use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.
the class RefreshView method refreshAll.
public static void refreshAll() {
IWorkbenchWindow workBenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (workBenchWindow == null) {
return;
}
IWorkbenchPage workBenchPage = workBenchWindow.getActivePage();
if (workBenchPage == null) {
return;
}
for (IViewDescriptor desc : PlatformUI.getWorkbench().getViewRegistry().getViews()) {
IViewPart viewPart = workBenchPage.findView(desc.getId());
// show the view again in order to see the change
if (viewPart != null) {
workBenchPage.hideView(viewPart);
}
}
workBenchPage.resetPerspective();
}
use of org.eclipse.ui.IWorkbenchWindow in project tesb-studio-se by Talend.
the class RefactorRenameHandler method isEnabled.
public boolean isEnabled() {
if (!handler.isEnabled()) {
return false;
}
// disable the command when editor is readonly.
IWorkbench workbench = PlatformUI.getWorkbench();
if (workbench == null) {
return false;
}
IWorkbenchWindow window = workbench.getActiveWorkbenchWindow();
if (window == null) {
return false;
}
IWorkbenchPage activePage = window.getActivePage();
if (activePage == null) {
return false;
}
IEditorPart activeEditor = activePage.getActiveEditor();
if (activeEditor != null && activeEditor instanceof LocalWSDLEditor) {
LocalWSDLEditor wsdlEditor = (LocalWSDLEditor) activeEditor;
return !wsdlEditor.isEditorInputReadOnly();
}
return false;
}
use of org.eclipse.ui.IWorkbenchWindow in project tesb-studio-se by Talend.
the class ESBService method refreshComponentView.
/**
* When services connection is renamed, refresh the connection label in the component view of job.
*
* @param item
*/
@Override
public void refreshComponentView(Item item) {
try {
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
IEditorReference[] editors = activePage.getEditorReferences();
for (IEditorReference er : editors) {
IEditorPart part = er.getEditor(false);
if (part instanceof AbstractMultiPageTalendEditor) {
AbstractMultiPageTalendEditor editor = (AbstractMultiPageTalendEditor) part;
CommandStack stack = (CommandStack) editor.getTalendEditor().getAdapter(CommandStack.class);
if (stack != null) {
IProcess process = editor.getProcess();
for (final INode processNode : process.getGraphicalNodes()) {
if (processNode instanceof Node) {
checkRepository((Node) processNode, item, stack);
}
}
}
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
}
use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.
the class AbstractProcessAction method checkUnLoadedNodeForProcess.
public void checkUnLoadedNodeForProcess(JobEditorInput fileEditorInput) {
if (fileEditorInput == null || fileEditorInput.getLoadedProcess() == null) {
return;
}
IProcess2 loadedProcess = fileEditorInput.getLoadedProcess();
List<NodeType> unloadedNode = loadedProcess.getUnloadedNode();
if (unloadedNode != null && !unloadedNode.isEmpty()) {
String message = "Some Component are not loaded:\n";
for (int i = 0; i < unloadedNode.size(); i++) {
message = message + unloadedNode.get(i).getComponentName() + "\n";
}
if (!CommonsPlugin.isHeadless() && PlatformUI.isWorkbenchRunning()) {
Display display = Display.getCurrent();
if (display == null) {
display = Display.getDefault();
}
if (display != null) {
final Display tmpDis = display;
final String tmpMess = message;
display.syncExec(new Runnable() {
public void run() {
Shell shell = null;
final IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow != null) {
shell = activeWorkbenchWindow.getShell();
} else {
if (tmpDis != null) {
shell = tmpDis.getActiveShell();
} else {
shell = new Shell();
}
}
MessageDialog.openWarning(shell, "Warning", tmpMess);
}
});
}
}
}
}
use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.
the class ExportJobScriptAction method checkDirtyPart.
/**
* DOC Administrator Comment method "checkDirtyPart".
*
* @param workbench
*/
@SuppressWarnings("restriction")
private boolean checkDirtyPart(IWorkbench workbench) {
ISaveablePart[] parts = null;
IWorkbenchWindow[] windows = workbench.getWorkbenchWindows();
for (IWorkbenchWindow window : windows) {
IWorkbenchPage[] pages = window.getPages();
for (IWorkbenchPage page : pages) {
parts = page.getDirtyEditors();
}
}
if (parts != null && parts.length > 0) {
return true;
}
return false;
}
Aggregations