org.eclipse.core.commands.NotHandledException Java Examples
The following examples show how to use
org.eclipse.core.commands.NotHandledException.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LocalDocumentsDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
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); } }
Example #2
Source File: LocalDocumentsDialog.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
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); } }
Example #3
Source File: XrefExtension.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
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); } } }
Example #4
Source File: EditLocalDocumentUtil.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
/** * 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 IDocumentLetter}, and the provided {@link IViewPart} is hidden. * * @param view * @param document * @return returns true if edit local is started and view is hidden */ public static boolean startEditLocalDocument(IViewPart view, IDocumentLetter document){ if (CoreHub.localCfg.get(Preferences.P_TEXT_EDIT_LOCAL, false) && document != 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(document)); 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; }
Example #5
Source File: EditLocalDocumentUtil.java From elexis-3-core with Eclipse Public License 1.0 | 6 votes |
/** * 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; }
Example #6
Source File: EmacsPlusUtils.java From e4macs with Eclipse Public License 1.0 | 6 votes |
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; }
Example #7
Source File: CommandUtils.java From birt with Eclipse Public License 1.0 | 5 votes |
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 ); } }
Example #8
Source File: CommandUtils.java From birt with Eclipse Public License 1.0 | 5 votes |
public static Object executeCommand( String commandId ) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { return getHandlerService( ).executeCommand( commandId, null ); }
Example #9
Source File: TriggerQuickAccessAction.java From codeexamples-eclipse with Eclipse Public License 1.0 | 5 votes |
@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(); } }
Example #10
Source File: EmacsPlusUtils.java From e4macs with Eclipse Public License 1.0 | 5 votes |
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; }
Example #11
Source File: WorkbenchHelper.java From gama with GNU General Public License v3.0 | 5 votes |
public static boolean runCommand(final Command c, final ExecutionEvent event) throws ExecutionException { if (c.isEnabled()) { try { c.executeWithChecks(event); return true; } catch (NotDefinedException | NotEnabledException | NotHandledException e) { e.printStackTrace(); } } return false; }
Example #12
Source File: RunProcessContributionItem.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override protected Listener createSelectionListener(AbstractProcess process) { return e -> { Command command = iCommandService.getCommand(RUN_COMMAND); Map<String, Object> parameters = new HashMap<>(); parameters.put("process", process); ExecutionEvent executionEvent = new ExecutionEvent(command, parameters, this, null); try { command.executeWithChecks(executionEvent); } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e1) { throw new RuntimeException(String.format("An error occured while executing command %s", RUN_COMMAND), e1); } }; }
Example #13
Source File: DocumentsView.java From elexis-3-core with Eclipse Public License 1.0 | 5 votes |
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) { MessageDialog.openError(getSite().getShell(), "Fehler", "Das Dokument konnte nicht geƶffnet werden."); e.printStackTrace(); } }); ContextServiceHolder.get().postEvent(ElexisEventTopics.EVENT_UPDATE, dh); } } }; }
Example #14
Source File: TraceControlTestFacility.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Creates session on passed session group. * @param group - session group * @return - trace session group if it's successful else null * @throws ExecutionException * @throws NotDefinedException * @throws NotEnabledException * @throws NotHandledException */ public TraceSessionComponent createSession(ITraceControlComponent group) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { executeCommand(group, "createSession"); ITraceControlComponent[] sessions = group.getChildren(); if ((sessions == null) || (sessions.length == 0)) { return null; } return (TraceSessionComponent)sessions[0]; }
Example #15
Source File: SWTBotUtils.java From tracecompass with Eclipse Public License 2.0 | 5 votes |
/** * Maximize a part. Calling this a second time will "un-maximize" a part. * * @param part * the workbench part */ public static void maximize(@NonNull IWorkbenchPart part) { assertNotNull(part); IWorkbenchPartSite site = part.getSite(); assertNotNull(site); // The annotation is to make the compiler not complain. @Nullable Object handlerServiceObject = site.getService(IHandlerService.class); assertTrue(handlerServiceObject instanceof IHandlerService); IHandlerService handlerService = (IHandlerService) handlerServiceObject; try { handlerService.executeCommand(IWorkbenchCommandConstants.WINDOW_MAXIMIZE_ACTIVE_VIEW_OR_EDITOR, null); } catch (ExecutionException | NotDefinedException | NotEnabledException | NotHandledException e) { fail(e.getMessage()); } }
Example #16
Source File: EmacsOverrunHandler.java From e4macs with Eclipse Public License 1.0 | 4 votes |
public void notHandled(String commandId, NotHandledException exception) { }
Example #17
Source File: MetaXMinibuffer.java From e4macs with Eclipse Public License 1.0 | 4 votes |
/** * @see org.eclipse.core.commands.IExecutionListener#notHandled(java.lang.String, org.eclipse.core.commands.NotHandledException) */ public void notHandled(String commandId, NotHandledException exception) { leave(); }
Example #18
Source File: EmacsPlusUtils.java From e4macs with Eclipse Public License 1.0 | 4 votes |
public static Object executeCommand(String commandId, Integer count, Event event, IWorkbenchPart editor) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException, CommandException { Map<String, Integer> parameters = new HashMap<String, Integer>(); parameters.put(EmacsPlusUtils.UNIVERSAL_ARG, count); return executeCommand(commandId, parameters, event, editor); }
Example #19
Source File: KbdMacroSupport.java From e4macs with Eclipse Public License 1.0 | 4 votes |
/** * @see org.eclipse.core.commands.IExecutionListener#notHandled(java.lang.String, org.eclipse.core.commands.NotHandledException) */ public void notHandled(String commandId, NotHandledException exception) { currentCommand = null; popEvent(); KbdMacroBeeper.beeper.beepInterrupt(); }
Example #20
Source File: RepeatCommandSupport.java From e4macs with Eclipse Public License 1.0 | 4 votes |
/** * @see org.eclipse.core.commands.IExecutionListener#notHandled(java.lang.String, org.eclipse.core.commands.NotHandledException) */ public void notHandled(String commandId, NotHandledException exception) { fail(commandId); }
Example #21
Source File: N4JSExternalLibraryStartup.java From n4js with Eclipse Public License 1.0 | 4 votes |
@Override public void notHandled(String commandId, NotHandledException exception) { // nothing to do }
Example #22
Source File: StartupJob.java From CodeCheckerEclipsePlugin with Eclipse Public License 1.0 | 4 votes |
@Override public void notHandled(String commandId, NotHandledException exception) { Logger.log(IStatus.INFO, "notHandled not Implemented"); }
Example #23
Source File: CustomExecutionListener.java From eclipse-wakatime with BSD 3-Clause "New" or "Revised" License | 4 votes |
@Override public void notHandled(String commandId, NotHandledException exception) { // TODO Auto-generated method stub }
Example #24
Source File: ExecutionListenerRegistrant.java From APICloud-Studio with GNU General Public License v3.0 | 4 votes |
public void notHandled(String commandId, NotHandledException exception) { // ignore }
Example #25
Source File: EmacsPlusUtils.java From e4macs with Eclipse Public License 1.0 | 3 votes |
/** * Invoke the specified parameterized command using the handler service * * @param commandId * @param parameters * @param event * @param editor * @return the result of the execution * @throws ExecutionException * @throws NotDefinedException * @throws NotEnabledException * @throws NotHandledException * @throws CommandException */ public static Object executeCommand(String commandId, Map<String,?> parameters, Event event) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException, CommandException { return executeCommand(commandId, parameters, event, (ICommandService) PlatformUI.getWorkbench().getService(ICommandService.class), (IHandlerService) PlatformUI.getWorkbench().getService(IHandlerService.class)); }
Example #26
Source File: EmacsPlusUtils.java From e4macs with Eclipse Public License 1.0 | 3 votes |
/** * Invoke the specified parameterized command using the handler service from the editor site * * @param commandId * @param parameters * @param event * @param editor * @return the result of the execution * @throws ExecutionException * @throws NotDefinedException * @throws NotEnabledException * @throws NotHandledException * @throws CommandException */ public static Object executeCommand(String commandId, Map<String,?> parameters, Event event, IWorkbenchPart editor) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException, CommandException { return (editor == null) ? executeCommand(commandId, parameters, event) : executeCommand(commandId,parameters,event, (ICommandService) editor.getSite().getService(ICommandService.class), (IHandlerService) editor.getSite().getService(IHandlerService.class)); }
Example #27
Source File: TraceControlTestFacility.java From tracecompass with Eclipse Public License 2.0 | 3 votes |
/** * Executes an Eclipse command with command ID * @param commandId * @throws ExecutionException * @throws NotDefinedException * @throws NotEnabledException * @throws NotHandledException */ public void executeCommand(String commandId) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { Object handlerServiceObject = fControlView.getSite().getService(IHandlerService.class); IHandlerService handlerService = (IHandlerService) handlerServiceObject; handlerService.executeCommand(COMMAND_CATEGORY_PREFIX + commandId, null); waitForJobs(); }
Example #28
Source File: CommandExecutionManager.java From ContentAssist with MIT License | 2 votes |
/** * Receives a command with no handler. * @param commandId the identifier of command that is not handled * @param exception the exception that occurred */ @Override public void notHandled(String commandId, NotHandledException exception) { }
Example #29
Source File: TraceControlTestFacility.java From tracecompass with Eclipse Public License 2.0 | 2 votes |
/** * Executes an Eclipse command with command ID after selecting passed component * @param component - component to select in the tree * @param commandId - command ID * @throws ExecutionException * @throws NotDefinedException * @throws NotEnabledException * @throws NotHandledException */ public void executeCommand(ITraceControlComponent component, String commandId) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { setSelection(component); executeCommand(commandId); }
Example #30
Source File: TraceControlTestFacility.java From tracecompass with Eclipse Public License 2.0 | 2 votes |
/** * Executes an Eclipse command with command ID after selecting passed components * @param components - array of components to select in the tree * @param commandId - command ID * @throws ExecutionException * @throws NotDefinedException * @throws NotEnabledException * @throws NotHandledException */ public void executeCommand(ITraceControlComponent[] components, String commandId) throws ExecutionException, NotDefinedException, NotEnabledException, NotHandledException { setSelection(components); executeCommand(commandId); }