Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[pde-build-dev] Retrievind an already opened editor from a resource

Hi


We are building an plugin for supporting a specific programming language.

We created a class which deals with markers related to compilation errors. I am having some problems because when the compiler is launched programmatically (instead of using external tools) its result needs to be parsed in order to attach the markers to the editor. If the file is already opened in our custom editor the markers are not shown in the right ruler.

I need to retrieve from an IFile instance the opened editor if it is opened. See below the else statement:

.
.
.
       if (fEditor != null) {
           fEditor.doSave(null);
           fFile = fEditor.getFile().getLocation().toFile().getAbsolutePath();
           fFileName = fEditor.getFile().getName();
           fFileLocation = fFile.substring(0, fFile.indexOf(fFileName));
           fMarkerFactory = fEditor.getMarkerFactory();
           fMarkerFactory.resetMarkers();
           fEditorDocument = fEditor.getDocumentProvider().getDocument(
                   fEditor.getEditorInput());
       } else {
           try {
               fResource.touch(null);
           } catch (CoreException e) {
           }
           fFile = fResource.getLocation().toFile().toString();
           fFileName = fResource.getName();
           fFileLocation = fFile.substring(0, fFile.indexOf(fFileName));
           fMarkerFactory = new ProblemsMarkerFactory(fResource);


Can anyone help us?

Thanks in advance!
Vit


Back to the top