diff options
author | Uwe Stieber | 2014-01-10 08:24:19 +0000 |
---|---|---|
committer | Uwe Stieber | 2014-01-10 08:25:15 +0000 |
commit | 550744e159a63297ff7085daea1b77f58be6e5da (patch) | |
tree | adb67ff64fe7bb43e7f2c8b63c29dbc51038fff7 /target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf | |
parent | 563c3129dbe9697ba1ee4361f6bb19a1d2e2ea9b (diff) | |
download | org.eclipse.tcf-550744e159a63297ff7085daea1b77f58be6e5da.tar.gz org.eclipse.tcf-550744e159a63297ff7085daea1b77f58be6e5da.tar.xz org.eclipse.tcf-550744e159a63297ff7085daea1b77f58be6e5da.zip |
Target Explorer: Persist selection state of the "Show auto-generated path map rules" button
Diffstat (limited to 'target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf')
-rw-r--r-- | target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/PathMapTab.java | 77 |
1 files changed, 76 insertions, 1 deletions
diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/PathMapTab.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/PathMapTab.java index e3cef868d..c363342cc 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/PathMapTab.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/editor/tabs/PathMapTab.java @@ -13,6 +13,8 @@ import java.util.List; import org.eclipse.core.runtime.Assert; import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.jface.dialogs.DialogSettings; +import org.eclipse.jface.dialogs.IDialogSettings; import org.eclipse.jface.viewers.CheckboxTableViewer; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; @@ -28,9 +30,12 @@ import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPe import org.eclipse.tcf.te.runtime.model.interfaces.IModelNode; import org.eclipse.tcf.te.runtime.services.ServiceManager; import org.eclipse.tcf.te.tcf.core.interfaces.IPathMapGeneratorService; +import org.eclipse.tcf.te.tcf.core.interfaces.IPathMapService; +import org.eclipse.tcf.te.tcf.launch.ui.activator.UIPlugin; import org.eclipse.tcf.te.tcf.launch.ui.editor.AbstractTcfLaunchTabContainerEditorPage; import org.eclipse.tcf.te.tcf.launch.ui.nls.Messages; import org.eclipse.tcf.te.tcf.locator.interfaces.nodes.IPeerNode; +import org.eclipse.tcf.te.ui.swt.SWTControlUtil; /** * Customized TCF path map launch configuration tab implementation to work better @@ -61,6 +66,54 @@ public class PathMapTab extends TCFPathMapTab { return parentEditorPage; } + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#initializeFrom(org.eclipse.debug.core.ILaunchConfiguration) + */ + @Override + public void initializeFrom(ILaunchConfiguration config) { + super.initializeFrom(config); + + // Restore the state of the "Show auto-generated path map rules" button + IDialogSettings settings = getDialogSettings(config); + if (settings != null) { + SWTControlUtil.setSelection(showAutoGeneratedRules, settings.getBoolean("showAutoGeneratedRules")); //$NON-NLS-1$ + // Refresh the viewer + getViewer().refresh(); + } + } + + /** + * Returns the dialog settings to use to store configuration specific dialog settings. + * + * @param config The active launch configuration. Must not be <code>null</code>. + * @return The dialog settings store or <code>null</code>. + */ + protected IDialogSettings getDialogSettings(ILaunchConfiguration config) { + Assert.isNotNull(config); + + IDialogSettings settings = null; + + // Determine the current context name + IModelNode context = LaunchContextsPersistenceDelegate.getFirstLaunchContext(config); + if (context instanceof IPeerNode) { + String name = ((IPeerNode)context).getPeer().getName(); + if (name != null) { + // Get the plug-in dialog settings + settings = UIPlugin.getDefault().getDialogSettings(); + if (settings != null) { + // Get the page dialog settings + settings = DialogSettings.getOrCreateSection(settings, PathMapTab.class.getSimpleName()); + if (settings != null) { + // Get the context specific dialog settings + settings = DialogSettings.getOrCreateSection(settings, name); + } + } + } + } + + return settings; + } + /* (non-Javadoc) * @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#getName() */ @@ -112,7 +165,17 @@ public class PathMapTab extends TCFPathMapTab { @SuppressWarnings("synthetic-access") @Override public void widgetSelected(SelectionEvent e) { - if (getViewer() != null) getViewer().refresh(); + if (getViewer() != null) { + // Save the state of the "Show auto-generated path map rules" button + if (getViewer().getInput() instanceof ILaunchConfiguration) { + IDialogSettings settings = getDialogSettings((ILaunchConfiguration)getViewer().getInput()); + if (settings != null) { + settings.put("showAutoGeneratedRules", SWTControlUtil.getSelection(showAutoGeneratedRules)); //$NON-NLS-1$ + } + } + // Refresh the viewer + getViewer().refresh(); + } } }); } @@ -136,6 +199,18 @@ public class PathMapTab extends TCFPathMapTab { return true; } }); + + // Add a filter hiding the host to target path mappings + viewer.addFilter(new ViewerFilter() { + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + if (element instanceof IPathMap.PathMapRule) { + IPathMap.PathMapRule rule = (IPathMap.PathMapRule) element; + return !IPathMapService.PATHMAP_PROTOCOL_HOST_TO_TARGET.equals(rule.getProtocol()); + } + return true; + } + }); } /* (non-Javadoc) |