Search in sources :

Example 1 with ModulesView

use of org.talend.librariesmanager.ui.views.ModulesView 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)

Aggregations

ArrayList (java.util.ArrayList)1 Point (org.eclipse.draw2d.geometry.Point)1 IViewPart (org.eclipse.ui.IViewPart)1 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)1 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)1 PartInitException (org.eclipse.ui.PartInitException)1 ILibrariesService (org.talend.core.model.general.ILibrariesService)1 Problem (org.talend.core.model.process.Problem)1 ModulesView (org.talend.librariesmanager.ui.views.ModulesView)1