Search in sources :

Example 1 with IWorkbench

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();
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Display(org.eclipse.swt.widgets.Display)

Example 2 with IWorkbench

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();
            }
        }
    });
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) Display(org.eclipse.swt.widgets.Display)

Example 3 with IWorkbench

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();
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) EditorHistory(org.eclipse.ui.internal.EditorHistory) EditorHistoryItem(org.eclipse.ui.internal.EditorHistoryItem) Workbench(org.eclipse.ui.internal.Workbench) IWorkbench(org.eclipse.ui.IWorkbench)

Example 4 with IWorkbench

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;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IJavaProject(org.eclipse.jdt.core.IJavaProject) ISelection(org.eclipse.jface.viewers.ISelection) ISelectionService(org.eclipse.ui.ISelectionService) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IResource(org.eclipse.core.resources.IResource) IProject(org.eclipse.core.resources.IProject)

Example 5 with IWorkbench

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);
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) StorageEditorInput(com.microsoft.azuretools.azureexplorer.editors.StorageEditorInput) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

IWorkbench (org.eclipse.ui.IWorkbench)60 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)21 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)17 IEditorPart (org.eclipse.ui.IEditorPart)13 WizardDialog (org.eclipse.jface.wizard.WizardDialog)10 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)9 ISelection (org.eclipse.jface.viewers.ISelection)8 PartInitException (org.eclipse.ui.PartInitException)8 Display (org.eclipse.swt.widgets.Display)7 IProject (org.eclipse.core.resources.IProject)6 IResource (org.eclipse.core.resources.IResource)6 TreeViewer (org.eclipse.jface.viewers.TreeViewer)6 Shell (org.eclipse.swt.widgets.Shell)6 IEditorDescriptor (org.eclipse.ui.IEditorDescriptor)6 TableEditorInput (com.cubrid.common.ui.cubrid.table.editor.TableEditorInput)5 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)5 ExecTaskWithProgress (com.cubrid.common.ui.spi.progress.ExecTaskWithProgress)5 TaskExecutor (com.cubrid.common.ui.spi.progress.TaskExecutor)5 DatabaseInfo (com.cubrid.cubridmanager.core.cubrid.database.model.DatabaseInfo)5 IJavaProject (org.eclipse.jdt.core.IJavaProject)5