use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class PackageSetChooserCombo method createModel.
protected NamedScope[] createModel() {
final Collection<NamedScope> model = new ArrayList<>();
final DependencyValidationManager manager = DependencyValidationManager.getInstance(myProject);
model.addAll(Arrays.asList(manager.getScopes()));
for (PackageSet unnamedScope : manager.getUnnamedScopes().values()) {
model.add(new NamedScope.UnnamedScope(unnamedScope));
}
model.remove(DefaultScopesProvider.getInstance(myProject).getProblemsScope());
return model.toArray(new NamedScope[model.size()]);
}
use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class ScopeConfigurable method setDisplayName.
@Override
public void setDisplayName(final String name) {
if (Comparing.strEqual(myScope.getName(), name)) {
return;
}
final PackageSet packageSet = myScope.getValue();
myScope = new NamedScope(name, packageSet != null ? packageSet.createCopy() : null);
}
use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class ScopeConfigurable method reset.
@Override
public void reset() {
mySharedCheckbox.setSelected(myShareScope);
myPanel.reset(myScope.getValue(), null);
final PackageSet packageSet = myScope.getValue();
myPackageSet = packageSet != null ? packageSet.getText() : null;
}
use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class ColorAndFontOptions method initScopesDescriptors.
private static void initScopesDescriptors(@NotNull List<EditorSchemeAttributeDescriptor> descriptions, @NotNull MyColorScheme scheme) {
Set<Pair<NamedScope, NamedScopesHolder>> namedScopes = new THashSet<>(new TObjectHashingStrategy<Pair<NamedScope, NamedScopesHolder>>() {
@Override
public int computeHashCode(@NotNull final Pair<NamedScope, NamedScopesHolder> object) {
return object.getFirst().getName().hashCode();
}
@Override
public boolean equals(@NotNull final Pair<NamedScope, NamedScopesHolder> o1, @NotNull final Pair<NamedScope, NamedScopesHolder> o2) {
return o1.getFirst().getName().equals(o2.getFirst().getName());
}
});
Project[] projects = ProjectManager.getInstance().getOpenProjects();
for (Project project : projects) {
DependencyValidationManagerImpl validationManager = (DependencyValidationManagerImpl) DependencyValidationManager.getInstance(project);
List<Pair<NamedScope, NamedScopesHolder>> cachedScopes = validationManager.getScopeBasedHighlightingCachedScopes();
namedScopes.addAll(cachedScopes);
}
List<Pair<NamedScope, NamedScopesHolder>> list = new ArrayList<>(namedScopes);
Collections.sort(list, (o1, o2) -> o1.getFirst().getName().compareToIgnoreCase(o2.getFirst().getName()));
for (Pair<NamedScope, NamedScopesHolder> pair : list) {
NamedScope namedScope = pair.getFirst();
String name = namedScope.getName();
TextAttributesKey textAttributesKey = ScopeAttributesUtil.getScopeTextAttributeKey(name);
if (scheme.getAttributes(textAttributesKey) == null) {
scheme.setAttributes(textAttributesKey, new TextAttributes());
}
NamedScopesHolder holder = pair.getSecond();
PackageSet value = namedScope.getValue();
String toolTip = holder.getDisplayName() + (value == null ? "" : ": " + value.getText());
addSchemedDescription(descriptions, name, SCOPES_GROUP, textAttributesKey, scheme, holder.getIcon(), toolTip);
}
}
use of com.intellij.psi.search.scope.packageSet.PackageSet in project intellij-community by JetBrains.
the class ScopePaneSelectInTarget method isSubIdSelectable.
@Override
public boolean isSubIdSelectable(@NotNull String subId, @NotNull SelectInContext context) {
PsiFileSystemItem file = getContextPsiFile(context);
if (!(file instanceof PsiFile))
return false;
final NamedScope scope = NamedScopesHolder.getScope(myProject, subId);
PackageSet packageSet = scope != null ? scope.getValue() : null;
if (packageSet == null)
return false;
NamedScopesHolder holder = NamedScopesHolder.getHolder(myProject, subId, DependencyValidationManager.getInstance(myProject));
return packageSet.contains((PsiFile) file, holder);
}
Aggregations