OMNeT++/OMNEST Bug Tracker

View Issue Details Jump to Notes ] Issue History ] Print ]
IDProjectCategoryView StatusDate SubmittedLast Update
0000280OMNeT++IDE / NED editorpublic2011-04-21 10:312011-06-01 16:04
Assigned Tolevy 
PlatformOSOS Version
Product Version4.2b1 
Target VersionFixed in Version 
Summary0000280: NED file opened by text editor from search hitlist when I clicked a concrete hit (not the filename)
DescriptionWhen double clicking a line entry of NED file in search view, the NED file opened by text editor.
When double clicking a NED filename entry in search view, the NED file opened by NED editor.
TagsNo tags attached.
Attached Files

- Relationships

-  Notes
andras (administrator)
2011-04-21 10:53

The problem is that the NED Editor is registered as an "external editor" in Eclipse, see the following code in

    public IEditorPart openAndSelect(IWorkbenchPage wbPage, IFile file, int offset, int length, boolean activate) throws PartInitException {
        String editorId= null;
        IEditorDescriptor desc= IDE.getEditorDescriptor(file); <=== this finds the "NED Editor"
        if (desc == null || !desc.isInternal()) {
            editorId= "org.eclipse.ui.DefaultTextEditor"; <=== but then it gets here because desc.isInternal()==false
        } else {
            editorId= desc.getId();

What is registered as "NED Editor" is actually a launcher class (NedEditorLauncher) that opens the actual NED editor for NED files, and the plain text editor for non-NED files and inactive NED files (i.e. those outside NED folders or in disabled packages).

To fix this problem, the actual NED editor (NedEditor class) would have to be revised so that it can open non-NED files as well, and the launcher class removed.
andras (administrator)
2011-06-01 16:04

> To fix this problem, the actual NED editor (NedEditor class) would have
> to be revised so that it can open non-NED files as well, and the launcher class
> removed.

As some hint how to fix the NED editor, here's how Eclipse's text editor copes with nonexistent files.

When a text editor is opened with a nonexistent file (hint: open an existing text file, switch to another open file, then re-start the IDE, and close the file's project), it will show the "Resource xxx does not exist." message, and nothing else.

However, internally it has created and set up all the text editor machinery: the StyledText widget as part of the ISourceViewer, annotation margins, document provider, etc -- only the text editor is hidden. The text editor widget is created in the parent using a StackLayout, and when the file doesn't exist, the StackLayout's topControl is simply set to a "status control", an instance of InfoForm.

This code is in StatusTextEditor.updatePartControl(IEditorInput input):

    if (!isErrorStatus(status)) {
        front= fDefaultComposite;
    } else {
        fStatusControl= createStatusControl(fParent, status); <== HERE
        front= fStatusControl;
    if (fStackLayout.topControl != front) {
        fStackLayout.topControl= front;

We could do something like that in NedEditor. When the file doesn't exist (or is not in a NED folder, excluded, etc):

   1. fake some dummy INedElement tree for it so that the graphical editor doesn't throw NPE
   2. cause MultiPageEditor to display an InfoForm like StatusTextEditor does, and hide the normal content (Design and Source tabs). E.g. MultiPageEditor's CTabFolder could be in a StackLayout together with the InfoForm widget, and we set topControl to swichever is needed. CTabFolder can be put into a StackLayout by e.g. overriding MultiPageEditorPart's createPageContainer() that's called from createPartControl().

- Issue History
Date Modified Username Field Change
2011-04-21 10:31 zbojthe New Issue
2011-04-21 10:53 andras Note Added: 0000419
2011-05-20 10:44 levy Assigned To => levy
2011-05-20 11:28 levy Status new => postponed
2011-05-20 11:28 levy Resolution open => suspended
2011-06-01 16:04 andras Note Added: 0000467

Copyright © 2000 - 2022 MantisBT Team
Powered by Mantis Bugtracker