-120.SNAPSHOT\r
+122.SNAPSHOT\r
libraryLicense(name: "Netty", libraryName: "Netty", version: "3.3.1", license: "Apache 2.0", url: "http://netty.io", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
libraryLicense(name: "Kryo", libraryName: "Kryo", version: "1.04", license: "New BSD License", url: "http://code.google.com/p/kryo/", licenseUrl: "http://www.opensource.org/licenses/bsd-license.php")
libraryLicense(name: "Snappy-Java", libraryName: "Snappy-Java", version: "1.0.4.1", license: "Apache 2.0", url: "http://code.google.com/p/snappy-java/", licenseUrl: "http://www.apache.org/licenses/LICENSE-2.0")
-libraryLicense(name: "cucumber-jvm", libraryName: "Cucumber-JVM", version: "1.0.11", license: "MIT License", url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
+libraryLicense(name: "Cucumber-JVM", libraryName: "cucumber-jvm", version: "1.0.11", license: "MIT License", url: "https://github.com/cucumber/cucumber-jvm/", licenseUrl: "http://www.opensource.org/licenses/mit-license.html")
jetbrainsLibrary("JPS")
jetbrainsLibrary("Maven Embedder")
jetbrainsLibrary("tcServiceMessages")
}
if (!AFTER_DOT.accepts(element)) {
- new CollectionsUtilityMethodsProvider(parameters.getPosition(),
- parameters.getExpectedType(),
- parameters.getDefaultType(), result)
- .addCompletions(parameters.getParameters().getInvocationCount() > 1 || StringUtil.isNotEmpty(matcher.getPrefix()));
+ if (parameters.getParameters().getInvocationCount() <= 1) {
+ new CollectionsUtilityMethodsProvider(parameters.getPosition(),
+ parameters.getExpectedType(),
+ parameters.getDefaultType(), result)
+ .addCompletions(StringUtil.isNotEmpty(matcher.getPrefix()));
+ }
ClassLiteralGetter.addCompletions(parameters, result, matcher);
final PsiElement position = parameters.getPosition();
static void addExpectedTypeMembers(CompletionParameters parameters, final CompletionResultSet result, PsiElement position) {
for (final ExpectedTypeInfo info : JavaSmartCompletionContributor.getExpectedTypes(parameters)) {
- new JavaMembersGetter(info.getDefaultType(), position).addMembers(parameters, parameters.getInvocationCount() > 1, new Consumer<LookupElement>() {
+ new JavaMembersGetter(info.getDefaultType(), parameters).addMembers(parameters.getInvocationCount() > 1, new Consumer<LookupElement>() {
@Override
public void consume(LookupElement element) {
result.addElement(element);
import com.intellij.codeInsight.lookup.DefaultLookupItemRenderer;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementPresentation;
+import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.psi.PsiClass;
import com.intellij.psi.PsiMember;
import com.intellij.psi.PsiMethod;
@Override
public void handleInsert(InsertionContext context) {
+ FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);
+
(willBeImported() ? myImportInsertion : myQualifiedInsertion).handleInsert(context, this);
}
PsiElement position = params.getPosition();
if (!BasicExpressionCompletionContributor.AFTER_DOT.accepts(position)) {
for (ExpectedTypeInfo info : mergedInfos) {
- new JavaMembersGetter(info.getType(), position).addMembers(params, !quick, consumer);
+ new JavaMembersGetter(info.getType(), params).addMembers(!quick, consumer);
if (!info.getDefaultType().equals(info.getType())) {
- new JavaMembersGetter(info.getDefaultType(), position).addMembers(params, !quick, consumer);
+ new JavaMembersGetter(info.getDefaultType(), params).addMembers(!quick, consumer);
}
}
}
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;\r
import com.intellij.codeInsight.lookup.LookupElement;\r
import com.intellij.codeInsight.lookup.VariableLookupItem;\r
+import com.intellij.featureStatistics.FeatureUsageTracker;\r
import com.intellij.psi.*;\r
import com.intellij.psi.util.PsiTreeUtil;\r
import org.jetbrains.annotations.NotNull;\r
shouldImport |= myOriginalPosition != null && PsiTreeUtil.isAncestor(containingClass, myOriginalPosition, false);\r
\r
if (member instanceof PsiMethod) {\r
- return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new JavaMethodCallElement((PsiMethod)member, shouldImport, false));\r
+ return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new GlobalMethodCallElement((PsiMethod)member, shouldImport, false));\r
}\r
- return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new VariableLookupItem((PsiField)member, shouldImport));\r
+ return AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(new VariableLookupItem((PsiField)member, shouldImport) {\r
+ @Override\r
+ public void handleInsert(InsertionContext context) {\r
+ FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);\r
+\r
+ super.handleInsert(context);\r
+ }\r
+ });\r
}\r
\r
@Override\r
boolean shouldImport) {\r
shouldImport |= myOriginalPosition != null && PsiTreeUtil.isAncestor(containingClass, myOriginalPosition, false);\r
\r
- final JavaMethodCallElement element = new JavaMethodCallElement(overloads.get(0), shouldImport, true);\r
+ final JavaMethodCallElement element = new GlobalMethodCallElement(overloads.get(0), shouldImport, true);\r
element.putUserData(JavaCompletionUtil.ALL_METHODS_ATTRIBUTE, overloads);\r
return element;\r
}\r
+\r
+ private static class GlobalMethodCallElement extends JavaMethodCallElement {\r
+ public GlobalMethodCallElement(PsiMethod member, boolean shouldImport, boolean mergedOverloads) {\r
+ super(member, shouldImport, mergedOverloads);\r
+ }\r
+\r
+ @Override\r
+ public void handleInsert(InsertionContext context) {\r
+ FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);\r
+\r
+ super.handleInsert(context);\r
+ }\r
+ }\r
}\r
import com.intellij.codeInsight.daemon.impl.quickfix.StaticImportMethodFix;
import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Condition;
import com.intellij.psi.*;
+import com.intellij.psi.impl.java.stubs.index.JavaStaticMemberNameIndex;
import com.intellij.psi.search.GlobalSearchScope;
-import com.intellij.psi.search.PsiShortNamesCache;
import com.intellij.util.Consumer;
import com.intellij.util.PairConsumer;
import com.intellij.util.containers.CollectionFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+import java.util.Set;
import static com.intellij.util.containers.CollectionFactory.hashSet;
import static com.intellij.util.containers.ContainerUtil.addIfNotNull;
}
public void processStaticMethodsGlobally(final PrefixMatcher matcher, Consumer<LookupElement> consumer) {
- FeatureUsageTracker.getInstance().triggerFeatureUsed(JavaCompletionFeatures.GLOBAL_MEMBER_NAME);
-
final GlobalSearchScope scope = myPosition.getResolveScope();
- final PsiShortNamesCache namesCache = PsiShortNamesCache.getInstance(myProject);
- String[] methodNames = namesCache.getAllMethodNames();
- for (final String methodName : CompletionUtil.sortMatching(matcher, Arrays.asList(methodNames))) {
- if (matcher.prefixMatches(methodName)) {
- Set<PsiClass> classes = new THashSet<PsiClass>();
- for (final PsiMethod method : namesCache.getMethodsByName(methodName, scope)) {
- if (isStaticallyImportable(method)) {
- final PsiClass containingClass = method.getContainingClass();
- assert containingClass != null : method.getName() + "; " + method + "; " + method.getClass();
-
- if (classes.add(containingClass) && JavaCompletionUtil.isSourceLevelAccessible(myPosition, containingClass, myPackagedContext)) {
- final boolean shouldImport = myStaticImportedClasses.contains(containingClass);
- showHint(shouldImport);
-
+ Collection<String> memberNames = JavaStaticMemberNameIndex.getInstance().getAllKeys(myProject);
+ for (final String memberName : CompletionUtil.sortMatching(matcher, memberNames)) {
+ Set<PsiClass> classes = new THashSet<PsiClass>();
+ for (final PsiMember member : JavaStaticMemberNameIndex.getInstance().getStaticMembers(memberName, myProject, scope)) {
+ if (isStaticallyImportable(member)) {
+ final PsiClass containingClass = member.getContainingClass();
+ assert containingClass != null : member.getName() + "; " + member + "; " + member.getClass();
+
+ if (JavaCompletionUtil.isSourceLevelAccessible(myPosition, containingClass, myPackagedContext)) {
+ final boolean shouldImport = myStaticImportedClasses.contains(containingClass);
+ showHint(shouldImport);
+ if (member instanceof PsiMethod && classes.add(containingClass)) {
final PsiMethod[] allMethods = containingClass.getAllMethods();
final List<PsiMethod> overloads = ContainerUtil.findAll(allMethods, new Condition<PsiMethod>() {
@Override
public boolean value(PsiMethod psiMethod) {
- return methodName.equals(psiMethod.getName()) && isStaticallyImportable(psiMethod);
+ return memberName.equals(psiMethod.getName()) && isStaticallyImportable(psiMethod);
}
});
assert !overloads.isEmpty();
if (overloads.size() == 1) {
- assert method == overloads.get(0);
- consumer.consume(createLookupElement(method, containingClass, shouldImport));
+ assert member == overloads.get(0);
+ consumer.consume(createLookupElement(member, containingClass, shouldImport));
} else {
if (overloads.get(0).getParameterList().getParametersCount() == 0) {
overloads.add(0, overloads.remove(1));
}
consumer.consume(createLookupElement(overloads, containingClass, shouldImport));
}
- }
- }
- }
- }
- }
- String[] fieldNames = namesCache.getAllFieldNames();
- for (final String fieldName : CompletionUtil.sortMatching(matcher, Arrays.asList(fieldNames))) {
- if (matcher.prefixMatches(fieldName)) {
- for (final PsiField field : namesCache.getFieldsByName(fieldName, scope)) {
- if (isStaticallyImportable(field)) {
- final PsiClass containingClass = field.getContainingClass();
- assert containingClass != null : field.getName() + "; " + field + "; " + field.getClass();
-
- if (JavaCompletionUtil.isSourceLevelAccessible(myPosition, containingClass, myPackagedContext)) {
- final boolean shouldImport = myStaticImportedClasses.contains(containingClass);
- showHint(shouldImport);
- consumer.consume(createLookupElement(field, containingClass, shouldImport));
+ } else if (member instanceof PsiField) {
+ consumer.consume(createLookupElement(member, containingClass, shouldImport));
}
}
}
import com.intellij.codeInsight.CodeInsightUtil;
import com.intellij.codeInsight.lookup.LookupManager;
+import com.intellij.featureStatistics.FeatureUsageTracker;
import com.intellij.openapi.actionSystem.IdeActions;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
@Override
public boolean process(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile psiFile) {
+ FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.complete.statement");
+
final Document document = editor.getDocument();
final String textForRollback = document.getText();
try {
*/\r
public class JavaMembersGetter extends MembersGetter {\r
private final PsiType myExpectedType;\r
- private final PsiElement myPlace;\r
\r
- public JavaMembersGetter(@NotNull PsiType expectedType, PsiElement place) {\r
- myPlace = place;\r
+ public JavaMembersGetter(@NotNull PsiType expectedType, CompletionParameters parameters) {\r
+ super(new JavaStaticMemberProcessor(parameters), parameters.getPosition());\r
myExpectedType = JavaCompletionUtil.originalize(expectedType);\r
}\r
\r
- public void addMembers(CompletionParameters parameters, boolean searchInheritors, final Consumer<LookupElement> results) {\r
- final StaticMemberProcessor processor = new JavaStaticMemberProcessor(parameters);\r
- final PsiElement position = parameters.getPosition();\r
+ public void addMembers(boolean searchInheritors, final Consumer<LookupElement> results) {\r
if (myExpectedType instanceof PsiPrimitiveType && PsiType.DOUBLE.isAssignableFrom(myExpectedType)) {\r
- addConstantsFromTargetClass(position, results, searchInheritors, processor);\r
- addConstantsFromReferencedClassesInSwitch(position, results, processor);\r
+ addConstantsFromTargetClass(results, searchInheritors);\r
+ addConstantsFromReferencedClassesInSwitch(results);\r
}\r
\r
- if (position.getParent().getParent() instanceof PsiSwitchLabelStatement) {\r
+ if (myPlace.getParent().getParent() instanceof PsiSwitchLabelStatement) {\r
return; //non-enum values are processed above, enum values will be suggested by reference completion\r
}\r
\r
final PsiClass psiClass = PsiUtil.resolveClassInType(myExpectedType);\r
- processMembers(position, results, psiClass, PsiTreeUtil.getParentOfType(position, PsiAnnotation.class) != null, searchInheritors, processor);\r
+ processMembers(results, psiClass, PsiTreeUtil.getParentOfType(myPlace, PsiAnnotation.class) == null, searchInheritors);\r
}\r
\r
- private void addConstantsFromReferencedClassesInSwitch(PsiElement position, final Consumer<LookupElement> results, final StaticMemberProcessor processor) {\r
- final Set<PsiField> fields = ReferenceExpressionCompletionContributor.findConstantsUsedInSwitch(position);\r
+ private void addConstantsFromReferencedClassesInSwitch(final Consumer<LookupElement> results) {\r
+ final Set<PsiField> fields = ReferenceExpressionCompletionContributor.findConstantsUsedInSwitch(myPlace);\r
final Set<PsiClass> classes = new HashSet<PsiClass>();\r
for (PsiField field : fields) {\r
ContainerUtil.addIfNotNull(classes, field.getContainingClass());\r
}\r
for (PsiClass aClass : classes) {\r
- processMembers(position, new Consumer<LookupElement>() {\r
+ processMembers(new Consumer<LookupElement>() {\r
@Override\r
public void consume(LookupElement element) {\r
//noinspection SuspiciousMethodCalls\r
results.consume(TailTypeDecorator.withTail(element, TailType.CASE_COLON));\r
}\r
}\r
- }, aClass, false, false, processor);\r
+ }, aClass, true, false);\r
}\r
}\r
\r
- private void addConstantsFromTargetClass(PsiElement position,\r
- Consumer<LookupElement> results,\r
- boolean searchInheritors, final StaticMemberProcessor processor) {\r
- PsiElement parent = position.getParent();\r
+ private void addConstantsFromTargetClass(Consumer<LookupElement> results, boolean searchInheritors) {\r
+ PsiElement parent = myPlace.getParent();\r
if (!(parent instanceof PsiReferenceExpression)) {\r
return;\r
}\r
final IElementType op = binaryExpression.getOperationTokenType();\r
if (JavaTokenType.EQEQ == op || JavaTokenType.NE == op) {\r
if (prev == binaryExpression.getROperand()) {\r
- processMembers(position, results, getCalledClass(binaryExpression.getLOperand()), false, searchInheritors,\r
- processor);\r
+ processMembers(results, getCalledClass(binaryExpression.getLOperand()), true, searchInheritors\r
+ );\r
}\r
return;\r
}\r
parent = parent.getParent();\r
}\r
if (parent instanceof PsiExpressionList) {\r
- processMembers(position, results, getCalledClass(parent.getParent()), false, searchInheritors, processor);\r
+ processMembers(results, getCalledClass(parent.getParent()), true, searchInheritors);\r
}\r
}\r
\r
import com.intellij.codeInsight.completion.StaticMemberProcessor;
import com.intellij.codeInsight.lookup.AutoCompletionPolicy;
import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.openapi.util.Condition;
+import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Key;
import com.intellij.psi.*;
import com.intellij.psi.filters.TrueFilter;
+import com.intellij.psi.impl.java.stubs.index.JavaStaticMemberTypeIndex;
import com.intellij.psi.scope.processor.FilterScopeProcessor;
+import com.intellij.psi.search.GlobalSearchScope;
import com.intellij.psi.util.InheritanceUtil;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.util.PsiUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import java.util.ArrayList;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Set;
+import java.util.*;
/**
* @author ik
*/
public abstract class MembersGetter {
public static final Key<Boolean> EXPECTED_TYPE_INHERITOR_MEMBER = Key.create("EXPECTED_TYPE_INHERITOR_MEMBER");
+ private final Set<PsiMember> myImportedStatically = new HashSet<PsiMember>();
+ private final List<PsiClass> myPlaceClasses = new ArrayList<PsiClass>();
+ private final List<PsiMethod> myPlaceMethods = new ArrayList<PsiMethod>();
+ protected final PsiElement myPlace;
- public void processMembers(@NotNull final PsiElement context, final Consumer<LookupElement> results, @Nullable final PsiClass where,
- final boolean acceptMethods, boolean searchInheritors,
- StaticMemberProcessor processor) {
- if (where == null) return;
-
- final List<PsiClass> placeClasses = new ArrayList<PsiClass>();
-
- PsiClass current = PsiTreeUtil.getContextOfType(context, PsiClass.class);
- while (current != null) {
- current = CompletionUtil.getOriginalOrSelf(current);
- placeClasses.add(current);
- current = PsiTreeUtil.getContextOfType(current, PsiClass.class);
- }
-
- final Set<PsiMember> importedStatically = new HashSet<PsiMember>();
+ protected MembersGetter(StaticMemberProcessor processor, @NotNull final PsiElement place) {
+ myPlace = place;
processor.processMembersOfRegisteredClasses(PrefixMatcher.ALWAYS_TRUE, new PairConsumer<PsiMember, PsiClass>() {
@Override
public void consume(PsiMember member, PsiClass psiClass) {
- importedStatically.add(member);
+ myImportedStatically.add(member);
}
});
-
- final Condition<PsiClass> mayProcessMembers = new Condition<PsiClass>() {
- @Override
- public boolean value(PsiClass psiClass) {
- if (psiClass == null) {
- return false;
- }
- psiClass = CompletionUtil.getOriginalOrSelf(psiClass);
- for (PsiClass placeClass : placeClasses) {
- if (InheritanceUtil.isInheritorOrSelf(placeClass, psiClass, true)) {
- return false;
- }
- }
- return true;
+ PsiClass current = PsiTreeUtil.getContextOfType(place, PsiClass.class);
+ while (current != null) {
+ current = CompletionUtil.getOriginalOrSelf(current);
+ myPlaceClasses.add(current);
+ current = PsiTreeUtil.getContextOfType(current, PsiClass.class);
+ }
+
+ PsiMethod eachMethod = PsiTreeUtil.getContextOfType(place, PsiMethod.class);
+ while (eachMethod != null) {
+ eachMethod = CompletionUtil.getOriginalOrSelf(eachMethod);
+ myPlaceMethods.add(eachMethod);
+ eachMethod = PsiTreeUtil.getContextOfType(eachMethod, PsiMethod.class);
+ }
+
+ }
+
+ private boolean mayProcessMembers(@Nullable PsiClass psiClass) {
+ if (psiClass == null) {
+ return false;
+ }
+
+ for (PsiClass placeClass : myPlaceClasses) {
+ if (InheritanceUtil.isInheritorOrSelf(placeClass, psiClass, true)) {
+ return false;
}
- };
-
- final PsiResolveHelper resolveHelper = JavaPsiFacade.getInstance(context.getProject()).getResolveHelper();
+ }
+ return true;
+ }
+
+ public void processMembers(final Consumer<LookupElement> results, @Nullable final PsiClass where,
+ final boolean acceptMethods, final boolean searchInheritors) {
+ if (where == null) return;
+
+ final boolean searchFactoryMethods = searchInheritors &&
+ !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName()) &&
+ !CommonClassNames.JAVA_LANG_STRING.equals(where.getQualifiedName());
+
+ final Project project = myPlace.getProject();
+ final GlobalSearchScope scope = myPlace.getResolveScope();
- final PsiClassType baseType = JavaPsiFacade.getElementFactory(where.getProject()).createType(where);
+ final PsiClassType baseType = JavaPsiFacade.getElementFactory(project).createType(where);
Consumer<PsiType> consumer = new Consumer<PsiType>() {
@Override
public void consume(PsiType psiType) {
PsiClass psiClass = PsiUtil.resolveClassInType(psiType);
- if (mayProcessMembers.value(psiClass)) {
- psiClass = CompletionUtil.getOriginalOrSelf(psiClass);
- for (PsiClass placeClass : placeClasses) {
- if (InheritanceUtil.isInheritorOrSelf(placeClass, psiClass, true)) {
- return;
- }
+ if (psiClass == null) {
+ return;
+ }
+ psiClass = CompletionUtil.getOriginalOrSelf(psiClass);
+ if (mayProcessMembers(psiClass)) {
+ final FilterScopeProcessor<PsiElement> declProcessor = new FilterScopeProcessor<PsiElement>(TrueFilter.INSTANCE);
+ psiClass.processDeclarations(declProcessor, ResolveState.initial(), null, myPlace);
+ doProcessMembers(acceptMethods, results, psiType != baseType, declProcessor.getResults());
+
+ String name = psiClass.getName();
+ if (name != null && searchFactoryMethods) {
+ Collection<PsiMember> factoryMethods = JavaStaticMemberTypeIndex.getInstance().getStaticMembers(name, project, scope);
+ doProcessMembers(acceptMethods, results, psiType != baseType, factoryMethods);
}
- processClassDeclaredMembers(psiClass, context, acceptMethods, results, resolveHelper, importedStatically, psiType != baseType);
}
}
};
consumer.consume(baseType);
if (searchInheritors && !CommonClassNames.JAVA_LANG_OBJECT.equals(where.getQualifiedName())) {
- CodeInsightUtil.processSubTypes(baseType, context, true, PrefixMatcher.ALWAYS_TRUE, consumer);
+ CodeInsightUtil.processSubTypes(baseType, myPlace, true, PrefixMatcher.ALWAYS_TRUE, consumer);
}
}
- private void processClassDeclaredMembers(PsiClass where,
- PsiElement context,
- boolean acceptMethods,
- Consumer<LookupElement> results, final PsiResolveHelper resolveHelper, final Set<PsiMember> importedStatically, boolean isInheritor) {
- final FilterScopeProcessor<PsiElement> processor = new FilterScopeProcessor<PsiElement>(TrueFilter.INSTANCE);
- where.processDeclarations(processor, ResolveState.initial(), null, context);
-
- for (final PsiElement result : processor.getResults()) {
+ private void doProcessMembers(boolean acceptMethods,
+ Consumer<LookupElement> results,
+ boolean isInheritor, Collection<? extends PsiElement> declarations) {
+ for (final PsiElement result : declarations) {
if (result instanceof PsiMember && !(result instanceof PsiClass)) {
final PsiMember member = (PsiMember)result;
- if (JavaCompletionUtil.isInExcludedPackage(member, false) || importedStatically.contains(member)) continue;
- if (member.hasModifierProperty(PsiModifier.STATIC) && resolveHelper.isAccessible(member, context, null)) {
- if (result instanceof PsiField && !member.hasModifierProperty(PsiModifier.FINAL)) continue;
- if (result instanceof PsiMethod && acceptMethods) continue;
- final LookupElement item = result instanceof PsiMethod ? createMethodElement((PsiMethod)result) : createFieldElement((PsiField)result);
- if (item != null) {
- item.putUserData(EXPECTED_TYPE_INHERITOR_MEMBER, isInheritor);
- results.consume(AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(item));
- }
+ if (!member.hasModifierProperty(PsiModifier.STATIC)) continue;
+ if (result instanceof PsiField && !member.hasModifierProperty(PsiModifier.FINAL)) continue;
+ if (result instanceof PsiMethod && (!acceptMethods || myPlaceMethods.contains(result))) continue;
+ if (JavaCompletionUtil.isInExcludedPackage(member, false) || myImportedStatically.contains(member)) continue;
+
+ if (!JavaPsiFacade.getInstance(myPlace.getProject()).getResolveHelper().isAccessible(member, myPlace, null)) {
+ continue;
+ }
+
+ final LookupElement item = result instanceof PsiMethod ? createMethodElement((PsiMethod)result) : createFieldElement((PsiField)result);
+ if (item != null) {
+ item.putUserData(EXPECTED_TYPE_INHERITOR_MEMBER, isInheritor);
+ results.consume(AutoCompletionPolicy.NEVER_AUTOCOMPLETE.applyPolicy(item));
}
}
}
--- /dev/null
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @author max
+ */
+package com.intellij.psi.impl.java.stubs.index;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiMember;
+import com.intellij.psi.impl.search.JavaSourceFilterScope;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.stubs.StringStubIndexExtension;
+import com.intellij.psi.stubs.StubIndexKey;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+public class JavaStaticMemberNameIndex extends StringStubIndexExtension<PsiMember> {
+
+ private static final JavaStaticMemberNameIndex ourInstance = new JavaStaticMemberNameIndex();
+ public static JavaStaticMemberNameIndex getInstance() {
+ return ourInstance;
+ }
+
+ @NotNull
+ @Override
+ public StubIndexKey<String, PsiMember> getKey() {
+ return JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES;
+ }
+
+ public Collection<PsiMember> getStaticMembers(final String name, final Project project, @NotNull final GlobalSearchScope scope) {
+ return super.get(name, project, new JavaSourceFilterScope(scope));
+ }
+
+ @Override
+ public boolean isKeyHighlySelective() {
+ return true;
+ }
+}
\ No newline at end of file
--- /dev/null
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/*
+ * @author max
+ */
+package com.intellij.psi.impl.java.stubs.index;
+
+import com.intellij.openapi.project.Project;
+import com.intellij.psi.PsiMember;
+import com.intellij.psi.impl.search.JavaSourceFilterScope;
+import com.intellij.psi.search.GlobalSearchScope;
+import com.intellij.psi.stubs.StringStubIndexExtension;
+import com.intellij.psi.stubs.StubIndexKey;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.Collection;
+
+public class JavaStaticMemberTypeIndex extends StringStubIndexExtension<PsiMember> {
+
+ private static final JavaStaticMemberTypeIndex ourInstance = new JavaStaticMemberTypeIndex();
+ public static JavaStaticMemberTypeIndex getInstance() {
+ return ourInstance;
+ }
+
+ @NotNull
+ @Override
+ public StubIndexKey<String, PsiMember> getKey() {
+ return JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES;
+ }
+
+ public Collection<PsiMember> getStaticMembers(@NotNull final String shortTypeText, final Project project, @NotNull final GlobalSearchScope scope) {
+ return super.get(shortTypeText, project, new JavaSourceFilterScope(scope));
+ }
+
+ @Override
+ public boolean isKeyHighlySelective() {
+ return true;
+ }
+}
\ No newline at end of file
import com.intellij.lang.LighterAST;
import com.intellij.lang.LighterASTNode;
import com.intellij.openapi.diagnostic.Logger;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.CommonClassNames;
import com.intellij.psi.JavaTokenType;
+import com.intellij.psi.PsiNameHelper;
import com.intellij.psi.impl.java.stubs.JavaStubElementTypes;
import com.intellij.psi.impl.java.stubs.PsiAnnotationStub;
import com.intellij.psi.impl.java.stubs.PsiClassStub;
public void addAnnotation(PsiAnnotationStub annotation) {
myAnnotationStubs.add(annotation);
}
+
+ @NotNull
+ public String getShortTypeText() {
+ if (text == null) return "";
+ String name = PsiNameHelper.getShortClassName(text.getString());
+ return arrayCount > 0 ? name + StringUtil.repeat("[]", arrayCount) : name;
+ }
}
\ No newline at end of file
@Override
public boolean hasModifierProperty(@NotNull String name) {
+ return hasMaskModifierProperty(name, getStub().getModifiersMask());
+ }
+
+ public static boolean hasMaskModifierProperty(String name, int mask) {
int flag = PsiModifierListImpl.NAME_TO_MODIFIER_FLAG_MAP.get(name);
assert flag != 0;
- return (getStub().getModifiersMask() & flag) != 0;
+ return (mask & flag) != 0;
}
@Override
final String name = stub.getName();
if (name != null) {
sink.occurrence(JavaStubIndexKeys.FIELDS, name);
+ if (JavaMethodElementType.isJavaStaticMemberStub(stub)) {
+ sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
+ sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getType(false).getShortTypeText());
+ }
}
}
import com.intellij.lang.LighterASTNode;
import com.intellij.psi.JavaTokenType;
import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiModifier;
+import com.intellij.psi.PsiModifierList;
import com.intellij.psi.impl.cache.RecordUtil;
import com.intellij.psi.impl.cache.TypeInfo;
+import com.intellij.psi.impl.compiled.ClsModifierListImpl;
import com.intellij.psi.impl.java.stubs.impl.PsiMethodStubImpl;
import com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys;
import com.intellij.psi.impl.source.PsiAnnotationMethodImpl;
final String name = stub.getName();
if (name != null) {
sink.occurrence(JavaStubIndexKeys.METHODS, name);
+ if (isJavaStaticMemberStub(stub)) {
+ sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
+ sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, stub.getReturnTypeText(false).getShortTypeText());
+ }
+ }
+ }
+
+ public static boolean isJavaStaticMemberStub(StubElement<?> stub) {
+ StubElement<PsiModifierList> type = stub.findChildStubByType(JavaStubElementTypes.MODIFIER_LIST);
+ if (type instanceof PsiModifierListStub) {
+ return ClsModifierListImpl.hasMaskModifierProperty(PsiModifier.STATIC, ((PsiModifierListStub)type).getModifiersMask());
}
+ return true;
}
}
public static final StubIndexKey<String, PsiReferenceList> SUPER_CLASSES = StubIndexKey.createIndexKey("java.class.extlist");
public static final StubIndexKey<String, PsiField> FIELDS = StubIndexKey.createIndexKey("java.field.name");
public static final StubIndexKey<String, PsiMethod> METHODS = StubIndexKey.createIndexKey("java.method.name");
+ public static final StubIndexKey<String, PsiMember> JVM_STATIC_MEMBERS_NAMES = StubIndexKey.createIndexKey("jvm.static.member.name");
+ public static final StubIndexKey<String, PsiMember> JVM_STATIC_MEMBERS_TYPES = StubIndexKey.createIndexKey("jvm.static.member.type");
public static final StubIndexKey<String,PsiAnonymousClass> ANONYMOUS_BASEREF = StubIndexKey.createIndexKey("java.anonymous.baseref");
public static final StubIndexKey<String,PsiClass> CLASS_SHORT_NAMES = StubIndexKey.createIndexKey("java.class.shortname");
public static final StubIndexKey<Integer,PsiClass> CLASS_FQN = StubIndexKey.createIndexKey("java.class.fqn");
* @author max
*/
public class JavaFileElementType extends ILightStubFileElementType<PsiJavaFileStub> {
- public static final int STUB_VERSION = 12;
+ public static final int STUB_VERSION = 13;
public JavaFileElementType() {
super("java.FILE", JavaLanguage.INSTANCE);
--- /dev/null
+import java.lang.Object;
+
+class Super<T> {
+}
+
+class SubString extends Super<String> {
+ public static SubString createSubString() {}
+}
+class SubInt extends Super<Integer> { }
+class SubGeneric<T> extends Super<T> { }
+class SubRaw extends Super { }
+
+class Factory {
+ public static Object createObject() {}
+ public static <T> Super<T> createExpected() {}
+ public static Super<Integer> createSuperInt() {}
+ public static SubInt createSubInt() {}
+ public static <T> SubGeneric<T> createSubGeneric() {}
+ public static SubRaw createSubRaw() {}
+}
+
+class Intermediate {
+
+ Super<String> s = create<caret>x
+}
+
+
static MyEnum getAvailabilityStatusCode() {
- return get<caret>
+ return getAS<caret>
}
{
Object o;
if (o instanceof Foo) {
- new Object().do<caret>
+ new Object().dofo<caret>
}
}
}
import com.intellij.JavaTestUtil;
import com.intellij.codeInsight.CodeInsightSettings;
-import com.intellij.codeInsight.lookup.*;
-import com.intellij.codeInsight.lookup.impl.LookupImpl;
+import com.intellij.codeInsight.lookup.LookupElementDecorator;
+import com.intellij.codeInsight.lookup.LookupElementPresentation;
+import com.intellij.codeInsight.lookup.LookupItem;
+import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.testFramework.PlatformTestUtil;
import com.intellij.util.ThrowableRunnable;
import org.jetbrains.annotations.NonNls;
@SuppressWarnings({"ALL"})
-public class SecondSmartTypeCompletionTest extends LightCompletionTestCase {
- private static final String BASE_PATH = "/codeInsight/completion/smartType/second";
+public class SecondSmartTypeCompletionTest extends LightFixtureCompletionTestCase {
- public SecondSmartTypeCompletionTest() {
- setType(CompletionType.SMART);
+ @Override
+ protected void complete() {
+ myItems = myFixture.complete(CompletionType.SMART, 2);
}
@Override
- protected String getTestDataPath() {
- return JavaTestUtil.getJavaTestDataPath();
+ protected String getBasePath() {
+ return JavaTestUtil.getRelativeJavaTestDataPath() + "/codeInsight/completion/smartType/second";
}
public void testMethodAsQualifier() throws Throwable { doTest(); }
public void testDontIgnoreToStringInsideIt() throws Throwable { doTest(); }
public void testDontIgnoreToStringInStringBuilders() throws Throwable {
configure();
- assertStringItems("bar.substring", "bar.substring", "bar.toString");
+ myFixture.assertPreferredCompletionItems(0, "bar.substring", "bar.substring", "bar.toString");
}
public void testNoObjectMethodsAsFirstPart() throws Throwable { doTest(); }
public void testNewStaticProblem() throws Throwable { doTest(); }
public void testChainingPerformance() throws Throwable {
- configureByFileNoComplete(BASE_PATH + "/" + getTestName(false) + ".java");
+ myFixture.configureByFile(getTestName(false) + ".java");
PlatformTestUtil.startPerformanceTest(getTestName(false), 1000, new ThrowableRunnable() {
@Override
public void run() throws Exception {
}
private void configure() {
- configureByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+ configureByFile(getTestName(false) + ".java");
}
public void testNoArraysAsListCommonPrefix() throws Throwable {
configure();
- checkResultByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+ checkResultByFile(getTestName(false) + ".java");
assertStringItems("bar()", "foo()");
assertEquals("Arrays.asList(f.bar())", ((LookupItem)((LookupElementDecorator)myItems[0]).getDelegate()).getPresentableText());
assertEquals("Arrays.asList(f.foo())", ((LookupItem)((LookupElementDecorator)myItems[1]).getDelegate()).getPresentableText());
}
public void testRestoreInitialPrefix() throws Throwable {
- configureByFileNoComplete(BASE_PATH + "/" + getTestName(false) + ".java");
- complete(1);
+ myFixture.configureByFile(getTestName(false) + ".java");
+ myFixture.complete(CompletionType.SMART);
assertStringItems("MyEnum.Bar", "MyEnum.Foo");
checkResult();
- complete(1);
+ myFixture.complete(CompletionType.SMART);
assertStringItems("my.getEnum", "MyEnum.Bar", "MyEnum.Foo");
}
private void doAntiTest() throws Exception {
configure();
- assertNull(myItems);
- checkResultByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+ assertEmpty(myItems);
+ checkResultByFile(getTestName(false) + ".java");
}
public void testCastInstanceofedQualifier() throws Throwable { doTest(); }
public void testNoRedundantCasts() throws Throwable {
configure();
- checkResultByFile(BASE_PATH + "/" + getTestName(false) + ".java");
+ checkResultByFile(getTestName(false) + ".java");
assertStringItems("o.gggg", "false", "true");
}
}
private void checkResult() {
- checkResultByFile(BASE_PATH + "/" + getTestName(false) + "-out.java");
+ checkResultByFile(getTestName(false) + "-out.java");
}
public void testSingletonMap() throws Throwable {
checkResult();
}
+ public void testGlobalFactoryMethods() {
+ configure();
+ assertStringItems("createExpected", "createSubGeneric", "createSubRaw", "createSubString");
+ }
+
public void testEmptyMapPresentation() {
configure();
LookupElementPresentation presentation = new LookupElementPresentation();
assertEquals("Collections.emptyMap", presentation.getItemText());
}
- @Override
- protected void complete() {
- complete(2);
- LookupImpl lookup = (LookupImpl)LookupManager.getActiveLookup(myEditor);
- myItems = lookup == null ? null : lookup.getItems().toArray(LookupElement.EMPTY_ARRAY);
- }
-
protected void tearDown() throws Exception {
LookupManager.getInstance(getProject()).hideActiveLookup();
super.tearDown();
myFixture.addClass("package foo; public class FList<T> implements java.util.List<T> { public static <T> FList<T> emptyList() {} }");
configureNoCompletion(getTestName(false) + ".java");
myFixture.complete(CompletionType.SMART, 2);
- assertPreferredItems(0, "local", "local.subList", "locMethod", "locMethod().subList", "emptyList", "singletonList", "unmodifiableList", "emptyList");
- assert 'Collections.emptyList' in lookup.items[4].allLookupStrings
- assert 'FList.emptyList' in lookup.items[7].allLookupStrings
+ assert lookup.items.findIndexOf { 'Collections.emptyList' in it.allLookupStrings } < lookup.items.findIndexOf { 'FList.emptyList' in it.allLookupStrings }
+ assertPreferredItems(0, "local", "local.subList", "locMethod")
}
public void testDispreferGetterInSetterCall() {
import org.jetbrains.annotations.NonNls;\r
\r
import java.util.ArrayList;\r
-import java.util.Arrays;\r
import java.util.Collection;\r
import java.util.Set;\r
\r
}\r
\r
protected void assertStringItems(@NonNls String... items) {\r
- assertEquals(getLookupStrings(new ArrayList<String>()), Arrays.asList(items));\r
+ assertOrderedEquals(getLookupStrings(new ArrayList<String>()), items);\r
}\r
\r
protected void assertContainsItems(final String... expected) {\r
--- /dev/null
+package org.jetbrains.jps.model;
+
+/**
+ * @author nik
+ */
+public interface JpsDummyElement extends JpsElement {
+}
public abstract JpsModel createModel();
- public abstract <P extends JpsElementProperties> JpsModule createModule(@NotNull String name, @NotNull JpsModuleType<P> type, @NotNull P properties);
+ public abstract <P extends JpsElement> JpsModule createModule(@NotNull String name, @NotNull JpsModuleType<P> type, @NotNull P properties);
public abstract <P extends JpsElementProperties> JpsTypedLibrary<P> createLibrary(@NotNull String name, @NotNull JpsLibraryType<P> type, @NotNull P properties);
@NotNull
public abstract JpsElementReference<JpsGlobal> createGlobalReference();
+
+ @NotNull
+ public abstract JpsDummyElement createDummyElement();
+
+ @NotNull
+ public abstract <P> JpsSimpleElement<P> createSimpleElement(@NotNull P properties);
}
/**
* @author nik
*/
-public interface JpsElementTypeWithDefaultProperties<P extends JpsElementProperties> {
+public interface JpsElementTypeWithDefaultProperties<P> {
@NotNull
P createDefaultProperties();
}
public interface JpsProject extends JpsCompositeElement, JpsReferenceableElement<JpsProject> {
@NotNull
- <P extends JpsElementProperties, ModuleType extends JpsModuleType<P> & JpsElementTypeWithDefaultProperties<P>>
+ <P extends JpsElement, ModuleType extends JpsModuleType<P> & JpsElementTypeWithDefaultProperties<P>>
JpsModule addModule(@NotNull String name, @NotNull ModuleType moduleType);
void addModule(@NotNull JpsModule module);
/**
* @author nik
*/
-public interface SimpleJpsElement<P extends JpsElementProperties> extends JpsElement {
+public interface JpsSimpleElement<P> extends JpsElement {
@NotNull
P getProperties();
void setRootElement(@NotNull JpsCompositePackagingElement rootElement);
+ boolean isBuildOnMake();
+
@NotNull
@Override
JpsArtifactReference createReference();
+
+ void setBuildOnMake(boolean buildOnMake);
}
package org.jetbrains.jps.model.java;
import org.jetbrains.annotations.NotNull;
-import org.jetbrains.jps.model.DummyJpsElementProperties;
+import org.jetbrains.jps.model.JpsDummyElement;
+import org.jetbrains.jps.model.JpsElementFactory;
import org.jetbrains.jps.model.JpsElementTypeWithDefaultProperties;
import org.jetbrains.jps.model.module.JpsModuleType;
/**
* @author nik
*/
-public class JpsJavaModuleType extends JpsModuleType<DummyJpsElementProperties> implements JpsElementTypeWithDefaultProperties<DummyJpsElementProperties> {
+public class JpsJavaModuleType extends JpsModuleType<JpsDummyElement> implements JpsElementTypeWithDefaultProperties<JpsDummyElement> {
public static final JpsJavaModuleType INSTANCE = new JpsJavaModuleType();
@NotNull
@Override
- public DummyJpsElementProperties createDefaultProperties() {
- return DummyJpsElementProperties.INSTANCE;
- }
-
- @Override
- public DummyJpsElementProperties createCopy(DummyJpsElementProperties properties) {
- return DummyJpsElementProperties.INSTANCE;
+ public JpsDummyElement createDefaultProperties() {
+ return JpsElementFactory.getInstance().createDummyElement();
}
}
JpsModuleType<?> getModuleType();
@NotNull
- JpsElementProperties getProperties();
+ JpsElement getProperties();
}
package org.jetbrains.jps.model.module;
-import org.jetbrains.jps.model.JpsElementProperties;
-import org.jetbrains.jps.model.JpsElementType;
+import org.jetbrains.jps.model.JpsElement;
+import org.jetbrains.jps.model.JpsElementChildRole;
/**
* @author nik
*/
-public abstract class JpsModuleType<P extends JpsElementProperties> extends JpsElementType<P> {
+public abstract class JpsModuleType<P extends JpsElement> {
+ private final JpsElementChildRole<P> myPropertiesRole = new JpsElementChildRole<P>();
+ public final JpsElementChildRole<P> getPropertiesRole() {
+ return myPropertiesRole;
+ }
}
ROOT_ELEMENT_CHILD_ROLE = JpsElementChildRoleBase.create("root element");
private static final JpsTypedDataRole<JpsArtifactType> TYPED_DATA_ROLE = new JpsTypedDataRole<JpsArtifactType>();
private String myOutputPath;
+ private boolean myBuildOnMake;
+
public JpsArtifactImpl(@NotNull String name, @NotNull JpsCompositePackagingElement rootElement, @NotNull JpsArtifactType type) {
super(name);
public void setRootElement(@NotNull JpsCompositePackagingElement rootElement) {
myContainer.setChild(ROOT_ELEMENT_CHILD_ROLE, rootElement);
}
+
+ @Override
+ public boolean isBuildOnMake() {
+ return myBuildOnMake;
+ }
+
+ @Override
+ public void setBuildOnMake(boolean buildOnMake) {
+ if (myBuildOnMake != buildOnMake) {
+ myBuildOnMake = buildOnMake;
+ fireElementChanged();
+ }
+ }
}
--- /dev/null
+package org.jetbrains.jps.model.impl;
+
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.jps.model.JpsDummyElement;
+
+/**
+ * @author nik
+ */
+public class JpsDummyElementImpl extends JpsElementBase<JpsDummyElementImpl> implements JpsDummyElement {
+ @NotNull
+ @Override
+ public JpsDummyElementImpl createCopy() {
+ return new JpsDummyElementImpl();
+ }
+
+ @Override
+ public void applyChanges(@NotNull JpsDummyElementImpl modified) {
+ }
+}
}
@Override
- public <P extends JpsElementProperties> JpsModule createModule(@NotNull String name, @NotNull JpsModuleType<P> type, @NotNull P properties) {
- return new JpsModuleImpl(type, name, properties);
+ public <P extends JpsElement> JpsModule createModule(@NotNull String name, @NotNull JpsModuleType<P> type, @NotNull P properties) {
+ return new JpsModuleImpl<P>(type, name, properties);
}
public JpsElementReference<JpsGlobal> createGlobalReference() {
return new JpsGlobalElementReference();
}
+
+ @NotNull
+ @Override
+ public JpsDummyElement createDummyElement() {
+ return new JpsDummyElementImpl();
+ }
+
+ @NotNull
+ @Override
+ public <P> JpsSimpleElement<P> createSimpleElement(@NotNull P properties) {
+ return new JpsSimpleElementImpl<P>(properties);
+ }
}
public abstract class JpsNamedElementReferenceBase<T extends JpsNamedElement, Self extends JpsNamedElementReferenceBase<T, Self>>
extends JpsCompositeElementBase<Self> implements JpsElementReference<T> {
private static final JpsElementChildRole<JpsElementReference<? extends JpsCompositeElement>> PARENT_REFERENCE_ROLE = JpsElementChildRoleBase.create("parent");
- private final JpsElementCollectionRole<? extends T> myCollectionRole;
+ protected final JpsElementCollectionRole<? extends T> myCollectionRole;
protected final String myElementName;
protected JpsNamedElementReferenceBase(@NotNull JpsElementCollectionRole<? extends T> role,
@NotNull
@Override
public
- <P extends JpsElementProperties, ModuleType extends JpsModuleType<P> & JpsElementTypeWithDefaultProperties<P>>
+ <P extends JpsElement, ModuleType extends JpsModuleType<P> & JpsElementTypeWithDefaultProperties<P>>
JpsModule addModule(@NotNull final String name, @NotNull ModuleType moduleType) {
final JpsElementCollectionImpl<JpsModule> collection = myContainer.getChild(JpsModuleRole.MODULE_COLLECTION_ROLE);
- return collection.addChild(new JpsModuleImpl(moduleType, name, moduleType.createDefaultProperties()));
+ return collection.addChild(new JpsModuleImpl<P>(moduleType, name, moduleType.createDefaultProperties()));
}
@NotNull
/**
* @author nik
*/
-public class SimpleJpsElementImpl<P extends JpsElementProperties> extends JpsElementBase<SimpleJpsElementImpl<P>> implements SimpleJpsElement<P> {
+public class JpsSimpleElementImpl<P> extends JpsElementBase<JpsSimpleElementImpl<P>> implements JpsSimpleElement<P> {
private P myProperties;
- public SimpleJpsElementImpl(P properties) {
+ public JpsSimpleElementImpl(P properties) {
myProperties = properties;
}
- public SimpleJpsElementImpl(SimpleJpsElementImpl<P> original) {
+ public JpsSimpleElementImpl(JpsSimpleElementImpl<P> original) {
myProperties = original.myProperties;
}
@NotNull
@Override
- public SimpleJpsElementImpl<P> createCopy() {
- return new SimpleJpsElementImpl<P>(this);
+ public JpsSimpleElementImpl<P> createCopy() {
+ return new JpsSimpleElementImpl<P>(this);
}
@Override
- public void applyChanges(@NotNull SimpleJpsElementImpl<P> modified) {
+ public void applyChanges(@NotNull JpsSimpleElementImpl<P> modified) {
setProperties(modified.getProperties());
}
}
setProperties(data.getProperties());
}
- public static <T extends JpsElementType<?> & JpsElementTypeWithDefaultProperties<?>> JpsTypedDataImpl<T> createTypedData(T type) {
- return createTypedData(type, type.createDefaultProperties());
- }
-
public static <T extends JpsElementType<?>> JpsTypedDataImpl<T> createTypedData(T type, final JpsElementProperties properties) {
return new JpsTypedDataImpl<T>(type, properties);
}
package org.jetbrains.jps.model.impl;
import org.jetbrains.jps.model.JpsElementProperties;
-import org.jetbrains.jps.model.SimpleJpsElement;
+import org.jetbrains.jps.model.JpsSimpleElement;
/**
* @author nik
*/
-public class SimpleJpsElementRole<P extends JpsElementProperties> extends JpsElementChildRoleBase<SimpleJpsElement<P>> {
+public class SimpleJpsElementRole<P extends JpsElementProperties> extends JpsElementChildRoleBase<JpsSimpleElement<P>> {
public SimpleJpsElementRole(String debugName) {
super(debugName);
}
/**
* @author nik
*/
-public class JpsModuleImpl extends JpsNamedCompositeElementBase<JpsModuleImpl> implements JpsModule {
- private static final JpsTypedDataRole<JpsModuleType<?>> TYPED_DATA_ROLE = new JpsTypedDataRole<JpsModuleType<?>>();
+public class JpsModuleImpl<P extends JpsElement> extends JpsNamedCompositeElementBase<JpsModuleImpl<P>> implements JpsModule {
private static final JpsUrlListRole CONTENT_ROOTS_ROLE = new JpsUrlListRole("content roots");
private static final JpsUrlListRole EXCLUDED_ROOTS_ROLE = new JpsUrlListRole("excluded roots");
- public static final JpsElementChildRole<JpsDependenciesListImpl>
- DEPENDENCIES_LIST_CHILD_ROLE = JpsElementChildRoleBase.create("dependencies");
+ public static final JpsElementChildRole<JpsDependenciesListImpl> DEPENDENCIES_LIST_CHILD_ROLE = JpsElementChildRoleBase.create("dependencies");
+ private final JpsModuleType<P> myModuleType;
private final JpsLibraryCollection myLibraryCollection;
- public <P extends JpsElementProperties> JpsModuleImpl(JpsModuleType<P> type, @NotNull String name, @NotNull P properties) {
+ public JpsModuleImpl(JpsModuleType<P> type, @NotNull String name, @NotNull P properties) {
super(name);
- myContainer.setChild(TYPED_DATA_ROLE, new JpsTypedDataImpl<JpsModuleType<?>>(type, properties));
+ myModuleType = type;
+ myContainer.setChild(myModuleType.getPropertiesRole(), properties);
myContainer.setChild(CONTENT_ROOTS_ROLE);
myContainer.setChild(EXCLUDED_ROOTS_ROLE);
myContainer.setChild(JpsFacetRole.COLLECTION_ROLE);
myContainer.setChild(JpsSdkReferencesTableImpl.ROLE);
}
- private JpsModuleImpl(JpsModuleImpl original) {
+ private JpsModuleImpl(JpsModuleImpl<P> original) {
super(original);
+ myModuleType = original.myModuleType;
myLibraryCollection = new JpsLibraryCollectionImpl(myContainer.getChild(JpsLibraryRole.LIBRARIES_COLLECTION_ROLE));
}
@NotNull
@Override
- public JpsModuleImpl createCopy() {
- return new JpsModuleImpl(this);
+ public JpsModuleImpl<P> createCopy() {
+ return new JpsModuleImpl<P>(this);
}
@Override
@NotNull
- public JpsElementProperties getProperties() {
- return myContainer.getChild(TYPED_DATA_ROLE).getProperties();
+ public P getProperties() {
+ return myContainer.getChild(myModuleType.getPropertiesRole());
}
@NotNull
@Override
public JpsModuleType<?> getModuleType() {
- return myContainer.getChild(TYPED_DATA_ROLE).getType();
+ return myModuleType;
}
}
/**
* @author nik
*/
-public abstract class JpsElementPropertiesSerializer<P extends JpsElementProperties, Type extends JpsElementType<P>> {
+public abstract class JpsElementPropertiesSerializer<P, Type> {
private final String myTypeId;
private final Type myType;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.DummyJpsElementProperties;
-import org.jetbrains.jps.model.JpsElementFactory;
-import org.jetbrains.jps.model.JpsElementProperties;
+import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.java.JpsJavaLibraryType;
import org.jetbrains.jps.model.library.*;
+import org.jetbrains.jps.model.module.JpsModuleReference;
import java.util.*;
public void saveProperties(DummyJpsElementProperties properties, Element element) {
}
};
+ private static final String MODULE_LEVEL = "module";
+ private static final String PROJECT_LEVEL = "project";
+ private static final String APPLICATION_LEVEL = "application";
public static void loadLibraries(Element libraryTableElement, JpsLibraryCollection result) {
for (Element libraryElement : JDOMUtil.getChildren(libraryTableElement, LIBRARY_TAG)) {
}
throw new IllegalArgumentException("unknown type library:" + type);
}
+
+ public static JpsElementReference<? extends JpsCompositeElement> createLibraryTableReference(String level) {
+ JpsElementFactory elementFactory = JpsElementFactory.getInstance();
+ if (level.equals(PROJECT_LEVEL)) {
+ return elementFactory.createProjectReference();
+ }
+ if (level.equals(APPLICATION_LEVEL)) {
+ return elementFactory.createGlobalReference();
+ }
+ for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+ final JpsElementReference<? extends JpsCompositeElement> reference = extension.createLibraryTableReference(level);
+ if (reference != null) {
+ return reference;
+ }
+ }
+ throw new UnsupportedOperationException();
+ }
+
+ public static String getLevelId(JpsElementReference<? extends JpsCompositeElement> reference) {
+ if (reference instanceof JpsModuleReference) {
+ return MODULE_LEVEL;
+ }
+ JpsCompositeElement element = reference.resolve();
+ if (element instanceof JpsProject) {
+ return PROJECT_LEVEL;
+ }
+ else if (element instanceof JpsGlobal) {
+ return APPLICATION_LEVEL;
+ }
+ for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+ String levelId = extension.getLibraryTableLevelId(reference);
+ if (levelId != null) {
+ return levelId;
+ }
+ }
+ return null;
+ }
}
import org.jetbrains.jps.model.JpsCompositeElement;
import org.jetbrains.jps.model.JpsElementReference;
import org.jetbrains.jps.model.JpsProject;
-import org.jetbrains.jps.model.artifact.JpsArtifactType;
import org.jetbrains.jps.model.module.JpsDependencyElement;
import org.jetbrains.jps.model.module.JpsModule;
-import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementLoader;
+import org.jetbrains.jps.model.serialization.artifact.JpsArtifactTypeSerializer;
+import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementSerializer;
import org.jetbrains.jps.model.serialization.facet.JpsModuleExtensionLoader;
import org.jetbrains.jps.service.JpsServiceManager;
return Collections.emptyList();
}
- public List<? extends JpsPackagingElementLoader<?>> getPackagingElementLoaders() {
+ public List<? extends JpsPackagingElementSerializer<?>> getPackagingElementSerializers() {
return Collections.emptyList();
}
- @Nullable
- public JpsArtifactType getArtifactType(@NotNull String typeId) {
- return null;
+ public List<JpsArtifactTypeSerializer> getArtifactTypeSerializers() {
+ return Collections.emptyList();
}
}
import org.jdom.Element;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.JpsElementProperties;
+import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.module.JpsModuleType;
/**
* @author nik
*/
-public abstract class JpsModulePropertiesSerializer<P extends JpsElementProperties> extends
- JpsElementPropertiesSerializer<P, JpsModuleType<P>> {
+public abstract class JpsModulePropertiesSerializer<P extends JpsElement> extends JpsElementPropertiesSerializer<P, JpsModuleType<P>> {
protected JpsModulePropertiesSerializer(JpsModuleType<P> type, String typeId) {
super(type, typeId);
}
private static final String MODULE_LIBRARY_TYPE = "module-library";
private static final String MODULE_TYPE = "module";
private static final String MODULE_NAME_ATTRIBUTE = "module-name";
- private static final String PROJECT_LEVEL = "project";
- private static final String APPLICATION_LEVEL = "application";
private static final String GENERATED_LIBRARY_NAME_PREFIX = "#";
public static void loadRootModel(JpsModule module, Element rootModelComponent, JpsSdkType<?> projectSdkType) {
String name = orderEntry.getAttributeValue(NAME_ATTRIBUTE);
String level = orderEntry.getAttributeValue(LEVEL_ATTRIBUTE);
final JpsLibraryDependency dependency =
- dependenciesList.addLibraryDependency(elementFactory.createLibraryReference(name, createLibraryTableReference(level)));
+ dependenciesList.addLibraryDependency(elementFactory.createLibraryReference(name, JpsLibraryTableSerializer
+ .createLibraryTableReference(level)));
loadModuleDependencyProperties(dependency, orderEntry);
}
else if (MODULE_LIBRARY_TYPE.equals(type)) {
JpsLibrary library = reference.resolve();
String libraryName = library.getName();
JpsLibraryTableSerializer
- .saveLibrary(library, libraryElement, libraryName.startsWith(GENERATED_LIBRARY_NAME_PREFIX) ? null : libraryName);
+ .saveLibrary(library, libraryElement, isGeneratedName(libraryName) ? null : libraryName);
element.addContent(libraryElement);
}
else {
element = createDependencyElement(LIBRARY_TYPE);
saveModuleDependencyProperties(dependency, element);
element.setAttribute(NAME_ATTRIBUTE, reference.getLibraryName());
- element.setAttribute(LEVEL_ATTRIBUTE, getLevelId(parentReference));
+ element.setAttribute(LEVEL_ATTRIBUTE, JpsLibraryTableSerializer.getLevelId(parentReference));
}
rootModelElement.addContent(element);
}
}
}
+ private static boolean isGeneratedName(String libraryName) {
+ return libraryName.startsWith(GENERATED_LIBRARY_NAME_PREFIX);
+ }
+
private static Element createDependencyElement(final String type) {
return new Element(ORDER_ENTRY_TAG).setAttribute(TYPE_ATTRIBUTE, type);
}
extension.saveModuleDependencyProperties(dependency, orderEntry);
}
}
-
- public static JpsElementReference<? extends JpsCompositeElement> createLibraryTableReference(String level) {
- JpsElementFactory elementFactory = JpsElementFactory.getInstance();
- if (level.equals(PROJECT_LEVEL)) {
- return elementFactory.createProjectReference();
- }
- if (level.equals(APPLICATION_LEVEL)) {
- return elementFactory.createGlobalReference();
- }
- for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
- final JpsElementReference<? extends JpsCompositeElement> reference = extension.createLibraryTableReference(level);
- if (reference != null) {
- return reference;
- }
- }
- throw new UnsupportedOperationException();
- }
-
- private static String getLevelId(JpsElementReference<? extends JpsCompositeElement> reference) {
- JpsCompositeElement element = reference.resolve();
- if (element instanceof JpsProject) {
- return PROJECT_LEVEL;
- }
- else if (element instanceof JpsGlobal) {
- return APPLICATION_LEVEL;
- }
- for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
- String levelId = extension.getLibraryTableLevelId(reference);
- if (levelId != null) {
- return levelId;
- }
- }
- return null;
- }
}
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.DummyJpsElementProperties;
-import org.jetbrains.jps.model.JpsElementFactory;
-import org.jetbrains.jps.model.JpsElementProperties;
-import org.jetbrains.jps.model.JpsProject;
+import org.jetbrains.jps.model.*;
import org.jetbrains.jps.model.java.JpsJavaModuleType;
import org.jetbrains.jps.model.library.JpsSdkType;
import org.jetbrains.jps.model.module.JpsModule;
-import org.jetbrains.jps.model.serialization.artifact.JpsArtifactLoader;
+import org.jetbrains.jps.model.serialization.artifact.JpsArtifactSerializer;
import org.jetbrains.jps.model.serialization.facet.JpsFacetLoader;
import java.io.File;
}
private void loadArtifacts(Element artifactManagerComponent) {
- JpsArtifactLoader.loadArtifacts(myProject, artifactManagerComponent);
+ JpsArtifactSerializer.loadArtifacts(myProject, artifactManagerComponent);
}
@Nullable
return expander;
}
- private static <P extends JpsElementProperties> JpsModule createModule(String name, Element moduleRoot, JpsModulePropertiesSerializer<P> loader) {
+ private static <P extends JpsElement> JpsModule createModule(String name, Element moduleRoot, JpsModulePropertiesSerializer<P> loader) {
return JpsElementFactory.getInstance().createModule(name, loader.getType(), loader.loadProperties(moduleRoot));
}
}
}
}
- return new JpsModulePropertiesSerializer<DummyJpsElementProperties>(JpsJavaModuleType.INSTANCE, "JAVA_MODULE") {
+ return new JpsModulePropertiesSerializer<JpsDummyElement>(JpsJavaModuleType.INSTANCE, "JAVA_MODULE") {
@Override
- public DummyJpsElementProperties loadProperties(@Nullable Element moduleRootElement) {
- return DummyJpsElementProperties.INSTANCE;
+ public JpsDummyElement loadProperties(@Nullable Element moduleRootElement) {
+ return JpsElementFactory.getInstance().createDummyElement();
}
};
}
+++ /dev/null
-package org.jetbrains.jps.model.serialization.artifact;
-
-import com.intellij.openapi.util.JDOMUtil;
-import com.intellij.util.xmlb.XmlSerializer;
-import org.jdom.Element;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.jps.model.JpsCompositeElement;
-import org.jetbrains.jps.model.JpsElementFactory;
-import org.jetbrains.jps.model.JpsElementReference;
-import org.jetbrains.jps.model.JpsProject;
-import org.jetbrains.jps.model.artifact.*;
-import org.jetbrains.jps.model.artifact.elements.JpsCompositePackagingElement;
-import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
-import org.jetbrains.jps.model.artifact.elements.JpsPackagingElementFactory;
-import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
-import org.jetbrains.jps.model.serialization.JpsModuleSerializer;
-
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * @author nik
- */
-public class JpsArtifactLoader {
- private static List<? extends JpsPackagingElementLoader<?>> STANDARD_LOADERS = Arrays.asList();
-
- public static void loadArtifacts(@NotNull JpsProject project, @Nullable Element componentElement) {
- JpsArtifactService service = JpsArtifactService.getInstance();
- for (Element artifactElement : JDOMUtil.getChildren(componentElement, "artifact")) {
- ArtifactState state = XmlSerializer.deserialize(artifactElement, ArtifactState.class);
- if (state == null) continue;
- JpsArtifactType artifactType = getArtifactType(state.getArtifactType());
- JpsPackagingElement rootElement = loadPackagingElement(state.getRootElement());
- if (rootElement != null) {
- JpsArtifact artifact = service.addArtifact(project, state.getName(), (JpsCompositePackagingElement)rootElement, artifactType);
- artifact.setOutputPath(state.getOutputPath());
- }
- }
- }
-
- @Nullable
- private static JpsPackagingElement loadPackagingElement(Element element) {
- JpsPackagingElement packagingElement = createPackagingElement(element);
- if (packagingElement instanceof JpsCompositePackagingElement) {
- for (Element childElement : JDOMUtil.getChildren(element, "element")) {
- JpsPackagingElement child = loadPackagingElement(childElement);
- if (child != null) {
- ((JpsCompositePackagingElement)packagingElement).addChild(child);
- }
- }
- }
- return packagingElement;
- }
-
- @Nullable
- private static JpsPackagingElement createPackagingElement(Element element) {
- String typeId = element.getAttributeValue("id");
- JpsPackagingElementFactory factory = JpsPackagingElementFactory.getInstance();
- if (typeId.equals("root")) {
- return factory.createArtifactRoot();
- }
- if (typeId.equals("directory")) {
- return factory.createDirectory(element.getAttributeValue("name"));
- }
- if (typeId.equals("archive")) {
- return factory.createArchive(element.getAttributeValue("name"));
- }
- if (typeId.equals("file-copy")) {
- return factory.createFileCopy(element.getAttributeValue("path"),
- element.getAttributeValue("output-file-name"));
- }
- if (typeId.equals("dir-copy")) {
- return factory.createDirectoryCopy(element.getAttributeValue("path"));
- }
- if (typeId.equals("extracted-dir")) {
- return factory.createExtractedDirectory(element.getAttributeValue("path"),
- element.getAttributeValue("path-in-jar"));
- }
- if (typeId.equals("library")) {
- String level = element.getAttributeValue("level");
- String libraryName = element.getAttributeValue("name");
- String moduleName = element.getAttributeValue("module-name");
- JpsElementReference<? extends JpsCompositeElement> parentReference;
- if (moduleName != null) {
- parentReference = JpsElementFactory.getInstance().createModuleReference(moduleName);
- }
- else {
- parentReference = JpsModuleSerializer.createLibraryTableReference(level);
- }
- return factory.createLibraryElement(JpsElementFactory.getInstance().createLibraryReference(libraryName, parentReference));
- }
- if (typeId.equals("artifact")) {
- return factory.createArtifactOutput(JpsArtifactService.getInstance().createReference(element.getAttributeValue("artifact-name")));
- }
- JpsPackagingElementLoader<?> loader = findElementLoader(typeId);
- if (loader != null) {
- return loader.load(element);
- }
- return null;
- }
-
- private static JpsArtifactType getArtifactType(@Nullable String typeId) {
- if (typeId == null || "plain".equals(typeId)) {
- return DirectoryArtifactType.INSTANCE;
- }
- if (typeId.equals("jar")) {
- return JarArtifactType.INSTANCE;
- }
- for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
- JpsArtifactType type = extension.getArtifactType(typeId);
- if (type != null) {
- return type;
- }
- }
- return DirectoryArtifactType.INSTANCE;
- }
-
- @Nullable
- private static JpsPackagingElementLoader<?> findElementLoader(@NotNull String typeId) {
- for (JpsPackagingElementLoader<?> loader : STANDARD_LOADERS) {
- if (loader.getTypeId().equals(typeId)) {
- return loader;
- }
- }
- for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
- for (JpsPackagingElementLoader<?> loader : extension.getPackagingElementLoaders()) {
- if (loader.getTypeId().equals(typeId)) {
- return loader;
- }
- }
- }
- return null;
- }
-}
--- /dev/null
+package org.jetbrains.jps.model.serialization.artifact;
+
+import com.intellij.openapi.util.JDOMUtil;
+import com.intellij.util.xmlb.SkipDefaultValuesSerializationFilters;
+import com.intellij.util.xmlb.XmlSerializer;
+import org.jdom.Element;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+import org.jetbrains.jps.model.JpsCompositeElement;
+import org.jetbrains.jps.model.JpsElementFactory;
+import org.jetbrains.jps.model.JpsElementReference;
+import org.jetbrains.jps.model.JpsProject;
+import org.jetbrains.jps.model.artifact.*;
+import org.jetbrains.jps.model.artifact.elements.*;
+import org.jetbrains.jps.model.library.JpsLibraryReference;
+import org.jetbrains.jps.model.module.JpsModuleReference;
+import org.jetbrains.jps.model.serialization.JpsLibraryTableSerializer;
+import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
+
+/**
+ * @author nik
+ */
+public class JpsArtifactSerializer {
+ private static JpsPackagingElementSerializer<?>[] STANDARD_SERIALIZERS = {
+ new ArtifactRootElementSerializer(),
+ new DirectoryElementSerializer(),
+ new ArchiveElementSerializer(),
+ new FileCopyElementSerializer(),
+ new DirectoryCopyElementSerializer(),
+ new ExtractedDirectoryElementSerializer(),
+ new LibraryFilesElementSerializer(),
+ new ArtifactOutputElementSerializer()
+ };
+ private static final JpsArtifactTypeSerializer[] STANDARD_TYPE_SERIALIZERS = {
+ new JpsArtifactTypeSerializer("plain", DirectoryArtifactType.INSTANCE),
+ new JpsArtifactTypeSerializer("jar", JarArtifactType.INSTANCE)
+ };
+ private static final String ELEMENT_TAG = "element";
+ private static final String ID_ATTRIBUTE = "id";
+ private static final SkipDefaultValuesSerializationFilters SERIALIZATION_FILTERS = new SkipDefaultValuesSerializationFilters();
+
+
+ public static void loadArtifacts(@NotNull JpsProject project, @Nullable Element componentElement) {
+ JpsArtifactService service = JpsArtifactService.getInstance();
+ for (Element artifactElement : JDOMUtil.getChildren(componentElement, "artifact")) {
+ ArtifactState state = XmlSerializer.deserialize(artifactElement, ArtifactState.class);
+ if (state == null) continue;
+ JpsArtifactType artifactType = getTypeSerializer(state.getArtifactType()).getType();
+ JpsPackagingElement rootElement = loadPackagingElement(state.getRootElement());
+ if (rootElement != null) {
+ JpsArtifact artifact = service.addArtifact(project, state.getName(), (JpsCompositePackagingElement)rootElement, artifactType);
+ artifact.setBuildOnMake(state.isBuildOnMake());
+ artifact.setOutputPath(state.getOutputPath());
+ }
+ }
+ }
+
+ public static void saveArtifact(@NotNull JpsArtifact artifact, Element componentElement) {
+ ArtifactState state = new ArtifactState();
+ state.setName(artifact.getName());
+ state.setBuildOnMake(artifact.isBuildOnMake());
+ state.setOutputPath(artifact.getOutputPath());
+ state.setArtifactType(getTypeSerializer(artifact.getArtifactType()).getTypeId());
+ state.setRootElement(savePackagingElement(artifact.getRootElement()));
+ componentElement.addContent(XmlSerializer.serialize(state, SERIALIZATION_FILTERS));
+ }
+
+ private static <P extends JpsPackagingElement> Element savePackagingElement(P element) {
+ //noinspection unchecked
+ JpsPackagingElementSerializer<P> serializer = findElementSerializer((Class<P>)element.getClass());
+ Element tag = new Element(ELEMENT_TAG).setAttribute(ID_ATTRIBUTE, serializer.getTypeId());
+ serializer.save(element, tag);
+ if (element instanceof JpsCompositePackagingElement) {
+ for (JpsPackagingElement child : ((JpsCompositePackagingElement)element).getChildren()) {
+ tag.addContent(savePackagingElement(child));
+ }
+ }
+ return tag;
+ }
+
+ @Nullable
+ private static JpsPackagingElement loadPackagingElement(Element element) {
+ JpsPackagingElement packagingElement = createPackagingElement(element);
+ if (packagingElement instanceof JpsCompositePackagingElement) {
+ for (Element childElement : JDOMUtil.getChildren(element, ELEMENT_TAG)) {
+ JpsPackagingElement child = loadPackagingElement(childElement);
+ if (child != null) {
+ ((JpsCompositePackagingElement)packagingElement).addChild(child);
+ }
+ }
+ }
+ return packagingElement;
+ }
+
+ @Nullable
+ private static JpsPackagingElement createPackagingElement(Element element) {
+ String typeId = element.getAttributeValue(ID_ATTRIBUTE);
+ JpsPackagingElementSerializer<?> serializer = findElementSerializer(typeId);
+ if (serializer != null) {
+ return serializer.load(element);
+ }
+ return null;
+ }
+
+ @Nullable
+ private static JpsPackagingElementSerializer<?> findElementSerializer(@NotNull String typeId) {
+ for (JpsPackagingElementSerializer<?> serializer : STANDARD_SERIALIZERS) {
+ if (serializer.getTypeId().equals(typeId)) {
+ return serializer;
+ }
+ }
+ for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+ for (JpsPackagingElementSerializer<?> serializer : extension.getPackagingElementSerializers()) {
+ if (serializer.getTypeId().equals(typeId)) {
+ return serializer;
+ }
+ }
+ }
+ return null;
+ }
+
+ @NotNull
+ private static <E extends JpsPackagingElement> JpsPackagingElementSerializer<E> findElementSerializer(@NotNull Class<E> elementClass) {
+ for (JpsPackagingElementSerializer<?> serializer : STANDARD_SERIALIZERS) {
+ if (serializer.getElementClass().isAssignableFrom(elementClass)) {
+ //noinspection unchecked
+ return (JpsPackagingElementSerializer<E>)serializer;
+ }
+ }
+ for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+ for (JpsPackagingElementSerializer<?> serializer : extension.getPackagingElementSerializers()) {
+ if (serializer.getElementClass().isAssignableFrom(elementClass)) {
+ //noinspection unchecked
+ return (JpsPackagingElementSerializer<E>)serializer;
+ }
+ }
+ }
+ throw new IllegalArgumentException("Serializer not found for " + elementClass);
+ }
+
+ private static JpsArtifactTypeSerializer getTypeSerializer(String typeId) {
+ for (JpsArtifactTypeSerializer serializer : STANDARD_TYPE_SERIALIZERS) {
+ if (serializer.getTypeId().equals(typeId)) {
+ return serializer;
+ }
+ }
+ for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+ for (JpsArtifactTypeSerializer serializer : extension.getArtifactTypeSerializers()) {
+ if (serializer.getTypeId().equals(typeId)) {
+ return serializer;
+ }
+ }
+ }
+ return STANDARD_TYPE_SERIALIZERS[0];
+ }
+
+ private static JpsArtifactTypeSerializer getTypeSerializer(JpsArtifactType type) {
+ for (JpsArtifactTypeSerializer serializer : STANDARD_TYPE_SERIALIZERS) {
+ if (serializer.getType().equals(type)) {
+ return serializer;
+ }
+ }
+ for (JpsModelSerializerExtension extension : JpsModelSerializerExtension.getExtensions()) {
+ for (JpsArtifactTypeSerializer serializer : extension.getArtifactTypeSerializers()) {
+ if (serializer.getType().equals(type)) {
+ return serializer;
+ }
+ }
+ }
+ return null;
+ }
+
+ private static class ArtifactRootElementSerializer extends JpsPackagingElementSerializer<JpsArtifactRootElement> {
+ public ArtifactRootElementSerializer() {
+ super("root", JpsArtifactRootElement.class);
+ }
+
+ @Override
+ public JpsArtifactRootElement load(Element element) {
+ return JpsPackagingElementFactory.getInstance().createArtifactRoot();
+ }
+
+ @Override
+ public void save(JpsArtifactRootElement element, Element tag) {
+ }
+ }
+
+ private static class DirectoryElementSerializer extends JpsPackagingElementSerializer<JpsDirectoryPackagingElement> {
+ public DirectoryElementSerializer() {
+ super("directory", JpsDirectoryPackagingElement.class);
+ }
+
+ @Override
+ public JpsDirectoryPackagingElement load(Element element) {
+ return JpsPackagingElementFactory.getInstance().createDirectory(element.getAttributeValue("name"));
+ }
+
+ @Override
+ public void save(JpsDirectoryPackagingElement element, Element tag) {
+ tag.setAttribute("name", element.getDirectoryName());
+ }
+ }
+
+ private static class ArchiveElementSerializer extends JpsPackagingElementSerializer<JpsArchivePackagingElement> {
+ public ArchiveElementSerializer() {
+ super("archive", JpsArchivePackagingElement.class);
+ }
+
+ @Override
+ public JpsArchivePackagingElement load(Element element) {
+ return JpsPackagingElementFactory.getInstance().createArchive(element.getAttributeValue("name"));
+ }
+
+ @Override
+ public void save(JpsArchivePackagingElement element, Element tag) {
+ tag.setAttribute("name", element.getArchiveName());
+ }
+ }
+
+ private static class FileCopyElementSerializer extends JpsPackagingElementSerializer<JpsFileCopyPackagingElement> {
+ public FileCopyElementSerializer() {
+ super("file-copy", JpsFileCopyPackagingElement.class);
+ }
+
+ @Override
+ public JpsFileCopyPackagingElement load(Element element) {
+ return JpsPackagingElementFactory.getInstance().createFileCopy(element.getAttributeValue("path"),
+ element.getAttributeValue("output-file-name"));
+ }
+
+ @Override
+ public void save(JpsFileCopyPackagingElement element, Element tag) {
+ tag.setAttribute("path", element.getFilePath());
+ String outputFileName = element.getRenamedOutputFileName();
+ if (outputFileName != null) {
+ tag.setAttribute("output-path-name", outputFileName);
+ }
+ }
+ }
+
+ private static class DirectoryCopyElementSerializer extends JpsPackagingElementSerializer<JpsDirectoryCopyPackagingElement> {
+ public DirectoryCopyElementSerializer() {
+ super("dir-copy", JpsDirectoryCopyPackagingElement.class);
+ }
+
+ @Override
+ public JpsDirectoryCopyPackagingElement load(Element element) {
+ return JpsPackagingElementFactory.getInstance().createDirectoryCopy(element.getAttributeValue("path"));
+ }
+
+ @Override
+ public void save(JpsDirectoryCopyPackagingElement element, Element tag) {
+ tag.setAttribute("path", element.getDirectoryPath());
+ }
+ }
+
+ private static class ExtractedDirectoryElementSerializer
+ extends JpsPackagingElementSerializer<JpsExtractedDirectoryPackagingElement> {
+ public ExtractedDirectoryElementSerializer() {
+ super("extracted-dir", JpsExtractedDirectoryPackagingElement.class);
+ }
+
+ @Override
+ public JpsExtractedDirectoryPackagingElement load(Element element) {
+ return JpsPackagingElementFactory.getInstance().createExtractedDirectory(element.getAttributeValue("path"),
+ element.getAttributeValue("path-in-jar"));
+ }
+
+ @Override
+ public void save(JpsExtractedDirectoryPackagingElement element, Element tag) {
+ tag.setAttribute("path", element.getFilePath());
+ tag.setAttribute("path-in-jar", element.getPathInJar());
+ }
+ }
+
+ private static class LibraryFilesElementSerializer extends JpsPackagingElementSerializer<JpsLibraryFilesPackagingElement> {
+ public LibraryFilesElementSerializer() {
+ super("library", JpsLibraryFilesPackagingElement.class);
+ }
+
+ @Override
+ public JpsLibraryFilesPackagingElement load(Element element) {
+ String level = element.getAttributeValue("level");
+ String libraryName = element.getAttributeValue("name");
+ String moduleName = element.getAttributeValue("module-name");
+ JpsElementReference<? extends JpsCompositeElement> parentReference;
+ if (moduleName != null) {
+ parentReference = JpsElementFactory.getInstance().createModuleReference(moduleName);
+ }
+ else {
+ parentReference = JpsLibraryTableSerializer.createLibraryTableReference(level);
+ }
+ return JpsPackagingElementFactory.getInstance()
+ .createLibraryElement(JpsElementFactory.getInstance().createLibraryReference(libraryName, parentReference));
+ }
+
+ @Override
+ public void save(JpsLibraryFilesPackagingElement element, Element tag) {
+ JpsLibraryReference reference = element.getLibraryReference();
+ JpsElementReference<? extends JpsCompositeElement> parentReference = reference.getParentReference();
+ tag.setAttribute("level", JpsLibraryTableSerializer.getLevelId(parentReference));
+ tag.setAttribute("name", reference.getLibraryName());
+ if (parentReference instanceof JpsModuleReference) {
+ tag.setAttribute("module-name", ((JpsModuleReference)parentReference).getModuleName());
+ }
+ }
+ }
+
+ private static class ArtifactOutputElementSerializer extends JpsPackagingElementSerializer<JpsArtifactOutputPackagingElement> {
+ public ArtifactOutputElementSerializer() {
+ super("artifact", JpsArtifactOutputPackagingElement.class);
+ }
+
+ @Override
+ public JpsArtifactOutputPackagingElement load(Element element) {
+ return JpsPackagingElementFactory.getInstance()
+ .createArtifactOutput(JpsArtifactService.getInstance().createReference(element.getAttributeValue("artifact-name")));
+ }
+
+ @Override
+ public void save(JpsArtifactOutputPackagingElement element, Element tag) {
+ tag.setAttribute("artifact-name", element.getArtifactReference().getArtifactName());
+ }
+ }
+}
--- /dev/null
+package org.jetbrains.jps.model.serialization.artifact;
+
+import org.jetbrains.jps.model.artifact.JpsArtifactType;
+
+/**
+ * @author nik
+ */
+public class JpsArtifactTypeSerializer {
+ private final String myTypeId;
+ private final JpsArtifactType myType;
+
+ public JpsArtifactTypeSerializer(String typeId, JpsArtifactType type) {
+ myTypeId = typeId;
+ myType = type;
+ }
+
+ public String getTypeId() {
+ return myTypeId;
+ }
+
+ public JpsArtifactType getType() {
+ return myType;
+ }
+}
+++ /dev/null
-package org.jetbrains.jps.model.serialization.artifact;
-
-import org.jdom.Element;
-import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
-
-/**
- * @author nik
- */
-public abstract class JpsPackagingElementLoader<E extends JpsPackagingElement> {
- private final String myTypeId;
-
- protected JpsPackagingElementLoader(String typeId) {
- myTypeId = typeId;
- }
-
- public String getTypeId() {
- return myTypeId;
- }
-
- public abstract E load(Element element);
-}
--- /dev/null
+package org.jetbrains.jps.model.serialization.artifact;
+
+import org.jdom.Element;
+import org.jetbrains.jps.model.artifact.elements.JpsPackagingElement;
+
+/**
+ * @author nik
+ */
+public abstract class JpsPackagingElementSerializer<E extends JpsPackagingElement> {
+ private final String myTypeId;
+ private final Class<? extends E> myElementClass;
+
+ protected JpsPackagingElementSerializer(String typeId, Class<? extends E> elementClass) {
+ myTypeId = typeId;
+ myElementClass = elementClass;
+ }
+
+ public String getTypeId() {
+ return myTypeId;
+ }
+
+ public Class<? extends E> getElementClass() {
+ return myElementClass;
+ }
+
+ public abstract E load(Element element);
+
+ public abstract void save(E element, Element tag);
+}
import org.jetbrains.jps.model.module.JpsModuleReference;
import org.jetbrains.jps.model.serialization.JpsLibraryRootTypeSerializer;
import org.jetbrains.jps.model.serialization.JpsModelSerializerExtension;
-import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementLoader;
+import org.jetbrains.jps.model.serialization.artifact.JpsPackagingElementSerializer;
import java.util.Arrays;
import java.util.List;
}
@Override
- public List<? extends JpsPackagingElementLoader<?>> getPackagingElementLoaders() {
- return Arrays.asList(new JpsModuleOutputPackagingElementLoader(), new JpsTestModuleOutputPackagingElementLoader());
+ public List<? extends JpsPackagingElementSerializer<?>> getPackagingElementSerializers() {
+ return Arrays.asList(new JpsModuleOutputPackagingElementSerializer(), new JpsTestModuleOutputPackagingElementSerializer());
}
private static void loadExplodedDirectoryExtension(JpsModule module, Element rootModelComponent) {
return JpsJavaExtensionService.getInstance();
}
- private static class JpsModuleOutputPackagingElementLoader extends JpsPackagingElementLoader<JpsProductionModuleOutputPackagingElement> {
- private JpsModuleOutputPackagingElementLoader() {
- super("module-output");
+ private static class JpsModuleOutputPackagingElementSerializer
+ extends JpsPackagingElementSerializer<JpsProductionModuleOutputPackagingElement> {
+ private JpsModuleOutputPackagingElementSerializer() {
+ super("module-output", JpsProductionModuleOutputPackagingElement.class);
}
@Override
JpsModuleReference reference = JpsElementFactory.getInstance().createModuleReference(element.getAttributeValue("name"));
return getService().createProductionModuleOutput(reference);
}
+
+ @Override
+ public void save(JpsProductionModuleOutputPackagingElement element, Element tag) {
+ tag.setAttribute("name", element.getModuleReference().getModuleName());
+ }
}
- private static class JpsTestModuleOutputPackagingElementLoader extends JpsPackagingElementLoader<JpsTestModuleOutputPackagingElement> {
- private JpsTestModuleOutputPackagingElementLoader() {
- super("module-test-output");
+ private static class JpsTestModuleOutputPackagingElementSerializer extends JpsPackagingElementSerializer<JpsTestModuleOutputPackagingElement> {
+ private JpsTestModuleOutputPackagingElementSerializer() {
+ super("module-test-output", JpsTestModuleOutputPackagingElement.class);
}
@Override
JpsModuleReference reference = JpsElementFactory.getInstance().createModuleReference(element.getAttributeValue("name"));
return getService().createTestModuleOutput(reference);
}
+
+ @Override
+ public void save(JpsTestModuleOutputPackagingElement element, Element tag) {
+ tag.setAttribute("name", element.getModuleReference().getModuleName());
+ }
}
}
--- /dev/null
+<component name="ArtifactManager">
+ <artifact build-on-make="true" name="dir">
+ <output-path>$PROJECT_DIR$/out/artifacts/dir</output-path>
+ <root id="root">
+ <element id="archive" name="x.jar">
+ <element id="module-output" name="util" />
+ </element>
+ <element id="directory" name="lib">
+ <element id="library" level="module" name="log4j" module-name="util" />
+ <element id="library" level="project" name="junit" />
+ <element id="file-copy" path="$PROJECT_DIR$/main.iml" />
+ <element id="dir-copy" path="$PROJECT_DIR$/lib/junit-anno" />
+ <element id="extracted-dir" path="$PROJECT_DIR$/lib/junit.jar" path-in-jar="/junit/" />
+ </element>
+ </root>
+ </artifact>
+</component>
\ No newline at end of file
--- /dev/null
+<component name="ArtifactManager">
+ <artifact type="jar" name="jar">
+ <output-path>$PROJECT_DIR$/out/artifacts/jar</output-path>
+ <root id="archive" name="jar.jar">
+ <element id="module-output" name="main" />
+ <element id="module-output" name="util" />
+ <element id="artifact" artifact-name="dir" />
+ </root>
+ </artifact>
+</component>
\ No newline at end of file
--- /dev/null
+package org.jetbrains.jps.model.serialization;
+
+import com.intellij.openapi.util.io.FileUtil;
+import com.intellij.testFramework.PlatformTestUtil;
+import org.jdom.Element;
+import org.jetbrains.jps.model.artifact.JpsArtifact;
+import org.jetbrains.jps.model.artifact.JpsArtifactService;
+import org.jetbrains.jps.model.serialization.artifact.JpsArtifactSerializer;
+
+import java.io.File;
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+
+import static org.jetbrains.jps.model.serialization.JpsProjectSerializationTest.SAMPLE_PROJECT_PATH;
+import static org.jetbrains.jps.model.serialization.JpsProjectSerializationTest.getFileInSampleProject;
+
+/**
+ * @author nik
+ */
+public class JpsArtifactSerializationTest extends JpsSerializationTestCase {
+ public void testLoadProject() {
+ loadProject(SAMPLE_PROJECT_PATH);
+ List<JpsArtifact> artifacts = getService().getArtifacts(myModel.getProject());
+ assertEquals(2, artifacts.size());
+ assertEquals("dir", artifacts.get(0).getName());
+ assertEquals("jar", artifacts.get(1).getName());
+ }
+
+ public void testSaveProject() {
+ loadProject(SAMPLE_PROJECT_PATH);
+ File[] artifactFiles = getFileInSampleProject(".idea/artifacts").listFiles();
+ assertNotNull(artifactFiles);
+ for (File file : artifactFiles) {
+ JpsArtifact artifact = getService().createReference(FileUtil.getNameWithoutExtension(file)).asExternal(myModel).resolve();
+ assertNotNull(artifact);
+ doTestSaveArtifact(artifact, file);
+ }
+ }
+
+ private static void doTestSaveArtifact(JpsArtifact artifact, File expectedFile) {
+ try {
+ Element actual = new Element("component").setAttribute("name", "ArtifactManager");
+ JpsArtifactSerializer.saveArtifact(artifact, actual);
+ JpsMacroExpander
+ expander = JpsProjectLoader.createProjectMacroExpander(Collections.<String, String>emptyMap(), getFileInSampleProject(""));
+ Element expected = JpsLoaderBase.loadRootElement(expectedFile, expander);
+ PlatformTestUtil.assertElementsEqual(expected, actual);
+ }
+ catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
+
+ private static JpsArtifactService getService() {
+ return JpsArtifactService.getInstance();
+ }
+}
* @author nik
*/
public class JpsProjectSerializationTest extends JpsSerializationTestCase {
- private static final String SAMPLE_PROJECT_PATH = "/jps/model-serialization/testData/sampleProject";
+ public static final String SAMPLE_PROJECT_PATH = "/jps/model-serialization/testData/sampleProject";
public void testLoadProject() {
loadProject(SAMPLE_PROJECT_PATH);
}
}
- private static File getFileInSampleProject(String moduleFilePath) {
- return new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH + "/" + moduleFilePath));
+ public static File getFileInSampleProject(String relativePath) {
+ return new File(getTestDataFileAbsolutePath(SAMPLE_PROJECT_PATH + "/" + relativePath));
}
public void _testLoadIdeaProject() {
return key.getID();
}
- @Nullable
+ @SuppressWarnings("ConstantConditions")
public T forLanguage(@NotNull Language l) {
T cached = l.getUserData(IN_LANGUAGE_CACHE);
if (cached != null) return cached;
private final Object myStubLock = new Object();
private SoftReference<StubTree> myStub;
protected final PsiManagerEx myManager;
- private volatile Object myTreeElementPointer; // SoftReference/WeakReference to RepositoryTreeElement when has repository id, RepositoryTreeElement otherwise
+ private volatile Object myTreeElementPointer; // SoftReference/WeakReference to ASTNode or a strong reference to a tree if the file is a DummyHolder
public static final Key<Boolean> BUILDING_STUB = new Key<Boolean>("Don't use stubs mark!");
protected PsiFileImpl(@NotNull IElementType elementType, IElementType contentElementType, @NotNull FileViewProvider provider) {
if (builder != null) {
data = builder.buildStubTree(inputData.getFile(), inputData.getContent(), inputData.getProject());
}
- else {
- final LanguageFileType filetype = (LanguageFileType)fileType;
- Language l = filetype.getLanguage();
+ else if (!fileType.isBinary()) {
+ final LanguageFileType languageFileType = (LanguageFileType)fileType;
+ Language l = languageFileType.getLanguage();
final IFileElementType type = LanguageParserDefinitions.INSTANCE.forLanguage(l).getFileNodeType();
PsiFile psi = inputData.getPsiFile();
if (type instanceof IStubFileElementType) {
data = ((IStubFileElementType)type).getBuilder().buildStubTree(psi);
}
- else if (filetype instanceof SubstitutedFileType) {
- SubstitutedFileType substituted = (SubstitutedFileType) filetype;
+ else if (languageFileType instanceof SubstitutedFileType) {
+ SubstitutedFileType substituted = (SubstitutedFileType) languageFileType;
LanguageFileType original = (LanguageFileType)substituted.getOriginalFileType();
final IFileElementType originalType = LanguageParserDefinitions.INSTANCE.forLanguage(original.getLanguage()).getFileNodeType();
- data = ((IStubFileElementType)originalType).getBuilder().buildStubTree(psi);
+ if (originalType instanceof IStubFileElementType) {
+ data = ((IStubFileElementType)originalType).getBuilder().buildStubTree(psi);
+ }
}
}
finally {
import com.intellij.codeInsight.completion.InsertHandler;
import com.intellij.codeInsight.completion.InsertionContext;
+import com.intellij.openapi.util.Iconable;
import com.intellij.psi.PsiNamedElement;
import com.intellij.util.ObjectUtils;
import gnu.trove.THashSet;
return new LookupElementBuilder(ObjectUtils.assertNotNull(element.getName()), element);
}
+ public static LookupElementBuilder createWithIcon(@NotNull PsiNamedElement element) {
+ return create(element).withIcon(element.getIcon(Iconable.ICON_FLAG_CLOSED));
+ }
+
public static LookupElementBuilder create(@NotNull Object lookupObject, @NotNull String lookupString) {
return new LookupElementBuilder(lookupString, lookupObject);
}
* @return target element's documentation (if any)
*/
@Nullable
- String generateDoc(PsiElement element, PsiElement originalElement);
+ String generateDoc(PsiElement element, @Nullable PsiElement originalElement);
@Nullable
PsiElement getDocumentationElementForLookupItem(PsiManager psiManager, Object object, PsiElement element);
import com.intellij.psi.search.scope.packageSet.NamedScopesHolder;
import com.intellij.ui.Colored;
import com.intellij.util.ArrayUtil;
-import org.intellij.lang.annotations.RegExp;
/**
* @author Konstantin Bulenkov
*/
-@Colored(color = NonProjectFilesScope.DEFAULT_COLOR)
+@Colored(color = "ffffe4", darkVariant = "000029")
public class NonProjectFilesScope extends NamedScope {
public static final String NAME = "Non-Project Files";
- @RegExp(prefix = "[0-9a-f]{6}")
- public static final String DEFAULT_COLOR = "ffffe4";
public NonProjectFilesScope() {
super(NAME, new AbstractPackageSet("NonProject") {
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
/**
* @author Konstantin Bulenkov
*/
-@Colored(color = "e7fadb")
+@Colored(color = "e7fadb", darkVariant = "777777")
public class TestsScope extends NamedScope {
public static final String NAME = IdeBundle.message("predefined.scope.tests.name");
public TestsScope() {
return findPrefixStatic(insertedElement, offsetInFile, NOT_JAVA_ID);
}
- protected static String findPrefixDefault(final PsiElement insertedElement, final int offset, @NotNull final ElementPattern trimStart) {
+ public static String findPrefixDefault(final PsiElement insertedElement, final int offset, @NotNull final ElementPattern trimStart) {
String substr = insertedElement.getText().substring(0, offset - insertedElement.getTextRange().getStartOffset());
if (substr.length() == 0 || Character.isWhitespace(substr.charAt(substr.length() - 1))) return "";
@Override
public int newCompletionStarted(int time, boolean repeated) {
CompletionServiceImpl.setCompletionPhase(NoCompletion);
- return time + 1;
+ return repeated ? time + 1 : time;
}
}
import com.intellij.psi.util.PsiUtilCore;
import com.intellij.ui.HintListener;
import com.intellij.ui.LightweightHint;
+import com.intellij.ui.ScreenUtil;
import com.intellij.usageView.UsageViewShortNameLocation;
import com.intellij.usageView.UsageViewTypeLocation;
import com.intellij.util.Alarm;
}
MouseEvent mouseEvent = e.getMouseEvent();
- if (isMouseOverTooltip(mouseEvent.getLocationOnScreen()) || isMouseMovedTowardTooltip(mouseEvent.getLocationOnScreen())) {
+ if (isMouseOverTooltip(mouseEvent.getLocationOnScreen())
+ || ScreenUtil.isMovementTowards(myPrevMouseLocation, mouseEvent.getLocationOnScreen(), getHintBounds())) {
myPrevMouseLocation = mouseEvent.getLocationOnScreen();
return;
}
return bounds != null && bounds.contains(mouseLocationOnScreen);
}
- private boolean isMouseMovedTowardTooltip(@NotNull Point mouseLocationOnScreen) {
- Rectangle bounds = getHintBounds();
- if (bounds == null) {
- return false;
- }
-
- Point prevLocation = myPrevMouseLocation;
- if (prevLocation == null) {
- myPrevMouseLocation = mouseLocationOnScreen;
- return true;
- }
- else if (prevLocation.equals(mouseLocationOnScreen)) {
- return true;
- }
-
- int dx = prevLocation.x - mouseLocationOnScreen.x;
- int dy = prevLocation.y - mouseLocationOnScreen.y;
-
- // Check if the mouse goes out of the control.
- if (dx > 0 && bounds.x >= prevLocation.x) return false;
- if (dx < 0 && bounds.x + bounds.width <= prevLocation.x) return false;
- if (dy > 0 && bounds.y + bounds.height >= prevLocation.y) return false;
- if (dy < 0 && bounds.y <= prevLocation.y) return false;
- if (dx == 0) {
- return (mouseLocationOnScreen.x >= bounds.x && mouseLocationOnScreen.x < bounds.x + bounds.width)
- && (dy > 0 ^ bounds.y > mouseLocationOnScreen.y);
- }
- if (dy == 0) {
- return (mouseLocationOnScreen.y >= bounds.y && mouseLocationOnScreen.y < bounds.y + bounds.height)
- && (dx > 0 ^ bounds.x > mouseLocationOnScreen.x);
- }
-
-
- // Calculate line equation parameters - y = a * x + b
- float a = (float)dy / dx;
- float b = mouseLocationOnScreen.y - a * mouseLocationOnScreen.x;
-
- // Check if crossing point with any tooltip border line is within bounds. Don't bother with floating point inaccuracy here.
-
- // Left border.
- float crossY = a * bounds.x + b;
- if (crossY >= bounds.y && crossY < bounds.y + bounds.height) return true;
-
- // Right border.
- crossY = a * (bounds.x + bounds.width) + b;
- if (crossY >= bounds.y && crossY < bounds.y + bounds.height) return true;
-
- // Top border.
- float crossX = (bounds.y - b) / a;
- if (crossX >= bounds.x && crossX < bounds.x + bounds.width) return true;
-
- // Bottom border
- crossX = (bounds.y + bounds.height - b) / a;
- if (crossX >= bounds.x && crossX < bounds.x + bounds.width) return true;
- return false;
- }
-
@Nullable
private Rectangle getHintBounds() {
LightweightHint hint = myHint;
import javax.swing.*;
import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Iterator;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
/**
* @author dyoma
private RunContentManagerImpl myContentManager;
private final Alarm awaitingTerminationAlarm = new Alarm(Alarm.ThreadToUse.SWING_THREAD);
private final List<Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor>> myRunningConfigurations =
- Collections.synchronizedList(new ArrayList<Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor>>());
+ new CopyOnWriteArrayList<Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor>>();
/**
* reflection
}
private void forgetRunContentDescriptor(RunContentDescriptor runContentDescriptor) {
- for (
- Iterator<Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor>> iterator = myRunningConfigurations.iterator();
- iterator.hasNext(); ) {
- Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor> trinity = iterator.next();
+ for (Trinity<RunContentDescriptor, RunnerAndConfigurationSettings, Executor> trinity : myRunningConfigurations) {
if (trinity.getFirst() == runContentDescriptor) {
- iterator.remove();
+ myRunningConfigurations.remove(trinity);
return;
}
}
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.components.JBList;
import com.intellij.util.ArrayUtil;
-import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
}
}) {
@Override
- protected void installPathCompletion(@Nullable Project project, FileChooserDescriptor fileChooserDescriptor) {
- super.installPathCompletion(project, FileChooserDescriptorFactory.createSingleFolderDescriptor());
+ protected void installPathCompletion(FileChooserDescriptor fileChooserDescriptor) {
+ super.installPathCompletion(FileChooserDescriptorFactory.createSingleFolderDescriptor());
}
};
panel.add(myWorkingDirectoryField, BorderLayout.CENTER);
import com.intellij.ui.FileColorManager;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.HashMap;
+import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
inner.setLayout(new BoxLayout(inner, BoxLayout.X_AXIS));
inner.setBorder(
BorderFactory.createCompoundBorder(BorderFactory.createLineBorder(Color.LIGHT_GRAY, 1), BorderFactory.createEmptyBorder(5, 5, 5, 5)));
- inner.setBackground(Color.WHITE);
+ if (!UIUtil.isUnderDarcula()) {
+ inner.setBackground(Color.WHITE);
+ }
result.add(inner, BorderLayout.CENTER);
final ButtonGroup group = new ButtonGroup();
doPerformAction(e);
}
});
- setBackground(Color.WHITE);
+
+ setBackground(UIUtil.isUnderDarcula() ? UIUtil.getControlColor() : Color.WHITE);
setBorder(BorderFactory.createEmptyBorder(5, 10, 5, 10));
}
@Override
public Color getForeground() {
if (getModel().isSelected()) {
- return Color.BLACK;
+ return UIUtil.isUnderDarcula() ? Color.WHITE : Color.BLACK;
} else if (getModel().isRollover()) {
return Color.GRAY;
} else {
import com.intellij.ui.FileColorManager;
import com.intellij.ui.LightColors;
import com.intellij.util.containers.hash.LinkedHashMap;
+import com.intellij.util.ui.UIUtil;
import org.jdom.Element;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
private FileColorSharedConfigurationManager mySharedConfigurationManager;
private static final Map<String, Color> ourDefaultColors;
+ private static final Map<String, Color> ourDefaultDarkColors;
static {
ourDefaultColors = new LinkedHashMap<String, Color>();
ourDefaultColors.put("Rose", new Color(242, 206, 202));
ourDefaultColors.put("Violet", new Color(222, 213, 241));
ourDefaultColors.put("Yellow", new Color(255, 255, 228));
+ ourDefaultDarkColors = new LinkedHashMap<String, Color>();
+ ourDefaultDarkColors.put("Blue", new Color(255-220, 255-240, 255-255));
+ ourDefaultDarkColors.put("Green", new Color(255-231, 255-250, 255-219));
+ ourDefaultDarkColors.put("Orange", new Color(255-246, 255-224, 255-202));
+ ourDefaultDarkColors.put("Rose", new Color(255-242, 255-206, 255-202));
+ ourDefaultDarkColors.put("Violet", new Color(255-222, 255-213, 255-241));
+ ourDefaultDarkColors.put("Yellow", new Color(255-255, 255-255, 255-228));
}
public FileColorManagerImpl(@NotNull final Project project) {
@SuppressWarnings({"MethodMayBeStatic"})
@Nullable
public Color getColor(@NotNull final String name) {
- final Color color = ourDefaultColors.get(name);
+ final Color color = UIUtil.isUnderDarcula() ? ourDefaultDarkColors.get(name) : ourDefaultColors.get(name);
return color == null ? ColorUtil.fromHex(name, null) : color;
}
*/
package com.intellij.openapi.ui;
-import com.intellij.ide.DataManager;
import com.intellij.openapi.Disposable;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
public TextFieldWithBrowseButton(JTextField field, @Nullable ActionListener browseActionListener) {
super(field, browseActionListener);
if (ApplicationManager.getApplication() != null) {
- final DataManager manager = DataManager.getInstance();
- if (manager != null) {
- installPathCompletion(PlatformDataKeys.PROJECT.getData(manager.getDataContext()),
- FileChooserDescriptorFactory.createSingleLocalFileDescriptor());
- }
+ installPathCompletion(FileChooserDescriptorFactory.createSingleLocalFileDescriptor());
}
}
public void addBrowseFolderListener(@Nullable String title, @Nullable String description, @Nullable Project project, FileChooserDescriptor fileChooserDescriptor) {
addBrowseFolderListener(title, description, project, fileChooserDescriptor, TextComponentAccessor.TEXT_FIELD_WHOLE_TEXT);
- installPathCompletion(project, fileChooserDescriptor);
+ installPathCompletion(fileChooserDescriptor);
}
- protected void installPathCompletion(final @Nullable Project project, final FileChooserDescriptor fileChooserDescriptor) {
- installPathCompletion(project, fileChooserDescriptor, null);
+ protected void installPathCompletion(final FileChooserDescriptor fileChooserDescriptor) {
+ installPathCompletion(fileChooserDescriptor, null);
}
- protected void installPathCompletion(final @Nullable Project project, final FileChooserDescriptor fileChooserDescriptor, @Nullable Disposable parent) {
+ protected void installPathCompletion(final FileChooserDescriptor fileChooserDescriptor,
+ @Nullable Disposable parent) {
final Application application = ApplicationManager.getApplication();
if (application == null || application.isUnitTestMode() || application.isHeadlessEnvironment()) return;
FileChooserFactory.getInstance().installFileCompletion(getChildComponent(), fileChooserDescriptor, true, parent);
super(browseActionListener);
}
- protected void installPathCompletion(final Project project, final FileChooserDescriptor fileChooserDescriptor) {
+ protected void installPathCompletion(final FileChooserDescriptor fileChooserDescriptor) {
}
}
}
rect.y = (int)screen.getMinY();
}
}
+
+ /**
+ *
+ * @param prevLocation - previous location on screen
+ * @param location - current location on screen
+ * @param bounds - area to check if location shifted towards or not. Also in screen coordinates
+ * @return true if movement from prevLocation to location is towards specified rectangular area
+ */
+ public static boolean isMovementTowards(final Point prevLocation, final Point location, final Rectangle bounds) {
+ if (bounds == null) {
+ return false;
+ }
+ if (prevLocation == null || prevLocation.equals(location)) {
+ return true;
+ }
+
+ int dx = prevLocation.x - location.x;
+ int dy = prevLocation.y - location.y;
+
+ // Check if the mouse goes out of the control.
+ if (dx > 0 && bounds.x >= prevLocation.x) return false;
+ if (dx < 0 && bounds.x + bounds.width <= prevLocation.x) return false;
+ if (dy > 0 && bounds.y + bounds.height >= prevLocation.y) return false;
+ if (dy < 0 && bounds.y <= prevLocation.y) return false;
+ if (dx == 0) {
+ return (location.x >= bounds.x && location.x < bounds.x + bounds.width)
+ && (dy > 0 ^ bounds.y > location.y);
+ }
+ if (dy == 0) {
+ return (location.y >= bounds.y && location.y < bounds.y + bounds.height)
+ && (dx > 0 ^ bounds.x > location.x);
+ }
+
+
+ // Calculate line equation parameters - y = a * x + b
+ float a = (float)dy / dx;
+ float b = location.y - a * location.x;
+
+ // Check if crossing point with any tooltip border line is within bounds. Don't bother with floating point inaccuracy here.
+
+ // Left border.
+ float crossY = a * bounds.x + b;
+ if (crossY >= bounds.y && crossY < bounds.y + bounds.height) return true;
+
+ // Right border.
+ crossY = a * (bounds.x + bounds.width) + b;
+ if (crossY >= bounds.y && crossY < bounds.y + bounds.height) return true;
+
+ // Top border.
+ float crossX = (bounds.y - b) / a;
+ if (crossX >= bounds.x && crossX < bounds.x + bounds.width) return true;
+
+ // Bottom border
+ crossX = (bounds.y + bounds.height - b) / a;
+ if (crossX >= bounds.x && crossX < bounds.x + bounds.width) return true;
+
+ return false;
+ }
}
package com.intellij.ide.ui;
import com.intellij.ide.IdeBundle;
-import com.intellij.ide.ui.laf.IdeaDarkLookAndFeelInfo;
-import com.intellij.openapi.application.ex.ApplicationManagerEx;
-import com.intellij.openapi.editor.colors.EditorColorsManager;
-import com.intellij.openapi.editor.colors.EditorColorsScheme;
+import com.intellij.ide.ui.laf.DarculaInstaller;
import com.intellij.openapi.options.BaseConfigurable;
import com.intellij.openapi.options.SearchableConfigurable;
import com.intellij.openapi.ui.ComboBox;
-import com.intellij.openapi.ui.Messages;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.wm.ex.WindowManagerEx;
import com.intellij.ui.ListCellRendererWrapper;
final UIManager.LookAndFeelInfo lafInfo = (UIManager.LookAndFeelInfo)myComponent.myLafComboBox.getSelectedItem();
if (lafManager.checkLookAndFeel(lafInfo)) {
update = shouldUpdateUI = true;
+ boolean wasDarcula = UIUtil.isUnderDarcula();
lafManager.setCurrentLookAndFeel(lafInfo);
- if (lafInfo instanceof IdeaDarkLookAndFeelInfo && !lafInfo.getName().equals(
- EditorColorsManager.getInstance().getGlobalScheme().getName())) {
- final EditorColorsScheme scheme = EditorColorsManager.getInstance().getScheme(lafInfo.getName());
-
- if (scheme != null) {
- final int answer = Messages.showOkCancelDialog("Set " + lafInfo.getName() + " editor scheme as well?",
- "Setup Editor Color Scheme",
- Messages.getQuestionIcon());
- if (answer == Messages.OK) {
- EditorColorsManager.getInstance().setGlobalScheme(scheme);
- if (Messages.showOkCancelDialog("Restart now?", "Restart", Messages.getQuestionIcon()) == Messages.OK) {
- ApplicationManagerEx.getApplicationEx().restart();
- }
- }
-
- }
+ if (UIUtil.isUnderDarcula()) {
+ DarculaInstaller.install();
+ } else if (wasDarcula) {
+ DarculaInstaller.uninstall();
}
}
}
--- /dev/null
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.ide.ui.laf;
+
+import com.intellij.openapi.application.ex.ApplicationManagerEx;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
+import com.intellij.openapi.editor.colors.EditorColorsScheme;
+import com.intellij.openapi.ui.Messages;
+
+/**
+ * @author Konstantin Bulenkov
+ */
+public class DarculaInstaller {
+
+ public static void uninstall() {
+ }
+
+ public static void install() {
+ if (!DarculaLaf.NAME.equals(EditorColorsManager.getInstance().getGlobalScheme().getName())) {
+ final EditorColorsScheme scheme = EditorColorsManager.getInstance().getScheme(DarculaLaf.NAME);
+ if (scheme != null) {
+ EditorColorsManager.getInstance().setGlobalScheme(scheme);
+ }
+ }
+
+ if (Messages.showOkCancelDialog("Restart now?", "Restart", Messages.getQuestionIcon()) == Messages.OK) {
+ ApplicationManagerEx.getApplicationEx().restart();
+ }
+ }
+}
/**
* @author Konstantin Bulenkov
*/
-final class DurculaLaf extends BasicLookAndFeel {
+public final class DarculaLaf extends BasicLookAndFeel {
+ public static final String NAME = "Darcula";
BasicLookAndFeel base;
- public DurculaLaf() {
+ public DarculaLaf() {
try {
if (SystemInfo.isWindows) {
base = new IdeaLaf();
final Properties properties = new Properties();
final String secondPart = postfix == null ? "" : "_" + postfix;
final String name = "darcula" + secondPart + ".properties";
- final InputStream stream = DurculaLaf.class.getResourceAsStream(name);
+ final InputStream stream = DarculaLaf.class.getResourceAsStream(name);
properties.load(stream);
for (String key : properties.stringPropertyNames()) {
final String value = properties.getProperty(key);
@Override
public String getName() {
- return "Darcula";
+ return NAME;
}
@Override
/**
* @author Konstantin Bulenkov
*/
-public class IdeaDarkLookAndFeelInfo extends UIManager.LookAndFeelInfo {
+public class DarculaLookAndFeelInfo extends UIManager.LookAndFeelInfo {
@NonNls public static final String CLASS_NAME = "idea.dark.laf.classname";
- public IdeaDarkLookAndFeelInfo(){
+ public DarculaLookAndFeelInfo(){
super(IdeBundle.message("idea.dark.look.and.feel"), CLASS_NAME);
}
public boolean equals(Object obj){
- return (obj instanceof IdeaDarkLookAndFeelInfo);
+ return (obj instanceof DarculaLookAndFeelInfo);
}
public int hashCode(){
myListenerList = new EventListenerList();
IdeaLookAndFeelInfo ideaLaf = new IdeaLookAndFeelInfo();
- IdeaDarkLookAndFeelInfo ideaDarkLaf = new IdeaDarkLookAndFeelInfo();
+ DarculaLookAndFeelInfo darculaLaf = new DarculaLookAndFeelInfo();
UIManager.LookAndFeelInfo[] installedLafs = UIManager.getInstalledLookAndFeels();
final boolean darculaAvailable = Registry.is("dark.laf.available");
myLafs = new UIManager.LookAndFeelInfo[(darculaAvailable ? 2 : 1) + installedLafs.length];
myLafs[0] = ideaLaf;
if (darculaAvailable) {
- myLafs[1] = ideaDarkLaf;
+ myLafs[1] = darculaLaf;
}
System.arraycopy(installedLafs, 0, myLafs, darculaAvailable ? 2 : 1, installedLafs.length);
Arrays.sort(myLafs, new Comparator<UIManager.LookAndFeelInfo>() {
return;
}
}
- else if (IdeaDarkLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
- DurculaLaf laf = new DurculaLaf();
+ else if (DarculaLookAndFeelInfo.CLASS_NAME.equals(lookAndFeelInfo.getClassName())) {
+ DarculaLaf laf = new DarculaLaf();
MetalLookAndFeel.setCurrentTheme(new IdeaDarkMetalTheme());
try {
UIManager.setLookAndFeel(laf);
@Override
public void disposeComponent() {
+ assertAllPointersDisposed();
}
@NotNull
@Override
public void dispose() {
- assertAllPointersDisposed();
}
private void incModificationCounter() {
}
public void setRefreshVisible(final boolean visible) {
- myRefreshAlarm.cancelAllRequests();
- myRefreshAlarm.addRequest(new Runnable() {
+ UIUtil.invokeLaterIfNeeded(new Runnable() {
@Override
public void run() {
- if (visible) {
- myRefreshIcon.resume();
- }
- else {
- myRefreshIcon.suspend();
- }
- myRefreshIcon.revalidate();
- myRefreshIcon.repaint();
+ myRefreshAlarm.cancelAllRequests();
+ myRefreshAlarm.addRequest(new Runnable() {
+ @Override
+ public void run() {
+ if (visible) {
+ myRefreshIcon.resume();
+ }
+ else {
+ myRefreshIcon.suspend();
+ }
+ myRefreshIcon.revalidate();
+ myRefreshIcon.repaint();
+ }
+ }, visible ? 100 : 300);
}
- }, visible ? 100 : 300);
+ });
}
public void setRefreshToolTipText(final String tooltip) {
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.ex.AnActionListener;
import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.keymap.impl.IdeMouseEventDispatcher;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.ui.GraphicsConfig;
import com.intellij.openapi.ui.MessageType;
private boolean myShadow = false;
private Layer myLayer;
private boolean myBlockClicks;
+ private Point myPrevMousePoint = null;
public boolean isInsideBalloon(MouseEvent me) {
return isInside(new RelativePoint(me));
if (cmp == myCloseRec) return true;
if (SwingUtilities.isDescendingFrom(cmp, myComp) || cmp == myComp) return true;
if (myComp == null || !myComp.isShowing()) return false;
- if (new Rectangle(myComp.getLocationOnScreen(), myComp.getSize()).contains(target.getScreenPoint())) return true;
+ Rectangle rectangleOnScreen = new Rectangle(myComp.getLocationOnScreen(), myComp.getSize());
+ if (rectangleOnScreen.contains(target.getScreenPoint())) return true;
- return false;
+ try {
+ return ScreenUtil.isMovementTowards(myPrevMousePoint, target.getScreenPoint(), rectangleOnScreen);
+ }
+ finally {
+ myPrevMousePoint = target.getScreenPoint();
+ }
}
private final ComponentAdapter myComponentListener = new ComponentAdapter() {
assertMatches("*Git", "BlaGitBla");
assertFalse(firstLetterMatcher("*Git").matches("BlagitBla"));
assertMatches("*git", "BlagitBla");
- assertDoesntMatch("*Git*", "AtpGenerationItem");
+ assertMatches("*Git*", "AtpGenerationItem");
assertMatches("Collec*Util*", "CollectionUtils");
assertMatches("Collec*Util*", "CollectionUtilsTest");
assertTrue(caseInsensitiveMatcher("*us").matches("usage"));
assertMatches(" File. sepa", "File._separator");
assertMatches(" File. _sepa", "File._separator");
assertMatches(" _fo", "_foo");
+ assertMatches("*BComp", "BaseComponent");
}
public void testMiddleMatchingFirstLetterSensitive() {
assertFalse(firstLetterMatcher(" _bl").matches("_top"));
assertFalse(firstLetterMatcher("*Ch").matches("char"));
assertTrue(firstLetterMatcher("*codes").matches("CFLocaleCopyISOCountryCodes"));
+ assertTrue(firstLetterMatcher("*Bcomp").matches("BaseComponent"));
}
private static Matcher firstLetterMatcher(String pattern) {
@Nullable
List<String> getLookupElementStrings();
+ void finishLookup();
+
@NotNull
PsiElement getElementAtCaret();
import com.intellij.codeInsight.highlighting.actions.HighlightUsagesAction;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInsight.intention.impl.ShowIntentionActionsHandler;
+import com.intellij.codeInsight.lookup.Lookup;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupManager;
import com.intellij.codeInsight.lookup.impl.LookupImpl;
});
}
+ @Override
+ public void finishLookup() {
+ CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
+ @Override
+ public void run() {
+ ((LookupImpl)LookupManager.getActiveLookup(getEditor())).finishLookup(Lookup.NORMAL_SELECT_CHAR);
+ }
+ }, null, null);
+ }
+
@Override
public void testRename(final String fileBefore, final String fileAfter, final String newName, final String... additionalFiles) {
assertInitialized();
public MinusculeMatcher(String pattern, NameUtil.MatchingCaseSensitivity options) {
myOptions = options;
myPattern = StringUtil.trimEnd(pattern, "* ").toCharArray();
- for (int i = 1; i < myPattern.length; i++) {
- char c = myPattern[i];
- if (Character.isUpperCase(c)) {
+ int i = 0;
+ while (isWildcard(i)) i++;
+ i++;
+ while (i < myPattern.length) {
+ if (Character.isUpperCase(myPattern[i])) {
myHasHumps = true;
return;
}
+ i++;
}
myHasHumps = false;
}
*/
package com.intellij.ui;
+import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public static Color getColor(@NotNull Class<?> cls) {
final Annotation annotation = cls.getAnnotation(Colored.class);
if (annotation instanceof Colored) {
- return fromHex(((Colored)annotation).color(), null);
+ final Colored colored = (Colored)annotation;
+ return fromHex(UIUtil.isUnderDarcula() ? colored.darkVariant() : colored.color(), null);
}
return null;
}
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2012 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
*/
@RegExp(prefix = "[0-9a-f]{6}")
String color();
+
+ /**
+ * @return color as hex-string
+ */
+ @RegExp(prefix = "[0-9a-f]{6}")
+ String darkVariant();
}
renderer.append(userObject.toString(), SimpleTextAttributes.REGULAR_ATTRIBUTES);
final String s = " (" + (myDirsSize > 0 ? myDirsSize + " directories and " : "") + (myUnversionedSize - myDirsSize) + " files) ";
renderer.append(s, SimpleTextAttributes.GRAY_ITALIC_ATTRIBUTES);
- renderer.append(" Click to browse", SimpleTextAttributes.LINK_ATTRIBUTES, myShower);
+ renderer.append("Click to browse", SimpleTextAttributes.LINK_ATTRIBUTES, myShower);
}
private static class MyUnversionedShower implements Runnable {
import com.intellij.designer.propertyTable.editors.ComboEditor;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.fileChooser.FileChooserDescriptor;
-import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.ComponentWithBrowseButton;
import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.text.StringUtil;
else {
myEditor = new TextFieldWithBrowseButton() {
@Override
- protected void installPathCompletion(@Nullable Project project,
- FileChooserDescriptor fileChooserDescriptor,
+ protected void installPathCompletion(FileChooserDescriptor fileChooserDescriptor,
@Nullable Disposable parent) {
}
import com.intellij.util.xmlb.annotations.Attribute;
import com.intellij.util.xmlb.annotations.Tag;
import org.jetbrains.android.util.AndroidCommonUtils;
-import org.jetbrains.jps.model.JpsElementProperties;
import java.util.ArrayList;
import java.util.List;
/**
* @author nik
*/
-public class JpsAndroidModuleProperties extends JpsElementProperties {
+public class JpsAndroidModuleProperties {
public String GEN_FOLDER_RELATIVE_PATH_APT;
public String GEN_FOLDER_RELATIVE_PATH_AIDL;
import org.jetbrains.jps.devkit.model.JpsIdeaSdkType;
import org.jetbrains.jps.devkit.model.JpsPluginModuleProperties;
import org.jetbrains.jps.incremental.artifacts.JpsSyntheticArtifactProvider;
-import org.jetbrains.jps.model.JpsElementProperties;
+import org.jetbrains.jps.model.JpsElement;
import org.jetbrains.jps.model.JpsModel;
+import org.jetbrains.jps.model.JpsSimpleElement;
import org.jetbrains.jps.model.artifact.DirectoryArtifactType;
import org.jetbrains.jps.model.artifact.JpsArtifact;
import org.jetbrains.jps.model.artifact.JpsArtifactService;
public List<JpsArtifact> createArtifacts(@NotNull JpsModel model) {
List<JpsArtifact> artifacts = new ArrayList<JpsArtifact>();
for (JpsModule module : model.getProject().getModules()) {
- JpsElementProperties properties = module.getProperties();
- if (properties instanceof JpsPluginModuleProperties) {
- artifacts.add(createArtifact(module, (JpsPluginModuleProperties)properties));
+ JpsElement propertiesElement = module.getProperties();
+ if (propertiesElement instanceof JpsSimpleElement) {
+ JpsPluginModuleProperties properties = ((JpsSimpleElement<JpsPluginModuleProperties>)propertiesElement).getProperties();
+ artifacts.add(createArtifact(module, properties));
}
}
return artifacts;
*/
package org.jetbrains.jps.devkit.model;
-import org.jetbrains.jps.model.JpsElementProperties;
-
/**
* @author nik
*/
-public class JpsPluginModuleProperties extends JpsElementProperties {
+public class JpsPluginModuleProperties {
private final String myPluginXmlUrl;
public JpsPluginModuleProperties(String pluginXmlUrl) {
*/
package org.jetbrains.jps.devkit.model;
+import org.jetbrains.jps.model.JpsSimpleElement;
import org.jetbrains.jps.model.module.JpsModuleType;
/**
* @author nik
*/
-public class JpsPluginModuleType extends JpsModuleType<JpsPluginModuleProperties> {
+public class JpsPluginModuleType extends JpsModuleType<JpsSimpleElement<JpsPluginModuleProperties>> {
public static final JpsPluginModuleType INSTANCE = new JpsPluginModuleType();
- @Override
- public JpsPluginModuleProperties createCopy(JpsPluginModuleProperties properties) {
- return new JpsPluginModuleProperties(properties);
- }
}
import org.jetbrains.jps.devkit.model.JpsIdeaSdkType;
import org.jetbrains.jps.devkit.model.JpsPluginModuleProperties;
import org.jetbrains.jps.devkit.model.JpsPluginModuleType;
+import org.jetbrains.jps.model.JpsElementFactory;
+import org.jetbrains.jps.model.JpsSimpleElement;
import org.jetbrains.jps.model.serialization.*;
import org.jetbrains.jps.model.serialization.JpsModulePropertiesSerializer;
import org.jetbrains.jps.model.serialization.JpsSdkPropertiesSerializer;
}
}
- private static class JpsPluginModulePropertiesSerializer extends JpsModulePropertiesSerializer<JpsPluginModuleProperties> {
+ private static class JpsPluginModulePropertiesSerializer extends JpsModulePropertiesSerializer<JpsSimpleElement<JpsPluginModuleProperties>> {
private JpsPluginModulePropertiesSerializer() {
super(JpsPluginModuleType.INSTANCE, "PLUGIN_MODULE");
}
@Override
- public JpsPluginModuleProperties loadProperties(@Nullable Element moduleRootElement) {
+ public JpsSimpleElement<JpsPluginModuleProperties> loadProperties(@Nullable Element moduleRootElement) {
Element component = JpsLoaderBase.findComponent(moduleRootElement, "DevKit.ModuleBuildProperties");
- return new JpsPluginModuleProperties(component != null ? component.getAttributeValue("url") : null);
+ String pluginXmlUrl = component != null ? component.getAttributeValue("url") : null;
+ return JpsElementFactory.getInstance().createSimpleElement(new JpsPluginModuleProperties(pluginXmlUrl));
}
}
}
import com.intellij.psi.xml.XmlTag;
import com.intellij.psi.xml.XmlToken;
import com.intellij.psi.xml.XmlTokenType;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.idea.devkit.inspections.DevKitInspectionBase;
import java.util.List;
}
@Override
- public String generateDoc(PsiElement element, PsiElement originalElement) {
+ public String generateDoc(PsiElement element, @Nullable PsiElement originalElement) {
+ if (originalElement == null) return null;
if (originalElement.getLanguage() == XMLLanguage.INSTANCE || DevKitInspectionBase.isPluginXml(originalElement.getContainingFile())) {
final PsiElement context = element.getContext();
String fqn = null;
import com.intellij.codeInsight.completion.CompletionParameters;
import com.intellij.codeInsight.completion.JavaCompletionUtil;
import com.intellij.codeInsight.lookup.LookupElement;
-import com.intellij.psi.*;
+import com.intellij.psi.PsiClassType;
+import com.intellij.psi.PsiField;
+import com.intellij.psi.PsiMethod;
+import com.intellij.psi.PsiType;
import com.intellij.psi.filters.getters.MembersGetter;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.util.Consumer;
*/
class GroovyMembersGetter extends MembersGetter {
private final PsiClassType myExpectedType;
- private final GroovyPsiElement myContext;
- private final CompletionParameters myParameters;
- GroovyMembersGetter(PsiClassType expectedType, PsiElement context, CompletionParameters parameters) {
- myParameters = parameters;
+ GroovyMembersGetter(PsiClassType expectedType, CompletionParameters parameters) {
+ super(GroovyCompletionContributor.completeStaticMembers(parameters), parameters.getPosition());
myExpectedType = JavaCompletionUtil.originalize(expectedType);
- myContext = (GroovyPsiElement)context;
}
public void processMembers(boolean searchInheritors, final Consumer<LookupElement> results) {
- processMembers(myContext, results, myExpectedType.resolve(), PsiTreeUtil.getParentOfType(myContext, GrAnnotation.class) != null, searchInheritors,
- GroovyCompletionContributor.completeStaticMembers(myParameters));
+ processMembers(results, myExpectedType.resolve(), PsiTreeUtil.getParentOfType(myPlace, GrAnnotation.class) == null, searchInheritors);
}
@Override
protected LookupElement createFieldElement(PsiField field) {
- if (!TypesUtil.isAssignable(myExpectedType, field.getType(), myContext)) {
+ if (!isSuitableType(field.getType())) {
return null;
}
@Override
protected LookupElement createMethodElement(PsiMethod method) {
PsiType type = method.getReturnType();
- if (type == null || !TypesUtil.isAssignable(myExpectedType, type, myContext)) {
+ if (!isSuitableType(type)) {
return null;
}
return GroovyCompletionContributor.createGlobalMemberElement(method, method.getContainingClass(), false);
}
+
+ private boolean isSuitableType(PsiType type) {
+ return type != null && TypesUtil.isAssignable(myExpectedType, type, (GroovyPsiElement)myPlace.getParent());
+ }
}
PsiType defType = info.getDefaultType();
boolean searchInheritors = params.getInvocationCount() > 1;
if (type instanceof PsiClassType) {
- new GroovyMembersGetter((PsiClassType)type, reference, params).processMembers(searchInheritors, consumer);
+ new GroovyMembersGetter((PsiClassType)type, params).processMembers(searchInheritors, consumer);
}
if (!defType.equals(type) && defType instanceof PsiClassType) {
- new GroovyMembersGetter((PsiClassType)defType, reference, params).processMembers(searchInheritors, consumer);
+ new GroovyMembersGetter((PsiClassType)defType, params).processMembers(searchInheritors, consumer);
}
}
}
@Override
public GrParameterStub createStub(@NotNull GrParameter psi, StubElement parentStub) {
- return new GrParameterStub(parentStub, StringRef.fromString(psi.getName()), GrStubUtils.getAnnotationNames(psi), GrStubUtils.getTypeText(psi));
+ return new GrParameterStub(parentStub, StringRef.fromString(psi.getName()), GrStubUtils.getAnnotationNames(psi), GrStubUtils.getTypeText(
+ psi.getTypeElementGroovy()));
}
@Override
public boolean hasExplicitModifier(@NotNull @NonNls String name) {
final GrModifierListStub stub = getStub();
if (stub != null) {
- final int flag = NAME_TO_MODIFIER_FLAG_MAP.get(name);
- return (stub.getModifiersFlags() & flag) != 0;
+ return hasMaskExplicitModifier(name, stub.getModifiersFlags());
}
if (name.equals(GrModifier.PUBLIC)) return findChildByType(GroovyElementTypes.kPUBLIC) != null;
return name.equals(GrModifier.VOLATILE) && findChildByType(GroovyElementTypes.kVOLATILE) != null;
}
+ public static boolean hasMaskExplicitModifier(String name, int mask) {
+ final int flag = NAME_TO_MODIFIER_FLAG_MAP.get(name);
+ return (mask & flag) != 0;
+ }
+
public void setModifierProperty(@NotNull @NonNls String name, boolean doSet) throws IncorrectOperationException {
if (hasModifierProperty(name) == doSet) return;
import com.intellij.psi.stubs.StubElement;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrEnumConstant;
final String[] annotations,
String[] namedParameters,
final IStubElementType elemType,
- byte flags, String typeText) {
+ byte flags, @Nullable String typeText) {
super(parent, elemType);
myName = name;
myAnnotations = annotations;
return myFlags;
}
+ @Nullable
public String getTypeText() {
return myTypeText;
}
import com.intellij.psi.stubs.StubElement;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
import org.jetbrains.plugins.groovy.lang.psi.stubs.elements.GrMethodElementType;
private final StringRef myName;
private final String[] myAnnotations;
private final String[] myNamedParameters;
+ private final String myTypeText;
public GrMethodStub(StubElement parent,
StringRef name,
final String[] annotations,
final @NotNull String[] namedParameters,
- final GrMethodElementType elementType) {
+ final GrMethodElementType elementType, @Nullable String typeText) {
super(parent, elementType);
myName = name;
myAnnotations = annotations;
myNamedParameters = namedParameters;
+ myTypeText = typeText;
}
@NotNull public String getName() {
public String[] getNamedParameters() {
return myNamedParameters;
}
+
+ @Nullable
+ public String getTypeText() {
+ return myTypeText;
+ }
}
package org.jetbrains.plugins.groovy.lang.psi.stubs;
import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.psi.PsiModifier;
import com.intellij.psi.PsiModifierList;
import com.intellij.psi.PsiModifierListOwner;
+import com.intellij.psi.PsiNameHelper;
+import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.stubs.StubInputStream;
import com.intellij.psi.stubs.StubOutputStream;
import com.intellij.util.ArrayUtil;
import com.intellij.util.containers.CollectionFactory;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.jetbrains.plugins.groovy.lang.parser.GroovyElementTypes;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.GrModifierList;
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.modifiers.annotation.GrAnnotation;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
-import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrMultiTypeParameter;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrCodeReferenceElement;
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
+import org.jetbrains.plugins.groovy.lang.psi.impl.auxiliary.modifiers.GrModifierListImpl;
import java.io.IOException;
import java.util.List;
*/
public class GrStubUtils {
-
- private GrStubUtils() {
- }
-
- public static String[] getMultiTypes(GrMultiTypeParameter psi) {
- final GrTypeElement[] typeElements = psi.getTypeElements();
- final String[] types = new String[typeElements.length];
- for (int i = 0; i < typeElements.length; i++) {
- types[i] = typeElements[i].getText();
- }
- return types;
- }
-
public static void writeStringArray(StubOutputStream dataStream, String[] array) throws IOException {
dataStream.writeByte(array.length);
for (String s : array) {
}
@Nullable
- public static String getTypeText(GrVariable psi) {
- final GrTypeElement typeElement = psi.getTypeElementGroovy();
+ public static String getTypeText(GrTypeElement typeElement) {
return typeElement == null ? null : typeElement.getText();
}
}
return ArrayUtil.toStringArray(annoNames);
}
+
+ public static boolean isGroovyStaticMemberStub(StubElement<?> stub) {
+ StubElement<GrModifierList> type = stub.findChildStubByType(GroovyElementTypes.MODIFIERS);
+ if (type instanceof GrModifierListStub) {
+ return GrModifierListImpl.hasMaskExplicitModifier(PsiModifier.STATIC, ((GrModifierListStub)type).getModifiersFlags());
+ }
+ return true;
+ }
+
+ @NotNull
+ public static String getShortTypeText(@Nullable String text) {
+ if (text == null) {
+ return "";
+ }
+ int i = text.length();
+ while (i - 2 >= 0 && text.charAt(i - 2) == '[' && text.charAt(i - 1) == ']') {
+ i -= 2;
+ }
+ return PsiNameHelper.getShortClassName(text.substring(0, i)) + text.substring(i);
+ }
}
*/
package org.jetbrains.plugins.groovy.lang.psi.stubs.elements;
+import com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys;
import com.intellij.psi.stubs.IndexSink;
import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.stubs.StubInputStream;
}
return new GrFieldStub(parentStub, StringRef.fromString(psi.getName()), annNames, namedParameters.toArray(new String[namedParameters.size()]), FIELD, GrFieldStub.buildFlags(psi),
- GrStubUtils.getTypeText(psi));
+ GrStubUtils.getTypeText(psi.getTypeElementGroovy()));
}
public void serialize(GrFieldStub stub, StubOutputStream dataStream) throws IOException {
flags, typeText);
}
+
static void indexFieldStub(GrFieldStub stub, IndexSink sink) {
String name = stub.getName();
sink.occurrence(GrFieldNameIndex.KEY, name);
+ if (GrStubUtils.isGroovyStaticMemberStub(stub)) {
+ sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
+ sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, GrStubUtils.getShortTypeText(stub.getTypeText()));
+ }
for (String annName : stub.getAnnotations()) {
if (annName != null) {
sink.occurrence(GrAnnotatedMemberIndex.KEY, annName);
*/
package org.jetbrains.plugins.groovy.lang.psi.stubs.elements;
+import com.intellij.psi.impl.java.stubs.index.JavaStubIndexKeys;
import com.intellij.psi.stubs.IndexSink;
import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.stubs.StubInputStream;
import com.intellij.psi.stubs.StubOutputStream;
+import com.intellij.util.ArrayUtil;
import com.intellij.util.io.StringRef;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
Set<String> namedParameters = psi.getNamedParameters().keySet();
return new GrMethodStub(parentStub, StringRef.fromString(psi.getName()), GrStubUtils.getAnnotationNames(psi),
- namedParameters.toArray(new String[namedParameters.size()]), this);
+ ArrayUtil.toStringArray(namedParameters), this,
+ GrStubUtils.getTypeText(psi.getReturnTypeElementGroovy()));
}
public void serialize(GrMethodStub stub, StubOutputStream dataStream) throws IOException {
dataStream.writeName(stub.getName());
GrStubUtils.writeStringArray(dataStream, stub.getAnnotations());
GrStubUtils.writeStringArray(dataStream, stub.getNamedParameters());
+ GrStubUtils.writeNullableString(dataStream, stub.getTypeText());
}
public GrMethodStub deserialize(StubInputStream dataStream, StubElement parentStub) throws IOException {
StringRef ref = dataStream.readName();
final String[] annNames = GrStubUtils.readStringArray(dataStream);
String[] namedParameters = GrStubUtils.readStringArray(dataStream);
- return new GrMethodStub(parentStub, ref, annNames, namedParameters, this);
+ String typeText = GrStubUtils.readNullableString(dataStream);
+ return new GrMethodStub(parentStub, ref, annNames, namedParameters, this, typeText);
}
public void indexStub(GrMethodStub stub, IndexSink sink) {
String name = stub.getName();
- if (name != null) {
- sink.occurrence(GrMethodNameIndex.KEY, name);
+ sink.occurrence(GrMethodNameIndex.KEY, name);
+ if (GrStubUtils.isGroovyStaticMemberStub(stub)) {
+ sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_NAMES, name);
+ sink.occurrence(JavaStubIndexKeys.JVM_STATIC_MEMBERS_TYPES, GrStubUtils.getShortTypeText(stub.getTypeText()));
}
for (String annName : stub.getAnnotations()) {
if (annName != null) {
@Override
public int getStubVersion() {
- return super.getStubVersion() + 11;
+ return super.getStubVersion() + 12;
}
public String getExternalId() {
package org.jetbrains.plugins.groovy.lang.resolve;
+import com.intellij.lang.java.JavaLanguage;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Key;
PsiElementFactory factory = JavaPsiFacade.getElementFactory(project);
boolean doProcessNonCodeMembers = false;
-
+ boolean isJavaResolver = false;
while (run != null) {
+
+ //hack for walking up in java code
+ //java's processDeclarations don't check names so we should do it manually
+ if (!isJavaResolver && run.getLanguage() == JavaLanguage.INSTANCE) {
+ isJavaResolver = true;
+ if (processor.getHint(NameHint.KEY) != null) {
+ processor = new JavaResolverProcessor(processor);
+ }
+ }
+
if (!run.processDeclarations(processor, ResolveState.initial(), lastParent, place)) return false;
if (processNonCodeMethods) {
if (!doProcessNonCodeMembers) {
--- /dev/null
+/*
+ * Copyright 2000-2012 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jetbrains.plugins.groovy.lang.resolve.processors;
+
+import com.intellij.openapi.util.Key;
+import com.intellij.psi.PsiElement;
+import com.intellij.psi.PsiNamedElement;
+import com.intellij.psi.ResolveState;
+import com.intellij.psi.scope.NameHint;
+import com.intellij.psi.scope.PsiScopeProcessor;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+/**
+ * Checks names of processed element because our Groovy processors don't do it
+ *
+ * @author Max Medvedev
+ */
+public class JavaResolverProcessor implements PsiScopeProcessor {
+ private final PsiScopeProcessor myDelegate;
+ private final NameHint myHint;
+
+
+ public JavaResolverProcessor(PsiScopeProcessor delegate) {
+ myDelegate = delegate;
+ myHint = delegate.getHint(NameHint.KEY);
+ }
+
+ @Override
+ public boolean execute(@NotNull PsiElement element, ResolveState state) {
+ if (myHint != null && element instanceof PsiNamedElement) {
+ final String expectedName = myHint.getName(state);
+ final String elementName = ((PsiNamedElement)element).getName();
+ if (expectedName != null && !expectedName.equals(elementName)) {
+ return true;
+ }
+ }
+
+
+ return myDelegate.execute(element, state);
+ }
+
+ @Override
+ public <T> T getHint(@NotNull Key<T> hintKey) {
+ return myDelegate.getHint(hintKey);
+ }
+
+ @Override
+ public void handleEvent(Event event, @Nullable Object associated) {
+ myDelegate.handleEvent(event, associated);
+ }
+}
* limitations under the License.
*/
-package org.jetbrains.plugins.groovy.refactoring.introduceParameter;
-
-import com.intellij.openapi.application.ApplicationManager;
-import com.intellij.openapi.command.CommandProcessor;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Pass;
-import com.intellij.psi.*;
-import com.intellij.psi.impl.source.PostprocessReformattingAspect;
-import com.intellij.refactoring.HelpID;
-import com.intellij.refactoring.IntroduceParameterRefactoring;
-import com.intellij.refactoring.introduceField.ElementToWorkOn;
-import com.intellij.refactoring.introduceParameter.IntroduceParameterProcessor;
-import com.intellij.refactoring.introduceParameter.Util;
-import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
-import gnu.trove.TIntArrayList;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.Nullable;
-import org.jetbrains.plugins.groovy.util.TestUtils;
-
+package org.jetbrains.plugins.groovy.refactoring.introduceParameter
+
+import com.intellij.openapi.application.ApplicationManager
+import com.intellij.openapi.command.CommandProcessor
+import com.intellij.openapi.editor.Editor
+import com.intellij.openapi.project.Project
+import com.intellij.openapi.util.Pass
+import com.intellij.psi.*
+import com.intellij.psi.impl.source.PostprocessReformattingAspect
+import com.intellij.refactoring.HelpID
+import com.intellij.refactoring.IntroduceParameterRefactoring
+import com.intellij.refactoring.introduceField.ElementToWorkOn
+import com.intellij.refactoring.introduceParameter.IntroduceParameterProcessor
+import com.intellij.refactoring.introduceParameter.Util
+import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
+import gnu.trove.TIntArrayList
+import org.jetbrains.annotations.NonNls
+import org.jetbrains.annotations.Nullable
+import org.jetbrains.plugins.groovy.util.TestUtils
/**
* @author Maxim.Medvedev
* Date: Apr 17, 2009 5:49:35 PM
*/
public class IntroduceParameterTest extends LightCodeInsightFixtureTestCase {
- @Override
- protected String getBasePath() {
- return TestUtils.getTestDataPath() + "refactoring/introduceParameter/" + getTestName(true) + '/';
- }
-
- private void doTest(int replaceFieldsWithGetters, boolean removeUnusedParameters, boolean searchForSuper, boolean declareFinal)
- throws Throwable {
- doTest(replaceFieldsWithGetters, removeUnusedParameters, searchForSuper, declareFinal, null);
+ final String getBasePath() {
+ return TestUtils.testDataPath + 'refactoring/introduceParameter/' + getTestName(true) + '/';
}
- private void doTest(int replaceFieldsWithGetters, boolean removeUnusedParameters, boolean searchForSuper, boolean declareFinal,
- @Nullable String conflicts)
- throws Throwable {
+ private void doTest(int replaceFieldsWithGetters, boolean removeUnusedParameters, boolean searchForSuper, boolean declareFinal, @Nullable String conflicts = null) {
final String beforeGroovy = getTestName(false)+"Before.groovy";
final String afterGroovy = getTestName(false) + "After.groovy";
final String javaClass = getTestName(false) + "MyClass.java";
myFixture.configureByFiles(javaClass, beforeGroovy);
executeRefactoring(true, replaceFieldsWithGetters, "anObject", searchForSuper, declareFinal, removeUnusedParameters, conflicts);
- PostprocessReformattingAspect.getInstance(getProject()).doPostponedFormatting();
+ PostprocessReformattingAspect.getInstance(project).doPostponedFormatting();
myFixture.checkResultByFile(beforeGroovy, afterGroovy, true);
}
final boolean removeUnusedParameters,
final String conflicts) {
boolean generateDelegate = false;
- Editor editor = myFixture.getEditor();
+ Editor editor = myFixture.editor;
- final PsiFile myFile = myFixture.getFile();
+ final PsiFile myFile = myFixture.file;
final ElementToWorkOn[] elementToWorkOn = new ElementToWorkOn[1];
- ElementToWorkOn
- .processElementToWorkOn(editor, myFile, "INtr param", HelpID.INTRODUCE_PARAMETER, getProject(), new Pass<ElementToWorkOn>() {
+ ElementToWorkOn.processElementToWorkOn(editor, myFile, "INtr param", HelpID.INTRODUCE_PARAMETER, project, new Pass<ElementToWorkOn>() {
@Override
public void pass(final ElementToWorkOn e) {
if (e == null) return;
}
});
- final PsiExpression expr = elementToWorkOn[0].getExpression();
- final PsiLocalVariable localVar = elementToWorkOn[0].getLocalVariable();
+ final PsiExpression expr = elementToWorkOn[0].expression;
+ final PsiLocalVariable localVar = elementToWorkOn[0].localVariable;
PsiElement context = expr == null ? localVar : expr;
PsiMethod method = Util.getContainingMethod(context);
methodToSearchFor = method;
}
- PsiExpression initializer = expr == null ? localVar.getInitializer() : expr;
+ PsiExpression initializer = expr == null ? localVar.initializer : expr;
assert initializer != null;
TIntArrayList parametersToRemove = removeUnusedParameters ? Util.findParametersToRemove(method, initializer, null) : new TIntArrayList();
- final Project project = myFixture.getProject();
+ final Project project = myFixture.project;
final IntroduceParameterProcessor processor =
new IntroduceParameterProcessor(project, method, methodToSearchFor, initializer, expr, localVar, true, parameterName,
replaceAllOccurrences, replaceFieldsWithGetters, declareFinal, generateDelegate, null,
parametersToRemove);
- CommandProcessor.getInstance().executeCommand(project, new Runnable() {
+ CommandProcessor.instance.executeCommand(project, new Runnable() {
@Override
public void run() {
- ApplicationManager.getApplication().runWriteAction(new Runnable() {
+ ApplicationManager.application.runWriteAction(new Runnable() {
@Override
public void run() {
try {
e.printStackTrace();
fail("Conflicts were not expected");
}
- assertEquals(conflicts, e.getMessage());
+ assertEquals(conflicts, e.message);
}
}
});
}, "introduce Parameter", null);
- editor.getSelectionModel().removeSelection();
+ editor.selectionModel.removeSelection();
return true;
}
- public void testSimpleOverridedMethod() throws Throwable {
+ public void testSimpleOverridedMethod() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
- public void testOverridedMethodWithRemoveUnusedParameters() throws Throwable {
+ public void testOverridedMethodWithRemoveUnusedParameters() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false);
}
- public void testSimpleUsage() throws Throwable {
+ public void testSimpleUsage() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
- public void testMethodWithoutParams() throws Throwable {
+ public void testMethodWithoutParams() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
- public void testParameterSubstitution() throws Throwable {
+ public void testParameterSubstitution() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
- public void testThisSubstitution() throws Throwable {
+ public void testThisSubstitution() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
- public void testThisSubstitutionInQualifier() throws Throwable {
+ public void testThisSubstitutionInQualifier() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false, "field <b><code>Test.i</code></b> is not accessible from method <b><code>XTest.n()</code></b>. Value for introduced parameter in that method call will be incorrect.");
}
- public void testFieldAccess() throws Throwable {
+ public void testFieldAccess() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
- public void testMethodAccess() throws Throwable {
+ public void testMethodAccess() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
- public void testStaticFieldAccess() throws Throwable {
+ public void testStaticFieldAccess() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
- public void testFieldWithGetterReplacement() throws Throwable {
+ public void testFieldWithGetterReplacement() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_ALL, false, false, false);
}
- public void testFieldWithInaccessibleGetterReplacement() throws Throwable {
+ public void testFieldWithInaccessibleGetterReplacement() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
}
- public void testWeirdQualifier() throws Throwable {
+ public void testWeirdQualifier() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
}
- public void testSuperInExpression() throws Throwable {
+ public void testSuperInExpression() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, "Parameter initializer contains <b><code>super</code></b>, but not all calls to method are in its class.");
}
- public void testWeirdQualifierAndParameter() throws Throwable {
+ public void testWeirdQualifierAndParameter() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
}
- public void testImplicitSuperCall() throws Throwable {
+ public void testImplicitSuperCall() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
}
- public void testImplicitDefaultConstructor() throws Throwable {
+ public void testImplicitDefaultConstructor() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
}
- public void testInternalSideEffect() throws Throwable {
+ public void testInternalSideEffect() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
}
-/* public void testAnonymousClass() throws Throwable {
+/* public void testAnonymousClass() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false);
}*/
- public void testSuperWithSideEffect() throws Throwable {
+ public void testSuperWithSideEffect() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, false, "Parameter initializer contains <b><code>super</code></b>, but not all calls to method are in its class.");
}
- public void testConflictingField() throws Throwable {
+ public void testConflictingField() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, true, false);
}
- /*public void testParameterJavaDoc1() throws Throwable {
+ /*public void testParameterJavaDoc1() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true);
}
- public void testParameterJavaDoc2() throws Throwable {
+ public void testParameterJavaDoc2() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true);
}
- public void testParameterJavaDoc3() throws Throwable {
+ public void testParameterJavaDoc3() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true);
}
- public void testParameterJavaDocBeforeVararg() throws Throwable {
+ public void testParameterJavaDocBeforeVararg() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_INACCESSIBLE, false, false, true);
}*/
- public void testRemoveParameterInHierarchy() throws Throwable {
+ public void testRemoveParameterInHierarchy() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false);
}
- /*public void testRemoveParameterWithJavadoc() throws Throwable {
+ /*public void testRemoveParameterWithJavadoc() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, true, false, false);
}*/
- public void testVarargs() throws Throwable { // IDEADEV-16828
+ public void testVarargs() { // IDEADEV-16828
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
- public void testMethodUsageInThisMethodInheritor() throws Throwable {
+ public void testMethodUsageInThisMethodInheritor() {
doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false);
}
+
+ public void testIntroduceConstantField() {
+ doTest(IntroduceParameterRefactoring.REPLACE_FIELDS_WITH_GETTERS_NONE, false, false, false)
+ }
}
--- /dev/null
+Foo.func(MySingleton.INSTANCE)
--- /dev/null
+Foo.func()
--- /dev/null
+class Foo {
+ static void func() {
+ System.out.println(<selection>MySingleton.INSTANCE</selection>);
+ }
+}
+
+public class MySingleton {
+ public static final MySingleton INSTANCE = new MySingleton();
+}
annotationProcessorDirectory = "target/generated-sources/annotations";
}
+ Map<String, String> options = myMavenProject.getAnnotationProcessorOptions();
+
List<String> processors = myMavenProject.getDeclaredAnnotationProcessors();
- if (processors == null && "target/generated-sources/annotations".equals(annotationProcessorDirectory)) {
+ if (processors == null && options.isEmpty() && "target/generated-sources/annotations".equals(annotationProcessorDirectory)) {
if (moduleProfile != null) {
compilerConfiguration.removeModuleProcessorProfile(moduleProfile);
}
if (moduleProfile == null) {
moduleProfile = new ProcessorConfigProfile(moduleProfileName);
moduleProfile.setEnabled(true);
+ moduleProfile.setObtainProcessorsFromClasspath(true);
moduleProfile.addModuleName(myModule.getName());
compilerConfiguration.addModuleProcessorProfile(moduleProfile);
}
moduleProfile.setGeneratedSourcesDirectoryName(annotationProcessorDirectory);
- if (processors == null) {
- moduleProfile.setObtainProcessorsFromClasspath(true);
+ moduleProfile.clearProcessorOptions();
+ for (Map.Entry<String, String> entry : options.entrySet()) {
+ moduleProfile.setOption(entry.getKey(), entry.getValue());
}
- else {
- moduleProfile.setObtainProcessorsFromClasspath(false);
+
+ moduleProfile.clearProcessors();
+
+ if (processors != null) {
for (String processor : processors) {
moduleProfile.addProcessor(processor);
}
*/
package org.jetbrains.idea.maven.project;
+import com.intellij.execution.configurations.ParametersList;
import com.intellij.openapi.module.ModuleType;
import com.intellij.openapi.module.StdModuleTypes;
import com.intellij.openapi.project.Project;
//private static Element getAnnotationProcessorsConfiguration(@Nullable Element compilerConfig) {
// return (compilerConfig == null) ? null : compilerConfig.getChild("annotationProcessors");
//}
-
+
+ public Map<String, String> getAnnotationProcessorOptions() {
+ Element compilerConfig = getCompilerConfig();
+
+ if (compilerConfig == null) return Collections.emptyMap();
+
+ Map<String, String> res = null;
+
+ String compilerArgument = compilerConfig.getChildText("compilerArgument");
+ if (!StringUtil.isEmptyOrSpaces(compilerArgument)) {
+ ParametersList parametersList = new ParametersList();
+ parametersList.addParametersString(compilerArgument);
+
+ for (String param : parametersList.getParameters()) {
+ if (param.startsWith("-A")) {
+ int idx = param.indexOf('=', 3);
+ if (idx >= 0) {
+ if (res == null) {
+ res = new LinkedHashMap<String, String>();
+ }
+
+ res.put(param.substring(2, idx), param.substring(idx + 1));
+ }
+ }
+ }
+ }
+
+ Element compilerArguments = compilerConfig.getChild("compilerArguments");
+ if (compilerArguments != null) {
+ for (Element e : (Collection<Element>)compilerArguments.getChildren()){
+ String name = e.getName();
+ if (name.length() > 1 && name.charAt(0) == 'A') {
+ if (res == null) {
+ res = new LinkedHashMap<String, String>();
+ }
+
+ res.put(name.substring(1), e.getTextTrim());
+ }
+ }
+ }
+
+ if (res == null) return Collections.emptyMap();
+
+ return res;
+ }
+
//private String getCompilerArgument() {
// return MavenJDOMUtil.findChildValueByPath(getCompilerConfig(), "compilerArgument");
//}
package org.jetbrains.idea.maven.wizards;
import com.intellij.ide.util.projectWizard.WizardContext;
+import com.intellij.openapi.application.ApplicationManager;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.projectImport.ProjectOpenProcessorBase;
import org.jetbrains.annotations.NotNull;
import java.util.List;
public class MavenProjectOpenProcessor extends ProjectOpenProcessorBase<MavenProjectBuilder> {
+
+ private static final Logger LOG = Logger.getInstance(MavenProjectOpenProcessor.class);
+
+ public static final String[] POM_XML = new String[]{MavenConstants.POM_XML};
+
public MavenProjectOpenProcessor(@NotNull MavenProjectBuilder builder) {
super(builder);
}
@Nullable
public String[] getSupportedExtensions() {
- return new String[]{MavenConstants.POM_XML};
+ return POM_XML;
+ }
+
+ @Override
+ public boolean canOpenProject(VirtualFile file) {
+ if (file.isDirectory()) {
+ long startTime = System.currentTimeMillis();
+
+ try {
+ return file.findChild(MavenConstants.POM_XML) != null;
+ }
+ finally {
+ long now = System.currentTimeMillis();
+
+ int limit = ApplicationManager.getApplication().isInternal() ? 100 : 500;
+
+ if (now - startTime > limit) {
+ LOG.error("Finding pom.xml got " + (now - startTime) + "ms. See IDEA-71265. " + file.getPath(), new Exception());
+ }
+ }
+ }
+ else {
+ if (MavenConstants.POM_XML.equals(file.getName())) {
+ return true;
+ }
+ }
+
+ return false;
}
public boolean doQuickImport(VirtualFile file, WizardContext wizardContext) {
</build>
""")
+ createModulePom("module4", """
+<groupId>test</groupId>
+<artifactId>module4</artifactId>
+<version>1</version>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <annotationProcessors>
+ </annotationProcessors>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+""")
+
importProject """
<groupId>test</groupId>
<artifactId>project</artifactId>
<version>1</version>
+<packaging>pom</packaging>
<modules>
<module>module1</module>
<module>module2</module>
<module>module3</module>
+ <module>module4</module>
</modules>
""";
def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE).getModuleNames() == new HashSet<String>(["project", "module1"])
- assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + 'module2').isObtainProcessorsFromClasspath() == false
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + 'module2').getProcessors() == new HashSet<String>(["com.test.SourceCodeGeneratingAnnotationProcessor2"])
+ assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + 'module3') == null
}
public void testOverrideGeneratedOutputDir() {
def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
- assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project").getGeneratedSourcesDirectoryName().endsWith("out/generated")
+ assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project").getGeneratedSourcesDirectoryName().replace('\\', '/').endsWith("out/generated")
+ }
+
+ public void testImportAnnotationProcessorOptions() {
+ importProject """
+<groupId>test</groupId>
+<artifactId>project</artifactId>
+<version>1</version>
+
+<build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <configuration>
+ <compilerArgument>-Aopt1=111 -Xmx512Mb -Aopt2=222</compilerArgument>
+ <compilerArguments>
+ <Aopt3>333</Aopt3>
+ <opt>666</opt>
+ </compilerArguments>
+ </configuration>
+ </plugin>
+ </plugins>
+</build>
+""";
+
+ def compilerConfiguration = ((CompilerConfigurationImpl)CompilerConfiguration.getInstance(myProject))
+
+ assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.MAVEN_DEFAULT_ANNOTATION_PROFILE) == null
+ assert compilerConfiguration.findModuleProcessorProfile(MavenModuleImporter.PROFILE_PREFIX + "project").getProcessorOptions() == ['opt1': '111', 'opt2': '222', 'opt3': '333']
}
}
import java.util.Arrays;
public class ResourceFilteringTest extends MavenImportingTestCase {
- @Override
- protected boolean runInDispatchThread() {
- return false;
- }
@Override
protected boolean runInWriteAction() {
@NotNull
@Override
public NodeDescriptor createDescriptor(Object element, NodeDescriptor parentDescriptor) {
- if (element == myTreeRoot) {
- return new TreeNodeDescriptor(parentDescriptor, element);
- }
- if (element instanceof RadComponent) {
- RadComponent component = (RadComponent)element;
+ if (element == myTreeRoot || element instanceof RadComponent) {
TreeNodeDescriptor descriptor = new TreeNodeDescriptor(parentDescriptor, element);
- descriptor.setWasDeclaredAlwaysLeaf(component.getTreeChildren().length == 0);
+ descriptor.setWasDeclaredAlwaysLeaf(isAlwaysLeaf(element));
return descriptor;
}
throw new IllegalArgumentException("Unknown element: " + element);
@Override
public boolean isAlwaysLeaf(Object element) {
- return element instanceof RadComponent && ((RadComponent)element).getChildren().isEmpty();
+ return element instanceof RadComponent && ((RadComponent)element).getTreeChildren().length == 0;
}
@Override
}
}
+ myTreeBuilder.queueUpdate();
hookSelection();
fireSelectionChanged();
}
public void run() {
if (file.getUserData(XML_FILE_WITH_XPATH_INJECTTION) == null) {
file.putUserData(XML_FILE_WITH_XPATH_INJECTTION, Boolean.TRUE);
- DaemonCodeAnalyzer.getInstance(file.getProject()).restart(file);
+ if (!ApplicationManager.getApplication().isUnitTestMode()) { // TODO workaround for highlighting tests
+ DaemonCodeAnalyzer.getInstance(file.getProject()).restart(file);
+ }
}
}
});
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaFieldNameIndex"/>
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaFullClassNameIndex"/>
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaMethodNameIndex"/>
+ <stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaStaticMemberNameIndex"/>
+ <stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaStaticMemberTypeIndex"/>
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaShortClassNameIndex"/>
<stubIndex implementation="com.intellij.psi.impl.java.stubs.index.JavaSuperClassNameOccurenceIndex"/>
--- /dev/null
+<component>
+ <actions>
+ <action id="CaptureMemorySnapShot" class="xcom.intellij.util.CaptureMemorySnapshotAction" text="Capture memory snapshot" description="Capture memory snapshot" icon="/actions/profileMemory.png" />
+ <action id="CaptureCPUUsageData" class="xcom.intellij.util.CaptureCPUUsageDataAction" text="Capture cpu usage data" description="Capture cpu usage data" icon="/actions/profuleCPU.png" />
+ <action id="ContextHelp" class="xcom.intellij.ide.actions.ContextHelpAction" text="Conte_xt Help" description="Show context help"/>
+ <action id="RunConfiguration" text="Select Run/Debug Configuration" description="Select Run/Debug Configuration" class="xcom.intellij.execution.actions.RunConfigurationAction"/>
+ <action id="ShowIntentionActions" text="Show Intention Actions" class="xcom.intellij.codeInsight.intention.actions.ShowIntentionActionsAction"/>
+ <action id="ToggleReadOnlyAttribute" text="Toggle Read-Only Attribute" description="Toggle read-only attribute of current file" class="xcom.intellij.ide.actions.ToggleReadOnlyAttributeAction"/>
+ <action id="TogglePopupHints" text="Toggle Popup Hints for Current File" class="xcom.intellij.ide.actions.TogglePopupHintsAction"/>
+ <action id="RunGc" text="Run Garbage Collector" class="xcom.intellij.ide.actions.RunGcAction"/>
+ <action id="ShowPopupMenu" text="Show Context Menu" class="xcom.intellij.ide.actions.ShowPopupMenuAction"/>
+ <action id="CloseWindow" text="Close Active Window" class="xcom.intellij.ide.actions.CloseWindowAction"/>
+
+ <action id="Vcs.ShowHistory" class="xcom.intellij.openapi.vcs.actions.FileHistoryAction" text="Show File History" description="Show history of file"/>
+ <action id="Vcs.ShowHistoryForBlock" class="xcom.intellij.openapi.vcs.actions.SelectedBlockHistoryAction" text="Show History _for Selection" description="Show history for editor selection"/>
+ <action id="Vcs.ShowTabbedFileHistory" class="xcom.intellij.openapi.vcs.actions.TabbedShowHistoryAction" text="_Show History" description="Show history of file"/>
+
+ <group id="RunContextGroup" popup="false">
+ <action id="CreateRunConfiguration" text="Create Run Configuration" description="Create run configuration from context" class="xcom.intellij.execution.actions.CreateAction"/>
+ </group>
+ <group id="RunContextPopupGroup" popup="false" text="Run Configurations">
+ <reference ref="RunContextGroup"/>
+ </group>
+ <!--Editor -->
+ <group id="EditorActions" text="Editor Actions">
+
+ <action id="EditorChooseLookupItem" class="xcom.intellij.codeInsight.lookup.impl.actions.ChooseItemAction" text="Choose Lookup Item"/>
+ <action id="EditorChooseLookupItemReplace" class="xcom.intellij.codeInsight.lookup.impl.actions.ChooseItemReplaceAction" text="Choose Lookup Item Replace"/>
+
+ <action id="NextTemplateVariable" text="Next Template Variable" class="xcom.intellij.codeInsight.template.impl.actions.NextVariableAction"/>
+ <action id="PreviousTemplateVariable" text="Previous Template Variable" class="xcom.intellij.codeInsight.template.impl.actions.PreviousVariableAction"/>
+
+ <action id="NextParameter" text="Next Parameter" class="xcom.intellij.codeInsight.hint.actions.NextParameterAction"/>
+ <action id="PrevParameter" text="Prev Parameter" class="xcom.intellij.codeInsight.hint.actions.PrevParameterAction"/>
+
+ <action id="EditorPageUp" class="xcom.intellij.openapi.editor.actions.PageUpAction" text="Page Up"/>
+ <action id="EditorPageDown" class="xcom.intellij.openapi.editor.actions.PageDownAction" text="Page Down"/>
+ <action id="EditorPageUpWithSelection" class="xcom.intellij.openapi.editor.actions.PageUpWithSelectionAction" text="Page Up with Selection"/>
+ <action id="EditorPageDownWithSelection" class="xcom.intellij.openapi.editor.actions.PageDownWithSelectionAction" text="Page Up with Selection"/>
+ <action id="EditorCopy" class="xcom.intellij.openapi.editor.actions.CopyAction" text="Copy"/>
+ <action id="EditorCut" class="xcom.intellij.openapi.editor.actions.CutAction" text="Cut"/>
+ <action id="EditorPaste" class="xcom.intellij.openapi.editor.actions.PasteAction" text="Paste"/>
+ <action id="EditorPasteFromX11" class="xcom.intellij.openapi.editor.actions.PasteFromX11Action" text="Paste from X clipboard"/>
+ <action id="EditorDelete" class="xcom.intellij.openapi.editor.actions.DeleteAction" text="Delete"/>
+ <action id="EditorBackSpace" class="xcom.intellij.openapi.editor.actions.BackspaceAction" text="Backspace"/>
+ <action id="EditorMoveToPageTop" class="xcom.intellij.openapi.editor.actions.PageTopAction" text="Move Caret to Page Top"/>
+ <action id="EditorMoveToPageBottom" class="xcom.intellij.openapi.editor.actions.PageBottomAction" text="Move Caret to Page Bottom"/>
+ <action id="EditorMoveToPageTopWithSelection" class="xcom.intellij.openapi.editor.actions.PageTopWithSelectionAction" text="Move Caret to Page Top with Selection"/>
+ <action id="EditorMoveToPageBottomWithSelection" class="xcom.intellij.openapi.editor.actions.PageBottomWithSelectionAction" text="Move Caret to Page Bottom with Selection"/>
+ <action id="EditorEnter" class="xcom.intellij.openapi.editor.actions.EnterAction" text="Enter"/>
+ <action id="EditorEscape" class="xcom.intellij.openapi.editor.actions.EscapeAction" text="Escape"/>
+ <action id="EditorUp" class="xcom.intellij.openapi.editor.actions.MoveCaretUpAction" text="Up"/>
+ <action id="EditorDown" class="xcom.intellij.openapi.editor.actions.MoveCaretDownAction" text="Down"/>
+ <action id="EditorLeft" class="xcom.intellij.openapi.editor.actions.MoveCaretLeftAction" text="Left"/>
+ <action id="EditorRight" class="xcom.intellij.openapi.editor.actions.MoveCaretRightAction" text="Right"/>
+ <action id="EditorUpWithSelection" class="xcom.intellij.openapi.editor.actions.MoveCaretUpWithSelectionAction" text="Up with Selection"/>
+ <action id="EditorDownWithSelection" class="xcom.intellij.openapi.editor.actions.MoveCaretDownWithSelectionAction" text="Down with Selection"/>
+ <action id="EditorLeftWithSelection" class="xcom.intellij.openapi.editor.actions.MoveCaretLeftWithSelectionAction" text="Left with Selection"/>
+ <action id="EditorRightWithSelection" class="xcom.intellij.openapi.editor.actions.MoveCaretRightWithSelectionAction" text="Right with Selection"/>
+ <action id="EditorIndentSelection" class="xcom.intellij.openapi.editor.actions.IndentSelectionAction" text="Indent Selection"/>
+ <action id="EditorUnindentSelection" class="xcom.intellij.openapi.editor.actions.UnindentSelectionAction" text="Unindent Selection"/>
+ <action id="EditorTab" class="xcom.intellij.openapi.editor.actions.TabAction" text="Tab"/>
+ <action id="EmacsStyleIndent" class="xcom.intellij.openapi.editor.actions.EmacsStyleIndentAction" text="Emacs Tab"/>
+ <action id="EditorScrollUp" class="xcom.intellij.openapi.editor.actions.ScrollUpAction" text="Scroll Up"/>
+ <action id="EditorScrollDown" class="xcom.intellij.openapi.editor.actions.ScrollDownAction" text="Scroll Down"/>
+ <action id="EditorMoveUpAndScroll" class="xcom.intellij.openapi.editor.actions.MoveUpAndScrollAction" text="Move Up and Scroll"/>
+ <action id="EditorMoveDownAndScroll" class="xcom.intellij.openapi.editor.actions.MoveDownAndScrollAction" text="Move Down and Scroll"/>
+ <action id="EditorMoveUpAndScrollWithSelection" class="xcom.intellij.openapi.editor.actions.MoveUpWithSelectionAndScrollAction" text="Move Up and Scroll with Selection"/>
+ <action id="EditorMoveDownAndScrollWithSelection" class="xcom.intellij.openapi.editor.actions.MoveDownWithSelectionAndScrollAction" text="Move Down and Scroll with Selection"/>
+ <action id="EditorLineStart" class="xcom.intellij.openapi.editor.actions.LineStartAction" text="Move Caret to Line Start"/>
+ <action id="EditorLineEnd" class="xcom.intellij.openapi.editor.actions.LineEndAction" text="Move Caret to Line End"/>
+ <action id="EditorCutLineEnd" class="xcom.intellij.openapi.editor.actions.CutLineEndAction" text="Cut up to Line End"/>
+ <action id="EditorTextStart" class="xcom.intellij.openapi.editor.actions.TextStartAction" text="Move Caret to Text Start"/>
+ <action id="EditorTextEnd" class="xcom.intellij.openapi.editor.actions.TextEndAction" text="Move Caret to Text End"/>
+ <action id="EditorLineStartWithSelection" class="xcom.intellij.openapi.editor.actions.LineStartWithSelectionAction" text="Move Caret to Line Start with Selection"/>
+ <action id="EditorLineEndWithSelection" class="xcom.intellij.openapi.editor.actions.LineEndWithSelectionAction" text="Move Caret to Line End with Selection"/>
+ <action id="EditorTextStartWithSelection" class="xcom.intellij.openapi.editor.actions.TextStartWithSelectionAction" text="Move Caret to Text Start with Selection"/>
+ <action id="EditorTextEndWithSelection" class="xcom.intellij.openapi.editor.actions.TextEndWithSelectionAction" text="Move Caret to Text End with Selection"/>
+ <action id="EditorNextWord" class="xcom.intellij.openapi.editor.actions.NextWordAction" text="Move Caret to Next Word"/>
+ <action id="EditorPreviousWord" class="xcom.intellij.openapi.editor.actions.PreviousWordAction" text="Move Caret to Previous Word"/>
+ <action id="EditorNextWordWithSelection" class="xcom.intellij.openapi.editor.actions.NextWordWithSelectionAction" text="Move Caret to Next Word with Selection"/>
+ <action id="EditorPreviousWordWithSelection" class="xcom.intellij.openapi.editor.actions.PreviousWordWithSelectionAction" text="Move Caret to Previous Word with Selection"/>
+ <action id="EditorCodeBlockStart" class="xcom.intellij.codeInsight.editorActions.CodeBlockStartAction" text="Move Caret to Code Block Start"/>
+ <action id="EditorCodeBlockEnd" class="xcom.intellij.codeInsight.editorActions.CodeBlockEndAction" text="Move Caret to Code Block End"/>
+ <action id="EditorCodeBlockStartWithSelection" class="xcom.intellij.codeInsight.editorActions.CodeBlockStartWithSelectionAction" text="Move Caret to Code Block Start with Selection"/>
+ <action id="EditorCodeBlockEndWithSelection" class="xcom.intellij.codeInsight.editorActions.CodeBlockEndWithSelectionAction" text="Move Caret to Code Block End with Selection"/>
+ <action id="EditorDeleteToWordStart" class="xcom.intellij.openapi.editor.actions.DeleteToWordStartAction" text="Delete to Word Start"/>
+ <action id="EditorDeleteToWordEnd" class="xcom.intellij.openapi.editor.actions.DeleteToWordEndAction" text="Delete to Word End"/>
+ <action id="EditorDeleteLine" class="xcom.intellij.openapi.editor.actions.DeleteLineAtCaretAction" text="Delete Line at Caret"/>
+ <action id="EditorDuplicate" class="xcom.intellij.openapi.editor.actions.DuplicateAction" text="Duplicate Line or Block"/>
+ <action id="EditorSelectWord" class="xcom.intellij.openapi.editor.actions.SelectWordAtCaretAction" text="Select Word at Caret"/>
+ <action id="EditorUnSelectWord" class="xcom.intellij.openapi.editor.actions.UnselectWordAtCaretAction" text="Unselect Word at Caret"/>
+ <action id="EditorToggleInsertState" class="xcom.intellij.openapi.editor.actions.ToggleInsertStateAction" text="Toggle Insert/Overwrite"/>
+ <action id="EditorToggleColumnMode" class="xcom.intellij.openapi.editor.actions.ToggleColumnModeAction" text="Column Mode" description="Toggle editor column mode"/>
+ <action id="EditorToggleShowWhitespaces" class="xcom.intellij.openapi.editor.actions.ToggleShowWhitespacesAction" text="Sh_ow Whitespaces" description="Toggle display whitespaces in current editor"/>
+ <action id="EditorToggleShowLineNumbers" class="xcom.intellij.openapi.editor.actions.ToggleShowLineNumbersAction" text="Show Line _Numbers" description="Toggle display line numbers in current editor"/>
+ <action id="EditorScrollToCenter" class="xcom.intellij.openapi.editor.actions.ScrollToCenterAction" text="Scroll to Center"/>
+ <action id="EditorToggleCase" class="xcom.intellij.openapi.editor.actions.ToggleCaseAction" text="Toggle Case"/>
+ <action id="EditorJoinLines" class="xcom.intellij.openapi.editor.actions.JoinLinesAction" text="Join Lines"/>
+ <action id="EditorSelectLine" class="xcom.intellij.openapi.editor.actions.SelectLineAction" text="Select Line at Caret"/>
+ <action id="EditorSplitLine" class="xcom.intellij.openapi.editor.actions.SplitLineAction" text="Split Line"/>
+ <action id="EditorStartNewLine" class="xcom.intellij.openapi.editor.actions.StartNewLineAction" text="Start New Line"/>
+ <action id="EditorCompleteStatement" class="xcom.intellij.codeInsight.editorActions.smartEnter.SmartEnterAction" text="Complete Current Statement"/>
+ </group>
+
+ <action id="ExpandAll" class="xcom.intellij.ide.actions.ExpandAllAction" text="Expand All" icon="/actions/expandall.png"/>
+ <action id="CollapseAll" class="xcom.intellij.ide.actions.CollapseAllAction" text="Collapse All" icon="/actions/collapseall.png"/>
+ <action id="ExportToTextFile" class="xcom.intellij.ide.actions.ExportToTextFileAction" text="Export to Text File" icon="/actions/export.png"/>
+ <action id="ExpandTreeNode" text="Expand Tree Node" class="xcom.intellij.ide.actions.tree.ExpandTreeNodeAction"/>
+ <action id="CollapseTreeNode" text="Collapse Tree Node" class="xcom.intellij.ide.actions.tree.CollapseTreeNodeAction"/>
+ <action id="FullyExpandTreeNode" text="Fully Expand Tree Node" class="xcom.intellij.ide.actions.tree.FullyExpandTreeNodeAction"/>
+
+ <group id="J2EEGenerateGroup">
+ <action id="CreateSessionBean" text="_Session Bean" class="xcom.intellij.javaee.module.view.ejb.actions.CreateSessionBeanAction" icon="/nodes/ejbSession.png"/>
+ <action id="CreateContainerManagedEntityBeanAction" text="_CMP Entity Bean" class="xcom.intellij.javaee.module.view.ejb.actions.CreateCMPEntityBeanAction" icon="/nodes/ejbEntity.png"/>
+ <action id="CreateBeanManagedEntityBeanAction" text="_BMP Entity Bean" class="xcom.intellij.javaee.module.view.ejb.actions.CreateBMPEntityBeanAction" icon="/nodes/ejbEntity.png"/>
+ <action id="CreateMessageBean" text="_Message Bean" class="xcom.intellij.javaee.module.view.ejb.actions.CreateMessageBeanAction" icon="/nodes/ejbMessage.png"/>
+ <action id="CreateTransferObject" text="_Transfer Object" class="xcom.intellij.javaee.module.view.ejb.actions.CreateTransferObjectAction" icon="/nodes/class.png"/>
+ <action id="CreateCMPField" text="_CMP Field" class="xcom.intellij.javaee.module.view.ejb.actions.CreateCmpFieldAction" icon="/nodes/ejbCmpField.png"/>
+ <action id="CreateEJBRelationship" text="EJB _Relationship" class="xcom.intellij.javaee.module.view.ejb.actions.CreateEjbRelationshipAction" icon="/nodes/ejbCmrField.png"/>
+
+ <action id="CreateJSPAction" text="_Jsp" class="xcom.intellij.javaee.module.view.web.CreateJspAction" description="Create new JSP file in this directory" icon="/fileTypes/jsp.png"/>
+ <action id="CreateServletAction" text="_Servlet" class="xcom.intellij.javaee.module.view.web.servlet.CreateServletAction" description="Create new Servlet" icon="/nodes/servlet.png"/>
+ <action id="CreateFilterAction" text="_Filter" class="xcom.intellij.javaee.module.view.web.filter.CreateFilterAction" description="Create new Servlet Filter" icon="/ant/filter.png"/>
+ </group>
+ <group id="GenerateGroup" text="_Generate">
+ <action id="GenerateConstructor" text="Constructor" class="xcom.intellij.codeInsight.generation.actions.GenerateConstructorAction"/>
+ <action id="GenerateGetter" text="Getter" class="xcom.intellij.codeInsight.generation.actions.GenerateGetterAction"/>
+ <action id="GenerateSetter" text="Setter" class="xcom.intellij.codeInsight.generation.actions.GenerateSetterAction"/>
+ <action id="GenerateGetterAndSetter" text="Getter and Setter" class="xcom.intellij.codeInsight.generation.actions.GenerateGetterAndSetterAction"/>
+ <action id="GenerateEquals" text="equals() and hashCode()" class="xcom.intellij.codeInsight.generation.actions.GenerateEqualsAction"/>
+ <action id="OverrideMethods" class="xcom.intellij.codeInsight.generation.actions.OverrideMethodsAction" text="_Override Methods..." description="Override base class methods in the current class"/>
+ <action id="ImplementMethods" class="xcom.intellij.codeInsight.generation.actions.ImplementMethodsAction" text="_Implement Methods..." description="Implement base interface/class methods in the current class"/>
+ <action id="GenerateSuperMethodCall" text="super method call" class="xcom.intellij.codeInsight.generation.actions.GenerateSuperMethodCallAction"/>
+ </group>
+
+ <action id="NextDiff" class="xcom.intellij.openapi.diff.actions.NextDiffAction" text="Move to the next difference" description="Move to the next difference" icon="/actions/moveDown.png"/>
+ <action id="PreviousDiff" class="xcom.intellij.openapi.diff.actions.PreviousDiffAction" text="Move to the previous difference" description="Move to the previous difference" icon="/actions/moveUp.png"/>
+
+ <action id="CheckinProject" class="xcom.intellij.openapi.vcs.actions.CommonCheckinProjectAction" text="Check In Project">
+ <keyboard-shortcut first-keystroke="control K" keymap="$default"/>
+ </action>
+ <action id="CheckinFiles" class="xcom.intellij.openapi.vcs.actions.CommonCheckinFilesAction" text="Check In"/>
+ <action id="UpdateFiles" class="xcom.intellij.openapi.vcs.update.CommonUpdateFileOrDirectoryAction" text="Update"/>
+ <action id="CheckStatusForFiles" class="xcom.intellij.openapi.vcs.update.CommonStatusFileOrDirectoryAction" text="Check Status"/>
+
+ <group id="NewGroup" text="New" popup="true">
+ <action id="NewClass" text="Class" class="xcom.intellij.ide.actions.CreateClassAction"/>
+ <action id="NewInterface" text="Interface" class="xcom.intellij.ide.actions.CreateInterfaceAction"/>
+ <action id="NewEnum" text="Enum" class="xcom.intellij.ide.actions.CreateEnumAction"/>
+ <action id="NewAnnotationType" text="@Interface" class="xcom.intellij.ide.actions.CreateAnnotationTypeAction"/>
+ <action id="NewFile" text="File" class="xcom.intellij.ide.actions.CreateFileAction"/>
+ <action id="NewDir" text="Directory/Package" class="xcom.intellij.ide.actions.CreateDirectoryOrPackageAction"/>
+ <separator/>
+ <action id="NewFromTemplate" text="From Template" class="xcom.intellij.ide.fileTemplates.actions.CreateFromTemplateGroup"/>
+ <separator/>
+ <action id="NewDialog" text="Dialog" class="xcom.intellij.uiDesigner.actions.CreateDialogAction"/>
+ <separator/>
+ <reference ref="J2EEGenerateGroup"/>
+ </group>
+
+ <action id="CompareTwoFiles" class="xcom.intellij.openapi.diff.actions.CompareFiles" text="Compare Two _Files" description="Compare two selected files"/>
+ <action id="CompareFileWithEditor" class="xcom.intellij.openapi.diff.actions.CompareFileWithEditor" text="Co_mpare File with Editor" description="Compare selected file with editor"/>
+
+ <group id="VcsGroups" class="xcom.intellij.openapi.vcs.actions.VcsActionGroup" text="Version Control" popup="true">
+
+ <group class="xcom.intellij.openapi.vcs.actions.VcsActionGroup" id="VcsGlobalGroup" test="Version Control" text="Version Control">
+ <action id="Vcs.FileView" class="xcom.intellij.openapi.vcs.actions.FileViewAction" text="Show File _View" description="Show version control related information for all local files"/>
+ <reference ref="CheckinProject"/>
+ <action id="Vcs.UpdateProject" class="xcom.intellij.openapi.vcs.update.CommonUpdateProjectAction" text="Update Project">
+ <keyboard-shortcut first-keystroke="control T" keymap="$default"/>
+ </action>
+ <action id="Vcs.ProjectStatus" class="xcom.intellij.openapi.vcs.update.CommonStatusProjectAction" text="Check Project Status">
+ </action>
+ </group>
+
+ <separator/>
+ <action id="Vcs.MarkSourcesAsCurrent" class="xcom.intellij.openapi.vcs.actions.MarkSourcesAsCurrent" text="Mark Project as Current" description="Mark sources as up-to-date"/>
+ </group>
+ <group class="xcom.intellij.openapi.vcs.actions.VcsActionGroup" id="VcsGroup" test="Version Control" text="Version Control"/>
+
+ <group id="VssGlobalGroup"
+ class="xcom.intellij.vssSupport.actions.VssGroup"
+ text="SourceSa_fe"
+ test="SourceSafe"
+ popup="true" >
+ <add-to-group group-id="VcsGroups" anchor="last"/>
+ <action id="Vss.RunExplorer" class="xcom.intellij.vssSupport.actions.RunExplorerAction" text="Open SourceSafe _Explorer" description="Open SourceSafe explorer"/>
+ </group>
+
+ <group id="VssFilePopupGroup"
+ class="xcom.intellij.vssSupport.actions.VssGroup"
+ text="SourceSa_fe"
+ test="SourceSafe"
+ popup="true" >
+ <add-to-group group-id="VcsGroup" anchor="last"/>
+ </group>
+
+
+ <group id="VssGroup">
+ <add-to-group group-id="VssGlobalGroup" anchor="last"/>
+ <add-to-group group-id="VssFilePopupGroup" anchor="last"/>
+ <action id="Vss.Checkout" class="xcom.intellij.vssSupport.actions.CheckoutAction" text="Check _Out..." description="Check out the file(s) from SourceSafe database for editing"/>
+ <action id="Vss.Checkin" class="xcom.intellij.vssSupport.actions.CheckinAction" text="Check _In..." description="Update SourceSafe database with changes made to the checked out file(s)"/>
+ <action id="Vss.Add" class="xcom.intellij.vssSupport.actions.AddAction" text="_Add File..." description="Add new file to the SourceSafe database"/>
+ <action id="Vss.Undocheckout" class="xcom.intellij.vssSupport.actions.UndocheckoutAction" text="_Undo Check Out..." description="Cancel a check out, voiding all changes"/>
+ <separator/>
+ <action id="Vss.Diff" class="xcom.intellij.vssSupport.actions.DiffAction"
+ text="_Compare with SourceSafe Version..."
+ description="Compare SourceSafe and local version of file"/>
+
+ <action id="Vss.Get"
+ class="xcom.intellij.vssSupport.actions.GetAction"
+ text="_Get Latest Version..."
+ description="Retrieve the most recent version of the file(s)"/>
+ </group>
+
+ <group class="xcom.intellij.openapi.vcs.actions.VcsGroupsWrapper" id="VcsFileGroupPopup" test="Version Control"
+ text="Version Control" popup="true">
+ </group>
+
+ <group id="VersionControlsGroup">
+ <group id="LocalVcsGroup" class="xcom.intellij.localVcs.actions.LocalVcsGroup" text="Local _History" popup="true">
+ <action id="LocalVcs.ShowHistory" class="xcom.intellij.localVcs.actions.ShowHistoryAction" text="Show _History" description="Show local history"/>
+ <action id="LocalVcs.HistoryForBlock" class="xcom.intellij.localVcs.actions.HistoryForSelectedBlockAction" text="Show History for _Selection" description="Show local history for editor selection"/>
+ <action id="LocalVcs.AddLabel" class="xcom.intellij.localVcs.actions.AddLabelAction" text="Add _Label..." description="Add label"/>
+ </group>
+ <reference ref="VcsFileGroupPopup"/>
+ </group>
+
+ <group id="MainMenu">
+
+ <!-- File -->
+ <group text="_File" id="FileMenu">
+ <action id="NewProject" class="xcom.intellij.ide.actions.NewProjectAction" text="_New Project..." description="Create a new project"/>
+ <action id="NewModule" class="xcom.intellij.openapi.roots.ui.configuration.actions.NewModuleAction" text="New _Module..." description="Add new module to the project"/>
+ <action id="OpenProject" class="xcom.intellij.ide.actions.OpenProjectAction" text="_Open Project..." description="Open an existing project"/>
+ <action id="OpenFile" class="xcom.intellij.ide.actions.OpenFileAction" text="_Open File..." icon="/actions/menu-open.png" description="Open file in editor"/>
+ <group id="$LRU" class="xcom.intellij.ide.actions.RecentProjectsGroup" text="_Reopen" popup="true" description="List of recently opened projects"/>
+ <action id="CloseProject" class="xcom.intellij.ide.actions.CloseProjectAction" text="Close Pro_ject" description="Close current project"/>
+
+ <separator/>
+ <action id="ShowSettings" class="xcom.intellij.ide.actions.ShowSettingsAction" text="Se_ttings" icon="/general/ideOptions.png" description="Configure application and current project settings"/>
+ <action id="TemplateProjectProperties" class="xcom.intellij.ide.actions.TemplateProjectPropertiesAction" text="Templ_ate Project Settings" description="Configure template settings for all new projects"/>
+ <separator/>
+ <action id="SaveAll" class="xcom.intellij.ide.actions.SaveAllAction" text="_Save All" icon="/actions/menu-saveall.png" description="Save all files and settings"/>
+ <action id="ExportSettings" class="xcom.intellij.ide.actions.ExportSettingsAction" text="_Export Settings..." description="Export global settings"/>
+ <action id="ImportSettings" class="xcom.intellij.ide.actions.ImportSettingsAction" text="_Import Settings..." description="Import global settings"/>
+ <action id="Synchronize" class="xcom.intellij.ide.actions.SynchronizeAction" text="S_ynchronize" icon="/actions/sync.png" description="Detect all externally changed files and reload them from disk"/>
+ <action id="ReloadFromDisk" class="xcom.intellij.ide.actions.ReloadFromDiskAction" text="Reload from Dis_k" description="Reload current file from disk and lose all changes"/>
+ <separator/>
+ <action id="ExportToHTML" class="xcom.intellij.codeEditor.printing.ExportToHTMLAction" text="Export to _HTML..." description="Save file content in HTML format with syntax coloring"/>
+ <action id="Print" class="xcom.intellij.codeEditor.printing.PrintAction" text="_Print..." description="Print file"/>
+ <separator/>
+ <action id="Exit" class="xcom.intellij.ide.actions.ExitAction" text="E_xit" description="Quit IDEA"/>
+ </group>
+
+ <!-- Edit -->
+ <group text="_Edit" id="EditMenu">
+ <action id="$Undo" class="xcom.intellij.ide.actions.UndoAction" text="_Undo" icon="/actions/undo.png" description="Undo last operation"/>
+ <action id="$Redo" class="xcom.intellij.ide.actions.RedoAction" text="_Redo" icon="/actions/redo.png" description="Redo last undone operation"/>
+ <separator/>
+ <group id="CutCopyPasteGroup">
+ <action id="$Cut" class="xcom.intellij.ide.actions.CutAction" text="Cu_t" icon="/actions/menu-cut.png" description="Cut to clipboard"/>
+ <action id="$Copy" class="xcom.intellij.ide.actions.CopyAction" text="_Copy" icon="/actions/copy.png" description="Copy to clipboard"/>
+ <action id="CopyPaths" class="xcom.intellij.ide.actions.CopyPathsAction" text="C_opy Paths" description="Copy paths corresponding to selected files or directories to clipboard"/>
+ <action id="$Paste" class="xcom.intellij.ide.actions.PasteAction" text="_Paste" icon="/actions/menu-paste.png" description="Paste from clipboard"/>
+ <action id="PasteMultiple" class="xcom.intellij.openapi.editor.actions.MultiplePasteAction" text="Past_e..." description="Paste from recent clipboards"/>
+ <reference ref="EditorToggleColumnMode"/>
+ </group>
+ <separator/>
+ <action id="$SelectAll" class="xcom.intellij.ide.actions.SelectAllAction" text="Select _All" description="Select all"/>
+ <separator/>
+ <action id="NewElement" class="xcom.intellij.ide.actions.NewElementAction" text="_New..." description="Create new class, interface, file or directory"/>
+ <action id="$Delete" class="xcom.intellij.ide.actions.DeleteAction" text="_Delete" description="Delete selected item"/>
+ <separator/>
+ <action id="ToggleBookmark" class="xcom.intellij.ide.bookmarks.actions.ToggleBookmarkAction" text="Toggle _Bookmark" description="Toggle bookmark at the current location"/>
+ <action id="ShowBookmarks" class="xcom.intellij.ide.bookmarks.actions.ShowBookmarksAction" text="_Show Bookmarks" description="Show list of all bookmarks"/>
+ </group>
+
+ <!-- Search -->
+ <group text="_Search" id="SearchMenu">
+ <action id="Find" class="xcom.intellij.openapi.editor.actions.FindAction" text="_Find..." icon="/actions/menu-find.png" description="Find a string in active editor"/>
+ <action id="Replace" class="xcom.intellij.openapi.editor.actions.ReplaceAction" text="_Replace..." icon="/actions/menu-replace.png" description="Replace a string in active editor with another string"/>
+ <action id="FindNext" class="xcom.intellij.ide.actions.SearchAgainAction" text="Find _Next" description="Repeat the last Find/Replace operation"/>
+ <action id="FindPrevious" class="xcom.intellij.ide.actions.SearchBackAction" text="Find Pre_vious" description="Repeat the last Find/Replace operation in reverse direction"/>
+ <action id="FindWordAtCaret" class="xcom.intellij.openapi.editor.actions.FindWordAtCaretAction" text="Find _Word at Caret" description="Find next occurrence of the word at caret"/>
+ <action id="IncrementalSearch" class="xcom.intellij.codeInsight.navigation.actions.IncrementalSearchAction" text="Incrementa_l Search" description="Start incremental search (searches string as you type)"/>
+ <separator/>
+ <action id="FindUsages" class="xcom.intellij.find.actions.FindUsagesAction" text="Find _Usages..." description="Find usages of the symbol at caret"/>
+ <action id="FindUsagesInFile" class="xcom.intellij.find.actions.FindUsagesInFileAction" text="F_ind Usages in File..." description="Find usages of the symbol at caret in active editor"/>
+ <action id="HighlightUsagesInFile" class="xcom.intellij.codeInsight.highlighting.actions.HighlightUsagesAction" text="_Highlight Usages in File" description="Highlight usages of the symbol at caret in active editor"/>
+ <separator/>
+ <action id="FindInPath" class="xcom.intellij.find.actions.FindInPathAction" text="Find in _Path..." description="Find a string in multiple files"/>
+ <action id="ReplaceInPath" class="xcom.intellij.find.actions.ReplaceInPathAction" text="Repl_ace in Path..." description="Replace a string in multiple files with another string"/>
+ </group>
+
+ <!-- View -->
+ <group text="_View" id="ViewMenu">
+ <action id="ViewToolBar" class="xcom.intellij.ide.actions.ViewToolbarAction" text="_Toolbar" description="Show/hide the main toolbar"/>
+ <action id="ViewStatusBar" class="xcom.intellij.ide.actions.ViewStatusBarAction" text="_Status Bar" description="Show/hide the status bar"/>
+ <reference ref="EditorToggleShowWhitespaces"/>
+ <reference ref="EditorToggleShowLineNumbers"/>
+ <separator/>
+ <action id="ToggleFullScreenMode" class="xcom.intellij.ide.actions.ToggleFullScreenModeAction" text="F_ull Screen" description="Maximize window to full screen"/>
+ <separator/>
+ <group id="CodeEditorViewGroup" class="xcom.intellij.ide.actions.CodeEditorActionGroup">
+ <action id="FileStructurePopup" class="xcom.intellij.ide.actions.ViewStructureAction" text="_File Structure Popup" description="Popup structure of the current file for quick navigation"/>
+ <action id="SelectIn" class="xcom.intellij.ide.actions.SelectInAction" text="Se_lect In..." description="Select the current class or method in any view"/>
+ <action id="QuickJavaDoc" class="xcom.intellij.codeInsight.javadoc.actions.ShowQuickDocInfoAction" text="_Quick JavaDoc" description="Show a popup window with JavaDoc for the symbol at caret"/>
+ <action id="QuickImplementations" class="xcom.intellij.codeInsight.hint.actions.ShowImplementationsAction" text="Quick _Implementations" description="Show a popup window with the symbol (and its implementations) code"/>
+ <action id="ParameterInfo" class="xcom.intellij.codeInsight.hint.actions.ShowParameterInfoAction" text="_Parameter Info" description="Show parameters of the method call at caret"/>
+ <action id="EditorContextInfo" class="xcom.intellij.codeInsight.hint.actions.ShowContainerInfoAction" text="_Context Info" description="Show the current method or class declaration when it is not visible"/>
+ <action id="ShowErrorDescription" class="xcom.intellij.codeInsight.daemon.impl.actions.ShowErrorDescriptionAction" text="E_rror Description" description="Show description of error or warning at caret"/>
+ </group>
+ <separator/>
+ <group id="CommanderViewGroup" class="xcom.intellij.ide.actions.CommanderViewActionGroup">
+ <action id="CommanderSyncViews" class="xcom.intellij.ide.actions.SyncViewsAction" text="S_ynchronize Views" description="Synchronize both panels"/>
+ <action id="CommanderSwapPanels" class="xcom.intellij.ide.actions.SwapPanelsAction" text="Swap _Panels" description="Swap the panels"/>
+ <reference ref="CompareTwoFiles"/>
+ <reference ref="CompareFileWithEditor"/>
+ </group>
+ <separator/>
+ <group id="ProjectViewGroup" class="xcom.intellij.ide.projectView.actions.ProjectViewActionGroup">
+ <action id="ProjectViewChangeView" class="xcom.intellij.ide.projectView.actions.ChangeProjectViewAction" text="Change View" description="Choose Project, Sourcepath or Classpath tree in the Project View window"/>
+ </group>
+ <separator/>
+ <action id="EditSource" class="xcom.intellij.ide.actions.EditSourceAction" text="_Jump to Source" description="Open editor for the selected item and give focus to it"/>
+ <action id="ViewSource" class="xcom.intellij.ide.actions.ViewSourceAction" text="Sho_w Source" description="Open editor for the selected item"/>
+ <separator/>
+ <action id="ExternalJavaDoc" class="xcom.intellij.ide.actions.ExternalJavaDocAction" text="External Java_Doc" description="Open browser with JavaDoc for the selected item"/>
+ <action id="RecentFiles" class="xcom.intellij.ide.actions.ShowRecentFilesAction" text="Rece_nt Files..." description="Show list of recently edited files"/>
+
+ <action id="QuickChangeScheme" class="xcom.intellij.ide.actions.QuickChangeSchemesAction" text="_Quick Switch Scheme..." description="Change current code style scheme, color&fonts scheme, keymap or Look&Feel"/>
+ <separator/>
+ <action id="TypeHierarchy" class="xcom.intellij.ide.hierarchy.actions.BrowseTypeHierarchyAction" text="Type _Hierarchy" description="Browse hierarchy for the selected class"/>
+ <action id="MethodHierarchy" class="xcom.intellij.ide.hierarchy.actions.BrowseMethodHierarchyAction" text="_Method Hierarchy" description="Browse method hierarchy for the selected method"/>
+ <action id="CallHierarchy" class="xcom.intellij.ide.hierarchy.actions.BrowseCallHierarchyAction" text="Call Hierarch_y" description="Browse call hierarchy for the selected method"/>
+ <separator/>
+ <group id="FoldingGroup" class="xcom.intellij.codeInsight.folding.impl.actions.FoldingGroup" text="Foldin_g" popup="true">
+ <action id="ExpandRegion" class="xcom.intellij.codeInsight.folding.impl.actions.ExpandRegionAction" text="E_xpand" description="Expand folding region at caret"/>
+ <action id="CollapseRegion" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseRegionAction" text="_Collapse" description="Collapse folding region at caret"/>
+ <separator/>
+ <action id="ExpandAllRegions" class="xcom.intellij.codeInsight.folding.impl.actions.ExpandAllRegionsAction" text="_Expand All" description="Expand all folding regions"/>
+ <action id="CollapseAllRegions" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseAllRegionsAction" text="Collapse _All" description="Collapse all folding regions"/>
+ <separator/>
+ <action id="ExpandJavadocs" class="xcom.intellij.codeInsight.folding.impl.actions.ExpandJavadocsAction" text="Expand Java_docs" description="Expand all javadoc comments"/>
+ <action id="CollapseJavadocs" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseJavadocsAction" text="Collapse _Javadocs" description="Collapse all javadoc comments"/>
+ <separator/>
+ <action id="CollapseSelection" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseSelectionAction" text="Fold _Selection / Remove region" description="Fold selected block"/>
+ <action id="CollapseBlock" class="xcom.intellij.codeInsight.folding.impl.actions.CollapseBlockAction" text="Fold Code Block" description="Fold current code block"/>
+ </group>
+ </group>
+
+ <!-- Go to -->
+ <group text="_Go To" id="GoToMenu">
+ <action id="GotoClass" class="xcom.intellij.ide.actions.GotoClassAction" text="_Class..." description="Quickly navigate to a class by name"/>
+ <action id="GotoFile" class="xcom.intellij.ide.actions.GotoFileAction" text="_File..." description="Quickly navigate to a file by name"/>
+ <action id="GotoSymbol" class="xcom.intellij.ide.actions.GotoSymbolAction" text="_Symbol..." description="Quickly navigate to any symbol by name"/>
+ <action id="GotoLine" class="xcom.intellij.ide.actions.GotoLineAction" text="_Line..." description="Navigate to a line in editor by its number"/>
+ <separator/>
+ <action id="GotoDeclaration" class="xcom.intellij.codeInsight.navigation.actions.GotoDeclarationAction" text="_Declaration" description="Navigate to the declaration of the symbol at caret"/>
+ <action id="GotoDefinition" class="xcom.intellij.codeInsight.navigation.actions.GotoDefinitionAction" text="_Definition" description="Navigate to the definitions of the current value"/>
+ <action id="GotoUsage" class="xcom.intellij.codeInsight.navigation.actions.GotoUsageAction" text="_Usage" description="Navigate to the usages of the current value"/>
+ <action id="GotoImplementation" class="xcom.intellij.codeInsight.navigation.actions.GotoImplementationAction" text="I_mplementation(s)" description="Navigate to the implementation(s) of the selected class or method"/>
+ <action id="SmartGotoImplementation" class="xcom.intellij.codeInsight.navigation.actions.SmartGotoImplementationAction" text="_Called Implementation(s)" description="Navigate to the implementation(s) of the selected method"/>
+ <action id="GotoTypeDeclaration" class="xcom.intellij.codeInsight.navigation.actions.GotoTypeDeclarationAction" text="_Type Declaration" description="Navigate to the declaration of the symbol's type at caret"/>
+ <action id="GotoSuperMethod" class="xcom.intellij.codeInsight.navigation.actions.GotoSuperAction" text="S_uper Method" description="Navigate to the declaration of the method that current method overrides or implements"/>
+ <action id="GotoAspect" class="xcom.intellij.codeInsight.navigation.actions.GotoAspectAction" text="_Aspect" description="Navigate to the declaration of the advice, error or warning declaration that affects a join point at caret"/>
+ <separator/>
+ <action id="GotoNextError" class="xcom.intellij.codeInsight.daemon.impl.actions.GotoNextErrorAction" text="_Next Highlighted Error" description="Navigate to the next highlighted error in the active editor"/>
+ <action id="GotoPreviousError" class="xcom.intellij.codeInsight.daemon.impl.actions.GotoPreviousErrorAction" text="_Previous Highlighted Error" description="Navigate to the previous highlighted error in the active editor"/>
+ <separator/>
+ <action id="MethodDown" class="xcom.intellij.codeInsight.navigation.actions.MethodDownAction" text="N_ext Method" description="Navigate to the next method in the active editor"/>
+
+
+ <action id="MethodUp" class="xcom.intellij.codeInsight.navigation.actions.MethodUpAction" text="Prev_ious Method" description="Navigate to the previous method in the active editor"/>
+ <separator/>
+ <action id="GotoNextBookmark" class="xcom.intellij.ide.bookmarks.actions.NextBookmarkAction" text="Ne_xt Bookmark" description="Navigate to the next bookmark in the active editor"/>
+ <action id="GotoPreviousBookmark" class="xcom.intellij.ide.bookmarks.actions.PreviousBookmarkAction" text="P_revious Bookmark" description="Navigate to the previous bookmark in the active editor"/>
+ <separator/>
+ <action id="Back" class="xcom.intellij.ide.actions.BackAction" text="_Back" icon="/actions/back.png" description="Undo last navigation operation"/>
+ <action id="Forward" class="xcom.intellij.ide.actions.ForwardAction" text="For_ward" icon="/actions/forward.png" description="Redo last undone navigation operation"/>
+ <action id="JumpToLastChange" class="xcom.intellij.ide.actions.JumpToLastEditAction" text="La_st Edit Location" description="Move through the most recent change points"/>
+ <separator/>
+ <action id="PreviousOccurence" class="xcom.intellij.ide.actions.PreviousOccurenceAction" text="Previ_ous Occurrence" icon="/actions/previousOccurence.png" description="Navigate to the previous occurrence"/>
+ <action id="NextOccurence" class="xcom.intellij.ide.actions.NextOccurenceAction" text="Ne_xt Occurrence" icon="/actions/nextOccurence.png" description="Navigate to the next occurrence"/>
+ <separator/>
+ <action id="VcsShowNextChangeMarker" class="xcom.intellij.openapi.vcs.actions.ShowNextChangeMarkerAction" text="Go To Next Change" description="Next change" icon="/actions/nextOccurence.png"/>
+ <action id="VcsShowPrevChangeMarker" class="xcom.intellij.openapi.vcs.actions.ShowPrevChangeMarkerAction" text="Go To Prev Change" description="Prev change" icon="/actions/previousOccurence.png"/>
+ </group>
+
+ <!-- Code -->
+ <group id="CodeMenu" class="xcom.intellij.codeInsight.actions.CodeGroup" text="Co_de">
+ <reference ref="OverrideMethods"/>
+ <reference ref="ImplementMethods"/>
+ <action id="DelegateMethod" class="xcom.intellij.codeInsight.generation.actions.GenerateDelegateAction" text="_Delegate Methods..." description="Generate delegate method to a field/getter"/>
+ <separator/>
+ <action id="SurroundWith" class="xcom.intellij.codeInsight.generation.actions.SurroundWithAction" text="_Surround With..." description="Surround selected code fragment with if, while, try/catch or other construct"/>
+ <!-- Alt-Ins in Java code-->
+ <action id="Generate" text="_Generate..." description="Generate constructor, getter or setter method, or EJB components" class="xcom.intellij.codeInsight.generation.actions.GenerateAction"/>
+ <separator/>
+ <group id="CodeCompletionGroup" class="xcom.intellij.codeInsight.completion.actions.CodeCompletionGroup" text="_Complete Code" popup="true">
+ <action id="CodeCompletion" class="xcom.intellij.codeInsight.completion.actions.CodeCompletionAction" text="Basic" description="Complete code"/>
+ <action id="WordCompletion" class="xcom.intellij.codeInsight.completion.actions.WordCompletionAction" text="Complete Word" description="Complete word"/>
+ <action id="SmartTypeCompletion" class="xcom.intellij.codeInsight.completion.actions.SmartCodeCompletionAction" text="SmartType" description="Complete code basing on expected type"/>
+ <action id="ClassNameCompletion" class="xcom.intellij.codeInsight.completion.actions.ClassNameCompletionAction" text="Class Name" description="Complete class name and add import for it"/>
+ </group>
+ <separator/>
+ <action id="InsertLiveTemplate" class="xcom.intellij.codeInsight.template.impl.actions.ListTemplatesAction" text="Insert Live _Template..." description="Show popup list of live templates starting with the specified prefix"/>
+ <action id="SurroundWithLiveTemplate" class="xcom.intellij.codeInsight.template.impl.actions.SurroundWithTemplateAction" text="Surround with Live Tem_plate..." description="Surrounds the selection with one of the template"/>
+ <separator/>
+ <action id="CommentByLineComment" class="xcom.intellij.codeInsight.generation.actions.CommentByLineCommentAction" text="Comment with _Line Comment" description="Comment/uncomment current line or selected block with line comments"/>
+ <action id="CommentByBlockComment" class="xcom.intellij.codeInsight.generation.actions.CommentByBlockCommentAction" text="Comment with _Block Comment" description="Comment/uncomment code with block comments"/>
+ <action id="AutoIndentLines" class="xcom.intellij.codeInsight.generation.actions.AutoIndentLinesAction" text="_Auto-Indent Lines" description="Indent current line or selected block according to the code style settings"/>
+ </group>
+
+ <group id="AnalyzeMenu" text="Analy_ze" popup="true">
+ <action id="InspectCode" class="xcom.intellij.codeInspection.actions.CodeInspectionAction" text="_Inspect Code..." description="Inspect code"/>
+ <action id="ViewOfflineInspection" class="xcom.intellij.codeInspection.actions.ViewOfflineResultsAction" text="View _Offline Inspection Results..." description="Load offline inspection results"/>
+ <action id="ShowPackageDeps" class="xcom.intellij.packageDependencies.actions.AnalyzeDependenciesAction" text="Analyze _Dependencies..." description="Browse code choosen analysis item depends on" />
+ <action id="DupLocate" class="xcom.intellij.dupLocator.DuplocateAction" text="_Locate Duplicates..." description="Locate duplicate code in project" />
+ </group>
+
+ <!-- Refactor -->
+ <group id="RefactoringMenu" class="xcom.intellij.refactoring.actions.RefactoringGroup" text="_Refactor" popup="true">
+ <action id="RenameElement" class="xcom.intellij.refactoring.actions.RenameElementAction" text="_Rename..." description="Rename the selected symbol and correct all references"/>
+ <action id="ChangeSignature" class="xcom.intellij.refactoring.actions.ChangeSignatureAction" text="Change _Signature..." description="Change signature of the selected method or class and correct all references"/>
+ <action id="MakeMethodStatic" class="xcom.intellij.refactoring.actions.MakeStaticAction" text="Make Method S_tatic..." description="Convert method to static and correct all references"/>
+ <action id="ConvertToInstanceMethod" class="xcom.intellij.refactoring.actions.ConvertToInstanceMethodAction" text="C_onvert To Instance Method..." description="Convert static method to instance method and correct all references"/>
+ <separator/>
+ <action id="Move" class="xcom.intellij.refactoring.actions.MoveAction" text="_Move..." description="Move the selected class, package or static member to another package or class and correct all references"/>
+ <action id="CopyElement" class="xcom.intellij.ide.actions.CopyElementAction" text="C_opy..." description="Create a copy of the selected class, file(s) or directory(es)"/>
+ <action id="CloneElement" class="xcom.intellij.ide.actions.CloneElementAction" text="Clo_ne..." description="Create a copy of the selected class, file or directory in the same package/directory"/>
+ <action id="SafeDelete" class="xcom.intellij.refactoring.actions.SafeDeleteAction" text="Safe _Delete..." description="Delete the selected class, method or field, checking for usages"/>
+ <separator/>
+ <action id="ExtractMethod" class="xcom.intellij.refactoring.actions.ExtractMethodAction" text="E_xtract Method..." description="Turn the selected code fragment into a method"/>
+ <action id="MethodDuplicates" class="xcom.intellij.refactoring.actions.MethodDuplicatesAction" text="Replace Method Code Duplicates..." description="Finds code in current file that can be transformed into a call of selected method"/>
+ <action id="IntroduceVariable" class="xcom.intellij.refactoring.actions.IntroduceVariableAction" text="Introduce _Variable..." description="Put a result of the selected expression into a variable"/>
+ <action id="IntroduceField" class="xcom.intellij.refactoring.actions.IntroduceFieldAction" text="Introduce _Field..." description="Put a result of the selected expression into a field"/>
+ <action id="IntroduceConstant" class="xcom.intellij.refactoring.actions.IntroduceConstantAction" text="Introduce _Constant..." description="Replace selected expression with a constant (static final field)"/>
+ <action id="IntroduceParameter" class="xcom.intellij.refactoring.actions.IntroduceParameterAction" text="Introduce _Parameter..." description="Turn the selected expression into method parameter"/>
+ <separator/>
+ <action id="ExtractModule" class="xcom.intellij.refactoring.actions.ExtractModuleAction" text="Extract _Interface..." description="Extract interface from the selected class"/>
+ <action id="ExtractSuperclass" class="xcom.intellij.refactoring.actions.ExtractSuperclassAction" text="Extract S_uperclass..." description="Extract superclass from the selected class"/>
+ <action id="TurnRefsToSuper" class="xcom.intellij.refactoring.actions.TurnRefsToSuperAction" text="Use Interface _Where Possible..." description="Change usages of a class to those of its superclass or interface"/>
+ <action id="MembersPullUp" class="xcom.intellij.refactoring.actions.PullUpAction" text="Pu_ll Members Up..." description="Pull class members to superclass or implemented interface"/>
+ <action id="MemberPushDown" class="xcom.intellij.refactoring.actions.PushDownAction" text="Pus_h Members Down..." description="Push class members down to directly inheriting subclasses"/>
+ <action id="InheritanceToDelegation" class="xcom.intellij.refactoring.actions.InheritanceToDelegationAction" text="Replace Inheritance with Dele_gation..." description="Replace inheritance with delegation"/>
+ <separator/>
+ <action id="Inline" class="xcom.intellij.refactoring.actions.InlineAction" text="Inli_ne..." description="Inline the selected method or variable"/>
+ <action id="AnonymousToInner" class="xcom.intellij.refactoring.actions.AnonymousToInnerAction" text="Convert Anon_ymous to Inner..." description="Convert anonymous class into an inner class"/>
+ <action id="EncapsulateFields" class="xcom.intellij.refactoring.actions.EncapsulateFieldsAction" text="_Encapsulate Fields..." description="Replace direct access to fields in the selected class with use of accessor methods"/>
+ <action id="ReplaceTempWithQuery" class="xcom.intellij.refactoring.actions.TempWithQueryAction" text="Replace Temp with _Query..." description="Turn the selected variable into a method"/>
+ <action id="ReplaceConstructorWithFactory" class="xcom.intellij.refactoring.actions.ReplaceConstructorWithFactoryAction" text="Replace Constructor with F_actory Method..." description="Create a static factory method and use it instead of a constructor"/>
+ <separator/>
+ <action id="Generify" class="xcom.intellij.refactoring.actions.TypeCookAction" text="Generify..." description="Convert your code to use generic types"/>
+ <action id="Type Migration" class="xcom.intellij.refactoring.actions.TypeMigrationAction" text="Type Migration..." description="Migrate one type to another"/>
+ <separator/>
+ <action id="ExtractInclude" class="xcom.intellij.refactoring.actions.ExtractIncludeAction" text="Extract Include File..." description="Turn the selected code fragment into included file"/>
+ </group>
+
+ <!-- Build -->
+ <group text="_Build" id="BuildMenu">
+ <action id="CompileProject" class="xcom.intellij.compiler.actions.CompileProjectAction" text="_Rebuild Project" description="Recompile all files in the project"/>
+ <action id="CompileDirty" class="xcom.intellij.compiler.actions.CompileDirtyAction" text="Make _Project" icon="/actions/compile.png" description="Compile all modified and dependent files in the project"/>
+ <action id="MakeModule" class="xcom.intellij.compiler.actions.MakeModuleAction" text="Make _Module" description="Compile all modified and dependent files in the module"/>
+ <action id="Compile" class="xcom.intellij.compiler.actions.CompileAction" text="_Compile" description="Compile the selected file or package"/>
+ <separator/>
+ <action id="GenerateAntBuild" class="xcom.intellij.compiler.actions.GenerateAntBuildAction" text="_Generate Ant Build" description="Generate Ant Build File from the Project"/>
+ <separator/>
+ <group id="AntBuildGroup" class="xcom.intellij.ant.actions.AntBuildGroup"/>
+ </group>
+
+
+ <group text="R_un" id="RunMenu">
+ <group id="RunnerActions" text="Run/Debug" />
+ <action id="editRunConfigurations" text="Edit Configurations" class="xcom.intellij.execution.actions.EditRunConfigurationsAction" description="Open edit Run/Debug configurations dialog"/>
+ <action id="Stop" text="Stop" class="xcom.intellij.execution.actions.StopAction" description="Stop process" icon="/actions/suspend.png"/>
+ <action id="Hotswap" class="xcom.intellij.debugger.actions.HotSwapAction" text="_Reload Changed Classes" description="Reload all changed classes into application being debugged (HotSwap)"/>
+ <separator/>
+ <action id="StepOver" class="xcom.intellij.debugger.actions.StepOverAction" text="Step _Over" icon="/actions/traceOver.png" description="Step to the next line in this file"/>
+ <action id="StepInto" class="xcom.intellij.debugger.actions.StepIntoAction" text="Step _Into" icon="/actions/traceInto.png" description="Step to the next line executed"/>
+ <action id="StepOut" class="xcom.intellij.debugger.actions.StepOutAction" text="Step Ou_t" icon="/actions/stepOut.png" description="Step to the first line executed after returning from this method"/>
+ <action id="ForceStepOver" class="xcom.intellij.debugger.actions.ForceStepOverAction" text="Fo_rce Step Over" icon="/actions/traceOver.png" description="Step over, disable all breakpoints before stepping."/>
+ <action id="ForceStepInto" class="xcom.intellij.debugger.actions.ForceStepIntoAction" text="Fo_rce Step Into" icon="/actions/forceStepInto.png" description="Step into, ignore stepping filters for libraries, constructors, etc."/>
+ <action id="RunToCursor" class="xcom.intellij.debugger.actions.RunToCursorAction" text="Run to _Cursor" icon="/actions/runToCursor.png" description="Run to the line where the caret is"/>
+ <action id="ForceRunToCursor" class="xcom.intellij.debugger.actions.ForceRunToCursorAction" text="Force Run to C_ursor" description="Run to the line where the caret is, ignoring any breakpoints"/>
+ <action id="Debugger.PopFrame" class="xcom.intellij.debugger.actions.PopFrameAction" text="Pop Frame" icon="/actions/popFrame.png" description="Moves execution point back to the method call dropping current method frames from the stack"/>
+ <action id="Pause" class="xcom.intellij.debugger.actions.PauseAction" text="_Pause Program" icon="/actions/pause.png" description="Suspend program execution and enable debugging"/>
+ <action id="Resume" class="xcom.intellij.debugger.actions.ResumeAction" text="Resume Pro_gram" icon="/actions/resume.png" description="Resume program execution"/>
+ <separator/>
+ <action id="EvaluateExpression" class="xcom.intellij.debugger.actions.EvaluateAction" text="_Evaluate Expression..." icon="/debugger/evaluateExpression.png" description="Evaluate arbitrary expression"/>
+ <action id="QuickEvaluateExpression" class="xcom.intellij.debugger.actions.QuickEvaluateAction" text="_Quick Evaluate Expression" description="Evaluate selected expression"/>
+ <action id="ShowExecutionPoint" class="xcom.intellij.debugger.actions.ShowExecutionPointAction" text="Show E_xecution Point" icon="/debugger/showCurrentFrame.png" description="Show the current program execution point"/>
+ <separator/>
+ <action id="ToggleLineBreakpoint" class="xcom.intellij.debugger.actions.ToggleLineBreakpointAction" text="Toggle _Line Breakpoint" description="Toggle line breakpoint at caret"/>
+ <action id="ToggleMethodBreakpoint" class="xcom.intellij.debugger.actions.ToggleMethodBreakpointAction" text="Toggle _Method Breakpoint" description="Toggle method breakpoint for the method at caret"/>
+ <action id="ToggleFieldBreakpoint" class="xcom.intellij.debugger.actions.ToggleFieldBreakpointAction" text="Toggle _Field Watchpoint" description="Toggle field watchpoint for the field at caret"/>
+ <action id="ToggleBreakpointEnabled" class="xcom.intellij.debugger.actions.ToggleBreakpointEnabledAction" text="Toggle Breakpoint Enabled" icon="/actions/toggleBreakpoint.png" description="Enable/disable breakpoint at the current line"/>
+ <action id="ViewBreakpoints" class="xcom.intellij.debugger.actions.ViewBreakpointsAction" text="_View Breakpoints" icon="/debugger/viewBreakpoints.png" description="View and manage all breakpoints and watchpoints"/>
+ <separator/>
+ <action id="ExportThreads" class="xcom.intellij.debugger.actions.ExportThreadsAction" text="Export T_hreads..." description="Save all threads information to a text file or clipboard"/>
+ </group>
+
+ <!-- Tools -->
+ <group text="_Tools" id="ToolsMenu" configurable="true">
+ <action id="ReformatCode" class="xcom.intellij.codeInsight.actions.ReformatCodeAction" text="_Reformat Code..." description="Reformat code"/>
+ <action id="OptimizeImports" class="xcom.intellij.codeInsight.actions.OptimizeImportsAction" text="_Optimize Imports..." description="Remove unused imports and reorder/reorganize imports"/>
+ <action id="SaveAsTemplate" class="xcom.intellij.codeInsight.template.actions.SaveAsTemplateAction" text="Save as L_ive Template..." description="Save the selected text as live template"/>
+ <action id="SaveFileAsTemplate" class="xcom.intellij.ide.actions.SaveFileAsTemplateAction" text="Save File as Temp_late..." description="Save current file as template"/>
+ <action id="GenerateJavadoc" class="xcom.intellij.javadoc.actions.GenerateJavadocAction" text="Generate Java_Doc..." description="Run the JavaDoc tool"/>
+ <separator/>
+ <group id="Macros" text="_Macros" description="View, Change, Record, Play Macros" popup="true">
+ <group id="StanardMacroActions">
+ <action id="PlaybackLastMacro" class="xcom.intellij.ide.actionMacro.actions.PlaybackLastMacroAction" text="Playback _Last Macro" description="Playback last used macro"/>
+ <action id="StartStopMacroRecording" class="xcom.intellij.ide.actionMacro.actions.StartStopMacroRecordingAction" text="Start/Stop Macro _Recording" description="Start/Stop recording of a new macro"/>
+ <action id="EditMacros" class="xcom.intellij.ide.actionMacro.actions.EditMacrosAction" text="_Edit Macros..." description="Configure existing macros"/>
+ </group>
+ <separator/>
+ <group id="PlaySavedMacroActions" class="xcom.intellij.ide.actionMacro.actions.MacrosGroup"/>
+ </group>
+ <separator/>
+ <action id="Migrate" class="xcom.intellij.refactoring.actions.MigrateAction" text="Mi_grate..." description="Open migration dialog"/>
+ <separator/>
+ <group>
+ <action id="ValidateXml" class="xcom.intellij.xml.actions.ValidateXmlAction" text="_Validate" description="Validate the current xml file"/>
+ <action id="AddAntBuildFile" class="xcom.intellij.ant.actions.AddAntBuildFile" text="Add as Ant Build File" description="Add current XML file to the list of project's Ant build files"/>
+ </group>
+ <separator/>
+ <reference ref="LocalVcsGroup"/>
+ <separator/>
+ <action id="GenerateDTD" class="xcom.intellij.codeInsight.actions.GenerateDTDAction" text="Generate DTD from XML file"/>
+
+ <separator/>
+ <group id="ExternalToolsGroup" text="External Tools" class="xcom.intellij.tools.ExternalToolsGroup"/>
+ <separator/>
+ <action id="DataSources" class="xcom.intellij.javaee.dataSource.DataSourcesManagementAction" text="Data Sources..." description="Manage JDBC Data Sources"/>
+ <separator/>
+
+ <group text="Unscramble" popup="true">
+ <action id="Unscramble" class="xcom.intellij.unscramble.UnscrambleAction" text="_Unscramble Stacktrace..."/>
+ <action id="UnscrambleFromClipboard" class="xcom.intellij.unscramble.UnscrambleFromClipboardAction" text="Unscramble Stacktrace From Clipboard..."/>
+ </group>
+
+ <group text="Internal Actions" internal="true" popup="true">
+ <action id="PsiViewer" internal="true" class="xcom.intellij.internal.psiView.PsiViewerAction" text="View PSI Structure"/>
+ <action id="DebugListen" internal="true" class="xcom.intellij.debugger.actions.ThrowDebugExceptionAction" text="Throw Debug Exception"/>
+ <action id="VirtualFileInfo" internal="true" class="xcom.intellij.openapi.vfs.impl.local.VirtualFileInfoAction" text="Virtual File Info"/>
+ <action id="Merge3Files" internal="true" class="xcom.intellij.openapi.diff.actions.MergeFilesAction" text="Merge"/>
+<!--
+<action class="xcom.intellij.localVcs.CheckFileContentProviderAction" id="CheckFileContentProvider" text="Check File Content Provider"></action>
+-->
+ <separator/>
+ <group text="Memory Management" id="MemoryManagement" popup="true">
+ <action id="ScanRefs" internal="true" class="xcom.intellij.internal.scanReferences.actions.ScanRefsAction" text="Scan Refs..."/>
+ <action id="ScanRefsByList" internal="true" class="xcom.intellij.internal.scanReferences.actions.ScanRefsByListAction" text="Scan Refs by List"/>
+ <action id="PrintRefsDump" internal="true" class="xcom.intellij.internal.scanReferences.actions.PrintRefsDumpAction" text="Print Refs Dump"/>
+ <action id="ClearDocumentHistory" internal="true" class="xcom.intellij.internal.scanReferences.actions.ClearDocumentHistoryAction" text="Clear Undo Queue"/>
+ <action id="SaveDump" internal="true" class="xcom.intellij.internal.saveDump.SaveDumpAction" text="Save Dump" description=""/>
+ <action id="DumpPsiMemoryCaches" internal="true" class="xcom.intellij.psi.impl.DumpPsiMemoryCaches" text="Dump what is cached in PSI"/>
+ <action id="AllocationsHistoryAction" internal="true" class="xcom.intellij.internal.scanReferences.allocations.ShowAllocationsAction" text="View Allocations History"/>
+ </group>
+ <action internal="true" id="DecodeBytesAction" class="xcom.intellij.internal.encodings.DecodeBytesAction" text="Decode Bytes"/>
+ <separator/>
+ <action id="LocalVcs.ShowStatistics" class="xcom.intellij.localVcs.actions.ShowStatistics" text="Show Local VCS Statistics..." description="Show Local VCS statistics" internal="true"/>
+ <action id="LocalVcs.ShowRepHistory" class="xcom.intellij.localVcs.actions.PringRepositoryHistoryAction" text="Repository History" internal="true"/>
+ <separator/>
+ <action id="Compile2" class="xcom.intellij.intellijac.CompileAction" te