Skip to content

Commit

Permalink
Shortcut to Target Platform preferences in editor
Browse files Browse the repository at this point in the history
This helps when a user wants to switch between target definitions without the
need of either navigating to another target definition file or the preference
page listing all Target Platforms.

Resolves #1281
  • Loading branch information
thahnen committed Jun 2, 2024
1 parent d92416a commit 78661d2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ public class PDEUIMessages extends NLS {

public static String AbstractTargetPage_reloadTarget;

public static String AbstractTargetPage_openPreferences;

public static String AddActivationHeaderResolution_label;

public static String AddAutomaticModuleResolution_desc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import org.eclipse.pde.internal.ui.PDEPlugin;
import org.eclipse.pde.internal.ui.PDEPluginImages;
import org.eclipse.pde.internal.ui.PDEUIMessages;
import org.eclipse.pde.internal.ui.preferences.TargetPlatformPreferencePage;
import org.eclipse.pde.internal.ui.shared.target.ITargetChangedListener;
import org.eclipse.pde.internal.ui.shared.target.TargetContentsGroup;
import org.eclipse.pde.internal.ui.shared.target.TargetLocationsGroup;
Expand All @@ -87,6 +88,7 @@
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.dialogs.PreferencesUtil;
import org.eclipse.ui.dialogs.SaveAsDialog;
import org.eclipse.ui.forms.AbstractFormPart;
import org.eclipse.ui.forms.HyperlinkGroup;
Expand Down Expand Up @@ -406,8 +408,19 @@ public void run() {
export.setToolTipText("Export"); //$NON-NLS-1$
export.setImageDescriptor(PDEPluginImages.DESC_EXPORT_TARGET_TOOL);

Action openTPPreference = new Action("openTPPreference") { //$NON-NLS-1$
@Override
public void run() {
String pageId = TargetPlatformPreferencePage.PAGE_ID;
PreferencesUtil.createPreferenceDialogOn(getSite().getShell(), pageId, null, null).open();
}
};
openTPPreference.setToolTipText(PDEUIMessages.AbstractTargetPage_openPreferences);
openTPPreference.setImageDescriptor(PDEPluginImages.DESC_SETTINGS_OBJ);

form.getToolBarManager().add(setAsTarget);
form.getToolBarManager().add(export);
form.getToolBarManager().add(openTPPreference);
form.getToolBarManager().add(help);
form.updateToolBar();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,7 @@ SchemaAttributeDetails_use=Use:
AbstractPluginBlock_counter={0} out of {1} selected
AbstractTargetPage_setTarget=Set as Active Target Platform
AbstractTargetPage_reloadTarget=Reload Target Platform
AbstractTargetPage_openPreferences=Open 'Target Platform' preference (lists all available target)
###### Launchers #######################################
MainTab_name = &Main
MainTab_AttributeLabel_LauncherPDEVersion=PDE version
Expand Down

0 comments on commit 78661d2

Please sign in to comment.