Package com.projity.job

Examples of com.projity.job.Job


   * @param allowCancel
   * @param prompt
   * @return null if cancelled
   */
  public Job getRemoveProjectJob(final Project project, boolean allowCancel, boolean prompt,boolean calledFromSwing) {
    Job job=null;
    if (prompt && project.needsSaving()) {
//      final boolean[] lock=new boolean[]{false};
//        SwingUtilities.invokeLater(new Runnable(){
//          public void run(){
//            Alert.okCancel("test");
//            synchronized (lock) {
//              lock[0]=true;
//              lock.notifyAll();
//            }
//            }
//        });
//      synchronized(lock){
//        while (!lock[0]){
//          try{
//              lock.wait();
//            }catch (InterruptedException e) {}
//        }
//      }

      int promptResult = promptForSave(project,allowCancel);
      if (promptResult == JOptionPane.YES_OPTION){
        SaveOptions opt=new SaveOptions();
        opt.setLocal(project.isLocal());
        if (project.isLocal()){
          String fileName=project.getFileName();
          if (fileName==null){
            fileName=SessionFactory.getInstance().getLocalSession().chooseFileName(true,project.getGuessedFileName());
          }
          if (fileName==null) return null;
          project.setFileName(fileName);
          opt.setFileName(fileName);
          opt.setImporter(LocalSession.getImporter(project.getFileType()));
        }
        job=getSaveProjectJob(project, opt);
      }
      else if (promptResult == JOptionPane.CANCEL_OPTION)
        return null;
    }

    final ArrayList toRemove = new ArrayList();
    final ArrayList projects=new ArrayList();
    DeepChildWalker.recursivelyTreatBranch(portfolio.getNodeModel(), project,  new Closure() {
      public void execute(Object arg0) {
        Node node = (Node)arg0;
        Object impl = node.getImpl();
        if (!(impl instanceof Project))
          return;
        final Project p = (Project)impl;
        toRemove.add(node);
        if (Environment.getStandAlone()||project.isLockable()){
          projects.add(p);
        }
      }
    });


    Job closeProjectJob=getCloseProjectsOnServerJob(projects);
    if (closeProjectJob==null){
      closeProjectJob=new Job(SessionFactory.getInstance().getJobQueue(),"closeProjects","Closing...",false);

    }
    if (job==null) job=closeProjectJob;
    else job.addJob(closeProjectJob);

View Full Code Here


    },/*!calledFromSwing*/false,false,calledFromSwing,false);
    return job;
  }

  public void removeProject(final Project project, boolean allowCancel, boolean prompt,boolean calledFromSwing) {
    Job job=getRemoveProjectJob(project,allowCancel,prompt,calledFromSwing);
    if (job != null) { // if not cancelled
      Session session=SessionFactory.getInstance().getSession(project.isLocal());
      session.schedule(job);
    }
  }
View Full Code Here

      session.schedule(job);
    }
  }

  public void doRemoveProject(Project project,boolean calledFromSwing) {
    Job job=projectFactory.getPortfolio().getRemoveProjectJob(project,calledFromSwing);
    if (job!=null) {
      SessionFactory.getInstance().getSession(project.isLocal()).schedule(job);
      portfolio.handleExternalTasks(project,false, false);     // external link handling
    }
View Full Code Here

TOP

Related Classes of com.projity.job.Job

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.