Dies ist eine alte Version des Dokuments!


Editor öffnen

Im folgenden Beispiel wird ein Editor geöffnet.
Dies erfolgt in einem seperatem Thread, damit das GUI während des Öffnens nicht „einfriert“.

public IEditorPart openEditor(Object myDataObject) {
   final IWorkbenchPage wbp = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
   final MutableObject response = new MutableObject();
   SafeRunner.run(new SafeRunnable() {
      public void run() throws Exception {
         final IMyEditorInput input = new MyEditorInput(myDataObject);
         final IEditorPart editor = wbp.openEditor(input, MyEditor.ID);
         response.setValue(editor);
      }
   });
   IEditorPart editorPart = (IEditorPart) response.getValue();
   return editorPart;
}


MyEditorInput muss wie folgt aufgebaut sein:

public class MyEditorInput extends PlatformObject implements IMyEditorInput {
   ...
}
 
public interface IMyEditorInput extends IEditorInput {
   ...
}



Eigene Werkzeuge
Werkzeuge

gratis Counter by GOWEB
seit 9.10.2007