Java 类org.eclipse.ui.navigator.resources.ProjectExplorer 实例源码

项目:mesfavoris    文件:GotoWorkspaceFolderBookmark.java   
@Override
public boolean gotoBookmark(IWorkbenchWindow window, Bookmark bookmark, IBookmarkLocation bookmarkLocation) {
    if (!(bookmarkLocation instanceof WorkspaceFolderBookmarkLocation)) {
        return false;
    }
    WorkspaceFolderBookmarkLocation workspaceFileBookmarkLocation = (WorkspaceFolderBookmarkLocation) bookmarkLocation;
    IFolder folder = workspaceFileBookmarkLocation.getWorkspaceFolder();
    try {
        ProjectExplorer projectExplorer = (ProjectExplorer) PlatformUI.getWorkbench().getActiveWorkbenchWindow()
                .getActivePage().showView(ProjectExplorer.VIEW_ID);
        projectExplorer.selectReveal(new StructuredSelection(folder));
        return true;
    } catch (PartInitException e) {
        return false;
    }
}
项目:translationstudio8    文件:TabbedPropertySheetTitleProvider.java   
/**
 * Constructor for CommonNavigatorTitleProvider.
 */
public TabbedPropertySheetTitleProvider() {
    super();
    IWorkbenchPart part = PlatformUI.getWorkbench()
            .getActiveWorkbenchWindow().getActivePage().findView(ProjectExplorer.VIEW_ID);

    INavigatorContentService contentService = (INavigatorContentService) part
            .getAdapter(INavigatorContentService.class);

    if (contentService != null) {
        labelProvider = contentService.createCommonLabelProvider();
        descriptionProvider = contentService
                .createCommonDescriptionProvider();
    } else {
        WorkbenchNavigatorPlugin.log(
                "Could not acquire INavigatorContentService from part (\"" //$NON-NLS-1$
                        + part.getTitle() + "\").", null); //$NON-NLS-1$
    }
}
项目:tmxeditor8    文件:TabbedPropertySheetTitleProvider.java   
/**
 * Constructor for CommonNavigatorTitleProvider.
 */
public TabbedPropertySheetTitleProvider() {
    super();
    IWorkbenchPart part = PlatformUI.getWorkbench()
            .getActiveWorkbenchWindow().getActivePage().findView(ProjectExplorer.VIEW_ID);

    INavigatorContentService contentService = (INavigatorContentService) part
            .getAdapter(INavigatorContentService.class);

    if (contentService != null) {
        labelProvider = contentService.createCommonLabelProvider();
        descriptionProvider = contentService
                .createCommonDescriptionProvider();
    } else {
        WorkbenchNavigatorPlugin.log(
                "Could not acquire INavigatorContentService from part (\"" //$NON-NLS-1$
                        + part.getTitle() + "\").", null); //$NON-NLS-1$
    }
}
项目:n4js    文件:GHOLD_101_WorkingSetsTest_PluginUITest.java   
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    waitForIdleState();
    projectExplorer = (ProjectExplorer) showView(ProjectExplorer.VIEW_ID);
    waitForUiThread();
    assertNotNull("Cannot show Project Explorer.", projectExplorer);
    commonViewer = projectExplorer.getCommonViewer();
    assertFalse("Expected projects as top level elements in navigator.", broker.isWorkingSetTopLevel());
    assertNull(
            "Select working set drop down contribution was visible when projects are configured as top level elements.",
            getWorkingSetDropDownContribution());

}
项目:n4js    文件:SelectAllProjectExplorer_PluginUITest.java   
@Override
@Before
public void setUp() throws Exception {
    super.setUp();
    waitForIdleState();
    projectExplorer = (ProjectExplorer) showView(ProjectExplorer.VIEW_ID);
    waitForUiThread();
    assertNotNull("Cannot show Project Explorer.", projectExplorer);
    commonViewer = projectExplorer.getCommonViewer();
    assertFalse("Expected projects as top level elements in navigator.", broker.isWorkingSetTopLevel());
    assertNull(
            "Select working set drop down contribution was visible when projects are configured as top level elements.",
            getWorkingSetDropDownContribution());

    final Multimap<ProjectType, String> typeNamesMapping = HashMultimap.create();

    typeNamesMapping.putAll(LIBRARY, LIBRARY_PROJECTS);
    typeNamesMapping.putAll(TEST, TEST_PROJECTS);
    for (final Entry<ProjectType, Collection<String>> entry : typeNamesMapping.asMap().entrySet()) {
        for (final String projectName : entry.getValue()) {
            createN4JSProject(projectName, entry.getKey());
        }
    }

    // Actually close "Closed*" projects
    closeProject("ClosedL2");
    closeProject("ClosedT2");

    // Wait for workbench to reflect project changes
    waitForIdleState();
    commonViewer.refresh();

    // Disable auto-building, as there is no real code to build involved
    ResourcesPlugin.getWorkspace().getDescription().setAutoBuilding(false);
}
项目:n4js    文件:WorkingSetManagerBrokerImpl.java   
private void asyncRefreshCommonViewer(final ProjectExplorer explorer, final boolean resetInput) {

        // do deferred initialization
        this.getWorkingSetManagers().stream()
                .filter(m -> (m instanceof IDeferredInitializer))
                .map(m -> (IDeferredInitializer) m)
                .filter(m -> m.isInitializationRequired())
                .forEach(m -> {
                    m.lateInit();
                });

        final CommonViewer viewer = explorer.getCommonViewer();
        final Display d = getDisplay();
        if (!d.isDisposed()) {
            if (resetInput) {
                d.asyncExec(() -> {
                    if (!viewer.getTree().isDisposed())
                        viewer.setInput(viewer.getInput());
                });
            } else {
                d.asyncExec(() -> {
                    if (!viewer.getTree().isDisposed())
                        viewer.refresh(true);
                });
            }
        }
    }
项目:Tarski    文件:MarkerFactory.java   
/**
 * This method refresh Project Explorer View when the actions (Mark/Mark All/Delete/Delete All)
 * have been completed.
 *
 */
public static void refreshProjectExp() {
  try {
    ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
    final IViewPart viewPart = PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage()
        .findView("org.eclipse.ui.navigator.ProjectExplorer");
    if (viewPart == null) {
      return;
    }
    ((ProjectExplorer) viewPart).getCommonViewer().refresh();
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
项目:iTrace-Archive    文件:HandlerBindManager.java   
/**
 * Binds all controls in an IWorkbenchPartReference that is
 * an instance of IEditorPartReference to their appropriate
 * gaze handlers if the handler exists.
 * Binds the IWorkbenchPartReference that is an instance of
 * IViewPartReference to the appropriate gaze handler if the
 * handler exists.
 * @param partRef Workbench part from which to get controls.
 */
public static void bind(IWorkbenchPartReference partRef) {
    IWorkbenchPart part = partRef.getPart(true);
    Control control = part.getAdapter(Control.class);
    System.out.println(control);
    //is an EditorPart
    if (control != null) {
        bindControl(partRef, control, false);
    //is a ViewPart
    } else {
        //must be handled on a case to case basis

        //Browser - always look through all controls in the shell for browsers and bind them
        //regardless of the partRef that has become visible
        //not possible to get a Browser control from a partRef
        Shell workbenchShell = partRef.getPage().getWorkbenchWindow().getShell();
        for (Control ctrl : workbenchShell.getChildren()) {
            bind(ctrl); //call recursive helper function to find all browser controls
        }

        //Project Explorer
        if (part.getAdapter(ProjectExplorer.class) != null) {
            ProjectExplorer explorer = part.getAdapter(ProjectExplorer.class);
            //this control is the primary control associated with a ProjectExplorer
            Control viewControl = explorer.getCommonViewer().getControl();
            bindControl(partRef, viewControl, false);
        }
    }
}
项目:iTrace-Archive    文件:HandlerBindManager.java   
/**
 * Unbinds all controls in an IWorkbenchPartReference that is an instance
 * of IEditorPartReference which are currently bound to a gaze handler.
 * Unbinds an IWorkbenchPartReference that is an instance of IViewPartReference
 * which is currently bound to a gaze handler.
 * @param partRef Workbench part from which to get controls.
 */
public static void unbind(IWorkbenchPartReference partRef) {
    IWorkbenchPart part = partRef.getPart(true);
    Control control = part.getAdapter(Control.class);

    //is an EditorPart
    if (control != null) {
        bindControl(partRef, control, true);
    //is a ViewPart
    } else {
        //must be handled on a case to case basis

        //Browser - always look through all controls in the shell for browsers and unbind them
        //regardless of the partRef that has been hidden
        //not possible to get Browser control from a partRef
        Shell workbenchShell = partRef.getPage().getWorkbenchWindow().getShell();
        for (Control ctrl : workbenchShell.getChildren()) {
            unbind(ctrl);
        }

        //Project Explorer
        if (part.getAdapter(ProjectExplorer.class) != null) {
            ProjectExplorer explorer = part.getAdapter(ProjectExplorer.class);
            //this control is the primary control associated with a ProjectExplorer
            Control viewControl = explorer.getCommonViewer().getControl();
            bindControl(partRef, viewControl, true);
        }
    }
}
项目:xtext-gef    文件:StatemachineDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:translationstudio8    文件:TabbedPropertySheetAdapterFactory.java   
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adaptableObject instanceof ProjectExplorer) {
        if (IPropertySheetPage.class == adapterType)
            return new TabbedPropertySheetPage(
                new TabbedPropertySheetProjectExplorerContributor(
                    (CommonNavigator) adaptableObject));
    }
    return null;
}
项目:translationstudio8    文件:WorkingSetsContentProvider.java   
public Object[] getChildren(Object parentElement) {
    if (parentElement instanceof IWorkingSet) {
        IWorkingSet workingSet = (IWorkingSet) parentElement;
        if (workingSet.isAggregateWorkingSet() && projectExplorer != null) {
            switch (projectExplorer.getRootMode()) {
                case ProjectExplorer.WORKING_SETS :
                    return ((IAggregateWorkingSet) workingSet).getComponents();
                case ProjectExplorer.PROJECTS :
                    return getWorkingSetElements(workingSet);
            }
        }
        return getWorkingSetElements(workingSet);
    }
    return NO_CHILDREN;
}
项目:translationstudio8    文件:WorkingSetsContentProvider.java   
private void updateRootMode() {
    if (projectExplorer == null) {
        return;
    }
    if( extensionStateModel.getBooleanProperty(SHOW_TOP_LEVEL_WORKING_SETS) )
        projectExplorer.setRootMode(ProjectExplorer.WORKING_SETS);
    else
        projectExplorer.setRootMode(ProjectExplorer.PROJECTS);
}
项目:WP3    文件:MarkerFactory.java   
/**
 * This method refresh Project Explorer View when the actions (Mark/Mark All/Delete/Delete All)
 * have been completed.
 *
 */
public static void refreshProjectExp() {
  try {
    ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IResource.DEPTH_INFINITE, null);
    final IViewPart viewPart = PlatformUI.getWorkbench().getWorkbenchWindows()[0].getActivePage()
        .findView("org.eclipse.ui.navigator.ProjectExplorer");
    if (viewPart == null) {
      return;
    }
    ((ProjectExplorer) viewPart).getCommonViewer().refresh();
  } catch (final CoreException e) {
    e.printStackTrace();
  }
}
项目:ROADDesigner    文件:SmcDiagramEditor.java   
/**
 * @generated
 */
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:tmxeditor8    文件:TabbedPropertySheetAdapterFactory.java   
public Object getAdapter(Object adaptableObject, Class adapterType) {
    if (adaptableObject instanceof ProjectExplorer) {
        if (IPropertySheetPage.class == adapterType)
            return new TabbedPropertySheetPage(
                new TabbedPropertySheetProjectExplorerContributor(
                    (CommonNavigator) adaptableObject));
    }
    return null;
}
项目:tmxeditor8    文件:WorkingSetsContentProvider.java   
public Object[] getChildren(Object parentElement) {
    if (parentElement instanceof IWorkingSet) {
        IWorkingSet workingSet = (IWorkingSet) parentElement;
        if (workingSet.isAggregateWorkingSet() && projectExplorer != null) {
            switch (projectExplorer.getRootMode()) {
                case ProjectExplorer.WORKING_SETS :
                    return ((IAggregateWorkingSet) workingSet).getComponents();
                case ProjectExplorer.PROJECTS :
                    return getWorkingSetElements(workingSet);
            }
        }
        return getWorkingSetElements(workingSet);
    }
    return NO_CHILDREN;
}
项目:tmxeditor8    文件:WorkingSetsContentProvider.java   
private void updateRootMode() {
    if (projectExplorer == null) {
        return;
    }
    if( extensionStateModel.getBooleanProperty(SHOW_TOP_LEVEL_WORKING_SETS) )
        projectExplorer.setRootMode(ProjectExplorer.WORKING_SETS);
    else
        projectExplorer.setRootMode(ProjectExplorer.PROJECTS);
}
项目:HelloBrazil    文件:Wc2014DiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:simplified-bpmn-example    文件:SimpleBPMNDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:ICSE15_SequenceDiagram_MAVODiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:NECSIS14_ClassDiagramDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:NECSIS14_DatabaseSchemaDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:MIDDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:MIDDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapterGen(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:RelationalDatabase_MAVODiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:RelationalDatabaseDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:IStar_MAVODiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:IStarDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:StateMachineDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:StateMachine_MAVODiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:StateDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:ArmyDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:EconomyDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:ClassDiagramDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:ClassDiagram_MAVODiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:MMINT    文件:Graph_MAVODiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:d-case_editor    文件:DcaseDiagramEditor.java   
/**
 * @generated
 */
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}
项目:eclipse-optimus    文件:TransformationDependencyDiagramEditor.java   
/**
 * @generated
 */
@SuppressWarnings("rawtypes")
public Object getAdapter(Class type) {
    if (type == IShowInTargetList.class) {
        return new IShowInTargetList() {
            public String[] getShowInTargetIds() {
                return new String[] { ProjectExplorer.VIEW_ID };
            }
        };
    }
    return super.getAdapter(type);
}