public void createPartControl(Composite parent) { GridLayoutFactory.fillDefaults().applyTo(parent); toolkit = new FormToolkit(parent.getDisplay()); toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER); form = toolkit.createForm(parent); icon = BookmarksPlugin.getImageDescriptor(IUIConstants.IMG_BOOKMARKS).createImage(); form.setImage(icon); GridDataFactory.fillDefaults().grab(true, true).applyTo(form); form.setText("Mes Favoris"); toolkit.decorateFormHeading(form); GridLayoutFactory.swtDefaults().applyTo(form.getBody()); SashForm sashForm = new SashForm(form.getBody(), SWT.VERTICAL); toolkit.adapt(sashForm, true, true); GridDataFactory.fillDefaults().grab(true, true).applyTo(sashForm); createTreeControl(sashForm); createCommentsSection(sashForm); makeActions(); hookContextMenu(); contributeToActionBars(); getSite().setSelectionProvider(proxySelectionProvider); proxySelectionProvider.setCurrentSelectionProvider(bookmarksTreeViewer); toggleLinkAction.init(); restoreState(memento); bookmarkDatabase.addListener(bookmarksListener); eventBroker.subscribe(BookmarksEvents.TOPIC_BOOKMARK_PROBLEMS_CHANGED, bookmarkProblemsEventHandler); }
protected BaseControlContribution createImageHyperlinkToolBarContribution(String id, final DataModel<?, ?, ?> model, final DataModelElementType modelElementType) { BaseControlContribution controlContribution = new BaseControlContribution(id) { @Override protected Control createControlInternal(Composite parent) { ImageHyperlink imageHyperlink = new ImageHyperlink(parent, SWT.TOP | SWT.WRAP); HyperlinkGroup group = new HyperlinkGroup(imageHyperlink.getDisplay()); group.setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER); group.add(imageHyperlink); imageHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { BaseOpenAction openAction = modelElementType.getOpenAction(); if (openAction != null) { try { openAction.runWithObject(model); } catch (Exception e1) { openAction.reportError(e1); } } } }); ElementTypeDataModelImageHyperlinkView view = new ElementTypeDataModelImageHyperlinkView(model, imageHyperlink, modelElementType); view.updateView(); return imageHyperlink; } }; return controlContribution; }
public static ScrolledForm formHeader(IManagedForm managedForm, String title, Image image) { ScrolledForm form = managedForm.getForm(); FormToolkit toolkit = managedForm.getToolkit(); toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode( HyperlinkSettings.UNDERLINE_HOVER); if (title != null) form.setText(title); if (image != null) form.setImage(image); toolkit.decorateFormHeading(form.getForm()); return form; }