public static void setHelp(final Control control, String href) { if (href == null) return; control.setData(HELP_KEY, href); // ensure that the listener is only registered once final HelpListener listener = getInstance().getHelpListener(); control.removeHelpListener(listener); control.addHelpListener(listener); control.addDisposeListener(new DisposeListener() { @Override public void widgetDisposed(DisposeEvent e) { control.removeHelpListener(listener); } }); }
/** * Adds a listener for help requests in this viewer. * Has no effect if an identical listener is already registered. * * @param listener a help listener */ public void addHelpListener(HelpListener listener) { helpListeners.add(listener); if (!helpHooked) { Control control = getControl(); if (control != null && !control.isDisposed()) { if (this.helpListener == null) { this.helpListener = new HelpListener() { public void helpRequested(HelpEvent event) { handleHelpRequest(event); } }; } control.addHelpListener(this.helpListener); helpHooked = true; } } }
/** * Constructs a RetargetAction with the given action id, text and style. * * @param actionID * the retargetable action id * @param text * the action's text, or <code>null</code> if there is no text * @param style * one of <code>AS_PUSH_BUTTON</code>, <code>AS_CHECK_BOX</code>, * <code>AS_DROP_DOWN_MENU</code>, <code>AS_RADIO_BUTTON</code>, * and <code>AS_UNSPECIFIED</code> * @since 3.0 */ public RetargetAction(String actionID, String text, int style) { super(text, style); setId(actionID); setEnabled(false); super.setHelpListener(new HelpListener() { public void helpRequested(HelpEvent e) { HelpListener listener = null; if (handler != null) { // if we have a handler, see if it has a help listener listener = handler.getHelpListener(); if (listener == null) { // use our own help listener listener = localHelpListener; } } if (listener != null) { // pass on the event listener.helpRequested(e); } } }); }
protected void configureShell(Shell newShell) { super.configureShell(newShell); // Register help listener on the shell newShell.addHelpListener(new HelpListener() { public void helpRequested(HelpEvent event) { // call perform help on the current page if (currentPage != null) { currentPage.performHelp(); } } }); }
@Override public void removeHelpListener(HelpListener listener) { if (lastListener != null){ super.removeHelpListener(lastListener); lastListener = null; } }
/** * Set the listener to the menu specified on the creation of the class, and the content * of the help are linked using the uri passed as parameter * * @param href the link to the help content * @return the created listener, or null is the menu is null */ public HelpListener setHelp(String href){ if (openedMenu != null){ HelpOpener handler = new HelpOpener(href); openedMenu.removeHelpListener(handler); openedMenu.addHelpListener(handler); return handler; } return null; }
/** * Removes the given help listener from this viewer. * Has no effect if an identical listener is not registered. * * @param listener a help listener */ public void removeHelpListener(HelpListener listener) { helpListeners.remove(listener); if (helpListeners.size() == 0) { Control control = getControl(); if (control != null && !control.isDisposed()) { control.removeHelpListener(this.helpListener); helpHooked = false; } } }
/** * Hook an SWT listener on the canvas where the chart is drawn. * The purpose of this method is to allow some degree of customization. * * @param listener The SWT listener to attach to the canvas. */ public void addSWTListener(EventListener listener) { if (listener instanceof ControlListener) { this.canvas.addControlListener((ControlListener) listener); } else if (listener instanceof DisposeListener) { this.canvas.addDisposeListener((DisposeListener) listener); // } // else if (listener instanceof DragDetectListener) { // this.canvas.addDragDetectListener((DragDetectListener) listener); } else if (listener instanceof FocusListener) { this.canvas.addFocusListener((FocusListener) listener); } else if (listener instanceof HelpListener) { this.canvas.addHelpListener((HelpListener) listener); } else if (listener instanceof KeyListener) { this.canvas.addKeyListener((KeyListener) listener); // } // else if (listener instanceof MenuDetectListener) { // this.canvas.addMenuDetectListener((MenuDetectListener) listener); } else if (listener instanceof MouseListener) { this.canvas.addMouseListener((MouseListener) listener); } else if (listener instanceof MouseMoveListener) { this.canvas.addMouseMoveListener((MouseMoveListener) listener); } else if (listener instanceof MouseTrackListener) { this.canvas.addMouseTrackListener((MouseTrackListener) listener); // } else if (listener instanceof MouseWheelListener) { // this.canvas.addMouseWheelListener((MouseWheelListener) listener); } else if (listener instanceof PaintListener) { this.canvas.addPaintListener((PaintListener) listener); } else if (listener instanceof TraverseListener) { this.canvas.addTraverseListener((TraverseListener) listener); } }
public HelpListener getHelpListener() { return fOpenAction.getHelpListener(); }
public void setHelpListener(HelpListener listener) { fOpenAction.setHelpListener(listener); }
@Override public HelpListener getHelpListener() { // TODO Auto-generated method stub return null; }
@Override public void setHelpListener(HelpListener listener) { // TODO Auto-generated method stub }
/** * Substitute the original listener with one adapted to this type of element. This help will open a * browser window when used the key F1 on the element, the link is taken from the properties of this element */ @Override public void addHelpListener(HelpListener listener) { HelpProvider contextHelp = new HelpProvider(menuProvider.getMenu()); lastListener = contextHelp.setHelp(control.getData(HelpSystem.HELP_KEY).toString()); }
@Override public HelpListener getHelpListener() { return fOpenAction.getHelpListener(); }
@Override public void setHelpListener(HelpListener listener) { fOpenAction.setHelpListener(listener); }
@Override public void addHelpListener(HelpListener listener) { fViewer.addHelpListener(listener); fListenerList.add(listener); }
@Override public void removeHelpListener(HelpListener listener) { fListenerList.remove(listener); fViewer.removeHelpListener(listener); }
/** * Hook an SWT listener on the canvas where the chart is drawn. * The purpose of this method is to allow some degree of customization. * * @param listener The SWT listener to attach to the canvas. */ public void addSWTListener(EventListener listener) { if (listener instanceof ControlListener) { this.canvas.addControlListener((ControlListener) listener); } else if (listener instanceof DisposeListener) { this.canvas.addDisposeListener((DisposeListener) listener); } else if (listener instanceof DragDetectListener) { this.canvas.addDragDetectListener((DragDetectListener) listener); } else if (listener instanceof FocusListener) { this.canvas.addFocusListener((FocusListener) listener); } else if (listener instanceof HelpListener) { this.canvas.addHelpListener((HelpListener) listener); } else if (listener instanceof KeyListener) { this.canvas.addKeyListener((KeyListener) listener); } else if (listener instanceof MenuDetectListener) { this.canvas.addMenuDetectListener((MenuDetectListener) listener); } else if (listener instanceof MouseListener) { this.canvas.addMouseListener((MouseListener) listener); } else if (listener instanceof MouseMoveListener) { this.canvas.addMouseMoveListener((MouseMoveListener) listener); } else if (listener instanceof MouseTrackListener) { this.canvas.addMouseTrackListener((MouseTrackListener) listener); } else if (listener instanceof MouseWheelListener) { this.canvas.addMouseWheelListener((MouseWheelListener) listener); } else if (listener instanceof PaintListener) { this.canvas.addPaintListener((PaintListener) listener); } else if (listener instanceof TraverseListener) { this.canvas.addTraverseListener((TraverseListener) listener); } }
public HelpListener getHelpListener() { return helpListener; }
public void setHelpListener(HelpListener listener) { helpListener = listener; }
public HelpListener getHelpListener() { return action.getHelpListener(); }
public void setHelpListener(HelpListener listener) { action.setHelpListener(listener); }
public void addHelpListener(HelpListener listener) { viewer.addHelpListener(listener); }
public void removeHelpListener(HelpListener listener) { viewer.removeHelpListener(listener); }