Merge remote-tracking branch 'origin/master'

This commit is contained in:
Maxim.Medvedev
2012-04-05 13:34:26 +04:00
54 changed files with 601 additions and 384 deletions
@@ -772,6 +772,7 @@ public abstract class DebugProcessImpl implements DebugProcess {
myPositionManager = null;
myReturnValueWatcher = null;
myNodeRederersMap.clear();
myRenderers.clear();
myState.set(STATE_DETACHED);
try {
myDebugProcessDispatcher.getMulticaster().processDetached(this, closedByUser);
@@ -27,7 +27,7 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.IndexNotReadyException;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.projectRoots.JavaSdkVersion;
import com.intellij.openapi.projectRoots.JavaSdkVersionUtil;
import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.TextRange;
import com.intellij.pom.java.LanguageLevel;
@@ -509,7 +509,8 @@ public class GenericsHighlightUtil {
final PsiType retErasure2 = TypeConversionUtil.erasure(superMethod.getReturnType());
boolean differentReturnTypeErasure = !Comparing.equal(retErasure1, retErasure2);
if (checkEqualsSuper && JavaSdkVersionUtil.isAtLeast(checkMethod, JavaSdkVersion.JDK_1_7)) {
final boolean atLeast17 = JavaVersionService.getInstance().isAtLeast(checkMethod, JavaSdkVersion.JDK_1_7);
if (checkEqualsSuper && atLeast17) {
if (retErasure1 != null && retErasure2 != null) {
differentReturnTypeErasure = !TypeConversionUtil.isAssignable(retErasure1, retErasure2);
} else {
@@ -520,8 +521,17 @@ public class GenericsHighlightUtil {
if (differentReturnTypeErasure &&
!TypeConversionUtil.isVoidType(retErasure1) &&
!TypeConversionUtil.isVoidType(retErasure2) &&
!(checkEqualsSuper && Arrays.equals(superSignature.getParameterTypes(), signatureToCheck.getParameterTypes()))) {
return null;
!(checkEqualsSuper && Arrays.equals(superSignature.getParameterTypes(), signatureToCheck.getParameterTypes())) &&
!atLeast17) {
int idx = 0;
final PsiType[] parameterTypes = signatureToCheck.getParameterTypes();
boolean erasure = parameterTypes.length > 0;
for (PsiType type : superSignature.getParameterTypes()) {
erasure &= Comparing.equal(type, TypeConversionUtil.erasure(parameterTypes[idx]));
idx++;
}
if (!erasure) return null;
}
if (!checkEqualsSuper && MethodSignatureUtil.isSubsignature(superSignature, signatureToCheck)) {
@@ -30,6 +30,7 @@ import com.intellij.codeInsight.hint.QuestionAction;
import com.intellij.codeInsight.intention.HighPriorityAction;
import com.intellij.codeInspection.HintAction;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.impl.LaterInvocator;
import com.intellij.openapi.command.CommandProcessor;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.project.Project;
@@ -67,13 +68,7 @@ public abstract class ImportClassFixBase<T extends PsiElement & PsiReference> im
return false;
}
PsiManager manager = file.getManager();
if (!manager.isInProject(file)) {
return false;
}
if (getClassesToImport().isEmpty()) {
return false;
}
return true;
return manager.isInProject(file) && !getClassesToImport().isEmpty();
}
@Nullable
@@ -188,6 +183,7 @@ public abstract class ImportClassFixBase<T extends PsiElement & PsiReference> im
CodeInsightSettings.getInstance().ADD_UNAMBIGIOUS_IMPORTS_ON_THE_FLY)
&& (ApplicationManager.getApplication().isUnitTestMode() || codeAnalyzer.canChangeFileSilently(psiFile))
&& !autoImportWillInsertUnexpectedCharacters(classes[0])
&& !LaterInvocator.isInModalContext()
) {
CommandProcessor.getInstance().runUndoTransparentAction(new Runnable() {
@Override
@@ -40,7 +40,6 @@ import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.text.MessageFormat;
import java.util.ArrayList;
/**
@@ -192,6 +192,7 @@ public class EntryPointsManagerImpl implements PersistentStateComponent<Element>
public void resolveEntryPoints(final RefManager manager) {
if (!myResolved) {
myResolved = true;
cleanup();
validateEntryPoints();
ApplicationManager.getApplication().runReadAction(new Runnable() {
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.projectRoots;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.psi.PsiElement;
/**
@@ -22,8 +23,15 @@ import com.intellij.psi.PsiElement;
* Date: 3/28/12
*/
public class JavaVersionServiceImpl extends JavaVersionService {
private boolean myTestVersion = false;
public void setTestVersion(boolean testVersion) {
myTestVersion = testVersion;
}
@Override
public boolean isAtLeast(PsiElement element, JavaSdkVersion version) {
if (ApplicationManager.getApplication().isUnitTestMode()) return myTestVersion;
return JavaSdkVersionUtil.isAtLeast(element, version);
}
}
@@ -131,6 +131,8 @@ public class PsiImplUtil {
}
public static int getParameterIndex(@NotNull PsiParameter parameter, @NotNull PsiParameterList parameterList) {
PsiElement parameterParent = parameter.getParent();
assert parameterParent == parameterList : parameterList +"; "+parameterParent;
PsiParameter[] parameters = parameterList.getParameters();
for (int i = 0; i < parameters.length; i++) {
PsiParameter paramInList = parameters[i];
@@ -146,9 +148,8 @@ public class PsiImplUtil {
break;
}
}
String message = parameter + ":"+parameter.getClass()+" not found among parameters: " + Arrays.asList(parameters) + "." +
String message = parameter + ":" + parameter.getClass() + " not found among parameters: " + Arrays.asList(parameters) + "." +
" parameterList' parent: " + parameterList.getParent() + ";" +
" parameter.getParent()==paramList: " + (parameter.getParent() == parameterList) + "; " + parameterList.getClass() + ";" +
" parameter.isValid()=" + parameter.isValid() + ";" +
" parameterList.isValid()= " + parameterList.isValid() + ";" +
" parameterList stub: " + (parameterList instanceof StubBasedPsiElement ? ((StubBasedPsiElement)parameterList).getStub() : "---") + "; " +
@@ -0,0 +1,21 @@
import java.util.*;
class ErasureTest {
<error descr="'toArrayDouble(List<? extends Number>)' clashes with 'toArrayDouble(List<double[]>)'; both methods have same erasure">public static double[] toArrayDouble(List<? extends Number> v)</error> {
return null;
}
public static double[][] toArrayDouble(List<double[]> v) {
return null;
}
}
class ErasureTest1 {
<error descr="'toArrayDouble(List<? extends Number>)' clashes with 'toArrayDouble(List)'; both methods have same erasure">public static double[] toArrayDouble(List<? extends Number> v)</error> {
return null;
}
public static double[][] toArrayDouble(List v) {
return null;
}
}
@@ -0,0 +1,31 @@
import java.util.*;
class ErasureTest {
public static double[] toArrayDouble(List<? extends Number> v) {
return null;
}
public static double[][] toArrayDouble(List<double[]> v) {
return null;
}
}
class ErasureTest1 {
<error descr="'toArrayDouble(List<? extends Number>)' clashes with 'toArrayDouble(List)'; both methods have same erasure">public static double[] toArrayDouble(List<? extends Number> v)</error> {
return null;
}
public static double[][] toArrayDouble(List v) {
return null;
}
}
class ErasureTest2 {
<error descr="'toArrayDouble(List<? extends Number>)' clashes with 'toArrayDouble(List<String>)'; both methods have same erasure">public static double[] toArrayDouble(List<? extends Number> v)</error> {
return null;
}
public static double[] toArrayDouble(List<String> v) {
return null;
}
}
@@ -15,3 +15,27 @@ abstract class Foo<T extends Foo<T>> {
return t.<error descr="'field' has private access in 'Foo'">field</error>;
}
}
public class Bug {
// Idea incorrectly analyses this code with JDK 7
public <T extends Bug> void doit(T other) {
// Oops, was legal with JDK 6, no longer legal with JDK 7
other.<error descr="'mPrivate()' has private access in 'Bug'">mPrivate</error>();
// Redundant with JDK 6, not a redundant cast with JDK 7
((Bug)other).mPrivate();
}
// Idea correctly analyses this code
public void doit2(SubClass other) {
// Not legal with JDK 6 or 7
other.<error descr="'mPrivate()' has private access in 'Bug'">mPrivate</error>();
// Not redundant with JDK 6 or 7
((Bug)other).mPrivate();
}
private void mPrivate() {
}
}
class SubClass extends Bug {
}
@@ -6,4 +6,28 @@ class A {
System.out.println(t.value);
}
}
}
public class Bug {
// Idea incorrectly analyses this code with JDK 7
public <T extends Bug> void doit(T other) {
// Oops, was legal with JDK 6, no longer legal with JDK 7
other.mPrivate();
// Redundant with JDK 6, not a redundant cast with JDK 7
((Bug)other).mPrivate();
}
// Idea correctly analyses this code
public void doit2(SubClass other) {
// Not legal with JDK 6 or 7
other.<error descr="'mPrivate()' has private access in 'Bug'">mPrivate</error>();
// Not redundant with JDK 6 or 7
((Bug)other).mPrivate();
}
private void mPrivate() {
}
}
class SubClass extends Bug {
}
@@ -4,6 +4,8 @@ import com.intellij.codeInspection.LocalInspectionTool;
import com.intellij.codeInspection.uncheckedWarnings.UncheckedWarningLocalInspection;
import com.intellij.codeInspection.unusedImport.UnusedImportLocalInspection;
import com.intellij.codeInspection.unusedSymbol.UnusedSymbolLocalInspection;
import com.intellij.openapi.projectRoots.JavaVersionService;
import com.intellij.openapi.projectRoots.JavaVersionServiceImpl;
import com.intellij.openapi.projectRoots.Sdk;
import com.intellij.openapi.projectRoots.impl.JavaSdkImpl;
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
@@ -100,7 +102,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testSOE() throws Exception { doTest(true); }
public void testGenericExtendException() throws Exception { doTest(false); }
public void testSameErasureDifferentReturnTypes() throws Exception { doTest(false); }
public void testSameErasureDifferentReturnTypes() throws Exception { doTest17Incompatibility(); }
public void testSameErasureDifferentReturnTypesJdk14() throws Exception { doTest(false); }
public void testDeepConflictingReturnTypes() throws Exception { doTest(false); }
public void testInheritFromTypeParameter() throws Exception { doTest(false); }
@@ -116,13 +118,16 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testPrivateInnerClassRef() throws Exception { doTest(false); }
public void testWideningCastToTypeParam() throws Exception { doTest(false); }
public void testCapturedWildcardAssignments() throws Exception { doTest(false);}
public void testTypeParameterBoundVisibility() throws Exception { doTest(false);}
public void testTypeParameterBoundVisibility() throws Exception { doTest17Incompatibility(); }
public void testTypeParameterBoundVisibilityJdk14() throws Exception { doTest(false);}
public void testUncheckedWarningsLevel6() throws Exception { doTest(true);}
public void testIDEA77991() throws Exception { doTest(false);}
public void testIDEA80386() throws Exception { doTest(false);}
public void testIDEA66311() throws Exception { doTest17Incompatibility();}
public void testIDEA66311_16() throws Exception { doTest(false);}
public void testJavaUtilCollections_NoVerify() throws Exception {
PsiClass collectionsClass = getJavaFacade().findClass("java.util.Collections", GlobalSearchScope.moduleWithLibrariesScope(getModule()));
@@ -132,4 +137,15 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
configureFromFileText("Collections.java", text.replaceAll("\r","\n"));
doTestConfiguredFile(false, false, null);
}
private void doTest17Incompatibility() throws Exception {
final JavaVersionServiceImpl javaVersionService = (JavaVersionServiceImpl)JavaVersionService.getInstance();
try {
javaVersionService.setTestVersion(true);
doTest(false);
}
finally {
javaVersionService.setTestVersion(false);
}
}
}
@@ -388,7 +388,7 @@ public class PropertyUtil {
return ArrayUtil.toStringArray(result);
}
public static PsiMethod generateGetterPrototype(PsiField field) {
public static PsiMethod generateGetterPrototype(@NotNull PsiField field) {
PsiElementFactory factory = JavaPsiFacade.getInstance(field.getProject()).getElementFactory();
Project project = field.getProject();
String name = field.getName();
@@ -43,8 +43,17 @@ public class Mappings {
private final TIntHashSet myChangedClasses;
private final TIntHashSet myChangedFiles;
private final TIntHashSet myDeletedClasses;
private final Object myLock;
private void addDeletedClass (final int it) {
assert (myDeletedClasses != null);
myDeletedClasses.add(it);
addChangedClass(it);
}
private void addChangedClass(final int it) {
assert (myChangedClasses != null && myChangedFiles != null);
myChangedClasses.add(it);
@@ -58,6 +67,10 @@ public class Mappings {
myIsDifferentiated = true;
}
private TIntHashSet getDeletedClasses() {
return myDeletedClasses;
}
private TIntHashSet getChangedClasses() {
return myChangedClasses;
}
@@ -129,6 +142,7 @@ public class Mappings {
myPostPasses = new LinkedList<PostPass>();
myChangedClasses = new TIntHashSet(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR);
myChangedFiles = new TIntHashSet(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR);
myDeletedClasses = new TIntHashSet(DEFAULT_SET_CAPACITY, DEFAULT_SET_LOAD_FACTOR);
myDeltaIsTransient = base.myDeltaIsTransient;
myRootDir = new File(FileUtil.toSystemIndependentName(base.myRootDir.getAbsolutePath()) + File.separatorChar + "delta");
myContext = base.myContext;
@@ -144,6 +158,7 @@ public class Mappings {
myPostPasses = new LinkedList<PostPass>();
myChangedClasses = null;
myChangedFiles = null;
myDeletedClasses = null;
myDeltaIsTransient = transientDelta;
myRootDir = rootDir;
createImplementation();
@@ -918,7 +933,7 @@ public class Mappings {
}
});
for (FileClasses compiledFile : newClasses) {
for (final FileClasses compiledFile : newClasses) {
final int fileName = compiledFile.fileName;
final Set<ClassRepr> classes = compiledFile.fileClasses;
final Set<ClassRepr> pastClasses = (Set<ClassRepr>)mySourceFileToClasses.get(fileName);
@@ -931,7 +946,7 @@ public class Mappings {
final Difference.Specifier<ClassRepr> classDiff = Difference.make(pastClasses, classes);
debug("Processing changed classes:");
for (Pair<ClassRepr, Difference> changed : classDiff.changed()) {
for (final Pair<ClassRepr, Difference> changed : classDiff.changed()) {
final ClassRepr it = changed.first;
final ClassRepr.Diff diff = (ClassRepr.Diff)changed.second;
@@ -1024,7 +1039,7 @@ public class Mappings {
.createAnnotationUsage(myContext, TypeRepr.createClassType(myContext, it.name), null, removedtargets));
}
for (MethodRepr m : diff.methods().added()) {
for (final MethodRepr m : diff.methods().added()) {
if (!m.hasValue()) {
debug("Added method with no default value: ", m.name);
debug("Adding class usage to affected usages");
@@ -1079,7 +1094,7 @@ public class Mappings {
final Collection<MethodRepr> lessSpecific = it.findMethods(u.lessSpecific(m));
for (MethodRepr mm : lessSpecific) {
for (final MethodRepr mm : lessSpecific) {
if (!mm.equals(m)) {
debug("Found less specific method, affecting method usages");
u.affectMethodUsages(mm, propagated, mm.createUsage(myContext, it.name), affectedUsages, dependants);
@@ -1087,7 +1102,7 @@ public class Mappings {
}
debug("Processing affected by specificity methods");
for (Pair<MethodRepr, ClassRepr> p : affectedMethods) {
for (final Pair<MethodRepr, ClassRepr> p : affectedMethods) {
final MethodRepr mm = p.first;
final ClassRepr cc = p.second;
@@ -1183,7 +1198,7 @@ public class Mappings {
boolean clear = true;
loop:
for (Pair<MethodRepr, ClassRepr> overriden : overridenMethods) {
for (final Pair<MethodRepr, ClassRepr> overriden : overridenMethods) {
final MethodRepr mm = overriden.first;
if (mm == myMockMethod || !mm.type.equals(m.type) || !empty(mm.signature) || !empty(m.signature)) {
@@ -1219,7 +1234,7 @@ public class Mappings {
boolean allAbstract = true;
boolean visited = false;
for (Pair<MethodRepr, ClassRepr> pp : overridenInS) {
for (final Pair<MethodRepr, ClassRepr> pp : overridenInS) {
final ClassRepr cc = pp.second;
if (cc == myMockClass) {
@@ -1259,7 +1274,7 @@ public class Mappings {
debug("End of removed methods processing");
debug("Processing changed methods:");
for (Pair<MethodRepr, Difference> mr : diff.methods().changed()) {
for (final Pair<MethodRepr, Difference> mr : diff.methods().changed()) {
final MethodRepr m = mr.first;
final MethodRepr.Diff d = (MethodRepr.Diff)mr.second;
final boolean throwsChanged = (d.exceptions().added().size() > 0) || (d.exceptions().changed().size() > 0);
@@ -1286,7 +1301,7 @@ public class Mappings {
debug("Method became package-local, affecting method usages outside the package");
u.affectMethodUsages(m, propagated, m.createUsage(myContext, it.name), usages, dependants);
for (UsageRepr.Usage usage : usages) {
for (final UsageRepr.Usage usage : usages) {
usageConstraints.put(usage, u.new InheritanceConstraint(it.name));
}
@@ -1333,7 +1348,7 @@ public class Mappings {
affectedUsages.addAll(usages);
}
for (UsageRepr.Usage usage : usages) {
for (final UsageRepr.Usage usage : usages) {
usageConstraints.put(usage, u.new InheritanceConstraint(it.name));
}
}
@@ -1396,7 +1411,7 @@ public class Mappings {
final Collection<Pair<FieldRepr, ClassRepr>> overridden = u.findOverridenFields(f, it);
for (Pair<FieldRepr, ClassRepr> p : overridden) {
for (final Pair<FieldRepr, ClassRepr> p : overridden) {
final FieldRepr ff = p.first;
final ClassRepr cc = p.second;
@@ -1429,7 +1444,7 @@ public class Mappings {
u.new NegationConstraint(u.new PackageConstraint(cc.getPackageName())));
}
for (UsageRepr.Usage usage : localUsages) {
for (final UsageRepr.Usage usage : localUsages) {
usageConstraints.put(usage, constaint);
}
}
@@ -1441,7 +1456,7 @@ public class Mappings {
debug("End of added fields processing");
debug("Processing removed fields:");
for (FieldRepr f : diff.fields().removed()) {
for (final FieldRepr f : diff.fields().removed()) {
debug("Field: ", f.name);
if ((f.access & Opcodes.ACC_PRIVATE) == 0 && (f.access & mask) == mask && f.hasValue()) {
@@ -1458,7 +1473,7 @@ public class Mappings {
debug("End of removed fields processing");
debug("Processing changed fields:");
for (Pair<FieldRepr, Difference> f : diff.fields().changed()) {
for (final Pair<FieldRepr, Difference> f : diff.fields().changed()) {
final Difference d = f.second;
final FieldRepr field = f.first;
@@ -1507,7 +1522,7 @@ public class Mappings {
affectedUsages.addAll(usages);
}
for (UsageRepr.Usage usage : usages) {
for (final UsageRepr.Usage usage : usages) {
if ((d.addedModifiers() & Opcodes.ACC_PROTECTED) > 0) {
usageConstraints.put(usage, u.new InheritanceConstraint(it.name));
}
@@ -1525,8 +1540,8 @@ public class Mappings {
debug("End of changed classes processing");
debug("Processing removed classes:");
for (ClassRepr c : classDiff.removed()) {
delta.addChangedClass(c.name);
for (final ClassRepr c : classDiff.removed()) {
delta.addDeletedClass(c.name);
self.appendDependents(c, dependants);
debug("Adding usages of class ", c.name);
affectedUsages.add(c.createUsage());
@@ -1534,7 +1549,7 @@ public class Mappings {
debug("End of removed classes processing.");
debug("Processing added classes:");
for (ClassRepr c : classDiff.added()) {
for (final ClassRepr c : classDiff.added()) {
delta.addChangedClass(c.name);
final TIntHashSet depClasses = myClassToClassDependency.get(c.name);
@@ -1573,7 +1588,7 @@ public class Mappings {
filewise:
for (int depFile : dependentFiles.toArray()) { // todo: avoid toArray()?
for (final int depFile : dependentFiles.toArray()) { // todo: avoid toArray()?
final File theFile = new File(myContext.getValue(depFile));
if (affectedFiles.contains(theFile) || compiledFiles.contains(theFile)) {
@@ -1583,7 +1598,7 @@ public class Mappings {
debug("Dependent file: ", depFile);
final Collection<UsageRepr.Cluster> depClusters = mySourceFileToUsages.get(depFile);
if (depClusters != null) {
for (UsageRepr.Cluster depCluster : depClusters) {
for (final UsageRepr.Cluster depCluster : depClusters) {
final Set<UsageRepr.Usage> depUsages = depCluster.getUsages();
if (depUsages == null) {
continue;
@@ -1603,7 +1618,7 @@ public class Mappings {
}
else {
final TIntHashSet residenceClasses = depCluster.getResidence(usage);
for (int residentName : residenceClasses.toArray()) {
for (final int residentName : residenceClasses.toArray()) {
if (constraint.checkResidence(residentName)) {
debug("Added file with satisfied constraint");
affectedFiles.add(theFile);
@@ -1617,8 +1632,8 @@ public class Mappings {
if (annotationQuery.size() > 0) {
final Collection<UsageRepr.Usage> annotationUsages = mySourceFileToAnnotationUsages.get(depFile);
for (UsageRepr.Usage usage : annotationUsages) {
for (UsageRepr.AnnotationUsage query : annotationQuery) {
for (final UsageRepr.Usage usage : annotationUsages) {
for (final UsageRepr.AnnotationUsage query : annotationQuery) {
if (query.satisfies(usage)) {
debug("Added file due to annotation query");
affectedFiles.add(theFile);
@@ -1633,7 +1648,7 @@ public class Mappings {
}
if (removed != null) {
for (String r : removed) {
for (final String r : removed) {
affectedFiles.remove(new File(r));
}
}
@@ -1649,26 +1664,26 @@ public class Mappings {
delta.runPostPasses();
if (removed != null) {
for (String file : removed) {
for (final String file : removed) {
final int key = myContext.get(file);
final Set<ClassRepr> classes = (Set<ClassRepr>)mySourceFileToClasses.get(key);
final Collection<UsageRepr.Cluster> clusters = mySourceFileToUsages.get(key);
if (classes != null) {
for (ClassRepr cr : classes) {
for (final ClassRepr cr : classes) {
myClassToSubclasses.remove(cr.name);
myClassToSourceFile.remove(cr.name);
myClassToClassDependency.remove(cr.name);
for (int superSomething : cr.getSupers()) {
for (final int superSomething : cr.getSupers()) {
myClassToSubclasses.removeFrom(superSomething, cr.name);
}
if (clusters != null) {
for (UsageRepr.Cluster cluster : clusters) {
for (final UsageRepr.Cluster cluster : clusters) {
final Set<UsageRepr.Usage> usages = cluster.getUsages();
if (usages != null) {
for (UsageRepr.Usage u : usages) {
for (final UsageRepr.Usage u : usages) {
if (u instanceof UsageRepr.ClassUsage) {
final TIntHashSet residents = cluster.getResidence(u);
@@ -1690,6 +1705,16 @@ public class Mappings {
}
if (delta.isDifferentiated()) {
delta.getDeletedClasses().forEach(new TIntProcedure() {
@Override
public boolean execute(int value) {
myClassToClassDependency.remove(value);
myClassToSubclasses.remove(value);
myClassToSourceFile.remove(value);
return true;
}
});
delta.getChangedClasses().forEach(new TIntProcedure() {
@Override
public boolean execute(int c) {
@@ -1795,11 +1820,11 @@ public class Mappings {
private int[] getClassNames(Collection<File> compiled) {
final TIntHashSet classnames = new TIntHashSet(compiled.size());
for (File c : compiled) {
for (final File c : compiled) {
final int fileName = myContext.get(FileUtil.toSystemIndependentName(c.getAbsolutePath()));
final Collection<ClassRepr> reprs = mySourceFileToClasses.get(fileName);
if (reprs != null) {
for (ClassRepr repr : reprs) {
for (final ClassRepr repr : reprs) {
classnames.add(repr.name);
}
}
@@ -1843,11 +1868,11 @@ public class Mappings {
myClassToSourceFile.put(repr.name, sourceFileNameS);
mySourceFileToClasses.put(sourceFileNameS, repr);
for (int s : repr.getSupers()) {
for (final int s : repr.getSupers()) {
myClassToSubclasses.put(s, repr.name);
}
for (UsageRepr.Usage u : localUsages.getUsages()) {
for (final UsageRepr.Usage u : localUsages.getUsages()) {
final int owner = u.getOwner();
if (owner != className) {
@@ -1883,7 +1908,7 @@ public class Mappings {
@Override
public void registerImports(final String className, final Collection<String> imports, Collection<String> staticImports) {
for (String s : staticImports) {
for (final String s : staticImports) {
int i = s.length() - 1;
for (; s.charAt(i) != '.'; i--) ;
imports.add(s.substring(0, i));
@@ -1982,6 +2007,4 @@ public class Mappings {
});
return changed.get();
}
}
@@ -27,7 +27,6 @@ import com.intellij.openapi.util.Ref;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiLock;
import com.intellij.psi.PsiWhiteSpace;
import com.intellij.psi.TokenType;
import com.intellij.psi.impl.source.SourceTreeToPsiMap;
@@ -77,7 +76,7 @@ public class DebugUtil {
}
public static /*final*/ boolean CHECK = false;
public static final boolean DO_EXPENSIVE_CHECKS = ApplicationManager.getApplication().isInternal() || ApplicationManager.getApplication().isUnitTestMode();
public static final boolean DO_EXPENSIVE_CHECKS = ApplicationManager.getApplication().isUnitTestMode();
public static final boolean CHECK_INSIDE_ATOMIC_ACTION_ENABLED = DO_EXPENSIVE_CHECKS;
public static String psiTreeToString(@NotNull final PsiElement element, final boolean skipWhitespaces) {
@@ -333,9 +332,7 @@ public class DebugUtil {
root = root.getTreeParent();
}
if (root instanceof CompositeElement) {
synchronized (PsiLock.LOCK) {
checkSubtree((CompositeElement)root);
}
checkSubtree((CompositeElement)root);
}
}
@@ -190,9 +190,8 @@ public class BlockSupportImpl extends BlockSupport {
final PsiFileImpl newFile = (PsiFileImpl)copy.getPsi(language);
if (newFile == null) {
LOG.error("View provider " + viewProvider + " refused to parse text with " + language +
throw new RuntimeException("View provider " + viewProvider + " refused to parse text with " + language +
"; base: " + viewProvider.getBaseLanguage() + "; copy: " + copy.getBaseLanguage() + "; fileType: " + fileType);
return null;
}
newFile.setOriginalFile(fileImpl);
@@ -457,7 +457,7 @@ public class FindInProjectUtil {
return (GlobalSearchScope)scope;
}
if (scope == null) {
return GlobalSearchScope.projectScope(project);
return projectContentScope(project);
}
Set<VirtualFile> files = new HashSet<VirtualFile>();
for (PsiElement element : ((LocalSearchScope)scope).getScope()) {
@@ -554,6 +554,15 @@ public class FindInProjectUtil {
return new Pair<Boolean, Collection<PsiFile>>(fast, resultFiles);
}
private static GlobalSearchScope projectContentScope(final Project project) {
GlobalSearchScope result = null;
for (Module module : ModuleManager.getInstance(project).getModules()) {
GlobalSearchScope moduleContent = moduleContentScope(module);
result = result == null ? moduleContent : result.uniteWith(moduleContent);
}
return result == null ? GlobalSearchScope.EMPTY_SCOPE : result;
}
@Nullable
private static GlobalSearchScope moduleContentScope(@NotNull final Module module) {
VirtualFile[] contentRoots = ModuleRootManager.getInstance(module).getContentRoots();
@@ -566,10 +575,7 @@ public class FindInProjectUtil {
result = result == null ? moduleContent : result.uniteWith(moduleContent);
}
}
if (result == null) {
result = GlobalSearchScope.EMPTY_SCOPE;
}
return result;
return result == null ? GlobalSearchScope.EMPTY_SCOPE : result;
}
private static void filterMaskedFiles(@NotNull final Set<PsiFile> resultFiles, @Nullable final Pattern fileMaskRegExp) {
@@ -44,7 +44,10 @@ public class FileNode extends PackageDependenciesNode implements Comparable<File
public void fillFiles(Set<PsiFile> set, boolean recursively) {
super.fillFiles(set, recursively);
set.add(getFile());
final PsiFile file = getFile();
if (file != null && file.isValid()) {
set.add(file);
}
}
public boolean hasUnmarked() {
@@ -105,6 +105,7 @@ public class ProjectPatternProvider extends PatternDialectProvider {
if (recursively) return null;
FileNode fNode = (FileNode)node;
final PsiFile file = (PsiFile)fNode.getPsiElement();
if (file == null) return null;
final VirtualFile virtualFile = file.getVirtualFile();
LOG.assertTrue(virtualFile != null);
final VirtualFile contentRoot = ProjectRootManager.getInstance(file.getProject()).getFileIndex().getContentRootForFile(virtualFile);
@@ -188,7 +188,7 @@ public class InjectedLanguageManagerImpl extends InjectedLanguageManager impleme
if (Thread.holdsLock(PsiLock.LOCK)) {
// hack for the case when docCommit was called from within PSI modification, e.g. in formatter.
// we can't spawn threads to do injections there, otherwise a deadlock is imminent
ContainerUtil.process(injected, commitProcessor);
ContainerUtil.process(new ArrayList<DocumentWindow>(injected), commitProcessor);
}
else {
commitInjectionsRunnable.run();
@@ -70,7 +70,7 @@ public class MoveFilesOrDirectoriesHandler extends MoveHandlerDelegate {
}
public void doMove(final Project project, final PsiElement[] elements, final PsiElement targetContainer, @Nullable final MoveCallback callback) {
if (!LOG.assertTrue(targetContainer == null || targetContainer instanceof PsiDirectory || targetContainer instanceof PsiDirectoryContainer)) {
if (!LOG.assertTrue(targetContainer == null || targetContainer instanceof PsiDirectory || targetContainer instanceof PsiDirectoryContainer, targetContainer)) {
return;
}
MoveFilesOrDirectoriesUtil.doMove(project, adjustForMove(project, elements, targetContainer), new PsiElement[] {targetContainer}, callback);
@@ -15,8 +15,8 @@
*/
package com.intellij.lang;
import com.intellij.openapi.fileTypes.StdFileTypes;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.fileTypes.StdFileTypes;
/**
* Defines the standard languages supported by IDEA.
@@ -35,6 +35,7 @@ public abstract class EditorColorsManager {
public abstract void setGlobalScheme(EditorColorsScheme scheme);
@NotNull
public abstract EditorColorsScheme getGlobalScheme();
public abstract EditorColorsScheme getScheme(@NonNls String schemeName);
@@ -289,10 +289,12 @@ public class EditorColorsManagerImpl extends EditorColorsManager implements Name
fireChanges(scheme);
}
@NotNull
private static DefaultColorsScheme getDefaultScheme() {
return DefaultColorSchemesManager.getInstance().getAllSchemes()[0];
}
@NotNull
@Override
public EditorColorsScheme getGlobalScheme() {
final EditorColorsScheme scheme = mySchemesManager.getCurrentScheme();
@@ -32,7 +32,7 @@ public class AtomicFieldUpdater<T,V> {
private static final Unsafe unsafe = getUnsafe();
@NotNull
private static Unsafe getUnsafe() {
public static Unsafe getUnsafe() {
Unsafe unsafe = null;
Class uc = Unsafe.class;
try {
@@ -69,6 +69,9 @@ public class AtomicFieldUpdater<T,V> {
Field[] declaredFields = ownerClass.getDeclaredFields();
Field found = null;
for (Field field : declaredFields) {
if ((field.getModifiers() & (Modifier.STATIC | Modifier.FINAL)) != 0) {
continue;
}
if (fieldType.isAssignableFrom(field.getType())) {
if (found == null) {
found = field;
@@ -79,15 +82,12 @@ public class AtomicFieldUpdater<T,V> {
}
}
if (found == null) {
throw new IllegalArgumentException("No field of "+fieldType+" found in the "+ownerClass);
throw new IllegalArgumentException("No (non-static, non-final) field of "+fieldType+" found in the "+ownerClass);
}
found.setAccessible(true);
if ((found.getModifiers() & Modifier.VOLATILE) == 0) {
throw new IllegalArgumentException("Field "+found+" in the "+ownerClass+" must be volatile");
}
if ((found.getModifiers() & (Modifier.STATIC | Modifier.FINAL)) != 0) {
throw new IllegalArgumentException("Field "+found+" in the "+ownerClass+" must be non-final non-static");
}
offset = unsafe.objectFieldOffset(found);
}
@@ -16,6 +16,9 @@
package com.intellij.util.containers;
import gnu.trove.THashSet;
import org.jetbrains.annotations.NotNull;
import java.util.*;
/** similar to java.util.ConcurrentHashMap except:
@@ -27,14 +30,14 @@ import java.util.*;
added hashing strategy argument
made not Serializable
*/
public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
public class StripedLockIntObjectConcurrentHashMap<V> {
/* ---------------- Constants -------------- */
/**
* The default initial number of table slots for this table.
* Used when not otherwise specified in constructor.
*/
static int DEFAULT_INITIAL_CAPACITY = 16;
private static final int DEFAULT_INITIAL_CAPACITY = 16;
/**
* The maximum capacity, used if a higher value is implicitly
@@ -42,13 +45,13 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
* be a power of two <= 1<<30 to ensure that entries are indexible
* using ints.
*/
static final int MAXIMUM_CAPACITY = 1 << 30;
private static final int MAXIMUM_CAPACITY = 1 << 30;
/**
* The default load factor for this table. Used when not
* otherwise specified in constructor.
*/
public static final float DEFAULT_LOAD_FACTOR = 0.75f;
protected static final float DEFAULT_LOAD_FACTOR = 0.75f;
/* ---------------- Fields -------------- */
@@ -74,7 +77,8 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
* nonpositive.
*/
public StripedLockIntObjectConcurrentHashMap(int initialCapacity, float loadFactor) {
super(getInitCap(initialCapacity, loadFactor), loadFactor);
int cap = getInitCap(initialCapacity, loadFactor);
setTable(new IntHashEntry[cap]);
}
private static int getInitCap(int initialCapacity, float loadFactor) {
@@ -141,10 +145,7 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
* @throws NullPointerException if the key or value is
* <tt>null</tt>.
*/
public V put(int key, V value) {
if (value == null) {
throw new NullPointerException();
}
public V put(int key, @NotNull V value) {
return put(key, value, false);
}
@@ -167,10 +168,7 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
* @throws NullPointerException if the specified key or value is
* <tt>null</tt>.
*/
public V putIfAbsent(int key, V value) {
if (value == null) {
throw new NullPointerException();
}
public V putIfAbsent(int key, @NotNull V value) {
return put(key, value, true);
}
@@ -205,23 +203,21 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
* Returns an enumeration of the values in this table.
*
* @return an enumeration of the values in this table.
* @see #values
*/
@NotNull
public Enumeration<V> elements() {
return new ValueIterator();
}
/* ---------------- Iterator Support -------------- */
abstract class HashIterator {
int nextSegmentIndex;
int nextTableIndex;
IntHashEntry[] currentTable;
IntHashEntry<V> nextEntry;
IntHashEntry<V> lastReturned;
private class HashIterator {
private int nextTableIndex;
private IntHashEntry[] currentTable;
private IntHashEntry<V> nextEntry;
private IntHashEntry<V> lastReturned;
HashIterator() {
nextSegmentIndex = 0;
private HashIterator() {
nextTableIndex = -1;
advance();
}
@@ -230,7 +226,7 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
return hasNext();
}
final void advance() {
private void advance() {
if (nextEntry != null && (nextEntry = nextEntry.next) != null) {
return;
}
@@ -241,16 +237,13 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
}
}
while (nextSegmentIndex >= 0) {
IntSegment seg = StripedLockIntObjectConcurrentHashMap.this;
nextSegmentIndex--;
if (seg.count != 0) {
currentTable = seg.table;
for (int j = currentTable.length - 1; j >= 0; --j) {
if ((nextEntry = (IntHashEntry<V>)currentTable[j]) != null) {
nextTableIndex = j - 1;
return;
}
StripedLockIntObjectConcurrentHashMap seg = StripedLockIntObjectConcurrentHashMap.this;
if (seg.count != 0) {
currentTable = seg.table;
for (int j = currentTable.length - 1; j >= 0; --j) {
if ((nextEntry = (IntHashEntry<V>)currentTable[j]) != null) {
nextTableIndex = j - 1;
return;
}
}
}
@@ -260,7 +253,7 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
return nextEntry != null;
}
IntHashEntry<V> nextEntry() {
protected IntHashEntry<V> nextEntry() {
if (nextEntry == null) {
throw new NoSuchElementException();
}
@@ -278,84 +271,60 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
}
}
final class ValueIterator extends HashIterator implements Iterator<V>, Enumeration<V> {
private final class ValueIterator extends HashIterator implements Iterator<V>, Enumeration<V> {
@Override
public V next() {
return nextEntry().value;
}
@Override
public V nextElement() {
return nextEntry().value;
}
}
interface IntEntry<V> {
public interface IntEntry<V> {
int getKey();
V getValue();
V setValue(V value);
@NotNull V getValue();
}
final class Values extends AbstractCollection<V> {
public Iterator<V> iterator() {
return new ValueIterator();
}
public int size() {
return StripedLockIntObjectConcurrentHashMap.this.size();
}
public boolean contains(Object o) {
return containsValue(o);
}
public void clear() {
StripedLockIntObjectConcurrentHashMap.this.clear();
}
public Object[] toArray() {
Collection<V> c = new ArrayList<V>();
for (V k : this) {
c.add(k);
}
return c.toArray();
}
public <T> T[] toArray(T[] a) {
Collection<V> c = new ArrayList<V>();
for (V k : this) {
c.add(k);
}
return c.toArray(a);
public Collection<IntEntry<V>> entries() {
HashIterator iterator = new HashIterator();
Set<IntEntry<V>> result = new THashSet<IntEntry<V>>();
while (iterator.hasNext()) {
IntHashEntry<V> ie = iterator.nextEntry;
SimpleEntry<V> entry = new SimpleEntry<V>(ie.key, ie.value);
result.add(entry);
}
return result;
}
/**
* This duplicates java.util.AbstractMap.SimpleEntry until this class
* is made accessible.
*/
static final class SimpleEntry<V> implements IntEntry<V> {
int key;
V value;
private static final class SimpleEntry<V> implements IntEntry<V> {
private final int key;
private final V value;
public SimpleEntry(IntEntry<V> e) {
key = e.getKey();
value = e.getValue();
private SimpleEntry(int key, @NotNull V value) {
this.key = key;
this.value = value;
}
@Override
public int getKey() {
return key;
}
@Override
@NotNull
public V getValue() {
return value;
}
public V setValue(V value) {
V oldValue = this.value;
this.value = value;
return oldValue;
}
@Override
public boolean equals(Object o) {
if (!(o instanceof SimpleEntry)) {
return false;
@@ -365,30 +334,31 @@ public class StripedLockIntObjectConcurrentHashMap<V> extends IntSegment<V> {
return key == o2 && eq(value, e.getValue());
}
@Override
public int hashCode() {
return key ^
(value == null ? 0 : value.hashCode());
}
@Override
public String toString() {
return key + "=" + value;
}
boolean eq(Object o1, Object o2) {
private static boolean eq(Object o1, Object o2) {
return o1 == null ? o2 == null : o1.equals(o2);
}
}
}
class IntSegment<V> {
private static final StripedReentrantLocks STRIPED_REENTRANT_LOCKS = StripedReentrantLocks.getInstance();
private final byte lockIndex = (byte)STRIPED_REENTRANT_LOCKS.allocateLockIndex();
public void lock() {
private void lock() {
STRIPED_REENTRANT_LOCKS.lock(lockIndex & 0xff);
}
public void unlock() {
private void unlock() {
STRIPED_REENTRANT_LOCKS.unlock(lockIndex & 0xff);
}
/*
@@ -431,7 +401,7 @@ class IntSegment<V> {
/**
* The number of elements in this segment's region.
*/
volatile int count;
protected volatile int count;
/**
* Number of updates that alter the size of the table. This is
@@ -441,47 +411,33 @@ class IntSegment<V> {
* we might have an inconsistent view of state so (usually)
* must retry.
*/
int modCount;
protected int modCount;
/**
* The table is rehashed when its size exceeds this threshold.
*/
int threshold() {
return (int)(table.length * loadFactor);
private int threshold() {
return (int)(table.length * StripedLockIntObjectConcurrentHashMap.DEFAULT_LOAD_FACTOR);
}
/**
* The per-segment table. Declared as a raw type, casted
* to IntHashEntry<K,V> on each use.
*/
volatile IntHashEntry[] table;
/**
* The load factor for the hash table. Even though this value
* is same for all segments, it is replicated to avoid needing
* links to outer object.
*
* @serial
*/
final float loadFactor;
IntSegment(int initialCapacity, float lf) {
loadFactor = lf;
setTable(new IntHashEntry[initialCapacity]);
}
protected volatile IntHashEntry[] table;
/**
* Set table to new IntHashEntry array.
* Call only while holding lock or in constructor.
*/
void setTable(IntHashEntry[] newTable) {
private void setTable(IntHashEntry[] newTable) {
table = newTable;
}
/**
* Return properly casted first entry of bin for given hash
*/
IntHashEntry<V> getFirst(int hash) {
private IntHashEntry<V> getFirst(int hash) {
IntHashEntry[] tab = table;
return tab[hash & tab.length - 1];
}
@@ -493,7 +449,7 @@ class IntSegment<V> {
* its table assignment, which is legal under memory model
* but is not known to ever occur.
*/
V readValueUnderLock(IntHashEntry<V> e) {
private V readValueUnderLock(IntHashEntry<V> e) {
lock();
try {
return e.value;
@@ -535,32 +491,7 @@ class IntSegment<V> {
return false;
}
public boolean containsValue(Object value) {
if (count != 0) { // read-volatile
IntHashEntry[] tab = table;
int len = tab.length;
for (int i = 0; i < len; i++) {
for (IntHashEntry<V> e = tab[i];
e != null;
e = e.next) {
V v = e.value;
if (v == null) // recheck
{
v = readValueUnderLock(e);
}
if (value.equals(v)) {
return true;
}
}
}
}
return false;
}
public boolean replace(int key, V oldValue, V newValue) {
if (oldValue == null || newValue == null) {
throw new NullPointerException();
}
public boolean replace(int key, @NotNull V oldValue, @NotNull V newValue) {
lock();
try {
IntHashEntry<V> e = getFirst(key);
@@ -580,31 +511,7 @@ class IntSegment<V> {
}
}
public V replace(int key, V newValue) {
if (newValue == null) {
throw new NullPointerException();
}
lock();
try {
IntHashEntry<V> e = getFirst(key);
while (e != null && !(key == e.key)) {
e = e.next;
}
V oldValue = null;
if (e != null) {
oldValue = e.value;
e.value = newValue;
}
return oldValue;
}
finally {
unlock();
}
}
V put(int key, V value, boolean onlyIfAbsent) {
protected V put(int key, @NotNull V value, boolean onlyIfAbsent) {
lock();
try {
int c = count;
@@ -640,10 +547,10 @@ class IntSegment<V> {
}
}
void rehash() {
private void rehash() {
IntHashEntry[] oldTable = table;
int oldCapacity = oldTable.length;
if (oldCapacity >= StripedLockConcurrentHashMap.MAXIMUM_CAPACITY) {
if (oldCapacity >= MAXIMUM_CAPACITY) {
return;
}
@@ -696,8 +603,7 @@ class IntSegment<V> {
for (IntHashEntry<V> p = e; p != lastRun; p = p.next) {
int k = p.key & sizeMask;
IntHashEntry<V> n = newTable[k];
newTable[k] = new IntHashEntry<V>(p.key,
n, p.value);
newTable[k] = new IntHashEntry<V>(p.key, n, p.value);
}
}
}
@@ -708,7 +614,7 @@ class IntSegment<V> {
/**
* Remove; match on key only if value null, else match both.
*/
public V remove(int key, Object value) {
protected V remove(int key, Object value) {
lock();
try {
int c = count - 1;
@@ -731,8 +637,7 @@ class IntSegment<V> {
++modCount;
IntHashEntry<V> newFirst = e.next;
for (IntHashEntry<V> p = first; p != e; p = p.next) {
newFirst = new IntHashEntry<V>(p.key,
newFirst, p.value);
newFirst = new IntHashEntry<V>(p.key, newFirst, p.value);
}
tab[index] = newFirst;
count = c; // write-volatile
@@ -761,28 +666,37 @@ class IntSegment<V> {
}
}
}
}
/**
* ConcurrentHashMap list entry. Note that this is never exported
* out as a user-visible Map.Entry.
* <p/>
* Because the value field is volatile, not final, it is legal wrt
* the Java Memory Model for an unsynchronized reader to see null
* instead of initial value when read via a data race. Although a
* reordering leading to this is not likely to ever actually
* occur, the Segment.readValueUnderLock method is used as a
* backup in case a null (pre-initialized) value is ever seen in
* an unsynchronized access method.
*/
final class IntHashEntry<V> {
final int key;
volatile V value;
final IntHashEntry<V> next;
public void putAll(@NotNull StripedLockIntObjectConcurrentHashMap<? extends V> t) {
for (IntEntry<? extends V> e : t.entries()) {
V value = e.getValue();
put(e.getKey(), value);
}
}
IntHashEntry(int key, IntHashEntry<V> next, V value) {
this.key = key;
this.next = next;
this.value = value;
/**
* ConcurrentHashMap list entry. Note that this is never exported
* out as a user-visible Map.Entry.
* <p/>
* Because the value field is volatile, not final, it is legal wrt
* the Java Memory Model for an unsynchronized reader to see null
* instead of initial value when read via a data race. Although a
* reordering leading to this is not likely to ever actually
* occur, the Segment.readValueUnderLock method is used as a
* backup in case a null (pre-initialized) value is ever seen in
* an unsynchronized access method.
*/
private static final class IntHashEntry<V> {
final int key;
@NotNull volatile V value;
final IntHashEntry<V> next;
IntHashEntry(int key, IntHashEntry<V> next, @NotNull V value) {
this.key = key;
this.next = next;
this.value = value;
}
}
}
@@ -35,6 +35,7 @@ import com.intellij.designer.designSurface.tools.ComponentPasteFactory;
import com.intellij.designer.model.RadComponent;
import com.intellij.designer.palette.Item;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.ApplicationManagerEx;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
@@ -43,6 +44,7 @@ import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
import com.intellij.psi.PsiManager;
import com.intellij.psi.xml.XmlFile;
import com.intellij.util.Alarm;
import com.intellij.util.ThrowableRunnable;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.sdk.AndroidPlatform;
@@ -63,9 +65,10 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
private final XmlFile myXmlFile;
private final ExternalPSIChangeListener myPSIChangeListener;
private final ProfileAction myProfileAction;
private int myProfileLastVersion;
private final Alarm mySessionAlarm = new Alarm();
private volatile RenderSession mySession;
private boolean myParseTime;
private int myProfileLastVersion;
public AndroidDesignerEditorPanel(@NotNull Module module, @NotNull VirtualFile file) {
super(module, file);
@@ -264,31 +267,24 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
}
private void createRenderer(final String layoutXmlText, final ThrowableRunnable<Throwable> runnable) {
if (mySession == null) {
ApplicationManager.getApplication().invokeLater(
new Runnable() {
@Override
public void run() {
if (mySession == null) {
showProgress("Create RenderLib");
}
}
}, new Condition() {
@Override
public boolean value(Object o) {
return mySession != null;
}
}
);
}
else {
if (mySession != null) {
disposeSession();
}
mySessionAlarm.addRequest(new Runnable() {
@Override
public void run() {
if (mySession == null) {
showProgress("Create RenderLib");
}
}
}, 500);
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@Override
public void run() {
try {
long time = System.currentTimeMillis();
myProfileLastVersion = myProfileAction.getVersion();
AndroidPlatform platform = AndroidPlatform.getInstance(myModule);
@@ -332,6 +328,11 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
}
}
if (ApplicationManagerEx.getApplicationEx().isInternal()) {
System.out.println("Render time: " + (System.currentTimeMillis() - time));
}
mySessionAlarm.cancelAllRequests();
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
@@ -355,6 +356,9 @@ public final class AndroidDesignerEditorPanel extends DesignerEditorPanel {
}
});
}
finally {
mySessionAlarm.cancelAllRequests();
}
}
});
}
@@ -317,7 +317,7 @@ android.lint.inspections.add.android.prefix=Add Android prefix
android.lint.inspections.replace.with.zero.dp=Replace size attribute with 0dp
android.lint.inspections.set.baseline.attribute=Set 'baselineAligned' attribute
android.lint.inspections.remove.attribute=Remove attribute
android.lint.inspections.convert.to.dp=Convert to \\"dp\\"...
android.lint.inspections.convert.to.dp=Convert to \"dp\"...
android.lint.inspections.set.to.wrap.content=Replace size attribute with 'wrap_content'
android.lint.inspections.add.permission.attribute=Add 'permission' attribute
android.lint.inspections.add.input.type.attribute=Add 'inputType' attribute
@@ -403,4 +403,5 @@ android.disable.adb.service.title=Disable ADB service
android.launch.hierarchy.viewer.action=Hierarchy Viewer
android.launch.draw.9.patch.action=Draw 9 Patch
android.facet.settings.include.system.proguard=Include system proguard file
file.already.exists.error=File {0} already exists
file.already.exists.error=File {0} already exists
deployment.target.settings.min.sdk.info.message=Min API level is set to {0} in AndroidManifest.xml. Only compatible AVDs are shown
@@ -281,6 +281,10 @@ public class CreateXmlResourceDialog extends DialogWrapper {
if (newSelectedIndex >= 0) {
myDirectoriesList.setSelectedIndex(newSelectedIndex);
}
if (checkBoxList.size() == 1) {
checkBoxList.get(0).setSelected(true);
}
}
@Override
@@ -314,6 +314,10 @@ public class ResourceReferenceConverter extends ResolvingConverter<ResourceValue
@NotNull
public PsiReference[] createReferences(GenericDomValue<ResourceValue> value, PsiElement element, ConvertContext context) {
if ("@null".equals(value.getStringValue())) {
return PsiReference.EMPTY_ARRAY;
}
Module module = context.getModule();
if (module != null) {
AndroidFacet facet = AndroidFacet.getInstance(module);
@@ -30,7 +30,8 @@ import java.util.Map;
public class AndroidDrawableDomUtil {
public static final Map<String, String> SPECIAL_STYLEABLE_NAMES = new HashMap<String, String>();
private static final String[] POSSIBLE_DRAWABLE_ROOTS =
new String[]{"selector", "bitmap", "nine-patch", "layer-list", "level-list", "transition", "inset", "clip", "scale", "shape"};
new String[]{"selector", "bitmap", "nine-patch", "layer-list", "level-list", "transition", "inset", "clip", "scale", "shape",
"animation-list", "animated-rotate"};
static {
SPECIAL_STYLEABLE_NAMES.put("selector", "StateListDrawable");
@@ -41,6 +42,7 @@ public class AndroidDrawableDomUtil {
SPECIAL_STYLEABLE_NAMES.put("clip", "ClipDrawable");
SPECIAL_STYLEABLE_NAMES.put("scale", "ScaleDrawable");
SPECIAL_STYLEABLE_NAMES.put("animation-list", "AnimationDrawable");
SPECIAL_STYLEABLE_NAMES.put("animated-rotate", "AnimatedRotateDrawable");
SPECIAL_STYLEABLE_NAMES.put("shape", "GradientDrawable");
SPECIAL_STYLEABLE_NAMES.put("corners", "DrawableCorners");
@@ -29,7 +29,7 @@ import org.jetbrains.annotations.Nullable;
*/
public class InsetOrClipOrScaleDomFileDescription extends AndroidResourceDomFileDescription<InsetOrClipOrScale> {
@NonNls private static final String[] ROOT_TAGS = new String[] {"inset", "clip", "scale"};
@NonNls private static final String[] ROOT_TAGS = new String[] {"inset", "clip", "scale", "animated-rotate"};
public InsetOrClipOrScaleDomFileDescription() {
super(InsetOrClipOrScale.class, ROOT_TAGS[0], "drawable");
@@ -27,4 +27,6 @@ public interface ListItemBase extends DrawableDomElement {
List<InsetOrClipOrScale> getScales();
List<InsetOrClipOrScale> getInsets();
List<InsetOrClipOrScale> getAnimatedRotates();
}
@@ -349,7 +349,7 @@ class ApkStep extends ExportSignedPackageWizardStep {
}
@Override
protected void commitForNext() throws CommitStepException {
public void _commit(boolean finishChosen) throws CommitStepException {
final String apkPath = myApkPathField.getText().trim();
if (apkPath.length() == 0) {
throw new CommitStepException(AndroidBundle.message("android.extract.package.specify.apk.path.error"));
@@ -378,7 +378,7 @@ class ApkStep extends ExportSignedPackageWizardStep {
AndroidCompileUtil.setReleaseBuild(compileScope);
properties.setValue(RUN_PROGUARD_PROPERTY, Boolean.toString(myProguardCheckBox.isSelected()));
if (myProguardCheckBox.isSelected()) {
final String proguardCfgPath = myProguardConfigFilePathField.getText().trim();
if (proguardCfgPath.length() == 0) {
@@ -386,11 +386,11 @@ class ApkStep extends ExportSignedPackageWizardStep {
}
properties.setValue(PROGUARD_CFG_PATH_PROPERTY, proguardCfgPath);
properties.setValue(INCLUDE_SYSTEM_PROGUARD_FILE_PROPERTY, Boolean.toString(myIncludeSystemProguardFileCheckBox.isSelected()));
if (!new File(proguardCfgPath).isFile()) {
throw new CommitStepException("Cannot find file " + proguardCfgPath);
}
compileScope.putUserData(AndroidProguardCompiler.PROGUARD_CFG_PATH_KEY, proguardCfgPath);
compileScope.putUserData(AndroidProguardCompiler.INCLUDE_SYSTEM_PROGUARD_FILE, myIncludeSystemProguardFileCheckBox.isSelected());
}
@@ -410,4 +410,8 @@ class ApkStep extends ExportSignedPackageWizardStep {
}
});
}
@Override
protected void commitForNext() throws CommitStepException {
}
}
@@ -65,7 +65,7 @@
<grid row="0" column="2" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<grid id="e9e4a" layout-manager="GridLayoutManager" row-count="4" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<grid id="e9e4a" layout-manager="GridLayoutManager" row-count="5" column-count="2" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="0">
<margin top="0" left="0" bottom="0" right="0"/>
<constraints>
<grid row="2" column="0" row-span="1" col-span="3" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false"/>
@@ -102,7 +102,7 @@
</component>
<component id="96ed1" class="com.intellij.openapi.ui.LabeledComponent" binding="myAvdComboComponent">
<constraints>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="0" indent="3" use-parent-layout="false"/>
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="8" fill="0" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<componentClass value="com.intellij.ui.ComboboxWithBrowseButton"/>
@@ -116,6 +116,14 @@
<grid row="3" column="1" row-span="1" col-span="1" vsize-policy="1" hsize-policy="6" anchor="0" fill="1" indent="0" use-parent-layout="false"/>
</constraints>
</hspacer>
<component id="1fdbe" class="com.intellij.ui.components.JBLabel" binding="myMinSdkInfoMessageLabel">
<constraints>
<grid row="4" column="0" row-span="1" col-span="2" vsize-policy="0" hsize-policy="0" anchor="8" fill="2" indent="2" use-parent-layout="false"/>
</constraints>
<properties>
<text value=""/>
</properties>
</component>
</children>
</grid>
</children>
@@ -24,10 +24,14 @@ import com.intellij.openapi.options.SettingsEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.LabeledComponent;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.IconLoader;
import com.intellij.ui.IdeBorderFactory;
import com.intellij.ui.PanelWithAnchor;
import com.intellij.ui.RawCommandLineEditor;
import com.intellij.ui.components.JBLabel;
import org.jetbrains.android.facet.AndroidFacet;
import org.jetbrains.android.sdk.AndroidPlatform;
import org.jetbrains.android.util.AndroidBundle;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -39,6 +43,8 @@ import java.awt.event.ActionListener;
* @author yole
*/
public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase> extends SettingsEditor<T> implements PanelWithAnchor {
private static final Icon INFO_MESSAGE_ICON = IconLoader.getIcon("/compiler/warning.png");
private JPanel myPanel;
private JComboBox myModulesComboBox;
private LabeledComponent<RawCommandLineEditor> myCommandLineComponent;
@@ -53,6 +59,7 @@ public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase
private JRadioButton myEmulatorRadioButton;
private JRadioButton myUsbDeviceRadioButton;
private LabeledComponent<AvdComboBox> myAvdComboComponent;
private JBLabel myMinSdkInfoMessageLabel;
private AvdComboBox myAvdCombo;
private RawCommandLineEditor myCommandLineField;
private String incorrectPreferredAvd;
@@ -93,17 +100,23 @@ public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase
});
myAvdCombo = myAvdComboComponent.getComponent();
myMinSdkInfoMessageLabel.setBorder(IdeBorderFactory.createEmptyBorder(10, 0, 0, 0));
myMinSdkInfoMessageLabel.setIcon(INFO_MESSAGE_ICON);
myMinSdkInfoMessageLabel.setDisabledIcon(INFO_MESSAGE_ICON);
Disposer.register(this, myAvdCombo);
final ActionListener listener = new ActionListener() {
public void actionPerformed(ActionEvent e) {
boolean enabled = myEmulatorRadioButton.isSelected();
myAvdComboComponent.setEnabled(enabled);
myMinSdkInfoMessageLabel.setEnabled(enabled);
}
};
myModulesComboBox.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
myAvdCombo.startUpdatingAvds(ModalityState.current());
updateInfoMessage();
}
});
myShowChooserRadioButton.addActionListener(listener);
@@ -114,6 +127,26 @@ public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase
myNetworkLatencyCombo.setModel(new DefaultComboBoxModel(NETWORK_LATENCIES));
}
private void updateInfoMessage() {
int apiLevel = -1;
final Module module = getModuleSelector().getModule();
if (module != null) {
final AndroidPlatform platform = AndroidPlatform.getInstance(module);
if (platform != null) {
apiLevel = platform.getTarget().getVersion().getApiLevel();
}
}
if (apiLevel >= 0) {
myMinSdkInfoMessageLabel.setText(AndroidBundle.message("deployment.target.settings.min.sdk.info.message", apiLevel));
myMinSdkInfoMessageLabel.setVisible(true);
}
else {
myMinSdkInfoMessageLabel.setText("");
myMinSdkInfoMessageLabel.setVisible(false);
}
}
@Override
public JComponent getAnchor() {
return anchor;
@@ -163,6 +196,7 @@ public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase
myUsbDeviceRadioButton.setSelected(targetSelectionMode == TargetSelectionMode.USB_DEVICE);
myAvdComboComponent.setEnabled(targetSelectionMode == TargetSelectionMode.EMULATOR);
myMinSdkInfoMessageLabel.setEnabled(targetSelectionMode == TargetSelectionMode.EMULATOR);
myCommandLineField.setText(configuration.COMMAND_LINE);
myConfigurationSpecificEditor.resetFrom(configuration);
@@ -171,6 +205,8 @@ public class AndroidRunConfigurationEditor<T extends AndroidRunConfigurationBase
myNetworkSpeedCombo.setSelectedItem(configuration.NETWORK_SPEED);
myNetworkLatencyCombo.setSelectedItem(configuration.NETWORK_SPEED);
myClearLogCheckBox.setSelected(configuration.CLEAR_LOGCAT);
updateInfoMessage();
}
protected void applyEditorTo(T configuration) throws ConfigurationException {
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:frameDur<caret>/>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:frameDuration=""/>
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="@<caret>"/>
@@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<animated-rotate xmlns:android="http://schemas.android.com/apk/res/android"
android:drawable="<error>@drawable/adsdsd</error>"
android:pivotX="50%"
android:pivotY="50%"
android:framesCount="12"
android:frameDuration="<error>aba</error>"/>
@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item>
<animated-rotate android:drawable="@drawable/myDrawable"/>
</item>
</layer-list>
@@ -9,6 +9,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:text="@string/welcome"
android:padding="@null"
/>
<TextView
@@ -16,6 +17,7 @@
android:layout_height="wrap_content"
android:layout_marginBottom="10dip"
android:text="<error>@string/animation_1_instructions</error>"
android:padding="<error>@nul</error>"
/>
<RadioGroup android:layout_width="fill_parent" android:layout_height="wrap_content"/>
@@ -249,13 +249,29 @@ public class AndroidDrawableResourcesDomTest extends AndroidDomTest {
doTestCompletion();
}
public void testAnimatedRotateCompletion1() throws Throwable {
doTestCompletion();
}
public void testAnimatedRotateCompletion2() throws Throwable {
doTestOnlyDrawableReferences();
}
public void testAnimatedRotateHighlighting1() throws Throwable {
doTestHighlighting();
}
public void testAnimatedRotateHighlighting2() throws Throwable {
doTestHighlighting();
}
public void testIncorrectRootTag() throws Throwable {
doTestHighlighting();
}
public void testRootTagCompletion() throws Throwable {
doTestCompletionVariants(getTestName(true) + ".xml", "selector", "bitmap", "nine-patch", "layer-list", "level-list", "transition",
"inset", "clip", "scale", "shape");
"inset", "clip", "scale", "shape", "animation-list", "animated-rotate");
}
public void testInlineClip() throws Throwable {
@@ -27,7 +27,6 @@ import com.intellij.openapi.ui.TextFieldWithBrowseButton;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.IconLoader;
import com.intellij.openapi.util.io.FileUtil;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.ui.IdeBorderFactory;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.idea.devkit.DevKitBundle;
@@ -128,7 +127,6 @@ public class PluginModuleBuildConfEditor implements ModuleConfigurationEditor {
}
public void reset() {
LocalFileSystem.getInstance().refresh(false);
myPluginXML.setText(myBuildProperties.getPluginXmlPath().substring(0, myBuildProperties.getPluginXmlPath().length() - META_INF.length() - PLUGIN_XML.length() - 2));
myManifest.setText(myBuildProperties.getManifestPath());
myUseUserManifest.setSelected(myBuildProperties.isUseUserManifest());
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.pom.Navigatable;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.intellij.psi.xml.XmlDocument;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
@@ -74,7 +75,12 @@ public class MavenPropertyPsiReference extends MavenPsiReference {
@Nullable
public PsiElement resolve() {
PsiElement result = doResolve();
if (result == null) return result;
if (result == null) {
if (MavenDomUtil.isMavenFile(getElement())) {
result = tryResolveToActivationSection();
if (result == null) return null;
}
}
if (result instanceof XmlTag) {
XmlTagChild[] children = ((XmlTag)result).getValue().getChildren();
@@ -85,6 +91,30 @@ public class MavenPropertyPsiReference extends MavenPsiReference {
return result;
}
private PsiElement tryResolveToActivationSection() {
XmlTag xmlTag = PsiTreeUtil.getParentOfType(getElement(), XmlTag.class);
while (xmlTag != null) {
if (xmlTag.getName().equals("profile")) {
XmlTag activation = xmlTag.findFirstSubTag("activation");
if (activation != null) {
for (XmlTag propertyTag : activation.findSubTags("property")) {
XmlTag nameTag = propertyTag.findFirstSubTag("name");
if (nameTag != null) {
if (nameTag.getValue().getTrimmedText().equals(myText)) {
return nameTag;
}
}
}
}
break;
}
xmlTag = xmlTag.getParentTag();
}
return null;
}
// See org.apache.maven.project.interpolation.AbstractStringBasedModelInterpolator.createValueSources()
@Nullable
protected PsiElement doResolve() {
@@ -194,11 +194,25 @@ public abstract class MavenDomTestCase extends MavenImportingTestCase {
String text = VfsUtilCore.loadText(file);
int index = text.indexOf(referenceText);
assert index >= 0;
assert text.indexOf(referenceText, index + referenceText.length()) == -1 : "Reference text '" + referenceText + "' occurs more than one times";
return getReferenceAt(file, index);
}
@Nullable
protected PsiReference getReference(VirtualFile file, @NotNull String referenceText, int index) throws IOException {
String text = VfsUtilCore.loadText(file);
int k = -1;
do {
k = text.indexOf(referenceText, k + 1);
assert k >= 0 : index;
}
while (--index >= 0);
return getReferenceAt(file, k);
}
@Nullable
protected PsiElement resolveReference(VirtualFile file, @NotNull String referenceText) throws IOException {
@@ -0,0 +1,57 @@
/*
* 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.idea.maven.dom
/**
* @author Sergey Evdokimov
*/
class MavenPropertyInActivationSectionTest extends MavenDomTestCase {
public void testResolvePropertyFromActivationSection() throws IOException {
importProject("""
<groupId>example</groupId>
<artifactId>parent</artifactId>
<packaging>jar</packaging>
<version>1.0</version>
<name>example</name>
<profiles>
<profile>
<id>glassfish-env-path</id>
<activation>
<property>
<name>env.GLASSFISH_HOME_123</name>
</property>
</activation>
<properties>
<glassfish.home.path>\${env.GLASSFISH_HOME_123}</glassfish.home.path>
</properties>
</profile>
</profiles>
<properties>
<aaa>\${env.GLASSFISH_HOME_123}</aaa>
</properties>
""");
assert getReference(myProjectPom, "env.GLASSFISH_HOME_123", 1).resolve() != null
assert getReference(myProjectPom, "env.GLASSFISH_HOME_123", 2).resolve() == null
}
}
@@ -1,83 +0,0 @@
/*
* 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.idea.maven.plugins.sql
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
import gnu.trove.THashSet
import gnu.trove.TObjectHashingStrategy
import com.intellij.util.text.CaseInsensitiveStringHashingStrategy
/**
* @author Sergey Evdokimov
*/
class MavenSqlInjectionTest extends LightCodeInsightFixtureTestCase {
public void testCompletion() {
myFixture.configureByText("pom.xml", """
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>simpleMaven</groupId>
<artifactId>simpleMaven</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>sql-maven-plugin</artifactId>
<version>1.0</version>
<executions>
<execution>
<id>groovy-magic</id>
<phase>package</phase>
<goals>
<goal>execute</goal>
</goals>
<configuration>
<sqlCommand>
<caret>
</sqlCommand>
</configuration>
</execution>
</executions>
<dependencies>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
<version>1.8.0</version>
</dependency>
</dependencies>
</plugin>
</plugins>
</build>
</project>
""")
myFixture.completeBasic()
def lookups = myFixture.lookupElementStrings
lookups = new THashSet<String>(lookups, CaseInsensitiveStringHashingStrategy.INSTANCE)
assert lookups.containsAll(["select", "update", "delete"])
}
}
Binary file not shown.
Binary file not shown.
+2
View File
@@ -18,7 +18,9 @@
<library name="axis-1.4">
<CLASSES>
<root url="jar://$MODULE_DIR$/lib/axis-1.4.jar!/" />
<root url="jar://$MODULE_DIR$/lib/wsdl4j-1.4.jar!/" />
<root url="jar://$MODULE_DIR$/lib/axis-jaxrpc-1.4.jar!/" />
<root url="jar://$MODULE_DIR$/lib/axis-saaj-1.3.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES>
@@ -316,6 +316,7 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
protected final void showProgress(String message) {
myProgressMessage.setText(message);
if (myProgressPanel.getParent() == null) {
myGlassLayer.setEnabled(false);
myProgressIcon.resume();
myLayeredPane.add(myProgressPanel, LAYER_PROGRESS);
myLayeredPane.repaint();
@@ -323,6 +324,7 @@ public abstract class DesignerEditorPanel extends JPanel implements DataProvider
}
protected final void hideProgress() {
myGlassLayer.setEnabled(true);
myProgressIcon.suspend();
myLayeredPane.remove(myProgressPanel);
}
@@ -29,13 +29,26 @@ import java.awt.event.MouseEvent;
* @author Alexander Lobas
*/
public final class GlassLayer extends JComponent implements PopupOwner, DataProvider {
private static final long EVENT_FLAGS = AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK;
private final ToolProvider myToolProvider;
private final EditableArea myArea;
public GlassLayer(ToolProvider provider, EditableArea area) {
myToolProvider = provider;
myArea = area;
enableEvents(AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.MOUSE_MOTION_EVENT_MASK);
enableEvents(EVENT_FLAGS);
}
@Override
public void setEnabled(boolean enabled) {
super.setEnabled(enabled);
if (enabled) {
enableEvents(EVENT_FLAGS);
}
else {
disableEvents(EVENT_FLAGS);
}
}
@Override
-4
View File
@@ -111,10 +111,6 @@
interface="com.intellij.openapi.compiler.util.InspectionValidator"
area="IDEA_PROJECT"/>
<!-- to be moved to a dedicated com.intellij.jpa plugin when available -->
<extensionPoint name="jpa.ql.persistenceModelProvider"
interface="com.intellij.jpa.ql.model.PersistenceModelProvider"/>
<extensionPoint name="javaExpressionSurrounder"
interface="com.intellij.codeInsight.generation.surroundWith.JavaExpressionSurrounder"/>