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);
// }
}
});
}
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;
}
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;
}
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();
}
}
});
}
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();
}
}
Aggregations