-
-
Notifications
You must be signed in to change notification settings - Fork 305
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
implement suggested changes (rename classes, move to method to util class) Signed-off-by: Christoph Rueger <[email protected]>
- Loading branch information
1 parent
2591b3a
commit 81cb4ee
Showing
8 changed files
with
69 additions
and
64 deletions.
There are no files selected for viewing
63 changes: 11 additions & 52 deletions
63
...e/src/bndtools/editor/common/Buttons.java → ...c/bndtools/editor/common/HelpButtons.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() {} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters