use of org.eclipse.ui.IWorkbenchWindow in project flux by eclipse.
the class LiveEditConnector method dispose.
public void dispose() {
this.liveEditCoordinator.removeLiveEditConnector(liveEditConnector);
this.repository.removeRepositoryListener(repositoryListener);
FileBuffers.getTextFileBufferManager().removeFileBufferListener(fileBufferListener);
ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceListener);
WorkbenchJob jw = new WorkbenchJob("Removing listener") {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (window != null) {
window.getActivePage().removePartListener(partListener);
}
return Status.OK_STATUS;
}
};
jw.setSystem(true);
jw.schedule();
for (IDocument document : documentMappings.values()) {
if (document != null) {
document.removeDocumentListener(documentListener);
}
}
resourceMappings.clear();
documentMappings.clear();
}
use of org.eclipse.ui.IWorkbenchWindow in project gfm_viewer by satyagraha.
the class DIManager method getInjector.
public Injector getInjector(Component.Scope scope) {
if (scope == null) {
throw new IllegalArgumentException("null scope");
}
switch(scope) {
case PLUGIN:
return pluginInjector;
case PAGE:
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
if (workbenchWindow == null) {
throw new IllegalStateException("no active workbench window");
}
IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
if (workbenchPage == null) {
throw new IllegalStateException("no active workbench page");
}
Injector pageInjector = pageInjectorMap.get(workbenchPage);
if (pageInjector == null) {
throw new IllegalStateException("unable to locate pageInjector for page: " + workbenchPage);
}
return pageInjector;
default:
throw new IllegalArgumentException("unexpected scope: " + scope);
}
}
use of org.eclipse.ui.IWorkbenchWindow in project dbeaver by serge-rider.
the class NavigatorHandlerProjectCreate method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
IWorkbenchWindow window = HandlerUtil.getActiveWorkbenchWindow(event);
createNewProject(window);
return null;
}
use of org.eclipse.ui.IWorkbenchWindow in project dbeaver by serge-rider.
the class NavigatorHandlerProjectSelect method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final DBeaverCore core = DBeaverCore.getInstance();
final DBNProject projectNode = core.getNavigatorModel().getRoot().getProject(core.getProjectRegistry().getActiveProject());
if (projectNode != null) {
final IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
try {
final ProjectNavigatorView projectsView = (ProjectNavigatorView) workbenchWindow.getActivePage().showView(ProjectNavigatorView.VIEW_ID);
if (projectsView != null) {
projectsView.showNode(projectNode);
}
} catch (PartInitException e) {
log.error(e);
}
}
return null;
}
use of org.eclipse.ui.IWorkbenchWindow in project dbeaver by serge-rider.
the class NavigatorHandlerCreateLink method execute.
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
final ISelection selection = HandlerUtil.getCurrentSelection(event);
if (selection instanceof IStructuredSelection) {
final IStructuredSelection structSelection = (IStructuredSelection) selection;
Object element = structSelection.getFirstElement();
if (!(element instanceof DBNResource)) {
return null;
}
final IResource resource = ((DBNResource) element).getResource();
if (resource instanceof IFolder) {
final IWorkbenchWindow workbenchWindow = HandlerUtil.getActiveWorkbenchWindow(event);
DirectoryDialog dialog = new DirectoryDialog(workbenchWindow.getShell(), SWT.NONE);
String folder = dialog.open();
if (folder != null) {
createLink(workbenchWindow, (IFolder) resource, folder);
}
}
}
return null;
}
Aggregations