use of org.eclipse.ui.IWorkbench in project dbeaver by serge-rider.
the class DBeaverApplication method stop.
@Override
public void stop() {
//$NON-NLS-1$
log.debug("DBeaver is stopping");
try {
final IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench == null)
return;
instanceServer = null;
DBeaverInstanceServer.stopInstanceServer();
final Display display = workbench.getDisplay();
DBeaverUI.syncExec(new Runnable() {
@Override
public void run() {
if (!display.isDisposed())
workbench.close();
}
});
} catch (Throwable e) {
log.error(e);
} finally {
instance = null;
stopDebugWriter();
}
}
use of org.eclipse.ui.IWorkbench in project translationstudio8 by heartsome.
the class Application method stop.
public void stop() {
final IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench == null) {
return;
}
final Display display = workbench.getDisplay();
display.syncExec(new Runnable() {
public void run() {
if (!display.isDisposed()) {
workbench.close();
}
}
});
}
use of org.eclipse.ui.IWorkbench in project translationstudio8 by heartsome.
the class CommonFunction method refreshHistoryWhenDelete.
/**
* 当删除一个文件时,刷新历史记录 --robert 2012-11-20
*/
@SuppressWarnings("restriction")
public static void refreshHistoryWhenDelete(IEditorInput input) {
IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench instanceof Workbench) {
EditorHistory history = ((Workbench) workbench).getEditorHistory();
for (EditorHistoryItem item : history.getItems()) {
if (item.matches(input)) {
history.remove(item);
}
}
history.refresh();
}
}
use of org.eclipse.ui.IWorkbench in project azure-tools-for-java by Microsoft.
the class ClasspathContainerPage method getSelectedProject.
/**
* This method returns currently selected project in workspace.
* @return IProject
*/
private IProject getSelectedProject() {
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
ISelectionService service = window.getSelectionService();
ISelection selection = service.getSelection();
Object element = null;
IResource resource;
IProject selProject = null;
if (selection instanceof IStructuredSelection) {
IStructuredSelection structuredSel = (IStructuredSelection) selection;
element = structuredSel.getFirstElement();
}
if (element instanceof IProject) {
resource = (IResource) element;
selProject = resource.getProject();
} else if (element instanceof IJavaProject) {
IJavaProject proj = ((IJavaElement) element).getJavaProject();
selProject = proj.getProject();
}
return selProject;
}
use of org.eclipse.ui.IWorkbench in project azure-tools-for-java by Microsoft.
the class UIHelperImpl method openItem.
@Override
public <T extends StorageServiceTreeItem> void openItem(Object projectObject, final StorageAccount storageAccount, final T item, String itemType, String itemName, String iconName) {
// Display.getDefault().syncExec(new Runnable() {
// @Override
// public void run() {
// try {
// BlobExplorerView view = (BlobExplorerView) PlatformUI
// .getWorkbench().getActiveWorkbenchWindow()
// .getActivePage().showView("com.microsoft.azureexplorer.views.BlobExplorerView");
// view.init(storageAccount, (BlobContainer) blobContainer);
// } catch (PartInitException e) {
// Activator.getDefault().log("Error opening container", e);
// }
// }
// });
IWorkbench workbench = PlatformUI.getWorkbench();
IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor(type2Editor.get(item.getClass()));
try {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IEditorPart newEditor = page.openEditor(new StorageEditorInput(storageAccount.name(), StorageClientSDKManager.getConnectionString(storageAccount), item), editorDescriptor.getId());
} catch (PartInitException e) {
Activator.getDefault().log("Error opening " + item.getName(), e);
}
}
Aggregations