diff options
| author | Oleg Besedin | 2011-11-24 16:12:36 +0000 |
|---|---|---|
| committer | Oleg Besedin | 2011-11-24 16:12:36 +0000 |
| commit | 77103f0a32e6b3cf691de4c18bf7aa32603bd3b9 (patch) | |
| tree | a41a7c59e13b07a371053235b1357c283dbf5420 | |
| parent | 59a65b4515b875d7f3131868332a7769d4861221 (diff) | |
| download | eclipse.platform.ui-77103f0a32e6b3cf691de4c18bf7aa32603bd3b9.tar.gz eclipse.platform.ui-77103f0a32e6b3cf691de4c18bf7aa32603bd3b9.tar.xz eclipse.platform.ui-77103f0a32e6b3cf691de4c18bf7aa32603bd3b9.zip | |
Bug 364039 - [Markers] Add "Delete All Markers" in severity group
context menu in Problems view
3 files changed, 42 insertions, 8 deletions
diff --git a/bundles/org.eclipse.ui.ide/plugin.xml b/bundles/org.eclipse.ui.ide/plugin.xml index 5771e2700d4..ff6b24a423f 100644 --- a/bundles/org.eclipse.ui.ide/plugin.xml +++ b/bundles/org.eclipse.ui.ide/plugin.xml @@ -2155,7 +2155,10 @@ <iterate ifEmpty="false" operator="and"> - <instanceof value="org.eclipse.ui.internal.views.markers.MarkerEntry"/> + <or> + <instanceof value="org.eclipse.ui.internal.views.markers.MarkerCategory"/> + <instanceof value="org.eclipse.ui.internal.views.markers.MarkerEntry"/> + </or> <test forcePluginActivation="false" property="org.eclipse.ui.ide.editable"> @@ -2241,7 +2244,7 @@ id="org.eclipse.ui.ide.editable" namespace="org.eclipse.ui.ide" properties="editable" - type="org.eclipse.ui.internal.views.markers.MarkerEntry"> + type="org.eclipse.ui.internal.views.markers.MarkerSupportItem"> </propertyTester> <propertyTester class="org.eclipse.ui.internal.views.markers.MarkersViewPropertyTester" diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/EditablePropertyTester.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/EditablePropertyTester.java index 33d7e1db29d..11433221114 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/EditablePropertyTester.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/EditablePropertyTester.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2008 IBM Corporation and others. + * Copyright (c) 2005, 2011 IBM Corporation 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 @@ -7,9 +7,14 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Andrew Gvozdev - Bug 364039 - Add "Delete All Markers" *******************************************************************************/ package org.eclipse.ui.internal.views.markers; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Set; + import org.eclipse.core.expressions.PropertyTester; import org.eclipse.core.resources.IMarker; @@ -37,9 +42,27 @@ public class EditablePropertyTester extends PropertyTester { public boolean test(Object receiver, String property, Object[] args, Object expectedValue) { if (property.equals(EDITABLE)) { - IMarker marker = ((MarkerEntry) receiver).getMarker(); - if (marker != null) - return marker.getAttribute(IMarker.USER_EDITABLE, true); + MarkerSupportItem item = (MarkerSupportItem) receiver; + Set/*<IMarker>*/ markers = new HashSet(); + if (item.isConcrete()) { + markers.add(((MarkerEntry) receiver).getMarker()); + } else { + MarkerSupportItem[] children = item.getChildren(); + for (int i = 0; i < children.length; i++) { + if (children[i].isConcrete()) + markers.add(((MarkerEntry) children[i]).getMarker()); + } + } + + if (!markers.isEmpty()) { + Iterator elements = markers.iterator(); + while (elements.hasNext()) { + IMarker marker = (IMarker) elements.next(); + if (!marker.getAttribute(IMarker.USER_EDITABLE, true)) + return false; + } + return true; + } } return false; } diff --git a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java index e466a6eda58..2bafef81800 100644 --- a/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java +++ b/bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java @@ -7,6 +7,7 @@ * * Contributors: * IBM Corporation - initial API and implementation + * Andrew Gvozdev - Bug 364039 - Add "Delete All Markers" *******************************************************************************/ package org.eclipse.ui.internal.views.markers; @@ -891,11 +892,18 @@ public class ExtendedMarkersView extends ViewPart { if (selection instanceof IStructuredSelection) { IStructuredSelection structured = (IStructuredSelection) selection; Iterator elements = structured.iterator(); - Collection result = new ArrayList(); + Collection result = new HashSet(); while (elements.hasNext()) { MarkerSupportItem next = (MarkerSupportItem) elements.next(); - if (next.isConcrete()) + if (next.isConcrete()) { result.add(((MarkerEntry) next).getMarker()); + } else { + MarkerSupportItem[] children = next.getChildren(); + for (int i = 0; i < children.length; i++) { + if (children[i].isConcrete()) + result.add(((MarkerEntry) children[i]).getMarker()); + } + } } if (result.isEmpty()) return MarkerSupportInternalUtilities.EMPTY_MARKER_ARRAY; |
