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 153084 Details for
Bug 296042
[Help] Add warnings for duplicate Context Sensitive Help ids on UI elements when debug is enabled
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]
Patch Revision 2
patch2.txt (text/plain), 3.68 KB, created by
Chris Austin
on 2009-11-25 11:41:31 EST
(
hide
)
Description:
Patch Revision 2
Filename:
MIME Type:
Creator:
Chris Austin
Created:
2009-11-25 11:41:31 EST
Size:
3.68 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.ui.workbench >Index: Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java >=================================================================== >RCS file: /cvsroot/eclipse/org.eclipse.ui.workbench/Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java,v >retrieving revision 1.24 >diff -u -r1.24 WorkbenchHelpSystem.java >--- Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java 16 Apr 2009 19:58:58 -0000 1.24 >+++ Eclipse UI/org/eclipse/ui/internal/help/WorkbenchHelpSystem.java 25 Nov 2009 16:43:48 -0000 >@@ -11,7 +11,7 @@ > package org.eclipse.ui.internal.help; > > import java.net.URL; >- >+import java.util.Hashtable; > import org.eclipse.core.runtime.Assert; > import org.eclipse.core.runtime.CoreException; > import org.eclipse.core.runtime.IConfigurationElement; >@@ -160,6 +160,13 @@ > private String desiredHelpSystemId; > > /** >+ * Table for tracing registered context ids. This is used only for debugging >+ * purposes. >+ * >+ */ >+ private Hashtable registeredIDTable; >+ >+ /** > * Handles dynamic removal of the help system. > * > * @since 3.1 >@@ -959,6 +966,8 @@ > * java.lang.String) > */ > public void setHelp(final IAction action, final String contextId) { >+ if (WorkbenchPlugin.DEBUG) >+ setHelpTrace(contextId); > action.setHelpListener(new HelpListener() { > public void helpRequested(HelpEvent event) { > if (getHelpUI() != null) { >@@ -981,6 +990,8 @@ > * java.lang.String) > */ > public void setHelp(Control control, String contextId) { >+ if (WorkbenchPlugin.DEBUG) >+ setHelpTrace(contextId); > control.setData(HELP_KEY, contextId); > // ensure that the listener is only registered once > control.removeHelpListener(getHelpListener()); >@@ -994,6 +1005,8 @@ > * java.lang.String) > */ > public void setHelp(Menu menu, String contextId) { >+ if (WorkbenchPlugin.DEBUG) >+ setHelpTrace(contextId); > menu.setData(HELP_KEY, contextId); > // ensure that the listener is only registered once > menu.removeHelpListener(getHelpListener()); >@@ -1007,12 +1020,50 @@ > * java.lang.String) > */ > public void setHelp(MenuItem item, String contextId) { >+ >+ if (WorkbenchPlugin.DEBUG) >+ setHelpTrace(contextId); >+ > item.setData(HELP_KEY, contextId); > // ensure that the listener is only registered once > item.removeHelpListener(getHelpListener()); > item.addHelpListener(getHelpListener()); > } > >+ /* >+ * (non-Javadoc) >+ * >+ * Traces all calls to the setHelp method in an attempt to find and report >+ * duplicated context IDs. >+ */ >+ private void setHelpTrace(String contextId) { >+ >+ StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); >+ StackTraceElement currentElement = null; >+ for (int s = 0; s < stackTrace.length; s++) { >+ if (stackTrace[s].getMethodName().equals("setHelp") && s + 1 < stackTrace.length) //$NON-NLS-1$ >+ { >+ currentElement = stackTrace[s + 1]; >+ break; >+ } >+ } >+ >+ if (registeredIDTable == null) >+ registeredIDTable = new Hashtable(); >+ >+ if (!registeredIDTable.containsKey(contextId)) >+ registeredIDTable.put(contextId, currentElement); >+ else if (!registeredIDTable.get(contextId).equals(currentElement)) { >+ StackTraceElement initialElement = (StackTraceElement) registeredIDTable >+ .get(contextId); >+ String error = "UI Duplicate Context ID found: '" + contextId + "'\n" + //$NON-NLS-1$ //$NON-NLS-2$ >+ " 1 at " + initialElement + '\n' + //$NON-NLS-1$ >+ " 2 at " + currentElement; //$NON-NLS-1$ >+ >+ System.out.println(error); >+ } >+ } >+ > /* (non-Javadoc) > * @see org.eclipse.ui.help.IWorkbenchHelpSystem#hasHelpUI() > */
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 296042
:
152990
| 153084