Java 类org.eclipse.core.commands.ExecutionException 实例源码

项目:vertigo-chroma-kspplugin    文件:OpenWsRouteHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    OpenDialogFactory.openDialog(new OpenDialogTemplate() {

        @Override
        public String getNature() {
            return "route";
        }

        @Override
        public Object[] getElements() {
            /* Charge les routes du cache du WsRouteManager. */
            return WsRouteManager.getInstance().getWorkspace().getWsRoutes().toArray();
        }
    });
    return null;
}
项目:vertigo-chroma-kspplugin    文件:OpenDaoHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    OpenDialogFactory.openDialog(new OpenDialogTemplate() {

        @Override
        public String getNature() {
            return "DAO/PAO method";
        }

        @Override
        public Object[] getElements() {
            /* Charge les DAO/PAO du cache du DaoManager. */
            return DaoManager.getInstance().getWorkspace().getDaoImplementations().toArray();
        }
    });
    return null;
}
项目: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;
}
项目:Tarski    文件:LoadSpecificationHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final MessageDialog warningdialog =
      new MessageDialog(MarkerActivator.getShell(), "Mark Information", null,
          "If new alloy file will be parsed , your all marker type will be lost !",
          MessageDialog.WARNING, new String[] {"OK", "Cancel"}, 0);
  if (warningdialog.open() != 0) {
    return null;
  }

  final String filePath = getFilePath();
  if (filePath == null) {
    return null;
  }
  AlloyParseUtil.parse(filePath);

  try {
    TraceManager.get().loadSpec(filePath);
  } catch (final TraceException e) {
    e.printStackTrace();
  }
  return null;
}
项目:RefDiff    文件:RunHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    //IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    try {
        IProject[] allProjects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
        TreeViewCommander tvc = new TreeViewCommander();

        for (IProject project1 : allProjects) {
            String name = project1.getName();
            if (name.endsWith("-v1")) {
                String baseName = name.substring(0, name.length() - 3);
                IProject project0 = find(allProjects, baseName + "-v0");
                tvc.detectRefactorings(project0, project1);
            }
        }
    } catch (Exception e) {
        System.err.println(e.getMessage());
        e.printStackTrace(System.err);
    }
    return null;
}
项目:gemoc-studio-modeldebugging    文件:CreateDSAProjectHandler.java   
@Override
public Object executeForSelectedLanguage(ExecutionEvent event,
        IProject updatedGemocLanguageProject, Language language)
        throws ExecutionException {
    CreateDSAWizardContextActionDSAK3 action = new CreateDSAWizardContextActionDSAK3(
            updatedGemocLanguageProject);
    action.createNewDSAProject(MelangeXDSMLProjectHelper.getFirstEcore(language));

    if(action.getLastCreatedProject() != null){
        waitForAutoBuild();

        Set<String> aspects = SequentialSingleLanguageTemplate.getAspectClassesList(action.getLastCreatedProject());

        updateMelange(event,language,aspects);
    }

    return null;
}
项目:gemoc-studio-modeldebugging    文件:CreateDomainModelProjectHandler.java   
@Override
public Object executeForSelectedLanguage(ExecutionEvent event,
        IProject updatedGemocLanguageProject, Language language)
        throws ExecutionException {
    CreateDomainModelWizardContextAction action = new CreateDomainModelWizardContextAction(
            updatedGemocLanguageProject); 
    action.actionToExecute = CreateDomainModelAction.CREATE_NEW_EMF_PROJECT;
    action.execute();

    if(action.getCreatedEcoreUri() != null){
        waitForAutoBuild();
        updateMelange(event,language,action.getCreatedEcoreUri());
    }

    return null;
}
项目:Hydrograph    文件:RemoveDebugHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    if (DebugHelper.INSTANCE.hasMoreWatchPoints()) {
        ELTGraphicalEditor editor = (ELTGraphicalEditor) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                .getActivePage().getActiveEditor();
        GraphicalViewer graphicalViewer = (GraphicalViewer) ((GraphicalEditor) editor)
                .getAdapter(GraphicalViewer.class);
        for (Iterator<EditPart> iterator = graphicalViewer.getEditPartRegistry().values().iterator(); iterator
                .hasNext();) {
            EditPart editPart = (EditPart) iterator.next();
            if (editPart instanceof ComponentEditPart) {
                Component comp = ((ComponentEditPart) editPart).getCastedModel();
                comp.clearWatchers();
            } else if (editPart instanceof PortEditPart) {
                ((PortEditPart) editPart).getPortFigure().removeWatcherColor();
                ((PortEditPart) editPart).getPortFigure().setWatched(false);
                ((PortEditPart) editPart).getCastedModel().setWatched(false);
            }
        }
        showMessage(Messages.WATCH_POINT_REMOVED_SUCCESSFULLY);
    } else {
        showMessage(Messages.NO_WATCH_POINT_AVAILABLE);
    }
    return null;

}
项目:neoscada    文件:ShowViewHandler.java   
@Override
public final Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked ( event );

    final Object value = event.getParameter ( PARAMETER_NAME_VIEW_ID );

    try
    {
        final String[] viewIds = ( (String)value ).split ( ":" );
        if ( viewIds.length == 1 )
        {
            openView ( viewIds[0], null, window );
        }
        else if ( viewIds.length == 2 )
        {
            openView ( viewIds[0], viewIds[1], window );
        }
    }
    catch ( final PartInitException e )
    {
        throw new ExecutionException ( "Part could not be initialized", e ); //$NON-NLS-1$
    }

    return null;
}
项目:neoscada    文件:OpenSignalGenerator.java   
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    for ( final Item item : getItems () )
    {
        GeneratorView view;
        try
        {
            view = (GeneratorView)getActivePage ().showView ( GeneratorView.VIEW_ID, asSecondardId ( item ), IWorkbenchPage.VIEW_ACTIVATE );
        }
        catch ( final PartInitException e )
        {
            throw new ExecutionException ( "Failed to open view", e );
        }
        view.setDataItem ( item );
    }

    return null;
}
项目:Tarski    文件:AlloyToEMFHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  final String alloyFilePath = MarkerPage.settings.get("alloyFile");
  try {
    TraceManager.get().loadSpec(alloyFilePath);
    final AlloyToEMF alloy2emf = new AlloyToEMF(alloyFilePath);
    alloy2emf.start();
    Display.getDefault().syncExec(new Runnable() {

      @Override
      public void run() {
        Visualization.showViz();
      }
    });
  } catch (final TraceException e) {
    final MessageDialog warningdialog = new MessageDialog(MarkerActivator.getShell(),
        "Alloy To EMF", null, e.getMessage(), MessageDialog.WARNING, new String[] {"OK"}, 0);
    if (warningdialog.open() != 0) {
      return null;
    }
  }
  return null;
}
项目:Tarski    文件:AddRemoveTypeHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  if (AlloyUtilities.isExists()) {
    candidateToTypeChanging = new ArrayList<IMarker>();
    file = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor()
        .getEditorInput().getAdapter(IFile.class);
    selection =
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection();
    editor =
        PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActiveEditor();
    selectedMarker = MarkUtilities.getLeaderOfMarker(getMarker());

    addRemoveType();
    if (Activator.getDefault().getWorkbench().getWorkbenchWindows()[0].getActivePage()
        .findView(Visualization.ID) != null) {
      Visualization.showViz();
    }
  } else {
    final MessageDialog infoDialog = new MessageDialog(MarkerActivator.getShell(),
        "System Information", null, "You dont have any registered alloy file to system.",
        MessageDialog.INFORMATION, new String[] {"Ok"}, 0);
    infoDialog.open();
  }
  return null;
}
项目:vertigo-chroma-kspplugin    文件:OpenServiceHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    OpenDialogFactory.openDialog(new OpenDialogTemplate() {

        @Override
        public String getNature() {
            return "service method";
        }

        @Override
        public Object[] getElements() {
            /* Charge les services du cache du ServiceManager. */
            return ServiceManager.getInstance().getWorkspace().getServiceImplementations().toArray();
        }
    });
    return null;
}
项目:neoscada    文件:ShowDetailDialog.java   
@SuppressWarnings ( "unchecked" )
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final String detailViewId = event.getParameter ( "org.eclipse.scada.vi.details.showDetailDialog.id" );
    final Map<String, String> parameters = (Map<String, String>)event.getObjectParameterForExecution ( "org.eclipse.scada.vi.details.showDetailDialog.parameters" );

    try
    {
        if ( this.useWaitShell )
        {
            openWithWaitShell ( getShell (), detailViewId, parameters );
        }
        else
        {
            open ( getShell (), detailViewId, parameters );
        }
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, "Failed to open detail view", e ), StatusManager.SHOW );
    }

    return null;
}
项目:neoscada    文件:OpenExplorerHandler.java   
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    try
    {
        // the following cast might look a bit weird. But first an adapter is requested and it only adapts to "core" connection services.
        final ConnectionService connectionService = (ConnectionService)SelectionHelper.first ( getSelection (), org.eclipse.scada.core.connection.provider.ConnectionService.class );
        final IViewPart view = getActivePage ().showView ( SummaryExplorerViewPart.VIEW_ID, "" + this.counter++, IWorkbenchPage.VIEW_ACTIVATE );

        ( (SummaryExplorerViewPart)view ).setConnectionService ( connectionService );
    }
    catch ( final PartInitException e )
    {
        throw new ExecutionException ( "Failed to open view", e );
    }
    return null;
}
项目:neoscada    文件:AbstractServerHandler.java   
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final MultiStatus ms = new MultiStatus ( HivesPlugin.PLUGIN_ID, 0, getLabel (), null );

    for ( final ServerLifecycle server : SelectionHelper.iterable ( getSelection (), ServerLifecycle.class ) )
    {
        try
        {
            process ( server );
        }
        catch ( final CoreException e )
        {
            ms.add ( e.getStatus () );
        }
    }
    if ( !ms.isOK () )
    {
        StatusManager.getManager ().handle ( ms, StatusManager.SHOW );
    }
    return null;
}
项目:neoscada    文件:FillFieldNumbersHandler.java   
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{

    final IEditorPart editor = getActivePage ().getActiveEditor ();

    byte b = (byte)1;
    for ( final Attribute attribute : SelectionHelper.iterable ( getSelection (), Attribute.class ) )
    {
        EditingDomain domain = AdapterFactoryEditingDomain.getEditingDomainFor ( attribute );

        if ( domain == null && editor instanceof IEditingDomainProvider )
        {
            domain = ( (IEditingDomainProvider)editor ).getEditingDomain ();
        }

        SetCommand.create ( domain, attribute, ProtocolPackage.Literals.ATTRIBUTE__FIELD_NUMBER, b ).execute ();

        b++;
    }

    return null;
}
项目: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;
}
项目:neoscada    文件:SetMasterHandler.java   
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final MasterSelectionDialog dlg;
    try
    {
        dlg = selectMaster ();
    }
    catch ( final CoreException e )
    {
        throw new ExecutionException ( "Failed to select driver", e );
    }

    if ( dlg != null )
    {
        setMaster ( dlg.getMaster (), dlg.getMode () );
    }
    return null;
}
项目:neoscada    文件:ShowComponentSpy.java   
@Override
public Object execute ( final ExecutionEvent event ) throws ExecutionException
{
    final Component component = SelectionHelper.first ( getSelection (), Component.class );
    if ( component == null )
    {
        return null;
    }

    try
    {
        final IObservableSet input = Helper.createObversableInput ( DisplayRealm.getRealm ( getShell ().getDisplay () ), component );
        new ComponentOutputDialog ( getShell (), input ).open ();
    }
    catch ( final Exception e )
    {
        StatusManager.getManager ().handle ( StatusHelper.convertStatus ( Activator.PLUGIN_ID, "Failed to generate component output", e ), StatusManager.BLOCK );
        throw new ExecutionException ( "Failed to generate component output", e );
    }

    return null;
}
项目:eclipse-bash-editor    文件:OpenWithBashEditor.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IFile file = getSelectedFile();
    if (file==null){
        return null;
    }
    IWorkbenchPage page = EclipseUtil.getActivePage();
    if (page==null){
        return null;
    }
    try {
        page.openEditor(new FileEditorInput(file), BashEditor.EDITOR_ID);
    } catch (PartInitException e) {
        throw new ExecutionException("Was not able to open bash editor for file:"+file.getName(),e);
    }
    return null;
}
项目:eclipse-plugin-commander    文件:ScaleTestHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    List<ResourceItem> files = createTestData();    

    FieldResolver<ResourceItem> nameResolver    = new FieldResolver<>("name",    resource -> resource.name);
    FieldResolver<ResourceItem> pathResolver    = new FieldResolver<>("path",    resource -> resource.path);
    FieldResolver<ResourceItem> projectResolver = new FieldResolver<>("project", resource -> resource.project);

    KaviPickListDialog<ResourceItem> finder = new KaviPickListDialog<>();
    finder.setListContentProvider("discovery", listContentProvider(listRankAndFilter(nameResolver, pathResolver, projectResolver), files))
          .setShowAllWhenNoFilter(false)
          .setDebounceTimeProvider(inputCommand -> inputCommand.countFilterableCharacters() > 2 ? 300:500)
          .addColumn(nameResolver.fieldId, nameResolver.fieldResolver).widthPercent(30)
          .addColumn(projectResolver.fieldId, projectResolver.fieldResolver).widthPercent(30).fontColor(155, 103, 4)
          .addColumn(pathResolver.fieldId, pathResolver.fieldResolver).widthPercent(40).italic().fontColor(100, 100, 100).backgroundColor(250, 250, 250);

    finder.setCurrentProvider("discovery");

    finder.setBounds(800, 400);
    finder.open();  
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:CompDefWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:InitAssmblWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Tarski    文件:EmfToAlloyHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  try {
    IFile file = AlloyParseUtil.getSelectedFile();
    if (file != null) {
      EMFToAlloy emfToAlloy = new EMFToAlloy(file);
      emfToAlloy.start();
    }
  } catch (IOException e) {
    final MessageDialog warningdialog =
        new MessageDialog(MarkerActivator.getShell(), "Alloy Example To EMF", null,
            e.getMessage(), MessageDialog.WARNING, new String[] {"OK"}, 0);
    if (warningdialog.open() != 0) {
      return null;
    }
    e.printStackTrace();
  }
  return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:FinalAssmblWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:Open_Source_ECOA_Toolset_AS5    文件:DeployWizardCommand.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
    }
    if (descriptor == null) {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
    }
    try {
        if (descriptor != null) {
            IWizard wizard = descriptor.createWizard();
            WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    } catch (CoreException e) {
        e.printStackTrace();
    }
    return null;
}
项目:gw4e.project    文件:ConvertToHandler.java   
public Object execute(ExecutionEvent event) throws ExecutionException {

        ISelection sel = HandlerUtil.getCurrentSelection(event);
        if (sel.isEmpty())
            return null;
        if (!(sel instanceof IStructuredSelection))
            return null;
        Object obj = ((IStructuredSelection) sel).getFirstElement();
        if (!(obj instanceof IFile))
            return null;

        try {
            ConvertToFileCreationWizard wizard = new ConvertToFileCreationWizard( );
            wizard.init(PlatformUI.getWorkbench(), (IStructuredSelection)sel);
            Shell activeShell = HandlerUtil.getActiveShell(event);
            if (activeShell==null) return null;
            WizardDialog dialog = new WizardDialog(activeShell,wizard);
            dialog.open();
        } catch (Exception e) {
            ResourceManager.logException(e);
        }

        return null;
    }
项目:TOSCA-Studio    文件:Main.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    // IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindowChecked(event);
    try {
        YamlReader reader = new YamlReader(new FileReader(
                "C:/Users/schallit/workspace-tosca/plugins/org.eclipse.cmf.occi.tosca.parser/tosca-types/normative-types.yml"));
        Map<String, ?> normativeTypesMap = (Map<String, ?>) reader.read();
        readYamlFile(normativeTypesMap);
        executeMapping();
        ExtensionsManager.save();

        ExtensionsManager.createExtendedTosca();
        Map<String, ?> customTypesMap = concatCustomAndAddedTypes();
        readYamlFile(customTypesMap);
        ExtensionsManager.save();

    } catch (Exception e) {
        throw new RuntimeException(e);
    }
    return null;
}
项目:Tarski    文件:CountMarkersInFileHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
  ISelection sel = Activator.getDefault().getWorkbench().getActiveWorkbenchWindow()
      .getSelectionService().getSelection();
  if (sel instanceof ITreeSelection) {
    ITreeSelection treeSel = (ITreeSelection) sel;
    if (treeSel.getFirstElement() instanceof IFile) {
      IFile file = (IFile) treeSel.getFirstElement();
      List<IMarker> markers = MarkerFactory.findMarkers(file);
      MessageDialog dialog = new MessageDialog(MarkerActivator.getShell(), "Marker Count", null,
          markers.size() + " marker(s)", MessageDialog.INFORMATION, new String[] {"OK"}, 0);
      dialog.open();
    }
  }
  return null;
}
项目:Tarski    文件:MarkerVisibilityHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
  this.decoratorManager = Activator.getDefault().getWorkbench().getDecoratorManager();

  if (!this.isHidden) {
    this.isHidden = true;
    this.setStore(false);
    this.setDecorator(false);
  } else {
    this.isHidden = false;
    this.setStore(true);
    this.setDecorator(true);
  }
  this.store.needsSaving();

  final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
  final ICommandService commandService = window.getService(ICommandService.class);
  if (commandService != null) {
    commandService.refreshElements(COMMAND_ID, null);
  }
  return null;
}
项目:vertigo-chroma-kspplugin    文件:OpenDtoHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    OpenDialogFactory.openDialog(new OpenDialogTemplate() {

        @Override
        public String getNature() {
            return "DTO";
        }

        @Override
        public Object[] getElements() {
            /* Charge les DTO du cache du DtoManager. */
            return DtoManager.getInstance().getWorkspace().getDtoFiles().toArray();
        }
    });

    return null;
}
项目:Hydrograph    文件:DeleteHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    IWorkbenchPart part = HandlerUtil.getActivePart(event);
    if(part instanceof CommonNavigator){
        DeleteAction action=new DeleteAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite());
        action.run();
    }

    else if (part instanceof ELTGraphicalEditor) {
        IEditorPart editor = HandlerUtil.getActiveEditor(event);
        ((ELTGraphicalEditor) editor).deleteSelection();
        ((ELTGraphicalEditor) editor).hideToolTip();
    }
    return null;
}
项目:n4js    文件:SelectAllProjectExplorer_PluginUITest.java   
/***/
@Test
public void testSelectAllCommand() throws ExecutionException {
    // Set projects as top level
    broker.setWorkingSetTopLevel(false);
    waitForIdleState();

    commonViewer.expandToLevel(2);
    waitForIdleState();

    // Make sure project explorer is in focus
    projectExplorer.setFocus();
    // Select all
    executeSelectAllCommand();
    waitForIdleState();

    // Test navigator selection to be complete
    StructuredSelection navigatorSelection = (StructuredSelection) commonViewer.getSelection();
    assertSelectionContainsAccessibleWorkspace(Arrays.asList(navigatorSelection.toArray()));

    assertContextMenuNoActionDuplicates();

    // Test context menu behavior
    assertContextMenuContains("Open Project", "Close Project");

    // If all is selected, there can't be unrelated projects
    assertContextMenuDoesNotContain("Close Unrelated Projects");
}
项目:n4js    文件:OpenTypeSelectionDialogHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    if (TYPE_SEARCH_IN_USE.compareAndSet(false, true)) {
        try {
            OpenTypeSelectionDialog typeSelectionDialog = provider.get();
            typeSelectionDialog.setInitialPattern(computeInitialPattern());
            typeSelectionDialog.open();
        } finally {
            TYPE_SEARCH_IN_USE.set(false);
        }
    }

    return null;
}
项目:n4js    文件:IgnoreNamedImportSpecifierHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Command cmd = event.getCommand();
    boolean currentState = HandlerUtil.toggleCommandState(cmd);
    N4JSReferenceQueryExecutor.ignoreNamedImportSpecifier = !currentState;
    return null;
}
项目:Hydrograph    文件:PasteHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    List<IFile> jobFiles = new ArrayList<>();
    List<IFile> pastedFileList = new ArrayList<>();
    IWorkbenchPart part = HandlerUtil.getActivePart(event);
    if(part instanceof CommonNavigator){
        PasteAction action = new PasteAction(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getActivePart().getSite());
        action.run();
        IWorkspaceRoot workSpaceRoot = ResourcesPlugin.getWorkspace().getRoot();
        IProject project = workSpaceRoot.getProject(JobCopyParticipant.getCopyToPath().split("/")[1]);
        IFolder jobFolder = project.getFolder(
                JobCopyParticipant.getCopyToPath().substring(JobCopyParticipant.getCopyToPath().indexOf('/', 2)));
        IFolder paramFolder = project.getFolder(PARAMETER_FOLDER_NAME);
        try {
            createCurrentJobFileList(jobFolder, jobFiles);
            pastedFileList=getPastedFileList(jobFiles);
            generateUniqueJobIdForPastedFiles(pastedFileList);
            createXmlFilesForPastedJobFiles(pastedFileList);
            List<String> copiedPropertiesList = getCopiedPropertiesList();
            createPropertiesFilesForPastedFiles(paramFolder, pastedFileList, copiedPropertiesList);
            JobCopyParticipant.cleanUpStaticResourcesAfterPasteOperation();

        } catch (CoreException  coreException) {
            logger.warn("Error while copy paste jobFiles",coreException.getMessage() );
        }

    }

    else if(part instanceof ELTGraphicalEditor){
        IEditorPart editor = HandlerUtil.getActiveEditor(event);
        ((ELTGraphicalEditor)editor).pasteSelection();
    }

    return null;
}
项目:n4js    文件:OpenExternalLibraryPreferencePageHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    Shell shell = HandlerUtil.getActiveShell(event);
    PreferenceDialog dialog = createPreferenceDialogOn(shell, ExternalLibraryPreferencePage.ID, FILTER_IDS, null);
    if (null != dialog) {
        dialog.open();
    }
    return null;
}
项目:n4js    文件:OpenGeneratedSourceInEditorHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {

    final ISelection selection = getCurrentSelection(event);
    if (null == selection) {
        return null;
    }

    if (selection.isEmpty()) {
        return null;
    }

    final AtomicReference<IFile> fileRef = new AtomicReference<>();

    if (selection instanceof IStructuredSelection) {
        final Object element = ((IStructuredSelection) selection).getFirstElement();
        if (element instanceof IFile) {
            fileRef.set((IFile) element);
        }
    } else if (selection instanceof ITextSelection) {
        final IEditorPart editorPart = getActiveEditor(event);
        if (null != editorPart) {
            final IEditorInput input = editorPart.getEditorInput();
            if (input instanceof IFileEditorInput) {
                fileRef.set(((IFileEditorInput) input).getFile());
            }
        }
    }

    if (null != fileRef.get()) {
        final Optional<IFile> generatedSource = fileLocator.tryGetGeneratedSourceForN4jsFile(fileRef.get());
        if (generatedSource.isPresent()) {
            tryOpenFileInEditor(fileRef.get(), generatedSource.get());
        }
    }

    return null;
}
项目:visuflow-plugin    文件:DebugStepResumeHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    EventAdmin ea = ServiceUtil.getService(EventAdmin.class);
    Event stepOver = new Event(EA_TOPIC_DEBUGGING_ACTION_RESUME, Collections.emptyMap());
    ea.sendEvent(stepOver);

    // has to be null (see javadoc)
    return null;
}