diff options
author | Michael Rennie | 2007-01-04 16:03:19 +0000 |
---|---|---|
committer | Michael Rennie | 2007-01-04 16:03:19 +0000 |
commit | fc263642a6fb70563dbe2b30cde6ec3f1a51481f (patch) | |
tree | 0d579532530a49b4c718a7e6d79ccebd5cd9b544 /org.eclipse.debug.ui/ui/org | |
parent | 445121f8ccf7249ccaf070ab93f915de5d4e1f2c (diff) | |
download | eclipse.platform.debug-fc263642a6fb70563dbe2b30cde6ec3f1a51481f.tar.gz eclipse.platform.debug-fc263642a6fb70563dbe2b30cde6ec3f1a51481f.tar.xz eclipse.platform.debug-fc263642a6fb70563dbe2b30cde6ec3f1a51481f.zip |
Bug 167667
[launching] No visual clue configurations are filtered from dialog
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
7 files changed, 95 insertions, 9 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java index 58cfd5f75..ca236bf02 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationTreeContentProvider.java @@ -49,6 +49,11 @@ public class LaunchConfigurationTreeContentProvider implements ITreeContentProvi */ private Shell fShell; + /** + * Constructor + * @param mode the mode + * @param shell the parent shell + */ public LaunchConfigurationTreeContentProvider(String mode, Shell shell) { setMode(mode); setShell(shell); diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java index 83a0fd7a8..15d91c86f 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationView.java @@ -19,6 +19,7 @@ import org.eclipse.debug.core.ILaunchConfigurationType; import org.eclipse.debug.core.ILaunchManager; import org.eclipse.debug.internal.ui.DebugUIPlugin; import org.eclipse.debug.internal.ui.IDebugHelpContextIds; +import org.eclipse.debug.internal.ui.SWTUtil; import org.eclipse.debug.ui.AbstractDebugView; import org.eclipse.debug.ui.IDebugUIConstants; import org.eclipse.debug.ui.IDebugView; @@ -39,11 +40,14 @@ import org.eclipse.swt.events.KeyAdapter; import org.eclipse.swt.events.KeyEvent; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Text; import org.eclipse.swt.widgets.TreeItem; import org.eclipse.ui.PlatformUI; import org.eclipse.ui.dialogs.PatternFilter; +import com.ibm.icu.text.MessageFormat; + /** * A tree view of launch configurations */ @@ -83,6 +87,13 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc private FilterLaunchConfigurationAction fFilterAction; /** + * This label is used to notify users that items (possibly) have been filtered from the + * launch configuration view + * @since 3.3 + */ + private Label fFilteredNotice = null; + + /** * Whether to automatically select configs that are added */ private boolean fAutoSelect = true; @@ -131,10 +142,9 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc return fTree.getLaunchConfigurationViewer(); } - /* - * Adds support for dynamic help + /** + * @see org.eclipse.debug.ui.AbstractDebugView#getAdapter(java.lang.Class) */ - public Object getAdapter(Class key) { if (key == IContextProvider.class) { return new IContextProvider () { @@ -275,6 +285,7 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc if (isAutoSelect()) { viewer.setSelection(new StructuredSelection(configuration), true); } + updateFilterLabel(); } catch (CoreException e) {} } @@ -355,6 +366,7 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc viewer.setSelection(newSelection); } } + updateFilterLabel(); } /** @@ -376,6 +388,8 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc if (getViewer() instanceof StructuredViewer) { ((StructuredViewer)getViewer()).addDoubleClickListener(this); } + fFilteredNotice = SWTUtil.createLabel(parent, "", 1); //$NON-NLS-1$ + fFilteredNotice.setBackground(parent.getBackground()); } /** @@ -386,6 +400,15 @@ public class LaunchConfigurationView extends AbstractDebugView implements ILaunc } /** + * Updates the filter notification label + * @since 3.3 + */ + public void updateFilterLabel() { + LaunchConfigurationViewer viewer = (LaunchConfigurationViewer) getViewer(); + fFilteredNotice.setText(MessageFormat.format(LaunchConfigurationsMessages.LaunchConfigurationView_0, new String[] {Integer.toString(viewer.getNonFilteredChildCount()), Integer.toString(viewer.getTotalChildCount())})); + } + + /** * returns the launch manager * @return */ diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java index f86392324..60829f79b 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationViewer.java @@ -28,6 +28,8 @@ import org.eclipse.swt.widgets.TreeItem; */ public class LaunchConfigurationViewer extends TreeViewer { + private int fTotalCount = 0; + /** * Constructor * @param tree the tree to create the viewer on @@ -115,6 +117,58 @@ public class LaunchConfigurationViewer extends TreeViewer { } /** + * Returns the total count of all of the children that <i>could</i> be visible at + * the time the input was set to the viewer + * @return the total number of elements + * + * @since 3.3 + */ + protected int getTotalChildCount() { + return fTotalCount; + } + + /** + * @see org.eclipse.jface.viewers.AbstractTreeViewer#inputChanged(java.lang.Object, java.lang.Object) + */ + protected void inputChanged(Object input, Object oldInput) { + super.inputChanged(input, oldInput); + //calc the total number of items that could be visible in the view + LaunchConfigurationTreeContentProvider cp = (LaunchConfigurationTreeContentProvider) getContentProvider(); + Object[] types = cp.getElements(null); + LaunchGroupFilter filter = new LaunchGroupFilter(((LaunchConfigurationsDialog)LaunchConfigurationsDialog.getCurrentlyVisibleLaunchConfigurationDialog()).getLaunchGroup()); + for(int i = 0; i < types.length; i++) { + if(filter.select(this, types[i], null)) { + fTotalCount += cp.getChildren(types[i]).length + 1; //+1 for the type + } + } + } + + /** + * returns the number of children that are remaining in the view. + * Note that this method will force the loading of all children + * @return the count of all children in the viewer + * + * @since 3.3 + */ + protected int getNonFilteredChildCount() { + int count = 0; + getTree().setRedraw(false); + TreeItem[] items = getTree().getItems(); + count += items.length; + boolean expanded = false; + TreeItem item = null; + for(int i = 0; i < items.length; i++) { + item = items[i]; + expanded = item.getExpanded(); + setExpandedState(item.getData(), true); + count += item.getItems().length; + item.setExpanded(expanded); + } + getTree().setRedraw(true); + return count; + } + + /** * Collects the indices of the child and parent items for the specified element * @param object the element to collect indices for * @return an array of indices for the specified element diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java index 08f35bfc9..142a0611e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsDialog.java @@ -446,6 +446,7 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun protected Control createDialogArea(Composite parent) { Composite dialogComp = (Composite)super.createDialogArea(parent); addContent(dialogComp); + fLaunchConfigurationView.updateFilterLabel(); return dialogComp; } @@ -1471,8 +1472,10 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun else if(event.getProperty().equals(IInternalDebugUIConstants.PREF_FILTER_TYPE_LIST)) { if(DebugUIPlugin.getDefault().getPreferenceStore().getBoolean(IInternalDebugUIConstants.PREF_FILTER_LAUNCH_TYPES)) { viewer.refresh(); + fLaunchConfigurationView.updateFilterLabel(); } } + return Status.OK_STATUS; } }; @@ -1492,5 +1495,6 @@ public class LaunchConfigurationsDialog extends TitleAreaDialog implements ILaun else { viewer.removeFilter(filter); } + fLaunchConfigurationView.updateFilterLabel(); } }
\ No newline at end of file diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java index f4cfa6f4c..801cae778 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.java @@ -104,6 +104,8 @@ public class LaunchConfigurationsMessages extends NLS { public static String LaunchConfigurationTabGroupViewer_18; public static String LaunchConfigurationTabGroupViewer_9; public static String LaunchConfigurationTabGroupViewer_13; + + public static String LaunchConfigurationView_0; public static String PerspectiveManager_Error_1; public static String PerspectiveManager_Unable_to_switch_perpsectives_as_specified_by_launch___0__4; public static String PerspectiveManager_Unable_to_switch_to_perspective___0__2; diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties index 34f07ac88..852efb4ed 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchConfigurationsMessages.properties @@ -95,6 +95,7 @@ LaunchConfigurationsDialog_0=New launch configuration LaunchConfigurationsDialog_1=Delete selected launch configuration(s) LaunchConfigurationsDialog_4=Filter launch configurations... LaunchConfigurationsDialog_5=Duplicates the currently selected launch configuration +LaunchConfigurationView_0=Filter matched {0} of {1} items LaunchConfigurationsDialog_c_ancel=Cancel LaunchConfigurationPresentationManager_No_tab_group_defined_for_launch_configuration_type__0__3=No tab group defined for launch configuration type {0} PerspectiveManager_Error_1=Error diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchGroupFilter.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchGroupFilter.java index 5a351dfc4..f8678ceaa 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchGroupFilter.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/launchConfigurations/LaunchGroupFilter.java @@ -39,10 +39,7 @@ public class LaunchGroupFilter extends ViewerFilter { /** * @see org.eclipse.jface.viewers.ViewerFilter#select(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object) */ - public boolean select( - Viewer viewer, - Object parentElement, - Object element) { + public boolean select(Viewer viewer, Object parentElement, Object element) { ILaunchConfigurationType type = null; ILaunchConfiguration config = null; if (parentElement instanceof ILaunchConfigurationType) { @@ -55,8 +52,8 @@ public class LaunchGroupFilter extends ViewerFilter { config = (ILaunchConfiguration)element; try { type = config.getType(); - } catch (CoreException e) { - } + } + catch (CoreException e) {} } boolean priv = false; if (config != null) { |