Java 类com.intellij.psi.search.scope.packageSet.CustomScopesProviderEx 实例源码

项目:intellij-ce-playground    文件:ScopesOrderDialog.java   
private void fillList() {
  DefaultListModel model = new DefaultListModel();
  model.removeAllElements();

  final List<String> scopes = new ArrayList<String>();
  for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
    for (final NamedScope scope : holder.getScopes()) {
      if (!(scope instanceof NonProjectFilesScope)) {
        scopes.add(scope.getName());
      }
    }
  }
  scopes.remove(CustomScopesProviderEx.getAllScope().getName());
  Collections.sort(scopes, new ScopeOrderComparator(myInspectionProfile));
  for (String scopeName : scopes) {
    model.addElement(scopeName);
  }
  myOptionsList.setModel(model);
  myOptionsList.setSelectedIndex(0);
}
项目:tools-idea    文件:AddScopeAction.java   
private List<String> getAvailableScopes(Project project, List<Descriptor> descriptors) {
  final ArrayList<NamedScope> scopes = new ArrayList<NamedScope>();
  for (NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(project)) {
    Collections.addAll(scopes, holder.getScopes());
  }
  scopes.remove(CustomScopesProviderEx.getAllScope());

  CustomScopesProviderEx.filterNoSettingsScopes(project, scopes);

  final Set<NamedScope> used = new HashSet<NamedScope>();
  for (Descriptor descriptor : descriptors) {
    final List<ScopeToolState> nonDefaultTools = getSelectedProfile().getNonDefaultTools(descriptor.getKey().toString(), project);
    if (nonDefaultTools != null) {
      for (ScopeToolState state : nonDefaultTools) {
        used.add(state.getScope(project));
      }
    }
  }
  scopes.removeAll(used);

  final List<String> availableScopes = new ArrayList<String>();
  for (NamedScope scope : scopes) {
    availableScopes.add(scope.getName());
  }
  return availableScopes;
}
项目:consulo    文件:ScopesOrderDialog.java   
private void fillList() {
  DefaultListModel model = new DefaultListModel();
  model.removeAllElements();

  final List<String> scopes = new ArrayList<String>();
  for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
    for (final NamedScope scope : holder.getScopes()) {
      if (!(scope instanceof NonProjectFilesScope)) {
        scopes.add(scope.getName());
      }
    }
  }
  scopes.remove(CustomScopesProviderEx.getAllScope().getName());
  Collections.sort(scopes, new ScopeOrderComparator(myInspectionProfile));
  for (String scopeName : scopes) {
    model.addElement(scopeName);
  }
  myOptionsList.setModel(model);
  myOptionsList.setSelectedIndex(0);
}
项目:intellij-ce-playground    文件:ScopesChooser.java   
@NotNull
@Override
public DefaultActionGroup createPopupActionGroup(final JComponent component) {
  final DefaultActionGroup group = new DefaultActionGroup();

  final List<NamedScope> predefinedScopes = new ArrayList<NamedScope>();
  final List<NamedScope> customScopes = new ArrayList<NamedScope>();
  for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
    Collections.addAll(customScopes, holder.getEditableScopes());
    predefinedScopes.addAll(holder.getPredefinedScopes());
  }
  predefinedScopes.remove(CustomScopesProviderEx.getAllScope());
  for (NamedScope predefinedScope : predefinedScopes) {
    if (predefinedScope instanceof NonProjectFilesScope) {
      predefinedScopes.remove(predefinedScope);
      break;
    }
  }

  fillActionGroup(group, predefinedScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames);
  group.addSeparator();
  fillActionGroup(group, customScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames);

  group.addSeparator();
  group.add(new DumbAwareAction("Edit Scopes Order...") {
    @Override
    public void actionPerformed(final AnActionEvent e) {
      final ScopesOrderDialog dlg = new ScopesOrderDialog(component, myInspectionProfile, myProject);
      if (dlg.showAndGet()) {
        onScopesOrderChanged();
      }
    }
  });

  return group;
}
项目:consulo    文件:ScopesChooser.java   
@Nonnull
@Override
public DefaultActionGroup createPopupActionGroup(final JComponent component) {
  final DefaultActionGroup group = new DefaultActionGroup();

  final List<NamedScope> predefinedScopes = new ArrayList<NamedScope>();
  final List<NamedScope> customScopes = new ArrayList<NamedScope>();
  for (final NamedScopesHolder holder : NamedScopesHolder.getAllNamedScopeHolders(myProject)) {
    Collections.addAll(customScopes, holder.getEditableScopes());
    predefinedScopes.addAll(holder.getPredefinedScopes());
  }
  predefinedScopes.remove(CustomScopesProviderEx.getAllScope());
  for (NamedScope predefinedScope : predefinedScopes) {
    if (predefinedScope instanceof NonProjectFilesScope) {
      predefinedScopes.remove(predefinedScope);
      break;
    }
  }

  fillActionGroup(group, predefinedScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames);
  group.addSeparator();
  fillActionGroup(group, customScopes, myDefaultDescriptors, myInspectionProfile, myExcludedScopeNames);

  group.addSeparator();
  group.add(new DumbAwareAction("Edit Scopes Order...") {
    @Override
    public void actionPerformed(final AnActionEvent e) {
      final ScopesOrderDialog dlg = new ScopesOrderDialog(component, myInspectionProfile, myProject);
      if (dlg.showAndGet()) {
        onScopesOrderChanged();
      }
    }
  });

  return group;
}
项目:intellij-ce-playground    文件:ToolsImpl.java   
public ToolsImpl(@NotNull InspectionToolWrapper toolWrapper, @NotNull HighlightDisplayLevel level, boolean enabled, boolean enabledByDefault) {
  myShortName = toolWrapper.getShortName();
  myDefaultState = new ScopeToolState(CustomScopesProviderEx.getAllScope(), toolWrapper, enabledByDefault, level);
  myTools = null;
  myEnabled = enabled;
}
项目:intellij-ce-playground    文件:FileColorConfigurationEditDialog.java   
@Override
protected JComponent createNorthPanel() {
  final List<NamedScope> scopeList = new ArrayList<NamedScope>();
  final Project project = myManager.getProject();
  final NamedScopesHolder[] scopeHolders = NamedScopeManager.getAllNamedScopeHolders(project);
  for (final NamedScopesHolder scopeHolder : scopeHolders) {
    final NamedScope[] scopes = scopeHolder.getScopes();
    Collections.addAll(scopeList, scopes);
  }
  CustomScopesProviderEx.filterNoSettingsScopes(project, scopeList);
  for (final NamedScope scope : scopeList) {
    myScopeNames.put(scope.getName(), scope);
  }

  myScopeComboBox = new JComboBox(ArrayUtil.toStringArray(myScopeNames.keySet()));
  myScopeComboBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      updateCustomButton();
      updateOKButton();
    }
  });

  final JLabel pathLabel = new JLabel("Scope:");
  pathLabel.setDisplayedMnemonic('S');
  pathLabel.setLabelFor(myScopeComboBox);
  final JLabel colorLabel = new JLabel("Color:");

  JPanel result = new JPanel(new GridBagLayout());
  GridBagConstraints gbc = new GridBagConstraints();
  gbc.fill = GridBagConstraints.BOTH;
  gbc.insets = JBUI.insets(5);
  gbc.gridx = 0;
  result.add(pathLabel, gbc);
  result.add(colorLabel, gbc);
  gbc.gridx = 1;
  gbc.weightx = 1;
  result.add(myScopeComboBox, gbc);
  result.add(myColorSelectionComponent, gbc);
  return result;
}
项目:tools-idea    文件:ToolsImpl.java   
public ToolsImpl(@NotNull InspectionToolWrapper toolWrapper, @NotNull HighlightDisplayLevel level, boolean enabled, boolean enabledByDefault) {
  myShortName = toolWrapper.getShortName();
  myEnabled = enabled;
  myDefaultState = new ScopeToolState(CustomScopesProviderEx.getAllScope(), toolWrapper, enabledByDefault, level);
}
项目:tools-idea    文件:FileColorConfigurationEditDialog.java   
@Override
protected JComponent createNorthPanel() {
  final JPanel result = new JPanel();
  result.setLayout(new BoxLayout(result, BoxLayout.Y_AXIS));

  final List<NamedScope> scopeList = new ArrayList<NamedScope>();
  final Project project = myManager.getProject();
  final NamedScopesHolder[] scopeHolders = NamedScopeManager.getAllNamedScopeHolders(project);
  for (final NamedScopesHolder scopeHolder : scopeHolders) {
    final NamedScope[] scopes = scopeHolder.getScopes();
    Collections.addAll(scopeList, scopes);
  }
  CustomScopesProviderEx.filterNoSettingsScopes(project, scopeList);
  for (final NamedScope scope : scopeList) {
    myScopeNames.put(scope.getName(), scope);
  }

  myScopeComboBox = new JComboBox(ArrayUtil.toStringArray(myScopeNames.keySet()));
  myScopeComboBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      updateCustomButton();
      updateOKButton();
    }
  });

  final JPanel pathPanel = new JPanel();
  pathPanel.setLayout(new BorderLayout());

  final JLabel pathLabel = new JLabel("Scope:");
  pathLabel.setDisplayedMnemonic('S');
  pathLabel.setLabelFor(myScopeComboBox);
  pathPanel.add(pathLabel, BorderLayout.WEST);
  pathPanel.add(myScopeComboBox, BorderLayout.CENTER);

  /*
  final JButton newScope = new JButton("Add scope...");
  newScope.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      // TBD: refresh scope list
    }
  });
  pathPanel.add(newScope, BorderLayout.EAST);
  */

  result.add(pathPanel);

  final JPanel colorPanel = new JPanel();
  colorPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
  colorPanel.setLayout(new BoxLayout(colorPanel, BoxLayout.X_AXIS));
  final JLabel colorLabel = new JLabel("Color:");
  colorPanel.add(colorLabel);
  colorPanel.add(myColorSelectionComponent);
  colorPanel.add(Box.createHorizontalGlue());
  result.add(colorPanel);

  return result;
}
项目:consulo    文件:ToolsImpl.java   
public ToolsImpl(@Nonnull InspectionToolWrapper toolWrapper, @Nonnull HighlightDisplayLevel level, boolean enabled, boolean enabledByDefault) {
  this(toolWrapper.getShortName(), new ScopeToolState(CustomScopesProviderEx.getAllScope(), toolWrapper, enabledByDefault, level), null, enabled);
}
项目:consulo    文件:FileColorConfigurationEditDialog.java   
@Override
protected JComponent createNorthPanel() {
  final JPanel result = new JPanel();
  result.setLayout(new BoxLayout(result, BoxLayout.Y_AXIS));

  final List<NamedScope> scopeList = new ArrayList<NamedScope>();
  final Project project = myManager.getProject();
  final NamedScopesHolder[] scopeHolders = NamedScopeManager.getAllNamedScopeHolders(project);
  for (final NamedScopesHolder scopeHolder : scopeHolders) {
    final NamedScope[] scopes = scopeHolder.getScopes();
    Collections.addAll(scopeList, scopes);
  }
  CustomScopesProviderEx.filterNoSettingsScopes(project, scopeList);
  for (final NamedScope scope : scopeList) {
    myScopeNames.put(scope.getName(), scope);
  }

  myScopeComboBox = new JComboBox(ArrayUtil.toStringArray(myScopeNames.keySet()));
  myScopeComboBox.addActionListener(new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent e) {
      updateCustomButton();
      updateOKButton();
    }
  });

  final JPanel pathPanel = new JPanel();
  pathPanel.setLayout(new BorderLayout());

  final JLabel pathLabel = new JLabel("Scope:");
  pathLabel.setDisplayedMnemonic('S');
  pathLabel.setLabelFor(myScopeComboBox);
  pathPanel.add(pathLabel, BorderLayout.WEST);
  pathPanel.add(myScopeComboBox, BorderLayout.CENTER);

  /*
  final JButton newScope = new JButton("Add scope...");
  newScope.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
      // TBD: refresh scope list
    }
  });
  pathPanel.add(newScope, BorderLayout.EAST);
  */

  result.add(pathPanel);

  final JPanel colorPanel = new JPanel();
  colorPanel.setBorder(BorderFactory.createEmptyBorder(5, 0, 5, 0));
  colorPanel.setLayout(new BoxLayout(colorPanel, BoxLayout.X_AXIS));
  final JLabel colorLabel = new JLabel("Color:");
  colorPanel.add(colorLabel);
  colorPanel.add(createColorButtonsPanel(myConfiguration));
  colorPanel.add(Box.createHorizontalGlue());
  result.add(colorPanel);

  return result;
}