protected Link getLink(Key key) { for (int i= fLinks.size() - 1; i >= 0; i--) { Link curr= fLinks.get(i); Key data= (Key)curr.getData(); if (key.equals(data)) { return curr; } } return null; }
protected Link getLink(Key key) { for (int i= fLinks.size() - 1; i >= 0; i--) { Link curr= fLinks.get(i); Key data= (Key)curr.getData(); if (key.equals(data)) { return curr; } } return null; }
/** * Update the text in the link * * @param taskString * @param link */ private void updateText(String taskString, Link link) { if(taskString == null){ taskString = ""; //$NON-NLS-1$ } if (!taskString.isEmpty()) { taskString = Dialog.shortenText(taskString, link); } // Put in a hyperlink if there is an action String text = link.getData(TRIGGER_KEY) == null ? taskString : NLS.bind("<a>{0}</a>", taskString); //$NON-NLS-1$ if (!text.equals(link.getText())) { link.setText(text); } }
/** Called whenever trigger details change */ private void hookTriggerCommandEnablement() { final Object data = link.getData(TRIGGER_KEY); if (!(data instanceof ParameterizedCommand) || !PlatformUI.isWorkbenchRunning()) return; // Would be nice to have the window's context, but we're too deep IEclipseContext context = PlatformUI.getWorkbench().getService(IEclipseContext.class); if (context == null) { return; } if (tracker != null) { // stop any existing RATs as the command details may have changed tracker.stop(); } tracker = new HandlerChangeTracker((ParameterizedCommand) data); context.runAndTrack(tracker); }