Java Code Examples for org.eclipse.ui.forms.widgets.ImageHyperlink#setLayoutData()

The following examples show how to use org.eclipse.ui.forms.widgets.ImageHyperlink#setLayoutData() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AbstractFormPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
public void loadErrorPage() {
    if (scrolledForm != null) {
        Stream.of(toolBarManager.getItems()).forEach(IContributionItem::update);
        disposePageContent();

        final Composite composite = toolkit.createComposite(scrolledForm.getBody());
        composite.setLayout(GridLayoutFactory.fillDefaults().create());
        composite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(SWT.CENTER, SWT.CENTER).create());

        final ImageHyperlink imageHyperlink = toolkit.createImageHyperlink(composite, SWT.NONE);
        imageHyperlink.setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).create());
        imageHyperlink.setImage(UIPlugin.getImage("icons/error.png"));
        imageHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

            @Override
            public void linkActivated(HyperlinkEvent e) {
                getEditor().setActiveEditor(getSourceEditor());
            }
        });
        final Label label = toolkit.createLabel(composite, Messages.parseError);
        label.setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).create());
        label.setFont(BonitaStudioFontRegistry.getPreferenceTitleFont());
        scrolledForm.getParent().layout(true, true);
    }
}
 
Example 2
Source File: BusinessDataViewer.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
private Composite createEmptyBDMComposite(Composite parent) {
    Composite client = widgetFactory.createComposite(parent);
    client.setLayout(GridLayoutFactory.fillDefaults().create());
    client.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());

    Composite emptyBDMComposite = widgetFactory.createComposite(client);
    emptyBDMComposite.setLayout(GridLayoutFactory.fillDefaults().create());
    emptyBDMComposite
            .setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.CENTER).grab(true, true).create());

    final ImageHyperlink imageHyperlink = widgetFactory.createImageHyperlink(emptyBDMComposite, SWT.NO_FOCUS);
    imageHyperlink.setLayoutData(GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.FILL).create());
    imageHyperlink.setImage(Pics.getImage("defineBdm_60.png", DataPlugin.getDefault()));
    imageHyperlink.addHyperlinkListener(new HyperlinkAdapter() {

        @Override
        public void linkActivated(HyperlinkEvent e) {
            commandExecutor.executeCommand(DEFINE_BDM_COMMAND, null);
        }
    });

    Link labelLink = new Link(emptyBDMComposite, SWT.NO_FOCUS);
    widgetFactory.adapt(labelLink, false, false);
    labelLink.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).align(SWT.FILL, SWT.CENTER).create());
    labelLink.setText(Messages.defineBdmTooltip);
    labelLink.addListener(SWT.Selection, e -> commandExecutor.executeCommand(DEFINE_BDM_COMMAND, null));

    return client;
}