Esempio n. 1
0
  protected void checkIfPathValid() {
    fFolder = null;
    IContainer folder = null;
    if (fUseFolderButton.isSelected()) {
      String pathStr = fContainerDialogField.getText();
      if (pathStr.length() == 0) {
        fContainerFieldStatus.setError(NewWizardMessages.NewSourceFolderDialog_error_enterpath);
        return;
      }
      IPath path = fCurrProject.getFullPath().append(pathStr);
      IWorkspace workspace = fCurrProject.getWorkspace();

      IStatus pathValidation = workspace.validatePath(path.toString(), IResource.FOLDER);
      if (!pathValidation.isOK()) {
        fContainerFieldStatus.setError(
            Messages.format(
                NewWizardMessages.NewSourceFolderDialog_error_invalidpath,
                pathValidation.getMessage()));
        return;
      }
      folder = fCurrProject.getFolder(pathStr);
    } else {
      folder = fCurrProject;
    }
    if (isExisting(folder)) {
      fContainerFieldStatus.setError(NewWizardMessages.NewSourceFolderDialog_error_pathexists);
      return;
    }
    fContainerFieldStatus.setOK();
    fFolder = folder;
  }
Esempio n. 2
0
 public static String toString(IWorkingSet[] workingSets) {
   Arrays.sort(workingSets, new WorkingSetComparator());
   String result = ""; // $NON-NLS-1$
   if (workingSets != null && workingSets.length > 0) {
     boolean firstFound = false;
     for (int i = 0; i < workingSets.length; i++) {
       String workingSetLabel = workingSets[i].getLabel();
       if (firstFound)
         result =
             Messages.format(
                 SearchMessages.SearchUtil_workingSetConcatenation,
                 new String[] {result, workingSetLabel});
       else {
         result = workingSetLabel;
         firstFound = true;
       }
     }
   }
   return result;
 }
Esempio n. 3
0
 /*
  * (non-Javadoc)
  *
  * @see org.eclipse.core.runtime.jobs.Job#run(org.eclipse.core.runtime.IProgressMonitor)
  */
 protected IStatus run(IProgressMonitor monitor) {
   synchronized (getClass()) {
     if (monitor.isCanceled()) {
       return Status.CANCEL_STATUS;
     }
     Job[] buildJobs = Job.getJobManager().find(ResourcesPlugin.FAMILY_MANUAL_BUILD);
     for (int i = 0; i < buildJobs.length; i++) {
       Job curr = buildJobs[i];
       if (curr != this && curr instanceof BuildJob) {
         BuildJob job = (BuildJob) curr;
         if (job.isCoveredBy(this)) {
           curr.cancel(); // cancel all other build jobs of
           // our kind
         }
       }
     }
   }
   try {
     if (fProject != null) {
       monitor.beginTask(
           Messages.format(DLTKUIMessages.CoreUtility_buildproject_taskname, fProject.getName()),
           2);
       fProject.build(IncrementalProjectBuilder.FULL_BUILD, new SubProgressMonitor(monitor, 1));
       DLTKUIPlugin.getWorkspace()
           .build(
               IncrementalProjectBuilder.INCREMENTAL_BUILD, new SubProgressMonitor(monitor, 1));
     } else {
       monitor.beginTask(DLTKUIMessages.CoreUtility_buildall_taskname, 2);
       DLTKUIPlugin.getWorkspace()
           .build(IncrementalProjectBuilder.FULL_BUILD, new SubProgressMonitor(monitor, 2));
     }
   } catch (CoreException e) {
     return e.getStatus();
   } catch (OperationCanceledException e) {
     return Status.CANCEL_STATUS;
   } finally {
     monitor.done();
   }
   return Status.OK_STATUS;
 }