mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' of git@git.labs.intellij.net:idea/community
This commit is contained in:
@@ -23,6 +23,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../../../lib/dev/compilerapi.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module" module-name="lang-impl" />
|
||||
|
||||
+1
-1
@@ -86,7 +86,7 @@ public class SuppressWarningsFoldingBuilder extends FoldingBuilderEx {
|
||||
return o.toString();
|
||||
}
|
||||
}
|
||||
return memberValue.getText();
|
||||
return memberValue != null ? memberValue.getText() : "";
|
||||
}
|
||||
|
||||
|
||||
|
||||
+8
-2
@@ -165,9 +165,15 @@ class InlineConstantFieldProcessor extends BaseRefactoringProcessor {
|
||||
PsiExpression qExpression = ((PsiReferenceExpression)expr).getQualifierExpression();
|
||||
if (qExpression != null) {
|
||||
if (initializer1 instanceof PsiMethodCallExpression) {
|
||||
((PsiMethodCallExpression)initializer1).getMethodExpression().setQualifierExpression(qExpression);
|
||||
PsiReferenceExpression methodExpression = ((PsiMethodCallExpression)initializer1).getMethodExpression();
|
||||
if (methodExpression.getQualifierExpression() == null) {
|
||||
methodExpression.setQualifierExpression(qExpression);
|
||||
}
|
||||
} else if (initializer1 instanceof PsiReferenceExpression) {
|
||||
((PsiReferenceExpression)initializer1).setQualifierExpression(qExpression);
|
||||
PsiReferenceExpression referenceExpression = (PsiReferenceExpression)initializer1;
|
||||
if (referenceExpression.getQualifierExpression() == null) {
|
||||
referenceExpression.setQualifierExpression(qExpression);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+16
-6
@@ -194,12 +194,20 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
return tempExpr;
|
||||
}
|
||||
|
||||
public static PsiExpression getSelectedExpression(final Project project, final PsiFile file, final int startOffset, final int endOffset) {
|
||||
public static PsiExpression getSelectedExpression(final Project project, final PsiFile file, int startOffset, int endOffset) {
|
||||
|
||||
final PsiElement elementAtStart = file.findElementAt(startOffset);
|
||||
if (elementAtStart == null) return null;
|
||||
final PsiElement elementAtEnd = file.findElementAt(endOffset - 1);
|
||||
if (elementAtEnd == null) return null;
|
||||
PsiElement elementAtStart = file.findElementAt(startOffset);
|
||||
if (elementAtStart == null || elementAtStart instanceof PsiWhiteSpace || elementAtStart instanceof PsiComment) {
|
||||
elementAtStart = PsiTreeUtil.skipSiblingsForward(elementAtStart, PsiWhiteSpace.class, PsiComment.class);
|
||||
if (elementAtStart == null) return null;
|
||||
startOffset = elementAtStart.getTextOffset();
|
||||
}
|
||||
PsiElement elementAtEnd = file.findElementAt(endOffset - 1);
|
||||
if (elementAtEnd == null || elementAtEnd instanceof PsiWhiteSpace || elementAtEnd instanceof PsiComment) {
|
||||
elementAtEnd = PsiTreeUtil.skipSiblingsBackward(elementAtEnd, PsiWhiteSpace.class, PsiComment.class);
|
||||
if (elementAtEnd == null) return null;
|
||||
endOffset = elementAtEnd.getTextRange().getEndOffset();
|
||||
}
|
||||
|
||||
PsiExpression tempExpr;
|
||||
PsiElement elementAt = PsiTreeUtil.findCommonParent(elementAtStart, elementAtEnd);
|
||||
@@ -295,7 +303,9 @@ public abstract class IntroduceVariableBase extends IntroduceHandlerBase impleme
|
||||
tempExpr.putUserData(ElementToWorkOn.PARENT, parent);
|
||||
}
|
||||
else {
|
||||
PsiErrorElement errorElement = PsiTreeUtil.getNextSiblingOfType(elementAtStart, PsiErrorElement.class);
|
||||
PsiErrorElement errorElement = elementAtStart instanceof PsiErrorElement
|
||||
? (PsiErrorElement)elementAtStart
|
||||
: PsiTreeUtil.getNextSiblingOfType(elementAtStart, PsiErrorElement.class);
|
||||
if (errorElement == null) {
|
||||
errorElement = PsiTreeUtil.getParentOfType(elementAtStart, PsiErrorElement.class);
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class QTest {
|
||||
final int myI = Source.CONST;
|
||||
public static void main(String[] args) {
|
||||
System.out.println(new QTest().my<caret>I);
|
||||
}
|
||||
}
|
||||
|
||||
class Source {
|
||||
int CONST = 0;
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class QTest {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(Source.CONST);
|
||||
}
|
||||
}
|
||||
|
||||
class Source {
|
||||
int CONST = 0;
|
||||
}
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
class A {
|
||||
public void test(boolean a, boolean b) {
|
||||
final boolean ab = a &&
|
||||
b;
|
||||
if (true && ab
|
||||
//some comment
|
||||
|
||||
);
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
public void test(boolean a, boolean b) {
|
||||
if (true && <selection>a &&
|
||||
b
|
||||
//some comment
|
||||
</selection>
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -198,6 +198,10 @@ public class IntroduceVariableTest extends LightCodeInsightTestCase {
|
||||
public void testAndAndSubexpression() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("ab", true, true, false, "boolean"));
|
||||
}
|
||||
|
||||
public void testSubexpressionWithSpacesInSelection() throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("ab", true, true, false, "boolean"));
|
||||
}
|
||||
|
||||
public void testDuplicatesAnonymousClassCreationWithSimilarParameters () throws Exception {
|
||||
doTest(new MockIntroduceVariableHandler("foo1", true, true, false, "Foo"));
|
||||
|
||||
@@ -25,6 +25,10 @@ public class InlineConstantFieldTest extends LightCodeInsightTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testQualifiedConstantExpressionReplacedWithAnotherOne() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Sdk getProjectJDK() {
|
||||
return JavaSdkImpl.getMockJdk17("java 1.5");
|
||||
|
||||
@@ -18,17 +18,18 @@ package com.intellij.psi.search.scope.packageSet;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.problems.WolfTheProblemSolver;
|
||||
import com.intellij.psi.*;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class PatternPackageSet implements PackageSet {
|
||||
public class PatternPackageSet implements PatternBasedPackageSet {
|
||||
@NonNls public static final String SCOPE_TEST = "test";
|
||||
@NonNls public static final String SCOPE_SOURCE = "src";
|
||||
@NonNls public static final String SCOPE_LIBRARY = "lib";
|
||||
@@ -136,4 +137,20 @@ public class PatternPackageSet implements PackageSet {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModulePattern() {
|
||||
return myModulePatternText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOn(String oldQName) {
|
||||
return Comparing.strEqual(oldQName, myAspectJSyntaxPattern) || //class qname
|
||||
Comparing.strEqual(oldQName + "..*", myAspectJSyntaxPattern) || //package req
|
||||
Comparing.strEqual(oldQName + ".*", myAspectJSyntaxPattern); //package
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern() {
|
||||
return myAspectJSyntaxPattern;
|
||||
}
|
||||
}
|
||||
+4
@@ -45,4 +45,8 @@ public class ComplementPackageSet implements PackageSet {
|
||||
public int getNodePriority() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
public PackageSet getComplementarySet() {
|
||||
return myComplementarySet;
|
||||
}
|
||||
}
|
||||
|
||||
+17
-1
@@ -26,6 +26,7 @@ import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.roots.ProjectFileIndex;
|
||||
import com.intellij.openapi.roots.ProjectRootManager;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -34,7 +35,7 @@ import org.jetbrains.annotations.NonNls;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
public class FilePatternPackageSet implements PackageSet {
|
||||
public class FilePatternPackageSet implements PatternBasedPackageSet {
|
||||
public static final @NonNls String SCOPE_FILE = "file";
|
||||
private Pattern myModulePattern;
|
||||
private Pattern myModuleGroupPattern;
|
||||
@@ -169,6 +170,21 @@ public class FilePatternPackageSet implements PackageSet {
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPattern() {
|
||||
return myPathPattern;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getModulePattern() {
|
||||
return myModulePatternText;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOn(String oldQName) {
|
||||
return Comparing.strEqual(myPathPattern, oldQName);
|
||||
}
|
||||
|
||||
public static String getRelativePath(final VirtualFile virtualFile, final ProjectFileIndex index, final boolean useFQName) {
|
||||
final Module module = index.getModuleForFile(virtualFile);
|
||||
if (module != null) {
|
||||
|
||||
+8
@@ -52,4 +52,12 @@ public class IntersectionPackageSet implements PackageSet {
|
||||
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
public PackageSet getFirstSet() {
|
||||
return myFirstSet;
|
||||
}
|
||||
|
||||
public PackageSet getSecondSet() {
|
||||
return mySecondSet;
|
||||
}
|
||||
}
|
||||
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.psi.search.scope.packageSet;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: Jul 26, 2010
|
||||
*/
|
||||
public interface PatternBasedPackageSet extends PackageSet{
|
||||
String getPattern();
|
||||
String getModulePattern();
|
||||
|
||||
boolean isOn(String oldQName);
|
||||
}
|
||||
@@ -42,4 +42,12 @@ public class UnionPackageSet implements PackageSet {
|
||||
public String getText() {
|
||||
return myFirstSet.getText() + "||" + mySecondSet.getText();
|
||||
}
|
||||
|
||||
public PackageSet getFirstSet() {
|
||||
return myFirstSet;
|
||||
}
|
||||
|
||||
public PackageSet getSecondSet() {
|
||||
return mySecondSet;
|
||||
}
|
||||
}
|
||||
@@ -180,12 +180,22 @@ public class PsiTreeUtil {
|
||||
}
|
||||
|
||||
@Nullable public static <T extends PsiElement> T findChildOfType(@NotNull final PsiElement element, @NotNull final Class<T> aClass, final boolean strict) {
|
||||
return findChildOfAnyType(element, strict, aClass);
|
||||
}
|
||||
|
||||
@Nullable public static <T extends PsiElement> T findChildOfAnyType(@NotNull final PsiElement element, @NotNull final Class<T>... classes) {
|
||||
return findChildOfAnyType(element, true, classes);
|
||||
}
|
||||
|
||||
@Nullable public static <T extends PsiElement> T findChildOfAnyType(@NotNull final PsiElement element, final boolean strict, @NotNull final Class<T>... classes) {
|
||||
PsiElementProcessor.FindElement<PsiElement> processor = new PsiElementProcessor.FindElement<PsiElement>() {
|
||||
@Override
|
||||
public boolean execute(PsiElement each) {
|
||||
if (strict && each == element) return true;
|
||||
if (instanceOf(aClass, each)) {
|
||||
return setFound(each);
|
||||
for (Class<T> eachClass : classes) {
|
||||
if (instanceOf(eachClass, each)) {
|
||||
return setFound(each);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.intellij.openapi.module.ModuleManager;
|
||||
import com.intellij.openapi.module.impl.ModuleImpl;
|
||||
import com.intellij.openapi.module.impl.scopes.JdkScope;
|
||||
import com.intellij.openapi.module.impl.scopes.LibraryRuntimeClasspathScope;
|
||||
import com.intellij.openapi.project.DumbAwareRunnable;
|
||||
import com.intellij.openapi.project.DumbServiceImpl;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ex.ProjectEx;
|
||||
@@ -619,11 +618,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
|
||||
return; // in test mode suppress addition to a queue unless project is properly initialized
|
||||
}
|
||||
}
|
||||
myStartupManager.runWhenProjectIsInitialized(new DumbAwareRunnable() {
|
||||
public void run() {
|
||||
DumbServiceImpl.getInstance(myProject).queueCacheUpdate(myRefreshCacheUpdaters);
|
||||
}
|
||||
});
|
||||
DumbServiceImpl.getInstance(myProject).queueCacheUpdate(myRefreshCacheUpdaters);
|
||||
}
|
||||
|
||||
private void addRootsToWatch() {
|
||||
|
||||
+144
@@ -0,0 +1,144 @@
|
||||
/*
|
||||
* Copyright 2000-2010 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.packageDependencies.ui;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.psi.PsiQualifiedNamedElement;
|
||||
import com.intellij.psi.search.scope.packageSet.*;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListener;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListenerComposite;
|
||||
import com.intellij.refactoring.listeners.RefactoringElementListenerProvider;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
/**
|
||||
* User: anna
|
||||
* Date: Jul 26, 2010
|
||||
*/
|
||||
public class RefactoringScopeElementListenerProvider implements RefactoringElementListenerProvider {
|
||||
private static final Logger LOG = Logger.getInstance("#" + RefactoringScopeElementListenerProvider.class.getName());
|
||||
|
||||
@Override
|
||||
public RefactoringElementListener getListener(PsiElement element) {
|
||||
final PsiFile containingFile = element.getContainingFile();
|
||||
if (!(element instanceof PsiQualifiedNamedElement)) return null;
|
||||
final String oldName = ((PsiQualifiedNamedElement)element).getQualifiedName();
|
||||
RefactoringElementListenerComposite composite = null;
|
||||
for (final NamedScopesHolder holder : NamedScopeManager.getAllNamedScopeHolders(element.getProject())) {
|
||||
final NamedScope[] scopes = holder.getEditableScopes();
|
||||
for (int i = 0; i < scopes.length; i++) {
|
||||
final NamedScope scope = scopes[i];
|
||||
final PackageSet packageSet = scope.getValue();
|
||||
if (packageSet != null && (containingFile == null || packageSet.contains(containingFile, holder))) {
|
||||
composite = traverse(new OldScopeDescriptor(oldName, scope, i, holder), composite, packageSet);
|
||||
}
|
||||
}
|
||||
}
|
||||
return composite;
|
||||
}
|
||||
|
||||
private static RefactoringElementListenerComposite traverse(OldScopeDescriptor scopeDescriptor,
|
||||
RefactoringElementListenerComposite composite,
|
||||
PackageSet packageSet) {
|
||||
if (packageSet instanceof PatternBasedPackageSet) {
|
||||
composite = checkPatternPackageSet(scopeDescriptor, composite, ((PatternBasedPackageSet)packageSet),
|
||||
scopeDescriptor.getScope().getValue().getText());
|
||||
}
|
||||
else if (packageSet instanceof ComplementPackageSet) {
|
||||
composite = traverse(scopeDescriptor, composite, ((ComplementPackageSet)packageSet).getComplementarySet());
|
||||
}
|
||||
else if (packageSet instanceof UnionPackageSet) {
|
||||
composite = traverse(scopeDescriptor, composite, ((UnionPackageSet)packageSet).getFirstSet());
|
||||
composite = traverse(scopeDescriptor, composite, ((UnionPackageSet)packageSet).getSecondSet());
|
||||
}
|
||||
else if (packageSet instanceof IntersectionPackageSet) {
|
||||
composite = traverse(scopeDescriptor, composite, ((IntersectionPackageSet)packageSet).getFirstSet());
|
||||
composite = traverse(scopeDescriptor, composite, ((IntersectionPackageSet)packageSet).getSecondSet());
|
||||
}
|
||||
return composite;
|
||||
}
|
||||
|
||||
private static RefactoringElementListenerComposite checkPatternPackageSet(final OldScopeDescriptor descriptor,
|
||||
RefactoringElementListenerComposite composite,
|
||||
final PatternBasedPackageSet pattern,
|
||||
final String text) {
|
||||
if (pattern.isOn(descriptor.getOldQName())) {
|
||||
if (composite == null) {
|
||||
composite = new RefactoringElementListenerComposite();
|
||||
}
|
||||
composite.addListener(new RefactoringElementListener() {
|
||||
@Override
|
||||
public void elementMoved(@NotNull PsiElement newElement) {
|
||||
setName(newElement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void elementRenamed(@NotNull PsiElement newElement) {
|
||||
setName(newElement);
|
||||
}
|
||||
|
||||
private void setName(@NotNull PsiElement newElement) {
|
||||
LOG.assertTrue(newElement instanceof PsiQualifiedNamedElement);
|
||||
try {
|
||||
final String newPattern = text.replace(descriptor.getOldQName(), ((PsiQualifiedNamedElement)newElement).getQualifiedName());
|
||||
final PackageSet newSet = PackageSetFactory.getInstance().compile(newPattern);
|
||||
NamedScope newScope = new NamedScope(descriptor.getScope().getName(), newSet);
|
||||
final NamedScope[] currentScopes = descriptor.getHolder().getEditableScopes();
|
||||
currentScopes[descriptor.getIdx()] = newScope;
|
||||
descriptor.getHolder().setScopes(currentScopes);
|
||||
}
|
||||
catch (ParsingException ignore) {
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
return composite;
|
||||
}
|
||||
|
||||
private static class OldScopeDescriptor {
|
||||
private final String myOldQName;
|
||||
private final NamedScopesHolder myHolder;
|
||||
private final int myIdx;
|
||||
private final NamedScope myScope;
|
||||
|
||||
private OldScopeDescriptor(final String oldQName,
|
||||
final NamedScope scope,
|
||||
final int idx,
|
||||
final NamedScopesHolder holder) {
|
||||
myOldQName = oldQName;
|
||||
myHolder = holder;
|
||||
myIdx = idx;
|
||||
myScope = scope;
|
||||
}
|
||||
|
||||
public String getOldQName() {
|
||||
return myOldQName;
|
||||
}
|
||||
|
||||
public NamedScopesHolder getHolder() {
|
||||
return myHolder;
|
||||
}
|
||||
|
||||
public int getIdx() {
|
||||
return myIdx;
|
||||
}
|
||||
|
||||
public NamedScope getScope() {
|
||||
return myScope;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -24,11 +24,13 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.PsiNamedElement;
|
||||
import com.intellij.refactoring.RefactoringBundle;
|
||||
import com.intellij.refactoring.rename.naming.AutomaticRenamer;
|
||||
import com.intellij.refactoring.ui.EnableDisableAction;
|
||||
import com.intellij.refactoring.ui.StringTableCellEditor;
|
||||
import com.intellij.refactoring.util.RefactoringUIUtil;
|
||||
import com.intellij.ui.BooleanTableCellRenderer;
|
||||
import com.intellij.ui.GuiUtils;
|
||||
import com.intellij.ui.TableUtil;
|
||||
@@ -248,15 +250,7 @@ public class AutomaticRenamingDialog extends DialogWrapper {
|
||||
case CHECK_COLUMN:
|
||||
return Boolean.valueOf(myShouldRename[rowIndex]);
|
||||
case OLD_NAME_COLUMN:
|
||||
final PsiNamedElement namedElement = myRenames[rowIndex];
|
||||
String location = null;
|
||||
if (namedElement instanceof NavigationItem) {
|
||||
final ItemPresentation presentation = ((NavigationItem)namedElement).getPresentation();
|
||||
if (presentation != null) {
|
||||
location = presentation.getLocationString();
|
||||
}
|
||||
}
|
||||
return namedElement.getName() + (location != null ? " " + location : "");
|
||||
return "<html>" + RefactoringUIUtil.getDescription(myRenames[rowIndex], true) + "</html>";
|
||||
case NEW_NAME_COLUMN:
|
||||
return myNewNames[rowIndex];
|
||||
default:
|
||||
|
||||
@@ -118,8 +118,10 @@ public class RenameProcessor extends BaseRefactoringProcessor {
|
||||
final List<RenamePsiElementProcessor> processors = RenamePsiElementProcessor.allForElement(element);
|
||||
myForceShowPreview = false;
|
||||
for (RenamePsiElementProcessor processor : processors) {
|
||||
processor.prepareRenaming(element, newName, allRenames);
|
||||
myForceShowPreview |= processor.forcesShowPreview();
|
||||
if (processor.canProcessElement(element)) {
|
||||
processor.prepareRenaming(element, newName, allRenames);
|
||||
myForceShowPreview |= processor.forcesShowPreview();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -51,17 +51,17 @@ public class FileBasedIndexProjectHandler extends AbstractProjectComponent imple
|
||||
if (startupManager != null) {
|
||||
startupManager.registerPreStartupActivity(new Runnable() {
|
||||
public void run() {
|
||||
final RefreshCacheUpdater refreshUpdater = new RefreshCacheUpdater();
|
||||
final UnindexedFilesUpdater rootsChangeUpdater = new UnindexedFilesUpdater(project, index);
|
||||
final RefreshCacheUpdater changedFilesUpdater = new RefreshCacheUpdater();
|
||||
final UnindexedFilesUpdater unindexedFilesUpdater = new UnindexedFilesUpdater(project, index);
|
||||
|
||||
startupManager.registerCacheUpdater(rootsChangeUpdater);
|
||||
rootManager.registerRootsChangeUpdater(rootsChangeUpdater);
|
||||
rootManager.registerRefreshUpdater(refreshUpdater);
|
||||
startupManager.registerCacheUpdater(unindexedFilesUpdater);
|
||||
rootManager.registerRootsChangeUpdater(unindexedFilesUpdater);
|
||||
rootManager.registerRefreshUpdater(changedFilesUpdater);
|
||||
myIndex.registerIndexableSet(FileBasedIndexProjectHandler.this, project);
|
||||
projectManager.addProjectManagerListener(project, new ProjectManagerAdapter() {
|
||||
public void projectClosing(Project project) {
|
||||
rootManager.unregisterRefreshUpdater(refreshUpdater);
|
||||
rootManager.unregisterRootsChangeUpdater(rootsChangeUpdater);
|
||||
rootManager.unregisterRefreshUpdater(changedFilesUpdater);
|
||||
rootManager.unregisterRootsChangeUpdater(unindexedFilesUpdater);
|
||||
myIndex.removeIndexableSet(FileBasedIndexProjectHandler.this);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -296,6 +296,7 @@
|
||||
|
||||
<patternDialectProvider implementation="com.intellij.packageDependencies.ui.ProjectPatternProvider" id="file"/>
|
||||
<customScopesProvider implementation="com.intellij.packageDependencies.DefaultScopesProvider"/>
|
||||
<refactoring.elementListenerProvider implementation="com.intellij.packageDependencies.ui.RefactoringScopeElementListenerProvider"/>
|
||||
|
||||
<highlightVisitor implementation="com.intellij.codeInsight.daemon.impl.analysis.DefaultHighlightVisitor"/>
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ public abstract class AbstractVcsAction extends AsyncUpdateAction<VcsContext> im
|
||||
|
||||
@NotNull
|
||||
protected static FilePath[] filterDescindingFiles(@NotNull FilePath[] roots, Project project) {
|
||||
return DescindingFilesFilter.filterDescindingFiles(roots, project, null);
|
||||
return DescindingFilesFilter.filterDescindingFiles(roots, project);
|
||||
}
|
||||
|
||||
protected VcsContext prepareDataFromContext(final AnActionEvent e) {
|
||||
|
||||
@@ -16,15 +16,12 @@
|
||||
package com.intellij.openapi.vcs.actions;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vcs.AbstractVcs;
|
||||
import com.intellij.openapi.vcs.FilePath;
|
||||
import com.intellij.openapi.vcs.ProjectLevelVcsManager;
|
||||
import com.intellij.openapi.vcs.VcsKey;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
@@ -33,8 +30,7 @@ public class DescindingFilesFilter {
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public static FilePath[] filterDescindingFiles(@NotNull FilePath[] roots, Project project,
|
||||
@Nullable final Convertor<Pair<FilePath, AbstractVcs>, Boolean> pathsFilter) {
|
||||
public static FilePath[] filterDescindingFiles(@NotNull FilePath[] roots, Project project) {
|
||||
final List<FilePath> result = new LinkedList<FilePath>();
|
||||
ProjectLevelVcsManager manager = ProjectLevelVcsManager.getInstance(project);
|
||||
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.intellij.openapi.vcs.checkin.CheckinHandler;
|
||||
import com.intellij.openapi.vcs.impl.ProjectLevelVcsManagerImpl;
|
||||
import com.intellij.openapi.vcs.impl.VcsInitObject;
|
||||
import com.intellij.openapi.vcs.readOnlyHandler.ReadonlyStatusHandlerImpl;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.ui.EditorNotifications;
|
||||
@@ -1084,7 +1085,9 @@ public class ChangeListManagerImpl extends ChangeListManagerEx implements Projec
|
||||
@Nullable
|
||||
private VcsKey findVcs(final String path) {
|
||||
// does not matter directory or not
|
||||
final AbstractVcs vcs = myVcsManager.getVcsFor(FilePathImpl.create(new File(path), false));
|
||||
final VirtualFile vf = LocalFileSystem.getInstance().refreshAndFindFileByIoFile(new File(path));
|
||||
if (vf == null) return null;
|
||||
final AbstractVcs vcs = myVcsManager.getVcsFor(vf);
|
||||
return vcs == null ? null : vcs.getKeyInstanceMethod();
|
||||
}
|
||||
}
|
||||
|
||||
+14
-1
@@ -658,9 +658,22 @@ public void addMessageToConsoleWindow(final String message, final TextAttributes
|
||||
return !myHaveLegacyVcsConfiguration && !myMappingsLoaded;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used to guess VCS for automatic mapping through a look into a working copy
|
||||
*/
|
||||
@Nullable
|
||||
public AbstractVcs findVersioningVcs(VirtualFile file) {
|
||||
return getVcsFor(file);
|
||||
final VcsDescriptor[] vcsDescriptors = getAllVcss();
|
||||
VcsDescriptor probableVcs = null;
|
||||
for (VcsDescriptor vcsDescriptor : vcsDescriptors) {
|
||||
if (vcsDescriptor.probablyUnderVcs(file)) {
|
||||
if (probableVcs != null) {
|
||||
return null;
|
||||
}
|
||||
probableVcs = vcsDescriptor;
|
||||
}
|
||||
}
|
||||
return probableVcs == null ? null : findVcsByName(probableVcs.getName());
|
||||
}
|
||||
|
||||
public CheckoutProvider.Listener getCompositeCheckoutListener() {
|
||||
|
||||
+1
-10
@@ -31,7 +31,6 @@ import com.intellij.openapi.progress.Task;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ex.ProjectManagerEx;
|
||||
import com.intellij.openapi.ui.MessageType;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import com.intellij.openapi.vcs.*;
|
||||
import com.intellij.openapi.vcs.actions.AbstractVcsAction;
|
||||
@@ -50,7 +49,6 @@ import com.intellij.openapi.vfs.VfsUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import com.intellij.util.containers.Convertor;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import com.intellij.util.ui.OptionsDialog;
|
||||
import com.intellij.vcsUtil.VcsUtil;
|
||||
@@ -84,14 +82,7 @@ public abstract class AbstractCommonUpdateAction extends AbstractVcsAction {
|
||||
if (project != null) {
|
||||
try {
|
||||
final FilePath[] filePaths = myScopeInfo.getRoots(context, myActionInfo);
|
||||
final FilePath[] roots = DescindingFilesFilter.filterDescindingFiles(filterRoots(filePaths, context), project,
|
||||
new Convertor<Pair<FilePath, AbstractVcs>, Boolean>() {
|
||||
public Boolean convert(Pair<FilePath, AbstractVcs> pair) {
|
||||
final AbstractVcs vcs = pair.getSecond();
|
||||
final FilePath fp = pair.getFirst();
|
||||
return vcs.isVersionedDirectory(fp.getVirtualFile());
|
||||
}
|
||||
});
|
||||
final FilePath[] roots = DescindingFilesFilter.filterDescindingFiles(filterRoots(filePaths, context), project);
|
||||
if (roots.length == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/../lib/trilead-ssh2-build213.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="file://$MODULE_DIR$/../trilead-ssh2-build213/src" />
|
||||
</SOURCES>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/trilead-ssh2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$MODULE_DIR$/lib/trilead-ssh2-src.zip!/" />
|
||||
</SOURCES>
|
||||
|
||||
@@ -54,7 +54,7 @@ public class GitLogTreeFileSelector extends DialogWrapper {
|
||||
}
|
||||
|
||||
private void initUi() {
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, false, false, false, true);
|
||||
final FileChooserDescriptor descriptor = new FileChooserDescriptor(true, true, true, true, false, true);
|
||||
descriptor.setRoot(myRoot);
|
||||
myFileSystemTree = FileSystemTreeFactory.SERVICE.getInstance().createFileSystemTree(myProject, descriptor);
|
||||
final JTree tree = myFileSystemTree.getTree();
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/gradle-open-api-0.8.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module" module-name="java-impl" />
|
||||
|
||||
+32
-17
@@ -15,25 +15,35 @@
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.codeInspection.unusedDef;
|
||||
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.codeInspection.ProblemHighlightType;
|
||||
import com.intellij.codeInspection.ProblemsHolder;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiReference;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.search.LocalSearchScope;
|
||||
import com.intellij.psi.search.searches.ReferencesSearch;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.Processor;
|
||||
import gnu.trove.*;
|
||||
import org.jetbrains.annotations.*;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import gnu.trove.TIntObjectHashMap;
|
||||
import gnu.trove.TIntProcedure;
|
||||
import gnu.trove.TObjectProcedure;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.codeInspection.GroovyInspectionBundle;
|
||||
import org.jetbrains.plugins.groovy.codeInspection.GroovyLocalInspectionBase;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GrControlFlowOwner;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyFileBase;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyPsiElement;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrClassInitializer;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrClassInitializer;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.blocks.GrClosableBlock;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrAssignmentExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrPostfixExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrReferenceExpression;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.controlFlow.Instruction;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.controlFlow.ReadWriteVariableInstruction;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.dataFlow.DFAEngine;
|
||||
@@ -105,22 +115,27 @@ public class UnusedDefInspection extends GroovyLocalInspectionBase {
|
||||
|
||||
unusedDefs.forEach(new TIntProcedure() {
|
||||
public boolean execute(int num) {
|
||||
final ReadWriteVariableInstruction instruction = (ReadWriteVariableInstruction) flow[num];
|
||||
final ReadWriteVariableInstruction instruction = (ReadWriteVariableInstruction)flow[num];
|
||||
final PsiElement element = instruction.getElement();
|
||||
if (element == null) return true;
|
||||
PsiElement toHighlight = null;
|
||||
if (isLocalAssignment(element) && isUsedInToplevelFlowOnly(element)) {
|
||||
if (element instanceof GrReferenceExpression) {
|
||||
PsiElement parent = element.getParent();
|
||||
PsiElement toHighlight = null;
|
||||
if (parent instanceof GrAssignmentExpression) {
|
||||
toHighlight = ((GrAssignmentExpression) parent).getLValue();
|
||||
} if (parent instanceof GrPostfixExpression) {
|
||||
toHighlight = ((GrAssignmentExpression)parent).getRValue();
|
||||
}
|
||||
if (parent instanceof GrPostfixExpression) {
|
||||
toHighlight = parent;
|
||||
}
|
||||
if (toHighlight == null) toHighlight = element;
|
||||
problemsHolder.registerProblem(toHighlight, GroovyInspectionBundle.message("unused.assignment.tooltip"), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
} else if (element instanceof GrVariable) {
|
||||
problemsHolder.registerProblem(((GrVariable) element).getNameIdentifierGroovy(), GroovyInspectionBundle.message("unused.assignment.tooltip"), ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
}
|
||||
else if (element instanceof GrVariable) {
|
||||
toHighlight = ((GrVariable)element).getInitializerGroovy();
|
||||
if (toHighlight == null) toHighlight = ((GrVariable)element).getNameIdentifierGroovy();
|
||||
}
|
||||
if (toHighlight == null) toHighlight = element;
|
||||
problemsHolder.registerProblem(toHighlight, GroovyInspectionBundle.message("unused.assignment.tooltip"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -71,7 +71,7 @@ public class GppTypeConverter extends GrTypeConverter {
|
||||
return true;
|
||||
}
|
||||
|
||||
if (hasDefaultConstructor(lType)) {
|
||||
if (!isMethodCallConversion(context) && hasDefaultConstructor(lType)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+12
-7
@@ -39,6 +39,7 @@ import org.jetbrains.plugins.groovy.lang.psi.api.statements.clauses.GrForInClaus
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.clauses.GrTraditionalForClause;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.*;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.params.GrParameter;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrAnonymousClassDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.GrTypeDefinition;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.typedef.members.GrMethod;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.controlFlow.*;
|
||||
@@ -60,7 +61,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
|
||||
|
||||
}
|
||||
|
||||
private class ExceptionInfo {
|
||||
private static class ExceptionInfo {
|
||||
GrCatchClause myClause;
|
||||
List<InstructionImpl> myThrowers = new ArrayList<InstructionImpl>();
|
||||
|
||||
@@ -181,7 +182,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
|
||||
myHead = instruction;
|
||||
}
|
||||
|
||||
void addEdge(InstructionImpl beg, InstructionImpl end) {
|
||||
static void addEdge(InstructionImpl beg, InstructionImpl end) {
|
||||
if (!beg.mySucc.contains(end)) {
|
||||
beg.mySucc.add(end);
|
||||
}
|
||||
@@ -281,7 +282,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
|
||||
@Nullable
|
||||
private ExceptionInfo findCatch(PsiType thrownType) {
|
||||
for (int i = myCatchedExceptionInfos.size() - 1; i >= 0; i--) {
|
||||
final ControlFlowBuilder.ExceptionInfo info = myCatchedExceptionInfos.get(i);
|
||||
final ExceptionInfo info = myCatchedExceptionInfos.get(i);
|
||||
final GrCatchClause clause = info.myClause;
|
||||
final GrParameter parameter = clause.getParameter();
|
||||
if (parameter != null) {
|
||||
@@ -363,7 +364,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isIncOrDecOperand(GrReferenceExpression referenceExpression) {
|
||||
private static boolean isIncOrDecOperand(GrReferenceExpression referenceExpression) {
|
||||
final PsiElement parent = referenceExpression.getParent();
|
||||
if (parent instanceof GrPostfixExpression) return true;
|
||||
if (parent instanceof GrUnaryExpression) {
|
||||
@@ -667,6 +668,9 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
|
||||
}
|
||||
|
||||
public void visitTypeDefinition(GrTypeDefinition typeDefinition) {
|
||||
if (typeDefinition instanceof GrAnonymousClassDefinition) {
|
||||
super.visitTypeDefinition(typeDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
public void visitVariable(GrVariable variable) {
|
||||
@@ -678,6 +682,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private InstructionImpl findInstruction(PsiElement element) {
|
||||
for (int i = myProcessingStack.size() - 1; i >= 0; i--) {
|
||||
InstructionImpl instruction = myProcessingStack.get(i);
|
||||
@@ -686,7 +691,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
|
||||
return null;
|
||||
}
|
||||
|
||||
class CallInstructionImpl extends InstructionImpl implements CallInstruction {
|
||||
static class CallInstructionImpl extends InstructionImpl implements CallInstruction {
|
||||
private final InstructionImpl myCallee;
|
||||
|
||||
public String toString() {
|
||||
@@ -712,7 +717,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
class PostCallInstructionImpl extends InstructionImpl implements AfterCallInstruction {
|
||||
static class PostCallInstructionImpl extends InstructionImpl implements AfterCallInstruction {
|
||||
private final CallInstructionImpl myCall;
|
||||
private RetInstruction myReturnInsn;
|
||||
|
||||
@@ -743,7 +748,7 @@ public class ControlFlowBuilder extends GroovyRecursiveElementVisitor {
|
||||
}
|
||||
}
|
||||
|
||||
class RetInstruction extends InstructionImpl {
|
||||
static class RetInstruction extends InstructionImpl {
|
||||
RetInstruction(int num) {
|
||||
super(null, num);
|
||||
}
|
||||
|
||||
@@ -109,6 +109,8 @@ public class GrMapType extends GrLiteralClassType {
|
||||
}
|
||||
|
||||
public String getInternalCanonicalText() {
|
||||
if (myStringEntries.size() == 0) return "[:]";
|
||||
|
||||
List<String> components = new ArrayList<String>();
|
||||
for (String s : myStringEntries.keySet()) {
|
||||
components.add("'" + s + "':" + getInternalCanonicalText(myStringEntries.get(s)));
|
||||
|
||||
+2
-1
@@ -20,6 +20,7 @@ import com.intellij.psi.PsiReference;
|
||||
import com.intellij.refactoring.rename.RenameJavaVariableProcessor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrField;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.GrVariable;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
@@ -29,7 +30,7 @@ import java.util.Collection;
|
||||
public class RenameAliasImportedFieldProcessor extends RenameJavaVariableProcessor{
|
||||
@Override
|
||||
public boolean canProcessElement(PsiElement element) {
|
||||
return super.canProcessElement(element) && !(element instanceof GrField && ((GrField)element).isProperty());
|
||||
return element instanceof GrVariable && !(element instanceof GrField && ((GrField)element).isProperty());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
@@ -68,7 +68,7 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
private void doTest(LocalInspectionTool... tools) throws Exception {
|
||||
private void doTest(LocalInspectionTool... tools) {
|
||||
myFixture.enableInspections(tools);
|
||||
myFixture.testHighlighting(true, false, false, getTestName(false) + ".groovy");
|
||||
}
|
||||
@@ -280,4 +280,8 @@ public class GroovyHighlightingTest extends LightCodeInsightFixtureTestCase {
|
||||
}
|
||||
|
||||
public void testNumberDuplicatesInMaps() throws Exception {doTest();}
|
||||
|
||||
public void testMapNotAcceptedAsStringParameter() {
|
||||
doTest();
|
||||
}
|
||||
}
|
||||
@@ -10,4 +10,4 @@ int numPermutationsPrinted = 1;
|
||||
|
||||
}
|
||||
|
||||
def <warning descr="Assignment is not used">x</warning> = 2
|
||||
def x = <warning descr="Assignment is not used">2</warning>
|
||||
@@ -0,0 +1,7 @@
|
||||
class A {
|
||||
void method(String m) {}
|
||||
|
||||
{
|
||||
method<warning descr="'method' in 'A' cannot be applied to '([:])'">([:])</warning>
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
int idx
|
||||
<warning descr="Assignment is not used">idx</warning> = 2
|
||||
idx = <warning descr="Assignment is not used">2</warning>
|
||||
idx = 3
|
||||
if (++idx == 8) { //Assignment is used here
|
||||
idx = 33
|
||||
|
||||
@@ -1 +1 @@
|
||||
Class <warning descr="Assignment is not used">clazz</warning> = null
|
||||
Class clazz = <warning descr="Assignment is not used">null</warning>
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
class A {
|
||||
void method(Map m, Closure e ) {}
|
||||
void method(String m) {}
|
||||
|
||||
{
|
||||
meth<ref>od([:])
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,6 +14,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/lucene-core-2.3.0.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/jaxb-impl-2.1.10.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -23,6 +25,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/wadl-core.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -30,6 +34,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/jaxb-api-2.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -37,6 +43,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/maven-embedder-1.1-SNAPSHOT.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -44,6 +52,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/classworlds-1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -51,6 +61,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/plexus-utils-1.5.5.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -58,6 +70,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/maven-2.2.1-uber.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -65,6 +79,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/mercury-artifact-1.0-alpha-6.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -72,6 +88,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/maven-dependency-tree-1.2.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -79,6 +97,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/nexus-indexer-1.2.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -86,6 +106,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/archetype-common-2.0-alpha-4-SNAPSHOT.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -93,6 +115,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/activation-1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -100,6 +124,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/commons-logging-1.1.1.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -107,6 +133,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/commons-beanutils.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module" module-name="maven" scope="TEST" />
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/rngom-20051226-patched.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$MODULE_DIR$/lib/rngom-src.zip!/src" />
|
||||
</SOURCES>
|
||||
@@ -28,6 +29,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/isorelax.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -35,6 +38,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/trang-core.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module-library">
|
||||
@@ -42,6 +47,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/jing.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/svnkit.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$MODULE_DIR$/lib/svnkitsrc.zip!/" />
|
||||
</SOURCES>
|
||||
@@ -29,6 +30,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/jna.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
|
||||
@@ -22,6 +22,7 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/svnkit.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$MODULE_DIR$/lib/svnkitsrc.zip!/" />
|
||||
</SOURCES>
|
||||
@@ -32,6 +33,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/trilead.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="module" module-name="platform-impl" />
|
||||
@@ -40,6 +43,8 @@
|
||||
<CLASSES>
|
||||
<root url="jar://$MODULE_DIR$/lib/jna.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
|
||||
Reference in New Issue
Block a user