use of org.eclipse.ui.IEditorReference in project dbeaver by dbeaver.
the class NavigatorHandlerObjectDelete method deleteNewObject.
private boolean deleteNewObject(IWorkbenchWindow workbenchWindow, DBNDatabaseNode node) throws DBException {
for (final IEditorReference editorRef : workbenchWindow.getActivePage().getEditorReferences()) {
final IEditorPart editor = editorRef.getEditor(false);
if (editor instanceof IDatabaseEditor) {
final IDatabaseEditorInput editorInput = ((IDatabaseEditor) editor).getEditorInput();
if (editorInput.getDatabaseObject() == node.getObject()) {
ConfirmResult confirmResult = confirmObjectDelete(workbenchWindow, node, false, null, false);
if (confirmResult == ConfirmResult.NO) {
return true;
}
// Just close editor
// It should dismiss new object and remove navigator node
workbenchWindow.getActivePage().closeEditor(editor, false);
return true;
}
}
}
return false;
}
use of org.eclipse.ui.IEditorReference in project erlide_eclipse by erlang.
the class ClearAllCachesAction method clearAllCaches.
public static void clearAllCaches() {
final String cacheFileOSPath = ErlangEngine.getInstance().getStateDir();
final File cacheFile = new File(cacheFileOSPath);
cacheFile.delete();
for (final IWorkbenchWindow window : PlatformUI.getWorkbench().getWorkbenchWindows()) {
for (final IWorkbenchPage page : window.getPages()) {
for (final IEditorReference editor : page.getEditorReferences()) {
final IEditorPart ed = editor.getEditor(false);
if (ed instanceof ErlangEditor) {
((ErlangEditor) ed).resetAndCacheScannerAndParser();
}
}
}
}
}
use of org.eclipse.ui.IEditorReference in project erlide_eclipse by erlang.
the class EditorTracker method clearAllAnnotations.
/**
* clears coverage annotations from all files opened in the editor
*/
@Override
public void clearAllAnnotations() {
final IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
coverage.removeAll();
for (final IWorkbenchWindow w : windows) {
for (final IWorkbenchPage page : w.getPages()) {
for (final IEditorReference editor : page.getEditorReferences()) {
clearAnnotations(editor.getPart(false));
}
}
}
}
use of org.eclipse.ui.IEditorReference in project erlide_eclipse by erlang.
the class EditorTracker method addAnnotations.
/**
* Marks coverage of all tested modules (if they are opened)
*/
@Override
public void addAnnotations() {
final IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
createAnnotationMap();
for (final IWorkbenchWindow w : windows) {
for (final IWorkbenchPage page : w.getPages()) {
for (final IEditorReference editor : page.getEditorReferences()) {
if (editor.isDirty()) {
continue;
}
annotateEditor(editor.getEditor(false));
}
}
}
}
use of org.eclipse.ui.IEditorReference in project core by jcryptool.
the class EditorsManager method getEditorContent.
/**
* Looks up editor with this title and reads out its content.
*
* @param title the title of the editor to look up.
* @return the streamed content of the editor; or <code>null</code> if no editor with this title is available.
* @throws EditorNotFoundException if no active workbench page could be found.
*/
public InputStream getEditorContent(final String title) throws EditorNotFoundException {
IWorkbenchPage[] pages = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getPages();
if (0 == pages.length) {
// $NON-NLS-1$
throw new EditorNotFoundException("Could not find active workbench page.");
}
IEditorReference[] refs = pages[0].getEditorReferences();
IEditorPart ip = null;
for (IEditorReference er : refs) {
if (er.getTitle().equals(title)) {
ip = er.getEditor(true);
break;
}
}
if (null != ip) {
return getContentInputStream(ip);
}
return null;
}
Aggregations