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

项目:mesfavoris    文件:BookmarksView.java   
private void hookDoubleClickAction() {
    bookmarksTreeViewer.addDoubleClickListener(event -> {
        ISelection selection = bookmarksTreeViewer.getSelection();
        Object firstElement = ((IStructuredSelection) selection).getFirstElement();
        Bookmark bookmark = Adapters.adapt(firstElement, Bookmark.class);
        if (bookmark instanceof BookmarkFolder) {
            bookmarksTreeViewer.setExpandedState(firstElement, !bookmarksTreeViewer.getExpandedState(firstElement));
        } else {
            // sometimes, selection and part in the command handler are not set to the boomarks view when we double-click on a bookmark
            getSite().getWorkbenchWindow().getActivePage().activate(this);
            IHandlerService handlerService = (IHandlerService) getSite().getService(IHandlerService.class);
            try {
                handlerService.executeCommand(COMMAND_ID_GOTO_FAVORI, null);
            } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
                StatusHelper.logError("Could not go to bookmark", e);
            }
        }
    });
}
项目:hssd    文件:DropEntryHandler.java   
@Override
public boolean performDrop(Object data) {
    IServiceLocator locator = Helper.getWB();
    ICommandService svc = (ICommandService)locator.getService(
            ICommandService.class);
    Command cmd = svc.getCommand(CMD_ID_MOVE_ENTRY);

    Map<String, String> params = new HashMap<>();

    params.put("source", data.toString());

    TreeNode en = (TreeNode)getCurrentTarget();
    EntryData ed = EntryData.of(en);
    params.put("target", String.valueOf(ed.entryID()));

    try {
        cmd.executeWithChecks(
                new ExecutionEvent(cmd, params, getCurrentEvent(), null));
    } catch (ExecutionException | NotDefinedException | NotEnabledException
            | NotHandledException e) {
        throw new RuntimeException(e);
    }
    return true;
}
项目:mondo-collab-framework    文件:MACLIncQueryGenerator.java   
private boolean callRuleGenerationCommand(EPackage ePack, PatternInstance pattern, IPath iPath) {
    IServiceLocator serviceLocator = PlatformUI.getWorkbench();
    ICommandService commandService = serviceLocator.getService(ICommandService.class);
    IHandlerService handlerService = serviceLocator.getService(IHandlerService.class);
    Command command = commandService.getCommand("org.mondo.collaboration.security.macl.tao.generation.rule");
    try {
        IParameter parameter = command.getParameter(MACLCommandContext.ID);
        String contextId = UUID.randomUUID().toString();
        Activator.put(contextId, context);
        Parameterization parameterization = new Parameterization(parameter, contextId);
        ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command, new Parameterization[] { parameterization });
        return (Boolean) handlerService.executeCommand(parameterizedCommand, null);

    } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e1) {
        return false;
    }
}
项目:mondo-collab-framework    文件:MACLPatternImplementation.java   
@Override
public boolean execute(EPackage ePack, PatternInstance pattern, IPath iPath) {
    IServiceLocator serviceLocator = PlatformUI.getWorkbench();
    ICommandService commandService = serviceLocator.getService(ICommandService.class);
    IHandlerService handlerService = serviceLocator.getService(IHandlerService.class);
    Command command = commandService.getCommand("org.mondo.collaboration.security.macl.tao.generation");
    try {
        IParameter parameter = command.getParameter(MACLCommandContext.ID);
        MACLCommandContext context = new MACLCommandContext(ePack, pattern, iPath);
        String contextId = UUID.randomUUID().toString();
        Activator.put(contextId, context);
        Parameterization parameterization = new Parameterization(parameter, contextId);
        ParameterizedCommand parameterizedCommand = new ParameterizedCommand(command, new Parameterization[] { parameterization });
        return (Boolean) handlerService.executeCommand(parameterizedCommand, null);

    } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e1) {
        return false;
    }
}
项目:e4macs    文件:EmacsPlusUtils.java   
private static Object executeCommand(String commandId, Map<String,?> parameters, Event event, ICommandService ics, IHandlerService ihs)
throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException, CommandException {
    Object result = null;
    if (ics != null && ihs != null) {
        Command command = ics.getCommand(commandId);
        if (command != null) {
            try {
                MarkUtils.setIgnoreDispatchId(true);
                ParameterizedCommand pcommand = ParameterizedCommand.generateCommand(command, parameters);
                if (pcommand != null) {
                    result = ihs.executeCommand(pcommand, event);
                }
            } finally {
                MarkUtils.setIgnoreDispatchId(false);
            }       
        }
    }
    return result;
}
项目:LinGUIne    文件:SelectCommandWizard.java   
@Override
public boolean performFinish() {
    String selectedOption = wizardPage.getSelectedOption();
    String commandId = commandOptions.get(selectedOption);
    Command selectedCommand = commandService.getCommand(commandId);

    try{
        selectedCommand.executeWithChecks(new ExecutionEvent());
    }
    catch(ExecutionException | NotDefinedException
            | NotEnabledException | NotHandledException e){
        MessageDialog.openError(getShell(), "Error", "The selected Command"
                + " could not be executed successfully.");

        return false;
    }

    return true;
}
项目:elexis-3-core    文件:DocumentLocalEditHandler.java   
private void createEvent(Command command, IPersistentObject po){
    IStructuredSelection iStructuredSelection = null;
    if (po != null) {
        iStructuredSelection = new StructuredSelection(po);
    }
    PlatformUI.getWorkbench().getService(IEclipseContext.class)
        .set(command.getId().concat(".selection"),
        iStructuredSelection);
    try {
        command.executeWithChecks(
            new ExecutionEvent(command, Collections.EMPTY_MAP, this, null));
    } catch (ExecutionException | NotDefinedException | NotEnabledException
            | NotHandledException e) {
        logger.error("cannot executre local edit event", e);
    }
}
项目:elexis-3-core    文件:EditLocalDocumentUtil.java   
/**
 * If {@link Preferences#P_TEXT_EDIT_LOCAL} is set, the
 * <code> ch.elexis.core.ui.command.startEditLocalDocument </code> command is called with the
 * provided {@link Brief}, and the provided {@link IViewPart} is hidden.
 * 
 * @param view
 * @param brief
 * @return returns true if edit local is started and view is hidden
 */
public static boolean startEditLocalDocument(IViewPart view, Brief brief){
    if (CoreHub.localCfg.get(Preferences.P_TEXT_EDIT_LOCAL, false) && brief != null) {
        // open for editing
        ICommandService commandService =
            (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
        Command command =
            commandService.getCommand("ch.elexis.core.ui.command.startEditLocalDocument"); //$NON-NLS-1$

        PlatformUI.getWorkbench().getService(IEclipseContext.class)
            .set(command.getId().concat(".selection"), new StructuredSelection(brief));
        try {
            command.executeWithChecks(
                new ExecutionEvent(command, Collections.EMPTY_MAP, view, null));
        } catch (ExecutionException | NotDefinedException | NotEnabledException
                | NotHandledException e) {
            MessageDialog.openError(view.getSite().getShell(), Messages.TextView_errortitle,
                Messages.TextView_errorlocaleditmessage);
        }
        view.getSite().getPage().hideView(view);
        return true;
    }
    return false;
}
项目:elexis-3-core    文件:XrefExtension.java   
private void startLocalEdit(Brief brief){
    if (brief != null) {
        ICommandService commandService =
            (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
        Command command =
            commandService.getCommand("ch.elexis.core.ui.command.startEditLocalDocument"); //$NON-NLS-1$

        PlatformUI.getWorkbench().getService(IEclipseContext.class)
            .set(command.getId().concat(".selection"), new StructuredSelection(brief));
        try {
            command.executeWithChecks(
                new ExecutionEvent(command, Collections.EMPTY_MAP, this, null));
        } catch (ExecutionException | NotDefinedException | NotEnabledException
                | NotHandledException e) {
            MessageDialog.openError(Display.getDefault().getActiveShell(),
                Messages.BriefAuswahl_errorttile,
                Messages.BriefAuswahl_erroreditmessage);
        }
    }
}
项目:elexis-3-core    文件:LocalDocumentsDialog.java   
private void endLocalEdit(StructuredSelection selection){
    ICommandService commandService =
        (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    Command command = commandService.getCommand("ch.elexis.core.ui.command.endLocalDocument"); //$NON-NLS-1$

    PlatformUI.getWorkbench().getService(IEclipseContext.class)
        .set(command.getId().concat(".selection"), selection);
    try {
        command
            .executeWithChecks(new ExecutionEvent(command, Collections.EMPTY_MAP, this, null));
        tableViewer.setInput(service.getAll());
    } catch (ExecutionException | NotDefinedException | NotEnabledException
            | NotHandledException e) {
        MessageDialog.openError(getShell(), Messages.LocalDocumentsDialog_errortitle,
            Messages.LocalDocumentsDialog_errorendmessage);
    }
}
项目:elexis-3-core    文件:LocalDocumentsDialog.java   
private void abortLocalEdit(StructuredSelection selection){
    ICommandService commandService =
        (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class);
    Command command = commandService.getCommand("ch.elexis.core.ui.command.abortLocalDocument"); //$NON-NLS-1$

    PlatformUI.getWorkbench().getService(IEclipseContext.class)
        .set(command.getId().concat(".selection"), selection);
    try {
        command.executeWithChecks(new ExecutionEvent(command, Collections.EMPTY_MAP, this, null));
        tableViewer.setInput(service.getAll());
    } catch (ExecutionException | NotDefinedException | NotEnabledException
            | NotHandledException e) {
        MessageDialog.openError(getShell(), Messages.LocalDocumentsDialog_errortitle,
            Messages.LocalDocumentsDialog_errorabortmessage);
    }
}
项目:elexis-3-base    文件:OutboxSendHandler.java   
private boolean openSendMailDlg(Patient patient, List<?> iOutboxElements,
    ICommandService commandService,
    String attachmentsString)
    throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException{
    Command sendMailCommand =
        commandService.getCommand("ch.elexis.core.mail.ui.sendMail");

    HashMap<String, String> params = new HashMap<String, String>();
    params.put("ch.elexis.core.mail.ui.sendMail.attachments", attachmentsString);
    if (patient != null) {
        params.put("ch.elexis.core.mail.ui.sendMail.subject",
            "Patient: " + patient.getLabel());
    }

    ParameterizedCommand parametrizedCommmand =
        ParameterizedCommand.generateCommand(sendMailCommand, params);

    Object obj = PlatformUI.getWorkbench().getService(IHandlerService.class)
        .executeCommand(parametrizedCommmand, null);
    return Boolean.TRUE.equals(obj);
}
项目:elexis-3-base    文件:SetStatusContributionItem.java   
private void setStatus(String statusId){
    ICommandService commandService = (ICommandService) PlatformUI.getWorkbench()
        .getActiveWorkbenchWindow().getService(ICommandService.class);
    Command command =
        commandService.getCommand("at.medevit.elexis.agenda.ui.command.setStatus");

    HashMap<String, String> parameters = new HashMap<String, String>();
    parameters.put("at.medevit.elexis.agenda.ui.command.parameter.statusId", statusId);
    ExecutionEvent ev = new ExecutionEvent(command, parameters, null, null);
    try {
        command.executeWithChecks(ev);
    } catch (ExecutionException | NotDefinedException | NotEnabledException
            | NotHandledException ex) {
        LoggerFactory.getLogger(getClass()).error("Error setting status", ex);
    }
}
项目:pgcodekeeper    文件:ProjectEditorDiffer.java   
private void callEgitCommitCommand(){
    if (!isCommitCommandAvailable || !mainPrefs.getBoolean(PREF.CALL_COMMIT_COMMAND_AFTER_UPDATE)){
        return;
    }
    try {
        getSite().getSelectionProvider().setSelection(new StructuredSelection(proj.getProject()));
        getSite().getService(IHandlerService.class).executeCommand(COMMAND.COMMIT_COMMAND_ID, null);
    } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
        Log.log(Log.LOG_WARNING, "Could not execute command " + COMMAND.COMMIT_COMMAND_ID, e); //$NON-NLS-1$
        ExceptionNotifier.notifyDefault(Messages.ProjectEditorDiffer_failed_egit_commit, e);
    }
}
项目:Hydrograph    文件:GraphRuntimePropertiesAction.java   
@Override
public void run() {
    IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getActiveWorkbenchWindow().getService(IHandlerService.class);
    try {
      handlerService.executeCommand(Constants.GRAPH_PROPERTY_COMMAND_ID, null);
      } catch ( ExecutionException| NotDefinedException| NotEnabledException| NotHandledException ex) {
        throw new RuntimeException(Constants.GRAPH_PROPERTY_COMMAND_ID + "not found");

        }
}
项目:afbb-bibo    文件:CommandExecutor.java   
/**
 * Executes a given command. might do nothing if there isn't an active
 * handler to handle the event
 * 
 * @param commandId
 */
public static void executeCommand(String commandId) {
    try {
        if (commandId != null) {
            getHandlerService().executeCommand(commandId, null);
        }
    } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
        // just swallowing the exception here
    }
}
项目:gama    文件:UpdateHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final Command c =
            WorkbenchHelper.getService(ICommandService.class).getCommand("org.eclipse.equinox.p2.ui.sdk.update");
    if (c != null) {
        try {
            return c.executeWithChecks(event);
        } catch (NotDefinedException | NotEnabledException | NotHandledException e) {}
    }
    return null;
}
项目:gama    文件:RestartHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final Command c =
            WorkbenchHelper.getService(ICommandService.class).getCommand("org.eclipse.ui.file.restartWorkbench");
    if (c != null) {
        try {
            return c.executeWithChecks(event);
        } catch (NotDefinedException | NotEnabledException | NotHandledException e) {}
    }
    return null;
}
项目:gama    文件:DetailsHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final Command c = WorkbenchHelper.getService(ICommandService.class)
            .getCommand("org.eclipse.equinox.p2.ui.sdk.installationDetails");
    if (c != null) {
        try {
            return c.executeWithChecks(event);
        } catch (NotDefinedException | NotEnabledException | NotHandledException e) {}
    }
    return null;
}
项目:gama    文件:InstallHandler.java   
@Override
public Object execute(final ExecutionEvent event) throws ExecutionException {
    final Command c =
            WorkbenchHelper.getService(ICommandService.class).getCommand("org.eclipse.equinox.p2.ui.sdk.install");
    if (c != null) {
        try {
            return c.executeWithChecks(event);
        } catch (NotDefinedException | NotEnabledException | NotHandledException e) {}
    }
    return null;
}
项目:OpenSPIFe    文件:CommandExecutionMonitor.java   
@Override
public void notHandled(String commandId, NotHandledException exception) {
    StringBuilder sb = new StringBuilder(commandId);
    double duration = addDuration(sb, commandId);
    addLine(sb, commandId, exception.getMessage());
    EnsembleUsageLogger.logUsage("CMD.notHandled: "+commandId, duration);
}
项目:watchdog    文件:CommandExecuterBase.java   
@Override
public void run() {
    commandService = getCommandService();

    if (commandService != null) {
        try {
            doCommand();
        } catch (ExecutionException | NotDefinedException
                | NotEnabledException | NotHandledException exception) {
            // intentionally empty
        }
    }
}
项目:codeexamples-eclipse    文件:TriggerQuickAccessAction.java   
@Override
public void run(IAction action) {
    IHandlerService handlerService = window.getService(IHandlerService.class);
    try {
        handlerService.executeCommand("org.eclipse.ui.window.quickAccess", null); // //$NON-NLS-1$
    } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
        e.printStackTrace();
    }
}
项目:birt    文件:CommandUtils.java   
public static Object executeCommand( String commandId, Map paramMap )
        throws NotDefinedException, ExecutionException,
        ParameterValueConversionException, NotEnabledException,
        NotHandledException
{
    Command cmd = CommandUtils.getCommand( commandId );
    List paramList = new ArrayList( );
    if ( paramMap != null )
    {
        for ( Iterator iter = paramMap.entrySet( ).iterator( ); iter.hasNext( ); )
        {
            Map.Entry entry = (Entry) iter.next( );
            String paramId = entry.getKey( ).toString( );
            Object value = entry.getValue( );
            if ( value != null )
            {
                paramList.add( createParameter( cmd, paramId, value ) );
            }
        }
    }
    if ( paramList.size( ) > 0 )
    {
        ParameterizedCommand paramCommand = new ParameterizedCommand( cmd,
                (Parameterization[]) paramList.toArray( new Parameterization[paramList.size( )] ) );

        return getHandlerService( ).executeCommand( paramCommand, null );
    }
    else
    {
        return getHandlerService( ).executeCommand( commandId, null );
    }
}
项目:birt    文件:CommandUtils.java   
public static Object executeCommand( String commandId )
        throws ExecutionException, NotDefinedException,
        NotEnabledException, NotHandledException
{

    return getHandlerService( ).executeCommand( commandId, null );
}
项目:e4macs    文件:EmacsPlusUtils.java   
private static Object executeCommand(String commandId, Event event, IHandlerService service)
throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException, CommandException {
    Object result = null;
    if (service != null) {
        try {
            MarkUtils.setIgnoreDispatchId(true);
            result =  service.executeCommand(commandId, event);
        } finally {
            MarkUtils.setIgnoreDispatchId(false);
        }       
    }
    return result;
}
项目:NIEM-Modeling-Tool    文件:CommandUtils.java   
public static void run_the_command(final String id) {
    try {
        ((IHandlerService) get_the_workbench().getService(IHandlerService.class)).executeCommand(id, null);
    } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) {
        throw new IllegalStateException("Unable to run the command " + id, e);
    }
}
项目:LinGUIne    文件:ProjectExplorer.java   
/**
 * Attempts to execute the command with the given Id.
 */
private void executeCommand(String commandId){
    Command command = commandService.getCommand(commandId);

    try {
        command.executeWithChecks(new ExecutionEvent());
    }
    catch(ExecutionException | NotDefinedException
            | NotEnabledException | NotHandledException exception) {
        exception.printStackTrace();
    }
}
项目:elexis-3-core    文件:DocumentsView.java   
private void makeActions(){
    doubleClickAction = new Action() {
        public void run(){
            ISelection selection = viewer.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            if (obj instanceof IDocument) {
                IDocument dh = (IDocument) obj;
                DocumentStoreServiceHolder.getService().getPersistenceObject(dh)
                    .ifPresent(po -> {
                        ICommandService commandService = (ICommandService) PlatformUI
                            .getWorkbench().getService(ICommandService.class);
                        Command command = commandService
                            .getCommand("ch.elexis.core.ui.command.startEditLocalDocument");
                        PlatformUI.getWorkbench().getService(IEclipseContext.class)
                            .set(command.getId().concat(".selection"),
                                new StructuredSelection(po));
                        try {
                            command.executeWithChecks(
                                new ExecutionEvent(command, Collections.EMPTY_MAP, null, null));
                        } catch (ExecutionException | NotDefinedException | NotEnabledException
                                | NotHandledException e) {
                            e.printStackTrace();
                        }
                    });
                viewer.refresh();
            }
        }
    };
}
项目:elexis-3-base    文件:OutboxSendHandler.java   
private void sendMailWithFiles(Patient patient, List<?> iOutboxElements,
    ICommandService commandService, String attachmentsString)
    throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException{
    if (openSendMailDlg(patient, iOutboxElements, commandService,
        attachmentsString)) {
        for (Object iOutboxElement : iOutboxElements) {
            if (iOutboxElement instanceof OutboxElement) {
                OutboxServiceComponent.getService().changeOutboxElementState(
                    (OutboxElement) iOutboxElement, State.SENT);
            }
        }
    }
}
项目:elexis-3-base    文件:OutboxSendHandler.java   
private void sendMailWithXdm(Patient patient, List<?> iOutboxElements,
    ICommandService commandService,
    String retInfo)
    throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException{
    String[] retInfos = retInfo.split(":::");
    // a retInfo must contain at least one xdm and one attachment
    if (retInfos.length > 1
        && openSendMailDlg(patient, iOutboxElements, commandService, retInfos[0])) {

        StringBuilder warnings = new StringBuilder();
        for (Object iOutboxElement : iOutboxElements) {
            if (iOutboxElement instanceof OutboxElement) {
                OutboxElement outboxElement = (OutboxElement) iOutboxElement;
                String lblOutBoxElement = outboxElement.getLabel();

                // check if outbox element is sent
                boolean outboxElementSent = false;
                for (String info : retInfos) {
                    if (info.endsWith(lblOutBoxElement)) {
                        outboxElementSent = true;
                    }
                }
                if (outboxElementSent) {
                    OutboxServiceComponent.getService()
                        .changeOutboxElementState((OutboxElement) iOutboxElement, State.SENT);
                } else {
                    warnings.append("\n");
                    warnings.append(lblOutBoxElement);
                }
            }
        }
        if (warnings.length() > 0) {
            MessageDialog.openWarning(Display.getCurrent().getActiveShell(), "Warnung",
                "Folgende Outbox Elemente konnten nicht versendet werden:\n" + warnings);
        }
    }
}
项目:elexis-3-base    文件:OutboxSendHandler.java   
private Object createXDM(Patient patient, ICommandService commandService,
    String attachmentsString)
    throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException{
    Command xdmCommand = commandService
        .getCommand("at.medevit.elexis.ehc.ui.vacdoc.CreateXdmHandler");
    if (xdmCommand.isDefined()) {
        HashMap<String, String> params = new HashMap<String, String>();
        params.put("at.medevit.elexis.ehc.ui.vacdoc.tmp.dir",
            attachmentsFolder.getAbsolutePath());
        params.put("at.medevit.elexis.ehc.ui.vacdoc.attachments",
            attachmentsString);
        if (patient != null) {
            params.put("at.medevit.elexis.ehc.ui.vacdoc.patient.id", patient.getId());
        }
        ParameterizedCommand parametrizedCommmand =
            ParameterizedCommand.generateCommand(xdmCommand, params);
        if (parametrizedCommmand != null) {
            Object obj = PlatformUI.getWorkbench().getService(IHandlerService.class)
                .executeCommand(parametrizedCommmand, null);
            return obj;
        }
    }
    else {
        MessageDialog.openError(Display.getCurrent().getActiveShell(), "Fehler",
            "Es wurde kein Plugin zum erstellen von XDM Dateien gefunden.");
    }

    return null;
}
项目:eclipse-plugin-commander    文件:CommandProvider.java   
public void executeCommand(ParameterizedCommand command) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException {
    handlerService.executeCommandInContext(command, null, evaluationContext);
}
项目:Tarski    文件:MarkerUpdater.java   
@Override
public boolean updateMarker(final IMarker marker, final IDocument doc, final Position position) {
  try {
    this.markerType = marker.getType();
    final int start = position.getOffset();
    final int end = position.getOffset() + position.getLength();

    if (!MarkUtilities.getText(marker).equals(doc.get(start, position.getLength()))) {
      // text of marker is changed
      Display.getDefault().syncExec(new Runnable() {
        @Override
        public void run() {

          final IServiceLocator serviceLocator = PlatformUI.getWorkbench();
          final ICommandService commandService = serviceLocator.getService(ICommandService.class);

          try {
            final Command command =
                commandService.getCommand("eu.modelwriter.marker.command.updatechangeandimpact");
            command.executeWithChecks(new ExecutionEvent());
          } catch (ExecutionException | NotDefinedException | NotEnabledException
              | NotHandledException e1) {
            e1.printStackTrace();
          }
        }
      });
    }

    MarkUtilities.setStart(marker, start);
    MarkUtilities.setEnd(marker, end);
    MarkUtilities.setLinenumber(marker, doc.getLineOfOffset(start));
    MarkUtilities.setText(marker, doc.get(start, position.getLength()));

    MarkerUpdater.update(marker);
    // TODO When the update action completed, you must trigger the Visualization.showViz method
    // for refreshing the view.

    return true;
  } catch (CoreException | BadLocationException e) {
    return false;
  }
}
项目:APICloud-Studio    文件:ExecutionListenerRegistrant.java   
public void notHandled(String commandId, NotHandledException exception)
{
    // ignore
}
项目:code-forest    文件:ExecutionListener.java   
@Override
public void notHandled(String commandId, NotHandledException exception) {
    System.out.println("notHandled " + commandId);
}
项目:WP3    文件:MarkerUpdater.java   
@Override
public boolean updateMarker(final IMarker marker, final IDocument doc, final Position position) {
  try {
    this.markerType = marker.getType();
    final int start = position.getOffset();
    final int end = position.getOffset() + position.getLength();

    if (!MarkUtilities.getText(marker).equals(doc.get(start, position.getLength()))) {
      // text of marker is changed
      Display.getDefault().syncExec(new Runnable() {
        @Override
        public void run() {

          final IServiceLocator serviceLocator = PlatformUI.getWorkbench();
          final ICommandService commandService = serviceLocator.getService(ICommandService.class);

          try {
            final Command command =
                commandService.getCommand("eu.modelwriter.marker.command.updatechangeandimpact");
            command.executeWithChecks(new ExecutionEvent());
          } catch (ExecutionException | NotDefinedException | NotEnabledException
              | NotHandledException e1) {
            e1.printStackTrace();
          }
        }
      });
    }

    MarkUtilities.setStart(marker, start);
    MarkUtilities.setEnd(marker, end);
    MarkUtilities.setLinenumber(marker, doc.getLineOfOffset(start));
    MarkUtilities.setText(marker, doc.get(start, position.getLength()));

    MarkerUpdater.update(marker);
    // TODO When the update action completed, you must trigger the Visualization.showViz method
    // for refreshing the view.

    return true;
  } catch (CoreException | BadLocationException e) {
    return false;
  }
}
项目:watchdog    文件:CommandExecuterBase.java   
/** Execute command. */
abstract protected void doCommand() throws ExecutionException,
        NotDefinedException, NotEnabledException, NotHandledException;
项目:watchdog    文件:CommandExecuterBase.java   
@Override
protected void doCommand() throws ExecutionException,
        NotDefinedException, NotEnabledException, NotHandledException {
    commandService.refreshElements(command, null);
}
项目:watchdog    文件:CommandExecuterBase.java   
protected void doCommand() throws ExecutionException,
        NotDefinedException, NotEnabledException, NotHandledException {
    commandService.getCommand(command).executeWithChecks(
            new ExecutionEvent());
}