Search in sources :

Example 1 with CommonNavigator

use of org.eclipse.ui.navigator.CommonNavigator in project tdi-studio-se by Talend.

the class MetadataGenericContentProvider method addResourceVisitor.

@Override
protected void addResourceVisitor(CommonViewer v) {
    if (v == null) {
        return;
    }
    RepoViewCommonNavigator navigator = null;
    if (v instanceof RepoViewCommonViewer) {
        CommonNavigator commonNavigator = ((RepoViewCommonViewer) v).getCommonNavigator();
        if (commonNavigator instanceof RepoViewCommonNavigator) {
            navigator = ((RepoViewCommonNavigator) commonNavigator);
        }
    }
    if (navigator == null) {
        return;
    }
    if (this.genericNodeVisitor != null) {
        navigator.removeVisitor(this.genericNodeVisitor);
    }
    this.genericNodeVisitor = new GenericNodeDirectChildrenNodeVisitor();
    navigator.addVisitor(this.genericNodeVisitor);
}
Also used : RepoViewCommonNavigator(org.talend.repository.navigator.RepoViewCommonNavigator) CommonNavigator(org.eclipse.ui.navigator.CommonNavigator) RepoViewCommonNavigator(org.talend.repository.navigator.RepoViewCommonNavigator) RepoViewCommonViewer(org.talend.repository.navigator.RepoViewCommonViewer)

Example 2 with CommonNavigator

use of org.eclipse.ui.navigator.CommonNavigator in project translationstudio8 by heartsome.

the class ApplicationWorkbenchWindowAdvisor method setInitLinkEnable.

/**
	 * 当程序第一次运行时(或是重新换了命名空间),设置项目视图的 link with editor 按钮处于选中状态
	 * robert	2013-01-04
	 */
private void setInitLinkEnable() {
    IPreferenceStore store = Activator.getDefault().getPreferenceStore();
    boolean isInitialRun = !store.getBoolean(IPreferenceConstants.INITIAL_RUN);
    if (isInitialRun) {
        IViewPart navigator = getWindowConfigurer().getWindow().getActivePage().findView("net.heartsome.cat.common.ui.navigator.view");
        CommonNavigator commonNavigator = (CommonNavigator) navigator;
        commonNavigator.setLinkingEnabled(true);
        store.setValue(IPreferenceConstants.INITIAL_RUN, true);
    }
}
Also used : CommonNavigator(org.eclipse.ui.navigator.CommonNavigator) IViewPart(org.eclipse.ui.IViewPart) IPreferenceStore(org.eclipse.jface.preference.IPreferenceStore)

Example 3 with CommonNavigator

use of org.eclipse.ui.navigator.CommonNavigator in project linuxtools by eclipse.

the class GcovTest method testGcovSummaryByLaunch.

@Test
public void testGcovSummaryByLaunch() {
    display.syncExec(() -> {
        try {
            CommonNavigator vc = (CommonNavigator) window.getActivePage().showView(ProjectExplorer.VIEW_ID);
            vc.selectReveal(new StructuredSelection(project.getFile(getBinName())));
            Menu menu = new MenuManager().createContextMenu(vc.getCommonViewer().getControl());
            new ProfileContextualLaunchAction(menu);
            for (MenuItem item : menu.getItems()) {
                if (item.getText().endsWith("Profile Code Coverage")) {
                    ((ActionContributionItem) item.getData()).getAction().run();
                    break;
                }
            }
        } catch (PartInitException e1) {
            Assert.fail("Cannot show Project Explorer.");
        }
        try {
            window.getActivePage().showView("org.eclipse.linuxtools.gcov.view");
        } catch (PartInitException e2) {
            Assert.fail("Cannot show GCov View.");
        }
    });
    // Wait for the build job to finish (note: DebugUIPlugin doesn't put launch jobs in a family)
    Job[] jobs = Job.getJobManager().find(null);
    for (Job job : jobs) {
        if (job.getName().contains("Gcov")) {
            try {
                job.join();
            } catch (InterruptedException e) {
            }
            break;
        }
    }
}
Also used : CommonNavigator(org.eclipse.ui.navigator.CommonNavigator) StructuredSelection(org.eclipse.jface.viewers.StructuredSelection) MenuManager(org.eclipse.jface.action.MenuManager) MenuItem(org.eclipse.swt.widgets.MenuItem) Menu(org.eclipse.swt.widgets.Menu) PartInitException(org.eclipse.ui.PartInitException) Job(org.eclipse.core.runtime.jobs.Job) Test(org.junit.Test) AbstractTest(org.eclipse.linuxtools.profiling.tests.AbstractTest)

Example 4 with CommonNavigator

use of org.eclipse.ui.navigator.CommonNavigator in project linuxtools by eclipse.

the class RemoveConnectionCommandHandler method execute.

@Override
public Object execute(ExecutionEvent event) {
    final IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
    if (activePart instanceof CommonNavigator) {
        final CommonViewer viewer = ((CommonNavigator) activePart).getCommonViewer();
        final ITreeSelection selection = (ITreeSelection) viewer.getSelection();
        Stream.of(selection.getPaths()).forEach(p -> DockerConnectionManager.getInstance().removeConnection((IDockerConnection) p.getLastSegment()));
    }
    return null;
}
Also used : CommonNavigator(org.eclipse.ui.navigator.CommonNavigator) ITreeSelection(org.eclipse.jface.viewers.ITreeSelection) IWorkbenchPart(org.eclipse.ui.IWorkbenchPart) CommonViewer(org.eclipse.ui.navigator.CommonViewer) IDockerConnection(org.eclipse.linuxtools.docker.core.IDockerConnection)

Example 5 with CommonNavigator

use of org.eclipse.ui.navigator.CommonNavigator in project tdq-studio-se by Talend.

the class RepositoryNodeHelper method getDQCommonViewer.

public static CommonViewer getDQCommonViewer(boolean open) {
    IViewPart part = null;
    CommonViewer commonViewer = null;
    IWorkbenchWindow activeWorkbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
    if (activeWorkbenchWindow != null) {
        IWorkbenchPage activePage = activeWorkbenchWindow.getActivePage();
        if (activePage != null) {
            part = activePage.findView(DQRESPOSITORYVIEW);
            if (part == null) {
                if (open) {
                    try {
                        part = activePage.showView(DQRESPOSITORYVIEW);
                        // open detail view at the same time
                        IViewPart detailPart = activePage.findView(DQRESPOSITORY_DETAIL_VIEW);
                        if (detailPart == null) {
                            activePage.showView(DQRESPOSITORY_DETAIL_VIEW);
                        }
                    } catch (PartInitException e) {
                        e.printStackTrace();
                    }
                    if (part == null) {
                        return null;
                    }
                } else {
                    return null;
                }
            }
            CommonNavigator dqView = (CommonNavigator) part;
            commonViewer = dqView.getCommonViewer();
        }
    }
    return commonViewer;
}
Also used : IWorkbenchWindow(org.eclipse.ui.IWorkbenchWindow) CommonNavigator(org.eclipse.ui.navigator.CommonNavigator) IViewPart(org.eclipse.ui.IViewPart) CommonViewer(org.eclipse.ui.navigator.CommonViewer) IWorkbenchPage(org.eclipse.ui.IWorkbenchPage) PartInitException(org.eclipse.ui.PartInitException)

Aggregations

CommonNavigator (org.eclipse.ui.navigator.CommonNavigator)20 IViewPart (org.eclipse.ui.IViewPart)9 IWorkbenchPage (org.eclipse.ui.IWorkbenchPage)9 CommonViewer (org.eclipse.ui.navigator.CommonViewer)8 StructuredSelection (org.eclipse.jface.viewers.StructuredSelection)4 IWorkbenchPart (org.eclipse.ui.IWorkbenchPart)4 CoreException (org.eclipse.core.runtime.CoreException)3 IProgressMonitor (org.eclipse.core.runtime.IProgressMonitor)3 UserException (org.eclipse.titan.log.viewer.exceptions.UserException)3 IWorkbenchWindow (org.eclipse.ui.IWorkbenchWindow)3 IOException (java.io.IOException)2 IFile (org.eclipse.core.resources.IFile)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 Job (org.eclipse.core.runtime.jobs.Job)2 IPreferenceStore (org.eclipse.jface.preference.IPreferenceStore)2 ISelection (org.eclipse.jface.viewers.ISelection)2 IStructuredSelection (org.eclipse.jface.viewers.IStructuredSelection)2 ITreeSelection (org.eclipse.jface.viewers.ITreeSelection)2 IDockerConnection (org.eclipse.linuxtools.docker.core.IDockerConnection)2 TechnicalException (org.eclipse.titan.log.viewer.exceptions.TechnicalException)2