diff options
author | ustieber | 2011-05-19 18:02:13 +0000 |
---|---|---|
committer | ustieber | 2011-05-19 18:02:13 +0000 |
commit | 6979fde809908eba099e41e3df94819dcb753d4b (patch) | |
tree | 5fc3ad1ce27f573014d427f4463237cda50bdc64 /target_explorer/plugins | |
parent | a1dfa9cc409eb736911e0be32b45f57a866e34c5 (diff) | |
download | org.eclipse.tcf-6979fde809908eba099e41e3df94819dcb753d4b.tar.gz org.eclipse.tcf-6979fde809908eba099e41e3df94819dcb753d4b.tar.xz org.eclipse.tcf-6979fde809908eba099e41e3df94819dcb753d4b.zip |
Target Explorer: Add necessary new target wizard infra-structure
Diffstat (limited to 'target_explorer/plugins')
38 files changed, 1464 insertions, 116 deletions
diff --git a/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF index a697591f5..1a3809e5d 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tm.te.core/META-INF/MANIFEST.MF @@ -10,7 +10,9 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin -Export-Package: org.eclipse.tm.te.core.extensions;version="1.0.0", - org.eclipse.tm.te.core.nls;version="1.0.0", - org.eclipse.tm.te.core.preferences;version="1.0.0", - org.eclipse.tm.te.core.tracing;version="1.0.0" +Export-Package: org.eclipse.tm.te.core.activator;x-internal:=true, + org.eclipse.tm.te.core.extensions, + org.eclipse.tm.te.core.internal;x-internal:=true, + org.eclipse.tm.te.core.nls, + org.eclipse.tm.te.core.preferences, + org.eclipse.tm.te.core.tracing diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.core/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.tcf.core/META-INF/MANIFEST.MF index 3c9be0a22..34e9db5a6 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.core/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.core/META-INF/MANIFEST.MF @@ -10,6 +10,12 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin -Export-Package: org.eclipse.tm.te.tcf.core;version="1.0.0", - org.eclipse.tm.te.tcf.core.interfaces;version="1.0.0", - org.eclipse.tm.te.tcf.core.interfaces.listeners;version="1.0.0" +Export-Package: org.eclipse.tm.te.tcf.core, + org.eclipse.tm.te.tcf.core.activator;x-internal:=true, + org.eclipse.tm.te.tcf.core.interfaces, + org.eclipse.tm.te.tcf.core.interfaces.listeners, + org.eclipse.tm.te.tcf.core.internal;x-internal:=true, + org.eclipse.tm.te.tcf.core.internal.interfaces;x-internal:=true, + org.eclipse.tm.te.tcf.core.internal.listener;x-internal:=true, + org.eclipse.tm.te.tcf.core.internal.nls;x-internal:=true, + org.eclipse.tm.te.tcf.core.internal.utils;x-internal:=true diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.filesystem/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.tcf.filesystem/META-INF/MANIFEST.MF index 52ea92f4c..f92bc7b58 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.filesystem/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.filesystem/META-INF/MANIFEST.MF @@ -17,7 +17,13 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin -Export-Package: org.eclipse.tm.te.tcf.filesystem.controls;version="1.0.0", - org.eclipse.tm.te.tcf.filesystem.dialogs;version="1.0.0", - org.eclipse.tm.te.tcf.filesystem.interfaces.preferences;version="1.0.0", - org.eclipse.tm.te.tcf.filesystem.model;version="1.0.0" +Export-Package: org.eclipse.tm.te.tcf.filesystem.activator;x-internal:=true, + org.eclipse.tm.te.tcf.filesystem.controls, + org.eclipse.tm.te.tcf.filesystem.dialogs, + org.eclipse.tm.te.tcf.filesystem.interfaces.preferences, + org.eclipse.tm.te.tcf.filesystem.internal;x-internal:=true, + org.eclipse.tm.te.tcf.filesystem.internal.explorer;x-internal:=true, + org.eclipse.tm.te.tcf.filesystem.internal.help;x-internal:=true, + org.eclipse.tm.te.tcf.filesystem.internal.nls;x-internal:=true, + org.eclipse.tm.te.tcf.filesystem.internal.preferences;x-internal:=true, + org.eclipse.tm.te.tcf.filesystem.model diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.locator/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.tcf.locator/META-INF/MANIFEST.MF index 0b6fddbed..bec51d8a6 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.locator/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.locator/META-INF/MANIFEST.MF @@ -12,12 +12,16 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin -Export-Package: org.eclipse.tm.te.tcf.locator;version="1.0.0", - org.eclipse.tm.te.tcf.locator.interfaces;version="1.0.0", - org.eclipse.tm.te.tcf.locator.interfaces.nodes;version="1.0.0", - org.eclipse.tm.te.tcf.locator.interfaces.preferences;version="1.0.0", - org.eclipse.tm.te.tcf.locator.interfaces.services;version="1.0.0", - org.eclipse.tm.te.tcf.locator.listener;version="1.0.0", - org.eclipse.tm.te.tcf.locator.nodes;version="1.0.0", - org.eclipse.tm.te.tcf.locator.services;version="1.0.0", - org.eclipse.tm.te.tcf.locator.utils;version="1.0.0" +Export-Package: org.eclipse.tm.te.tcf.locator, + org.eclipse.tm.te.tcf.locator.activator;x-internal:=true, + org.eclipse.tm.te.tcf.locator.interfaces, + org.eclipse.tm.te.tcf.locator.interfaces.nodes, + org.eclipse.tm.te.tcf.locator.interfaces.preferences, + org.eclipse.tm.te.tcf.locator.interfaces.services, + org.eclipse.tm.te.tcf.locator.internal;x-internal:=true, + org.eclipse.tm.te.tcf.locator.internal.nls;x-internal:=true, + org.eclipse.tm.te.tcf.locator.internal.preferences;x-internal:=true, + org.eclipse.tm.te.tcf.locator.listener, + org.eclipse.tm.te.tcf.locator.nodes, + org.eclipse.tm.te.tcf.locator.services, + org.eclipse.tm.te.tcf.locator.utils diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/META-INF/MANIFEST.MF index 04b46de06..22cac6421 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/META-INF/MANIFEST.MF @@ -17,4 +17,16 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin -Export-Package: org.eclipse.tm.te.tcf.ui.tables;version="1.0.0" +Export-Package: org.eclipse.tm.te.tcf.ui.activator;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.editor.pages;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.filter;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.handler;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.help;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.model;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.navigator;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.navigator.images;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.nls;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.wizards;x-internal:=true, + org.eclipse.tm.te.tcf.ui.internal.wizards.pages;x-internal:=true, + org.eclipse.tm.te.tcf.ui.tables diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.properties index 4cb50fdbc..91cb31544 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.properties @@ -13,11 +13,12 @@ providerName = Eclipse.org # ***** Filter ***** -UnreachablePeersFilter.name=Unreachable Remote Targets (TCF) +UnreachablePeersFilter.name=Unreachable TCF Targets # ***** Wizards ***** -NewPeerWizard.name=TCF Remote Target +NewWizards.category.name=Target Communication Framework (TCF) +NewTargetWizard.name=TCF Target # ***** Editor Pages ***** diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml index bddba4fef..c0261b546 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/plugin.xml @@ -31,7 +31,7 @@ id="org.eclipse.tm.te.tcf.ui.navigator.sorter"/> <commonWizard type="new" - wizardId="org.eclipse.tm.te.tcf.ui.wizards.NewPeerWizard"> + wizardId="org.eclipse.tm.te.tcf.ui.wizards.NewRemoteTargetWizard"> <enablement> <instanceof value="org.eclipse.tm.te.tcf.locator.interfaces.nodes.IPeerModel"/> </enablement> @@ -46,15 +46,19 @@ </commonFilter> </extension> -<!-- New wizard contributions --> +<!-- New target wizard contributions --> - <extension point="org.eclipse.ui.newWizards"> + <extension point="org.eclipse.tm.te.ui.newWizards"> + <category + id="org.eclipse.tm.te.tcf.ui.newWizards.category" + name="%NewWizards.category.name"> + </category> <wizard - category="org.eclipse.tm.te.ui.newWizards.category" - class="org.eclipse.tm.te.tcf.ui.internal.wizards.NewRemoteTargetWizard" + category="org.eclipse.tm.te.tcf.ui.newWizards.category" + class="org.eclipse.tm.te.tcf.ui.internal.wizards.NewTargetWizard" icon="icons/elcl16/newRemoteTarget_wiz.gif" - id="org.eclipse.tm.te.tcf.ui.wizards.NewPeerWizard" - name="%NewPeerWizard.name"> + id="org.eclipse.tm.te.tcf.ui.wizards.NewTargetWizard" + name="%NewTargetWizard.name"> </wizard> </extension> diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/help/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/help/IContextHelpIds.java index cdd7b9a48..fc53d6463 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/help/IContextHelpIds.java +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/help/IContextHelpIds.java @@ -22,9 +22,9 @@ public interface IContextHelpIds { public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$ /** - * New TCF remote target wizard main page. + * New TCF target wizard main page. */ - public final static String NEW_REMOTE_TARGET_WIZARD_PAGE = PREFIX + "NewRemoteTargetWizardPage"; //$NON-NLS-1$ + public final static String NEW_TARGET_WIZARD_PAGE = PREFIX + "NewTargetWizardPage"; //$NON-NLS-1$ /** * Target Explorer details editor page: Node properties diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.java index f0dadb93f..17d80d020 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.java @@ -83,13 +83,13 @@ public class Messages extends NLS { public static String NodePropertiesLabelProvider_services_local; public static String NodePropertiesLabelProvider_services_remote; - public static String NewRemoteTargetWizard_windowTitle; - - public static String NewRemoteTargetWizardPage_title; - public static String NewRemoteTargetWizardPage_description; - public static String NewRemoteTargetWizardPage_TransportTypeControl_label; - public static String NewRemoteTargetWizardPage_AgentHostControl_label; - public static String NewRemoteTargetWizardPage_AgentPortControl_label; - public static String NewRemoteTargetWizardPage_PeerIdControl_label; - public static String NewRemoteTargetWizardPage_PeerNameControl_label; + public static String NewTargetWizard_windowTitle; + + public static String NewTargetWizardPage_title; + public static String NewTargetWizardPage_description; + public static String NewTargetWizardPage_TransportTypeControl_label; + public static String NewTargetWizardPage_AgentHostControl_label; + public static String NewTargetWizardPage_AgentPortControl_label; + public static String NewTargetWizardPage_PeerIdControl_label; + public static String NewTargetWizardPage_PeerNameControl_label; } diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.properties index d656ee622..3a13def02 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/nls/Messages.properties @@ -19,12 +19,12 @@ NodePropertiesLabelProvider_services_remote=Remote Services AddPeerDialog_title=Add New Peer -NewRemoteTargetWizard_windowTitle=New Remote Target +NewTargetWizard_windowTitle=New TCF Target -NewRemoteTargetWizardPage_title=New Remote Target -NewRemoteTargetWizardPage_description=Specify the attributes to connect to the remote target. -NewRemoteTargetWizardPage_TransportTypeControl_label=Type: -NewRemoteTargetWizardPage_AgentHostControl_label=Host: -NewRemoteTargetWizardPage_AgentPortControl_label=Port: -NewRemoteTargetWizardPage_PeerIdControl_label=ID: -NewRemoteTargetWizardPage_PeerNameControl_label=Name: +NewTargetWizardPage_title=New TCF Target +NewTargetWizardPage_description=Specify the attributes to connect to the TCF target. +NewTargetWizardPage_TransportTypeControl_label=Type: +NewTargetWizardPage_AgentHostControl_label=Host: +NewTargetWizardPage_AgentPortControl_label=Port: +NewTargetWizardPage_PeerIdControl_label=ID: +NewTargetWizardPage_PeerNameControl_label=Name: diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/NewRemoteTargetWizard.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/NewTargetWizard.java index 15a306277..9282b6a7a 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/NewRemoteTargetWizard.java +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/NewTargetWizard.java @@ -25,7 +25,7 @@ import org.eclipse.tm.te.tcf.locator.interfaces.nodes.IPeerModel; import org.eclipse.tm.te.tcf.locator.interfaces.services.ILocatorModelLookupService;
import org.eclipse.tm.te.tcf.ui.internal.model.Model;
import org.eclipse.tm.te.tcf.ui.internal.nls.Messages;
-import org.eclipse.tm.te.tcf.ui.internal.wizards.pages.NewRemoteTargetWizardPage;
+import org.eclipse.tm.te.tcf.ui.internal.wizards.pages.NewTargetWizardPage;
import org.eclipse.tm.te.ui.views.interfaces.IUIConstants;
import org.eclipse.tm.te.ui.wizards.AbstractWizard;
import org.eclipse.ui.INewWizard;
@@ -35,18 +35,25 @@ import org.eclipse.ui.IWorkbenchPart; import org.eclipse.ui.PlatformUI;
/**
- * New TCF remote target wizard implementation.
+ * New TCF target wizard implementation.
*/
-public class NewRemoteTargetWizard extends AbstractWizard implements INewWizard {
+public class NewTargetWizard extends AbstractWizard implements INewWizard {
/* (non-Javadoc)
* @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
*/
public void init(IWorkbench workbench, IStructuredSelection selection) {
// Set the window title
- setWindowTitle(Messages.NewRemoteTargetWizard_windowTitle);
+ setWindowTitle(Messages.NewTargetWizard_windowTitle);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
// Create and add the wizard pages
- addPage(new NewRemoteTargetWizardPage());
+ addPage(new NewTargetWizardPage());
}
/* (non-Javadoc)
@@ -54,12 +61,12 @@ public class NewRemoteTargetWizard extends AbstractWizard implements INewWizard */
@Override
public boolean performFinish() {
- IWizardPage page = getPage(NewRemoteTargetWizardPage.class.getName());
- if (page instanceof NewRemoteTargetWizardPage) {
+ IWizardPage page = getPage(NewTargetWizardPage.class.getName());
+ if (page instanceof NewTargetWizardPage) {
// Trigger the saving of the widget history
- ((NewRemoteTargetWizardPage)page).saveWidgetValues();
+ ((NewTargetWizardPage)page).saveWidgetValues();
// Get the peer attributes map from the page
- Map<String, String> peerAttributes = ((NewRemoteTargetWizardPage)page).getPeerAttributes();
+ Map<String, String> peerAttributes = ((NewTargetWizardPage)page).getPeerAttributes();
if (peerAttributes != null) {
// Try to connect to the peer
IChannel channel = null;
diff --git a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/pages/NewRemoteTargetWizardPage.java b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/pages/NewTargetWizardPage.java index 39f67d2b1..b6310251a 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/pages/NewRemoteTargetWizardPage.java +++ b/target_explorer/plugins/org.eclipse.tm.te.tcf.ui/src/org/eclipse/tm/te/tcf/ui/internal/wizards/pages/NewTargetWizardPage.java @@ -34,7 +34,7 @@ import org.eclipse.ui.PlatformUI; * Wizard page implementation querying all information needed
* to create the different TCF peer types.
*/
-public class NewRemoteTargetWizardPage extends AbstractWizardPage {
+public class NewTargetWizardPage extends AbstractWizardPage {
private Combo fTransportTypeControl;
private Text fAddressControl;
private Text fPortControl;
@@ -44,8 +44,8 @@ public class NewRemoteTargetWizardPage extends AbstractWizardPage { /**
* Constructor.
*/
- public NewRemoteTargetWizardPage() {
- this(NewRemoteTargetWizardPage.class.getName());
+ public NewTargetWizardPage() {
+ this(NewTargetWizardPage.class.getName());
}
/**
@@ -53,7 +53,7 @@ public class NewRemoteTargetWizardPage extends AbstractWizardPage { *
* @param pageName The page name. Must not be <code>null</code>.
*/
- public NewRemoteTargetWizardPage(String pageName) {
+ public NewTargetWizardPage(String pageName) {
super(pageName);
}
@@ -63,8 +63,8 @@ public class NewRemoteTargetWizardPage extends AbstractWizardPage { */
public void createControl(Composite parent) {
// Setup title and description
- setTitle(Messages.NewRemoteTargetWizardPage_title);
- setDescription(Messages.NewRemoteTargetWizardPage_description);
+ setTitle(Messages.NewTargetWizardPage_title);
+ setDescription(Messages.NewTargetWizardPage_description);
// Create the main panel
Composite mainPanel = new Composite(parent, SWT.NONE);
@@ -74,7 +74,7 @@ public class NewRemoteTargetWizardPage extends AbstractWizardPage { setControl(mainPanel);
// Setup the help
- PlatformUI.getWorkbench().getHelpSystem().setHelp(mainPanel, IContextHelpIds.NEW_REMOTE_TARGET_WIZARD_PAGE);
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(mainPanel, IContextHelpIds.NEW_TARGET_WIZARD_PAGE);
// Create the main panel sub controls
createMainPanelControls(mainPanel);
@@ -99,7 +99,7 @@ public class NewRemoteTargetWizardPage extends AbstractWizardPage { // Add the controls
Label label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewRemoteTargetWizardPage_TransportTypeControl_label);
+ label.setText(Messages.NewTargetWizardPage_TransportTypeControl_label);
fTransportTypeControl = new Combo(panel, SWT.READ_ONLY);
fTransportTypeControl.setItems(new String[] { "TCP" }); //$NON-NLS-1$
@@ -108,7 +108,7 @@ public class NewRemoteTargetWizardPage extends AbstractWizardPage { fTransportTypeControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewRemoteTargetWizardPage_AgentHostControl_label);
+ label.setText(Messages.NewTargetWizardPage_AgentHostControl_label);
fAddressControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
fAddressControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
@@ -119,7 +119,7 @@ public class NewRemoteTargetWizardPage extends AbstractWizardPage { });
label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewRemoteTargetWizardPage_AgentPortControl_label);
+ label.setText(Messages.NewTargetWizardPage_AgentPortControl_label);
fPortControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
fPortControl.setText("1534"); //$NON-NLS-1$
@@ -131,13 +131,13 @@ public class NewRemoteTargetWizardPage extends AbstractWizardPage { });
label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewRemoteTargetWizardPage_PeerIdControl_label);
+ label.setText(Messages.NewTargetWizardPage_PeerIdControl_label);
fPeerIdControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
fPeerIdControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
label = new Label(panel, SWT.NONE);
- label.setText(Messages.NewRemoteTargetWizardPage_PeerNameControl_label);
+ label.setText(Messages.NewTargetWizardPage_PeerNameControl_label);
fPeerNameControl = new Text(panel, SWT.SINGLE | SWT.BORDER);
fPeerNameControl.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.ui.views/META-INF/MANIFEST.MF index f54227fd2..c43f81452 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/META-INF/MANIFEST.MF @@ -10,9 +10,19 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.ui;bundle-version="3.6.2", org.eclipse.ui.forms;bundle-version="3.5.2", org.eclipse.ui.navigator;bundle-version="3.5.0", - org.eclipse.tm.te.core;bundle-version="1.0.0" + org.eclipse.tm.te.core;bundle-version="1.0.0", + org.eclipse.tm.te.ui;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin -Export-Package: org.eclipse.tm.te.ui.views.editor;version="1.0.0", - org.eclipse.tm.te.ui.views.interfaces;version="1.0.0" +Export-Package: org.eclipse.tm.te.ui.views.activator;x-internal:=true, + org.eclipse.tm.te.ui.views.editor, + org.eclipse.tm.te.ui.views.interfaces, + org.eclipse.tm.te.ui.views.internal;x-internal:=true, + org.eclipse.tm.te.ui.views.internal.actions;x-internal:=true, + org.eclipse.tm.te.ui.views.internal.editor;x-internal:=true, + org.eclipse.tm.te.ui.views.internal.expressions;x-internal:=true, + org.eclipse.tm.te.ui.views.internal.extensions;x-internal:=true, + org.eclipse.tm.te.ui.views.internal.handler;x-internal:=true, + org.eclipse.tm.te.ui.views.internal.nls;x-internal:=true, + org.eclipse.tm.te.ui.views.perspective diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.properties b/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.properties index 0da27fad4..7327262bb 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.properties @@ -30,8 +30,6 @@ TargetExplorer.name=Target Explorer Editor.name=Target Explorer Details Editor # ***** Command and menu contributions ***** -Command.category.name=Target Explorer Commands - Command.open.name=Open PropertiesAction.label=&Properties diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.xml index 296c2584f..81d1d5ea1 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/plugin.xml @@ -140,10 +140,6 @@ <!-- Command contributions --> <extension point="org.eclipse.ui.commands"> - <category - id="org.eclipse.tm.te.ui.commands.category" - name="%Command.category.name"> - </category> <!-- Definition of the Common Navigator global retargetable open action id as command. --> @@ -193,7 +189,6 @@ </with> </activeWhen> </handler> - </extension> <!-- Eclipse core expressions property tester --> diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/interfaces/ImageConsts.java b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/interfaces/ImageConsts.java index aba89ee72..b6aea8d5f 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/interfaces/ImageConsts.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/interfaces/ImageConsts.java @@ -18,7 +18,7 @@ public interface ImageConsts { * the bundle directory. */ public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$ - + /** * The directory where to load view related images from, relative to * the image root directory. diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/actions/NewActionProvider.java b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/actions/NewActionProvider.java index 82fdf64e0..9fd636589 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/actions/NewActionProvider.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/actions/NewActionProvider.java @@ -10,14 +10,17 @@ package org.eclipse.tm.te.ui.views.internal.actions;
import org.eclipse.jface.action.IMenuManager;
+import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.action.Separator;
+import org.eclipse.tm.te.ui.interfaces.IContextHelpIds;
+import org.eclipse.tm.te.ui.interfaces.ImageConsts;
import org.eclipse.tm.te.ui.views.interfaces.IUIConstants;
import org.eclipse.tm.te.ui.views.internal.nls.Messages;
+import org.eclipse.tm.te.ui.wizards.newWizard.NewWizardRegistry;
+import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.ActionFactory;
-import org.eclipse.ui.actions.ActionFactory.IWorkbenchAction;
+import org.eclipse.ui.internal.actions.CommandAction;
import org.eclipse.ui.navigator.CommonActionProvider;
import org.eclipse.ui.navigator.ICommonActionExtensionSite;
import org.eclipse.ui.navigator.ICommonMenuConstants;
@@ -28,9 +31,12 @@ import org.eclipse.ui.navigator.WizardActionGroup; * Action provider implementation providing the "New >" content menu
* content.
*/
+@SuppressWarnings("restriction")
public class NewActionProvider extends CommonActionProvider {
- // Reference to the action showing the "Other..." dialog
- private IWorkbenchAction fOtherDialogAction = null;
+ // Reference to the action showing the "Other..." dialog (context menu)
+ private CommandAction fNewWizardCommandAction = null;
+ // Reference to the action showing the "Other..." dialog (toolbar)
+ private CommandAction fNewWizardCommandActionToolbar = null;
// Reference to the action group managing the context sensitive new wizards
private WizardActionGroup fNewWizardActionGroup = null;
@@ -45,9 +51,22 @@ public class NewActionProvider extends CommonActionProvider { // To initialize the actions, the workbench window instance is required
IWorkbenchWindow window = ((ICommonViewerWorkbenchSite)site.getViewSite()).getWorkbenchWindow();
// Initialize the actions
- fOtherDialogAction = ActionFactory.NEW.create(window);
+ fNewWizardCommandAction = new CommandAction(window, "org.eclipse.tm.te.ui.command.newWizards"); //$NON-NLS-1$
+ fNewWizardCommandAction.setImageDescriptor(null);
+ fNewWizardCommandAction.setDisabledImageDescriptor(null);
+ fNewWizardCommandAction.setText(Messages.NewActionProvider_NewWizardCommandAction_label);
+ fNewWizardCommandAction.setToolTipText(Messages.NewActionProvider_NewWizardCommandAction_tooltip);
+ window.getWorkbench().getHelpSystem().setHelp(fNewWizardCommandAction, IContextHelpIds.NEW_TARGET_WIZARD);
+
+ fNewWizardCommandActionToolbar = new CommandAction(window, "org.eclipse.tm.te.ui.command.newWizards"); //$NON-NLS-1$
+ fNewWizardCommandActionToolbar.setImageDescriptor(org.eclipse.tm.te.ui.activator.UIPlugin.getImageDescriptor(ImageConsts.IMAGE_NEW_TARGET_WIZARD_ENABLED));
+ fNewWizardCommandActionToolbar.setDisabledImageDescriptor(org.eclipse.tm.te.ui.activator.UIPlugin.getImageDescriptor(ImageConsts.IMAGE_NEW_TARGET_WIZARD_DISABLED));
+ fNewWizardCommandActionToolbar.setText(Messages.NewActionProvider_NewWizardCommandAction_label);
+ fNewWizardCommandActionToolbar.setToolTipText(Messages.NewActionProvider_NewWizardCommandAction_tooltip);
+ window.getWorkbench().getHelpSystem().setHelp(fNewWizardCommandActionToolbar, IContextHelpIds.NEW_TARGET_WIZARD);
+
fNewWizardActionGroup = new WizardActionGroup(window,
- PlatformUI.getWorkbench().getNewWizardRegistry(),
+ NewWizardRegistry.getInstance(),
WizardActionGroup.TYPE_NEW,
site.getContentService());
}
@@ -58,9 +77,9 @@ public class NewActionProvider extends CommonActionProvider { */
@Override
public void dispose() {
- if (fOtherDialogAction != null) {
- fOtherDialogAction.dispose();
- fOtherDialogAction = null;
+ if (fNewWizardCommandAction != null) {
+ fNewWizardCommandAction.dispose();
+ fNewWizardCommandAction = null;
}
if (fNewWizardActionGroup != null) {
fNewWizardActionGroup.dispose();
@@ -75,12 +94,14 @@ public class NewActionProvider extends CommonActionProvider { @Override
public void fillContextMenu(IMenuManager menu) {
// If none of the actions got created, there is nothing to do here
- if (fOtherDialogAction == null && fNewWizardActionGroup == null) {
+ if (fNewWizardCommandAction == null && fNewWizardActionGroup == null) {
return;
}
// Create the new sub menu
- IMenuManager newMenu = new MenuManager(Messages.NewActionProvider_NewMenu_label, IUIConstants.ID_EXPLORER + ".menu.new"); //$NON-NLS-1$
+ IMenuManager newMenu = new MenuManager(Messages.NewActionProvider_NewMenu_label,
+ org.eclipse.tm.te.ui.activator.UIPlugin.getImageDescriptor(ImageConsts.IMAGE_NEW_TARGET_WIZARD_ENABLED),
+ IUIConstants.ID_EXPLORER + ".menu.new"); //$NON-NLS-1$
// Add the context sensitive wizards (commonWizard element)
if (fNewWizardActionGroup != null) {
@@ -92,12 +113,25 @@ public class NewActionProvider extends CommonActionProvider { newMenu.add(new Separator(ICommonMenuConstants.GROUP_ADDITIONS));
// Add the "Other..." dialog action
- if (fOtherDialogAction != null) {
+ if (fNewWizardCommandAction != null) {
newMenu.add(new Separator());
- newMenu.add(fOtherDialogAction);
+ newMenu.add(fNewWizardCommandAction);
}
// The menu will be appended after the GROUP_NEW group.
menu.insertAfter(ICommonMenuConstants.GROUP_NEW, newMenu);
}
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.actions.ActionGroup#fillActionBars(org.eclipse.ui.IActionBars)
+ */
+ @Override
+ public void fillActionBars(IActionBars actionBars) {
+ if (fNewWizardCommandActionToolbar == null) {
+ return;
+ }
+
+ IToolBarManager toolbar = actionBars.getToolBarManager();
+ toolbar.insertAfter(ICommonMenuConstants.GROUP_NEW, fNewWizardCommandActionToolbar);
+ }
}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/nls/Messages.java b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/nls/Messages.java index c82162003..361a3c160 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/nls/Messages.java @@ -29,7 +29,13 @@ public class Messages extends NLS { // **** Declare externalized string id's down here ***** - public static String PropertiesCommandHandler_error_initPartFailed; + public static String NewWizard_dialog_title; + public static String NewWizardSelectionPage_title; + public static String NewWizardSelectionPage_description; public static String NewActionProvider_NewMenu_label; + public static String NewActionProvider_NewWizardCommandAction_label; + public static String NewActionProvider_NewWizardCommandAction_tooltip; + + public static String PropertiesCommandHandler_error_initPartFailed; } diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/nls/Messages.properties index d437b577f..ae56ba58b 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tm.te.ui.views/src/org/eclipse/tm/te/ui/views/internal/nls/Messages.properties @@ -3,8 +3,12 @@ # Externalized Strings. # -PropertiesCommandHandler_error_initPartFailed=Failed to initialize the Target Explorer details editor. - # ***** Action Provider ***** NewActionProvider_NewMenu_label=&New +NewActionProvider_NewWizardCommandAction_label=&Other... +NewActionProvider_NewWizardCommandAction_tooltip=Open the New target wizard + +# ***** Command Handler ***** + +PropertiesCommandHandler_error_initPartFailed=Failed to initialize the Target Explorer details editor. diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/META-INF/MANIFEST.MF b/target_explorer/plugins/org.eclipse.tm.te.ui/META-INF/MANIFEST.MF index 0f776b4e0..60b620773 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/META-INF/MANIFEST.MF +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/META-INF/MANIFEST.MF @@ -9,18 +9,22 @@ Require-Bundle: org.eclipse.core.runtime;bundle-version="3.6.0", org.eclipse.core.expressions;bundle-version="3.4.200", org.eclipse.ui;bundle-version="3.6.2", org.eclipse.ui.forms;bundle-version="3.5.2", - org.eclipse.help;bundle-version="3.5.0" + org.eclipse.help;bundle-version="3.5.0", + org.eclipse.tm.te.core;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin -Export-Package: org.eclipse.tm.te.ui;version="1.0.0", - org.eclipse.tm.te.ui.dialogs;version="1.0.0", - org.eclipse.tm.te.ui.forms;version="1.0.0", - org.eclipse.tm.te.ui.images;version="1.0.0", - org.eclipse.tm.te.ui.interfaces;version="1.0.0", - org.eclipse.tm.te.ui.nls;version="1.0.0", - org.eclipse.tm.te.ui.tables;version="1.0.0", - org.eclipse.tm.te.ui.tables.properties;version="1.0.0", - org.eclipse.tm.te.ui.trees;version="1.0.0", - org.eclipse.tm.te.ui.wizards;version="1.0.0", - org.eclipse.tm.te.ui.wizards.pages;version="1.0.0" +Export-Package: org.eclipse.tm.te.ui, + org.eclipse.tm.te.ui.activator;x-internal:=true, + org.eclipse.tm.te.ui.dialogs, + org.eclipse.tm.te.ui.forms, + org.eclipse.tm.te.ui.images, + org.eclipse.tm.te.ui.interfaces, + org.eclipse.tm.te.ui.interfaces.newWizard, + org.eclipse.tm.te.ui.nls, + org.eclipse.tm.te.ui.tables, + org.eclipse.tm.te.ui.tables.properties, + org.eclipse.tm.te.ui.trees, + org.eclipse.tm.te.ui.wizards, + org.eclipse.tm.te.ui.wizards.newWizard, + org.eclipse.tm.te.ui.wizards.pages diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/icons/dlcl16/newtarget_wiz.gif b/target_explorer/plugins/org.eclipse.tm.te.ui/icons/dlcl16/newtarget_wiz.gif Binary files differnew file mode 100644 index 000000000..5d9eae9e5 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/icons/dlcl16/newtarget_wiz.gif diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/icons/elcl16/newtarget_wiz.gif b/target_explorer/plugins/org.eclipse.tm.te.ui/icons/elcl16/newtarget_wiz.gif Binary files differnew file mode 100644 index 000000000..9f2b4acc7 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/icons/elcl16/newtarget_wiz.gif diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/icons/wizban/newtarget_wiz.gif b/target_explorer/plugins/org.eclipse.tm.te.ui/icons/wizban/newtarget_wiz.gif Binary files differnew file mode 100644 index 000000000..6a4a5ef6b --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/icons/wizban/newtarget_wiz.gif diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/plugin.properties b/target_explorer/plugins/org.eclipse.tm.te.ui/plugin.properties index 73ddc751a..c1ee84c79 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/plugin.properties +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/plugin.properties @@ -13,4 +13,10 @@ providerName = Eclipse.org # ***** Wizards ***** -NewWizards.category.name=Target Explorer +NewWizards.category.name=General + +# ***** Command contributions ***** +Command.category.name=Target Explorer Commands + +Command.newWizards.name=New Target +Command.newWizards.description=Open the New target wizard diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/plugin.xml b/target_explorer/plugins/org.eclipse.tm.te.ui/plugin.xml index 28b9fa9eb..247cbe1dc 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/plugin.xml +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/plugin.xml @@ -1,14 +1,41 @@ <?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
+ <extension-point id="newWizards" name="New Target Wizards" schema="schema/newWizards.exsd"/>
-<!-- New wizard contributions -->
+<!-- New target wizard contributions -->
- <extension point="org.eclipse.ui.newWizards">
+ <extension point="org.eclipse.tm.te.ui.newWizards">
<category
- id="org.eclipse.tm.te.ui.newWizards.category"
+ id="org.eclipse.tm.te.ui.newWizards.category.general"
name="%NewWizards.category.name">
</category>
</extension>
+<!-- Command contributions -->
+ <extension point="org.eclipse.ui.commands">
+ <category
+ id="org.eclipse.tm.te.ui.commands.category"
+ name="%Command.category.name">
+ </category>
+
+ <command
+ categoryId="org.eclipse.tm.te.ui.commands.category"
+ defaultHandler="org.eclipse.tm.te.ui.wizards.newWizard.NewWizardCommandHandler"
+ description="%Command.newWizards.description"
+ helpContextId="org.eclipse.tm.te.ui.command.newWizards"
+ id="org.eclipse.tm.te.ui.command.newWizards"
+ name="%Command.newWizards.name">
+ </command>
+ </extension>
+
+<!-- Command image contributions -->
+ <extension point="org.eclipse.ui.commandImages">
+ <image
+ commandId="org.eclipse.tm.te.ui.command.newWizards"
+ disabledIcon="icons/dlcl16/newtarget_wiz.gif"
+ icon="icons/elcl16/newtarget_wiz.gif">
+ </image>
+ </extension>
+
</plugin>
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/schema/newWizards.exsd b/target_explorer/plugins/org.eclipse.tm.te.ui/schema/newWizards.exsd new file mode 100644 index 000000000..f064da2a6 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/schema/newWizards.exsd @@ -0,0 +1,220 @@ +<?xml version='1.0' encoding='UTF-8'?>
+<!-- Schema file written by PDE -->
+<schema targetNamespace="org.eclipse.tm.te.ui" xmlns="http://www.w3.org/2001/XMLSchema">
+<annotation>
+ <appinfo>
+ <meta.schema plugin="org.eclipse.tm.te.ui" id="newWizards" name="New Target Wizards"/>
+ </appinfo>
+ <documentation>
+ This extension point is used to register target creation wizard extensions. Target creation wizards appear as choices within the "New Target" dialog, and are used to create target definitions. Target creation wizards can be organized in categories. Uncategorized wizards or wizards with invalid category paths will be sorted in as non-categorized root element.
+<p>
+Target creation wizards may optionally specify a description subelement whose body should contain short text about the wizard.
+ </documentation>
+ </annotation>
+
+ <element name="extension">
+ <annotation>
+ <appinfo>
+ <meta.element />
+ </appinfo>
+ </annotation>
+ <complexType>
+ <choice>
+ <element ref="category" minOccurs="0" maxOccurs="unbounded"/>
+ <element ref="wizard" minOccurs="0" maxOccurs="unbounded"/>
+ </choice>
+ <attribute name="point" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified identifier of the target extension point
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="id" type="string">
+ <annotation>
+ <documentation>
+ an optional identifier of the extension instance
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string">
+ <annotation>
+ <documentation>
+ an optional name of the extension instance
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="category">
+ <complexType>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ a unique name that can be used to identify this category
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ a translatable name of the category that will be used in the dialog box
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="parentCategory" type="string">
+ <annotation>
+ <documentation>
+ a path to another category if this category should be added as a child
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="identifier" basedOn="org.eclipse.tm.te.ui.newWizards/category/@id"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="wizard">
+ <complexType>
+ <sequence>
+ <element ref="description" minOccurs="0" maxOccurs="1"/>
+ </sequence>
+ <attribute name="id" type="string" use="required">
+ <annotation>
+ <documentation>
+ a unique id that can be used to identify this wizard
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="name" type="string" use="required">
+ <annotation>
+ <documentation>
+ a translatable name of the wizard that will be used in the UI
+ </documentation>
+ <appinfo>
+ <meta.attribute translatable="true"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="icon" type="string">
+ <annotation>
+ <documentation>
+ a relative path of an icon that will be used together with the name to represent the wizard as one of the choices in the creation dialog box.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="resource"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="category" type="string">
+ <annotation>
+ <documentation>
+ a slash-delimited path ('/') of category IDs. Each token in the path must represent a valid category ID previously defined by this or some other plug-in. If omitted, the wizard will be added to the "Other" category.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="class" type="string" use="required">
+ <annotation>
+ <documentation>
+ a fully qualified name of the Java class implementing <samp>org.eclipse.ui.IWorkbenchWizard</samp>.
+ </documentation>
+ <appinfo>
+ <meta.attribute kind="java" basedOn="org.eclipse.jface.wizard.Wizard:org.eclipse.ui.IWorkbenchWizard"/>
+ </appinfo>
+ </annotation>
+ </attribute>
+ <attribute name="canFinishEarly" type="boolean">
+ <annotation>
+ <documentation>
+ whether the wizard is capable of finishing without ever showing pages to the user.
+ </documentation>
+ </annotation>
+ </attribute>
+ <attribute name="hasPages" type="boolean">
+ <annotation>
+ <documentation>
+ whether the wizard provides any pages.
+ </documentation>
+ </annotation>
+ </attribute>
+ </complexType>
+ </element>
+
+ <element name="description" type="string">
+ <annotation>
+ <appinfo>
+ <meta.element translatable="true"/>
+ </appinfo>
+ <documentation>
+ an optional subelement whose body contains a short text describing what the wizard will do when started
+ </documentation>
+ </annotation>
+ </element>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="since"/>
+ </appinfo>
+ <documentation>
+ Target Explorer 1.0.0
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="examples"/>
+ </appinfo>
+ <documentation>
+ The following is an example of this extension point's usage:
+
+<p>
+<pre>
+ <extension point="org.eclipse.tm.te.ui.newWizards">
+ <category id="org.eclipse.tm.te.ui.newWizards.category"
+ name="General"/>
+ <wizard
+ categoryId="org.eclipse.tm.te.ui.newWizards.category"
+ class="org.eclipse.tm.te.tcf.ui.internal.wizards.NewTargetWizard"
+ id="org.eclipse.tm.te.tcf.ui.wizards.NewTargetWizard"
+ name="TCF Target">
+ </wizard>
+ </extension>
+</pre>
+</p>
+ </documentation>
+ </annotation>
+
+ <annotation>
+ <appinfo>
+ <meta.section type="apiinfo"/>
+ </appinfo>
+ <documentation>
+ The provider of a new target creation wizard must implement <samp>org.eclipse.ui.IWorkbenchWizard</samp>.
+ </documentation>
+ </annotation>
+
+
+ <annotation>
+ <appinfo>
+ <meta.section type="copyright"/>
+ </appinfo>
+ <documentation>
+ Copyright (c) 2011 Wind River Systems, Inc. and others.
+
+All rights reserved.
+
+This program and the accompanying materials are made available under the terms
+of the Eclipse Public License v1.0 which accompanies this distribution, and is
+available at http://www.eclipse.org/legal/epl-v10.html.
+ </documentation>
+ </annotation>
+
+</schema>
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/activator/UIPlugin.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/activator/UIPlugin.java index d8d6e1e1b..35b11b7ed 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/activator/UIPlugin.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/activator/UIPlugin.java @@ -9,6 +9,12 @@ *******************************************************************************/ package org.eclipse.tm.te.ui.activator; +import java.net.URL; + +import org.eclipse.jface.resource.ImageDescriptor; +import org.eclipse.jface.resource.ImageRegistry; +import org.eclipse.swt.graphics.Image; +import org.eclipse.tm.te.ui.interfaces.ImageConsts; import org.eclipse.ui.plugin.AbstractUIPlugin; import org.osgi.framework.BundleContext; @@ -61,4 +67,41 @@ public class UIPlugin extends AbstractUIPlugin { plugin = null; super.stop(context); } + + /* (non-Javadoc) + * @see org.eclipse.ui.plugin.AbstractUIPlugin#initializeImageRegistry(org.eclipse.jface.resource.ImageRegistry) + */ + @Override + protected void initializeImageRegistry(ImageRegistry registry) { + URL url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_WIZBAN + "newtarget_wiz.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.IMAGE_NEW_TARGET_WIZARD, ImageDescriptor.createFromURL(url)); + + url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_DLCL + "newtarget_wiz.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.IMAGE_NEW_TARGET_WIZARD_DISABLED, ImageDescriptor.createFromURL(url)); + + url = UIPlugin.getDefault().getBundle().getEntry(ImageConsts.IMAGE_DIR_ROOT + ImageConsts.IMAGE_DIR_ELCL + "newtarget_wiz.gif"); //$NON-NLS-1$ + registry.put(ImageConsts.IMAGE_NEW_TARGET_WIZARD_ENABLED, ImageDescriptor.createFromURL(url)); + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the <code>Image</code> object instance. + * + * @param key The key the image is registered with. + * @return The <code>Image</code> object instance or <code>null</code>. + */ + public static Image getImage(String key) { + return getDefault().getImageRegistry().get(key); + } + + /** + * Loads the image registered under the specified key from the image + * registry and returns the <code>ImageDescriptor</code> object instance. + * + * @param key The key the image is registered with. + * @return The <code>ImageDescriptor</code> object instance or <code>null</code>. + */ + public static ImageDescriptor getImageDescriptor(String key) { + return getDefault().getImageRegistry().getDescriptor(key); + } } diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IContextHelpIds.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IContextHelpIds.java new file mode 100644 index 000000000..986c232a6 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IContextHelpIds.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Uwe Stieber (Wind River) - initial API and implementation + *******************************************************************************/ +package org.eclipse.tm.te.ui.interfaces; + +import org.eclipse.tm.te.ui.activator.UIPlugin; + +/** + * Target Explorer: Context help id definitions. + */ +public interface IContextHelpIds { + + /** + * UI plug-in common context help id prefix. + */ + public final static String PREFIX = UIPlugin.getUniqueIdentifier() + "."; //$NON-NLS-1$ + + /** + * New target wizard context help id. + */ + public final static String NEW_TARGET_WIZARD = PREFIX + "NewTargetWizard"; //$NON-NLS-1$ +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IUIConstants.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IUIConstants.java index 3ff613ac9..f1805de23 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IUIConstants.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/IUIConstants.java @@ -22,4 +22,9 @@ public interface IUIConstants { * The Target Explorer common controls context menu id base part. */ public static final String ID_CONTROL_MENUS_BASE = UIPlugin.getUniqueIdentifier() + ".controls"; //$NON-NLS-1$ + + /** + * The Target Explorer new target wizard selection page context help id. + */ + public static final String HELP_NEW_WIZARD_SELECTION_PAGE = UIPlugin.getUniqueIdentifier() + ".NewWizardSelectionPage"; //$NON-NLS-1$ } diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/ImageConsts.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/ImageConsts.java new file mode 100644 index 000000000..f3568306d --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/ImageConsts.java @@ -0,0 +1,54 @@ +/******************************************************************************* + * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved. + * This program and the accompanying materials are made available under the terms + * of the Eclipse Public License v1.0 which accompanies this distribution, and is + * available at http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Uwe Stieber (Wind River) - initial API and implementation + *******************************************************************************/ +package org.eclipse.tm.te.ui.interfaces; + +/** + * Target Explorer: Image registry constants. + */ +public interface ImageConsts { + /** + * The root directory where to load the images from, relative to + * the bundle directory. + */ + public final static String IMAGE_DIR_ROOT = "icons/"; //$NON-NLS-1$ + + /** + * The directory where to load disabled local toolbar images from, + * relative to the image root directory. + */ + public final static String IMAGE_DIR_DLCL = "dlcl16/"; //$NON-NLS-1$ + + /** + * The directory where to load enabled local toolbar images from, + * relative to the image root directory. + */ + public final static String IMAGE_DIR_ELCL = "elcl16/"; //$NON-NLS-1$ + + /** + * The directory where to load wizard banner images from, + * relative to the image root directory. + */ + public final static String IMAGE_DIR_WIZBAN = "wizban/"; //$NON-NLS-1$ + + /** + * The key to access the New target wizard banner image. + */ + public static final String IMAGE_NEW_TARGET_WIZARD = "NewTargetWizard"; //$NON-NLS-1$ + + /** + * The key to access the New target wizard image (enabled). + */ + public static final String IMAGE_NEW_TARGET_WIZARD_ENABLED = "NewTargetWizard_enabled"; //$NON-NLS-1$ + + /** + * The key to access the New target wizard image (disabled). + */ + public static final String IMAGE_NEW_TARGET_WIZARD_DISABLED = "NewTargetWizard_disabled"; //$NON-NLS-1$ +} diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/newWizard/INewTargetWizard.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/newWizard/INewTargetWizard.java new file mode 100644 index 000000000..529ce20b0 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/interfaces/newWizard/INewTargetWizard.java @@ -0,0 +1,31 @@ +/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Uwe Stieber (Wind River) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.te.ui.interfaces.newWizard;
+
+import org.eclipse.tm.te.ui.wizards.newWizard.NewWizardSelectionPage;
+import org.eclipse.ui.wizards.IWizardDescriptor;
+
+/**
+ * Target Explorer: Interface to be implemented optionally by new target wizards.
+ */
+public interface INewTargetWizard {
+
+ /**
+ * Called by the {@link NewWizardSelectionPage} to associate the wizard
+ * instance with the wizard descriptor the wizard got created from.
+ * <p>
+ * This method is called just before
+ * {@link #init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)}
+ * is called.
+ *
+ * @param descriptor
+ */
+ public void setWizardDescriptor(IWizardDescriptor descriptor);
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.java index 297235b6b..d56669d2e 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.java @@ -29,7 +29,15 @@ public class Messages extends NLS { // **** Declare externalized string id's down here ***** - public static String AbstractImageRegistry_error_malformedImage; + public static String NewWizard_dialog_title; + + public static String NewWizardSelectionPage_title; + public static String NewWizardSelectionPage_description; + public static String NewWizardSelectionPage_wizards; + public static String NewWizardSelectionPage_createWizardFailed; + + public static String AbstractAction_UnsatisfiedLinkError_title; + public static String AbstractAction_UnsatisfiedLinkError_message; public static String NodePropertiesTableControl_section_title; public static String NodePropertiesTableControl_section_title_noSelection; diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.properties index b943bab0c..d552b4aa3 100644 --- a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/nls/Messages.properties @@ -3,7 +3,22 @@ # Externalized Strings. # -AbstractImageRegistry_error_malformedImage=Malformed Image +# ***** Wizards ***** + +NewWizard_dialog_title=New Target + +NewWizardSelectionPage_title=Select a target wizard +NewWizardSelectionPage_description=Please select the target creation wizard matching the target to connect to. +NewWizardSelectionPage_wizards=Wizards: +NewWizardSelectionPage_createWizardFailed=The selected wizard could not be started. + +# ***** Actions ***** + +AbstractAction_UnsatisfiedLinkError_title=Library Not Found +AbstractAction_UnsatisfiedLinkError_message=A required shared library could not be loaded. This is a serious \ +problem and is most likely caused by a incomplete or corrupted installation. + +# ***** Controls ***** NodePropertiesTableControl_section_title={0} Information NodePropertiesTableControl_section_title_noSelection=Node diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizard.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizard.java new file mode 100644 index 000000000..00a29c947 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizard.java @@ -0,0 +1,122 @@ +/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Uwe Stieber (Wind River) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.te.ui.wizards.newWizard;
+
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.Wizard;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.tm.te.ui.activator.UIPlugin;
+import org.eclipse.tm.te.ui.interfaces.ImageConsts;
+import org.eclipse.tm.te.ui.nls.Messages;
+import org.eclipse.ui.INewWizard;
+import org.eclipse.ui.IWorkbench;
+
+/**
+ * The New Target wizard implementation.
+ *
+ * @noextend This class is not intended to be subclassed by clients.
+ */
+public final class NewWizard extends Wizard implements INewWizard {
+ // The new target wizard registry to use
+ private NewWizardRegistry wizardRegistry;
+ // The new wizard selection page instance
+ private NewWizardSelectionPage mainPage;
+
+ /**
+ * Constructor.
+ */
+ public NewWizard() {
+ super();
+ setWindowTitle(Messages.NewWizard_dialog_title);
+ setForcePreviousAndNextButtons(true);
+ setNeedsProgressMonitor(true);
+
+ // Initialize the dialog settings for this wizard
+ IDialogSettings settings = UIPlugin.getDefault().getDialogSettings();
+ String sectionName = this.getClass().getName();
+ if (settings.getSection(sectionName) == null) settings.addNewSection(sectionName);
+ setDialogSettings(settings.getSection(sectionName));
+
+ wizardRegistry = NewWizardRegistry.getInstance();
+ mainPage = new NewWizardSelectionPage(wizardRegistry);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#dispose()
+ */
+ @Override
+ public void dispose() {
+ super.dispose();
+ mainPage = null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#getDefaultPageImage()
+ */
+ @Override
+ public Image getDefaultPageImage() {
+ return UIPlugin.getImage(ImageConsts.IMAGE_NEW_TARGET_WIZARD);
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IWorkbenchWizard#init(org.eclipse.ui.IWorkbench, org.eclipse.jface.viewers.IStructuredSelection)
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ if (mainPage != null) mainPage.init(workbench, selection);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#addPages()
+ */
+ @Override
+ public void addPages() {
+ if (mainPage != null) addPage(mainPage);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.rse.ui.wizards.AbstractSystemWizard#performFinish()
+ */
+ @Override
+ public boolean performFinish() {
+ if (mainPage != null) {
+ // Trigger the saving of the widget values of
+ // the main wizard selection page
+ mainPage.saveWidgetValues();
+
+ // If the finish is invoked directly from the main page,
+ // call performFinish() for the selected wizard too.
+ if (mainPage.equals(getContainer().getCurrentPage())) {
+ if (mainPage.canFinishEarly() && mainPage.getSelectedNode() != null) {
+ // Get the selected wizard
+ IWizard wizard = mainPage.getSelectedNode().getWizard();
+ if (wizard != null) {
+ wizard.setContainer(getContainer());
+ wizard.performFinish();
+ }
+ }
+ }
+ }
+ return true;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.Wizard#canFinish()
+ */
+ @Override
+ public boolean canFinish() {
+ if (mainPage != null && mainPage.equals(getContainer().getCurrentPage())) {
+ return mainPage.canFinishEarly();
+ }
+ return super.canFinish();
+ }
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardCommandHandler.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardCommandHandler.java new file mode 100644 index 000000000..9b6542372 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardCommandHandler.java @@ -0,0 +1,97 @@ +/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Uwe Stieber (Wind River) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.te.ui.wizards.newWizard;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.viewers.ISelection;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.swt.widgets.Shell;
+import org.eclipse.tm.te.ui.interfaces.IContextHelpIds;
+import org.eclipse.ui.IWorkbenchWindow;
+import org.eclipse.ui.handlers.HandlerUtil;
+
+/**
+ * Target Explorer: "org.eclipse.tm.te.ui.command.newWizards" default command handler implementation.
+ */
+public class NewWizardCommandHandler extends AbstractHandler {
+ /**
+ * The wizard dialog default width
+ */
+ private static final int DEFAULT_WIZARD_WIDTH = 500;
+
+ /**
+ * The wizard dialog default height
+ */
+ private static final int DEFAULT_WIZARD_HEIGHT = 500;
+
+ /**
+ * Creates the new target wizard instance.
+ *
+ * @return The new target wizard instance.
+ */
+ protected NewWizard createWizard() {
+ return new NewWizard();
+ }
+
+ /**
+ * Creates the new target wizard dialog instance.
+ *
+ * @param shell The parent shell or <code>null</code>.
+ * @param wizard The new target wizard instance. Must not be <code>null</code>.
+ *
+ * @return The wizard dialog instance.
+ */
+ protected WizardDialog createWizardDialog(Shell shell, IWizard wizard) {
+ Assert.isNotNull(wizard);
+ return new WizardDialog(shell, wizard);
+ }
+
+ /**
+ * Returns the current selection casted to {@link IStructuredSelection}.
+ *
+ * @param event The execution event.
+ * @return The current selection casted to {@link IStructuredSelection} or an empty selection.
+ */
+ protected IStructuredSelection getCurrentSelection(ExecutionEvent event) {
+ ISelection selection = HandlerUtil.getCurrentSelection(event);
+ return selection instanceof IStructuredSelection ? (IStructuredSelection)selection : StructuredSelection.EMPTY;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
+ */
+ public Object execute(ExecutionEvent event) throws ExecutionException {
+ IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
+ if (window != null) {
+ // Create the wizard
+ NewWizard wizard = createWizard();
+ // Initialize the wizard with the current workbench instance
+ // and the current selection
+ wizard.init(window.getWorkbench(), getCurrentSelection(event));
+
+ // Create and open the wizard dialog
+ WizardDialog dialog = createWizardDialog(window.getShell(), wizard);
+ dialog.create();
+ dialog.getShell().setSize(Math.max(DEFAULT_WIZARD_WIDTH, dialog.getShell().getSize().x), DEFAULT_WIZARD_HEIGHT);
+
+ window.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IContextHelpIds.NEW_TARGET_WIZARD);
+ dialog.open();
+ }
+
+ return null;
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardNode.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardNode.java new file mode 100644 index 000000000..1e7951fd0 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardNode.java @@ -0,0 +1,138 @@ +/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Uwe Stieber (Wind River) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.te.ui.wizards.newWizard;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.tm.te.ui.activator.UIPlugin;
+import org.eclipse.tm.te.ui.interfaces.newWizard.INewTargetWizard;
+import org.eclipse.tm.te.ui.nls.Messages;
+import org.eclipse.ui.IPluginContribution;
+import org.eclipse.ui.IWorkbenchWizard;
+import org.eclipse.ui.internal.util.Util;
+import org.eclipse.ui.wizards.IWizardDescriptor;
+
+/**
+ * Target Explorer: New wizard node implementation.
+ */
+@SuppressWarnings("restriction")
+/* default */ class NewWizardNode implements IWizardNode, IPluginContribution {
+ // The associated wizard descriptor
+ private final IWizardDescriptor descriptor;
+ // The parent wizard selection page
+ private final NewWizardSelectionPage page;
+
+ // The wizard instance, once created
+ private IWizard wizard;
+
+ /**
+ * Constructor.
+ *
+ * @param page The parent wizard selection page. Must not be <code>null</code>.
+ * @param descriptor The wizard descriptor. Must not be <code>null</code>.
+ */
+ public NewWizardNode(NewWizardSelectionPage page, IWizardDescriptor descriptor) {
+ Assert.isNotNull(page);
+ Assert.isNotNull(descriptor);
+
+ this.page = page;
+ this.descriptor = descriptor;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizardNode#dispose()
+ */
+ public void dispose() {
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizardNode#getExtent()
+ */
+ public Point getExtent() {
+ return new Point(-1, -1);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IPluginContribution#getLocalId()
+ */
+ public String getLocalId() {
+ IPluginContribution contribution = (IPluginContribution)Util.getAdapter(descriptor, IPluginContribution.class);
+ if (contribution != null) {
+ return contribution.getLocalId();
+ }
+ return descriptor.getId();
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.IPluginContribution#getPluginId()
+ */
+ public String getPluginId() {
+ IPluginContribution contribution = (IPluginContribution) Util.getAdapter(descriptor, IPluginContribution.class);
+ if (contribution != null) {
+ return contribution.getPluginId();
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizardNode#isContentCreated()
+ */
+ public boolean isContentCreated() {
+ return wizard != null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.IWizardNode#getWizard()
+ */
+ public IWizard getWizard() {
+ if (wizard == null) {
+ wizard = createWizard(descriptor);
+ }
+ return wizard;
+ }
+
+ /**
+ * Create the wizard associated with the specified wizard descriptor.
+ *
+ * @param descriptor The wizard descriptor. Must not be <code>null</code>.
+ * @return The wizard or <code>null</code> if the creation fails.
+ */
+ private final IWorkbenchWizard createWizard(IWizardDescriptor descriptor) {
+ Assert.isNotNull(descriptor);
+
+ IWorkbenchWizard wizard = null;
+
+ try {
+ // Create the wizard instance
+ wizard = descriptor.createWizard();
+
+ // If the wizard is a INewTargetWizard, associate the wizard descriptor
+ if (wizard instanceof INewTargetWizard) ((INewTargetWizard)wizard).setWizardDescriptor(descriptor);
+
+ // Initialize the wizard
+ IStructuredSelection wizardSelection = descriptor.adaptedSelection(page.getSelection());
+ wizard.init(page.getWorkbench(), wizardSelection);
+ } catch (CoreException e) {
+ page.setErrorMessage(Messages.NewWizardSelectionPage_createWizardFailed);
+
+ IStatus status = new Status(IStatus.ERROR, UIPlugin.getUniqueIdentifier(),
+ Messages.NewWizardSelectionPage_createWizardFailed, e);
+ UIPlugin.getDefault().getLog().log(status);
+ }
+
+ return wizard;
+ }
+}
\ No newline at end of file diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardRegistry.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardRegistry.java new file mode 100644 index 000000000..7cfde2b96 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardRegistry.java @@ -0,0 +1,62 @@ +/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Uwe Stieber (Wind River) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.te.ui.wizards.newWizard;
+
+
+import org.eclipse.tm.te.ui.activator.UIPlugin;
+import org.eclipse.ui.internal.wizards.AbstractExtensionWizardRegistry;
+
+/**
+ * Target Explorer: New target wizard registry.
+ *
+ * @see org.eclipse.ui.internal.wizards.NewWizardRegistry
+ */
+@SuppressWarnings("restriction")
+public final class NewWizardRegistry extends AbstractExtensionWizardRegistry {
+
+ /*
+ * Thread save singleton instance creation.
+ */
+ private static class LazyInstance {
+ public static NewWizardRegistry instance = new NewWizardRegistry();
+ }
+
+ /**
+ * Constructor.
+ */
+ /* default */ NewWizardRegistry() {
+ super();
+ }
+
+ /**
+ * Returns the singleton instance of the wizard registry.
+ */
+ public static NewWizardRegistry getInstance() {
+ return LazyInstance.instance;
+ }
+
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.internal.wizards.AbstractExtensionWizardRegistry#getExtensionPoint()
+ */
+ @Override
+ protected String getExtensionPoint() {
+ return "newWizards"; //$NON-NLS-1$
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.ui.internal.wizards.AbstractExtensionWizardRegistry#getPlugin()
+ */
+ @Override
+ protected String getPlugin() {
+ return UIPlugin.getUniqueIdentifier();
+ }
+
+}
diff --git a/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardSelectionPage.java b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardSelectionPage.java new file mode 100644 index 000000000..73792b385 --- /dev/null +++ b/target_explorer/plugins/org.eclipse.tm.te.ui/src/org/eclipse/tm/te/ui/wizards/newWizard/NewWizardSelectionPage.java @@ -0,0 +1,399 @@ +/*******************************************************************************
+ * Copyright (c) 2011 Wind River Systems, Inc. and others. All rights reserved.
+ * This program and the accompanying materials are made available under the terms
+ * of the Eclipse Public License v1.0 which accompanies this distribution, and is
+ * available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Uwe Stieber (Wind River) - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.tm.te.ui.wizards.newWizard;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.eclipse.core.runtime.Assert;
+import org.eclipse.jface.dialogs.Dialog;
+import org.eclipse.jface.dialogs.IDialogSettings;
+import org.eclipse.jface.viewers.DoubleClickEvent;
+import org.eclipse.jface.viewers.IBasicPropertyConstants;
+import org.eclipse.jface.viewers.IDoubleClickListener;
+import org.eclipse.jface.viewers.ISelectionChangedListener;
+import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.SelectionChangedEvent;
+import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.jface.viewers.TreeViewer;
+import org.eclipse.jface.viewers.ViewerComparator;
+import org.eclipse.jface.wizard.IWizard;
+import org.eclipse.jface.wizard.IWizardContainer;
+import org.eclipse.jface.wizard.IWizardNode;
+import org.eclipse.jface.wizard.IWizardPage;
+import org.eclipse.jface.wizard.WizardPage;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.layout.GridData;
+import org.eclipse.swt.layout.GridLayout;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Label;
+import org.eclipse.tm.te.ui.activator.UIPlugin;
+import org.eclipse.tm.te.ui.interfaces.IUIConstants;
+import org.eclipse.tm.te.ui.nls.Messages;
+import org.eclipse.ui.IWorkbench;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.activities.ITriggerPoint;
+import org.eclipse.ui.activities.WorkbenchActivityHelper;
+import org.eclipse.ui.dialogs.FilteredTree;
+import org.eclipse.ui.dialogs.PatternFilter;
+import org.eclipse.ui.internal.activities.ws.WorkbenchTriggerPoints;
+import org.eclipse.ui.internal.dialogs.WizardContentProvider;
+import org.eclipse.ui.internal.dialogs.WizardPatternFilter;
+import org.eclipse.ui.model.WorkbenchLabelProvider;
+import org.eclipse.ui.wizards.IWizardCategory;
+import org.eclipse.ui.wizards.IWizardDescriptor;
+
+/**
+ * Target Explorer: The New Target creation wizard selection page implementation.
+ */
+@SuppressWarnings("restriction")
+public class NewWizardSelectionPage extends WizardPage {
+ // The wizards settings storage id where the expanded categories are remembered
+ private static final String EXPANDED_CATEGORIES_SETTINGS_ID = "filteredTree.expandedCatogryIds"; //$NON-NLS-1$
+
+ // The wizards settings storage id where the selected wizard descriptor id is remembered
+ private static final String SELECTED_WIZARD_DESCRIPTOR_SETTINGS_ID = "filteredTree.selectedWizardDescriptorId"; //$NON-NLS-1$
+
+ // The default expanded category id's
+ private static final String[] DEFAULT_EXPANDED_CATEGORY_IDS = new String[] { "org.eclipse.tm.te.ui.newWizards.category.general" }; //$NON-NLS-1$
+
+ // The new target wizard registry
+ private NewWizardRegistry wizardRegistry;
+
+ // References to the page subcontrol's
+ private FilteredTree filteredTree;
+ private PatternFilter filteredTreeFilter;
+
+ // The selected wizard descriptor
+ private IWizardDescriptor selectedWizardDescriptor;
+
+ // The wizard nodes per wizard descriptor
+ private final Map<IWizardDescriptor, IWizardNode> wizardNodes = new HashMap<IWizardDescriptor, IWizardNode>();
+
+ // The workbench instance as passed in by init(...)
+ private IWorkbench workbench;
+ // The selection as passed in by init(...)
+ private IStructuredSelection selection;
+
+ /**
+ * Internal class. The wizard viewer comparator is responsible for
+ * the sorting in the tree. Current implementation is not prioritizing
+ * categories.
+ */
+ /* default */ static class NewWizardViewerComparator extends ViewerComparator {
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.viewers.ViewerComparator#isSorterProperty(java.lang.Object, java.lang.String)
+ */
+ @Override
+ public boolean isSorterProperty(Object element, String property) {
+ // The comparator is affected if the label of the elements should change.
+ return property.equals(IBasicPropertyConstants.P_TEXT);
+ }
+ }
+
+ /**
+ * Constructor.
+ *
+ * @param wizardRegistry The new target wizard registry. Must not be <code>null</code>.
+ */
+ public NewWizardSelectionPage(NewWizardRegistry wizardRegistry) {
+ super(NewWizardSelectionPage.class.getSimpleName());
+
+ setTitle(getDefaultTitle());
+ setDescription(getDefaultDescription());
+
+ Assert.isNotNull(wizardRegistry);
+ this.wizardRegistry = wizardRegistry;
+ }
+
+ /**
+ * Returns the default page title.
+ *
+ * @return The default page title. Must be never <code>null</code>.
+ */
+ protected String getDefaultTitle() {
+ return Messages.NewWizardSelectionPage_title;
+ }
+
+ /**
+ * Returns the default page description.
+ *
+ * @return The default page description. Must be never <code>null</code>.
+ */
+ protected String getDefaultDescription() {
+ return Messages.NewWizardSelectionPage_description;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
+ */
+ public void createControl(Composite parent) {
+ Composite composite = new Composite(parent, SWT.NONE);
+ composite.setLayout(new GridLayout());
+ composite.setLayoutData(new GridData(GridData.FILL_BOTH));
+
+ Label label = new Label(composite, SWT.NONE);
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ label.setText(Messages.NewWizardSelectionPage_wizards);
+ label.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+
+ filteredTreeFilter = new WizardPatternFilter();
+ filteredTree = new FilteredTree(composite, SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER, filteredTreeFilter, true);
+ filteredTree.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
+ GridData layoutData = new GridData(GridData.FILL_BOTH);
+ layoutData.heightHint = 325; layoutData.widthHint = 450;
+ filteredTree.setLayoutData(layoutData);
+
+ final TreeViewer treeViewer = filteredTree.getViewer();
+ treeViewer.setContentProvider(new WizardContentProvider());
+ treeViewer.setLabelProvider(new WorkbenchLabelProvider());
+ treeViewer.setComparator(new NewWizardViewerComparator());
+
+ treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
+ public void selectionChanged(SelectionChangedEvent event) {
+ onSelectionChanged();
+ }
+ });
+ treeViewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ // Double-click on a connection type is triggering the sub wizard
+ if (event.getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection selection = (IStructuredSelection)event.getSelection();
+ // The tree is single selection, so look for the first element only.
+ Object element = selection.getFirstElement();
+ if (element instanceof IWizardDescriptor) {
+ // Double-click on a connection type is triggering the sub wizard
+ if (canFlipToNextPage()) getWizard().getContainer().showPage(getNextPage());
+ } else if (event.getViewer() instanceof TreeViewer) {
+ TreeViewer viewer = (TreeViewer)event.getViewer();
+ if (viewer.isExpandable(element)) {
+ viewer.setExpandedState(element, !viewer.getExpandedState(element));
+ }
+ }
+ }
+ }
+ });
+
+ treeViewer.setInput(wizardRegistry.getRootCategory());
+
+ // apply the standard dialog font
+ Dialog.applyDialogFont(composite);
+
+ setControl(composite);
+
+ // Restore the tree state
+ restoreWidgetValues();
+
+ // Initialize the context help id
+ PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(), IUIConstants.HELP_NEW_WIZARD_SELECTION_PAGE);
+ }
+
+ /**
+ * Initialize the page with the current workbench instance and the
+ * current workbench selection.
+ *
+ * @param workbench The current workbench.
+ * @param selection The current object selection.
+ */
+ public void init(IWorkbench workbench, IStructuredSelection selection) {
+ this.workbench = workbench;
+ this.selection = selection;
+ }
+
+ /**
+ * Returns the current workbench.
+ *
+ * @return The current workbench or <code>null</code> if not set.
+ */
+ public IWorkbench getWorkbench() {
+ return workbench;
+ }
+
+ /**
+ * Returns the current object selection.
+ *
+ * @return The current object selection or <code>null</code> if not set.
+ */
+ public IStructuredSelection getSelection() {
+ return selection;
+ }
+
+ /**
+ * Called from the selection listener to propagate the current
+ * system type selection to the underlying wizard.
+ */
+ protected void onSelectionChanged() {
+ if (filteredTree.getViewer().getSelection() instanceof IStructuredSelection) {
+ IStructuredSelection filteredTreeSelection = (IStructuredSelection)filteredTree.getViewer().getSelection();
+ if (filteredTreeSelection.getFirstElement() instanceof IWizardDescriptor) {
+ selectedWizardDescriptor = (IWizardDescriptor)filteredTreeSelection.getFirstElement();
+
+ // Update the description if the current wizard descriptor has one
+ if (selectedWizardDescriptor.getDescription() != null && !"".equals(selectedWizardDescriptor.getDescription())) { //$NON-NLS-1$
+ setDescription(selectedWizardDescriptor.getDescription());
+ } else {
+ if (!getDefaultDescription().equals(getDescription())) setDescription(getDefaultDescription());
+ }
+ } else {
+ selectedWizardDescriptor = null;
+ }
+
+ // Create the wizard node for the selected descriptor if not yet done
+ if (!wizardNodes.containsKey(selectedWizardDescriptor)) {
+ wizardNodes.put(selectedWizardDescriptor, new NewWizardNode(this, selectedWizardDescriptor));
+ }
+ }
+
+ // Update the wizard container UI elements
+ IWizardContainer container = getContainer();
+ if (container != null && container.getCurrentPage() != null) {
+ container.updateWindowTitle();
+ container.updateTitleBar();
+ container.updateButtons();
+ }
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.WizardPage#getNextPage()
+ */
+ @Override
+ public IWizardPage getNextPage() {
+ ITriggerPoint triggerPoint = workbench.getActivitySupport().getTriggerPointManager().getTriggerPoint(WorkbenchTriggerPoints.NEW_WIZARDS);
+ if (triggerPoint == null || WorkbenchActivityHelper.allowUseOf(triggerPoint, getSelectedNode())) {
+ IWizardNode selectedNode = getSelectedNode();
+ if (selectedNode != null) {
+ // Determine if the content got create before(!) triggering
+ // the wizard creation
+ boolean isCreated = selectedNode.isContentCreated();
+ // Get the wizard from the selected node (triggers wizard creation if needed)
+ IWizard wizard = selectedNode.getWizard();
+ if (wizard != null) {
+ // If the wizard got created by the call to getWizard(),
+ // then allow the wizard to create its pages
+ if (!isCreated) wizard.addPages();
+ // Return the starting page of the wizard
+ return wizard.getStartingPage();
+ }
+ }
+ }
+ return null;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.WizardPage#canFlipToNextPage()
+ */
+ @Override
+ public boolean canFlipToNextPage() {
+ if (selectedWizardDescriptor != null && selectedWizardDescriptor.hasPages()) {
+ return super.canFlipToNextPage();
+ }
+ return false;
+ }
+
+ /**
+ * Returns if or if not the wizard can be finished early.
+ *
+ * @return <code>True</code> if the wizard can be finished early, <code>false</code> otherwise.
+ */
+ public boolean canFinishEarly() {
+ return selectedWizardDescriptor != null && selectedWizardDescriptor.canFinishEarly();
+ }
+
+ /**
+ * Returns the wizard node for the currently selected
+ * wizard descriptor.
+ *
+ * @return The wizard node or <code>null</code> if none.
+ */
+ public IWizardNode getSelectedNode() {
+ IWizardNode node = null;
+ if (selectedWizardDescriptor != null) {
+ node = wizardNodes.get(selectedWizardDescriptor);
+ }
+ return node;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.jface.wizard.WizardPage#getDialogSettings()
+ */
+ @Override
+ protected IDialogSettings getDialogSettings() {
+ // If the wizard is set and returns dialog settings, we re-use them here
+ IDialogSettings settings = super.getDialogSettings();
+ // If the dialog settings could not set from the wizard, fallback to the plugin's
+ // dialog settings store.
+ if (settings == null) settings = UIPlugin.getDefault().getDialogSettings();
+ String sectionName = this.getClass().getName();
+ if (settings.getSection(sectionName) == null) settings.addNewSection(sectionName);
+ settings = settings.getSection(sectionName);
+
+ return settings;
+ }
+
+ /**
+ * Restore the tree state from the dialog settings.
+ */
+ public void restoreWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ String[] expandedCategories = settings.getArray(EXPANDED_CATEGORIES_SETTINGS_ID);
+ // by default we expand always the "General" category.
+ if (expandedCategories == null) expandedCategories = DEFAULT_EXPANDED_CATEGORY_IDS;
+ if (expandedCategories != null) {
+ List<IWizardCategory> expanded = new ArrayList<IWizardCategory>();
+ for (int i = 0; i < expandedCategories.length; i++) {
+ String categoryId = expandedCategories[i];
+ if (categoryId != null && !"".equals(categoryId.trim())) { //$NON-NLS-1$
+ IWizardCategory category = wizardRegistry.findCategory(categoryId);
+ if (category != null && !expanded.contains(category)) {
+ expanded.add(category);
+ }
+ }
+ }
+
+ if (expanded.size() > 0) filteredTree.getViewer().setExpandedElements(expanded.toArray());
+ }
+
+ String selectedWizardDescriptorId = settings.get(SELECTED_WIZARD_DESCRIPTOR_SETTINGS_ID);
+ if (selectedWizardDescriptorId != null && !"".equals(selectedWizardDescriptorId.trim())) { //$NON-NLS-1$
+ IWizardDescriptor descriptor = wizardRegistry.findWizard(selectedWizardDescriptorId);
+ if (descriptor != null) {
+ filteredTree.getViewer().setSelection(new StructuredSelection(descriptor), true);
+ }
+ }
+ }
+ }
+
+ /**
+ * Saves the tree state to the wizards settings store.
+ */
+ public void saveWidgetValues() {
+ IDialogSettings settings = getDialogSettings();
+ if (settings != null) {
+ List<String> expandedCategories = new ArrayList<String>();
+ Object[] expanded = filteredTree.getViewer().getVisibleExpandedElements();
+ for (int i = 0; i < expanded.length; i++) {
+ if (expanded[i] instanceof IWizardCategory) {
+ expandedCategories.add(((IWizardCategory)expanded[i]).getId());
+ }
+ }
+ settings.put(EXPANDED_CATEGORIES_SETTINGS_ID, expandedCategories.toArray(new String[expandedCategories.size()]));
+
+ if (selectedWizardDescriptor != null) {
+ settings.put(SELECTED_WIZARD_DESCRIPTOR_SETTINGS_ID, selectedWizardDescriptor.getId());
+ } else {
+ settings.put(SELECTED_WIZARD_DESCRIPTOR_SETTINGS_ID, ""); //$NON-NLS-1$
+ }
+ }
+ }
+}
\ No newline at end of file |