當前位置: 首頁>>代碼示例>>Java>>正文


Java IDE.computeSelectedResources方法代碼示例

本文整理匯總了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();
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:26,代碼來源:ADocSpecExportWizard.java

示例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);
        }
      }
    }
  }
}
 
開發者ID:eclipse,項目名稱:triquetrum,代碼行數:23,代碼來源:ExportToMomlWizard.java

示例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);
  }
}
 
開發者ID:eclipse,項目名稱:triquetrum,代碼行數:10,代碼來源:ImportFromMomlWizard.java

示例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);
}
 
開發者ID:OpenSoftwareSolutions,項目名稱:PDFReporter-Studio,代碼行數:34,代碼來源:TemplateExporterWizard.java

示例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();
			}
		}
	};
}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:71,代碼來源:NpmExportWizard.java


注:本文中的org.eclipse.ui.ide.IDE.computeSelectedResources方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。