Search in sources :

Example 91 with IViewPart

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);
            }
        }
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) Element(org.talend.core.model.process.Element) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Example 92 with IViewPart

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();
        }
    }
}
Also used : IViewPart(org.eclipse.ui.IViewPart) ContextsView(org.talend.designer.core.ui.views.contexts.ContextsView) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage)

Example 93 with IViewPart

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();
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) OpenPaletteFilterAction(org.talend.repository.ui.actions.OpenPaletteFilterAction) AbstractMultiPageTalendEditor(org.talend.designer.core.ui.AbstractMultiPageTalendEditor) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) IEditorPart(org.eclipse.ui.IEditorPart) IActionBars(org.eclipse.ui.IActionBars)

Example 94 with IViewPart

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);
    }
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) IViewPart(org.eclipse.ui.IViewPart) ModulesView(org.talend.librariesmanager.ui.views.ModulesView) ILibrariesService(org.talend.core.model.general.ILibrariesService) ArrayList(java.util.ArrayList) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) Problem(org.talend.core.model.process.Problem) PartInitException(org.eclipse.ui.PartInitException) Point(org.eclipse.draw2d.geometry.Point)

Example 95 with IViewPart

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);
                }
            }
        }
    }
}
Also used : IJobSettingsView(org.talend.repository.ui.views.IJobSettingsView) IViewPart(org.eclipse.ui.IViewPart) IRepositoryNode(org.talend.repository.model.IRepositoryNode) IPath(org.eclipse.core.runtime.IPath) EditRoutinePropertiesWizard(org.talend.repository.ui.wizards.routines.EditRoutinePropertiesWizard) ConnectionItem(org.talend.core.model.properties.ConnectionItem) IRunProcessService(org.talend.designer.runprocess.IRunProcessService) IStructuredSelection(org.eclipse.jface.viewers.IStructuredSelection) IEditorPart(org.eclipse.ui.IEditorPart) EditProcessPropertiesWizard(org.talend.metadata.managment.ui.wizard.process.EditProcessPropertiesWizard) ITalendProcessJavaProject(org.talend.core.runtime.process.ITalendProcessJavaProject) EditProcessPropertiesWizard(org.talend.metadata.managment.ui.wizard.process.EditProcessPropertiesWizard) EditRoutinePropertiesWizard(org.talend.repository.ui.wizards.routines.EditRoutinePropertiesWizard) PropertiesWizard(org.talend.metadata.managment.ui.wizard.PropertiesWizard) IESBService(org.talend.core.IESBService) ISelection(org.eclipse.jface.viewers.ISelection) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IRepositoryViewObject(org.talend.core.model.repository.IRepositoryViewObject) IDesignerCoreService(org.talend.designer.core.IDesignerCoreService) WizardDialog(org.eclipse.jface.wizard.WizardDialog) IUIRefresher(org.talend.core.services.IUIRefresher)

Aggregations

IViewPart (org.eclipse.ui.IViewPart)95 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)52 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)38 IEditorPart (org.eclipse.ui.IEditorPart)31 PartInitException (org.eclipse.ui.PartInitException)25 IViewReference (org.eclipse.ui.IViewReference)23 IFile (org.eclipse.core.resources.IFile)15 ArrayList (java.util.ArrayList)14 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)14 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)14 IEditorInput (org.eclipse.ui.IEditorInput)11 ICubridNode (com.cubrid.common.ui.spi.model.ICubridNode)10 IXliffEditor (net.heartsome.cat.ts.ui.editors.IXliffEditor)10 ITermViewPart (net.heartsome.cat.ts.ui.view.ITermViewPart)10 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)10 Shell (org.eclipse.swt.widgets.Shell)9 IEditorReference (org.eclipse.ui.IEditorReference)9 XLFHandler (net.heartsome.cat.ts.core.file.XLFHandler)8 XLIFFEditorImplWithNatTable (net.heartsome.cat.ts.ui.xliffeditor.nattable.editor.XLIFFEditorImplWithNatTable)8 IProject (org.eclipse.core.resources.IProject)8