本文整理汇总了Java中org.eclipse.ui.ide.IDE.computeSelectedResources方法的典型用法代码示例。如果您正苦于以下问题:Java IDE.computeSelectedResources方法的具体用法?Java IDE.computeSelectedResources怎么用?Java IDE.computeSelectedResources使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.ide.IDE
的用法示例。
在下文中一共展示了IDE.computeSelectedResources方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: init
import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
@Override
public void init(IWorkbench targetWorkbench, IStructuredSelection currentSelection) {
this.selection = currentSelection;
List<?> selectedResources = IDE.computeSelectedResources(currentSelection);
if (!selectedResources.isEmpty()) {
this.selection = new StructuredSelection(selectedResources);
}
setWindowTitle("AsciiDoc Specification Export");
setNeedsProgressMonitor(true);
configAdocPage = new SpecConfigAdocPage("Configuration Page");
processAdocPage = new SpecProcessPage("Process Page");
comparePage = new SpecComparePage("Compare Page", "Adoc");
summaryPage = new SpecExportCodeSummaryPage("Summary Page");
configOutputPage = new SpecConfigOutputPage("Configuration Page");
processOutputPage = new SpecProcessPage("Process Page");
taskGenAdoc = new TaskGenerateAdoc(jsDoc2SpecProcessor, resourceSetProvider, n4JSCore, selection,
configAdocPage, processAdocPage);
taskWriteFiles = new TaskWriteFiles(processOutputPage, taskGenAdoc);
addVisibilityListeners();
}
示例2: init
import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
@Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
this.selection = currentSelection;
List<?> selectedResources = IDE.computeSelectedResources(currentSelection);
if (!selectedResources.isEmpty()) {
this.selection = new StructuredSelection(selectedResources);
}
// look it up if current selection (after resource adapting) is empty
if (selection.isEmpty() && workbench.getActiveWorkbenchWindow() != null) {
IWorkbenchPage page = workbench.getActiveWorkbenchWindow().getActivePage();
if (page != null) {
IEditorPart currentEditor = page.getActiveEditor();
if (currentEditor != null) {
Object selectedResource = currentEditor.getEditorInput().getAdapter(IResource.class);
if (selectedResource != null) {
selection = new StructuredSelection(selectedResource);
}
}
}
}
}
示例3: init
import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
@Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
this.selection = currentSelection;
List<?> selectedResources = IDE.computeSelectedResources(currentSelection);
if (!selectedResources.isEmpty()) {
this.selection = new StructuredSelection(selectedResources);
}
}
示例4: init
import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
/**
* Initialize the selection of the wizard, by searching an IFile in the selected element
* in the Project Explorer or in the actually opened and focused editor
*
* @param workbench
* @param currentSelection the element actually selected
*/
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
this.selection = currentSelection;
@SuppressWarnings("rawtypes")
List selectedResources = IDE.computeSelectedResources(currentSelection);
if (!selectedResources.isEmpty()) {
this.selection = new StructuredSelection(selectedResources);
}
// look it up if current selection (after resource adapting) is empty
if (selection.isEmpty() && workbench.getActiveWorkbenchWindow() != null) {
IWorkbenchPage page = workbench.getActiveWorkbenchWindow()
.getActivePage();
if (page != null) {
IEditorPart currentEditor = page.getActiveEditor();
if (currentEditor != null) {
Object selectedResource = currentEditor.getEditorInput()
.getAdapter(IResource.class);
if (selectedResource != null) {
selection = new StructuredSelection(selectedResource);
}
}
}
}
setWindowTitle(Messages.TemplateExporterWizard_title);
setNeedsProgressMonitor(false);
}
示例5: init
import org.eclipse.ui.ide.IDE; //导入方法依赖的package包/类
@Override
public void init(IWorkbench targetWorkbench, IStructuredSelection currentSelection) {
// this.selection = currentSelection;
List<?> selectedResources = IDE.computeSelectedResources(currentSelection);
List<IProject> workspaceProjects = Arrays.asList(ResourcesPlugin.getWorkspace().getRoot().getProjects());
// Find all selected projects
Set<IProject> projects = selectedResources.stream()
.filter(m -> m instanceof IResource)
.map(m -> ((IResource) m).getProject())
.filter(p -> p.isOpen()) // only open projects
.collect(Collectors.toSet());
// make the behavior predictable by ordering:
TreeSet<IProject> sortedProjects = Sets
.<IProject> newTreeSet((a, b) -> a.getName()
.compareToIgnoreCase(b.getName()));
sortedProjects.addAll(projects);
// 0) turn into IN4JSProject and give and process further.
// a) find out which projects fulfill the npm-"exportable"-contract
// b) give back a list to the user what to export,
// c) disable things not fullfilling the contract.
// d) take choosing from the list and pass to exporter in non-ui package.
// 0)
List<IN4JSEclipseProject> rawN4jsProjects = Lists.newArrayList();
iP2in4jsP = HashBiMap.create();
for (IProject iProject : workspaceProjects) {
IN4JSEclipseProject mappedIn4jsProject = map2In4js(iProject);
if (mappedIn4jsProject != null) {
rawN4jsProjects.add(mappedIn4jsProject);
iP2in4jsP.put(iProject, mappedIn4jsProject);
}
}
// filter out Non-N4JS-projects from initial selection.
sortedProjects.retainAll(iP2in4jsP.keySet());
// filter out all non-N4JS-projects from the workspace projects.
ArrayList<IProject> filteredWorkspaceProjects = new ArrayList<>(workspaceProjects);
filteredWorkspaceProjects.retainAll(iP2in4jsP.keySet());
setWindowTitle("N4JS to npm Export");
setNeedsProgressMonitor(true);
Map<IProject, Boolean> selectedProjects = new HashMap<>();
// Add all workspace projects to list, default selection value is false
filteredWorkspaceProjects.forEach(project -> selectedProjects.put(project, false));
// Override selection value for all initially selected projects
sortedProjects.forEach(project -> selectedProjects.put(project, true));
// exportPage = new ExportSelectionPage("Export Page", rawN4jsProjects, labelProvider);
exportPage = new ExportSelectionPage("Export Page", selectedProjects);
if (runTools())
toolRunnerPage = new NpmToolRunnerPage("npm Execution Page");
comparePage = new PackageJsonComparePage("Compare package.json Page");
pageListener = new IPageChangedListener() {
@Override
public void pageChanged(PageChangedEvent event) {
if (event.getSelectedPage() == comparePage) {
udpatePackagJasonComparison();
}
}
};
}