Skip to content

Commit

Permalink
1st draft of help buttons for views
Browse files Browse the repository at this point in the history
HELP_BTN_REPOSITORIES, HELP_BTN_BNDTOOLS_EXPLORER, HELP_BTN_RESOLUTION_VIEW

Signed-off-by: Christoph Rueger <[email protected]>
  • Loading branch information
chrisrueger committed Oct 30, 2023
1 parent 8641fe8 commit dbde546
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 0 deletions.
42 changes: 42 additions & 0 deletions bndtools.core/src/bndtools/editor/common/Buttons.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
package bndtools.editor.common;

import org.bndtools.core.ui.icons.Icons;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.swt.program.Program;
import org.eclipse.ui.ISharedImages;

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

public static final Action HELP_BTN_REPOSITORIES = createHelpButton(
"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 = createHelpButton(
"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 = createHelpButton(
"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. Click to open manual in the browser.");

private static Action createHelpButton(String url, String tooltipText) {
Action helpAction = new Action("Help", IAction.AS_PUSH_BUTTON) {
@Override
public void run() {
Program.launch(url);
}
};
helpAction.setEnabled(true);
helpAction.setToolTipText(tooltipText);
helpAction.setImageDescriptor(Icons.desc(ISharedImages.IMG_LCL_LINKTO_HELP));

return helpAction;
}

private Buttons() {}
}
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.Buttons;
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(Buttons.HELP_BTN_BNDTOOLS_EXPLORER);
toolBarManager.update(true);

return header;
}

Expand Down
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.Buttons;
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(Buttons.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.Buttons;
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(Buttons.HELP_BTN_RESOLUTION_VIEW);

}

private void doEEActionMenu(IToolBarManager toolBarManager) {
Expand Down

0 comments on commit dbde546

Please sign in to comment.