Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit

Permalink
Merge pull request #362 from eharris369/299-addLearnMoreLinkToRepoMgm…
Browse files Browse the repository at this point in the history
…tDialog

Issue #299: Add a learn more link to the manage template sources dialog
  • Loading branch information
eharris369 authored Oct 11, 2019
2 parents 11fe890 + 8346b1d commit c4b1b42
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,7 @@ public class Messages extends NLS {
public static String RepoMgmtDialogMessage;

public static String RepoMgmtDescription;
public static String RepoMgmtLearnMoreLink;
public static String RepoMgmtTableLabel;
public static String RepoMgmtAddButton;
public static String RepoMgmtRemoveButton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,7 @@ RepoMgmtDialogTitle=Manage Template Sources
RepoMgmtDialogMessage=Add, remove, enable and disable template sources

RepoMgmtDescription=Enable or disable template sources using the check boxes. Use the buttons to add and remove template sources. Default template sources cannot be removed.
RepoMgmtLearnMoreLink=Learn more...
RepoMgmtTableLabel=Template &sources
RepoMgmtAddButton=&Add...
RepoMgmtRemoveButton=&Remove
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@

public class RepositoryManagementComposite extends Composite {

private static final String DOC_URL = "https://www.eclipse.org/codewind/mdteclipseusingadifferenttemplate.html";

private final CodewindConnection connection;
private final List<RepositoryInfo> repoList;
private List<RepoEntry> repoEntries;
Expand Down Expand Up @@ -94,7 +96,25 @@ protected void createControl() {
description.setText("");
description.setBackground(this.getBackground());
description.setForeground(this.getForeground());
description.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
description.setLayoutData(new GridData(GridData.FILL, GridData.END, true, false, 1, 1));

Link learnMoreLink = new Link(this, SWT.NONE);
learnMoreLink.setText("<a>" + Messages.RepoMgmtLearnMoreLink + "</a>");
learnMoreLink.setLayoutData(new GridData(GridData.END, GridData.END, false, false, 1, 1));

learnMoreLink.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent event) {
try {
IWorkbenchBrowserSupport browserSupport = PlatformUI.getWorkbench().getBrowserSupport();
IWebBrowser browser = browserSupport.getExternalBrowser();
URL url = new URL(DOC_URL);
browser.openURL(url);
} catch (Exception e) {
Logger.logError("An error occurred trying to open an external browser at: " + DOC_URL, e); //$NON-NLS-1$
}
}
});

new Label(this, SWT.NONE).setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false, 2, 1));

Expand Down

0 comments on commit c4b1b42

Please sign in to comment.