Search in sources :

Example 6 with IWorkbench

use of org.eclipse.ui.IWorkbench in project azure-tools-for-java by Microsoft.

the class UIHelperImpl method refreshQueue.

@Override
public void refreshQueue(Object projectObject, final StorageAccount storageAccount, final Queue queue) {
    IWorkbench workbench = PlatformUI.getWorkbench();
    final IEditorDescriptor editorDescriptor = workbench.getEditorRegistry().findEditor("com.microsoft.azuretools.azureexplorer.editors.QueueFileEditor");
    DefaultLoader.getIdeHelper().invokeLater(new Runnable() {

        public void run() {
        // TODO
        //                try {
        //                    IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
        //                    QueueFileEditor newEditor = (QueueFileEditor) page.openEditor(new StorageEditorInput(storageAccount, queue), editorDescriptor.getId());
        //                    newEditor.fillGrid();
        //                } catch (PartInitException e) {
        //                    Activator.getDefault().log("Error opening container", e);
        //                }
        }
    });
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IEditorDescriptor(org.eclipse.ui.IEditorDescriptor)

Example 7 with IWorkbench

use of org.eclipse.ui.IWorkbench in project azure-tools-for-java by Microsoft.

the class SDKJarsFilter method getSelectedProject.

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 8 with IWorkbench

use of org.eclipse.ui.IWorkbench in project azure-tools-for-java by Microsoft.

the class PluginUtil method getSelectedProject.

/**
	 * This method returns currently selected project in workspace.
	 * @return IProject
	 */
public static 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();
    } else if (element instanceof IResource) {
        resource = (IResource) element;
        selProject = resource.getProject();
    } else {
        IWorkbenchPage page = window.getActivePage();
        IEditorPart editorPart = page.getActiveEditor();
        if (editorPart != null) {
            IFile file = (IFile) editorPart.getEditorInput().getAdapter(IFile.class);
            if (file != null) {
                selProject = file.getProject();
            }
        }
    }
    return selProject;
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IJavaProject(org.eclipse.jdt.core.IJavaProject) IFile(org.eclipse.core.resources.IFile) ISelection(org.eclipse.jface.viewers.ISelection) ISelectionService(org.eclipse.ui.ISelectionService) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) IResource(org.eclipse.core.resources.IResource) IProject(org.eclipse.core.resources.IProject)

Example 9 with IWorkbench

use of org.eclipse.ui.IWorkbench in project tdi-studio-se by Talend.

the class Application method stop.

/*
     * (non-Javadoc)
     * 
     * @see org.eclipse.equinox.app.IApplication#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 10 with IWorkbench

use of org.eclipse.ui.IWorkbench in project tdi-studio-se by Talend.

the class ShowDesignerPageAction method run.

@Override
public void run() {
    IWorkbench workbench = PlatformUI.getWorkbench();
    IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
    IEditorPart editorPart = page.getActiveEditor();
    if (editorPart instanceof MultiPageTalendEditor) {
        ((MultiPageTalendEditor) editorPart).showDesignerPage();
    }
}
Also used : IWorkbench(org.eclipse.ui.IWorkbench) MultiPageTalendEditor(org.talend.designer.core.ui.MultiPageTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart)

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