use of org.eclipse.ui.IViewPart in project tdi-studio-se by Talend.
the class ComponentSettings method switchToCurComponentSettingsView.
public static void switchToCurComponentSettingsView() {
IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
IViewPart view = page.findView(ComponentSettingsView.ID);
if (view == null) {
// don't do anything. before it made the view appear for nothing even in other product like DQ.
return;
}
if (view != null && view instanceof ComponentSettingsView) {
ComponentSettingsView settingView = (ComponentSettingsView) view;
Element element = settingView.getElement();
if (element != null) {
settingView.cleanDisplay();
settingView.setElement(element);
}
}
List<ComponentSettingsView> otherViews = JobTemplateViewsAndProcessUtil.getInstance().getAllViews();
if (otherViews == null || otherViews.isEmpty()) {
return;
}
for (ComponentSettingsView v : otherViews) {
if (v.getParent() != null && !v.getParent().isDisposed()) {
Element elem = v.getElement();
if (elem != null) {
v.cleanDisplay();
v.setElement(elem);
}
}
}
}
use of org.eclipse.ui.IViewPart in project tdi-studio-se by Talend.
the class AbstractMultiPageTalendEditor method changeContextsViewStatus.
private void changeContextsViewStatus(boolean flag) {
IWorkbenchPage workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage();
if (workbenchPage != null) {
IViewPart view = workbenchPage.findView(ContextsView.CTX_ID_DESIGNER);
if (view != null) {
ContextsView contextsView = (ContextsView) view;
contextsView.getContextViewComposite().setTabEnable(flag);
contextsView.getContextViewComposite().getContextTableComposite().refresh();
}
}
}
use of org.eclipse.ui.IViewPart in project tdi-studio-se by Talend.
the class TalendPaletteHelper method checkAndInitToolBar2.
private static void checkAndInitToolBar2() {
//
IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
if (activeWorkbenchWindow == null || activeWorkbenchWindow.getActivePage() == null) {
return;
}
boolean isTalendEditor = false;
IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
IEditorPart activePart = activePage.getActiveEditor();
if (activePart != null && activePart instanceof AbstractMultiPageTalendEditor) {
isTalendEditor = true;
}
IViewPart paletteViewPart = activePage.findView(PaletteView.ID);
if (paletteViewPart != null) {
// find existing or not, and add it.
IActionBars actionBars = paletteViewPart.getViewSite().getActionBars();
// ShowStandardAction showStandardAction = ShowStandardAction.getInstance();
// updatePaletteActions(actionBars, showStandardAction, isTalendEditor);
//
// ShowFavoriteAction showFavoriteAction = ShowFavoriteAction.getInstance();
// updatePaletteActions(actionBars, showFavoriteAction, isTalendEditor);
//
// if (ShowFavoriteAction.state) {
// showStandardAction.doSetEnable();
// }
OpenPaletteFilterAction openPaletteFilterAction = OpenPaletteFilterAction.getInstance();
updatePaletteActions(actionBars, openPaletteFilterAction, isTalendEditor);
actionBars.updateActionBars();
}
}
use of org.eclipse.ui.IViewPart in project tdi-studio-se by Talend.
the class SubjobContainerPart method showModules.
private void showModules(Node node) {
ILibrariesService moduleService = CorePlugin.getDefault().getLibrariesService();
if (moduleService == null) {
return;
}
List<Problem> problems = moduleService.getProblems(node, node);
List<Problem> mproblems = new ArrayList<Problem>();
List<String> modulesName = new ArrayList<String>();
String componentName = null;
String moduleStr = "Module_";
for (Problem pro : problems) {
if (pro.getStatus() == ProblemStatus.ERROR && pro.getKey() != null && pro.getKey().startsWith(moduleStr)) {
mproblems.add(pro);
}
}
if (mproblems.isEmpty()) {
return;
}
for (Problem pro : mproblems) {
if (componentName == null) {
componentName = pro.getComponentName();
}
String key = pro.getKey();
if (key.contains(moduleStr)) {
int first = key.indexOf(moduleStr);
String keydes = key.substring(first + moduleStr.length());
modulesName.add(keydes);
}
}
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
final IWorkbenchPage page = window.getActivePage();
if (page == null) {
return;
}
try {
IViewPart view = page.showView("org.talend.designer.codegen.perlmodule.ModulesView");
if (view instanceof ModulesView) {
((ModulesView) view).selectUninstalledItem(componentName, modulesName);
}
} catch (PartInitException e) {
ExceptionHandler.process(e);
}
}
use of org.eclipse.ui.IViewPart in project tdi-studio-se by Talend.
the class EditPropertiesAction method doRun.
@Override
protected void doRun() {
ISelection selection = getSelection();
Object obj = ((IStructuredSelection) selection).getFirstElement();
IRepositoryNode node = (IRepositoryNode) obj;
// try {
// ProxyRepositoryFactory.getInstance().initialize();
// } catch (PersistenceException e1) {
// ExceptionHandler.process(e1);
// }
IRepositoryViewObject object = node.getObject();
IPath path = RepositoryNodeUtilities.getPath(node);
String originalName = object.getLabel();
final PropertiesWizard wizard;
if (ERepositoryObjectType.ROUTINES == object.getRepositoryObjectType() || isInstanceofCamelBeans(object.getRepositoryObjectType())) {
wizard = new EditRoutinePropertiesWizard(object, path, true);
} else if (ERepositoryObjectType.PROCESS == object.getRepositoryObjectType()) {
wizard = new EditProcessPropertiesWizard(object, path, true);
} else {
wizard = getPropertiesWizard(object, path);
}
WizardDialog dlg = new WizardDialog(Display.getCurrent().getActiveShell(), wizard);
if (dlg.open() == Window.OK) {
refresh(node);
// refresh the corresponding editor's name
IEditorPart part = getCorrespondingEditor(node);
if (part != null && part instanceof IUIRefresher) {
((IUIRefresher) part).refreshName();
} else {
processRoutineRenameOperation(originalName, node, path);
}
// rename the job launch, for bug 8878
IDesignerCoreService designerCoreService = RepositoryPlugin.getDefault().getDesignerCoreService();
if (designerCoreService != null) {
designerCoreService.renameJobLaunch(node.getObject(), originalName);
// TDI-24863:reset the job problem list if rename the job item
designerCoreService.resetJobProblemList(node.getObject(), originalName);
}
// refresh ...
IViewPart jobSettingView = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().findView(IJobSettingsView.ID);
if (jobSettingView != null && jobSettingView instanceof IJobSettingsView) {
((IJobSettingsView) jobSettingView).refreshCurrentViewTab();
}
if (node.getObjectType() == ERepositoryObjectType.ROUTINES) {
RepositoryManager.syncRoutineAndJoblet(ERepositoryObjectType.ROUTINES);
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
IRunProcessService service = (IRunProcessService) GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
ITalendProcessJavaProject talendProcessJavaProject = service.getTalendProcessJavaProject();
if (talendProcessJavaProject != null) {
talendProcessJavaProject.updateRoutinesPom(true, true);
}
}
}
if (node.getObjectType().getType().equals("SERVICES")) {
//$NON-NLS-1$
ConnectionItem connectionItem = (ConnectionItem) node.getObject().getProperty().getItem();
RepositoryUpdateManager.updateServices(connectionItem);
if (GlobalServiceRegister.getDefault().isServiceRegistered(IESBService.class)) {
IESBService service = (IESBService) GlobalServiceRegister.getDefault().getService(IESBService.class);
if (service != null) {
service.refreshComponentView(connectionItem);
}
}
}
}
}
Aggregations