currentWorkspace.deleteWorkflow(workflowName);
currentWorkspace.removeWorkflow(workflowName);
  public void importURL(final URL url)  {    Workspace space;    if(url==null)     	return;   	if (!(currentWorkspace instanceof Workspace))   	 	return;   	space = (Workspace)currentWorkspace;    	    StatusDisplay status = (StatusDisplay)WorkflowDesigner.INSTANCE.statusBar.getItemByName("Status");    String f = url.getFile();    if(!"file".equals(url.getProtocol()) && f.indexOf('?')>-1) f = f.substring(0, f.indexOf('?'));    String fileName = f.substring(f.lastIndexOf('/')+1, f.length());    try    {      final File outputFile = new File(space.getLocation().getParentFile(), fileName);      if(outputFile.isDirectory()) throw new Exception("Output file is a directory!");      //don't allow importing of files within the workspace!      if(!"file".equals(url.getProtocol()) ||        !new File(url.getFile()).getParentFile().getCanonicalPath().equals(space.getLocation().getParentFile().getCanonicalPath()))      {        status.setProgressStatus(ResourceManager.getString("import.progress", new Object[]{fileName}));        status.setIndeterminate(true);        Worker.post(new Task()        {          public Object run() throws Exception          {            FileOutputStream out = new FileOutputStream(outputFile);            InputStream in = url.openStream();            byte[] buff = new byte[4096];            int nch;            while((nch = in.read(buff, 0, buff.length)) != -1)            {              out.write(buff, 0, nch);            }            out.flush();            out.close();            return null;          }        });        String workflowName = fileName.substring(0, fileName.lastIndexOf('.'));        space.importDescriptor(workflowName, url.openStream());        //this ensures that the descriptor is loaded into the cache	      try	      {		      currentWorkspace.getWorkflow(workflowName);		      WorkflowDesigner.INSTANCE.navigator().setWorkspace(currentWorkspace);	      }	      catch(FactoryException e)	      {		      JOptionPane.showMessageDialog(WorkflowDesigner.INSTANCE, ResourceManager.getString("import.factory.error.long", new Object[]{fileName, e.getMessage()}),		                                    ResourceManager.getString("import.factory.error"), JOptionPane.ERROR_MESSAGE);		      currentWorkspace.deleteWorkflow(workflowName);	      }      }    }    catch(FactoryException ex)    {    }    catch(Exception t)    {      t.printStackTrace();    }    finally    {      status.setIndeterminate(false);      status.setStatus("");    }  }