@Override public String getText() { try { return command.getName(); } catch (final NotDefinedException e) { return null; } }
public int compare(Binding binding1, Binding binding2) { ParameterizedCommand cmdA = binding1.getParameterizedCommand(); ParameterizedCommand cmdB = binding2.getParameterizedCommand(); int result = 0; try { result = cmdA.getName().compareTo(cmdB.getName()); } catch (NotDefinedException e) { // whaaa? } return result; } });
@Override public String getSortLabel() { try { return command.getName(); } catch (NotDefinedException e) { return command.toString(); } }
/** * Returns a human-readable representation of this command with all of its * parameterizations. * * @return The human-readable representation of this parameterized command; * never <code>null</code>. * @throws NotDefinedException * If the underlying command is not defined. */ public String getName() throws NotDefinedException { return getName(command.getName()); }
/** * Returns a human-readable representation of this command with all of its * parameterizations. * * @return The human-readable representation of this parameterized command; * never <code>null</code>. * @throws NotDefinedException * If the underlying command is not defined. */ public final String getName() throws NotDefinedException { return getName(command.getName()); }
/** * Returns a human-readable representation of this command with all of its * parameterizations. * * @return The human-readable representation of this parameterized command; * never <code>null</code>. * @throws NotDefinedException * If the underlying command is not defined. */ public final String getName() throws NotDefinedException { return getName(command.getName()); }
public int compare(Binding a, Binding b) { Binding bindingA = a; Binding bindingB = b; ParameterizedCommand commandA = bindingA.getParameterizedCommand(); ParameterizedCommand commandB = bindingB.getParameterizedCommand(); try { return commandA.getName().compareTo(commandB.getName()); } catch (NotDefinedException e) { // should not happen return 0; } } });
@Override public final int compareTo(final Object object) { final ParameterizedCommand command = (ParameterizedCommand) object; final boolean thisDefined = this.command.isDefined(); final boolean otherDefined = command.command.isDefined(); if (!thisDefined || !otherDefined) { return Util.compare(thisDefined, otherDefined); } try { final int compareTo = getName().compareTo(command.getName()); if (compareTo == 0) { return getId().compareTo(command.getId()); } return compareTo; } catch (final NotDefinedException e) { throw new Error( "Concurrent modification of a command's defined state"); //$NON-NLS-1$ } }
@Override public int compareTo(final Object object) { final ParameterizedCommand command = (ParameterizedCommand) object; final boolean thisDefined = this.command.isDefined(); final boolean otherDefined = command.command.isDefined(); if (!thisDefined || !otherDefined) { return Util.compare(thisDefined, otherDefined); } try { final int compareTo = getName().compareTo(command.getName()); if (compareTo == 0) { return getId().compareTo(command.getId()); } return compareTo; } catch (final NotDefinedException e) { throw new Error( "Concurrent modification of a command's defined state"); //$NON-NLS-1$ } }
@Override public final int compareTo(final Object object) { final ParameterizedCommand command = (ParameterizedCommand) object; final boolean thisDefined = this.command.isDefined(); final boolean otherDefined = command.command.isDefined(); if (!thisDefined || !otherDefined) { return Util.compare(thisDefined, otherDefined); } try { final int compareTo = getName().compareTo(command.getName()); if (compareTo == 0) { return getId().compareTo(command.getId()); } return compareTo; } catch (final NotDefinedException e) { throw new Error( "Concurrent modification of a command's defined state"); //$NON-NLS-1$ } }
/** * Returns a formatted string describes this command. * * @return a description of the command of this element * @since 3.6 */ public String getCommand() { final StringBuilder label = new StringBuilder(); try { Command nestedCommand = command.getCommand(); label.append(command.getName()); if (nestedCommand != null && nestedCommand.getDescription() != null && nestedCommand.getDescription().length() != 0) { label.append(separator).append(nestedCommand.getDescription()); } } catch (NotDefinedException e) { label.append(command.toString()); } return label.toString(); }
private String getToolTipText() { String text = model.getLocalizedTooltip(); ParameterizedCommand parmCmd = model.getWbCommand(); if (parmCmd == null) { generateCommand(); parmCmd = model.getWbCommand(); } if (parmCmd != null && text == null) { try { text = parmCmd.getName(); } catch (NotDefinedException e) { return null; } } TriggerSequence sequence = bindingService.getBestSequenceFor(parmCmd); if (sequence != null) { text = text + " (" + sequence.format() + ')'; //$NON-NLS-1$ } return text; }
private String getToolTipText(MItem item) { String text = item.getLocalizedTooltip(); if (item instanceof MHandledItem) { MHandledItem handledItem = (MHandledItem) item; IEclipseContext context = getContext(item); EBindingService bs = (EBindingService) context .get(EBindingService.class.getName()); ParameterizedCommand cmd = handledItem.getWbCommand(); if (cmd == null) { cmd = generateParameterizedCommand(handledItem, context); } TriggerSequence sequence = bs.getBestSequenceFor(handledItem .getWbCommand()); if (sequence != null) { if (text == null) { try { text = cmd.getName(); } catch (NotDefinedException e) { return null; } } text = text + " (" + sequence.format() + ')'; //$NON-NLS-1$ } return text; } return text; }
protected void setItemText(MMenuItem model, MenuItem item) { String text = model.getLocalizedLabel(); if (model instanceof MHandledItem) { MHandledItem handledItem = (MHandledItem) model; IEclipseContext context = getContext(model); EBindingService bs = (EBindingService) context .get(EBindingService.class.getName()); ParameterizedCommand cmd = handledItem.getWbCommand(); if (cmd != null && (text == null || text.length() == 0)) { try { text = cmd.getName(); } catch (NotDefinedException e) { // TODO Auto-generated catch block e.printStackTrace(); } } TriggerSequence sequence = bs.getBestSequenceFor(handledItem .getWbCommand()); if (sequence != null) { text = text + '\t' + sequence.format(); } item.setText(text == null ? handledItem.getCommand().getElementId() : text); } else { super.setItemText(model, item); } }
private String getToolTipText(boolean attachKeybinding) { String text = getModel().getLocalizedTooltip(); ParameterizedCommand parmCmd = getModel().getWbCommand(); if (parmCmd == null) { generateCommand(); parmCmd = getModel().getWbCommand(); } if (parmCmd != null && text == null) { try { text = parmCmd.getName(); } catch (NotDefinedException e) { return null; } } TriggerSequence sequence = bindingService.getBestSequenceFor(parmCmd); if (attachKeybinding && sequence != null) { text = text + " (" + sequence.format() + ')'; //$NON-NLS-1$ } return text; }
/** * @param bindingCommand */ private void setCommandInfo(ParameterizedCommand bindingCommand) { setId(bindingCommand.getId()); try { setName(bindingCommand.getName()); } catch (NotDefinedException e) { setName(NewKeysPreferenceMessages.Undefined_Command); } try { setDescription(bindingCommand.getCommand().getDescription()); } catch (NotDefinedException e) { setDescription(Util.ZERO_LENGTH_STRING); } try { setCategory(bindingCommand.getCommand().getCategory().getName()); } catch (NotDefinedException e) { setCategory(NewKeysPreferenceMessages.Unavailable_Category); } setConflict(Boolean.FALSE); }
if (text == null) { try { text = cmd.getName(); } catch (NotDefinedException e) { return null;
setActionDefinitionId(parameterizedCommand.getId()); try { setText(parameterizedCommand.getName()); } catch (NotDefinedException e) {