org.eclipse.ui.forms.widgets.ImageHyperlink Java Examples

The following examples show how to use org.eclipse.ui.forms.widgets.ImageHyperlink. 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: AbstractEditorPropertySection.java    From statecharts with Eclipse Public License 1.0 6 votes vote down vote up
protected void createHelpWidget(final Composite parent, final Control control, String helpId) {
	final ImageHyperlink helpWidget = toolkit.createImageHyperlink(parent, SWT.CENTER);
	Image defaultImage = PlatformUI.getWorkbench().getSharedImages().getImage(ISharedImages.IMG_LCL_LINKTO_HELP);
	helpWidget.setImage(defaultImage);
	GridDataFactory.fillDefaults().align(SWT.FILL, SWT.TOP).applyTo(helpWidget);
	helpWidget.setToolTipText(JFaceResources.getString(IDialogLabelKeys.HELP_LABEL_KEY));
	helpWidget.addMouseListener(new MouseAdapter() {
		public void mouseDown(MouseEvent e) {
			control.setFocus();
			PlatformUI.getWorkbench().getHelpSystem().displayDynamicHelp();
		}
	});
	GridDataFactory.fillDefaults().applyTo(helpWidget);
	helpWidget.setEnabled(true);
	setHelpContext(control, helpId);
}
 
Example #2
Source File: CloudForgeComposite.java    From APICloud-Studio with GNU General Public License v3.0 6 votes vote down vote up
private void createControls() {	
	Composite cloudForgeComposite = new Composite(this, SWT.NULL);
	GridLayout layout = new GridLayout();
	layout.numColumns = 1;
	cloudForgeComposite.setLayout(layout);
	GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.FILL_HORIZONTAL);
	cloudForgeComposite.setLayoutData(data);
	
	ImageHyperlink cloudForgeLink = new ImageHyperlink(cloudForgeComposite, SWT.NONE);
	cloudForgeLink.setImage(SVNUIPlugin.getPlugin().getImageDescriptor(ISVNUIConstants.IMG_CLOUDFORGE).createImage());
	cloudForgeLink.addHyperlinkListener(new HyperlinkAdapter() {
		@Override
		public void linkActivated(HyperlinkEvent evt) {
			try {
				PlatformUI.getWorkbench().getBrowserSupport().getExternalBrowser().openURL(new URL(SIGNUP_URL));
			} catch (Exception e) {
				MessageDialog.openError(getShell(), "Sign-up for CloudForge", e.getMessage());
			}
		}			
	});
	cloudForgeLink.setToolTipText(SIGNUP_URL);
}
 
Example #3
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 #4
Source File: ResultPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createItems() {
	LinkClick click = new LinkClick();
	for (Descriptor d : getPageResults()) {
		Composite comp = tk.createComposite(pageComposite);
		UI.gridData(comp, true, false);
		UI.gridLayout(comp, 1).verticalSpacing = 3;
		ImageHyperlink link = tk.createImageHyperlink(comp, SWT.TOP);
		link.setText(Labels.name(d));
		link.setImage(Images.get(d));
		link.setForeground(Colors.linkBlue());
		link.setData(d);
		link.addHyperlinkListener(click);
		renderCategory(tk, d, comp);
		renderDescription(tk, d, comp);
	}
}
 
Example #5
Source File: ChartLegend.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void element(String text, Object model, int colorIndex) {
	if (model instanceof CategorizedDescriptor || model instanceof CategorizedEntity) {
		ImageHyperlink link = new ImageHyperlink(composite, SWT.TOP);
		link.setText(text);
		link.setImage(getImage(colorIndex));
		Controls.onClick(link, (e) -> {
			if (model instanceof CategorizedDescriptor) {
				App.openEditor((CategorizedDescriptor) model);
			} else if (model instanceof CategorizedEntity) {
				App.openEditor((CategorizedEntity) model);
			}
		});
		createdLinks.push(link);
	} else {
		CLabel label = new CLabel(composite, SWT.TOP);
		label.setImage(getImage(colorIndex));
		label.setText(text);
		createdLinks.push(label);
	}
}
 
Example #6
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;
}
 
Example #7
Source File: DefaultControlFieldProvider.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public Composite createControl(final Composite parent){
	// Form form=tk.createForm(parent);
	// form.setLayoutData(SWTHelper.getFillGridData(1,true,1,false));
	// Composite ret=form.getBody();
	Composite ret = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(2, false);
	layout.marginWidth = 0;
	ret.setLayout(layout);
	ret.setBackground(parent.getBackground());
	
	ImageHyperlink hClr = tk.createImageHyperlink(ret, SWT.NONE); //$NON-NLS-1$
	hClr.setImage(Images.IMG_CLEAR.getImage());
	hClr.addHyperlinkListener(new HyperlinkAdapter() {
		
		@Override
		public void linkActivated(final HyperlinkEvent e){
			clearValues();
		}
		
	});
	hClr.setBackground(parent.getBackground());
	
	inner = new Composite(ret, SWT.NONE);
	GridLayout lRet = new GridLayout(fields.length, true);
	inner.setLayout(lRet);
	inner.setLayoutData(SWTHelper.getFillGridData(1, true, 1, true));
	
	populateInnerComposite();
	
	return ret;
}
 
Example #8
Source File: ResultPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
@Override
public void linkActivated(HyperlinkEvent e) {
	ImageHyperlink link = (ImageHyperlink) e.widget;
	Object data = link.getData();
	if (data instanceof CategoryDescriptor) {
		CategoryDescriptor d = (CategoryDescriptor) data;
		Category c = Cache.getEntityCache().get(Category.class, d.id);
		Navigator.select(c);
	} else if (data instanceof CategorizedDescriptor) {
		App.openEditor((CategorizedDescriptor) data);
	}
}
 
Example #9
Source File: FlowUseSection.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void renderFlowLink(Image image, Composite composite,
		ProcessDescriptor d) {
	ImageHyperlink link = new ImageHyperlink(composite, SWT.TOP);
	link.setText(Labels.name(d));
	if (d.description != null) {
		link.setToolTipText(d.description);
	}
	link.setImage(image);
	link.setForeground(Colors.linkBlue());
	Controls.onClick(link, e -> {
		ProcessDao dao = new ProcessDao(database);
		Process p = dao.getForId(d.id);
		App.openEditor(p);
	});
}
 
Example #10
Source File: FlowUseSection.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void renderUsageLink(Image image, Composite composite, int rest) {
	if (rest < 1)
		return;
	var link = new ImageHyperlink(composite, SWT.TOP);
	link.setText(rest + " more");
	link.setImage(image);
	link.setForeground(Colors.linkBlue());
	Controls.onClick(link,
			e -> SearchPage.forUsage(Descriptor.of(flow)));
}
 
Example #11
Source File: CommentControl.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void initControl(Composite parent, FormToolkit toolkit) {
	if (!App.isCommentingEnabled() || comments == null || !comments.hasPath(path)) {
		UI.filler(parent, toolkit);
		return;
	}
	ImageHyperlink control = new ImageHyperlink(parent, SWT.NONE);
	UI.gridData(control, false, false).verticalAlignment = SWT.TOP;
	Controls.onClick(control, (e) -> {
		new CommentDialog(path, comments).open();
	});
	control.setImage(Icon.SHOW_COMMENTS.get());
	control.setToolTipText(M.Comment);
}
 
Example #12
Source File: StatisticsPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void generalSection(FormToolkit tk, Composite body) {
	Composite comp = UI.formSection(body, tk, "General statistics");
	UI.gridLayout(comp, 2, 15, 10);

	UI.formLabel(comp, "Number of processes");
	bind(UI.formLabel(comp, ""), label -> {
		label.setText(Integer.toString(stats.processCount));
	});

	UI.formLabel(comp, "Number of process links");
	bind(UI.formLabel(comp, ""), label -> {
		label.setText(Integer.toString(stats.linkCount));
	});

	UI.formLabel(comp, "Connected graph / can calculate?");
	bind(UI.formLabel(comp, ""), label -> {
		String text = stats.connectedGraph
				? "yes"
				: "no";
		label.setText(text);
	});

	UI.formLabel(comp, "Reference process");
	ImageHyperlink link = new ImageHyperlink(comp, SWT.TOP);
	link.setForeground(Colors.linkBlue());
	link.setImage(Images.get(ModelType.PROCESS));
	Controls.onClick(link, e -> {
		if (stats != null) {
			App.openEditor(stats.refProcess);
		}
	});
	bind(link, l -> {
		l.setText(Labels.name(stats.refProcess));
	});

	UI.formLabel(comp, "");
	Button btn = tk.createButton(comp, M.Update, SWT.NONE);
	Controls.onSelect(btn, e -> calculate());
}
 
Example #13
Source File: ModelPage.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
protected ImageHyperlink link(Composite parent, String label, String property) {
	return Widgets.link(parent, label, property, getEditor(), getToolkit());
}