Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add help buttons for different views #5852

Merged
merged 7 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions bndtools.core/bndtools.cocoa.macosx.aarch64.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@
org.eclipse.ui.ide;version='[3.19.100,3.19.101)',\
org.eclipse.ui.ide.application;version='[1.4.500,1.4.501)',\
org.eclipse.ui.intro;version='[3.6.600,3.6.601)',\
org.eclipse.ui.intro.quicklinks;version='[1.1.200,1.1.201)',\
org.eclipse.ui.intro.quicklinks.source;version='[1.1.200,1.1.201)',\
org.eclipse.ui.intro.source;version='[3.6.600,3.6.601)',\
org.eclipse.ui.intro.universal;version='[3.4.300,3.4.301)',\
org.eclipse.ui.intro.universal.source;version='[3.4.300,3.4.301)',\
org.eclipse.ui.navigator;version='[3.10.300,3.10.301)',\
org.eclipse.ui.navigator.resources;version='[3.8.400,3.8.401)',\
org.eclipse.ui.views;version='[3.11.200,3.11.201)',\
Expand Down
5 changes: 5 additions & 0 deletions bndtools.core/bndtools.cocoa.macosx.x86_64.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,11 @@
org.eclipse.ui.ide;version='[3.19.100,3.19.101)',\
org.eclipse.ui.ide.application;version='[1.4.500,1.4.501)',\
org.eclipse.ui.intro;version='[3.6.600,3.6.601)',\
org.eclipse.ui.intro.quicklinks;version='[1.1.200,1.1.201)',\
org.eclipse.ui.intro.quicklinks.source;version='[1.1.200,1.1.201)',\
org.eclipse.ui.intro.source;version='[3.6.600,3.6.601)',\
org.eclipse.ui.intro.universal;version='[3.4.300,3.4.301)',\
org.eclipse.ui.intro.universal.source;version='[3.4.300,3.4.301)',\
org.eclipse.ui.navigator;version='[3.10.300,3.10.301)',\
org.eclipse.ui.navigator.resources;version='[3.8.400,3.8.401)',\
org.eclipse.ui.views;version='[3.11.200,3.11.201)',\
Expand Down
5 changes: 5 additions & 0 deletions bndtools.core/bndtools.gtk.linux.x86_64.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -273,6 +273,11 @@
org.eclipse.ui.ide;version='[3.19.100,3.19.101)',\
org.eclipse.ui.ide.application;version='[1.4.500,1.4.501)',\
org.eclipse.ui.intro;version='[3.6.600,3.6.601)',\
org.eclipse.ui.intro.quicklinks;version='[1.1.200,1.1.201)',\
org.eclipse.ui.intro.quicklinks.source;version='[1.1.200,1.1.201)',\
org.eclipse.ui.intro.source;version='[3.6.600,3.6.601)',\
org.eclipse.ui.intro.universal;version='[3.4.300,3.4.301)',\
org.eclipse.ui.intro.universal.source;version='[3.4.300,3.4.301)',\
org.eclipse.ui.navigator;version='[3.10.300,3.10.301)',\
org.eclipse.ui.navigator.resources;version='[3.8.400,3.8.401)',\
org.eclipse.ui.views;version='[3.11.200,3.11.201)',\
Expand Down
8 changes: 7 additions & 1 deletion bndtools.core/bndtools.shared.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,13 @@
bnd.identity;id='org.eclipse.ui.ide.application',\
bnd.identity;id='junit-platform-commons';version='${range;[===,==+);${junit.platform.eclipse.version}}',\
bnd.identity;id='junit-platform-engine';version='${range;[===,==+);${junit.platform.eclipse.version}}',\
bnd.identity;id='junit-platform-launcher';version='${range;[===,==+);${junit.platform.eclipse.version}}'
bnd.identity;id='junit-platform-launcher';version='${range;[===,==+);${junit.platform.eclipse.version}}',\
bnd.identity;id='org.eclipse.ui.intro',\
bnd.identity;id='org.eclipse.ui.intro.quicklinks',\
bnd.identity;id='org.eclipse.ui.intro.quicklinks.source',\
bnd.identity;id='org.eclipse.ui.intro.source',\
bnd.identity;id='org.eclipse.ui.intro.universal',\
bnd.identity;id='org.eclipse.ui.intro.universal.source'

-runblacklist: \
bnd.identity;id='biz.aQute.bnd.annotation',\
Expand Down
5 changes: 5 additions & 0 deletions bndtools.core/bndtools.win32.x86_64.bndrun
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,11 @@
org.eclipse.ui.ide;version='[3.19.100,3.19.101)',\
org.eclipse.ui.ide.application;version='[1.4.500,1.4.501)',\
org.eclipse.ui.intro;version='[3.6.600,3.6.601)',\
org.eclipse.ui.intro.quicklinks;version='[1.1.200,1.1.201)',\
org.eclipse.ui.intro.quicklinks.source;version='[1.1.200,1.1.201)',\
org.eclipse.ui.intro.source;version='[3.6.600,3.6.601)',\
org.eclipse.ui.intro.universal;version='[3.4.300,3.4.301)',\
org.eclipse.ui.intro.universal.source;version='[3.4.300,3.4.301)',\
org.eclipse.ui.navigator;version='[3.10.300,3.10.301)',\
org.eclipse.ui.navigator.resources;version='[3.8.400,3.8.401)',\
org.eclipse.ui.views;version='[3.11.200,3.11.201)',\
Expand Down
1 change: 1 addition & 0 deletions bndtools.core/icons.properties
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ icons.download=icons/download.png
icons.download.disabled=icons/download_d.png
icons.resolve=icons/lightbulb.png
icons.match=icons/star-small.png
icons.help=icons/help.gif

# Repository View
icons.add=icons/add_obj.png
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,28 @@
<?xml version="1.0" encoding="UTF-8" ?>

<introContent>
<extensionContent id="bndtools.core" name="Bndtools"
style="css/whatsnew.css" alt-style="css/whatsnew.properties" path="overview/@">
<group id="content-group" style-id="content-group">
<link label="Bndtools" url="https://bndtools.org" id="bndtools-overview" style-id="content-link">
<text>
Learn how to develop OSGi applications with Bndtools!
</text>
</link>
</group>
</extensionContent>

<extensionContent id="bndtools.core" name="Bndtools"
style="css/whatsnew.css" alt-style="css/whatsnew.properties" path="tutorials/@">
<group id="content-group" style-id="content-group">
<link label="Bndtools" url="https://bndtools.org/tutorial.html" id="bndtools-tutorials" style-id="content-link">
<text>
In this tutorial we will build a sample OSGi application composed of two components and an API.
</text>
</link>
</group>
</extensionContent>

<extensionContent id="bndtools.core" name="Bndtools"
style="css/whatsnew.css" alt-style="css/whatsnew.properties" path="whatsnew/@">
<group id="content-group" style-id="content-group">
Expand Down
Binary file added bndtools.core/resources/unprocessed/icons/help.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 17 additions & 1 deletion bndtools.core/resources/unprocessed/intro/css/whatsnew.css
Original file line number Diff line number Diff line change
@@ -1,7 +1,23 @@
a#bndtools-overview img {
background-image: url(../images/bndtools.gif);
}

a#bndtools-overview:hover img {
background-image: url(../images/bndtools-glow.gif);
}

a#bndtools-tutorials img {
background-image: url(../images/bndtools.gif);
}

a#bndtools-tutorials:hover img {
background-image: url(../images/bndtools-glow.gif);
}

a#bndtools-noteworthy img {
background-image: url(../images/bndtools.gif);
}

a#bndtools-noteworthy:hover img {
background-image: url(../images/bndtools-glow.gif);
}
}
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
whatsnew.bndtools-overview.link-icon = intro/images/bndtools.gif
whatsnew.bndtools-overview.hover-icon = intro/images/bndtools-glow.gif
whatsnew.bndtools-tutorials.link-icon = intro/images/bndtools.gif
whatsnew.bndtools-tutorials.hover-icon = intro/images/bndtools-glow.gif
whatsnew.bndtools-noteworthy.link-icon = intro/images/bndtools.gif
whatsnew.bndtools-noteworthy.hover-icon = intro/images/bndtools-glow.gif
40 changes: 40 additions & 0 deletions bndtools.core/src/bndtools/editor/common/HelpButtons.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package bndtools.editor.common;

import static bndtools.utils.EditorUtils.createButton;
import static bndtools.utils.EditorUtils.createButtonWithText;

import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;

/**
* Helper containing help buttons for different parts / views which link to the
* user manual.
*/
public final class HelpButtons {

public static final Action HELP_BTN_REPOSITORIES = createButton(
"https://bndtools.org/manual/repositories-view.html",
"The Repositories View provides a user-friendly interface to inspect and manage the bundle repositories that are available to your Bndtools projects. Click to open manual in the browser.");

public static final Action HELP_BTN_BNDTOOLS_EXPLORER = createButton(
"https://bndtools.org/manual/packageexplorer.html",
"The explorer provides an overview of the projects and their contents and allows advanced filtering. Click to open manual in the browser.");

public static final Action HELP_BTN_RESOLUTION_VIEW = createButton(
"https://bndtools.org/manual/resolution-view.html",
"The Resolution view shows the requirements and capabilities of one or multiple selected items, be they bnd.bnd files, JAR files, or entries in the Repositories view. This is useful for understanding dependencies as it provides information about what requirements are matched with what capabilities from the included resources. Click to open manual in the browser.");

public static final Action HELP_BTN_BND_EDITOR = createButton(
"https://bndtools.org/manual/bndeditor.html",
"This editor allows to edit bnd.bnd files, which define OSGi bundle metadata and build instructions for Java projects, encompassing sections for builtpath, imports, exports, bundle headers, and instructions to control the generation of the resulting OSGi bundle. Click to open manual in the browser.");

public static final Action HELP_BTN_BND_EDITOR_WORKSPACE = createButton(
"https://bndtools.org/manual/bndeditor.html",
"This editor allows to edit global .bnd files such as the main cnf/build.bnd, which serves as the central configuration hub for the entire bndtools workspace, allowing users to define and manage global build settings, plugins, repository references, and other overarching workspace properties. Click to open manual in the browser.");

public static final ActionContributionItem HELP_BTN_BND_EDITOR_RUN = createButtonWithText(
"https://bndtools.org/manual/bndeditor.html#run", "Help",
"The bnd editor for .bndrun files facilitates dependency management, automated resolution of required bundles, configuration of JVM and framework properties, direct launching of OSGi instances for testing, and the export of run configurations as executable JARs. Click to open manual in the browser.");

private HelpButtons() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.bndtools.core.ui.ExtendedFormEditor;
import org.bndtools.core.ui.IFormPageFactory;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.SWT;
Expand All @@ -26,6 +27,7 @@
import aQute.bnd.build.model.BndEditModel;
import aQute.bnd.build.model.clauses.ExportedPackage;
import aQute.bnd.build.model.clauses.ImportPattern;
import bndtools.editor.common.HelpButtons;
import bndtools.editor.common.MDSashForm;
import bndtools.editor.contents.BundleCalculatedImportsPart;
import bndtools.editor.contents.GeneralInfoPart;
Expand Down Expand Up @@ -69,6 +71,12 @@ protected void createFormContent(IManagedForm managedForm) {
ScrolledForm scrolledForm = managedForm.getForm();
scrolledForm.setText("Bundle Content");

// buttons top of form
IToolBarManager toolbar = scrolledForm.getForm()
.getToolBarManager();
toolbar.add(HelpButtons.HELP_BTN_BND_EDITOR);
toolbar.update(true);

Form form = scrolledForm.getForm();
toolkit.decorateFormHeading(form);
form.addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));
Expand Down
4 changes: 4 additions & 0 deletions bndtools.core/src/bndtools/editor/pages/ProjectRunPage.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import aQute.bnd.build.Workspace;
import aQute.bnd.build.model.BndEditModel;
import bndtools.central.Central;
import bndtools.editor.common.HelpButtons;
import bndtools.editor.common.MDSashForm;
import bndtools.editor.project.AvailableBundlesPart;
import bndtools.editor.project.RepositorySelectionPart;
Expand Down Expand Up @@ -142,6 +143,9 @@ protected void createFormContent(IManagedForm managedForm) {
form.getToolBarManager()
.add(exportContrib);

form.getToolBarManager()
.add(HelpButtons.HELP_BTN_BND_EDITOR_RUN);

form.getToolBarManager()
.update(true);

Expand Down
8 changes: 8 additions & 0 deletions bndtools.core/src/bndtools/editor/pages/WorkspacePage.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import org.bndtools.core.ui.ExtendedFormEditor;
import org.bndtools.core.ui.IFormPageFactory;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
Expand All @@ -16,6 +17,7 @@

import aQute.bnd.build.model.BndEditModel;
import aQute.bnd.build.model.clauses.HeaderClause;
import bndtools.editor.common.HelpButtons;
import bndtools.editor.workspace.PluginPathPart;
import bndtools.editor.workspace.PluginsPart;
import bndtools.editor.workspace.WorkspaceMainPart;
Expand Down Expand Up @@ -75,6 +77,12 @@ protected void createFormContent(IManagedForm managedForm) {
form.getForm()
.addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor()));

// buttons top of form
IToolBarManager toolbar = form.getForm()
.getToolBarManager();
toolbar.add(HelpButtons.HELP_BTN_BND_EDITOR_WORKSPACE);
toolbar.update(false);

// Create controls
Composite body = form.getBody();

Expand Down
4 changes: 4 additions & 0 deletions bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
import bndtools.Plugin;
import bndtools.central.Central;
import bndtools.central.sync.WorkspaceSynchronizer;
import bndtools.editor.common.HelpButtons;
import bndtools.preferences.BndPreferences;
import bndtools.preferences.ui.BndPreferencePage;

Expand Down Expand Up @@ -238,6 +239,9 @@ public void linkActivated(HyperlinkEvent e) {
toolBarManager.add(pin);
toolBarManager.update(true);

toolBarManager.add(HelpButtons.HELP_BTN_BNDTOOLS_EXPLORER);
toolBarManager.update(true);

return header;
}

Expand Down
46 changes: 46 additions & 0 deletions bndtools.core/src/bndtools/utils/EditorUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,13 @@

import java.lang.reflect.InvocationTargetException;

import org.bndtools.core.ui.icons.Icons;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.ActionContributionItem;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.operation.IRunnableWithProgress;
import org.eclipse.swt.program.Program;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.forms.IFormPart;
Expand Down Expand Up @@ -36,4 +41,45 @@ public static final IFormPart findPartByClass(IManagedForm form, Class<? extends
}
return null;
}

/**
* Creates a button with icon and tooltip.
*
* @param url
* @param tooltipText
* @return
*/
public static final Action createButton(String url, String tooltipText) {
Action btn = new Action("Help", IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
Program.launch(url);
}
};
btn.setEnabled(true);
btn.setToolTipText(tooltipText);
btn.setImageDescriptor(Icons.desc("help"));

return btn;
}

/**
* Creates a button with icon, text and tooltip.
*
* @param url
* @param buttonText
* @param tooltipText
* @return
*/
public static final ActionContributionItem createButtonWithText(String url, String buttonText, String tooltipText) {
Action btn = createButton(url, tooltipText);
btn.setText(buttonText);

// the ActionContributionItem is required to display text below the icon
// of the button
ActionContributionItem helpContrib = new ActionContributionItem(btn);
helpContrib.setMode(ActionContributionItem.MODE_FORCE_TEXT);

return helpContrib;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
import bndtools.central.RepositoriesViewRefresher;
import bndtools.central.RepositoryUtils;
import bndtools.dnd.gav.GAVIPageListener;
import bndtools.editor.common.HelpButtons;
import bndtools.model.repo.RepositoryBundle;
import bndtools.model.repo.RepositoryBundleVersion;
import bndtools.model.repo.RepositoryEntry;
Expand Down Expand Up @@ -767,6 +768,8 @@ public void run() {
});
}



void createContextMenu() {
MenuManager mgr = new MenuManager();
Menu menu = mgr.createContextMenu(viewer.getControl());
Expand Down Expand Up @@ -876,6 +879,8 @@ private void fillToolBar(IToolBarManager toolBar) {
toolBar.add(new Separator());
toolBar.add(offlineAction);
toolBar.add(new Separator());
toolBar.add(HelpButtons.HELP_BTN_REPOSITORIES);
toolBar.add(new Separator());
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
import aQute.lib.io.IO;
import aQute.lib.strings.Strings;
import bndtools.Plugin;
import bndtools.editor.common.HelpButtons;
import bndtools.model.repo.RepositoryResourceElement;
import bndtools.model.resolution.CapReqMapContentProvider;
import bndtools.model.resolution.CapabilityLabelProvider;
Expand Down Expand Up @@ -347,6 +348,9 @@ public void runWithEvent(Event event) {
toolBarManager.add(toggleLockInput);

doEEActionMenu(toolBarManager);

toolBarManager.add(HelpButtons.HELP_BTN_RESOLUTION_VIEW);

}

private void doEEActionMenu(IToolBarManager toolBarManager) {
Expand Down