Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [cdt-dev] multipage editor does not support "open declaration " properly"

Open declaration does not use an IMarker to jump to the right location. It uses IWorkbenchPage.openEditor() followed by ITextEditor.selectAndReveal().

I suspect the problem may be with this chunk of code from SelectionParseAction (line 114):

IEditorPart editor = EditorUtility.openInEditor(path, fEditor.getInputCElement());
if (editor instanceof ITextEditor) {
ITextEditor textEditor = (ITextEditor) editor;
textEditor.selectAndReveal(currentOffset, currentLength);
}

If the editor does not implement ITextEditor then selectAndReveal() won't get called.

This is just speculation, try debugging the OpenDeclarationsAction to see what's really going on.


Mike Kucera
Software Developer
IBM Eclipse CDT Team
mkucera@xxxxxxxxxx

Inactive hide details for Wieant Nielander ---06/23/2009 09:01:50 AM---> I have created a multipage editor by extending MultipaWieant Nielander ---06/23/2009 09:01:50 AM---> I have created a multipage editor by extending MultipageEditorpart . it


From:

Wieant Nielander <wieant@xxxxxxxxx>

To:

"CDT General developers list." <cdt-dev@xxxxxxxxxxx>

Date:

06/23/2009 09:01 AM

Subject:

Re: [cdt-dev] multipage editor does not support "open declaration " properly"




> I  have created a multipage editor by extending MultipageEditorpart  . it
> extends the class CEditor to get the features of
> general cdt c/c++ editor. But the functionality  "open declaration " is not
> working properly in that multi page editor
> such that if I try "open declaration" , it  opens the file with that
> declaration only at the begining of the file  and not
> at the right place where declaration is present. But this open declaration
> works fine with single page editor when I am
> extending the Ceditor class for c/c++ editor properties  or  if  am using
> the default c/c++ editor of CDT.what I should do
> to make the open declaration work properly in multipage editor?

I suspect the "open declaration" uses an IMarker and the editors
'gotoMarker()' to jump to the right location. In that case it will
probably end up in your multipage-editors gotoMarker() instead of
the specific (singlepage) CEditor. So you might start looking there,
and perhaps you can simply redirect the goto. (also note that
gotoMarker is not called directly, but is retreived through your
editors getAdapter() method).

Regards,
 Wieant
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev


GIF image

GIF image


Back to the top