本文整理汇总了Java中org.eclipse.ui.navigator.resources.ProjectExplorer类的典型用法代码示例。如果您正苦于以下问题:Java ProjectExplorer类的具体用法?Java ProjectExplorer怎么用?Java ProjectExplorer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ProjectExplorer类属于org.eclipse.ui.navigator.resources包,在下文中一共展示了ProjectExplorer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: gotoBookmark
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
@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;
}
}
示例2: TabbedPropertySheetTitleProvider
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
/**
* 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$
}
}
示例3: setUp
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
@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());
}
示例4: setUp
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
@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);
}
示例5: asyncRefreshCommonViewer
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
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);
});
}
}
}
示例6: refreshProjectExp
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
/**
* 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();
}
}
示例7: bind
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
/**
* 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);
}
}
}
示例8: unbind
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
/**
* 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);
}
}
}
示例9: getAdapter
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
/**
* @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);
}
示例10: getAdapter
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
public Object getAdapter(Object adaptableObject, Class adapterType) {
if (adaptableObject instanceof ProjectExplorer) {
if (IPropertySheetPage.class == adapterType)
return new TabbedPropertySheetPage(
new TabbedPropertySheetProjectExplorerContributor(
(CommonNavigator) adaptableObject));
}
return null;
}
示例11: getChildren
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
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;
}
示例12: updateRootMode
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
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);
}
示例13: getAdapter
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
/**
* @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);
}
示例14: getAdapterGen
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
/**
* @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);
}
示例15: getAdapter
import org.eclipse.ui.navigator.resources.ProjectExplorer; //导入依赖的package包/类
/**
* @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);
}