From dbde54638d47a84945ddde8aa6ea9c9fe6241058 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Sun, 29 Oct 2023 18:57:01 +0100 Subject: [PATCH 1/7] 1st draft of help buttons for views HELP_BTN_REPOSITORIES, HELP_BTN_BNDTOOLS_EXPLORER, HELP_BTN_RESOLUTION_VIEW Signed-off-by: Christoph Rueger --- .../src/bndtools/editor/common/Buttons.java | 42 +++++++++++++++++++ .../bndtools/explorer/BndtoolsExplorer.java | 4 ++ .../views/repository/RepositoriesView.java | 5 +++ .../views/resolution/ResolutionView.java | 4 ++ 4 files changed, 55 insertions(+) create mode 100644 bndtools.core/src/bndtools/editor/common/Buttons.java diff --git a/bndtools.core/src/bndtools/editor/common/Buttons.java b/bndtools.core/src/bndtools/editor/common/Buttons.java new file mode 100644 index 0000000000..40a4fb235b --- /dev/null +++ b/bndtools.core/src/bndtools/editor/common/Buttons.java @@ -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() {} +} diff --git a/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java b/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java index a7527ed349..6013f41512 100644 --- a/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java +++ b/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java @@ -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; @@ -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; } diff --git a/bndtools.core/src/bndtools/views/repository/RepositoriesView.java b/bndtools.core/src/bndtools/views/repository/RepositoriesView.java index 36865b20c0..4ded75013d 100644 --- a/bndtools.core/src/bndtools/views/repository/RepositoriesView.java +++ b/bndtools.core/src/bndtools/views/repository/RepositoriesView.java @@ -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; @@ -767,6 +768,8 @@ public void run() { }); } + + void createContextMenu() { MenuManager mgr = new MenuManager(); Menu menu = mgr.createContextMenu(viewer.getControl()); @@ -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()); } /** diff --git a/bndtools.core/src/bndtools/views/resolution/ResolutionView.java b/bndtools.core/src/bndtools/views/resolution/ResolutionView.java index 09666b1402..0c7565f61c 100644 --- a/bndtools.core/src/bndtools/views/resolution/ResolutionView.java +++ b/bndtools.core/src/bndtools/views/resolution/ResolutionView.java @@ -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; @@ -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) { From 98cf6050d5d7767b4decc3201e8daf22d002fab8 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Sun, 29 Oct 2023 20:01:47 +0100 Subject: [PATCH 2/7] add help buttons for .bnd and .bndrun editor Signed-off-by: Christoph Rueger --- .../src/bndtools/editor/common/Buttons.java | 54 +++++++++++++++---- .../editor/pages/BundleContentPage.java | 8 +++ .../bndtools/editor/pages/ProjectRunPage.java | 4 ++ 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/bndtools.core/src/bndtools/editor/common/Buttons.java b/bndtools.core/src/bndtools/editor/common/Buttons.java index 40a4fb235b..e043bc87e2 100644 --- a/bndtools.core/src/bndtools/editor/common/Buttons.java +++ b/bndtools.core/src/bndtools/editor/common/Buttons.java @@ -2,6 +2,7 @@ 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.swt.program.Program; import org.eclipse.ui.ISharedImages; @@ -12,30 +13,65 @@ */ public final class Buttons { - public static final Action HELP_BTN_REPOSITORIES = createHelpButton( + 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( + 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( + 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."); + "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 = createHelpButton( + "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."); + + public static final ActionContributionItem HELP_BTN_BND_EDITOR_RUN = createHelpButtonWithText( + "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."); + + /** + * Creates a help button with icon and tooltip. + * + * @param url + * @param tooltipText + * @return + */ private static Action createHelpButton(String url, String tooltipText) { - Action helpAction = new Action("Help", IAction.AS_PUSH_BUTTON) { + Action btn = 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)); + btn.setEnabled(true); + btn.setToolTipText(tooltipText); + btn.setImageDescriptor(Icons.desc(ISharedImages.IMG_LCL_LINKTO_HELP)); + + return btn; + } + + /** + * Creates a helpbutton with icon, text and tooltip. + * + * @param url + * @param buttonText + * @param tooltipText + * @return + */ + private static ActionContributionItem createHelpButtonWithText(String url, String buttonText, String tooltipText) { + Action btn = createHelpButton(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 helpAction; + return helpContrib; } private Buttons() {} diff --git a/bndtools.core/src/bndtools/editor/pages/BundleContentPage.java b/bndtools.core/src/bndtools/editor/pages/BundleContentPage.java index aeb536f855..e8e5f710fa 100644 --- a/bndtools.core/src/bndtools/editor/pages/BundleContentPage.java +++ b/bndtools.core/src/bndtools/editor/pages/BundleContentPage.java @@ -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; @@ -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.Buttons; import bndtools.editor.common.MDSashForm; import bndtools.editor.contents.BundleCalculatedImportsPart; import bndtools.editor.contents.GeneralInfoPart; @@ -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(Buttons.HELP_BTN_BND_EDITOR); + toolbar.update(true); + Form form = scrolledForm.getForm(); toolkit.decorateFormHeading(form); form.addMessageHyperlinkListener(new MessageHyperlinkAdapter(getEditor())); diff --git a/bndtools.core/src/bndtools/editor/pages/ProjectRunPage.java b/bndtools.core/src/bndtools/editor/pages/ProjectRunPage.java index ff09531bfa..0bdf063a57 100644 --- a/bndtools.core/src/bndtools/editor/pages/ProjectRunPage.java +++ b/bndtools.core/src/bndtools/editor/pages/ProjectRunPage.java @@ -23,6 +23,7 @@ import aQute.bnd.build.Workspace; import aQute.bnd.build.model.BndEditModel; import bndtools.central.Central; +import bndtools.editor.common.Buttons; import bndtools.editor.common.MDSashForm; import bndtools.editor.project.AvailableBundlesPart; import bndtools.editor.project.RepositorySelectionPart; @@ -142,6 +143,9 @@ protected void createFormContent(IManagedForm managedForm) { form.getToolBarManager() .add(exportContrib); + form.getToolBarManager() + .add(Buttons.HELP_BTN_BND_EDITOR_RUN); + form.getToolBarManager() .update(true); From b05a414d07d87b08f8f468a63e440801259d37b1 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Mon, 30 Oct 2023 14:14:46 +0100 Subject: [PATCH 3/7] Extend welcome screen * add Bndtools to Overview and Tutorials and link to relevant pages on bndtools.org * before this change there was already an entry in the Whats new section, but usually the Overview is the first thing shown. So I added it to the overview too to have more visibility for bndtools Signed-off-by: Christoph Rueger --- .../bndtools.cocoa.macosx.aarch64.bndrun | 5 +++++ .../bndtools.cocoa.macosx.x86_64.bndrun | 5 +++++ .../bndtools.gtk.linux.x86_64.bndrun | 5 +++++ bndtools.core/bndtools.win32.x86_64.bndrun | 5 +++++ .../intro/whatsnewExtensionContent.xml | 22 +++++++++++++++++++ .../unprocessed/intro/css/whatsnew.css | 18 ++++++++++++++- .../unprocessed/intro/css/whatsnew.properties | 4 ++++ 7 files changed, 63 insertions(+), 1 deletion(-) diff --git a/bndtools.core/bndtools.cocoa.macosx.aarch64.bndrun b/bndtools.core/bndtools.cocoa.macosx.aarch64.bndrun index f038254aad..1426f7f23b 100644 --- a/bndtools.core/bndtools.cocoa.macosx.aarch64.bndrun +++ b/bndtools.core/bndtools.cocoa.macosx.aarch64.bndrun @@ -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)',\ diff --git a/bndtools.core/bndtools.cocoa.macosx.x86_64.bndrun b/bndtools.core/bndtools.cocoa.macosx.x86_64.bndrun index 479b82db99..e143e4d54d 100644 --- a/bndtools.core/bndtools.cocoa.macosx.x86_64.bndrun +++ b/bndtools.core/bndtools.cocoa.macosx.x86_64.bndrun @@ -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)',\ diff --git a/bndtools.core/bndtools.gtk.linux.x86_64.bndrun b/bndtools.core/bndtools.gtk.linux.x86_64.bndrun index 9b6f225c0e..596b46ec15 100644 --- a/bndtools.core/bndtools.gtk.linux.x86_64.bndrun +++ b/bndtools.core/bndtools.gtk.linux.x86_64.bndrun @@ -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)',\ diff --git a/bndtools.core/bndtools.win32.x86_64.bndrun b/bndtools.core/bndtools.win32.x86_64.bndrun index 3100d7c7dd..3f8eaa01f6 100644 --- a/bndtools.core/bndtools.win32.x86_64.bndrun +++ b/bndtools.core/bndtools.win32.x86_64.bndrun @@ -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)',\ diff --git a/bndtools.core/resources/processed/intro/whatsnewExtensionContent.xml b/bndtools.core/resources/processed/intro/whatsnewExtensionContent.xml index de9e577ed3..14d95448d9 100644 --- a/bndtools.core/resources/processed/intro/whatsnewExtensionContent.xml +++ b/bndtools.core/resources/processed/intro/whatsnewExtensionContent.xml @@ -1,6 +1,28 @@ + + + + + Learn how to develop OSGi applications with Bndtools! + + + + + + + + + + In this tutorial we will build a sample OSGi application composed of two components and an API. + + + + + diff --git a/bndtools.core/resources/unprocessed/intro/css/whatsnew.css b/bndtools.core/resources/unprocessed/intro/css/whatsnew.css index 34d70adcde..8927fa22ba 100644 --- a/bndtools.core/resources/unprocessed/intro/css/whatsnew.css +++ b/bndtools.core/resources/unprocessed/intro/css/whatsnew.css @@ -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); -} +} \ No newline at end of file diff --git a/bndtools.core/resources/unprocessed/intro/css/whatsnew.properties b/bndtools.core/resources/unprocessed/intro/css/whatsnew.properties index 38b4b3897c..57e3af8df8 100644 --- a/bndtools.core/resources/unprocessed/intro/css/whatsnew.properties +++ b/bndtools.core/resources/unprocessed/intro/css/whatsnew.properties @@ -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 From 5875434953dd052354c531851769cbe53d11b88f Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Mon, 30 Oct 2023 15:19:52 +0100 Subject: [PATCH 4/7] use different help icon this icon is a bit smaller got the help.gif from Eclipse (License Eclipse Puglic License EPL) https://git.eclipse.org/c/platform/eclipse.platform.ui.git/plain/examples/org.eclipse.ui.forms.examples/icons/ see https://git.eclipse.org/c/platform/eclipse.platform.ui.git/plain/examples/org.eclipse.ui.forms.examples/about.html for license information) Signed-off-by: Christoph Rueger --- bndtools.core/icons.properties | 1 + .../resources/unprocessed/icons/help.gif | Bin 0 -> 259 bytes .../src/bndtools/editor/common/Buttons.java | 3 +-- 3 files changed, 2 insertions(+), 2 deletions(-) create mode 100644 bndtools.core/resources/unprocessed/icons/help.gif diff --git a/bndtools.core/icons.properties b/bndtools.core/icons.properties index bd363847eb..72d5dc916a 100644 --- a/bndtools.core/icons.properties +++ b/bndtools.core/icons.properties @@ -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 diff --git a/bndtools.core/resources/unprocessed/icons/help.gif b/bndtools.core/resources/unprocessed/icons/help.gif new file mode 100644 index 0000000000000000000000000000000000000000..9d70301dae38843e0ad0ea28a42710f4c920ea9f GIT binary patch literal 259 zcmV+e0sQ_)Nk%w1VGsZi0K@U5T+@im_^v zw``QSd7ZwMvdp5p(@=n__51(&{r~9j_4NDy_x%6u^7Z!o|LpSh`ThU={{Qv-|M>m? z_x=C-{{Qy<|NsC0A^8LW0018VEC2ui01yBW000Gm;3tk`X+Do(pr)8Mgb)zTT0U^W z?HoWqBm<#9IH-g~!w8q*Bn*q1fs<(fKMz8r<6!JkoDSh?xL`1m9m0T!L@LTpc|+%{ z6&U&@o~2NBDm#AzS2%uu4h|L`78F(^LK+$zDjF6V1aU4f5IhhQKQ{(25)w2vEhs81 JEv+RX06QZIfSmvU literal 0 HcmV?d00001 diff --git a/bndtools.core/src/bndtools/editor/common/Buttons.java b/bndtools.core/src/bndtools/editor/common/Buttons.java index e043bc87e2..5c13a43996 100644 --- a/bndtools.core/src/bndtools/editor/common/Buttons.java +++ b/bndtools.core/src/bndtools/editor/common/Buttons.java @@ -5,7 +5,6 @@ import org.eclipse.jface.action.ActionContributionItem; 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 @@ -49,7 +48,7 @@ public void run() { }; btn.setEnabled(true); btn.setToolTipText(tooltipText); - btn.setImageDescriptor(Icons.desc(ISharedImages.IMG_LCL_LINKTO_HELP)); + btn.setImageDescriptor(Icons.desc("help")); return btn; } From 88d82f0ff07b09a890fa91c1ebf1ae3b1c9493b2 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Mon, 30 Oct 2023 15:42:00 +0100 Subject: [PATCH 5/7] add help button for Workspace bnd editor e.g. for the main cnf/build.bnd Signed-off-by: Christoph Rueger --- bndtools.core/src/bndtools/editor/common/Buttons.java | 8 ++++++-- .../src/bndtools/editor/pages/WorkspacePage.java | 8 ++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/bndtools.core/src/bndtools/editor/common/Buttons.java b/bndtools.core/src/bndtools/editor/common/Buttons.java index 5c13a43996..050f12fd07 100644 --- a/bndtools.core/src/bndtools/editor/common/Buttons.java +++ b/bndtools.core/src/bndtools/editor/common/Buttons.java @@ -26,11 +26,15 @@ public final class Buttons { public static final Action HELP_BTN_BND_EDITOR = createHelpButton( "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."); + "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 = createHelpButton( + "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 = createHelpButtonWithText( "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."); + "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."); /** * Creates a help button with icon and tooltip. diff --git a/bndtools.core/src/bndtools/editor/pages/WorkspacePage.java b/bndtools.core/src/bndtools/editor/pages/WorkspacePage.java index 9d4f51236b..b6570a8b25 100644 --- a/bndtools.core/src/bndtools/editor/pages/WorkspacePage.java +++ b/bndtools.core/src/bndtools/editor/pages/WorkspacePage.java @@ -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; @@ -16,6 +17,7 @@ import aQute.bnd.build.model.BndEditModel; import aQute.bnd.build.model.clauses.HeaderClause; +import bndtools.editor.common.Buttons; import bndtools.editor.workspace.PluginPathPart; import bndtools.editor.workspace.PluginsPart; import bndtools.editor.workspace.WorkspaceMainPart; @@ -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(Buttons.HELP_BTN_BND_EDITOR_WORKSPACE); + toolbar.update(false); + // Create controls Composite body = form.getBody(); From 2591b3a9def01f41400389a4f211f9aba9a4e1e5 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Mon, 30 Oct 2023 15:48:00 +0100 Subject: [PATCH 6/7] add intro bundles to shared.bndrun * the resolver now adds the same bundles which I aded manually in an earlier commit. I verified.. files are exactly the same. Signed-off-by: Christoph Rueger --- bndtools.core/bndtools.shared.bndrun | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/bndtools.core/bndtools.shared.bndrun b/bndtools.core/bndtools.shared.bndrun index ca3d521450..a16fd2560b 100644 --- a/bndtools.core/bndtools.shared.bndrun +++ b/bndtools.core/bndtools.shared.bndrun @@ -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',\ From 81cb4ee099cff25c67042974e77ce76b5d809ad8 Mon Sep 17 00:00:00 2001 From: Christoph Rueger Date: Tue, 31 Oct 2023 12:07:08 +0100 Subject: [PATCH 7/7] code cleanup and renaming implement suggested changes (rename classes, move to method to util class) Signed-off-by: Christoph Rueger --- .../common/{Buttons.java => HelpButtons.java} | 63 ++++--------------- .../editor/pages/BundleContentPage.java | 4 +- .../bndtools/editor/pages/ProjectRunPage.java | 4 +- .../bndtools/editor/pages/WorkspacePage.java | 4 +- .../bndtools/explorer/BndtoolsExplorer.java | 4 +- .../src/bndtools/utils/EditorUtils.java | 46 ++++++++++++++ .../views/repository/RepositoriesView.java | 4 +- .../views/resolution/ResolutionView.java | 4 +- 8 files changed, 69 insertions(+), 64 deletions(-) rename bndtools.core/src/bndtools/editor/common/{Buttons.java => HelpButtons.java} (60%) diff --git a/bndtools.core/src/bndtools/editor/common/Buttons.java b/bndtools.core/src/bndtools/editor/common/HelpButtons.java similarity index 60% rename from bndtools.core/src/bndtools/editor/common/Buttons.java rename to bndtools.core/src/bndtools/editor/common/HelpButtons.java index 050f12fd07..1431b6ea3b 100644 --- a/bndtools.core/src/bndtools/editor/common/Buttons.java +++ b/bndtools.core/src/bndtools/editor/common/HelpButtons.java @@ -1,81 +1,40 @@ package bndtools.editor.common; -import org.bndtools.core.ui.icons.Icons; +import static bndtools.utils.EditorUtils.createButton; +import static bndtools.utils.EditorUtils.createButtonWithText; + import org.eclipse.jface.action.Action; import org.eclipse.jface.action.ActionContributionItem; -import org.eclipse.jface.action.IAction; -import org.eclipse.swt.program.Program; /** * Helper containing help buttons for different parts / views which link to the * user manual. */ -public final class Buttons { +public final class HelpButtons { - public static final Action HELP_BTN_REPOSITORIES = createHelpButton( + 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 = createHelpButton( + 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 = createHelpButton( + 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 = createHelpButton( + 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 = createHelpButton( + 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 = createHelpButtonWithText( + 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."); - /** - * Creates a help button with icon and tooltip. - * - * @param url - * @param tooltipText - * @return - */ - private static Action createHelpButton(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 helpbutton with icon, text and tooltip. - * - * @param url - * @param buttonText - * @param tooltipText - * @return - */ - private static ActionContributionItem createHelpButtonWithText(String url, String buttonText, String tooltipText) { - Action btn = createHelpButton(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; - } - - private Buttons() {} + private HelpButtons() {} } diff --git a/bndtools.core/src/bndtools/editor/pages/BundleContentPage.java b/bndtools.core/src/bndtools/editor/pages/BundleContentPage.java index e8e5f710fa..781b625a8d 100644 --- a/bndtools.core/src/bndtools/editor/pages/BundleContentPage.java +++ b/bndtools.core/src/bndtools/editor/pages/BundleContentPage.java @@ -27,7 +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.Buttons; +import bndtools.editor.common.HelpButtons; import bndtools.editor.common.MDSashForm; import bndtools.editor.contents.BundleCalculatedImportsPart; import bndtools.editor.contents.GeneralInfoPart; @@ -74,7 +74,7 @@ protected void createFormContent(IManagedForm managedForm) { // buttons top of form IToolBarManager toolbar = scrolledForm.getForm() .getToolBarManager(); - toolbar.add(Buttons.HELP_BTN_BND_EDITOR); + toolbar.add(HelpButtons.HELP_BTN_BND_EDITOR); toolbar.update(true); Form form = scrolledForm.getForm(); diff --git a/bndtools.core/src/bndtools/editor/pages/ProjectRunPage.java b/bndtools.core/src/bndtools/editor/pages/ProjectRunPage.java index 0bdf063a57..18e58ee5c8 100644 --- a/bndtools.core/src/bndtools/editor/pages/ProjectRunPage.java +++ b/bndtools.core/src/bndtools/editor/pages/ProjectRunPage.java @@ -23,7 +23,7 @@ import aQute.bnd.build.Workspace; import aQute.bnd.build.model.BndEditModel; import bndtools.central.Central; -import bndtools.editor.common.Buttons; +import bndtools.editor.common.HelpButtons; import bndtools.editor.common.MDSashForm; import bndtools.editor.project.AvailableBundlesPart; import bndtools.editor.project.RepositorySelectionPart; @@ -144,7 +144,7 @@ protected void createFormContent(IManagedForm managedForm) { .add(exportContrib); form.getToolBarManager() - .add(Buttons.HELP_BTN_BND_EDITOR_RUN); + .add(HelpButtons.HELP_BTN_BND_EDITOR_RUN); form.getToolBarManager() .update(true); diff --git a/bndtools.core/src/bndtools/editor/pages/WorkspacePage.java b/bndtools.core/src/bndtools/editor/pages/WorkspacePage.java index b6570a8b25..87cd33712a 100644 --- a/bndtools.core/src/bndtools/editor/pages/WorkspacePage.java +++ b/bndtools.core/src/bndtools/editor/pages/WorkspacePage.java @@ -17,7 +17,7 @@ import aQute.bnd.build.model.BndEditModel; import aQute.bnd.build.model.clauses.HeaderClause; -import bndtools.editor.common.Buttons; +import bndtools.editor.common.HelpButtons; import bndtools.editor.workspace.PluginPathPart; import bndtools.editor.workspace.PluginsPart; import bndtools.editor.workspace.WorkspaceMainPart; @@ -80,7 +80,7 @@ protected void createFormContent(IManagedForm managedForm) { // buttons top of form IToolBarManager toolbar = form.getForm() .getToolBarManager(); - toolbar.add(Buttons.HELP_BTN_BND_EDITOR_WORKSPACE); + toolbar.add(HelpButtons.HELP_BTN_BND_EDITOR_WORKSPACE); toolbar.update(false); // Create controls diff --git a/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java b/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java index 6013f41512..c62f6a2a3a 100644 --- a/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java +++ b/bndtools.core/src/bndtools/explorer/BndtoolsExplorer.java @@ -69,7 +69,7 @@ import bndtools.Plugin; import bndtools.central.Central; import bndtools.central.sync.WorkspaceSynchronizer; -import bndtools.editor.common.Buttons; +import bndtools.editor.common.HelpButtons; import bndtools.preferences.BndPreferences; import bndtools.preferences.ui.BndPreferencePage; @@ -239,7 +239,7 @@ public void linkActivated(HyperlinkEvent e) { toolBarManager.add(pin); toolBarManager.update(true); - toolBarManager.add(Buttons.HELP_BTN_BNDTOOLS_EXPLORER); + toolBarManager.add(HelpButtons.HELP_BTN_BNDTOOLS_EXPLORER); toolBarManager.update(true); return header; diff --git a/bndtools.core/src/bndtools/utils/EditorUtils.java b/bndtools.core/src/bndtools/utils/EditorUtils.java index 6331e653d9..15e0502944 100644 --- a/bndtools.core/src/bndtools/utils/EditorUtils.java +++ b/bndtools.core/src/bndtools/utils/EditorUtils.java @@ -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; @@ -36,4 +41,45 @@ public static final IFormPart findPartByClass(IManagedForm form, Class