1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-08-11 02:05:39 +02:00

Fix for 201938: CHelpProvider isn't called

This commit is contained in:
Anton Leherbauer 2007-09-04 14:16:21 +00:00
parent b5aff24da0
commit 3a7a4a5803
2 changed files with 25 additions and 29 deletions

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2002, 2006 QNX Software Systems and others.
* Copyright (c) 2002, 2007 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
@ -361,23 +361,6 @@ public class CEditorHoverConfigurationBlock implements IPreferenceConfigurationB
}
CEditorTextHoverDescriptor[] getContributedHovers() {
CEditorTextHoverDescriptor[] hoverDescriptors= CUIPlugin.getDefault().getCEditorTextHoverDescriptors();
// Move Best Match hover to front
boolean done= false;
for (int i= 0; !done && i < hoverDescriptors.length; i++) {
if (PreferenceConstants.ID_BESTMATCH_HOVER.equals(hoverDescriptors[i].getId())) {
// Swap with first one
CEditorTextHoverDescriptor tmpHover= hoverDescriptors[0];
hoverDescriptors[0]= hoverDescriptors[i];
hoverDescriptors[i]= tmpHover;
return hoverDescriptors;
}
}
// return unchanged array if best match hover can't be found
return CUIPlugin.getDefault().getCEditorTextHoverDescriptors();
}

View file

@ -734,25 +734,38 @@ public class CUIPlugin extends AbstractUIPlugin {
CEditorTextHoverDescriptor hoverDescriptor= null;
if (first > -1 && problemHoverIndex > -1 && problemHoverIndex != first) {
if (first > -1 && problemHoverIndex > -1 && problemHoverIndex > first) {
// move problem hover to beginning
hoverDescriptor= fCEditorTextHoverDescriptors[first];
fCEditorTextHoverDescriptors[first]= fCEditorTextHoverDescriptors[problemHoverIndex];
fCEditorTextHoverDescriptors[problemHoverIndex]= hoverDescriptor;
hoverDescriptor= fCEditorTextHoverDescriptors[problemHoverIndex];
System.arraycopy(fCEditorTextHoverDescriptors, first, fCEditorTextHoverDescriptors, first+1, problemHoverIndex - first);
fCEditorTextHoverDescriptors[first]= hoverDescriptor;
// update annotation hover index if needed
if (annotationHoverIndex == first)
annotationHoverIndex= problemHoverIndex;
if (annotationHoverIndex > first && annotationHoverIndex < problemHoverIndex)
annotationHoverIndex++;
}
if (annotationHoverIndex > -1 && annotationHoverIndex != last) {
if (annotationHoverIndex > -1 && annotationHoverIndex < last) {
// move annotation hover to end
hoverDescriptor= fCEditorTextHoverDescriptors[last];
fCEditorTextHoverDescriptors[last]= fCEditorTextHoverDescriptors[annotationHoverIndex];
fCEditorTextHoverDescriptors[annotationHoverIndex]= hoverDescriptor;
hoverDescriptor= fCEditorTextHoverDescriptors[annotationHoverIndex];
System.arraycopy(fCEditorTextHoverDescriptors, annotationHoverIndex+1, fCEditorTextHoverDescriptors, annotationHoverIndex, last - annotationHoverIndex);
fCEditorTextHoverDescriptors[last]= hoverDescriptor;
}
// Move Best Match hover to front
for (int i= 0; i < length; i++) {
if (PreferenceConstants.ID_BESTMATCH_HOVER.equals(fCEditorTextHoverDescriptors[i].getId())) {
if (i > 0) {
// move to top
CEditorTextHoverDescriptor bestMatchHover= fCEditorTextHoverDescriptors[i];
System.arraycopy(fCEditorTextHoverDescriptors, 0, fCEditorTextHoverDescriptors, 1, i);
fCEditorTextHoverDescriptors[0]= bestMatchHover;
}
break;
}
}
}
return fCEditorTextHoverDescriptors;
}