summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorMike Rennie2012-02-02 12:43:02 (EST)
committer Eric Moffatt2012-02-08 14:17:13 (EST)
commite22e6142750f84f2536ec116061307b26810f231 (patch)
tree410a36f968344621d42ae5677919fa28de21c488
parentd59df20d10f9f093ef19c6bfc1daaa6c7a21013f (diff)
downloadeclipse.platform.ui-e22e6142750f84f2536ec116061307b26810f231.zip
eclipse.platform.ui-e22e6142750f84f2536ec116061307b26810f231.tar.gz
eclipse.platform.ui-e22e6142750f84f2536ec116061307b26810f231.tar.bz2
Bug 370471 - Double-clicking on marker category crashes Eclipsev20120208-1917
-rw-r--r--bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/BrowserViewer.java3
-rw-r--r--bundles/org.eclipse.ui.ide/src/org/eclipse/ui/internal/views/markers/ExtendedMarkersView.java67
2 files changed, 60 insertions, 10 deletions
diff --git a/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/BrowserViewer.java b/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/BrowserViewer.java
index bb2334f..45955ca 100644
--- a/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/BrowserViewer.java
+++ b/bundles/org.eclipse.ui.browser/src/org/eclipse/ui/internal/browser/BrowserViewer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2004, 2011 IBM Corporation and others.
+ * Copyright (c) 2004, 2012 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
@@ -21,7 +21,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.action.IStatusLineManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.SWTError;
-import org.eclipse.swt.SWTException;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.CloseWindowListener;
import org.eclipse.swt.browser.LocationEvent;
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 2bafef8..53adb0b 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
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2007, 2011 IBM Corporation and others.
+ * Copyright (c) 2007, 2012 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
@@ -30,12 +30,15 @@ import org.eclipse.jface.action.ContributionManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.jface.util.OpenStrategy;
import org.eclipse.jface.viewers.ColumnPixelData;
+import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.IContentProvider;
+import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILazyTreeContentProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
+import org.eclipse.jface.viewers.ITreeSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TableLayout;
@@ -408,6 +411,8 @@ public class ExtendedMarkersView extends ViewPart {
createViewer(parent);
+ addDoubleClickListener();
+
addPageAndPartSelectionListener();
addLinkWithEditorSupport();
@@ -452,6 +457,27 @@ public class ExtendedMarkersView extends ViewPart {
}
/**
+ * Attaches an {@link IDoubleClickListener} to expand items that are not openable
+ * @since 3.8
+ */
+ private void addDoubleClickListener() {
+ viewer.addDoubleClickListener(new IDoubleClickListener() {
+ public void doubleClick(DoubleClickEvent event) {
+ ISelection selection = event.getSelection();
+ if(selection instanceof ITreeSelection) {
+ ITreeSelection ss = (ITreeSelection) selection;
+ if(ss.size() == 1) {
+ Object obj = ss.getFirstElement();
+ if(viewer.isExpandable(obj)) {
+ viewer.setExpandedState(obj, !viewer.getExpandedState(obj));
+ }
+ }
+ }
+ }
+ });
+ }
+
+ /**
*
*/
private void addPageAndPartSelectionListener() {
@@ -580,7 +606,35 @@ public class ExtendedMarkersView extends ViewPart {
}
};
}
-
+
+ /**
+ * Returns the complete list of selected {@link IMarker}s from the view.
+ *
+ * @return the complete list of selected {@link IMarker}s or an empty array, never <code>null</code>
+ * @since 3.8
+ */
+ IMarker[] getOpenableMarkers() {
+ ISelection selection = viewer.getSelection();
+ if (selection instanceof IStructuredSelection) {
+ IStructuredSelection structured = (IStructuredSelection) selection;
+ Iterator elements = structured.iterator();
+ HashSet result = new HashSet();
+ while (elements.hasNext()) {
+ MarkerSupportItem next = (MarkerSupportItem) elements.next();
+ if (next.isConcrete()) {
+ result.add(((MarkerEntry) next).getMarker());
+ }
+ }
+ if (result.isEmpty()) {
+ return MarkerSupportInternalUtilities.EMPTY_MARKER_ARRAY;
+ }
+ IMarker[] markers = new IMarker[result.size()];
+ result.toArray(markers);
+ return markers;
+ }
+ return MarkerSupportInternalUtilities.EMPTY_MARKER_ARRAY;
+ }
+
/**
* Turn off all filters in the builder.
*/
@@ -624,7 +678,6 @@ public class ExtendedMarkersView extends ViewPart {
* @return MarkerSupportItem[]
*/
MarkerSupportItem[] getAllConcreteItems() {
-
MarkerSupportItem[] elements =getActiveViewerInputClone().getElements();
Collection allMarkers = new ArrayList();
for (int i = 0; i < elements.length; i++) {
@@ -1183,17 +1236,15 @@ public class ExtendedMarkersView extends ViewPart {
}
}
-
+
/**
* Open the selected markers
*/
void openSelectedMarkers() {
- IMarker[] markers = getSelectedMarkers();
+ IMarker[] markers = getOpenableMarkers();
for (int i = 0; i < markers.length; i++) {
- IMarker marker = markers[i];
IWorkbenchPage page = getSite().getPage();
-
- openMarkerInEditor(marker, page);
+ openMarkerInEditor(markers[i], page);
}
}