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 151932 Details for
Bug 294812
[hover] Improper hover order prevents using the right hover
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]
Alternative fix
294812.patch (text/plain), 4.89 KB, created by
Anton Leherbauer
on 2009-11-11 05:46:44 EST
(
hide
)
Description:
Alternative fix
Filename:
MIME Type:
Creator:
Anton Leherbauer
Created:
2009-11-11 05:46:44 EST
Size:
4.89 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.cdt.ui >Index: src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java >=================================================================== >RCS file: /cvsroot/tools/org.eclipse.cdt-core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java,v >retrieving revision 1.9 >diff -u -r1.9 BestMatchHover.java >--- src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java 17 Apr 2008 13:43:54 -0000 1.9 >+++ src/org/eclipse/cdt/internal/ui/text/c/hover/BestMatchHover.java 11 Nov 2009 10:46:23 -0000 >@@ -1,5 +1,5 @@ > /******************************************************************************* >- * Copyright (c) 2002, 2008 QNX Software Systems and others. >+ * Copyright (c) 2002, 2009 QNX Software Systems 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 >@@ -8,17 +8,14 @@ > * Contributors: > * QNX Software Systems - Initial API and implementation > * Anton Leherbauer (Wind River Systems) >+ * Ericsson - Fix improper hover order (Bug 294812) > *******************************************************************************/ > > package org.eclipse.cdt.internal.ui.text.c.hover; > > import java.util.ArrayList; >-import java.util.Iterator; > import java.util.List; > >-import org.eclipse.cdt.ui.CUIPlugin; >-import org.eclipse.cdt.ui.PreferenceConstants; >-import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover; > import org.eclipse.jface.text.IInformationControlCreator; > import org.eclipse.jface.text.IRegion; > import org.eclipse.jface.text.ITextHover; >@@ -28,8 +25,16 @@ > import org.eclipse.jface.text.information.IInformationProviderExtension2; > import org.eclipse.ui.IEditorPart; > >+import org.eclipse.cdt.ui.CUIPlugin; >+import org.eclipse.cdt.ui.PreferenceConstants; >+import org.eclipse.cdt.ui.text.c.hover.ICEditorTextHover; >+ > /** >- * BestMatchHover >+ * BestMatchHover. >+ * This is not a real hover, but instead, it is always the first hover used >+ * and it will choose the best of the real hovers. To choose the best hover, >+ * we simply find the first hover that returns some text. This implies >+ * that the order of hovers is important and must be preserved. (Bug 294812) > */ > public class BestMatchHover extends AbstractCEditorTextHover { > >@@ -59,25 +64,37 @@ > CEditorTextHoverDescriptor[] hoverDescs= CUIPlugin.getDefault().getCEditorTextHoverDescriptors(); > for (int i= 0; i < hoverDescs.length; i++) { > // ensure that we don't add ourselves to the list >- if (!PreferenceConstants.ID_BESTMATCH_HOVER.equals(hoverDescs[i].getId())) >+ if (!PreferenceConstants.ID_BESTMATCH_HOVER.equals(hoverDescs[i].getId())) { > fTextHoverSpecifications.add(hoverDescs[i]); >+ // add place-holder for hover instance >+ fInstantiatedTextHovers.add(null); >+ } > } > } > > private void checkTextHovers() { >- if (fTextHoverSpecifications.size() == 0) >+ if (fTextHoverSpecifications == null) > return; > >- for (Iterator<CEditorTextHoverDescriptor> iterator= new ArrayList<CEditorTextHoverDescriptor>(fTextHoverSpecifications).iterator(); iterator.hasNext(); ) { >- CEditorTextHoverDescriptor spec= iterator.next(); >- >+ boolean allCreated = true; >+ for (int i= 0; i < fTextHoverSpecifications.size(); ++i) { >+ CEditorTextHoverDescriptor spec= fTextHoverSpecifications.get(i); >+ if (spec == null) continue; >+ > ICEditorTextHover hover= spec.createTextHover(); > if (hover != null) { > hover.setEditor(getEditor()); >- addTextHover(hover); >- fTextHoverSpecifications.remove(spec); >+ // remember instance and mark as created >+ fInstantiatedTextHovers.set(i, hover); >+ fTextHoverSpecifications.set(i, null); >+ } else { >+ allCreated = false; > } > } >+ >+ if (allCreated) { >+ fTextHoverSpecifications = null; >+ } > } > > protected void addTextHover(ITextHover hover) { >@@ -98,8 +115,8 @@ > if (fInstantiatedTextHovers == null) > return null; > >- for (Iterator<ITextHover> iterator= fInstantiatedTextHovers.iterator(); iterator.hasNext(); ) { >- ITextHover hover= iterator.next(); >+ for (ITextHover hover : fInstantiatedTextHovers) { >+ if (hover == null) continue; > > String s= hover.getHoverInfo(textViewer, hoverRegion); > if (s != null && s.trim().length() > 0) { >@@ -124,9 +141,9 @@ > if (fInstantiatedTextHovers == null) > return null; > >- for (Iterator<ITextHover> iterator= fInstantiatedTextHovers.iterator(); iterator.hasNext(); ) { >- ITextHover hover= iterator.next(); >- >+ for (ITextHover hover : fInstantiatedTextHovers) { >+ if (hover == null) continue; >+ > if (hover instanceof ITextHoverExtension2) { > Object info= ((ITextHoverExtension2) hover).getHoverInfo2(textViewer, hoverRegion); > if (info != null) {
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
Flags:
aleherb+eclipse
:
iplog-
Actions:
View
|
Diff
Attachments on
bug 294812
:
151880
|
151904
|
151932
|
151941