org.eclipse.ui.ide.IDE.computeSelectedResources()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(4.2k)|赞(0)|评价(0)|浏览(218)

本文整理了Java中org.eclipse.ui.ide.IDE.computeSelectedResources()方法的一些代码示例,展示了IDE.computeSelectedResources()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。IDE.computeSelectedResources()方法的具体详情如下:
包路径:org.eclipse.ui.ide.IDE
类名称:IDE
方法名:computeSelectedResources

IDE.computeSelectedResources介绍

[英]Extracts and returns the IResources in the given selection or the resource objects they adapts to.
[中]提取并返回给定选择中的IResource或它们适应的资源对象。

代码示例

代码示例来源:origin: org.eclipse/org.eclipse.team.ui

protected boolean checkWorkingSetElements() {
  List allWorkingSetResources = new ArrayList();
  IWorkingSet[] workingSets = getWorkingSets();
  for (int i = 0; i < workingSets.length; i++) {
    IWorkingSet set = workingSets[i];
    allWorkingSetResources.addAll(IDE.computeSelectedResources(new StructuredSelection(set.getElements())));
  }
  getViewer().setCheckedElements(allWorkingSetResources.toArray(new IResource[allWorkingSetResources.size()]));
  return !allWorkingSetResources.isEmpty();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

@Override
protected boolean checkWorkingSetElements() {
  List allWorkingSetResources = new ArrayList();
  IWorkingSet[] workingSets = getWorkingSets();
  for (int i = 0; i < workingSets.length; i++) {
    IWorkingSet set = workingSets[i];
    allWorkingSetResources.addAll(IDE.computeSelectedResources(new StructuredSelection(set.getElements())));
  }
  getViewer().setCheckedElements(allWorkingSetResources.toArray(new IResource[allWorkingSetResources.size()]));
  return !allWorkingSetResources.isEmpty();
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

@Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
  this.workbench = workbench;
  this.selection = currentSelection;
  List selectedResources = IDE.computeSelectedResources(currentSelection);
  if (!selectedResources.isEmpty()) {
    this.selection = new StructuredSelection(selectedResources);
  }
  setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
  setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/importdir_wiz.png"));//$NON-NLS-1$
  setNeedsProgressMonitor(true);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

@Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
  this.selection = currentSelection;
  List selectedResources = IDE.computeSelectedResources(currentSelection);
  if (!selectedResources.isEmpty()) {
    this.selection = new StructuredSelection(selectedResources);
  }
  setWindowTitle(DataTransferMessages.DataTransfer_export);
  setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportzip_wiz.png"));//$NON-NLS-1$
  setNeedsProgressMonitor(true);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

@Override
public void init(IWorkbench workbench, IStructuredSelection currentSelection) {
  this.workbench = workbench;
  this.selection = currentSelection;
  List selectedResources = IDE.computeSelectedResources(currentSelection);
  if (!selectedResources.isEmpty()) {
    this.selection = new StructuredSelection(selectedResources);
  }
  setWindowTitle(DataTransferMessages.DataTransfer_importTitle);
  setDefaultPageImageDescriptor(IDEWorkbenchPlugin
      .getIDEImageDescriptor("wizban/importzip_wiz.png"));//$NON-NLS-1$
  setNeedsProgressMonitor(true);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.ui.ide

@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 = Adapters.adapt(currentEditor.getEditorInput(), IResource.class);
        if (selectedResource != null) {
          selection = new StructuredSelection(selectedResource);
        }
      }
    }
  }
  setWindowTitle(DataTransferMessages.DataTransfer_export);
  setDefaultPageImageDescriptor(IDEWorkbenchPlugin.getIDEImageDescriptor("wizban/exportdir_wiz.png"));//$NON-NLS-1$
  setNeedsProgressMonitor(true);
}

相关文章