Java 类org.eclipse.ui.services.ISourceProviderService 实例源码

项目:neoscada    文件:SessionManagerImpl.java   
@Override
public void setSession ( final LoginSession session )
{
    checkRealm ();

    if ( this.session != null )
    {
        this.session.dispose ();
    }

    this.session = session;

    if ( this.session != null )
    {
        this.session.register ();
    }

    for ( final IWorkbenchWindow window : PlatformUI.getWorkbench ().getWorkbenchWindows () )
    {
        final ISourceProviderService service = (ISourceProviderService)window.getService ( ISourceProviderService.class );
        final LoginSessionProvider sessionSourceProvider = (LoginSessionProvider)service.getSourceProvider ( LoginSessionProvider.SESSION_STATE );
        sessionSourceProvider.setLoginSession ( session );
    }

    super.setSession ( session );
}
项目:Tarski    文件:VizStopOtherSolutionHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  final ISourceProviderService service =
      activeWorkbenchWindow.getService(ISourceProviderService.class);
  final AnalysisSourceProvider sourceProvider =
      (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE);
  sourceProvider.setPassive();

  final Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
      AlloyValidator.isCanceled = true;
      AlloyOtherSolutionReasoning.getInstance().finish();
      AlloyOtherSolutionDiscovering.getInstance().finish();
      AlloyOtherSolutionReasoningForAtom.getInstance().finish();
      Visualization.showViz();
    }
  });
  thread.start();
  return true;
}
项目:Tarski    文件:OpenCloseEvaluatorHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  final ISourceProviderService service =
      activeWorkbenchWindow.getService(ISourceProviderService.class);
  final AnalysisSourceProvider sourceProvider =
      (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE);

  final Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
      if (sourceProvider.getEvaluationState() == EvaluationState.OPEN) {
        Visualization.evaluatorOpen = false;
        sourceProvider.setEvaluationState(EvaluationState.CLOSE);
      } else if (sourceProvider.getEvaluationState() == EvaluationState.CLOSE) {
        Visualization.evaluatorOpen = true;
        sourceProvider.setEvaluationState(EvaluationState.OPEN);
      }
      Visualization.showViz();
    }
  });
  thread.start();
  return true;
}
项目:Tarski    文件:VizDiscoverRelationsHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  final ISourceProviderService service =
      activeWorkbenchWindow.getService(ISourceProviderService.class);
  final AnalysisSourceProvider sourceProvider =
      (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE);
  sourceProvider.setActive(ReasoningType.DISCOVER_RELATION);

  final Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
      final AlloyReasoning alloyReasoning = new AlloyReasoning();
      final boolean reasoning = alloyReasoning.reasoning();
      if (!reasoning) {
        sourceProvider.setPassive();
      }

      Visualization.showViz();
    }
  });
  thread.start();
  return true;
}
项目:Tarski    文件:VizDiscoverAtomsHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  final ISourceProviderService service =
      activeWorkbenchWindow.getService(ISourceProviderService.class);
  final AnalysisSourceProvider sourceProvider =
      (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE);
  sourceProvider.setActive(ReasoningType.DISCOVER_ATOM);

  final Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
      final AlloyDiscovering alloyDiscovering = new AlloyDiscovering();
      final boolean discovering =
          alloyDiscovering.discovering();
      if (!discovering) {
        Visualization.sourceProvider.setPassive();
      }
      Visualization.showViz();
    }
  });
  thread.start();
  return true;
}
项目:WP3    文件:VizStopOtherSolutionHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  final ISourceProviderService service =
      activeWorkbenchWindow.getService(ISourceProviderService.class);
  final AnalysisSourceProvider sourceProvider =
      (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE);
  sourceProvider.setPassive();

  final Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
      AlloyValidator.isCanceled = true;
      AlloyOtherSolutionReasoning.getInstance().finish();
      AlloyOtherSolutionDiscovering.getInstance().finish();
      AlloyOtherSolutionReasoningForAtom.getInstance().finish();
      Visualization.showViz();
    }
  });
  thread.start();
  return true;
}
项目:WP3    文件:OpenCloseEvaluatorHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  final ISourceProviderService service =
      activeWorkbenchWindow.getService(ISourceProviderService.class);
  final AnalysisSourceProvider sourceProvider =
      (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE);

  final Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
      if (sourceProvider.getEvaluationState() == EvaluationState.OPEN) {
        Visualization.evaluatorOpen = false;
        sourceProvider.setEvaluationState(EvaluationState.CLOSE);
      } else if (sourceProvider.getEvaluationState() == EvaluationState.CLOSE) {
        Visualization.evaluatorOpen = true;
        sourceProvider.setEvaluationState(EvaluationState.OPEN);
      }
      Visualization.showViz();
    }
  });
  thread.start();
  return true;
}
项目:WP3    文件:VizDiscoverRelationsHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  final ISourceProviderService service =
      activeWorkbenchWindow.getService(ISourceProviderService.class);
  final AnalysisSourceProvider sourceProvider =
      (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE);
  sourceProvider.setActive(ReasoningType.DISCOVER_RELATION);

  final Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
      final AlloyReasoning alloyReasoning = new AlloyReasoning();
      final boolean reasoning = alloyReasoning.reasoning();
      if (!reasoning) {
        sourceProvider.setPassive();
      }

      Visualization.showViz();
    }
  });
  thread.start();
  return true;
}
项目:WP3    文件:VizDiscoverAtomsHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final IWorkbenchWindow activeWorkbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
  final ISourceProviderService service =
      activeWorkbenchWindow.getService(ISourceProviderService.class);
  final AnalysisSourceProvider sourceProvider =
      (AnalysisSourceProvider) service.getSourceProvider(AnalysisSourceProvider.ANALYSIS_STATE);
  sourceProvider.setActive(ReasoningType.DISCOVER_ATOM);

  final Thread thread = new Thread(new Runnable() {
    @Override
    public void run() {
      final AlloyDiscovering alloyDiscovering = new AlloyDiscovering();
      final boolean discovering =
          alloyDiscovering.discovering();
      if (!discovering) {
        Visualization.sourceProvider.setPassive();
      }
      Visualization.showViz();
    }
  });
  thread.start();
  return true;
}
项目:yamcs-studio    文件:ArchiveView.java   
public boolean isRefreshEnabled() {
    // Not necessarily on the SWT thread. This is a bit of a risk. Maybe we should do a blocking Display.getDefault().syncExec
    IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
    ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
    RefreshStateProvider commandState = (RefreshStateProvider) service.getSourceProvider(RefreshStateProvider.STATE_KEY_ENABLED);
    return (Boolean) commandState.getCurrentState().get(RefreshStateProvider.STATE_KEY_ENABLED);
}
项目:yamcs-studio    文件:ArchiveView.java   
public void setRefreshEnabled(boolean enabled) {
    // Back to the SWT thread, to be sure
    Display.getDefault().asyncExec(() -> {
        IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
        ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
        RefreshStateProvider commandState = (RefreshStateProvider) service.getSourceProvider(RefreshStateProvider.STATE_KEY_ENABLED);
        commandState.setEnabled(enabled);
    });
}
项目:yamcs-studio    文件:ArchiveView.java   
public void setZoomInEnabled(boolean enabled) {
    // Back to the SWT thread, to be sure
    Display.getDefault().asyncExec(() -> {
        IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
        ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
        ZoomInStateProvider commandState = (ZoomInStateProvider) service.getSourceProvider(ZoomInStateProvider.STATE_KEY_ENABLED);
        commandState.setEnabled(enabled);
    });
}
项目:yamcs-studio    文件:ArchiveView.java   
public void setZoomOutEnabled(boolean enabled) {
    // Back to the SWT thread, to be sure
    Display.getDefault().asyncExec(() -> {
        IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
        ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
        ZoomOutStateProvider commandState = (ZoomOutStateProvider) service.getSourceProvider(ZoomOutStateProvider.STATE_KEY_ENABLED);
        commandState.setEnabled(enabled);
    });
}
项目:yamcs-studio    文件:ArchiveView.java   
public void setZoomClearEnabled(boolean enabled) {
    // Back to the SWT thread, to be sure
    Display.getDefault().asyncExec(() -> {
        IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
        ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
        ClearZoomStateProvider commandState = (ClearZoomStateProvider) service.getSourceProvider(ClearZoomStateProvider.STATE_KEY_ENABLED);
        commandState.setEnabled(enabled);
    });
}
项目:yamcs-studio    文件:ArchiveView.java   
public boolean isTagEnabled() {
    IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
    ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
    AnnotateRangeStateProvider commandState = (AnnotateRangeStateProvider) service
            .getSourceProvider(AnnotateRangeStateProvider.STATE_KEY_ENABLED);
    return (Boolean) commandState.getCurrentState().get(AnnotateRangeStateProvider.STATE_KEY_ENABLED);
}
项目:yamcs-studio    文件:ArchiveView.java   
public void setTagEnabled(boolean enabled) {
    // Back to the SWT thread, to be sure
    Display.getDefault().asyncExec(() -> {
        IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
        ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
        AnnotateRangeStateProvider commandState = (AnnotateRangeStateProvider) service
                .getSourceProvider(AnnotateRangeStateProvider.STATE_KEY_ENABLED);
        commandState.setEnabled(enabled);
    });
}
项目:hssd    文件:MultiDiffView.java   
private HSSDEditor getHSSDEditor() {
    final ISourceProviderService svc = Helper.getSPSvc();
    final HSSDEditorSourceProvider sp = Helper.getHSSDEditorSP(svc);
    final IEditorPart ep = sp.getEditor();
    if(!(ep instanceof HSSDEditor)) {
        return null;
    }

    return (HSSDEditor)ep;
}
项目:hssd    文件:EntrySearchResultPage.java   
private HSSDEditor getHSSDEditor() {
    final ISourceProviderService svc = Helper.getSPSvc();
    final HSSDEditorSourceProvider sp = Helper.getHSSDEditorSP(svc);
    final IEditorPart ep = sp.getEditor();
    if(!(ep instanceof HSSDEditor)) {
        return null;
    }

    return (HSSDEditor)ep;
}
项目:hssd    文件:Helper.java   
public static HSSDEditor getLastHSSDEditor() {
    final ISourceProviderService svc = getSPSvc();
    final HSSDEditorSourceProvider sp = getHSSDEditorSP(svc);
    final IEditorPart ep = sp.getEditor();
    if(!(ep instanceof HSSDEditor)) {
        return null;
    }

    return (HSSDEditor)ep;
}
项目:hssd    文件:Helper.java   
@SuppressWarnings("unchecked")
public static <T extends ISourceProvider> T getSP(
        ISourceProviderService svc,
        String var
        ) {
    return (T)svc.getSourceProvider(var);
}
项目:PDFReporter-Studio    文件:SwitchLanguageHandler.java   
/**
 * Execute the command, read the regional code from the parameter passed by the plugin file and
 * call the method to write the regional code to the configuration. If the configuration is modified
 * than call a restart
 */
public Object execute(ExecutionEvent event) throws ExecutionException {
    String locale = event.getParameter("com.jaspersoft.studio.switchlanguage.locale"); //$NON-NLS-1$
    boolean needToRestart = changeLocale(locale);
    if (needToRestart) {
        MessageDialog dialog = new MessageDialog(UIUtils.getShell(), Messages.SwitchLanguageHandler_restartTitle, null,
                Messages.SwitchLanguageHandler_restartMessage, MessageDialog.QUESTION, new String[] { Messages.common_yes , Messages.common_no}, 1); 
        int selection = dialog.open();
        if (selection == 0){
            //Some OS (linux\mac) dosen't reload the configuration file after the restart. So when eclipse is 
            //re-launched it is done with the -nl parameter to the new locale. Essentially it's like it is launched
            //from command line with the explicit nl parameter
            String command_line = buildCommandLine(locale);
            System.setProperty(PROP_EXIT_DATA, command_line);
            System.setProperty(PROP_EXIT_CODE, IApplication.EXIT_RELAUNCH.toString());
            return new RestartWorkbenchHandler().execute(event);
        } else {
            //Request an update of the locale provider and force the update of the menu item, in this way the language
            //menu is show updated even without a restart
            IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
            ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
            LocaleSourceProvider sessionSourceProvider = (LocaleSourceProvider) service.getSourceProvider(LocaleSourceProvider.ACTUAL_LOCALE);
            sessionSourceProvider.forceRefreshLocale();
            ICommandService commandService = (ICommandService)window.getService(ICommandService.class); 
            commandService.refreshElements("com.jaspersoft.studio.switchlanguage.command", null);
        }
    }
    return null;
}
项目:gama    文件:SwtGui.java   
@Override
public void updateExperimentState(final IScope scope, final String forcedState) {
    // System.out.println("STATE: " + forcedState);
    final ISourceProviderService service = WorkbenchHelper.getService(ISourceProviderService.class);
    final ISimulationStateProvider stateProvider = (ISimulationStateProvider) service
            .getSourceProvider("ummisco.gama.ui.experiment.SimulationRunningState");
    // stateProvider.updateStateTo(forcedState);
    if (stateProvider != null) {
        WorkbenchHelper.run(() -> stateProvider.updateStateTo(forcedState));
    }

    WorkbenchHelper.run(() -> {
        WorkbenchHelper.getWindow().getShell().forceActive();
    });
}
项目:yamcs-studio    文件:LifeCycleManager.java   
private void doUpdateGlobalProcessingState(IWorkbench workbench, ProcessorInfo processorInfo) {
    ISourceProviderService service = (ISourceProviderService) workbench.getService(ISourceProviderService.class);
    ProcessorStateProvider state = (ProcessorStateProvider) service.getSourceProvider(ProcessorStateProvider.STATE_KEY_PROCESSING);
    state.updateState(processorInfo);
}
项目:yamcs-studio    文件:ArchiveView.java   
public boolean isZoomInEnabled() {
    IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
    ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
    ZoomInStateProvider commandState = (ZoomInStateProvider) service.getSourceProvider(ZoomInStateProvider.STATE_KEY_ENABLED);
    return (Boolean) commandState.getCurrentState().get(ZoomInStateProvider.STATE_KEY_ENABLED);
}
项目:yamcs-studio    文件:ArchiveView.java   
public boolean isZoomOutEnabled() {
    IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
    ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
    ZoomOutStateProvider commandState = (ZoomOutStateProvider) service.getSourceProvider(ZoomOutStateProvider.STATE_KEY_ENABLED);
    return (Boolean) commandState.getCurrentState().get(ZoomOutStateProvider.STATE_KEY_ENABLED);
}
项目:yamcs-studio    文件:ArchiveView.java   
public boolean isZoomClearEnabled() {
    IWorkbenchWindow window = getViewSite().getWorkbenchWindow();
    ISourceProviderService service = (ISourceProviderService) window.getService(ISourceProviderService.class);
    ClearZoomStateProvider commandState = (ClearZoomStateProvider) service.getSourceProvider(ClearZoomStateProvider.STATE_KEY_ENABLED);
    return (Boolean) commandState.getCurrentState().get(ClearZoomStateProvider.STATE_KEY_ENABLED);
}
项目:yamcs-studio    文件:RCPUtils.java   
/**
 * Finds a source provider using the specified locator (for example, a
 * workbench window)
 */
@SuppressWarnings("unchecked")
public static <T> T findSourceProvider(IServiceLocator locator, String sourceName, Class<T> expectedClass) {
    ISourceProviderService service = (ISourceProviderService) locator.getService(ISourceProviderService.class);
    return (T) service.getSourceProvider(sourceName);
}
项目:hssd    文件:EditorSelectionSP.java   
private void updateSelection(ISelection sel) {
    final ISourceProviderService svc = Helper.getSPSvc();
    final IEditorSelectionSP sp = Helper.getSP(svc, var);
    sp.updateSelection(editor, sel);
}
项目:hssd    文件:Helper.java   
public static ISourceProviderService getSPSvc(ExecutionEvent event) {
    final IWorkbenchWindow window = 
            HandlerUtil.getActiveWorkbenchWindow(event);
    final Object svc = window.getService(ISourceProviderService.class);
    return (ISourceProviderService)svc;
}
项目:hssd    文件:Helper.java   
public static EntryEditorSourceProvider getEntryEditorSP(
        ISourceProviderService spSvc) {
    final String srcName = EntryEditorSourceProvider.VAR_ENTRY_SELECTION;
    final ISourceProvider sp = spSvc.getSourceProvider(srcName);
    return (EntryEditorSourceProvider)sp;
}
项目:hssd    文件:Helper.java   
public static HSSDEditorSourceProvider getHSSDEditorSP(
        ISourceProviderService spSvc) {
    final String srcName = HSSDEditorSourceProvider.VAR_HSSD_SELECTION;
    final ISourceProvider sp = spSvc.getSourceProvider(srcName);
    return (HSSDEditorSourceProvider)sp;
}
项目:hssd    文件:Helper.java   
@SuppressWarnings("unchecked")
public static <T> T getSPSvc() {
    return (T)getWB().getService(ISourceProviderService.class);
}