use of org.eclipse.ui.forms.widgets.ImageHyperlink in project eclipse-integration-commons by spring-projects.
the class DashboardMainPage method createNewProjectLink.
private void createNewProjectLink(Composite parent, String name, Image image, IHyperlinkListener listener) {
ImageHyperlink link = toolkit.createImageHyperlink(parent, SWT.NONE);
link.setText(name);
link.setImage(image);
GridDataFactory.fillDefaults().grab(true, false).applyTo(link);
if (listener != null) {
link.addHyperlinkListener(listener);
}
}
use of org.eclipse.ui.forms.widgets.ImageHyperlink in project bndtools by bndtools.
the class BuildOperationsPart method createClient.
/**
* Fill the section.
*/
private void createClient(Section section, FormToolkit toolkit) {
section.setText("Build Operations");
Composite container = toolkit.createComposite(section);
section.setClient(container);
container.setLayout(new GridLayout(1, false));
ImageHyperlink lnkRebuildProject = toolkit.createImageHyperlink(container, SWT.NONE);
lnkRebuildProject.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
IResource resource = findEditorResource();
if (resource != null) {
RebuildJob job = new RebuildJob(resource.getProject(), IncrementalProjectBuilder.FULL_BUILD);
job.setUser(true);
job.schedule();
}
}
});
toolkit.paintBordersFor(lnkRebuildProject);
lnkRebuildProject.setText("Rebuild Project");
lnkRebuildProject.setImage(refreshImg);
ImageHyperlink lnkCleanProject = toolkit.createImageHyperlink(container, SWT.NONE);
toolkit.paintBordersFor(lnkCleanProject);
lnkCleanProject.setText("Clean Project");
lnkCleanProject.setImage(cleanImg);
lnkCleanProject.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
IResource resource = findEditorResource();
if (resource != null) {
RebuildJob job = new RebuildJob(resource.getProject(), IncrementalProjectBuilder.CLEAN_BUILD);
job.setUser(true);
job.schedule();
}
}
});
}
use of org.eclipse.ui.forms.widgets.ImageHyperlink in project bndtools by bndtools.
the class WorkspaceMainPart method initialize.
@Override
public void initialize(final IManagedForm form) {
super.initialize(form);
final Composite container = (Composite) getSection().getClient();
// create a layout stack and the first visible component will be an empty component with "waiting" message
// this will be replaced by real composite once workspace completes
final StackLayout stackLayout = new StackLayout();
container.setLayout(stackLayout);
Composite labelParent = new Composite(container, SWT.NONE);
FillLayout fillLayout = new FillLayout();
fillLayout.marginHeight = fillLayout.marginWidth = 10;
labelParent.setLayout(fillLayout);
if (!Central.isWorkspaceInited()) {
Label label = new Label(labelParent, SWT.NONE);
label.setText("Workspace is loading, please wait...");
label.setBackground(container.getBackground());
label.setForeground(container.getForeground());
}
stackLayout.topControl = labelParent;
container.layout();
Central.onWorkspaceAsync(workspace -> {
IFile buildFile = Central.getWorkspaceBuildFile();
if (buildFile == null)
return;
Composite contents = new Composite(container, SWT.NONE);
if (!mainFile) {
ImageHyperlink link = form.getToolkit().createImageHyperlink(contents, SWT.CENTER);
link.setText("Open main build.bnd file.");
link.setImage(bndFileImg);
link.addHyperlinkListener(new FileOpenLinkListener(buildFile.getFullPath()));
} else {
IResource[] extFiles;
IContainer cnfDir = buildFile.getParent();
IFolder extDir = cnfDir.getFolder(new Path("ext"));
if (extDir.exists())
extFiles = extDir.members();
else
extFiles = new IResource[0];
if (extFiles.length > 0) {
for (IResource extFile : extFiles) {
if (extFile.getType() == IResource.FILE && "bnd".equalsIgnoreCase(extFile.getFileExtension())) {
ImageHyperlink link = form.getToolkit().createImageHyperlink(contents, SWT.CENTER);
link.setText("Open " + extFile.getName());
link.setImage(extFileImg);
link.addHyperlinkListener(new FileOpenLinkListener(extFile.getFullPath()));
}
}
} else {
createMissingExtsWarningPanel(contents, form.getToolkit(), extDir.getFullPath());
}
}
stackLayout.topControl = contents;
container.layout();
}).onFailure(e -> Plugin.error(Collections.singletonList(e.getMessage())));
}
use of org.eclipse.ui.forms.widgets.ImageHyperlink in project cubrid-manager by CUBRID.
the class NoticeDashboardPage method createActionSection.
@SuppressWarnings("unused")
private void createActionSection(Composite parent) {
Section section = createStaticSection(parent, Messages.titleCommonAction);
Composite composite = toolkit.createComposite(section);
GridLayout gridLayout = new GridLayout();
gridLayout.numColumns = 2;
composite.setLayout(gridLayout);
composite.setLayoutData(new GridData(GridData.FILL_BOTH));
section.setClient(composite);
GridData data = new GridData(GridData.BEGINNING);
data.widthHint = 200;
ImageHyperlink addHost = toolkit.createImageHyperlink(composite, SWT.NONE);
addHost.setLayoutData(data);
addHost.setImage(CommonUIPlugin.getImageDescriptor("icons/action/host_add.png").createImage());
addHost.setText(Messages.titleAddHostBtn);
addHost.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
ActionManager.getInstance().getAction("com.cubrid.cubridmanager.ui.host.action.AddHostAction").run();
}
});
ImageHyperlink connectHost = toolkit.createImageHyperlink(composite, SWT.NONE);
connectHost.setLayoutData(data);
connectHost.setImage(CommonUIPlugin.getImageDescriptor("icons/action/host_connect.png").createImage());
connectHost.setText(Messages.titleConHostBtn);
connectHost.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
ActionManager.getInstance().getAction("com.cubrid.cubridmanager.ui.host.action.ConnectHostAction").run();
}
});
ImageHyperlink preferences = toolkit.createImageHyperlink(composite, SWT.NONE);
preferences.setLayoutData(data);
preferences.setImage(CommonUIPlugin.getImageDescriptor("icons/action/property.png").createImage());
preferences.setText(Messages.titlePreferencesBtn);
preferences.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
ActionManager.getInstance().getAction("preferences").run();
}
});
ImageHyperlink help = toolkit.createImageHyperlink(composite, SWT.NONE);
help.setLayoutData(data);
help.setImage(CommonUIPlugin.getImageDescriptor("icons/action/help.png").createImage());
help.setText(Messages.titleHelpBtn);
help.addHyperlinkListener(new IHyperlinkListener() {
public void linkExited(HyperlinkEvent e) {
}
public void linkEntered(HyperlinkEvent e) {
}
public void linkActivated(HyperlinkEvent e) {
ActionManager.getInstance().getAction(HelpDocumentAction.ID).run();
}
});
}
use of org.eclipse.ui.forms.widgets.ImageHyperlink in project eclipse-integration-commons by spring-projects.
the class DashboardMainPage method displayUpdate.
private void displayUpdate(final SyndEntry entry, String severity, Composite composite, int pos, Control[] children) {
ImageHyperlink link;
FormText text;
if (pos < children.length / 2) {
link = (ImageHyperlink) children[pos * 2];
link.setVisible(true);
text = (FormText) children[pos * 2 + 1];
text.setVisible(true);
} else {
link = toolkit.createImageHyperlink(composite, SWT.NONE);
text = new FormText(composite, SWT.WRAP | SWT.MULTI | SWT.NO_BACKGROUND | SWT.NO_FOCUS);
text.setHyperlinkSettings(toolkit.getHyperlinkGroup());
final TableWrapData data = new TableWrapData();
data.indent = UPDATE_INDENTATION;
data.maxWidth = updateSection.getSize().x - UPDATE_TEXT_WRAP_INDENT;
text.setLayoutData(data);
text.addPaintListener(new PaintListener() {
public void paintControl(PaintEvent e) {
data.maxWidth = updateSection.getSize().x - UPDATE_TEXT_WRAP_INDENT;
}
});
text.setBackground(toolkit.getColors().getBackground());
text.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
if (e.data instanceof String) {
TasksUiUtil.openUrl((String) e.data);
}
}
});
}
link.setText(entry.getTitle());
TableWrapData linkData = new TableWrapData();
if ("important".equals(severity)) {
link.setImage(StsUiImages.getImage(StsUiImages.IMPORTANT));
linkData.indent = 0;
} else if ("warning".equals(severity)) {
link.setImage(StsUiImages.getImage(StsUiImages.WARNING));
linkData.indent = 0;
} else {
// link.setImage(IdeUiPlugin.getImage(ICON_BLOG_BLANK));
linkData.indent = UPDATE_INDENTATION - 1;
}
link.setLayoutData(linkData);
link.addHyperlinkListener(new HyperlinkAdapter() {
@Override
public void linkActivated(HyperlinkEvent e) {
String url = entry.getLink();
if (url == null) {
return;
}
TasksUiUtil.openUrl(url);
}
});
String description = getDescription(entry);
if (entry.getPublishedDate() != null && description.endsWith("</p></form>")) {
String dateString = DateFormat.getDateInstance(DateFormat.MEDIUM).format(entry.getPublishedDate());
description = description.replace("</p></form>", " (" + dateString + ")</p></form>");
} else if (entry.getPublishedDate() != null) {
String dateString = DateFormat.getDateInstance(DateFormat.MEDIUM).format(entry.getPublishedDate());
description = description + " (" + dateString + ")";
}
text.setText(description, description.startsWith("<form>"), true);
text.setForeground(feedColor);
text.setBackground(toolkit.getColors().getBackground());
addImages(text, description);
}
Aggregations