本文整理匯總了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();
}
}
};
}