Monday, December 12, 2005

How to go through all editors


public static void allEditors() {
IWorkbenchWindow[] win = SamplePlugin.getDefault()
.getWorkbench().getWorkbenchWindows();
for (int i = 0; i < win.length; i++) {
IWorkbenchPage[] pages = win[i].getPages();
for (int j = 0; j < pages.length; j++) {
IEditorReference[] editors = pages[j].getEditorReferences();
for (int k = 0; k < editors.length; k++) {
IEditorPart editor = editors[k].getEditor(true);
if (editor instanceof MyEditor)
//getText() is the metod in MyEditor.
((MyEditor)editor).getText();
}
}
}
}

0 Comments:

Post a Comment

<< Home