Exemplo n.º 1
0
 @Override
 public void handleArtifactEvent(ArtifactEvent artifactEvent, Sender sender) {
   final Collection<EventBasicGuidArtifact> deletedPurgedArts =
       artifactEvent.get(EventModType.Deleted, EventModType.Purged);
   if (deletedPurgedArts.isEmpty()) {
     return;
   }
   Displays.ensureInDisplayThread(
       new Runnable() {
         @Override
         public void run() {
           if (getViewer() != null) {
             AbstractArtifactSearchResult results = getInput();
             if (results != null) {
               for (EventBasicGuidArtifact guidArt : deletedPurgedArts) {
                 for (Match match : results.getMatches(guidArt)) {
                   results.removeMatch(match);
                 }
               }
               getViewer().refresh();
             }
           }
         }
       });
 }
Exemplo n.º 2
0
  private Object getWindowLocalKey() {
    Object key;

    if (PlatformUI.isWorkbenchRunning()) {
      Displays.ensureInDisplayThread(windowKey);
      key = windowKey.getKey();
    } else {
      key = NON_WINDOW;
    }

    return key;
  }
 private void handleUserAuthenticated() {
   Displays.ensureInDisplayThread(
       new Runnable() {
         @Override
         public void run() {
           if (branchSelectEnabled != null
               && branchSelectEnabled.isDisposed() != true
               && isFeatureEnabled() != false) {
             handleBranchSelectEnabled(branchSelectEnabled.getSelection());
           }
         }
       });
 }
 public void setFeatureEnabled(final boolean isEnabled) {
   Displays.ensureInDisplayThread(
       new Runnable() {
         @Override
         public void run() {
           featureEnabled = isEnabled;
           handleBranchSelectEnabled(false);
           statusLabel.setText(featureEnabled != true ? FEATURE_DISABLED : "");
           setEnabled(featureEnabled);
           setSelectable(featureEnabled);
         }
       });
 }
Exemplo n.º 5
0
 public void clear(boolean forcePend) {
   Displays.ensureInDisplayThread(
       new Runnable() {
         @Override
         public void run() {
           if (Widgets.isAccessible(xViewer.getControl())) {
             xViewer.setInput(Collections.emptyList());
             xViewer.refresh();
           }
         };
       },
       forcePend);
 }
 private void setSelectable(final boolean isSelectable) {
   Displays.ensureInDisplayThread(
       new Runnable() {
         @Override
         public void run() {
           if (isSelectable != false) {
             stackedLayout.topControl = selectableComposite;
           } else {
             stackedLayout.topControl = statusComposite;
           }
           group.layout();
         }
       });
 }
    @Override
    public void run() {
      Displays.ensureInDisplayThread(
          new Runnable() {
            @Override
            public void run() {
              try {
                if (!runButton.isEnabled()) {
                  abortBatchButton.setEnabled(true);
                  abortButton.setEnabled(true);
                }
              } catch (Throwable th) {

              }
            }
          });
    }
 @Override
 public boolean onConnectionLost() {
   boolean result = getScriptManager().onConnectionLost();
   Displays.ensureInDisplayThread(
       new Runnable() {
         @Override
         public void run() {
           runButton.setEnabled(false);
           abortButton.setEnabled(false);
           abortBatchButton.setEnabled(false);
           scriptTable.onConnectionChanged(false);
           statusWindow.setValue(
               UpdateableLabel.HOSTLABEL.name(), NOT_CONNECTED, SWT.BOLD, SWT.COLOR_DARK_RED);
           statusWindow.refresh();
         }
       });
   return result;
 }
 public static void closeView(final String viewId, final String secondaryId) {
   if (Strings.isValid(viewId)) {
     Displays.ensureInDisplayThread(
         new Runnable() {
           @Override
           public void run() {
             IWorkbench workbench = PlatformUI.getWorkbench();
             if (workbench != null) {
               IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
               if (workbenchWindow != null) {
                 IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
                 if (workbenchPage != null) {
                   workbenchPage.hideView(workbenchPage.findViewReference(viewId, secondaryId));
                 }
               }
             }
           }
         });
   }
 }
 @Override
 public boolean onConnection(final ConnectionEvent event) {
   boolean result = getScriptManager().connect(event);
   Displays.ensureInDisplayThread(
       new Runnable() {
         @Override
         public void run() {
           runButton.setEnabled(true);
           abortButton.setEnabled(false);
           abortBatchButton.setEnabled(false);
           scriptTable.onConnectionChanged(true);
           statusWindow.setValue(
               UpdateableLabel.HOSTLABEL.name(),
               event.getProperties().getStation(),
               SWT.BOLD,
               SWT.COLOR_DARK_GREEN);
           statusWindow.refresh();
         }
       });
   return result;
 }