diff options
author | Uwe Stieber | 2014-01-09 13:30:49 +0000 |
---|---|---|
committer | Uwe Stieber | 2014-01-10 08:25:14 +0000 |
commit | 563c3129dbe9697ba1ee4361f6bb19a1d2e2ea9b (patch) | |
tree | ecf64d33fd35ab1fde303996a6f6256ac0ba50a9 | |
parent | 4301ae02686e95d0ad03e3a211ae65ec975d5c94 (diff) | |
download | org.eclipse.tcf-563c3129dbe9697ba1ee4361f6bb19a1d2e2ea9b.tar.gz org.eclipse.tcf-563c3129dbe9697ba1ee4361f6bb19a1d2e2ea9b.tar.xz org.eclipse.tcf-563c3129dbe9697ba1ee4361f6bb19a1d2e2ea9b.zip |
Target Explorer: Support filtering of auto generated path map rules from the path map table
4 files changed, 77 insertions, 0 deletions
diff --git a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/launch/TCFPathMapTab.java b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/launch/TCFPathMapTab.java index eeb64124d..5e94f3a7a 100644 --- a/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/launch/TCFPathMapTab.java +++ b/plugins/org.eclipse.tcf.debug.ui/src/org/eclipse/tcf/internal/debug/ui/launch/TCFPathMapTab.java @@ -212,9 +212,19 @@ public class TCFPathMapTab extends AbstractLaunchConfigurationTab { composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, true, 1, 1)); createTable(composite); + createCustomControls(composite); setControl(composite); } + /** + * Hook to add custom controls below the path map rules table. + * + * @param parent The parent composite. Must not be <code>null</code>. + */ + protected void createCustomControls(Composite parent) { + // Nothing to do + } + private void createTable(Composite parent) { Font font = parent.getFont(); Label map_label = new Label(parent, SWT.WRAP); @@ -255,11 +265,22 @@ public class TCFPathMapTab extends AbstractLaunchConfigurationTab { } }); + configureTableViewer(viewer); + table.pack(true); createTableButtons(composite); } + /** + * Hook to configure the checkbox table viewer. + * + * @param viewer The checkbox table viewer. Must not be <code>null</code>. + */ + protected void configureTableViewer(CheckboxTableViewer viewer) { + // Nothing to do + } + protected void configureTable(final Table table) { GridData data = new GridData(GridData.FILL_BOTH | GridData.VERTICAL_ALIGN_BEGINNING); data.widthHint = SIZING_TABLE_WIDTH; 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 d7f0bda3a..e3cef868d 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 @@ -11,7 +11,17 @@ package org.eclipse.tcf.te.tcf.launch.ui.editor.tabs; import java.util.List; +import org.eclipse.core.runtime.Assert; import org.eclipse.debug.core.ILaunchConfiguration; +import org.eclipse.jface.viewers.CheckboxTableViewer; +import org.eclipse.jface.viewers.Viewer; +import org.eclipse.jface.viewers.ViewerFilter; +import org.eclipse.swt.SWT; +import org.eclipse.swt.events.SelectionAdapter; +import org.eclipse.swt.events.SelectionEvent; +import org.eclipse.swt.layout.GridData; +import org.eclipse.swt.widgets.Button; +import org.eclipse.swt.widgets.Composite; import org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab; import org.eclipse.tcf.services.IPathMap; import org.eclipse.tcf.te.launch.core.persistence.launchcontext.LaunchContextsPersistenceDelegate; @@ -30,6 +40,8 @@ public class PathMapTab extends TCFPathMapTab { // Reference to the parent editor page private final AbstractTcfLaunchTabContainerEditorPage parentEditorPage; + /* default */ Button showAutoGeneratedRules; + /** * Constructor * @@ -85,6 +97,48 @@ public class PathMapTab extends TCFPathMapTab { } /* (non-Javadoc) + * @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#createCustomControls(org.eclipse.swt.widgets.Composite) + */ + @Override + protected void createCustomControls(Composite parent) { + Assert.isNotNull(parent); + super.createCustomControls(parent); + + // Add a "[ ] Show all" to the bottom of the page + showAutoGeneratedRules = new Button(parent, SWT.CHECK); + showAutoGeneratedRules.setText(Messages.PathMapEditorPage_showAll_label); + showAutoGeneratedRules.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + showAutoGeneratedRules.addSelectionListener(new SelectionAdapter() { + @SuppressWarnings("synthetic-access") + @Override + public void widgetSelected(SelectionEvent e) { + if (getViewer() != null) getViewer().refresh(); + } + }); + } + + /* (non-Javadoc) + * @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#configureTableViewer(org.eclipse.jface.viewers.CheckboxTableViewer) + */ + @Override + protected void configureTableViewer(CheckboxTableViewer viewer) { + Assert.isNotNull(viewer); + super.configureTableViewer(viewer); + + // Add a filter filtering out the generated mappings if "Show all" is not checked + viewer.addFilter(new ViewerFilter() { + @Override + public boolean select(Viewer viewer, Object parentElement, Object element) { + if (showAutoGeneratedRules != null && !showAutoGeneratedRules.isDisposed() && !showAutoGeneratedRules.getSelection() && element instanceof IPathMap.PathMapRule) { + IPathMap.PathMapRule rule = (IPathMap.PathMapRule) element; + return rule.getProperties().get(PROP_GENERATED) == null || !((Boolean)rule.getProperties().get(PROP_GENERATED)).booleanValue(); + } + return true; + } + }); + } + + /* (non-Javadoc) * @see org.eclipse.tcf.internal.debug.ui.launch.TCFPathMapTab#initializePathMap(java.util.List, org.eclipse.debug.core.ILaunchConfiguration) */ @Override diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java index 45d214b9c..cd27bdf70 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.java @@ -98,6 +98,7 @@ public class Messages extends NLS { public static String PathMapEditorPage_name; public static String PathMapEditorPage_error_apply; public static String PathMapEditorPage_error_title; + public static String PathMapEditorPage_showAll_label; public static String SourceLookupEditorPage_name; diff --git a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties index 6d498ba1b..b44b8c341 100644 --- a/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties +++ b/target_explorer/plugins/org.eclipse.tcf.te.tcf.launch.ui/src/org/eclipse/tcf/te/tcf/launch/ui/nls/Messages.properties @@ -39,6 +39,7 @@ LaunchConfigurationAdvancedTabSection_lineseparator_cr=CR PathMapEditorPage_name=Object Paths PathMapEditorPage_error_apply=Failed to update object paths for configuration ''{0}''.\n\nPossible cause:\n{1} PathMapEditorPage_error_title=Error +PathMapEditorPage_showAll_label=Show auto-generated path map rules SourceLookupEditorPage_name=Source Paths |