Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 192217 Details for
Bug 341259
[JFace] Add debug flag to find bad content providers that return multiple equal children
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Fix
patch.txt (text/plain), 9.19 KB, created by
Markus Keller
on 2011-03-30 14:22:22 EDT
(
hide
)
Description:
Fix
Filename:
MIME Type:
Creator:
Markus Keller
Created:
2011-03-30 14:22:22 EDT
Size:
9.19 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.jface >Index: .options >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/.options,v >retrieving revision 1.4 >diff -u -r1.4 .options >--- .options 2 May 2007 21:01:58 -0000 1.4 >+++ .options 30 Mar 2011 18:17:45 -0000 >@@ -9,6 +9,9 @@ > # Always log reentrant calls to viewers (if set to false, it just logs the first reentrant call) > org.eclipse.jface/debug/viewers/reentrantViewerCalls=false > >+# Log illegal equal elements in a viewer >+org.eclipse.jface/debug/viewers/equalElements=false >+ > # Show the jface new look for the preferences dialog > org.eclipse.jface/newlook/preferences/showNewLook=false > >Index: src/org/eclipse/jface/internal/InternalPolicy.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/internal/InternalPolicy.java,v >retrieving revision 1.5 >diff -u -r1.5 InternalPolicy.java >--- src/org/eclipse/jface/internal/InternalPolicy.java 20 May 2009 21:51:18 -0000 1.5 >+++ src/org/eclipse/jface/internal/InternalPolicy.java 30 Mar 2011 18:17:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2007, 2009 IBM Corporation and others. >+ * Copyright (c) 2007, 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 >@@ -25,6 +25,13 @@ > * @since 3.3 > */ > public static boolean DEBUG_LOG_REENTRANT_VIEWER_CALLS = false; >+ >+ /** >+ * (NON-API) A flag to indicate whether illegal equal elements in a viewer should be logged. >+ * >+ * @since 3.7 >+ */ >+ public static boolean DEBUG_LOG_EQUAL_VIEWER_ELEMENTS= false; > > /** > * (NON-API) A flag to indicate whether label provider changed notifications >Index: src/org/eclipse/jface/viewers/AbstractTreeViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/AbstractTreeViewer.java,v >retrieving revision 1.152 >diff -u -r1.152 AbstractTreeViewer.java >--- src/org/eclipse/jface/viewers/AbstractTreeViewer.java 30 Mar 2011 15:20:04 -0000 1.152 >+++ src/org/eclipse/jface/viewers/AbstractTreeViewer.java 30 Mar 2011 18:17:45 -0000 >@@ -23,6 +23,13 @@ > import java.util.LinkedList; > import java.util.List; > >+import org.eclipse.core.runtime.Assert; >+import org.eclipse.core.runtime.IStatus; >+import org.eclipse.core.runtime.ListenerList; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.jface.internal.InternalPolicy; >+import org.eclipse.jface.util.Policy; >+import org.eclipse.jface.util.SafeRunnable; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.BusyIndicator; > import org.eclipse.swt.events.SelectionEvent; >@@ -34,11 +41,6 @@ > import org.eclipse.swt.widgets.Item; > import org.eclipse.swt.widgets.Widget; > >-import org.eclipse.core.runtime.Assert; >-import org.eclipse.core.runtime.ListenerList; >- >-import org.eclipse.jface.util.SafeRunnable; >- > /** > * Abstract base implementation for tree-structure-oriented viewers (trees and > * table trees). >@@ -1349,12 +1351,14 @@ > } > Object[] result = tpcp.getChildren(path); > if (result != null) { >+ assertElementsNotNull(parent, result); > return result; > } > } else if (cp instanceof ITreeContentProvider) { > ITreeContentProvider tcp = (ITreeContentProvider) cp; > Object[] result = tcp.getChildren(parent); > if (result != null) { >+ assertElementsNotNull(parent, result); > return result; > } > } >@@ -1366,6 +1370,39 @@ > } > > /** >+ * Asserts that the given array of elements is itself non- <code>null</code> >+ * and contains no <code>null</code> elements. >+ * >+ * @param parent >+ * the parent element >+ * @param elements >+ * the array to check >+ */ >+ private void assertElementsNotNull(Object parent, Object[] elements) { >+ Assert.isNotNull(elements); >+ for (int i = 0, n = elements.length; i < n; ++i) { >+ Assert.isNotNull(elements[i]); >+ } >+ >+ if (InternalPolicy.DEBUG_LOG_EQUAL_VIEWER_ELEMENTS >+ && elements.length > 1) { >+ CustomHashtable elementSet = newHashtable(elements.length * 2); >+ for (int i = 0; i < elements.length; i++) { >+ Object element = elements[i]; >+ Object old = elementSet.put(element, element); >+ if (old != null) { >+ String message = "Sibling elements in viewer must not be equal:\n " //$NON-NLS-1$ >+ + old + ",\n " + element + ",\n parent: " + parent; //$NON-NLS-1$ //$NON-NLS-2$ >+ Policy.getLog().log( >+ new Status(IStatus.WARNING, Policy.JFACE, message, >+ new RuntimeException())); >+ return; >+ } >+ } >+ } >+ } >+ >+ /** > * Returns all selected items for the given SWT control. > * > * @param control >Index: src/org/eclipse/jface/viewers/StructuredViewer.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.jface/src/org/eclipse/jface/viewers/StructuredViewer.java,v >retrieving revision 1.88 >diff -u -r1.88 StructuredViewer.java >--- src/org/eclipse/jface/viewers/StructuredViewer.java 10 Sep 2010 15:54:27 -0000 1.88 >+++ src/org/eclipse/jface/viewers/StructuredViewer.java 30 Mar 2011 18:17:45 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2000, 2010 IBM Corporation and others. >+ * Copyright (c) 2000, 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 >@@ -17,9 +17,13 @@ > import java.util.List; > > import org.eclipse.core.runtime.Assert; >+import org.eclipse.core.runtime.IStatus; > import org.eclipse.core.runtime.ListenerList; >+import org.eclipse.core.runtime.Status; >+import org.eclipse.jface.internal.InternalPolicy; > import org.eclipse.jface.util.IOpenEventListener; > import org.eclipse.jface.util.OpenStrategy; >+import org.eclipse.jface.util.Policy; > import org.eclipse.jface.util.SafeRunnable; > import org.eclipse.swt.SWT; > import org.eclipse.swt.custom.TableTreeItem; >@@ -594,6 +598,23 @@ > for (int i = 0, n = elements.length; i < n; ++i) { > Assert.isNotNull(elements[i]); > } >+ >+ if (InternalPolicy.DEBUG_LOG_EQUAL_VIEWER_ELEMENTS >+ && elements.length > 1) { >+ CustomHashtable elementSet = newHashtable(elements.length * 2); >+ for (int i = 0; i < elements.length; i++) { >+ Object element = elements[i]; >+ Object old = elementSet.put(element, element); >+ if (old != null) { >+ String message = "Sibling elements in viewer must not be equal:\n " //$NON-NLS-1$ >+ + old + ",\n " + element; //$NON-NLS-1$ >+ Policy.getLog().log( >+ new Status(IStatus.WARNING, Policy.JFACE, message, >+ new RuntimeException())); >+ return; >+ } >+ } >+ } > } > > /** >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java,v >retrieving revision 1.22 >diff -u -r1.22 JFaceUtil.java >--- Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java 1 Jun 2010 19:22:35 -0000 1.22 >+++ Eclipse UI/org/eclipse/ui/internal/JFaceUtil.java 30 Mar 2011 18:17:45 -0000 >@@ -16,8 +16,8 @@ > import org.eclipse.core.runtime.Platform; > import org.eclipse.core.runtime.SafeRunner; > import org.eclipse.core.runtime.preferences.IEclipsePreferences; >-import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.core.runtime.preferences.IEclipsePreferences.NodeChangeEvent; >+import org.eclipse.core.runtime.preferences.InstanceScope; > import org.eclipse.jface.internal.InternalPolicy; > import org.eclipse.jface.preference.JFacePreferences; > import org.eclipse.jface.util.ILogger; >@@ -72,11 +72,12 @@ > }); > > // Get all debug options from Platform >- if ("true".equalsIgnoreCase(Platform.getDebugOption("/debug"))) { //$NON-NLS-1$ //$NON-NLS-2$ >+ if ("true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug"))) { //$NON-NLS-1$ //$NON-NLS-2$ > Policy.DEBUG_DIALOG_NO_PARENT = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/dialog/noparent")); //$NON-NLS-1$ //$NON-NLS-2$ > Policy.TRACE_ACTIONS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/trace/actions")); //$NON-NLS-1$ //$NON-NLS-2$ > Policy.TRACE_TOOLBAR = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/trace/toolbarDisposal")); //$NON-NLS-1$ //$NON-NLS-2$ > InternalPolicy.DEBUG_LOG_REENTRANT_VIEWER_CALLS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/reentrantViewerCalls")); //$NON-NLS-1$ //$NON-NLS-2$ >+ InternalPolicy.DEBUG_LOG_EQUAL_VIEWER_ELEMENTS = "true".equalsIgnoreCase(Platform.getDebugOption(Policy.JFACE + "/debug/viewers/equalElements")); //$NON-NLS-1$ //$NON-NLS-2$ > } > } >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 341259
: 192217