Ejemplo n.º 1
0
 private String formatLogicalPackageMessage(LogicalPackage logicalPackage) {
   IScriptFolder[] fragments = logicalPackage.getScriptFolders();
   StringBuffer buf = new StringBuffer(logicalPackage.getElementName());
   buf.append(ScriptElementLabels.CONCAT_STRING);
   String message = ""; // $NON-NLS-1$
   boolean firstTime = true;
   for (int i = 0; i < fragments.length; i++) {
     IScriptFolder fragment = fragments[i];
     IModelElement element = fragment.getParent();
     if (element instanceof IProjectFragment) {
       IProjectFragment root = (IProjectFragment) element;
       String label =
           ScriptElementLabels.getDefault()
               .getElementLabel(
                   root,
                   ScriptElementLabels.DEFAULT_QUALIFIED | ScriptElementLabels.ROOT_QUALIFIED);
       if (firstTime) {
         buf.append(label);
         firstTime = false;
       } else
         message =
             Messages.format(
                 ScriptBrowsingMessages.StatusBar_concat, new String[] {message, label});
     }
   }
   buf.append(message);
   return buf.toString();
 }
  private void updateStatus(HoverConfig hoverConfig) {
    if (hoverConfig != null && hoverConfig.fIsEnabled && hoverConfig.fStateMask == -1)
      fStatus =
          new StatusInfo(
              IStatus.ERROR,
              Messages.format(
                  PreferencesMessages.DLTKEditorHoverConfigurationBlock_modifierIsNotValid,
                  hoverConfig.fModifierString));
    else fStatus = new StatusInfo();

    int i = 0;
    HashMap stateMasks = new HashMap(fHoverConfigs.length);
    while (fStatus.isOK() && i < fHoverConfigs.length) {
      if (fHoverConfigs[i].fIsEnabled) {
        String label = getContributedHovers()[i].getLabel();
        Integer stateMask = Integer.valueOf(fHoverConfigs[i].fStateMask);
        if (fHoverConfigs[i].fStateMask == -1)
          fStatus =
              new StatusInfo(
                  IStatus.ERROR,
                  Messages.format(
                      PreferencesMessages
                          .DLTKEditorHoverConfigurationBlock_modifierIsNotValidForHover,
                      new String[] {fHoverConfigs[i].fModifierString, label}));
        else if (stateMasks.containsKey(stateMask))
          fStatus =
              new StatusInfo(
                  IStatus.ERROR,
                  Messages.format(
                      PreferencesMessages.DLTKEditorHoverConfigurationBlock_duplicateModifier,
                      new String[] {label, (String) stateMasks.get(stateMask)}));
        else stateMasks.put(stateMask, label);
      }
      i++;
    }

    fMainPreferencePage.setValid(fStatus.isOK());
    StatusUtil.applyToStatusLine(fMainPreferencePage, fStatus);
  }
Ejemplo n.º 3
0
 @Override
 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;
 }