use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.
the class DesignerCoreService method refreshComponentView.
@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 TalendPaletteHelper method checkAndInitToolBar.
public static void checkAndInitToolBar() {
if (talendPartListener == null) {
talendPartListener = new TalendPartAdapter2() {
@Override
public void partActivated(IWorkbenchPartReference partRef) {
checkAndInitToolBar();
}
@Override
public void partOpened(IWorkbenchPartReference partRef) {
checkAndInitToolBar();
}
};
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow != null) {
IPartService partService = activeWorkbenchWindow.getPartService();
partService.addPartListener(talendPartListener);
}
}
// check every time
checkAndInitToolBar2();
}
use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.
the class DesignerColorsPreferencePage method switchToCurrentColor.
/**
* zli Comment method "switchToCurrentColor".
*/
private void switchToCurrentColor() {
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow != null) {
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
if (activePage != null) {
for (IEditorReference ref : activePage.getEditorReferences()) {
IEditorPart editor = ref.getEditor(true);
if (editor instanceof AbstractMultiPageTalendEditor) {
AbstractMultiPageTalendEditor pageEditor = (AbstractMultiPageTalendEditor) editor;
AbstractTalendEditor talendEditor = pageEditor.getTalendEditor();
ProcessPart processPart = talendEditor.getProcessPart();
processPart.ajustReadOnly();
changeMRGroupColor(processPart);
}
}
}
}
}
use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.
the class CreateDiagramAction method setRepositoryNode.
private void setRepositoryNode(Properties params) {
IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (null == workbenchWindow) {
return;
}
IWorkbenchPage workbenchPage = workbenchWindow.getActivePage();
if (null == workbenchPage) {
return;
}
IPerspectiveDescriptor currentPerspective = workbenchPage.getPerspective();
if (!IBrandingConfiguration.PERSPECTIVE_DI_ID.equals(currentPerspective.getId())) {
// show di perspective
try {
workbenchWindow.getWorkbench().showPerspective(IBrandingConfiguration.PERSPECTIVE_DI_ID, workbenchWindow);
workbenchPage = workbenchWindow.getActivePage();
} catch (WorkbenchException e) {
ExceptionHandler.process(e);
return;
}
}
// bug 16594
IRepositoryView view = RepositoryManagerHelper.getRepositoryView();
if (view != null) {
Object type = params.get("type");
if (ERepositoryObjectType.BUSINESS_PROCESS != null && ERepositoryObjectType.BUSINESS_PROCESS.name().equals(type)) {
RepositoryNode processNode = ((ProjectRepositoryNode) view.getRoot()).getRootRepositoryNode(ERepositoryObjectType.BUSINESS_PROCESS);
final StructuredViewer viewer = view.getViewer();
if (viewer instanceof TreeViewer) {
((TreeViewer) viewer).expandToLevel(processNode, 1);
}
this.repositoryNode = processNode;
}
}
}
use of org.eclipse.ui.IWorkbenchWindow in project tdi-studio-se by Talend.
the class DownloadComponenentsAction method selectPaletteEntry.
private void selectPaletteEntry(String componentName) {
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow != null) {
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
if (activePage != null) {
IEditorReference[] editorReferences = activePage.getEditorReferences();
if (editorReferences != null) {
for (IEditorReference er : editorReferences) {
IEditorPart part = er.getEditor(false);
if (part instanceof AbstractMultiPageTalendEditor) {
AbstractMultiPageTalendEditor editor = (AbstractMultiPageTalendEditor) part;
AbstractTalendEditor talendEditor = editor.getTalendEditor();
try {
ComponentPaletteUtilities.setSkipUpdatePalette(true);
talendEditor.selectPaletteEntry(componentName);
} catch (Exception e) {
ExceptionHandler.process(e);
}
return;
}
}
}
}
}
}
Aggregations