@Override public boolean isEnabled() { return handler.isEnabled(); }
/** * {@inheritDoc} */ public boolean isEnabled() { return !hasRefactorings(getSynchronizationContext(), getSynchronizePageConfiguration()) && fDelegateHandler.isEnabled(); } }
protected boolean isEnabledForSelection(IStructuredSelection selection) { return handler.isEnabled(); }
@Override protected boolean isEnabledForSelection(IStructuredSelection selection) { return handler.isEnabled(); }
/** * @param handlerEvent */ public void handlerChanged(HandlerEvent handlerEvent) { setEnabled(handler.isEnabled()); }
private boolean calculateEnablement() { IHandler handler = getHandler(); return handler != null && handler.isEnabled(); }
@Override public boolean isEnabled() { if (partHandler != null) { if (partHandler instanceof IHandler2) { ((IHandler2) partHandler).setEnabled(appContext); } return partHandler.isEnabled(); } return false; }
/** * @param handlerEvent */ @Override public void handlerChanged(HandlerEvent handlerEvent) { setEnabled(handler.isEnabled()); }
private boolean calculateEnablement() { IHandler handler = getHandler(); return handler != null && handler.isEnabled(); }
/** * Returns whether this command has a handler, and whether this handler is * also handled and enabled. * * @return <code>true</code> if the command is handled; <code>false</code> * otherwise. */ public final boolean isEnabled() { if (handler == null) { return false; } try { return handler.isEnabled(); } catch (Exception e) { if (DEBUG_HANDLERS) { // since this has the ability to generate megs of logs, only // provide information if tracing Tracing.printTrace("HANDLERS", "Handler " + handler + " for " //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + id + " threw unexpected exception"); //$NON-NLS-1$ e.printStackTrace(System.out); } } return false; }
/** * Returns whether this command has a handler, and whether this handler is * also handled and enabled. * * @return <code>true</code> if the command is handled; <code>false</code> * otherwise. */ public final boolean isEnabled() { if (handler == null) { return false; } try { return handler.isEnabled(); } catch (Exception e) { if (DEBUG_HANDLERS) { // since this has the ability to generate megs of logs, only // provide information if tracing Tracing.printTrace("HANDLERS", "Handler " + handler + " for " //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + id + " threw unexpected exception"); //$NON-NLS-1$ e.printStackTrace(System.out); } } return false; }
/** * Returns whether this command has a handler, and whether this handler is * also handled and enabled. * * @return <code>true</code> if the command is handled; <code>false</code> * otherwise. */ public boolean isEnabled() { if (handler == null) { return false; } try { return handler.isEnabled(); } catch (Exception e) { if (DEBUG_HANDLERS) { // since this has the ability to generate megs of logs, only // provide information if tracing Tracing.printTrace("HANDLERS", "Handler " + handler + " for " //$NON-NLS-1$//$NON-NLS-2$ //$NON-NLS-3$ + id + " threw unexpected exception"); //$NON-NLS-1$ e.printStackTrace(System.out); } } return false; }
@Override public void handlerChanged(HandlerEvent event) { final boolean enabledChanged = ((Boolean) event .getPreviousAttributeValuesByName().get( ILegacyAttributeNames.ENABLED)).booleanValue() != handler .isEnabled(); final boolean handledChanged = ((Boolean) event .getPreviousAttributeValuesByName().get( ILegacyAttributeNames.HANDLED)).booleanValue() != handler .isHandled(); listener.handlerChanged(new org.eclipse.core.commands.HandlerEvent( handler, enabledChanged, handledChanged)); } }
@Override public boolean isEnabled() { if (enabledWhenExpression != null) { // proxyEnabled reflects the enabledWhen clause if (!getProxyEnabled()) { return false; } if (isOkToLoad() && loadHandler()) { return handler.isEnabled(); } return true; } /* * There is no enabled when expression, so we just need to consult the * handler. */ if (isOkToLoad() && loadHandler()) { return handler.isEnabled(); } return true; }
@CanExecute public boolean canExecute(IEclipseContext context, @Optional IEvaluationContext staticContext, MApplication application) { if (handler instanceof IHandler2) { Object ctx = staticContext; if (ctx == null) { ctx = new ExpressionContext(application.getContext()); } ((IHandler2) handler).setEnabled(ctx); } return handler.isEnabled(); }
/** * Creates links for given commands on the parent composite. * * @param parent * Parent composite. * @param toolkit * {@link FormToolkit} to use. * @param commandMap * IDs of the commands to display. Only active ones will be displayed. */ private void createLinks(Composite parent, FormToolkit toolkit, Map<String, String> commandMap) { for (Map.Entry<String, String> entry : commandMap.entrySet()) { Command command = commandService.getCommand(entry.getKey()); if (command.isDefined() && (null != command.getHandler()) && command.getHandler().isEnabled()) { toolkit.createLabel(parent, "", SWT.NONE).setImage(arrow); Hyperlink link = toolkit.createHyperlink(parent, entry.getValue(), SWT.WRAP); link.addHyperlinkListener(new CommandHyperlinkListener(command)); link.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false)); } } }
@Override public void runWithEvent(Event event) { if (handler == null || !handler.isEnabled()) return; try { handleTargetSaveableChange(); } catch (InvocationTargetException e) { handle(e); return; } catch (InterruptedException e) { // Canceled so return return; } try { handler.execute(new ExecutionEvent(null, Collections.EMPTY_MAP, event, null)); } catch (ExecutionException e) { handle(e); } }
public void runWithEvent(Event event) { if (handler == null || !handler.isEnabled()) return; try { handleTargetSaveableChange(); } catch (InvocationTargetException e) { handle(e); return; } catch (InterruptedException e) { // Canceled so return return; } try { handler.execute(new ExecutionEvent(null, Collections.EMPTY_MAP, event, null)); } catch (ExecutionException e) { handle(e); } }
@Override public void runWithEvent(Event event) { IHandler handler = getHandler(); if (handler != null && handler.isEnabled()) { final SaveableComparison currentBuffer = ((ModelSynchronizeParticipant)configuration.getParticipant()).getActiveSaveable(); if (currentBuffer != null && currentBuffer.isDirty()) {
public void runWithEvent(Event event) { IHandler handler = getHandler(); if (handler != null && handler.isEnabled()) { final SaveableComparison currentBuffer = ((ModelSynchronizeParticipant)configuration.getParticipant()).getActiveSaveable(); if (currentBuffer != null && currentBuffer.isDirty()) {