diff --git a/.idea/modules.xml b/.idea/modules.xml
index d0916bb1096d..d7c5d4aea264 100644
--- a/.idea/modules.xml
+++ b/.idea/modules.xml
@@ -193,6 +193,11 @@
+
+
+
+
+
diff --git a/build/scripts/layouts.gant b/build/scripts/layouts.gant
index 02d32fc8abe5..8a9c8d069137 100644
--- a/build/scripts/layouts.gant
+++ b/build/scripts/layouts.gant
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -75,6 +75,7 @@ def layoutFull(String home, String targetDirectory, String patchedDescriptorDir
"java-indexing-impl",
"java-impl",
"java-psi-impl",
+ "java-structure-view",
"jsp-spi",
"manifest",
"platform-main",
diff --git a/build/scripts/utils.gant b/build/scripts/utils.gant
index ad21749a63bb..7eb7c83f2333 100644
--- a/build/scripts/utils.gant
+++ b/build/scripts/utils.gant
@@ -255,6 +255,7 @@ binding.setVariable("platformApiModules", [
"lvcs-api",
"projectModel-api",
"platform-api",
+ "structure-view-api",
"usageView",
"vcs-api",
"vcs-log-api",
@@ -262,6 +263,7 @@ binding.setVariable("platformApiModules", [
"xml-analysis-api",
"xml-openapi",
"xml-psi-api",
+ "xml-structure-view-api",
])
@@ -278,6 +280,7 @@ binding.setVariable("platformImplementationModules", [
"lvcs-impl",
"projectModel-impl",
"platform-impl",
+ "structure-view-impl",
"vcs-impl",
"vcs-log-graph",
"vcs-log-impl",
@@ -290,6 +293,7 @@ binding.setVariable("platformImplementationModules", [
"xml",
"xml-analysis-impl",
"xml-psi-impl",
+ "xml-structure-view-impl",
])
binding.setVariable("layoutMacApp", { String path, String ch, Map args ->
diff --git a/java/java-impl/java-impl.iml b/java/java-impl/java-impl.iml
index 0e65b921e41f..688a8d303608 100644
--- a/java/java-impl/java-impl.iml
+++ b/java/java-impl/java-impl.iml
@@ -52,6 +52,7 @@
+
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/ExcludeFromCompletionLookupActionProvider.java b/java/java-impl/src/com/intellij/codeInsight/completion/ExcludeFromCompletionLookupActionProvider.java
index bc00fa223385..ec7c5c5ffde4 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/ExcludeFromCompletionLookupActionProvider.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/ExcludeFromCompletionLookupActionProvider.java
@@ -32,7 +32,11 @@ import org.jetbrains.annotations.Nullable;
public class ExcludeFromCompletionLookupActionProvider implements LookupActionProvider {
@Override
public void fillActions(LookupElement element, Lookup lookup, Consumer consumer) {
- final Object o = element.getObject();
+ Object o = element.getObject();
+ if (o instanceof PsiClassObjectAccessExpression) {
+ o = PsiUtil.resolveClassInType(((PsiClassObjectAccessExpression)o).getOperand().getType());
+ }
+
if (o instanceof PsiClass) {
PsiClass clazz = (PsiClass)o;
addExcludes(consumer, clazz, clazz.getQualifiedName());
diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/RedundantLambdaParameterTypeIntention.java b/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/RedundantLambdaParameterTypeIntention.java
index 949ddceaeb29..4df26a06f4f7 100644
--- a/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/RedundantLambdaParameterTypeIntention.java
+++ b/java/java-impl/src/com/intellij/codeInsight/daemon/quickFix/RedundantLambdaParameterTypeIntention.java
@@ -23,6 +23,7 @@ import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.*;
import com.intellij.psi.impl.source.resolve.DefaultParameterTypeInferencePolicy;
import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
@@ -57,7 +58,7 @@ public class RedundantLambdaParameterTypeIntention extends PsiElementBaseIntenti
if (parameter.getTypeElement() == null) return false;
}
if (parameters.length == 0) return false;
- final PsiType functionalInterfaceType = LambdaUtil.getFunctionalInterfaceType(expression, false);
+ final PsiType functionalInterfaceType = LambdaUtil.getFunctionalInterfaceType(expression, true);
if (functionalInterfaceType != null) {
final PsiElement lambdaParent = expression.getParent();
if (lambdaParent instanceof PsiExpressionList) {
@@ -84,11 +85,12 @@ public class RedundantLambdaParameterTypeIntention extends PsiElementBaseIntenti
for (PsiTypeParameter parameter : typeParameters) {
final PsiType psiType = substitutor.substitute(parameter);
- if (psiType == null || LambdaUtil.dependsOnTypeParams(psiType, expression, parameter)) return false;
+ if (psiType == null || dependsOnTypeParams(psiType, expression, parameter)) return false;
}
+ return functionalInterfaceType.isAssignableFrom(substitutor.substitute(method.getParameterList().getParameters()[idx].getType()));
}
}
- else if (!LambdaUtil.isLambdaFullyInferred(expression, functionalInterfaceType)) {
+ if (!LambdaUtil.isLambdaFullyInferred(expression, functionalInterfaceType)) {
return false;
}
return true;
@@ -122,4 +124,11 @@ public class RedundantLambdaParameterTypeIntention extends PsiElementBaseIntenti
lambdaExpression.getParameterList().replace(expression.getParameterList());
}
}
+
+ private static boolean dependsOnTypeParams(PsiType type,
+ PsiLambdaExpression expr,
+ PsiTypeParameter param2Check) {
+ return LambdaUtil.depends(type, new LambdaUtil.TypeParamsChecker(expr, PsiUtil
+ .resolveGenericsClassInType(LambdaUtil.getFunctionalInterfaceType(expr, false)).getElement()), param2Check);
+ }
}
diff --git a/java/java-impl/src/com/intellij/ide/projectView/impl/ClassesTreeStructureProvider.java b/java/java-impl/src/com/intellij/ide/projectView/impl/ClassesTreeStructureProvider.java
index 518fb06fea75..7e0515726610 100644
--- a/java/java-impl/src/com/intellij/ide/projectView/impl/ClassesTreeStructureProvider.java
+++ b/java/java-impl/src/com/intellij/ide/projectView/impl/ClassesTreeStructureProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -29,6 +29,7 @@ import com.intellij.openapi.roots.ProjectRootManager;
import com.intellij.openapi.util.Computable;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.jps.model.java.JavaModuleSourceRootTypes;
@@ -42,8 +43,9 @@ public class ClassesTreeStructureProvider implements SelectableTreeStructureProv
myProject = project;
}
+ @NotNull
@Override
- public Collection modify(AbstractTreeNode parent, Collection children, ViewSettings settings) {
+ public Collection modify(@NotNull AbstractTreeNode parent, @NotNull Collection children, ViewSettings settings) {
ArrayList result = new ArrayList();
for (final AbstractTreeNode child : children) {
Object o = child.getValue();
diff --git a/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageElement.java b/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageElement.java
index 3e92bdafbbab..ee64a3186f0e 100644
--- a/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageElement.java
+++ b/java/java-impl/src/com/intellij/ide/projectView/impl/nodes/PackageElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -58,6 +58,7 @@ public final class PackageElement implements Queryable, RootsProvider {
return myElement;
}
+ @NotNull
@Override
public Collection getRoots() {
Set roots= new HashSet();
diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/StructureNodeRenderer.java b/java/java-impl/src/com/intellij/ide/structureView/impl/StructureNodeRenderer.java
index b264b488430e..0ed2b58372d2 100644
--- a/java/java-impl/src/com/intellij/ide/structureView/impl/StructureNodeRenderer.java
+++ b/java/java-impl/src/com/intellij/ide/structureView/impl/StructureNodeRenderer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -26,13 +26,15 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiMember;
import com.intellij.ui.ColoredTreeCellRenderer;
import com.intellij.ui.SimpleTextAttributes;
+import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
public class StructureNodeRenderer extends ColoredTreeCellRenderer {
- public void customizeCellRenderer(JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
+ @Override
+ public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) {
forNodeDescriptorInTree(value, expanded).customize(this);
}
diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/InheritedMembersFilter.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/InheritedMembersFilter.java
deleted file mode 100644
index b176cc00325d..000000000000
--- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/InheritedMembersFilter.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Copyright 2000-2009 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.ide.structureView.impl.java;
-
-import com.intellij.icons.AllIcons;
-import com.intellij.ide.IdeBundle;
-import com.intellij.ide.util.FileStructureFilter;
-import com.intellij.ide.util.treeView.smartTree.ActionPresentation;
-import com.intellij.ide.util.treeView.smartTree.ActionPresentationData;
-import com.intellij.ide.util.treeView.smartTree.TreeElement;
-import com.intellij.openapi.actionSystem.Shortcut;
-import com.intellij.openapi.keymap.KeymapManager;
-import org.jetbrains.annotations.NonNls;
-import org.jetbrains.annotations.NotNull;
-
-public class InheritedMembersFilter implements FileStructureFilter {
- @NonNls public static final String ID = "SHOW_INHERITED";
-
- public boolean isVisible(TreeElement treeNode) {
- if (treeNode instanceof JavaClassTreeElementBase) {
- return !((JavaClassTreeElementBase)treeNode).isInherited();
- }
- else {
- return true;
- }
- }
-
- @NotNull
- public ActionPresentation getPresentation() {
- return new ActionPresentationData(IdeBundle.message("action.structureview.show.inherited"), null, AllIcons.Hierarchy.Supertypes);
- }
-
- @NotNull
- public String getName() {
- return ID;
- }
-
- public boolean isReverted() {
- return true;
- }
-
- public String getCheckBoxText() {
- return IdeBundle.message("file.structure.toggle.show.inherited");
- }
-
- public Shortcut[] getShortcut() {
- return KeymapManager.getInstance().getActiveKeymap().getShortcuts("FileStructurePopup");
- }
-}
diff --git a/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaAnonymousMembersFilter.java b/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaAnonymousMembersFilter.java
deleted file mode 100644
index fc91ca57ea01..000000000000
--- a/java/java-impl/src/com/intellij/ide/structureView/impl/java/JavaAnonymousMembersFilter.java
+++ /dev/null
@@ -1,64 +0,0 @@
-/*
- * Copyright 2000-2011 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.ide.structureView.impl.java;
-
-import com.intellij.ide.util.FileStructureFilter;
-import com.intellij.ide.util.treeView.smartTree.ActionPresentation;
-import com.intellij.ide.util.treeView.smartTree.ActionPresentationData;
-import com.intellij.ide.util.treeView.smartTree.TreeElement;
-import com.intellij.openapi.actionSystem.Shortcut;
-import com.intellij.util.PlatformIcons;
-import org.jetbrains.annotations.NotNull;
-
-/**
- * @author Konstantin Bulenkov
- */
-public class JavaAnonymousMembersFilter implements FileStructureFilter {
-
- private static final String ID = "SHOW_ANONYMOUS";
-
- @Override
- public String getCheckBoxText() {
- return "Show Anonymous Classes";
- }
-
- @Override
- public Shortcut[] getShortcut() {
- return new Shortcut[0];
- }
-
- @Override
- public boolean isVisible(TreeElement treeNode) {
- return !(treeNode instanceof JavaAnonymousClassTreeElement);
- }
-
- @Override
- public boolean isReverted() {
- return true;
- }
-
- @NotNull
- @Override
- public ActionPresentation getPresentation() {
- return new ActionPresentationData(getCheckBoxText(), null, PlatformIcons.ANONYMOUS_CLASS_ICON);
- }
-
- @NotNull
- @Override
- public String getName() {
- return ID;
- }
-}
diff --git a/java/java-impl/src/com/intellij/ide/util/treeView/SourceComparator.java b/java/java-impl/src/com/intellij/ide/util/treeView/SourceComparator.java
index 3b9e17b2fbb1..7456bdcb192f 100644
--- a/java/java-impl/src/com/intellij/ide/util/treeView/SourceComparator.java
+++ b/java/java-impl/src/com/intellij/ide/util/treeView/SourceComparator.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -28,6 +28,7 @@ public class SourceComparator implements Comparator{
private SourceComparator() {
}
+ @Override
public int compare(NodeDescriptor nodeDescriptor1, NodeDescriptor nodeDescriptor2) {
int weight1 = getWeight(nodeDescriptor1);
int weight2 = getWeight(nodeDescriptor2);
diff --git a/java/java-impl/src/com/intellij/lang/java/JavaAnonymousClassesProvider.java b/java/java-impl/src/com/intellij/lang/java/JavaAnonymousClassesProvider.java
index 0d01c1b762e1..5e5fa498bdc4 100644
--- a/java/java-impl/src/com/intellij/lang/java/JavaAnonymousClassesProvider.java
+++ b/java/java-impl/src/com/intellij/lang/java/JavaAnonymousClassesProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.lang.java;
import com.intellij.navigation.AnonymousElementProvider;
import com.intellij.psi.*;
+import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.List;
@@ -25,8 +26,9 @@ import java.util.List;
* @author Konstantin Bulenkov
*/
public class JavaAnonymousClassesProvider implements AnonymousElementProvider {
+ @NotNull
@Override
- public PsiElement[] getAnonymousElements(PsiElement parent) {
+ public PsiElement[] getAnonymousElements(@NotNull PsiElement parent) {
if (suite(parent)) {
if (parent instanceof PsiCompiledElement) {
parent = parent.getNavigationElement();
diff --git a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaRearranger.java b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaRearranger.java
index 7e3f95a692a2..369c5b2cc832 100644
--- a/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaRearranger.java
+++ b/java/java-impl/src/com/intellij/psi/codeStyle/arrangement/JavaRearranger.java
@@ -180,12 +180,14 @@ public class JavaRearranger implements Rearranger,
private static void setupBreadthFirstDependency(@NotNull ArrangementEntryDependencyInfo info) {
Deque toProcess = new ArrayDeque();
toProcess.add(info);
+ JavaElementArrangementEntry prev = info.getAnchorEntry();
while (!toProcess.isEmpty()) {
ArrangementEntryDependencyInfo current = toProcess.removeFirst();
for (ArrangementEntryDependencyInfo dependencyInfo : current.getDependentEntriesInfos()) {
JavaElementArrangementEntry dependencyMethod = dependencyInfo.getAnchorEntry();
if (dependencyMethod.getDependencies() == null) {
- dependencyMethod.addDependency(current.getAnchorEntry());
+ dependencyMethod.addDependency(prev);
+ prev = dependencyMethod;
}
toProcess.addLast(dependencyInfo);
}
diff --git a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
index 10d4584be81d..7749d956c318 100644
--- a/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
+++ b/java/java-impl/src/com/intellij/psi/impl/source/codeStyle/JavaCodeStyleManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -13,10 +13,6 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-
-/*
- * @author max
- */
package com.intellij.psi.impl.source.codeStyle;
import com.intellij.lang.ASTNode;
@@ -47,6 +43,9 @@ import org.jetbrains.annotations.Nullable;
import java.beans.Introspector;
import java.util.*;
+/**
+ * @author max
+ */
public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.source.codeStyle.JavaCodeStyleManagerImpl");
@@ -87,8 +86,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
}
@Override
- public void shortenClassReferences(@NotNull PsiElement element, int startOffset, int endOffset)
- throws IncorrectOperationException {
+ public void shortenClassReferences(@NotNull PsiElement element, int startOffset, int endOffset) throws IncorrectOperationException {
CheckUtil.checkWritable(element);
if (SourceTreeToPsiMap.hasTreeElement(element)) {
final ReferenceAdjuster adjuster = ReferenceAdjuster.Extension.getReferenceAdjuster(element.getLanguage());
@@ -164,7 +162,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
ContainerUtil.addAll(redundant, imports);
redundant.removeAll(allImports);
for (PsiImportStatementBase importStatement : imports) {
- if (importStatement instanceof JspxImportStatement && ((JspxImportStatement)importStatement).isForeignFileImport()) {
+ if (importStatement instanceof JspxImportStatement && importStatement.isForeignFileImport()) {
redundant.remove(importStatement);
}
}
@@ -481,7 +479,7 @@ public class JavaCodeStyleManagerImpl extends JavaCodeStyleManager {
if (fromLiterals != null) {
ContainerUtil.addAll(names, fromLiterals);
}
-
+
ContainerUtil.addAll(names, suggestVariableNameByExpressionOnly(expr, variableKind, correctKeywords, false).names);
ContainerUtil.addAll(names, suggestVariableNameByExpressionPlace(expr, variableKind, correctKeywords).names);
diff --git a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java
index e8bb45ce350d..83de0ed2f516 100644
--- a/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java
+++ b/java/java-impl/src/com/intellij/refactoring/changeSignature/JavaChangeSignatureUsageProcessor.java
@@ -17,6 +17,7 @@ package com.intellij.refactoring.changeSignature;
import com.intellij.codeInsight.ExceptionUtil;
import com.intellij.codeInsight.daemon.impl.analysis.JavaHighlightUtil;
+import com.intellij.codeInspection.dataFlow.ControlFlowAnalyzer;
import com.intellij.lang.StdLanguages;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
@@ -884,7 +885,7 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
private static class ConflictSearcher {
private final JavaChangeInfo myChangeInfo;
- private ConflictSearcher(JavaChangeInfo changeInfo) {
+ private ConflictSearcher(@NotNull JavaChangeInfo changeInfo) {
this.myChangeInfo = changeInfo;
}
@@ -901,6 +902,8 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
LOG.error(e);
}
}
+
+ checkContract(conflictDescriptions, myChangeInfo.getMethod());
for (UsageInfo usageInfo : usagesSet) {
final PsiElement element = usageInfo.getElement();
@@ -914,6 +917,8 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
conflictDescriptions.putValue(baseMethod, "Implicit last parameter should not be deleted");
}
}
+
+ checkContract(conflictDescriptions, method);
} else if (element instanceof PsiMethodReferenceExpression) {
conflictDescriptions.putValue(element, "Changed method is used in method reference");
}
@@ -922,6 +927,12 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
return conflictDescriptions;
}
+ private static void checkContract(MultiMap conflictDescriptions, PsiMethod method) {
+ if (ControlFlowAnalyzer.findContractAnnotation(method) != null) {
+ conflictDescriptions.putValue(method, "@Contract annotation will have to be changed manually");
+ }
+ }
+
private boolean needToChangeCalls() {
return myChangeInfo.isNameChanged() || myChangeInfo.isParameterSetOrOrderChanged() || myChangeInfo.isExceptionSetOrOrderChanged();
}
@@ -964,9 +975,6 @@ public class JavaChangeSignatureUsageProcessor implements ChangeSignatureUsagePr
private void addMethodConflicts(MultiMap conflicts) {
String newMethodName = myChangeInfo.getNewName();
- if (!(myChangeInfo instanceof JavaChangeInfo)) {
- return;
- }
try {
PsiMethod prototype;
final PsiMethod method = myChangeInfo.getMethod();
diff --git a/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java b/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
index 653b92fc494e..32a81a764127 100644
--- a/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/LambdaUtil.java
@@ -239,12 +239,6 @@ public class LambdaUtil {
return -1;
}
- public static boolean dependsOnTypeParams(PsiType type,
- PsiLambdaExpression expr,
- PsiTypeParameter param2Check) {
- return depends(type, new TypeParamsChecker(expr), param2Check);
- }
-
public static boolean dependsOnTypeParams(PsiType type,
PsiType functionalInterfaceType,
PsiElement lambdaExpression,
@@ -253,13 +247,7 @@ public class LambdaUtil {
PsiUtil.resolveClassInType(functionalInterfaceType)), param2Check);
}
- public static boolean dependsOnTypeParams(PsiType type,
- PsiClass aClass,
- PsiMethod aMethod) {
- return depends(type, new TypeParamsChecker(aMethod, aClass));
- }
-
- static boolean depends(PsiType type, TypeParamsChecker visitor, PsiTypeParameter... param2Check) {
+ public static boolean depends(PsiType type, TypeParamsChecker visitor, PsiTypeParameter... param2Check) {
if (!visitor.startedInference()) return false;
final Boolean accept = type.accept(visitor);
if (param2Check.length > 0) {
@@ -268,79 +256,8 @@ public class LambdaUtil {
return accept != null && accept.booleanValue();
}
- public static boolean isFreeFromTypeInferenceArgs(final PsiParameter[] methodParameters,
- final PsiLambdaExpression lambdaExpression,
- final PsiExpression expression,
- final PsiSubstitutor subst,
- final PsiType functionalInterfaceType,
- final PsiTypeParameter typeParam) {
- if (expression instanceof PsiCallExpression && ((PsiCallExpression)expression).getTypeArguments().length > 0) return true;
- if (expression instanceof PsiNewExpression) {
- final PsiJavaCodeReferenceElement classReference = ((PsiNewExpression)expression).getClassOrAnonymousClassReference();
- if (classReference != null) {
- final PsiReferenceParameterList parameterList = classReference.getParameterList();
- if (parameterList != null) {
- final PsiTypeElement[] typeParameterElements = parameterList.getTypeParameterElements();
- if (typeParameterElements.length > 0) {
- if (!(typeParameterElements[0].getType() instanceof PsiDiamondType)) {
- return true;
- }
- }
- }
- }
- }
- final PsiParameter[] lambdaParams = lambdaExpression.getParameterList().getParameters();
- if (lambdaParams.length != methodParameters.length) return false;
- final boolean[] independent = {true};
- final PsiMethod interfaceMethod = getFunctionalInterfaceMethod(functionalInterfaceType);
- if (interfaceMethod == null) return false;
- final TypeParamsChecker paramsChecker = new TypeParamsChecker(lambdaExpression);
- for (PsiParameter parameter : interfaceMethod.getParameterList().getParameters()) {
- subst.substitute(parameter.getType()).accept(paramsChecker);
- }
- paramsChecker.myUsedTypeParams.add(typeParam);
-
- expression.accept(new JavaRecursiveElementWalkingVisitor() {
- @Override
- public void visitConditionalExpression(PsiConditionalExpression expression) {
- final PsiExpression thenExpression = expression.getThenExpression();
- if (thenExpression != null) {
- thenExpression.accept(this);
- }
- final PsiExpression elseExpression = expression.getElseExpression();
- if (elseExpression != null) {
- elseExpression.accept(this);
- }
- }
-
- @Override
- public void visitReferenceExpression(PsiReferenceExpression expression) {
- super.visitReferenceExpression(expression);
- int usedParamIdx = -1;
- for (int i = 0; i < lambdaParams.length; i++) {
- PsiParameter param = lambdaParams[i];
- if (expression.isReferenceTo(param)) {
- usedParamIdx = i;
- break;
- }
- }
-
- if (usedParamIdx > -1 && dependsOnTypeParams(subst.substitute(methodParameters[usedParamIdx].getType()), functionalInterfaceType,
- lambdaExpression, paramsChecker.myUsedTypeParams.toArray(new PsiTypeParameter[paramsChecker.myUsedTypeParams.size()]))) {
- independent[0] = false;
- }
- }
- });
- return independent[0];
- }
-
@Nullable
public static PsiType getFunctionalInterfaceType(PsiElement expression, final boolean tryToSubstitute) {
- return getFunctionalInterfaceType(expression, tryToSubstitute, -1);
- }
-
- @Nullable
- public static PsiType getFunctionalInterfaceType(PsiElement expression, final boolean tryToSubstitute, int paramIdx) {
PsiElement parent = expression.getParent();
PsiElement element = expression;
while (parent instanceof PsiParenthesizedExpression || parent instanceof PsiConditionalExpression) {
@@ -376,14 +293,6 @@ public class LambdaUtil {
final int lambdaIdx = getLambdaIdx(expressionList, expression);
if (lambdaIdx > -1) {
- PsiType cachedType = null;
- final Pair method = MethodCandidateInfo.getCurrentMethod(parent);
- if (method != null) {
- final PsiParameter[] parameters = method.first.getParameterList().getParameters();
- cachedType = lambdaIdx < parameters.length ? method.second.substitute(getNormalizedType(parameters[adjustLambdaIdx(lambdaIdx, method.first, parameters)])) : null;
- if (!tryToSubstitute) return cachedType;
- }
-
PsiElement gParent = expressionList.getParent();
if (gParent instanceof PsiAnonymousClass) {
@@ -399,22 +308,6 @@ public class LambdaUtil {
final int finalLambdaIdx = adjustLambdaIdx(lambdaIdx, (PsiMethod)resolve, parameters);
if (finalLambdaIdx < parameters.length) {
if (!tryToSubstitute) return getNormalizedType(parameters[finalLambdaIdx]);
- if (cachedType != null) {
- final PsiMethod interfaceMethod = getFunctionalInterfaceMethod(cachedType);
- if (interfaceMethod != null) {
- final PsiClassType.ClassResolveResult cachedResult = PsiUtil.resolveGenericsClassInType(cachedType);
- if (paramIdx == -1) {
- if (!dependsOnTypeParams(cachedType, cachedType, expression) && !dependsOnTypeParams(getFunctionalInterfaceReturnType(cachedType), cachedType, expression)) {
- return cachedType;
- }
- }
- else {
- if (!dependsOnTypeParams(cachedResult.getSubstitutor().substitute(interfaceMethod.getParameterList().getParameters()[paramIdx].getType()), cachedType, expression)) {
- return cachedType;
- }
- }
- }
- }
return PsiResolveHelper.ourGuard.doPreventingRecursion(expression, true, new Computable() {
@Override
public PsiType compute() {
@@ -467,53 +360,6 @@ public class LambdaUtil {
return type;
}
- public static PsiType getLambdaParameterType(PsiParameter param) {
- final PsiElement paramParent = param.getParent();
- if (paramParent instanceof PsiParameterList) {
- final int parameterIndex = ((PsiParameterList)paramParent).getParameterIndex(param);
- if (parameterIndex > -1) {
- final PsiLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(param, PsiLambdaExpression.class);
- if (lambdaExpression != null) {
-
- PsiType type = getFunctionalInterfaceType(lambdaExpression, true, parameterIndex);
- if (type == null) {
- type = getFunctionalInterfaceType(lambdaExpression, false);
- }
- if (type instanceof PsiIntersectionType) {
- final PsiType[] conjuncts = ((PsiIntersectionType)type).getConjuncts();
- for (PsiType conjunct : conjuncts) {
- final PsiType lambdaParameterFromType = getLambdaParameterFromType(parameterIndex, lambdaExpression, conjunct);
- if (lambdaParameterFromType != null) return lambdaParameterFromType;
- }
- } else {
- final PsiType lambdaParameterFromType = getLambdaParameterFromType(parameterIndex, lambdaExpression, type);
- if (lambdaParameterFromType != null) {
- return lambdaParameterFromType;
- }
- }
- }
- }
- }
- return new PsiLambdaParameterType(param);
- }
-
- private static PsiType getLambdaParameterFromType(int parameterIndex, PsiLambdaExpression lambdaExpression, PsiType conjunct) {
- final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(conjunct);
- if (resolveResult != null) {
- final PsiMethod method = getFunctionalInterfaceMethod(conjunct);
- if (method != null) {
- final PsiParameter[] parameters = method.getParameterList().getParameters();
- if (parameterIndex < parameters.length) {
- final PsiType psiType = getSubstitutor(method, resolveResult).substitute(parameters[parameterIndex].getType());
- if (!dependsOnTypeParams(psiType, conjunct, lambdaExpression)) {
- return GenericsUtil.eliminateWildcards(psiType);
- }
- }
- }
- }
- return null;
- }
-
public static boolean notInferredType(PsiType typeByExpression) {
return typeByExpression instanceof PsiMethodReferenceType || typeByExpression instanceof PsiLambdaExpressionType || typeByExpression instanceof PsiLambdaParameterType;
}
@@ -584,19 +430,10 @@ public class LambdaUtil {
return true;
}
- static class TypeParamsChecker extends PsiTypeVisitor {
+ public static class TypeParamsChecker extends PsiTypeVisitor {
private PsiMethod myMethod;
private final PsiClass myClass;
- private final Set myUsedTypeParams = new HashSet();
-
- private TypeParamsChecker(PsiMethod method, PsiClass aClass) {
- myMethod = method;
- myClass = aClass;
- }
-
- public TypeParamsChecker(PsiElement expression) {
- this(expression, PsiUtil.resolveGenericsClassInType(getFunctionalInterfaceType(expression, false)).getElement());
- }
+ public final Set myUsedTypeParams = new HashSet();
public TypeParamsChecker(PsiElement expression, PsiClass aClass) {
myClass = aClass;
diff --git a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
index 73c6b342c01a..32a987937974 100644
--- a/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
+++ b/java/java-psi-api/src/com/intellij/psi/util/PsiUtil.java
@@ -1065,11 +1065,11 @@ public final class PsiUtil extends PsiUtilCore {
return className + "." + member.getName();
}
- static boolean checkSameExpression(PsiExpression templateExpr, final PsiExpression expression) {
+ static boolean checkSameExpression(PsiElement templateExpr, final PsiExpression expression) {
return templateExpr.equals(skipParenthesizedExprDown(expression));
}
- public static boolean isCondition(PsiExpression expr, PsiElement parent) {
+ public static boolean isCondition(PsiElement expr, PsiElement parent) {
if (parent instanceof PsiIfStatement) {
if (checkSameExpression(expr, ((PsiIfStatement)parent).getCondition())) {
return true;
diff --git a/java/java-psi-impl/src/com/intellij/psi/ClassFileViewProvider.java b/java/java-psi-impl/src/com/intellij/psi/ClassFileViewProvider.java
index bdcc3f11188f..ef89a6cc70be 100644
--- a/java/java-psi-impl/src/com/intellij/psi/ClassFileViewProvider.java
+++ b/java/java-psi-impl/src/com/intellij/psi/ClassFileViewProvider.java
@@ -31,8 +31,8 @@ public class ClassFileViewProvider extends SingleRootFileViewProvider {
super(manager, file);
}
- public ClassFileViewProvider(@NotNull final PsiManager manager, @NotNull final VirtualFile virtualFile, final boolean physical) {
- super(manager, virtualFile, physical);
+ public ClassFileViewProvider(@NotNull final PsiManager manager, @NotNull final VirtualFile virtualFile, final boolean eventSystemEnabled) {
+ super(manager, virtualFile, eventSystemEnabled);
}
@Override
diff --git a/java/java-psi-impl/src/com/intellij/psi/ClassFileViewProviderFactory.java b/java/java-psi-impl/src/com/intellij/psi/ClassFileViewProviderFactory.java
index d9b77117801d..de870b9cfcbf 100644
--- a/java/java-psi-impl/src/com/intellij/psi/ClassFileViewProviderFactory.java
+++ b/java/java-psi-impl/src/com/intellij/psi/ClassFileViewProviderFactory.java
@@ -29,20 +29,20 @@ import static com.intellij.psi.compiled.ClassFileDecompilers.Full;
*/
public class ClassFileViewProviderFactory implements FileViewProviderFactory {
@Override
- public FileViewProvider createFileViewProvider(@NotNull VirtualFile file, Language language, @NotNull PsiManager manager, boolean physical) {
+ public FileViewProvider createFileViewProvider(@NotNull VirtualFile file, Language language, @NotNull PsiManager manager, boolean eventSystemEnabled) {
ClassFileDecompilers.Decompiler decompiler = ClassFileDecompilers.find(file);
if (decompiler instanceof Full) {
- return ((Full)decompiler).createFileViewProvider(file, manager, physical);
+ return ((Full)decompiler).createFileViewProvider(file, manager, eventSystemEnabled);
}
for (ContentBasedFileSubstitutor processor : Extensions.getExtensions(ContentBasedFileSubstitutor.EP_NAME)) {
Language lang = processor.obtainLanguageForFile(file);
if (lang != null) {
FileViewProviderFactory factory = LanguageFileViewProviders.INSTANCE.forLanguage(language);
- return factory.createFileViewProvider(file, language, manager, physical);
+ return factory.createFileViewProvider(file, language, manager, eventSystemEnabled);
}
}
- return new ClassFileViewProvider(manager, file, physical);
+ return new ClassFileViewProvider(manager, file, eventSystemEnabled);
}
}
\ No newline at end of file
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java
index 287fba0238e4..ae08b6d342b8 100644
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java
+++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/PsiParameterImpl.java
@@ -32,6 +32,7 @@ import com.intellij.psi.search.LocalSearchScope;
import com.intellij.psi.search.SearchScope;
import com.intellij.psi.stubs.IStubElementType;
import com.intellij.psi.util.PsiTreeUtil;
+import com.intellij.psi.util.PsiUtil;
import com.intellij.reference.SoftReference;
import com.intellij.ui.RowIcon;
import com.intellij.util.IncorrectOperationException;
@@ -59,6 +60,53 @@ public class PsiParameterImpl extends JavaStubPsiElement imple
super(node);
}
+ public static PsiType getLambdaParameterType(PsiParameter param) {
+ final PsiElement paramParent = param.getParent();
+ if (paramParent instanceof PsiParameterList) {
+ final int parameterIndex = ((PsiParameterList)paramParent).getParameterIndex(param);
+ if (parameterIndex > -1) {
+ final PsiLambdaExpression lambdaExpression = PsiTreeUtil.getParentOfType(param, PsiLambdaExpression.class);
+ if (lambdaExpression != null) {
+
+ PsiType type = LambdaUtil.getFunctionalInterfaceType(lambdaExpression, true);
+ if (type == null) {
+ type = LambdaUtil.getFunctionalInterfaceType(lambdaExpression, false);
+ }
+ if (type instanceof PsiIntersectionType) {
+ final PsiType[] conjuncts = ((PsiIntersectionType)type).getConjuncts();
+ for (PsiType conjunct : conjuncts) {
+ final PsiType lambdaParameterFromType = getLambdaParameterFromType(parameterIndex, lambdaExpression, conjunct);
+ if (lambdaParameterFromType != null) return lambdaParameterFromType;
+ }
+ } else {
+ final PsiType lambdaParameterFromType = getLambdaParameterFromType(parameterIndex, lambdaExpression, type);
+ if (lambdaParameterFromType != null) {
+ return lambdaParameterFromType;
+ }
+ }
+ }
+ }
+ }
+ return new PsiLambdaParameterType(param);
+ }
+
+ private static PsiType getLambdaParameterFromType(int parameterIndex, PsiLambdaExpression lambdaExpression, PsiType conjunct) {
+ final PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(conjunct);
+ if (resolveResult != null) {
+ final PsiMethod method = LambdaUtil.getFunctionalInterfaceMethod(conjunct);
+ if (method != null) {
+ final PsiParameter[] parameters = method.getParameterList().getParameters();
+ if (parameterIndex < parameters.length) {
+ final PsiType psiType = LambdaUtil.getSubstitutor(method, resolveResult).substitute(parameters[parameterIndex].getType());
+ if (!LambdaUtil.dependsOnTypeParams(psiType, conjunct, lambdaExpression)) {
+ return GenericsUtil.eliminateWildcards(psiType);
+ }
+ }
+ }
+ }
+ return null;
+ }
+
@Override
public void subtreeChanged() {
super.subtreeChanged();
@@ -138,7 +186,7 @@ public class PsiParameterImpl extends JavaStubPsiElement imple
PsiTypeElement typeElement = getTypeElement();
if (typeElement == null) {
assert isLambdaParameter() : this;
- return LambdaUtil.getLambdaParameterType(this);
+ return getLambdaParameterType(this);
}
else {
return JavaSharedImplUtil.getType(typeElement, getParameterIdentifier());
diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/GraphInferencePolicy.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/GraphInferencePolicy.java
deleted file mode 100644
index b6a0baa40f85..000000000000
--- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/GraphInferencePolicy.java
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- * Copyright 2000-2013 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.impl.source.resolve;
-
-import com.intellij.psi.*;
-import com.intellij.psi.scope.MethodProcessorSetupFailedException;
-import com.intellij.psi.scope.processor.MethodCandidatesProcessor;
-import com.intellij.psi.scope.util.PsiScopesUtil;
-import com.intellij.psi.util.PsiUtil;
-import org.jetbrains.annotations.NotNull;
-
-import java.util.*;
-
-/**
-* User: anna
-* Date: 2/14/13
-*/
-public class GraphInferencePolicy extends ProcessCandidateParameterTypeInferencePolicy {
- private static final ThreadLocal
diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditor.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditor.java
similarity index 98%
rename from platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditor.java
rename to platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditor.java
index f22010baa31a..c251020aaf4f 100644
--- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditor.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java
similarity index 96%
rename from platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java
rename to platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java
index 696c6b991127..e62f21841f78 100644
--- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorLocation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorState.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorState.java
similarity index 96%
rename from platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorState.java
rename to platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorState.java
index 277a679e2b92..f8557358ac00 100644
--- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorState.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorState.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2010 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java
similarity index 94%
rename from platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java
rename to platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java
index 4408f12db539..0cd2a91e0c49 100644
--- a/platform/platform-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/FileEditorStateLevel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java
similarity index 97%
rename from platform/platform-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java
rename to platform/editor-ui-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java
index c742e08b0824..3d9b84b6f44c 100644
--- a/platform/platform-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/NavigatableFileEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/openapi/fileEditor/TextEditor.java b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/TextEditor.java
similarity index 95%
rename from platform/platform-api/src/com/intellij/openapi/fileEditor/TextEditor.java
rename to platform/editor-ui-api/src/com/intellij/openapi/fileEditor/TextEditor.java
index 8c0578b8cf38..99d9b1444ff7 100644
--- a/platform/platform-api/src/com/intellij/openapi/fileEditor/TextEditor.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/fileEditor/TextEditor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatus.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatus.java
similarity index 97%
rename from platform/platform-api/src/com/intellij/openapi/vcs/FileStatus.java
rename to platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatus.java
index 0dc2ca3b08c6..4b57f9cf327d 100644
--- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatus.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatus.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.openapi.vcs;
import com.intellij.openapi.editor.colors.ColorKey;
import com.intellij.ui.Gray;
+import org.jetbrains.annotations.NotNull;
import java.awt.*;
@@ -24,7 +25,6 @@ public interface FileStatus {
Color COLOR_NOT_CHANGED = null; // deliberately null, do not use hardcoded Color.BLACK
Color COLOR_NOT_CHANGED_RECURSIVE = new Color(138, 164, 200);
Color COLOR_NOT_CHANGED_IMMEDIATE = new Color(50, 100, 180);
- Color t = new Color(47, 109, 255);
Color COLOR_MERGE = new Color(117, 3, 220);
Color COLOR_MODIFIED = new Color(0, 50, 160);
@@ -63,7 +63,9 @@ public interface FileStatus {
Color getColor();
+ @NotNull
ColorKey getColorKey();
+ @NotNull
String getId();
}
diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusFactory.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusFactory.java
similarity index 50%
rename from platform/platform-api/src/com/intellij/openapi/vcs/FileStatusFactory.java
rename to platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusFactory.java
index 1227c9e7b6b1..cb5d4808b55d 100644
--- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusFactory.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,8 +16,9 @@
package com.intellij.openapi.vcs;
import com.intellij.openapi.editor.colors.ColorKey;
-import com.intellij.openapi.vcs.impl.FileStatusImpl;
+import com.intellij.openapi.editor.colors.EditorColorsManager;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import java.awt.*;
import java.util.ArrayList;
@@ -30,13 +31,13 @@ public class FileStatusFactory {
private FileStatusFactory() {
}
- public synchronized FileStatus createFileStatus(@NonNls String id, String description, Color color) {
+ public synchronized FileStatus createFileStatus(@NonNls @NotNull String id, @NotNull String description, Color color) {
FileStatusImpl result = new FileStatusImpl(id, ColorKey.createColorKey("FILESTATUS_" + id, color), description);
myStatuses.add(result);
return result;
}
- public synchronized FileStatus createOnlyColorForFileStatus(@NonNls String id, final Color color) {
+ public synchronized FileStatus createOnlyColorForFileStatus(@NonNls @NotNull String id, final Color color) {
FileStatus result = new FileStatusImpl.OnlyColorFileStatus(id, ColorKey.createColorKey("FILESTATUS_" + id, color), null);
myStatuses.add(result);
return result;
@@ -50,4 +51,61 @@ public class FileStatusFactory {
return ourInstance;
}
-}
\ No newline at end of file
+ /**
+ * author: lesya
+ */
+ private static class FileStatusImpl implements FileStatus {
+ private final String myStatus;
+ private final ColorKey myColorKey;
+ private final String myText;
+
+ public FileStatusImpl(@NotNull String status, @NotNull ColorKey key, String text) {
+ myStatus = status;
+ myColorKey = key;
+ myText = text;
+ }
+
+ public String toString() {
+ return myStatus;
+ }
+
+ @Override
+ public String getText() {
+ return myText;
+ }
+
+ @Override
+ public Color getColor() {
+ return EditorColorsManager.getInstance().getGlobalScheme().getColor(getColorKey());
+ }
+
+ @NotNull
+ @Override
+ public ColorKey getColorKey() {
+ return myColorKey;
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ return myStatus;
+ }
+
+ private static class OnlyColorFileStatus extends FileStatusImpl {
+ public OnlyColorFileStatus(@NotNull String status, @NotNull ColorKey key, String text) {
+ super(status, key, text);
+ }
+
+ @NotNull
+ @Override
+ public String getId() {
+ throw new UnsupportedOperationException();
+ }
+
+ @Override
+ public String getText() {
+ throw new UnsupportedOperationException();
+ }
+ }
+ }
+}
diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusListener.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusListener.java
similarity index 93%
rename from platform/platform-api/src/com/intellij/openapi/vcs/FileStatusListener.java
rename to platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusListener.java
index a556fb4e104e..f53a2adc086a 100644
--- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusListener.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -24,7 +24,7 @@ import org.jetbrains.annotations.NotNull;
public interface FileStatusListener {
/**
* Indicates that some file statuses were change. On this event client should recalculate all statuses
- * it's depenedend on.
+ * it's dependent on.
*/
void fileStatusesChanged();
void fileStatusChanged(@NotNull VirtualFile virtualFile);
diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusManager.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusManager.java
similarity index 72%
rename from platform/platform-api/src/com/intellij/openapi/vcs/FileStatusManager.java
rename to platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusManager.java
index f2fad70bb48e..4c40f9120a46 100644
--- a/platform/platform-api/src/com/intellij/openapi/vcs/FileStatusManager.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/FileStatusManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -35,23 +35,23 @@ public abstract class FileStatusManager {
public abstract void fileStatusesChanged();
public abstract void fileStatusChanged(VirtualFile file);
- public abstract void addFileStatusListener(FileStatusListener listener);
- public abstract void addFileStatusListener(FileStatusListener listener, Disposable parentDisposable);
- public abstract void removeFileStatusListener(FileStatusListener listener);
+ public abstract void addFileStatusListener(@NotNull FileStatusListener listener);
+ public abstract void addFileStatusListener(@NotNull FileStatusListener listener, @NotNull Disposable parentDisposable);
+ public abstract void removeFileStatusListener(@NotNull FileStatusListener listener);
/**
* @deprecated Use getStatus(file).getText()} instead
*/
- public String getStatusText(VirtualFile file){
+ public String getStatusText(@NotNull VirtualFile file){
return getStatus(file).getText();
}
/**
* @deprecated Use getStatus(file).getColor()} instead
*/
- public Color getStatusColor(VirtualFile file){
+ public Color getStatusColor(@NotNull VirtualFile file){
return getStatus(file).getColor();
}
- public abstract Color getNotChangedDirectoryColor(VirtualFile vf);
+ public abstract Color getNotChangedDirectoryColor(@NotNull VirtualFile vf);
}
diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/VcsBundle.java b/platform/editor-ui-api/src/com/intellij/openapi/vcs/VcsBundle.java
similarity index 97%
rename from platform/platform-api/src/com/intellij/openapi/vcs/VcsBundle.java
rename to platform/editor-ui-api/src/com/intellij/openapi/vcs/VcsBundle.java
index 20cf6cb389fd..531cb653ed63 100644
--- a/platform/platform-api/src/com/intellij/openapi/vcs/VcsBundle.java
+++ b/platform/editor-ui-api/src/com/intellij/openapi/vcs/VcsBundle.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/editor-ui-api/src/com/intellij/psi/util/PsiEditorUtil.java b/platform/editor-ui-api/src/com/intellij/psi/util/PsiEditorUtil.java
new file mode 100644
index 000000000000..0f0f0879f79c
--- /dev/null
+++ b/platform/editor-ui-api/src/com/intellij/psi/util/PsiEditorUtil.java
@@ -0,0 +1,33 @@
+/*
+ * Copyright 2000-2014 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.util;
+
+import com.intellij.openapi.components.ServiceManager;
+import com.intellij.openapi.editor.Editor;
+import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
+
+public interface PsiEditorUtil {
+ @Nullable
+ Editor findEditorByPsiElement(@NotNull PsiElement element);
+
+ class Service {
+ public static PsiEditorUtil getInstance() {
+ return ServiceManager.getService(PsiEditorUtil.class);
+ }
+ }
+}
diff --git a/platform/platform-api/src/com/intellij/ui/PlaceHolder.java b/platform/editor-ui-api/src/com/intellij/ui/PlaceHolder.java
similarity index 85%
rename from platform/platform-api/src/com/intellij/ui/PlaceHolder.java
rename to platform/editor-ui-api/src/com/intellij/ui/PlaceHolder.java
index 88f4d0a140fc..0c78ac10ccc6 100644
--- a/platform/platform-api/src/com/intellij/ui/PlaceHolder.java
+++ b/platform/editor-ui-api/src/com/intellij/ui/PlaceHolder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,9 +15,11 @@
*/
package com.intellij.ui;
+import org.jetbrains.annotations.NotNull;
+
/**
* @author Konstantin Bulenkov
*/
public interface PlaceHolder extends PlaceProvider {
- void setPlace(Place place);
+ void setPlace(@NotNull Place place);
}
diff --git a/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java b/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java
index f2533463f855..53bd28fdc803 100644
--- a/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java
+++ b/platform/indexing-api/src/com/intellij/psi/stubs/StubIndex.java
@@ -64,10 +64,20 @@ public abstract class StubIndex {
return get(indexKey, key, project, scope);
}
- public abstract boolean process(@NotNull StubIndexKey indexKey,
+ @Deprecated
+ public boolean process(@NotNull StubIndexKey indexKey,
@NotNull Key key,
@NotNull Project project,
GlobalSearchScope scope,
+ @NotNull Processor super Psi> processor) {
+ return processElements(indexKey, key, project, scope, (Class)PsiElement.class, processor);
+ }
+
+ public abstract boolean processElements(@NotNull StubIndexKey indexKey,
+ @NotNull Key key,
+ @NotNull Project project,
+ GlobalSearchScope scope,
+ Class requiredClass,
@NotNull Processor super Psi> processor);
public boolean process(@NotNull StubIndexKey indexKey,
@@ -79,6 +89,16 @@ public abstract class StubIndex {
return process(indexKey, key, project, scope, processor);
}
+ public boolean processElements(@NotNull StubIndexKey indexKey,
+ @NotNull Key key,
+ @NotNull Project project,
+ GlobalSearchScope scope,
+ IdFilter idFilter,
+ Class requiredClass,
+ @NotNull Processor super Psi> processor) {
+ return process(indexKey, key, project, scope, processor);
+ }
+
@NotNull
public abstract Collection getAllKeys(@NotNull StubIndexKey indexKey, @NotNull Project project);
diff --git a/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java b/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
index 6b2493373fb4..05fada9b8fc7 100644
--- a/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
+++ b/platform/indexing-impl/src/com/intellij/psi/stubs/StubProcessingHelperBase.java
@@ -32,21 +32,21 @@ public abstract class StubProcessingHelperBase {
return stub.getStubType();
}
- public boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor super Psi> processor) {
- return processStubsInFile(project, file, value, processor, false);
+ public boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor super Psi> processor, Class requiredClass) {
+ return processStubsInFile(project, file, value, processor, requiredClass, false);
}
- public boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor super Psi> processor, final boolean skipOnErrors) {
+ public boolean processStubsInFile(final Project project, final VirtualFile file, StubIdList value, final Processor super Psi> processor, Class requiredClass, final boolean skipOnErrors) {
StubTree stubTree = null;
- PsiFile _psifile = PsiManager.getInstance(project).findFile(file);
+ PsiFile someRoot = PsiManager.getInstance(project).findFile(file);
PsiFileWithStubSupport psiFile = null;
boolean customStubs = false;
- if (_psifile != null && !(_psifile instanceof PsiPlainTextFile)) {
- _psifile = _psifile.getViewProvider().getStubBindingRoot();
- if (_psifile instanceof PsiFileWithStubSupport) {
- psiFile = (PsiFileWithStubSupport)_psifile;
+ if (someRoot != null && !(someRoot instanceof PsiPlainTextFile)) {
+ someRoot = someRoot.getViewProvider().getStubBindingRoot();
+ if (someRoot instanceof PsiFileWithStubSupport) {
+ psiFile = (PsiFileWithStubSupport)someRoot;
stubTree = psiFile.getStubTree();
if (stubTree == null && psiFile instanceof PsiFileImpl) {
IElementType contentElementType = ((PsiFileImpl)psiFile).getContentElementType();
@@ -91,6 +91,10 @@ public abstract class StubProcessingHelperBase {
if (tree.getElementType() == stubType(stub)) {
Psi psi = (Psi)tree.getPsi();
PsiUtilCore.ensureValid(psi);
+ if (!skipOnErrors && !requiredClass.isInstance(psi)) {
+ inconsistencyDetected(stubTree, psiFile);
+ break;
+ }
if (!processor.process(psi)) return false;
}
else if (!skipOnErrors) {
@@ -121,31 +125,32 @@ public abstract class StubProcessingHelperBase {
final int stubTreeIndex = value.get(i);
if (stubTreeIndex >= plained.size()) {
if (!skipOnErrors) {
- final VirtualFile virtualFile = psiFile.getVirtualFile();
- StubTree stubTreeFromIndex = (StubTree)StubTreeLoader.getInstance().readFromVFile(project, file);
- LOG.error(stubTreeAndIndexDoNotMatch(stubTree, psiFile, plained, virtualFile, stubTreeFromIndex));
-
- onInternalError(file);
+ inconsistencyDetected(stubTree, psiFile);
}
break;
}
Psi psi = (Psi)plained.get(stubTreeIndex).getPsi();
PsiUtilCore.ensureValid(psi);
+ if (!skipOnErrors && !requiredClass.isInstance(psi)) {
+ inconsistencyDetected(stubTree, psiFile);
+ break;
+ }
if (!processor.process(psi)) return false;
}
}
return true;
}
+ private void inconsistencyDetected(StubTree stubTree, PsiFileWithStubSupport psiFile) {
+ LOG.error(stubTreeAndIndexDoNotMatch(stubTree, psiFile));
+ onInternalError(psiFile.getVirtualFile());
+ }
+
/***
* Returns a message to log when stub tree and index do not match
*/
- protected abstract Object stubTreeAndIndexDoNotMatch(StubTree stubTree,
- PsiFileWithStubSupport psiFile,
- List> plained,
- VirtualFile virtualFile,
- StubTree stubTreeFromIndex);
+ protected abstract Object stubTreeAndIndexDoNotMatch(StubTree stubTree, PsiFileWithStubSupport psiFile);
protected abstract void onInternalError(VirtualFile file);
diff --git a/platform/lang-api/src/com/intellij/ide/projectView/ProjectViewNode.java b/platform/lang-api/src/com/intellij/ide/projectView/ProjectViewNode.java
index 5b72e74bcb09..64972b0c8308 100644
--- a/platform/lang-api/src/com/intellij/ide/projectView/ProjectViewNode.java
+++ b/platform/lang-api/src/com/intellij/ide/projectView/ProjectViewNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -44,7 +44,7 @@ import java.util.List;
* @see TreeStructureProvider#modify(com.intellij.ide.util.treeView.AbstractTreeNode, java.util.Collection, com.intellij.ide.projectView.ViewSettings)
*/
-public abstract class ProjectViewNode extends AbstractTreeNode implements RootsProvider {
+public abstract class ProjectViewNode extends AbstractTreeNode implements RootsProvider, SettingsProvider {
protected static final Logger LOG = Logger.getInstance("#com.intellij.ide.projectView.ProjectViewNode");
@@ -82,6 +82,7 @@ public abstract class ProjectViewNode extends AbstractTreeNode im
return null;
}
+ @Override
public final ViewSettings getSettings() {
return mySettings;
}
@@ -108,7 +109,7 @@ public abstract class ProjectViewNode extends AbstractTreeNode im
Object value,
ViewSettings settings) throws
InstantiationException {
- Object[] parameters = new Object[]{project, value, settings};
+ Object[] parameters = {project, value, settings};
for (Constructor extends AbstractTreeNode> constructor : (Constructor extends AbstractTreeNode>[])nodeClass.getConstructors()) {
if (constructor.getParameterTypes().length != 3) continue;
try {
@@ -164,6 +165,7 @@ public abstract class ProjectViewNode extends AbstractTreeNode im
return false;
}
+ @NotNull
@Override
public Collection getRoots() {
Value value = getValue();
diff --git a/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java b/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
index 1cb4441d20b2..b85fcd8796fa 100644
--- a/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
+++ b/platform/lang-api/src/com/intellij/psi/util/PsiUtilBase.java
@@ -32,10 +32,8 @@ import com.intellij.openapi.fileEditor.TextEditor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.AsyncResult;
import com.intellij.openapi.util.TextRange;
-import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VFileProperty;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.openapi.vfs.VirtualFileSystem;
import com.intellij.psi.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -43,7 +41,7 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.*;
-public class PsiUtilBase extends PsiUtilCore {
+public class PsiUtilBase extends PsiUtilCore implements PsiEditorUtil {
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.util.PsiUtilBase");
public static final Comparator LANGUAGE_COMPARATOR = new Comparator() {
@Override
@@ -207,6 +205,12 @@ public class PsiUtilBase extends PsiUtilCore {
while (true);
}
+ @Nullable
+ @Override
+ public Editor findEditorByPsiElement(@NotNull PsiElement element) {
+ return findEditor(element);
+ }
+
/**
* Tries to find editor for the given element.
*
@@ -232,8 +236,7 @@ public class PsiUtilBase extends PsiUtilCore {
return null;
}
- VirtualFileSystem fileSystem = virtualFile.getFileSystem();
- if (fileSystem instanceof LocalFileSystem) {
+ if (virtualFile.isInLocalFileSystem()) {
// Try to find editor for the real file.
final FileEditor[] editors = FileEditorManager.getInstance(psiFile.getProject()).getEditors(virtualFile);
for (FileEditor editor : editors) {
@@ -270,8 +273,6 @@ public class PsiUtilBase extends PsiUtilCore {
PsiFileSystemItem psiFileSystemItem = (PsiFileSystemItem)element;
return psiFileSystemItem.isValid() ? psiFileSystemItem.getVirtualFile() : null;
}
- else {
- return null;
- }
+ return null;
}
}
diff --git a/platform/lang-impl/lang-impl.iml b/platform/lang-impl/lang-impl.iml
index d1580e0bc141..7528850108a3 100644
--- a/platform/lang-impl/lang-impl.iml
+++ b/platform/lang-impl/lang-impl.iml
@@ -30,6 +30,7 @@
+
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.form b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.form
index f27be63f56da..97a3afccbb10 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.form
+++ b/platform/lang-impl/src/com/intellij/codeInsight/actions/ReformatFilesDialog.form
@@ -3,7 +3,7 @@
-
+
@@ -34,7 +34,7 @@
-
+
@@ -47,7 +47,7 @@
-
+
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java
index 1aa29cc14ee3..a91a2709c80c 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/completion/CodeCompletionHandlerBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -574,11 +574,11 @@ public class CodeCompletionHandlerBase {
}
- private static CompletionAssertions.WatchingInsertionContext insertItemHonorBlockSelection(CompletionProgressIndicator indicator,
- LookupElement item,
- char completionChar,
- List items,
- CompletionLookupArranger.StatisticsUpdate update) {
+ private static CompletionAssertions.WatchingInsertionContext insertItemHonorBlockSelection(final CompletionProgressIndicator indicator,
+ final LookupElement item,
+ final char completionChar,
+ final List items,
+ final CompletionLookupArranger.StatisticsUpdate update) {
final Editor editor = indicator.getEditor();
final int caretOffset = editor.getCaretModel().getOffset();
@@ -586,6 +586,7 @@ public class CodeCompletionHandlerBase {
if (idEndOffset < 0) {
idEndOffset = CompletionInitializationContext.calcDefaultIdentifierEnd(editor, caretOffset);
}
+ final int idEndOffsetDelta = idEndOffset - caretOffset;
CompletionAssertions.WatchingInsertionContext context = null;
if (editor.getSelectionModel().hasBlockSelection() && editor.getSelectionModel().getBlockSelectionEnds().length > 0) {
@@ -622,7 +623,17 @@ public class CodeCompletionHandlerBase {
}
} else {
- context = insertItem(indicator, item, completionChar, items, update, editor, caretOffset, idEndOffset);
+ final Ref contextRef = new Ref();
+ editor.getCaretModel().runForEachCaret(new CaretAction() {
+ @Override
+ public void perform(Caret caret) {
+ CompletionAssertions.WatchingInsertionContext currentContext = insertItem(indicator, item, completionChar, items, update, editor, caret.getOffset(), caret.getOffset() + idEndOffsetDelta);
+ if (caret.getVisualPosition().equals(editor.getCaretModel().getPrimaryCaret().getVisualPosition())) {
+ contextRef.set(currentContext);
+ }
+ }
+ });
+ context = contextRef.get();
}
return context;
}
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java
index 2ced9a6b55b2..044e621edf34 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/editorActions/TypedHandler.java
@@ -33,10 +33,7 @@ import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.editor.Document;
-import com.intellij.openapi.editor.Editor;
-import com.intellij.openapi.editor.EditorModificationUtil;
-import com.intellij.openapi.editor.ScrollType;
+import com.intellij.openapi.editor.*;
import com.intellij.openapi.editor.actionSystem.TypedActionHandler;
import com.intellij.openapi.editor.ex.EditorEx;
import com.intellij.openapi.editor.highlighter.EditorHighlighter;
@@ -48,6 +45,7 @@ import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.fileTypes.LanguageFileType;
import com.intellij.openapi.fileTypes.PlainTextLanguage;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.registry.Registry;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
@@ -582,13 +580,35 @@ public class TypedHandler extends TypedActionHandlerBase {
final FileType fileType = file.getFileType();
BraceMatcher braceMatcher = BraceMatchingUtil.getBraceMatcher(fileType, iterator);
- final boolean isBrace = braceMatcher.isLBraceToken(iterator, chars, fileType) || braceMatcher.isRBraceToken(iterator, chars, fileType);
+ boolean rBraceToken = braceMatcher.isRBraceToken(iterator, chars, fileType);
+ final boolean isBrace = braceMatcher.isLBraceToken(iterator, chars, fileType) || rBraceToken;
+ int lBraceOffset = -1;
+
+ if (Registry.is("typing.rbrace.reformats.block") &&
+ rBraceToken &&
+ braceMatcher.isStructuralBrace(iterator, chars, fileType) && offset > 0) {
+ lBraceOffset = BraceMatchingUtil.findLeftLParen(
+ highlighter.createIterator(offset - 1),
+ braceMatcher.getOppositeBraceTokenType(iterator.getTokenType()),
+ editor.getDocument().getCharsSequence(),
+ fileType
+ );
+ }
if (element.getNode() != null && isBrace) {
+ final int finalLBraceOffset = lBraceOffset;
ApplicationManager.getApplication().runWriteAction(new Runnable() {
@Override
public void run(){
try{
- int newOffset = CodeStyleManager.getInstance(project).adjustLineIndent(file, offset);
+ int newOffset;
+ if (finalLBraceOffset != -1) {
+ RangeMarker marker = document.createRangeMarker(offset, offset + 1);
+ CodeStyleManager.getInstance(project).reformatRange(file, finalLBraceOffset, offset, true);
+ newOffset = marker.getStartOffset();
+ } else {
+ newOffset = CodeStyleManager.getInstance(project).adjustLineIndent(file, offset);
+ }
+
editor.getCaretModel().moveToOffset(newOffset + 1);
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
editor.getSelectionModel().removeSelection();
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java
index c9d4d88d9529..c3fc814181b3 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/highlighting/BraceMatchingUtil.java
@@ -301,6 +301,40 @@ public class BraceMatchingUtil {
return lastLbraceOffset;
}
+ public static int findLeftLParen(HighlighterIterator iterator,
+ IElementType lparenTokenType,
+ CharSequence fileText,
+ FileType fileType) {
+ int lastLbraceOffset = -1;
+
+ Stack braceStack = new Stack();
+ for (; !iterator.atEnd(); iterator.retreat()) {
+ final IElementType tokenType = iterator.getTokenType();
+
+ if (isLBraceToken(iterator, fileText, fileType)) {
+ if (!braceStack.isEmpty()) {
+ IElementType topToken = braceStack.pop();
+ if (!isPairBraces(tokenType, topToken, fileType)) {
+ break; // unmatched braces
+ }
+ }
+ else {
+ if (tokenType == lparenTokenType) {
+ return iterator.getStart();
+ }
+ else {
+ break;
+ }
+ }
+ }
+ else if (isRBraceToken(iterator, fileText, fileType)) {
+ braceStack.push(iterator.getTokenType());
+ }
+ }
+
+ return lastLbraceOffset;
+ }
+
// TODO: better name for this method
public static int findRightmostRParen(HighlighterIterator iterator,
IElementType rparenTokenType,
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
index b92155067b27..26115d4b307e 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/lookup/impl/LookupImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -678,9 +678,9 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
}
private void insertLookupString(LookupElement item, final int prefix) {
- Document document = myEditor.getDocument();
+ final Document document = myEditor.getDocument();
- String lookupString = getCaseCorrectedLookupString(item);
+ final String lookupString = getCaseCorrectedLookupString(item);
if (myEditor.getSelectionModel().hasBlockSelection()) {
LogicalPosition blockStart = myEditor.getSelectionModel().getBlockStart();
@@ -710,20 +710,25 @@ public class LookupImpl extends LightweightHint implements LookupEx, Disposable
myEditor.getSelectionModel().setBlockSelection(start, end);
myEditor.getCaretModel().moveToLogicalPosition(new LogicalPosition(caretLine, end.column));
} else {
- EditorModificationUtil.deleteSelectedText(myEditor);
- final int caretOffset = myEditor.getCaretModel().getOffset();
- int lookupStart = caretOffset - prefix;
+ myEditor.getCaretModel().runForEachCaret(new CaretAction() {
+ @Override
+ public void perform(Caret caret) {
+ EditorModificationUtil.deleteSelectedText(myEditor);
+ final int caretOffset = myEditor.getCaretModel().getOffset();
+ int lookupStart = caretOffset - prefix;
- int len = document.getTextLength();
- LOG.assertTrue(lookupStart >= 0 && lookupStart <= len,
- "ls: " + lookupStart + " caret: " + caretOffset + " prefix:" + prefix + " doc: " + len);
- LOG.assertTrue(caretOffset >= 0 && caretOffset <= len, "co: " + caretOffset + " doc: " + len);
+ int len = document.getTextLength();
+ LOG.assertTrue(lookupStart >= 0 && lookupStart <= len,
+ "ls: " + lookupStart + " caret: " + caretOffset + " prefix:" + prefix + " doc: " + len);
+ LOG.assertTrue(caretOffset >= 0 && caretOffset <= len, "co: " + caretOffset + " doc: " + len);
- document.replaceString(lookupStart, caretOffset, lookupString);
+ document.replaceString(lookupStart, caretOffset, lookupString);
- int offset = lookupStart + lookupString.length();
- myEditor.getCaretModel().moveToOffset(offset);
- myEditor.getSelectionModel().removeSelection();
+ int offset = lookupStart + lookupString.length();
+ myEditor.getCaretModel().moveToOffset(offset);
+ myEditor.getSelectionModel().removeSelection();
+ }
+ });
}
myEditor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java
index 70939f3a4f12..de559b777eb5 100644
--- a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java
+++ b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleBuilder.java
@@ -26,6 +26,7 @@ import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
+import com.intellij.testFramework.LightVirtualFile;
import com.intellij.ui.components.JBLayeredPane;
import com.intellij.util.Consumer;
import com.intellij.util.PairFunction;
@@ -35,6 +36,9 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
+/**
+ * @experimental
+ */
public final class LanguageConsoleBuilder {
@Nullable
private LanguageConsoleView consoleView;
@@ -51,6 +55,8 @@ public final class LanguageConsoleBuilder {
@Nullable
private GutterContentProvider gutterContentProvider;
+ private boolean oneLineInput;
+
// todo to be removed
public LanguageConsoleBuilder(@SuppressWarnings("NullableProblems") @NotNull LanguageConsoleView consoleView) {
this.consoleView = consoleView;
@@ -70,6 +76,9 @@ public final class LanguageConsoleBuilder {
return this;
}
+ /**
+ * @see {@link com.intellij.psi.PsiCodeFragment}
+ */
public LanguageConsoleBuilder psiFileFactory(@NotNull PairFunction value) {
psiFileFactory = value;
return this;
@@ -121,8 +130,24 @@ public final class LanguageConsoleBuilder {
return this;
}
+ /**
+ * @see {@link com.intellij.openapi.editor.ex.EditorEx#setOneLineMode(boolean)}
+ */
+ public LanguageConsoleBuilder oneLineInput() {
+ oneLineInput(true);
+ return this;
+ }
+
+ /**
+ * @see {@link com.intellij.openapi.editor.ex.EditorEx#setOneLineMode(boolean)}
+ */
+ public LanguageConsoleBuilder oneLineInput(boolean value) {
+ oneLineInput = value;
+ return this;
+ }
+
public LanguageConsoleView build(@NotNull Project project, @NotNull Language language) {
- GutteredLanguageConsole console = new GutteredLanguageConsole(project, language, gutterContentProvider, psiFileFactory);
+ GutteredLanguageConsole console = new GutteredLanguageConsole(project, language, gutterContentProvider, psiFileFactory, oneLineInput);
LanguageConsoleViewImpl consoleView = new LanguageConsoleViewImpl(console, true);
if (executeActionHandler != null) {
assert historyType != null;
@@ -153,15 +178,35 @@ public final class LanguageConsoleBuilder {
private final static class GutteredLanguageConsole extends LanguageConsoleImpl {
@Nullable
private final GutterContentProvider gutterContentProvider;
+ @Nullable
+ private final PairFunction psiFileFactory;
public GutteredLanguageConsole(@NotNull Project project,
@NotNull Language language,
@Nullable GutterContentProvider gutterContentProvider,
- @Nullable PairFunction psiFileFactory) {
- super(project, language.getDisplayName() + " Console", language, psiFileFactory);
+ @Nullable PairFunction psiFileFactory,
+ boolean oneLineInput) {
+ super(project, language.getDisplayName() + " Console", language, false);
setShowSeparatorLine(false);
+
+ if (oneLineInput) {
+ getConsoleEditor().setOneLineMode(true);
+ }
+
this.gutterContentProvider = gutterContentProvider;
+ this.psiFileFactory = psiFileFactory;
+ }
+
+ @NotNull
+ @Override
+ protected PsiFile createFile(@NotNull LightVirtualFile virtualFile, @NotNull Document document, @NotNull Project project) {
+ if (psiFileFactory == null) {
+ return super.createFile(virtualFile, document, project);
+ }
+ else {
+ return psiFileFactory.fun(virtualFile, project);
+ }
}
@Override
diff --git a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
index 79373dc75ff8..3ec577da2259 100644
--- a/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
+++ b/platform/lang-impl/src/com/intellij/execution/console/LanguageConsoleImpl.java
@@ -58,7 +58,10 @@ import com.intellij.psi.impl.source.tree.injected.InjectedLanguageUtil;
import com.intellij.testFramework.LightVirtualFile;
import com.intellij.ui.JBColor;
import com.intellij.ui.SideBorder;
-import com.intellij.util.*;
+import com.intellij.util.DocumentUtil;
+import com.intellij.util.FileContentUtil;
+import com.intellij.util.ObjectUtils;
+import com.intellij.util.SingleAlarm;
import com.intellij.util.ui.AbstractLayoutManager;
import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
@@ -112,8 +115,6 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
}
};
- private final PairFunction myPsiFileFactory;
-
public LanguageConsoleImpl(@NotNull Project project, @NotNull String title, @NotNull Language language) {
this(project, title, language, true);
}
@@ -122,19 +123,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
this(project, title, new LightVirtualFile(title, language, ""), initComponents);
}
- public LanguageConsoleImpl(@NotNull Project project, @NotNull String title, @NotNull Language language, @Nullable PairFunction psiFileFactory) {
- this(project, title, new LightVirtualFile(title, language, ""), false, psiFileFactory);
- }
-
public LanguageConsoleImpl(@NotNull Project project, @NotNull String title, @NotNull LightVirtualFile lightFile, boolean initComponents) {
- this(project, title, lightFile, initComponents, null);
- }
-
- public LanguageConsoleImpl(@NotNull Project project,
- @NotNull String title,
- @NotNull LightVirtualFile lightFile,
- boolean initComponents,
- @Nullable PairFunction psiFileFactory) {
myProject = project;
myTitle = title;
myVirtualFile = lightFile;
@@ -142,7 +131,6 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
myHistoryFile = new LightVirtualFile(getTitle() + ".history.txt", FileTypes.PLAIN_TEXT, "");
myEditorDocument = FileDocumentManager.getInstance().getDocument(lightFile);
assert myEditorDocument != null;
- myPsiFileFactory = psiFileFactory;
myFile = createFile(myVirtualFile, myEditorDocument, myProject);
myConsoleEditor = (EditorEx)editorFactory.createEditor(myEditorDocument, myProject);
myConsoleEditor.addFocusListener(myFocusListener);
@@ -691,12 +679,7 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
@NotNull
protected PsiFile createFile(@NotNull LightVirtualFile virtualFile, @NotNull Document document, @NotNull Project project) {
- if (myPsiFileFactory == null) {
- return ObjectUtils.assertNotNull(PsiManager.getInstance(project).findFile(virtualFile));
- }
- else {
- return myPsiFileFactory.fun(virtualFile, project);
- }
+ return ObjectUtils.assertNotNull(PsiManager.getInstance(project).findFile(virtualFile));
}
private class MyLayout extends AbstractLayoutManager {
diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
index bf172257afb4..c20b5925721d 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/LivePreview.java
@@ -262,6 +262,7 @@ public class LivePreview extends DocumentAdapter implements SearchResults.Search
@Override
public void run() {
for (FoldRegion region : allRegions) {
+ if (!region.isValid()) continue;
if (cursor.intersects(TextRange.create(region))) {
region.setExpanded(true);
}
diff --git a/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java
index 893072bb0ccc..754c3c6204ed 100644
--- a/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java
+++ b/platform/lang-impl/src/com/intellij/find/impl/livePreview/SearchResults.java
@@ -219,6 +219,8 @@ public class SearchResults implements DocumentListener {
ApplicationManager.getApplication().runReadAction(new Runnable() {
@Override
public void run() {
+ Project project = getProject();
+ if (project != null && project.isDisposed()) return;
int[] starts = new int[0];
int[] ends = new int[0];
try {
diff --git a/platform/lang-impl/src/com/intellij/formatting/FormatterTagHandler.java b/platform/lang-impl/src/com/intellij/formatting/FormatterTagHandler.java
index af5164daad06..e475f8cf83d4 100644
--- a/platform/lang-impl/src/com/intellij/formatting/FormatterTagHandler.java
+++ b/platform/lang-impl/src/com/intellij/formatting/FormatterTagHandler.java
@@ -48,9 +48,11 @@ public class FormatterTagHandler {
!StringUtil.isEmpty(mySettings.FORMATTER_OFF_TAG) &&
block instanceof ASTBlock) {
ASTNode node = ((ASTBlock)block).getNode();
- PsiElement element = node.getPsi();
- if (element != null && element instanceof PsiComment) {
- return getFormatterTag((PsiComment)element);
+ if (node != null) {
+ PsiElement element = node.getPsi();
+ if (element != null && element instanceof PsiComment) {
+ return getFormatterTag((PsiComment)element);
+ }
}
}
return FormatterTag.NONE;
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java b/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java
index 7070b065c959..8b44a0ece134 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/GotoClassAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -185,7 +185,7 @@ public class GotoClassAction extends GotoActionBase implements DumbAware {
return null;
}
- private static PsiElement getElement(PsiElement element, ChooseByNamePopup popup) {
+ private static PsiElement getElement(@NotNull PsiElement element, ChooseByNamePopup popup) {
final String path = popup.getPathToAnonymous();
if (path != null) {
final String[] classes = path.split("\\$");
@@ -214,10 +214,11 @@ public class GotoClassAction extends GotoActionBase implements DumbAware {
return element;
}
- static PsiElement[] getAnonymousClasses(PsiElement element) {
+ @NotNull
+ private static PsiElement[] getAnonymousClasses(@NotNull PsiElement element) {
for (AnonymousElementProvider provider : Extensions.getExtensions(AnonymousElementProvider.EP_NAME)) {
final PsiElement[] elements = provider.getAnonymousElements(element);
- if (elements != null && elements.length > 0) {
+ if (elements.length > 0) {
return elements;
}
}
diff --git a/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java b/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java
index 3d48cd908530..b2533d5fad35 100644
--- a/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java
+++ b/platform/lang-impl/src/com/intellij/ide/actions/ViewStructureAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -22,6 +22,7 @@ import com.intellij.ide.structureView.StructureViewBuilder;
import com.intellij.ide.structureView.StructureViewModel;
import com.intellij.ide.util.FileStructureDialog;
import com.intellij.ide.util.FileStructurePopup;
+import com.intellij.ide.util.treeView.smartTree.TreeStructureUtil;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
@@ -41,7 +42,6 @@ import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class ViewStructureAction extends AnAction {
- private static final String PLACE = "StructureViewPopup";
public ViewStructureAction() {
setEnabledInModalContext(true);
@@ -56,16 +56,16 @@ public class ViewStructureAction extends AnAction {
final VirtualFile virtualFile;
final Editor editor = e.getData(CommonDataKeys.EDITOR);
- if (editor != null) {
+ if (editor == null) {
+ virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
+ }
+ else {
PsiDocumentManager.getInstance(project).commitDocument(editor.getDocument());
PsiFile psiFile = PsiDocumentManager.getInstance(project).getPsiFile(editor.getDocument());
if (psiFile == null) return;
virtualFile = psiFile.getVirtualFile();
}
- else {
- virtualFile = e.getData(CommonDataKeys.VIRTUAL_FILE);
- }
String title = virtualFile == null? fileEditor.getName() : virtualFile.getName();
FeatureUsageTracker.getInstance().triggerFeatureUsed("navigation.popup.file.structure");
@@ -79,6 +79,7 @@ public class ViewStructureAction extends AnAction {
popup.show();
}
else {
+ assert editor != null;
DialogWrapper dialog = createDialog(editor, project, navigatable, fileEditor);
if (dialog == null) return;
@@ -88,7 +89,10 @@ public class ViewStructureAction extends AnAction {
}
@Nullable
- private static DialogWrapper createDialog(@Nullable Editor editor, @NotNull Project project, @Nullable Navigatable navigatable, @NotNull FileEditor fileEditor) {
+ private static DialogWrapper createDialog(@NotNull Editor editor,
+ @NotNull Project project,
+ @Nullable Navigatable navigatable,
+ @NotNull FileEditor fileEditor) {
final StructureViewBuilder structureViewBuilder = fileEditor.getStructureViewBuilder();
if (structureViewBuilder == null) return null;
StructureView structureView = structureViewBuilder.createStructureView(fileEditor, project);
@@ -103,18 +107,15 @@ public class ViewStructureAction extends AnAction {
StructureViewModel model = structureView.getTreeModel();
if (model instanceof PlaceHolder) {
//noinspection unchecked
- ((PlaceHolder)model).setPlace(PLACE);
+ ((PlaceHolder)model).setPlace(TreeStructureUtil.PLACE);
}
return createStructureViewPopup(project, fileEditor, structureView);
}
- public static boolean isInStructureViewPopup(@NotNull PlaceHolder model) {
- return PLACE.equals(model.getPlace());
- }
-
- private static FileStructureDialog createStructureViewBasedDialog(StructureViewModel structureViewModel,
- Editor editor,
- Project project,
+ @NotNull
+ private static FileStructureDialog createStructureViewBasedDialog(@NotNull StructureViewModel structureViewModel,
+ @NotNull Editor editor,
+ @NotNull Project project,
Navigatable navigatable,
@NotNull Disposable alternativeDisposable) {
return new FileStructureDialog(structureViewModel, editor, project, navigatable, alternativeDisposable, true);
diff --git a/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java b/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java
index bc4064a3fb6d..0591a5014437 100644
--- a/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java
+++ b/platform/lang-impl/src/com/intellij/ide/commander/ProjectListBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -216,7 +216,7 @@ public class ProjectListBuilder extends AbstractListBuilder {
}
@Override
- public void fileStatusChanged(final VirtualFile vFile) {
+ public void fileStatusChanged(@NotNull final VirtualFile vFile) {
final PsiManager manager = PsiManager.getInstance(myProject);
if (vFile.isDirectory()) {
diff --git a/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.java b/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.java
index ec026cacd275..048ca1d72427 100644
--- a/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.java
+++ b/platform/lang-impl/src/com/intellij/ide/impl/StructureViewWrapperImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -56,6 +56,7 @@ import com.intellij.util.ui.UIUtil;
import com.intellij.util.ui.update.MergingUpdateQueue;
import com.intellij.util.ui.update.Update;
import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -74,6 +75,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl
private VirtualFile myFile;
private StructureView myStructureView;
+ private FileEditor myFileEditor;
private ModuleStructureComponent myModuleStructureComponent;
private JPanel[] myPanels = new JPanel[0];
@@ -222,7 +224,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl
@Override
public void run() {
if (myStructureView != null) {
- if (!Comparing.equal(myStructureView.getFileEditor(), fileEditor)) {
+ if (!Comparing.equal(myFileEditor, fileEditor)) {
myFile = file;
rebuild();
}
@@ -269,6 +271,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl
myStructureView.storeState();
Disposer.dispose(myStructureView);
myStructureView = null;
+ myFileEditor = null;
}
if (myModuleStructureComponent != null) {
@@ -290,7 +293,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl
}
}
- String[] names = new String[] {""};
+ String[] names = {""};
JComponent focusedComponent = null;
if (file != null && file.isValid()) {
if (file.isDirectory()) {
@@ -315,6 +318,7 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl
final StructureViewBuilder structureViewBuilder = editor.getStructureViewBuilder();
if (structureViewBuilder != null) {
myStructureView = structureViewBuilder.createStructureView(editor, myProject);
+ myFileEditor = editor;
Disposer.register(this, myStructureView);
updateHeaderActions(myStructureView);
@@ -322,18 +326,17 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl
((StructureView.Scrollable)myStructureView).setReferenceSizeWhileInitializing(referenceSize);
}
- final StructureViewComposite.StructureViewDescriptor[] views;
-
if (myStructureView instanceof StructureViewComposite) {
final StructureViewComposite composite = (StructureViewComposite)myStructureView;
- views = composite.getStructureViews();
+ final StructureViewComposite.StructureViewDescriptor[] views = composite.getStructureViews();
myPanels = new JPanel[views.length];
names = new String[views.length];
for (int i = 0; i < myPanels.length; i++) {
myPanels[i] = createContentPanel(views[i].structureView.getComponent());
names[i] = views[i].title;
}
- } else {
+ }
+ else {
createSinglePanel(myStructureView.getComponent());
}
focusedComponent = hadFocus ? IdeFocusTraversalPolicy.getPreferredFocusedComponent(myStructureView.getComponent()) : null;
@@ -393,15 +396,12 @@ public class StructureViewWrapperImpl implements StructureViewWrapper, Disposabl
}
@Nullable
- private FileEditor createTempFileEditor(VirtualFile file) {
+ private FileEditor createTempFileEditor(@NotNull VirtualFile file) {
if (file.getLength() > PersistentFSConstants.getMaxIntellisenseFileSize()) return null;
FileEditorProviderManager editorProviderManager = FileEditorProviderManager.getInstance();
final FileEditorProvider[] providers = editorProviderManager.getProviders(myProject, file);
- for (FileEditorProvider provider : providers) {
- return provider.createEditor(myProject, file);
- }
- return null;
+ return providers.length == 0 ? null : providers[0].createEditor(myProject, file);
}
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java
index 34ccfc64504c..bb80f55237e5 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/AbstractProjectViewPane.java
@@ -672,6 +672,7 @@ public abstract class AbstractProjectViewPane implements DataProvider, Disposabl
return dragAction == DnDConstants.ACTION_MOVE && MoveHandler.canMove(dataContext);
}
+ @NotNull
@Override
public ActionCallback getReady(@NotNull Object requestor) {
if (myTreeBuilder == null || myTreeBuilder.isDisposed()) return new ActionCallback.Rejected();
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java
index 55909752ab2f..c7a81cbd0cda 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -1858,6 +1858,7 @@ public class ProjectViewImpl extends ProjectView implements PersistentStateCompo
return mySelectInTargets.values();
}
+ @NotNull
@Override
public ActionCallback getReady(@NotNull Object requestor) {
AbstractProjectViewPane pane = myId2Pane.get(myCurrentViewSubId);
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/AbstractModuleNode.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/AbstractModuleNode.java
index 3ef138d82542..58591a139949 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/AbstractModuleNode.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/AbstractModuleNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -62,6 +62,7 @@ public abstract class AbstractModuleNode extends ProjectViewNode impleme
return "Module";
}
+ @NotNull
@Override
public Collection getRoots() {
return Arrays.asList(ModuleRootManager.getInstance(getValue()).getContentRoots());
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ModuleGroupNode.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ModuleGroupNode.java
index 1c3dca9dbb3a..621dd67af1e2 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ModuleGroupNode.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/ModuleGroupNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -70,6 +70,7 @@ public abstract class ModuleGroupNode extends ProjectViewNode imple
return result;
}
+ @NotNull
@Override
public Collection getRoots() {
Collection children = getChildren();
diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java
index 809c41cb9bf0..ab954007b0d3 100644
--- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java
+++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/nodes/PsiTreeAnchorizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -23,13 +23,13 @@ import com.intellij.openapi.util.Key;
import com.intellij.psi.PsiElement;
import com.intellij.psi.SmartPointerManager;
import com.intellij.psi.SmartPsiElementPointer;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
/**
* @author peter
*/
public class PsiTreeAnchorizer extends TreeAnchorizer {
-
private static final Key PSI_ANCHORIZER_POINTER = Key.create("PSI_ANCHORIZER_POINTER");
@Override
@@ -47,7 +47,8 @@ public class PsiTreeAnchorizer extends TreeAnchorizer {
if (pointer == null || pointer.myPointer.getElement() != psiElement) {
Project project = psiElement.getProject();
- pointer = new SmartPointerWrapper(SmartPointerManager.getInstance(project).createSmartPsiElementPointer(psiElement));
+ SmartPsiElementPointer psiElementPointer = SmartPointerManager.getInstance(project).createSmartPsiElementPointer(psiElement);
+ pointer = new SmartPointerWrapper(psiElementPointer);
psiElement.putUserData(PSI_ANCHORIZER_POINTER, pointer);
}
return pointer;
@@ -74,7 +75,7 @@ public class PsiTreeAnchorizer extends TreeAnchorizer {
private static class SmartPointerWrapper {
private final SmartPsiElementPointer myPointer;
- private SmartPointerWrapper(SmartPsiElementPointer pointer) {
+ private SmartPointerWrapper(@NotNull SmartPsiElementPointer pointer) {
myPointer = pointer;
}
diff --git a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java
index 8fa7e9b054c0..ccacc10761b9 100644
--- a/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java
+++ b/platform/lang-impl/src/com/intellij/ide/scopeView/ScopeViewPane.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -40,7 +40,6 @@ import com.intellij.psi.PsiFileSystemItem;
import com.intellij.psi.PsiManager;
import com.intellij.psi.search.scope.NonProjectFilesScope;
import com.intellij.psi.search.scope.packageSet.*;
-import com.intellij.ui.PopupHandler;
import com.intellij.util.Alarm;
import com.intellij.util.ArrayUtil;
import org.jetbrains.annotations.NonNls;
@@ -252,6 +251,7 @@ public class ScopeViewPane extends AbstractProjectViewPane {
return myViewPanel != null ? myViewPanel.getData(dataId) : null;
}
+ @NotNull
@Override
public ActionCallback getReady(@NotNull Object requestor) {
final ActionCallback callback = myViewPanel.getActionCallback();
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java
index d49da8097bfc..8955f0769922 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java
+++ b/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewFactoryImpl.java
@@ -106,8 +106,9 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple
}
}
+ @NotNull
@Override
- public Collection getAllExtensions(Class extends PsiElement> type) {
+ public Collection getAllExtensions(@NotNull Class extends PsiElement> type) {
Collection result = myImplExtensions.get(type);
if (result == null) {
MultiValuesMap, StructureViewExtension> map = myExtensions.getValue();
@@ -154,7 +155,7 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple
}
@Override
- public void runWhenInitialized(Runnable runnable) {
+ public void runWhenInitialized(@NotNull Runnable runnable) {
if (myStructureViewWrapperImpl != null) {
runnable.run();
}
@@ -163,14 +164,20 @@ public final class StructureViewFactoryImpl extends StructureViewFactoryEx imple
}
}
- @Override
- public StructureView createStructureView(final FileEditor fileEditor, final StructureViewModel treeModel, final Project project) {
- return new StructureViewComponent(fileEditor, treeModel, project);
- }
-
+ @NotNull
@Override
public StructureView createStructureView(final FileEditor fileEditor,
- final StructureViewModel treeModel, final Project project, final boolean showRootNode) {
+ @NotNull final StructureViewModel treeModel,
+ @NotNull final Project project) {
+ return createStructureView(fileEditor, treeModel, project, true);
+ }
+
+ @NotNull
+ @Override
+ public StructureView createStructureView(final FileEditor fileEditor,
+ @NotNull StructureViewModel treeModel,
+ @NotNull Project project,
+ final boolean showRootNode) {
return new StructureViewComponent(fileEditor, treeModel, project, showRootNode);
}
}
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java b/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java
index 6886470e1a87..83174587bf01 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java
+++ b/platform/lang-impl/src/com/intellij/ide/structureView/impl/TemplateLanguageStructureViewBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -155,7 +155,7 @@ public abstract class TemplateLanguageStructureViewBuilder implements StructureV
@Override
@NotNull
- public StructureView createStructureView(FileEditor fileEditor, Project project) {
+ public StructureView createStructureView(FileEditor fileEditor, @NotNull Project project) {
myFileEditor = fileEditor;
List viewDescriptors = new ArrayList();
final TemplateLanguageFileViewProvider provider = getViewProvider();
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java
index ae8cedaf9129..6ac9813606ce 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java
+++ b/platform/lang-impl/src/com/intellij/ide/structureView/newStructureView/StructureViewComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -92,13 +92,9 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
private final StructureViewModel myTreeModel;
private static int ourSettingsModificationCount;
- public StructureViewComponent(FileEditor editor, StructureViewModel structureViewModel, Project project) {
- this(editor, structureViewModel, project, true);
- }
-
public StructureViewComponent(final FileEditor editor,
- final StructureViewModel structureViewModel,
- final Project project,
+ @NotNull StructureViewModel structureViewModel,
+ @NotNull Project project,
final boolean showRootNode) {
super(true, true);
@@ -236,7 +232,7 @@ public class StructureViewComponent extends SimpleToolWindowPanel implements Tre
}
- private static Object[] convertPathsToValues(TreePath[] selectionPaths) {
+ private static Object[] convertPathsToValues(@Nullable TreePath[] selectionPaths) {
if (selectionPaths == null) return null;
List
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java
index 5fccbdcf6c8d..f449ed1c2884 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java
+++ b/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeUi.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -717,8 +717,9 @@ public class AbstractTreeUi {
Runnable update = new Runnable() {
@Override
public void run() {
- if (getElementFromDescriptor(rootDescriptor.get()) != null) {
- createMapping(getElementFromDescriptor(rootDescriptor.get()), getRootNode());
+ Object fromDescriptor = getElementFromDescriptor(rootDescriptor.get());
+ if (fromDescriptor != null) {
+ createMapping(fromDescriptor, getRootNode());
}
@@ -3070,8 +3071,9 @@ public class AbstractTreeUi {
public void run() {
if (!oldElement.equals(newElement.get()) || forceRemapping.get()) {
removeMapping(oldElement, childNode, newElement.get());
- if (newElement.get() != null) {
- createMapping(newElement.get(), childNode);
+ Object newE = newElement.get();
+ if (newE != null) {
+ createMapping(newE, childNode);
}
NodeDescriptor parentDescriptor = getDescriptorFrom(parentNode);
if (parentDescriptor != null) {
@@ -3660,7 +3662,9 @@ public class AbstractTreeUi {
NodeDescriptor descriptor = getDescriptorFrom(node);
if (descriptor == null) return;
final Object element = getElementFromDescriptor(descriptor);
- removeMapping(element, node, null);
+ if (element != null) {
+ removeMapping(element, node, null);
+ }
myAutoExpandRoots.remove(element);
node.setUserObject(null);
node.removeAllChildren();
@@ -4565,7 +4569,7 @@ public class AbstractTreeUi {
myUpdaterState = null;
}
- private void createMapping(Object element, DefaultMutableTreeNode node) {
+ private void createMapping(@NotNull Object element, DefaultMutableTreeNode node) {
element = TreeAnchorizer.getService().createAnchor(element);
if (!myElementToNodeMap.containsKey(element)) {
myElementToNodeMap.put(element, node);
@@ -4585,7 +4589,7 @@ public class AbstractTreeUi {
}
}
- private void removeMapping(Object element, DefaultMutableTreeNode node, @Nullable Object elementToPutNodeActionsFor) {
+ private void removeMapping(@NotNull Object element, DefaultMutableTreeNode node, @Nullable Object elementToPutNodeActionsFor) {
element = TreeAnchorizer.getService().createAnchor(element);
final Object value = myElementToNodeMap.get(element);
if (value != null) {
diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java
index 6aade96ca923..2c81a6603c0c 100644
--- a/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java
+++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/DataConstants.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -35,7 +35,7 @@ public interface DataConstants {
/**
* Returns {@link com.intellij.openapi.module.Module}
*
- * @depreacated use {@link com.intellij.openapi.actionSystem.LangDataKeys#MODULE} instead
+ * @deprecated use {@link com.intellij.openapi.actionSystem.LangDataKeys#MODULE} instead
*/
@NonNls String MODULE = "module";
@@ -166,7 +166,7 @@ public interface DataConstants {
@NonNls String LANGUAGE = "Language";
/**
- * Returns java.awt.Component currently in focus, DataContext should be retreived for
+ * Returns java.awt.Component currently in focus, DataContext should be retrieved for
*
* @deprecated use {@link com.intellij.openapi.actionSystem.PlatformDataKeys#CONTEXT_COMPONENT} instead
*/
@@ -232,7 +232,7 @@ public interface DataConstants {
String DELETE_ELEMENT_PROVIDER = PlatformDataKeys.DELETE_ELEMENT_PROVIDER.getName();
/**
- * Returns com.intellij.openapi.editor.Editor even if foces currently is in find bar
+ * Returns com.intellij.openapi.editor.Editor even if focuses currently is in find bar
*
* @deprecated use {@link com.intellij.openapi.actionSystem.PlatformDataKeys#EDITOR} instead
*/
diff --git a/platform/platform-api/src/com/intellij/openapi/application/ApplicationActivationListener.java b/platform/platform-api/src/com/intellij/openapi/application/ApplicationActivationListener.java
index badabf49e5e6..ad67106c56eb 100644
--- a/platform/platform-api/src/com/intellij/openapi/application/ApplicationActivationListener.java
+++ b/platform/platform-api/src/com/intellij/openapi/application/ApplicationActivationListener.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.openapi.application;
import com.intellij.openapi.wm.IdeFrame;
@@ -7,17 +22,23 @@ import com.intellij.util.messages.Topic;
* @author yole
*/
public interface ApplicationActivationListener {
+ Topic TOPIC = Topic.create("Application activation notifications", ApplicationActivationListener.class);
+
/**
- * Is called when app is activated by transferring focus to it
- * @param ideFrame
+ * Called when app is activated by transferring focus to it.
*/
void applicationActivated(IdeFrame ideFrame);
/**
- * Is called when app is de-activated by transferring focus from it
- * @param ideFrame
+ * Called when app is de-activated by transferring focus from it.
*/
void applicationDeactivated(IdeFrame ideFrame);
- Topic TOPIC = Topic.create("com.intellij.openapi.application.ApplicationActivationListener", ApplicationActivationListener.class);
+ abstract class Adapter implements ApplicationActivationListener {
+ @Override
+ public void applicationActivated(IdeFrame ideFrame) { }
+
+ @Override
+ public void applicationDeactivated(IdeFrame ideFrame) { }
+ }
}
diff --git a/platform/platform-api/src/com/intellij/openapi/editor/TextLineWrapPositionStrategy.java b/platform/platform-api/src/com/intellij/openapi/editor/TextLineWrapPositionStrategy.java
new file mode 100644
index 000000000000..21e232a1c038
--- /dev/null
+++ b/platform/platform-api/src/com/intellij/openapi/editor/TextLineWrapPositionStrategy.java
@@ -0,0 +1,36 @@
+/*
+ * Copyright 2000-2014 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.openapi.editor;
+
+public class TextLineWrapPositionStrategy extends GenericLineWrapPositionStrategy {
+
+ public TextLineWrapPositionStrategy() {
+ // Commas.
+ addRule(new Rule(',', WrapCondition.AFTER, Rule.DEFAULT_WEIGHT));
+
+ // Symbols to wrap either before or after.
+ addRule(new Rule(' '));
+ addRule(new Rule('\t'));
+
+ // Symbols to wrap after.
+ addRule(new Rule(';', WrapCondition.AFTER));
+ addRule(new Rule(')', WrapCondition.AFTER));
+
+ // Symbols to wrap before
+ addRule(new Rule('(', WrapCondition.BEFORE));
+ addRule(new Rule('.', WrapCondition.BEFORE));
+ }
+}
diff --git a/platform/platform-api/src/com/intellij/openapi/vcs/impl/FileStatusImpl.java b/platform/platform-api/src/com/intellij/openapi/vcs/impl/FileStatusImpl.java
deleted file mode 100644
index 6f1b9d1d5b59..000000000000
--- a/platform/platform-api/src/com/intellij/openapi/vcs/impl/FileStatusImpl.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright 2000-2009 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.openapi.vcs.impl;
-
-import com.intellij.openapi.editor.colors.ColorKey;
-import com.intellij.openapi.editor.colors.EditorColorsManager;
-import com.intellij.openapi.vcs.FileStatus;
-
-import java.awt.*;
-
-/**
- * author: lesya
- */
-public class FileStatusImpl implements FileStatus {
- private final String myStatus;
- private final ColorKey myColorKey;
- private final String myText;
-
- public FileStatusImpl(String status, ColorKey key, String text) {
- myStatus = status;
- myColorKey = key;
- myText = text;
- }
-
- public String toString() {
- return myStatus;
- }
-
- public String getText() {
- return myText;
- }
-
- public Color getColor() {
- return EditorColorsManager.getInstance().getGlobalScheme().getColor(getColorKey());
- }
-
- public ColorKey getColorKey() {
- return myColorKey;
- }
-
- public String getId() {
- return myStatus;
- }
-
- public static class OnlyColorFileStatus extends FileStatusImpl {
- public OnlyColorFileStatus(String status, ColorKey key, String text) {
- super(status, key, text);
- }
-
- @Override
- public String getId() {
- throw new UnsupportedOperationException();
- }
-
- @Override
- public String getText() {
- throw new UnsupportedOperationException();
- }
- }
-}
diff --git a/platform/platform-api/src/com/intellij/openapi/wm/IdeFocusManager.java b/platform/platform-api/src/com/intellij/openapi/wm/IdeFocusManager.java
index 7f9fbb337ddc..d8f7e86d4b9e 100644
--- a/platform/platform-api/src/com/intellij/openapi/wm/IdeFocusManager.java
+++ b/platform/platform-api/src/com/intellij/openapi/wm/IdeFocusManager.java
@@ -42,7 +42,7 @@ import java.awt.event.KeyEvent;
* comp.requestFocus();
*
*
- * This class is also responsible for delivering key events while focus tranferring is in progress.
+ * This class is also responsible for delivering key events while focus transferring is in progress.
*
* IdeFocusManager instance can be received per project or the global instance. The preferred way is
* to use instance IdeFocusManager.getInstance(project). If no project instance is available, then
diff --git a/platform/platform-api/src/com/intellij/util/Alarm.java b/platform/platform-api/src/com/intellij/util/Alarm.java
index 1462df1888e4..269b81b630c3 100644
--- a/platform/platform-api/src/com/intellij/util/Alarm.java
+++ b/platform/platform-api/src/com/intellij/util/Alarm.java
@@ -116,16 +116,12 @@ public class Alarm implements Disposable {
if (runWithActiveFrameOnly && !ApplicationManager.getApplication().isActive()) {
final MessageBus bus = ApplicationManager.getApplication().getMessageBus();
final MessageBusConnection connection = bus.connect(this);
- connection.subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener() {
+ connection.subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener.Adapter() {
@Override
public void applicationActivated(IdeFrame ideFrame) {
connection.disconnect();
addRequest(request, delay);
}
-
- @Override
- public void applicationDeactivated(IdeFrame ideFrame) {
- }
});
} else {
addRequest(request, delay);
diff --git a/platform/platform-api/src/com/intellij/util/ui/update/Activatable.java b/platform/platform-api/src/com/intellij/util/ui/update/Activatable.java
index d0cfc9f0159e..d840f992b561 100644
--- a/platform/platform-api/src/com/intellij/util/ui/update/Activatable.java
+++ b/platform/platform-api/src/com/intellij/util/ui/update/Activatable.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -25,9 +25,11 @@ public interface Activatable {
void hideNotify();
class Adapter implements Activatable {
+ @Override
public void hideNotify() {
}
+ @Override
public void showNotify() {
}
}
diff --git a/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java b/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java
index d4bd50adf117..dea9dd8457bf 100644
--- a/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java
+++ b/platform/platform-impl/src/com/intellij/ide/CopyPasteManagerEx.java
@@ -58,17 +58,17 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn
}
@Override
- public void addContentChangedListener(ContentChangedListener listener) {
+ public void addContentChangedListener(@NotNull ContentChangedListener listener) {
myDispatcher.addListener(listener);
}
@Override
- public void addContentChangedListener(final ContentChangedListener listener, Disposable parentDisposable) {
+ public void addContentChangedListener(@NotNull final ContentChangedListener listener, @NotNull Disposable parentDisposable) {
myDispatcher.addListener(listener, parentDisposable);
}
@Override
- public void removeContentChangedListener(ContentChangedListener listener) {
+ public void removeContentChangedListener(@NotNull ContentChangedListener listener) {
myDispatcher.removeListener(listener);
}
@@ -256,6 +256,7 @@ public class CopyPasteManagerEx extends CopyPasteManager implements ClipboardOwn
return null;
}
+ @NotNull
@Override
public Transferable[] getAllContents() {
String clipString = getContents(DataFlavor.stringFlavor);
diff --git a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
index b1165471f28f..d585ec5a7b7d 100644
--- a/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/fileChooser/ex/FileChooserDialogImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -335,15 +335,11 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
ApplicationManager.getApplication().getMessageBus().connect(getDisposable())
- .subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener() {
+ .subscribe(ApplicationActivationListener.TOPIC, new ApplicationActivationListener.Adapter() {
@Override
public void applicationActivated(IdeFrame ideFrame) {
SaveAndSyncHandlerImpl.getInstance().maybeRefresh(ModalityState.current());
}
-
- @Override
- public void applicationDeactivated(IdeFrame ideFrame) {
- }
});
return panel;
diff --git a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java
index 609e239c15e4..7de5fc0d30e0 100644
--- a/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java
+++ b/platform/platform-impl/src/com/intellij/openapi/ui/playback/PlaybackRunner.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -74,11 +74,7 @@ public class PlaybackRunner {
myUseDirectActionCall = useDirectActionCall;
myUseTypingTargets = useTypingTargets;
myStopOnAppDeactivation = stopOnAppDeactivation;
- myAppListener = new ApplicationActivationListener() {
- @Override
- public void applicationActivated(IdeFrame ideFrame) {
- }
-
+ myAppListener = new ApplicationActivationListener.Adapter() {
@Override
public void applicationDeactivated(IdeFrame ideFrame) {
if (myStopOnAppDeactivation) {
diff --git a/platform/platform-impl/src/com/intellij/openapi/vcs/impl/FileStatusManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/vcs/impl/FileStatusManagerImpl.java
index 29a1ab9c5d7c..c3d1ab0c66ec 100644
--- a/platform/platform-impl/src/com/intellij/openapi/vcs/impl/FileStatusManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/vcs/impl/FileStatusManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -80,11 +80,13 @@ public class FileStatusManagerImpl extends FileStatusManager implements ProjectC
throw new AssertionError("Should not be called");
}
+ @NotNull
@Override
public ColorKey getColorKey() {
throw new AssertionError("Should not be called");
}
+ @NotNull
@Override
public String getId() {
throw new AssertionError("Should not be called");
@@ -175,7 +177,7 @@ public class FileStatusManagerImpl extends FileStatusManager implements ProjectC
}
@Override
- public void addFileStatusListener(final FileStatusListener listener, Disposable parentDisposable) {
+ public void addFileStatusListener(@NotNull final FileStatusListener listener, @NotNull Disposable parentDisposable) {
addFileStatusListener(listener);
Disposer.register(parentDisposable, new Disposable() {
@Override
@@ -275,14 +277,14 @@ public class FileStatusManagerImpl extends FileStatusManager implements ProjectC
}
@Override
- public void removeFileStatusListener(FileStatusListener listener) {
+ public void removeFileStatusListener(@NotNull FileStatusListener listener) {
myListeners.remove(listener);
}
@Override
- public Color getNotChangedDirectoryColor(VirtualFile vf) {
+ public Color getNotChangedDirectoryColor(@NotNull VirtualFile vf) {
final Color notChangedColor = FileStatus.NOT_CHANGED.getColor();
- if (vf == null || !vf.isDirectory()) {
+ if (!vf.isDirectory()) {
return notChangedColor;
}
final Boolean exactMatch = myWhetherExactlyParentToChanged.get(vf);
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java
index 952bb259a605..340ca8032263 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowHeadlessManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -85,6 +85,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx {
return false;
}
+ @NotNull
@Override
public ActionCallback getReady(@NotNull Object requestor) {
return new ActionCallback.Done();
@@ -265,6 +266,7 @@ public class ToolWindowHeadlessManagerImpl extends ToolWindowManagerEx {
private final List myContents = new ArrayList();
private Content mySelected;
+ @NotNull
@Override
public ActionCallback getReady(@NotNull Object requestor) {
return new ActionCallback.Done();
diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java
index cc9180e4c96e..ce09b94cc7fe 100644
--- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java
+++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/ToolWindowImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -154,6 +154,7 @@ public final class ToolWindowImpl implements ToolWindowEx {
return myToolWindowManager.isToolWindowActive(myId) || myDecorator != null && myDecorator.isFocused();
}
+ @NotNull
@Override
public ActionCallback getReady(@NotNull final Object requestor) {
final ActionCallback result = new ActionCallback();
diff --git a/platform/platform-impl/src/com/intellij/ui/AppIcon.java b/platform/platform-impl/src/com/intellij/ui/AppIcon.java
index 4dba3bebacb3..f8b4b062dbe1 100644
--- a/platform/platform-impl/src/com/intellij/ui/AppIcon.java
+++ b/platform/platform-impl/src/com/intellij/ui/AppIcon.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -143,22 +143,18 @@ public abstract class AppIcon {
Application app = ApplicationManager.getApplication();
if (app != null && myAppListener == null) {
- myAppListener = new ApplicationActivationListener() {
+ myAppListener = new ApplicationActivationListener.Adapter() {
@Override
public void applicationActivated(IdeFrame ideFrame) {
hideProgress(ideFrame.getProject(), myCurrentProcessId);
_setOkBadge(ideFrame, false);
_setTextBadge(ideFrame, null);
}
-
- @Override
- public void applicationDeactivated(IdeFrame ideFrame) {
- }
};
app.getMessageBus().connect().subscribe(ApplicationActivationListener.TOPIC, myAppListener);
}
- return app != null ? app.isActive() : false;
+ return app != null && app.isActive();
}
}
diff --git a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java
index b38eaedd62e7..b6e739692ede 100644
--- a/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java
+++ b/platform/platform-impl/src/com/intellij/ui/content/impl/ContentManagerImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -108,6 +108,7 @@ public class ContentManagerImpl implements ContentManager, PropertyChangeListene
return myComponent;
}
+ @NotNull
@Override
public ActionCallback getReady(@NotNull Object requestor) {
Content selected = getSelectedContent();
diff --git a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
index 97b376534c2d..c2b6e7461ea3 100755
--- a/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
+++ b/platform/platform-impl/src/com/intellij/ui/messages/SheetController.java
@@ -160,23 +160,24 @@ public class SheetController {
sheetPanel.add(headerLabel);
- JEditorPane textArea = new JEditorPane();
+ JEditorPane messageTextPane = new JEditorPane();
- textArea.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
- textArea.setFont(regularFont);
- textArea.setEditable(false);
+ messageTextPane.putClientProperty(JEditorPane.HONOR_DISPLAY_PROPERTIES, Boolean.TRUE);
+ messageTextPane.setFont(regularFont);
+ messageTextPane.setEditable(false);
- textArea.setContentType("text/html");
- textArea.setSize(250, Short.MAX_VALUE);
- textArea.setText(message);
- messageArea.setSize(250, textArea.getPreferredSize().height);
- textArea.setSize(messageArea);
+ messageTextPane.setContentType("text/html");
+ messageTextPane.setSize(250, Short.MAX_VALUE);
+ messageTextPane.setText(message);
+ messageArea.setSize(250, messageTextPane.getPreferredSize().height);
+ messageTextPane.setSize(messageArea);
- textArea.setOpaque(false);
+ messageTextPane.setOpaque(false);
+ messageTextPane.setFocusable(false);
- sheetPanel.add(textArea);
+ sheetPanel.add(messageTextPane);
- textArea.repaint();
+ messageTextPane.repaint();
SHEET_HEIGHT = 20 + headerLabel.getPreferredSize().height + 10 + messageArea.height + 10 + 70;
@@ -187,9 +188,11 @@ public class SheetController {
ico.setLocation(20, 20);
sheetPanel.add(ico);
headerLabel.setLocation(120, 20);
- textArea.setLocation(120, 20 + headerLabel.getPreferredSize().height + 10);
+ messageTextPane.setLocation(120, 20 + headerLabel.getPreferredSize().height + 10);
layoutWithAbsoluteLayout(buttons, sheetPanel);
+ sheetPanel.setFocusCycleRoot(true);
+
return sheetPanel;
}
@@ -267,8 +270,6 @@ public class SheetController {
final BufferedImage image = UIUtil.createImage(SHEET_WIDTH, SHEET_HEIGHT, BufferedImage.TYPE_INT_ARGB);
-
-
mySheetPanel.paint(image.createGraphics());
myOffScreenFrame.dispose();
return image;
diff --git a/platform/platform-resources-en/src/misc/registry.properties b/platform/platform-resources-en/src/misc/registry.properties
index 3518b23a6cca..ead490913d66 100644
--- a/platform/platform-resources-en/src/misc/registry.properties
+++ b/platform/platform-resources-en/src/misc/registry.properties
@@ -318,8 +318,6 @@ diagrams.rendering.no.cache=true
wolf.the.problem.solver=true
ui.no.bangs.and.whistles=false
-disable.graph.inference=false
-enable.graph.inference=true
comment.by.line.bulk.lines.trigger=100
@@ -367,3 +365,7 @@ ide.open.file.in.temp.project.dir.description=Enables opening file in temp proje
editor.allow.multiple.carets=false
embed.scene.builder=false
+typing.rbrace.reformats.block=true
+
+dsm.retina.darcula.legend=false
+dsm.retina.darcula.legend.description=Experimental DSM legend component
diff --git a/platform/platform-resources/src/META-INF/PlatformExtensions.xml b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
index d02dd820f454..bd5693a0cfb9 100644
--- a/platform/platform-resources/src/META-INF/PlatformExtensions.xml
+++ b/platform/platform-resources/src/META-INF/PlatformExtensions.xml
@@ -288,6 +288,8 @@
+
+
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/AbstractLineWrapPositionStrategyTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/AbstractLineWrapPositionStrategyTest.java
new file mode 100644
index 000000000000..5946038158a4
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/AbstractLineWrapPositionStrategyTest.java
@@ -0,0 +1,135 @@
+/*
+ * Copyright 2000-2014 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.openapi.editor;
+
+import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+import org.jmock.Expectations;
+import org.jmock.Mockery;
+import org.jmock.integration.junit4.JUnit4Mockery;
+import org.jmock.lib.legacy.ClassImposteriser;
+
+import static org.junit.Assert.assertSame;
+
+public abstract class AbstractLineWrapPositionStrategyTest {
+ private static final String EDGE_MARKER = "";
+ private static final String WRAP_MARKER = "";
+ private Mockery myMockery;
+ private Project myProject;
+
+ public void setUp() {
+ myMockery = new JUnit4Mockery() {{
+ setImposteriser(ClassImposteriser.INSTANCE);
+ }};
+ myProject = myMockery.mock(Project.class);
+ }
+
+ protected void doTest(@NotNull LineWrapPositionStrategy strategy, final String document) {
+ doTest(strategy, document, true);
+ }
+
+ protected void doTest(@NotNull LineWrapPositionStrategy strategy, final String document, boolean allowToBeyondMaxPreferredOffset) {
+ final Context context = new Context(document);
+ context.init();
+ int actual = strategy.calculateWrapPosition(
+ createMockDocument(context.document), myProject, 0, context.document.length(), context.edgeIndex,
+ allowToBeyondMaxPreferredOffset, true
+ );
+ assertSame(context.wrapIndex, actual);
+ }
+
+ private Document createMockDocument(@NotNull final String text) {
+ final Document result = myMockery.mock(Document.class);
+ myMockery.checking(new Expectations() {{
+ allowing(result).getCharsSequence(); will(returnValue(text));
+ }});
+ return result;
+ }
+
+ /**
+ * Utility class for parsing and initialising test data.
+ *
+ * Note: this class is line-oriented, i.e. it assumes that target document doesn't contain line feeds.
+ */
+ private static class Context {
+
+ private final StringBuilder buffer = new StringBuilder();
+ private final String rawDocument;
+
+ private String document;
+ private int index;
+ private int wrapIndex = -1;
+ private int tmpWrapIndex;
+ private int edgeIndex;
+ private int tmpEdgeIndex;
+
+ Context(String rawDocument) {
+ if (rawDocument.contains("\n")) {
+ throw new IllegalArgumentException(
+ String.format("Don't expect to test multi-line documents but the one is detected: '%s'", rawDocument)
+ );
+ }
+ this.rawDocument = rawDocument;
+ }
+
+ public void init() {
+ tmpWrapIndex = rawDocument.indexOf(WRAP_MARKER);
+ tmpEdgeIndex = rawDocument.indexOf(EDGE_MARKER);
+ if (tmpWrapIndex >= 0 && tmpEdgeIndex >= 0) {
+ if (tmpWrapIndex < tmpEdgeIndex) {
+ processWrap();
+ processMaxPreferredIndex();
+ }
+ else {
+ processMaxPreferredIndex();
+ processWrap();
+ }
+ }
+ else {
+ if (tmpWrapIndex >= 0) {
+ processWrap();
+ }
+ if (tmpEdgeIndex >= 0) {
+ processMaxPreferredIndex();
+ }
+ }
+
+ buffer.append(rawDocument.substring(index));
+ document = buffer.toString();
+ if (edgeIndex <= 0) {
+ edgeIndex = document.length();
+ }
+ }
+
+ private void processWrap() {
+ buffer.append(rawDocument.substring(index, tmpWrapIndex));
+ index = tmpWrapIndex + WRAP_MARKER.length();
+ wrapIndex = buffer.length();
+ if (rawDocument.indexOf(WRAP_MARKER, index) >= 0) {
+ throw new IllegalArgumentException(String.format("More than one wrap indicator is found at the document '%s'", rawDocument));
+ }
+ }
+
+ private void processMaxPreferredIndex() {
+ buffer.append(rawDocument.substring(index, tmpEdgeIndex));
+ index = tmpEdgeIndex + EDGE_MARKER.length();
+ edgeIndex = buffer.length();
+ if (rawDocument.indexOf(EDGE_MARKER, index) >= 0) {
+ throw new IllegalArgumentException(String.format("More than one max preferred offset is found at the document '%s'", rawDocument));
+ }
+ }
+ }
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/DefaultLineWrapPositionStrategyTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/DefaultLineWrapPositionStrategyTest.java
index a4b8ddf29bab..f0e1cf354ef5 100644
--- a/platform/platform-tests/testSrc/com/intellij/openapi/editor/DefaultLineWrapPositionStrategyTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/DefaultLineWrapPositionStrategyTest.java
@@ -15,161 +15,47 @@
*/
package com.intellij.openapi.editor;
-import com.intellij.openapi.project.Project;
-import org.jetbrains.annotations.NotNull;
-import org.jmock.Expectations;
-import org.jmock.Mockery;
-import org.jmock.integration.junit4.JUnit4Mockery;
-import org.jmock.lib.legacy.ClassImposteriser;
import org.junit.Before;
import org.junit.Test;
-import static org.junit.Assert.assertSame;
-
/**
* @author Denis Zhdanov
* @since Aug 25, 2010 3:20:41 PM
*/
-public class DefaultLineWrapPositionStrategyTest {
-
- private static final String EDGE_MARKER = "";
- private static final String WRAP_MARKER = "";
-
- private Mockery myMockery;
- private DefaultLineWrapPositionStrategy myStrategy;
- private Project myProject;
+public class DefaultLineWrapPositionStrategyTest extends AbstractLineWrapPositionStrategyTest {
+ private LineWrapPositionStrategy myStrategy;
@Before
public void setUp() {
+ super.setUp();
myStrategy = new DefaultLineWrapPositionStrategy();
-
- myMockery = new JUnit4Mockery() {{
- setImposteriser(ClassImposteriser.INSTANCE);
- }};
- myProject = myMockery.mock(Project.class);
}
@Test
public void commaNotSeparated() {
String document =
"void method(String p1, String p2) {}";
- doTest(document, false);
+ doTest(myStrategy, document, false);
}
@Test
public void wrapOnExceedingWhiteSpace() {
String document =
"void method(String p1, String p2) {}";
- doTest(document);
+ doTest(myStrategy, document);
}
@Test
public void preferWrapOnComma() {
String document =
"int variable = testMethod(var1 + var2, var3 + var4);";
- doTest(document);
+ doTest(myStrategy, document);
}
@Test
public void longStringWithoutWrapPositionIsNotWrapped() {
String document =
"--------------------------------------------------------------------------";
- doTest(document);
- }
-
- private void doTest(final String document) {
- doTest(document, true);
- }
-
- private void doTest(final String document, boolean allowToBeyondMaxPreferredOffset) {
- final Context context = new Context(document);
- context.init();
- int actual = myStrategy.calculateWrapPosition(
- createMockDocument(context.document), myProject, 0, context.document.length(), context.edgeIndex,
- allowToBeyondMaxPreferredOffset, true
- );
- assertSame(context.wrapIndex, actual);
- }
-
- private Document createMockDocument(@NotNull final String text) {
- final Document result = myMockery.mock(Document.class);
- myMockery.checking(new Expectations() {{
- allowing(result).getCharsSequence(); will(returnValue(text));
- }});
- return result;
- }
-
- /**
- * Utility class for parsing and initialising test data.
- *
- * Note: this class is line-oriented, i.e. it assumes that target document doesn't contain line feeds.
- */
- private static class Context {
-
- private final StringBuilder buffer = new StringBuilder();
- private final String rawDocument;
-
- private String document;
- private int index;
- private int wrapIndex = -1;
- private int tmpWrapIndex;
- private int edgeIndex;
- private int tmpEdgeIndex;
-
- Context(String rawDocument) {
- if (rawDocument.contains("\n")) {
- throw new IllegalArgumentException(
- String.format("Don't expect to test multi-line documents but the one is detected: '%s'", rawDocument)
- );
- }
- this.rawDocument = rawDocument;
- }
-
- public void init() {
- tmpWrapIndex = rawDocument.indexOf(WRAP_MARKER);
- tmpEdgeIndex = rawDocument.indexOf(EDGE_MARKER);
- if (tmpWrapIndex >= 0 && tmpEdgeIndex >= 0) {
- if (tmpWrapIndex < tmpEdgeIndex) {
- processWrap();
- processMaxPreferredIndex();
- }
- else {
- processMaxPreferredIndex();
- processWrap();
- }
- }
- else {
- if (tmpWrapIndex >= 0) {
- processWrap();
- }
- if (tmpEdgeIndex >= 0) {
- processMaxPreferredIndex();
- }
- }
-
- buffer.append(rawDocument.substring(index));
- document = buffer.toString();
- if (edgeIndex <= 0) {
- edgeIndex = document.length();
- }
- }
-
- private void processWrap() {
- buffer.append(rawDocument.substring(index, tmpWrapIndex));
- index = tmpWrapIndex + WRAP_MARKER.length();
- wrapIndex = buffer.length();
- if (rawDocument.indexOf(WRAP_MARKER, index) >= 0) {
- throw new IllegalArgumentException(String.format("More than one wrap indicator is found at the document '%s'", rawDocument));
- }
- }
-
- private void processMaxPreferredIndex() {
- buffer.append(rawDocument.substring(index, tmpEdgeIndex));
- index = tmpEdgeIndex + EDGE_MARKER.length();
- edgeIndex = buffer.length();
- if (rawDocument.indexOf(EDGE_MARKER, index) >= 0) {
- throw new IllegalArgumentException(String.format("More than one max preferred offset is found at the document '%s'", rawDocument));
- }
- }
+ doTest(myStrategy, document);
}
}
diff --git a/platform/platform-tests/testSrc/com/intellij/openapi/editor/TextLineWrapPositionStrategyTest.java b/platform/platform-tests/testSrc/com/intellij/openapi/editor/TextLineWrapPositionStrategyTest.java
new file mode 100644
index 000000000000..7d43d7954ada
--- /dev/null
+++ b/platform/platform-tests/testSrc/com/intellij/openapi/editor/TextLineWrapPositionStrategyTest.java
@@ -0,0 +1,37 @@
+/*
+ * Copyright 2000-2014 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.openapi.editor;
+
+import org.junit.Before;
+import org.junit.Test;
+
+public class TextLineWrapPositionStrategyTest extends AbstractLineWrapPositionStrategyTest {
+ private LineWrapPositionStrategy myStrategy;
+
+ @Before
+ public void setUp() {
+ super.setUp();
+ myStrategy = new TextLineWrapPositionStrategy();
+ }
+
+ @Test
+ public void preferNearestWhiteSpaceWrap_InsteadOf_Comma() {
+ String document =
+ "queueing the JSON for later submission, we retain the SimpleRequestData";
+ doTest(myStrategy, document, false);
+ }
+
+}
diff --git a/platform/platform-tests/testSrc/com/intellij/structureView/SmartTreeStructureTest.java b/platform/platform-tests/testSrc/com/intellij/structureView/SmartTreeStructureTest.java
index 2132deb33f1c..e62512ba0669 100644
--- a/platform/platform-tests/testSrc/com/intellij/structureView/SmartTreeStructureTest.java
+++ b/platform/platform-tests/testSrc/com/intellij/structureView/SmartTreeStructureTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -123,6 +123,7 @@ public class SmartTreeStructureTest extends LightPlatformCodeInsightFixtureTestC
public void testSorting() throws Exception {
myModel.addSorter(new Sorter() {
+ @NotNull
@Override
public Comparator getComparator() {
return new Comparator() {
@@ -154,6 +155,7 @@ public class SmartTreeStructureTest extends LightPlatformCodeInsightFixtureTestC
});
myModel.addSorter(new Sorter() {
+ @NotNull
@Override
public Comparator getComparator() {
return new Comparator() {
diff --git a/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java b/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java
index f4474c547514..280bfb89eacc 100644
--- a/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java
+++ b/platform/platform-tests/testSrc/com/intellij/structureView/TestGrouper.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.structureView;
import com.intellij.ide.util.treeView.AbstractTreeNode;
@@ -42,6 +57,7 @@ public class TestGrouper implements Grouper {
myChildren = new ArrayList(children);
}
+ @NotNull
@Override
public Collection getChildren() {
Collection result = new LinkedHashSet();
@@ -53,6 +69,7 @@ public class TestGrouper implements Grouper {
return result;
}
+ @NotNull
@Override
public ItemPresentation getPresentation() {
return null;
@@ -80,7 +97,7 @@ public class TestGrouper implements Grouper {
@Override
@NotNull
- public Collection group(final AbstractTreeNode parent, Collection children) {
+ public Collection group(@NotNull final AbstractTreeNode parent, @NotNull Collection children) {
List result = new ArrayList();
Collection parentGroupUsedStrings = parent.getValue() instanceof StringGroup ?
((StringGroup)parent.getValue()).myChildrenUsedStrings :
diff --git a/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java b/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java
index 7b0da6e39d40..56e628a37fd8 100644
--- a/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java
+++ b/platform/platform-tests/testSrc/com/intellij/structureView/TestTreeModel.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.structureView;
import com.intellij.ide.projectView.PresentationData;
@@ -67,12 +82,14 @@ public class TestTreeModel implements StructureViewModel{
myValue = value;
}
+ @NotNull
@Override
public StructureViewTreeElement[] getChildren() {
return myChildren.toArray(new StructureViewTreeElement[myChildren.size()]);
}
+ @NotNull
@Override
public ItemPresentation getPresentation() {
return new PresentationData(myValue, null, null, null);
@@ -114,11 +131,11 @@ public class TestTreeModel implements StructureViewModel{
}
@Override
- public void addEditorPositionListener(FileEditorPositionListener listener) {
+ public void addEditorPositionListener(@NotNull FileEditorPositionListener listener) {
}
@Override
- public void removeEditorPositionListener(FileEditorPositionListener listener) {
+ public void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) {
}
@Override
@@ -131,12 +148,12 @@ public class TestTreeModel implements StructureViewModel{
}
@Override
- public void addModelListener(ModelListener modelListener) {
+ public void addModelListener(@NotNull ModelListener modelListener) {
}
@Override
- public void removeModelListener(ModelListener modelListener) {
+ public void removeModelListener(@NotNull ModelListener modelListener) {
}
}
diff --git a/platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java b/platform/structure-view-api/src/com/intellij/ide/projectView/PresentationData.java
similarity index 99%
rename from platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java
rename to platform/structure-view-api/src/com/intellij/ide/projectView/PresentationData.java
index 18cd07311f41..435c5ef9279d 100644
--- a/platform/platform-api/src/com/intellij/ide/projectView/PresentationData.java
+++ b/platform/structure-view-api/src/com/intellij/ide/projectView/PresentationData.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/lang-api/src/com/intellij/ide/projectView/RootsProvider.java b/platform/structure-view-api/src/com/intellij/ide/projectView/RootsProvider.java
similarity index 90%
rename from platform/lang-api/src/com/intellij/ide/projectView/RootsProvider.java
rename to platform/structure-view-api/src/com/intellij/ide/projectView/RootsProvider.java
index 6a7ca09059c4..2f341936fb3d 100644
--- a/platform/lang-api/src/com/intellij/ide/projectView/RootsProvider.java
+++ b/platform/structure-view-api/src/com/intellij/ide/projectView/RootsProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.ide.projectView;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.util.containers.HashSet;
+import org.jetbrains.annotations.NotNull;
import java.util.Collection;
import java.util.Set;
@@ -25,6 +26,7 @@ public interface RootsProvider {
Set EMPTY_ROOTS = new HashSet();
+ @NotNull
Collection getRoots();
}
diff --git a/platform/structure-view-api/src/com/intellij/ide/projectView/SettingsProvider.java b/platform/structure-view-api/src/com/intellij/ide/projectView/SettingsProvider.java
new file mode 100644
index 000000000000..e7163ba361c1
--- /dev/null
+++ b/platform/structure-view-api/src/com/intellij/ide/projectView/SettingsProvider.java
@@ -0,0 +1,20 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.ide.projectView;
+
+public interface SettingsProvider {
+ ViewSettings getSettings();
+}
diff --git a/platform/lang-api/src/com/intellij/ide/projectView/TreeStructureProvider.java b/platform/structure-view-api/src/com/intellij/ide/projectView/TreeStructureProvider.java
similarity index 90%
rename from platform/lang-api/src/com/intellij/ide/projectView/TreeStructureProvider.java
rename to platform/structure-view-api/src/com/intellij/ide/projectView/TreeStructureProvider.java
index 0ecf0f2c90ef..315a41ec6a81 100644
--- a/platform/lang-api/src/com/intellij/ide/projectView/TreeStructureProvider.java
+++ b/platform/structure-view-api/src/com/intellij/ide/projectView/TreeStructureProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.ide.projectView;
import com.intellij.ide.util.treeView.AbstractTreeNode;
import com.intellij.openapi.extensions.ExtensionPointName;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
@@ -38,7 +39,8 @@ public interface TreeStructureProvider {
* @return the modified collection of child nodes, or children if no modifications
* are required.
*/
- Collection modify(AbstractTreeNode parent, Collection children, ViewSettings settings);
+ @NotNull
+ Collection modify(@NotNull AbstractTreeNode parent, @NotNull Collection children, ViewSettings settings);
/**
* Returns a user data object of the specified type for the specified selection in the
diff --git a/platform/lang-api/src/com/intellij/ide/projectView/ViewSettings.java b/platform/structure-view-api/src/com/intellij/ide/projectView/ViewSettings.java
similarity index 98%
rename from platform/lang-api/src/com/intellij/ide/projectView/ViewSettings.java
rename to platform/structure-view-api/src/com/intellij/ide/projectView/ViewSettings.java
index bc11154a08ad..4229fcf47440 100644
--- a/platform/lang-api/src/com/intellij/ide/projectView/ViewSettings.java
+++ b/platform/structure-view-api/src/com/intellij/ide/projectView/ViewSettings.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java b/platform/structure-view-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java
similarity index 96%
rename from platform/platform-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java
index 9dc167caac50..ad7a2ce32239 100644
--- a/platform/platform-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/FileEditorPositionListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/structureView/ModelListener.java b/platform/structure-view-api/src/com/intellij/ide/structureView/ModelListener.java
similarity index 96%
rename from platform/platform-api/src/com/intellij/ide/structureView/ModelListener.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/ModelListener.java
index e633d227dfc7..3ec8c284c6ca 100644
--- a/platform/platform-api/src/com/intellij/ide/structureView/ModelListener.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/ModelListener.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureView.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureView.java
similarity index 98%
rename from platform/platform-api/src/com/intellij/ide/structureView/StructureView.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/StructureView.java
index ee4817ae5a5f..604fa00b2841 100644
--- a/platform/platform-api/src/com/intellij/ide/structureView/StructureView.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureView.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilder.java
similarity index 94%
rename from platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilder.java
index 87ba9c5e7b4d..ceaab48de15b 100644
--- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilder.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -49,5 +49,5 @@ public interface StructureViewBuilder {
* @see TreeBasedStructureViewBuilder
*/
@NotNull
- StructureView createStructureView(FileEditor fileEditor, Project project);
+ StructureView createStructureView(FileEditor fileEditor, @NotNull Project project);
}
diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java
similarity index 97%
rename from platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java
index 55495001457f..5d70e3d95c7d 100644
--- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewBuilderProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewFactory.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewFactory.java
similarity index 80%
rename from platform/platform-api/src/com/intellij/ide/structureView/StructureViewFactory.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewFactory.java
index e10f3c190a69..1d2bf73f10f7 100644
--- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewFactory.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,6 +18,7 @@ package com.intellij.ide.structureView;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.openapi.fileEditor.FileEditor;
import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
/**
* Factory interface for creating instances of the standard structure view component.
@@ -31,9 +32,10 @@ public abstract class StructureViewFactory {
* @param project the project containing the file for which the structure view is requested.
* @return the structure view instance.
*/
+ @NotNull
public abstract StructureView createStructureView(FileEditor fileEditor,
- StructureViewModel treeModel,
- Project project);
+ @NotNull StructureViewModel treeModel,
+ @NotNull Project project);
/**
* Creates a structure view component instance for the specified editor.
@@ -44,10 +46,11 @@ public abstract class StructureViewFactory {
* @param showRootNode pass false if root node of the structure built should not actually be shown in result tree.
* @return the structure view instance.
*/
+ @NotNull
public abstract StructureView createStructureView(FileEditor fileEditor,
- StructureViewModel treeModel,
- Project project,
- boolean showRootNode);
+ @NotNull StructureViewModel treeModel,
+ @NotNull Project project,
+ boolean showRootNode);
public static StructureViewFactory getInstance(Project project) {
return ServiceManager.getService(project, StructureViewFactory.class);
diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewModel.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModel.java
similarity index 87%
rename from platform/platform-api/src/com/intellij/ide/structureView/StructureViewModel.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModel.java
index 61009d21c34c..551d70d055e1 100644
--- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewModel.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -41,7 +41,7 @@ public interface StructureViewModel extends TreeModel {
*
* @param listener the listener to add.
*/
- void addEditorPositionListener(FileEditorPositionListener listener);
+ void addEditorPositionListener(@NotNull FileEditorPositionListener listener);
/**
* Removes a listener which gets notified when the selection in the editor linked to the
@@ -49,7 +49,7 @@ public interface StructureViewModel extends TreeModel {
*
* @param listener the listener to remove.
*/
- void removeEditorPositionListener(FileEditorPositionListener listener);
+ void removeEditorPositionListener(@NotNull FileEditorPositionListener listener);
/**
* Adds a listener which gets notified when the data represented by the structure view
@@ -57,7 +57,7 @@ public interface StructureViewModel extends TreeModel {
*
* @param modelListener the listener to add.
*/
- void addModelListener(ModelListener modelListener);
+ void addModelListener(@NotNull ModelListener modelListener);
/**
* Removes a listener which gets notified when the data represented by the structure view
@@ -65,13 +65,14 @@ public interface StructureViewModel extends TreeModel {
*
* @param modelListener the listener to remove.
*/
- void removeModelListener(ModelListener modelListener);
+ void removeModelListener(@NotNull ModelListener modelListener);
/**
* Returns the root element of the structure view tree.
*
* @return the structure view root.
*/
+ @Override
@NotNull
StructureViewTreeElement getRoot();
@@ -83,15 +84,12 @@ public interface StructureViewModel extends TreeModel {
boolean shouldEnterElement(Object element);
interface ElementInfoProvider extends StructureViewModel {
-
boolean isAlwaysShowsPlus(StructureViewTreeElement element);
-
boolean isAlwaysLeaf(StructureViewTreeElement element);
-
}
interface ExpandInfoProvider {
- boolean isAutoExpand(StructureViewTreeElement element);
+ boolean isAutoExpand(@NotNull StructureViewTreeElement element);
boolean isSmartExpand();
}
}
diff --git a/platform/lang-api/src/com/intellij/ide/structureView/StructureViewModelBase.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModelBase.java
similarity index 87%
rename from platform/lang-api/src/com/intellij/ide/structureView/StructureViewModelBase.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModelBase.java
index f38ef1503ddf..ac191b813ffd 100644
--- a/platform/lang-api/src/com/intellij/ide/structureView/StructureViewModelBase.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewModelBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -37,9 +37,7 @@ public class StructureViewModelBase extends TextEditorBasedStructureViewModel {
}
public StructureViewModelBase(@NotNull PsiFile psiFile, @NotNull StructureViewTreeElement root) {
- super(psiFile);
-
- myRoot = root;
+ this(psiFile, null, root);
}
@Override
@@ -48,12 +46,14 @@ public class StructureViewModelBase extends TextEditorBasedStructureViewModel {
return myRoot;
}
- public StructureViewModelBase withSorters(Sorter... sorters) {
+ @NotNull
+ public StructureViewModelBase withSorters(@NotNull Sorter... sorters) {
mySorters = sorters;
return this;
}
- public StructureViewModelBase withSuitableClasses(Class... suitableClasses) {
+ @NotNull
+ public StructureViewModelBase withSuitableClasses(@NotNull Class... suitableClasses) {
mySuitableClasses = suitableClasses;
return this;
}
diff --git a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java
similarity index 92%
rename from platform/platform-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java
index 81010a383d9f..1b666467585e 100644
--- a/platform/platform-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/StructureViewTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -34,6 +34,4 @@ public interface StructureViewTreeElement extends TreeElement, Navigatable{
* @return the data object instance.
*/
Object getValue();
-
- /*StructureViewTreeElement[] getChildren();*/
}
diff --git a/platform/lang-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java b/platform/structure-view-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java
similarity index 91%
rename from platform/lang-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java
index 02d63de0e0de..5cef3a5801a6 100644
--- a/platform/lang-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/TextEditorBasedStructureViewModel.java
@@ -24,7 +24,7 @@ import com.intellij.openapi.editor.event.CaretListener;
import com.intellij.openapi.util.Disposer;
import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiFile;
-import com.intellij.psi.util.PsiUtilBase;
+import com.intellij.psi.util.PsiEditorUtil;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ReflectionUtil;
import com.intellij.util.containers.ContainerUtil;
@@ -54,7 +54,7 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView
* @param psiFile the file for which the structure view model is requested.
*/
protected TextEditorBasedStructureViewModel(@NotNull PsiFile psiFile) {
- this(PsiUtilBase.findEditor(psiFile), psiFile);
+ this(PsiEditorUtil.Service.getInstance().findEditorByPsiElement(psiFile), psiFile);
}
/**
@@ -85,12 +85,12 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView
}
@Override
- public final void addEditorPositionListener(FileEditorPositionListener listener) {
+ public final void addEditorPositionListener(@NotNull FileEditorPositionListener listener) {
myListeners.add(listener);
}
@Override
- public final void removeEditorPositionListener(FileEditorPositionListener listener) {
+ public final void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) {
myListeners.remove(listener);
}
@@ -136,12 +136,12 @@ public abstract class TextEditorBasedStructureViewModel implements StructureView
}
@Override
- public void addModelListener(ModelListener modelListener) {
+ public void addModelListener(@NotNull ModelListener modelListener) {
}
@Override
- public void removeModelListener(ModelListener modelListener) {
+ public void removeModelListener(@NotNull ModelListener modelListener) {
}
diff --git a/platform/lang-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java b/platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java
similarity index 94%
rename from platform/lang-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java
rename to platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java
index ec30047809be..c0152c7f64ad 100644
--- a/platform/lang-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java
+++ b/platform/structure-view-api/src/com/intellij/ide/structureView/TreeBasedStructureViewBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -33,8 +33,7 @@ import org.jetbrains.annotations.Nullable;
* @see TextEditorBasedStructureViewModel
* @see com.intellij.lang.LanguageStructureViewBuilder#getStructureViewBuilder(com.intellij.psi.PsiFile)
*/
-public abstract class
- TreeBasedStructureViewBuilder implements StructureViewBuilder {
+public abstract class TreeBasedStructureViewBuilder implements StructureViewBuilder {
/**
* @deprecated Use createStructureViewModel(Editor editor)
*/
@@ -60,7 +59,7 @@ public abstract class
@Override
@NotNull
- public StructureView createStructureView(FileEditor fileEditor, Project project) {
+ public StructureView createStructureView(FileEditor fileEditor, @NotNull Project project) {
final StructureViewModel model = createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null);
StructureView view = StructureViewFactory.getInstance(project).createStructureView(fileEditor, model, project, isRootNodeShown());
Disposer.register(view, new Disposable() {
@@ -79,4 +78,4 @@ public abstract class
public boolean isRootNodeShown() {
return true;
}
-}
\ No newline at end of file
+}
diff --git a/platform/platform-api/src/com/intellij/ide/structureView/package.html b/platform/structure-view-api/src/com/intellij/ide/structureView/package.html
similarity index 100%
rename from platform/platform-api/src/com/intellij/ide/structureView/package.html
rename to platform/structure-view-api/src/com/intellij/ide/structureView/package.html
diff --git a/platform/structure-view-api/src/com/intellij/ide/util/ActionShortcutProvider.java b/platform/structure-view-api/src/com/intellij/ide/util/ActionShortcutProvider.java
new file mode 100644
index 000000000000..26c5c9388373
--- /dev/null
+++ b/platform/structure-view-api/src/com/intellij/ide/util/ActionShortcutProvider.java
@@ -0,0 +1,24 @@
+/*
+ * Copyright 2000-2014 JetBrains s.r.o.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.intellij.ide.util;
+
+import org.jetbrains.annotations.NotNull;
+
+// used in the implementation of FileStructureNodeProvider to avoid dependency on KeyMapManager in com.intellij.ide.util.FileStructureNodeProvider.getShortcut()
+public interface ActionShortcutProvider {
+ @NotNull
+ String getActionIdForShortcut();
+}
diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructureFilter.java b/platform/structure-view-api/src/com/intellij/ide/util/FileStructureFilter.java
similarity index 88%
rename from platform/lang-impl/src/com/intellij/ide/util/FileStructureFilter.java
rename to platform/structure-view-api/src/com/intellij/ide/util/FileStructureFilter.java
index 9c2f7b230ecc..f8fa7a877f40 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/FileStructureFilter.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/FileStructureFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,12 +18,15 @@ package com.intellij.ide.util;
import com.intellij.ide.util.treeView.smartTree.Filter;
import com.intellij.openapi.actionSystem.Shortcut;
+import org.jetbrains.annotations.NotNull;
/**
* @author yole
*/
public interface FileStructureFilter extends Filter {
+ @NotNull
String getCheckBoxText();
+ @NotNull
Shortcut[] getShortcut();
}
diff --git a/platform/lang-impl/src/com/intellij/ide/util/FileStructureNodeProvider.java b/platform/structure-view-api/src/com/intellij/ide/util/FileStructureNodeProvider.java
similarity index 90%
rename from platform/lang-impl/src/com/intellij/ide/util/FileStructureNodeProvider.java
rename to platform/structure-view-api/src/com/intellij/ide/util/FileStructureNodeProvider.java
index 524354442e1b..2bf37e2635c1 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/FileStructureNodeProvider.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/FileStructureNodeProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,12 +18,15 @@ package com.intellij.ide.util;
import com.intellij.ide.util.treeView.smartTree.NodeProvider;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.openapi.actionSystem.Shortcut;
+import org.jetbrains.annotations.NotNull;
/**
* @author Konstantin Bulenkov
*/
public interface FileStructureNodeProvider extends NodeProvider {
+ @NotNull
String getCheckBoxText();
+ @NotNull
Shortcut[] getShortcut();
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java
similarity index 94%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java
index d722c2c6444e..ada9c64047e6 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/AbstractTreeNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -69,7 +69,7 @@ public abstract class AbstractTreeNode extends PresentableNodeDescriptor extends PresentableNodeDescriptor extends PresentableNodeDescriptor extends NodeDescriptor {
return new PresentationData();
}
- protected void postprocess(PresentationData date) {
+ protected void postprocess(@NotNull PresentationData date) {
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.java
similarity index 97%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.java
index 058139e34ef7..1da325dcd5db 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeAnchorizer.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java
similarity index 98%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java
index 4884ca1f804e..7b4e1f83b690 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeUpdatePass.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeVisitor.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeVisitor.java
similarity index 94%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/TreeVisitor.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeVisitor.java
index 2744537e60e4..211abb1b5c72 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/TreeVisitor.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/TreeVisitor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/ValidateableNode.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/ValidateableNode.java
similarity index 94%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/ValidateableNode.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/ValidateableNode.java
index f08ba88976f5..f8f3c3d6fddf 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/ValidateableNode.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/ValidateableNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/WeighedItem.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/WeighedItem.java
similarity index 94%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/WeighedItem.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/WeighedItem.java
index ad2552cd62f2..edbe752d3208 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/WeighedItem.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/WeighedItem.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -20,4 +20,4 @@ package com.intellij.ide.util.treeView;
*/
public interface WeighedItem {
int getWeight();
-}
\ No newline at end of file
+}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java
similarity index 93%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java
index 0a95507ac9f1..8ba47d5b32e1 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentation.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,6 +15,8 @@
*/
package com.intellij.ide.util.treeView.smartTree;
+import org.jetbrains.annotations.NotNull;
+
import javax.swing.*;
/**
@@ -31,6 +33,7 @@ public interface ActionPresentation {
*
* @return the action name.
*/
+ @NotNull
String getText();
/**
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java
similarity index 90%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java
index d5194afe675d..1a85799128cc 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ActionPresentationData.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,6 +15,8 @@
*/
package com.intellij.ide.util.treeView.smartTree;
+import org.jetbrains.annotations.NotNull;
+
import javax.swing.*;
/**
@@ -35,13 +37,14 @@ public class ActionPresentationData implements ActionPresentation {
* @param icon the icon for the action, displayed on the toolbar button.
*/
- public ActionPresentationData(String text, String description, Icon icon) {
+ public ActionPresentationData(@NotNull String text, String description, Icon icon) {
myText = text;
myDescription = description;
myIcon = icon;
}
@Override
+ @NotNull
public String getText() {
return myText;
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java
similarity index 97%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java
index f418858a8f1b..3cd07474612f 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Filter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Group.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Group.java
similarity index 91%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Group.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Group.java
index b1ba9a31d8e0..9623cf6a5c4e 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Group.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Group.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package com.intellij.ide.util.treeView.smartTree;
import com.intellij.navigation.ItemPresentation;
+import org.jetbrains.annotations.NotNull;
import java.util.Collection;
@@ -30,6 +31,7 @@ public interface Group {
*
* @return the group presentation.
*/
+ @NotNull
ItemPresentation getPresentation();
/**
@@ -37,5 +39,6 @@ public interface Group {
*
* @return the list of nodes.
*/
+ @NotNull
Collection getChildren();
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java
similarity index 88%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java
index 83381b65c2b0..9c36f0c5f867 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Grouper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -37,5 +37,6 @@ public interface Grouper extends TreeAction {
* @param children the children of the parent node.
* @return the collection of groups
*/
- @NotNull Collection group(final AbstractTreeNode parent, Collection children);
+ @NotNull
+ Collection group(@NotNull AbstractTreeNode parent, @NotNull Collection children);
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.java
similarity index 83%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.java
index d55e73200e90..ea97b85b78b0 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/NodeProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,11 +15,14 @@
*/
package com.intellij.ide.util.treeView.smartTree;
+import org.jetbrains.annotations.NotNull;
+
import java.util.Collection;
/**
* @author Konstantin Bulenkov
*/
public interface NodeProvider extends TreeAction {
- Collection provideNodes(TreeElement node);
+ @NotNull
+ Collection provideNodes(@NotNull TreeElement node);
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.java
similarity index 95%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.java
index 8e2263cf6bca..cd2f7a0df243 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/ProvidingTreeModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java
similarity index 89%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java
index fda76a576379..6ec0f5484b57 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SortableTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,10 +16,13 @@
package com.intellij.ide.util.treeView.smartTree;
+import org.jetbrains.annotations.NotNull;
+
/**
* Item in a smart tree which allows using a custom text (other than the presentable text)
* as a key for alphabetic sorting.
*/
public interface SortableTreeElement {
+ @NotNull
String getAlphaSortKey();
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java
similarity index 98%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java
index 1b0728de37de..cd0f2dbf6516 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/Sorter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java
similarity index 71%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java
index 5434bc082bab..cabcc7a7ac0d 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/SorterUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,6 +15,8 @@
*/
package com.intellij.ide.util.treeView.smartTree;
+import org.jetbrains.annotations.NotNull;
+
/**
* @author Konstantin Bulenkov
*/
@@ -22,16 +24,19 @@ public class SorterUtil {
private SorterUtil() {
}
+ @NotNull
public static String getStringPresentation(Object object) {
String result = null;
if (object instanceof SortableTreeElement) {
- result = ((SortableTreeElement) object).getAlphaSortKey();
- } else if (object instanceof TreeElement){
- result = ((TreeElement)object).getPresentation().getPresentableText();
- } else if (object instanceof Group){
+ result = ((SortableTreeElement)object).getAlphaSortKey();
+ }
+ else if (object instanceof TreeElement) {
+ result = ((TreeElement)object).getPresentation().getPresentableText();
+ }
+ else if (object instanceof Group) {
result = ((Group)object).getPresentation().getPresentableText();
}
- return result != null ? result : "";
+ return result == null ? "" : result;
}
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java
similarity index 97%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java
index e35ec5df5dbb..82b907195b04 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeAction.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java
similarity index 88%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java
index b672bfa947ef..407c4437e57b 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package com.intellij.ide.util.treeView.smartTree;
import com.intellij.navigation.ItemPresentation;
+import org.jetbrains.annotations.NotNull;
/**
* An element in a generic tree control displayed in the IDEA user interface.
@@ -24,11 +25,13 @@ import com.intellij.navigation.ItemPresentation;
*/
public interface TreeElement {
+ TreeElement[] EMPTY_ARRAY = new TreeElement[0];
/**
* Returns the presentation of the tree element.
*
* @return the element presentation.
*/
+ @NotNull
ItemPresentation getPresentation();
/**
@@ -36,5 +39,6 @@ public interface TreeElement {
*
* @return the list of children.
*/
+ @NotNull
TreeElement[] getChildren();
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java
similarity index 88%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java
index 0375e32eae03..675c7041cd3e 100644
--- a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java
+++ b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/TreeModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -29,7 +29,8 @@ public interface TreeModel {
*
* @return the tree root.
*/
- @NotNull TreeElement getRoot();
+ @NotNull
+ TreeElement getRoot();
/**
* Returns the list of actions for grouping items in the tree.
@@ -37,7 +38,8 @@ public interface TreeModel {
* @return the array of grouping actions.
* @see Grouper#EMPTY_ARRAY
*/
- @NotNull Grouper[] getGroupers();
+ @NotNull
+ Grouper[] getGroupers();
/**
* Returns the array of actions for sorting items in the tree.
@@ -45,7 +47,8 @@ public interface TreeModel {
* @return the array of sorting actions.
* @see Sorter#EMPTY_ARRAY
*/
- @NotNull Sorter[] getSorters();
+ @NotNull
+ Sorter[] getSorters();
/**
* Returns the array of actions for filtering items in the tree.
@@ -53,5 +56,6 @@ public interface TreeModel {
* @return the array of filtering actions.
* @see Filter#EMPTY_ARRAY
*/
- @NotNull Filter[] getFilters();
+ @NotNull
+ Filter[] getFilters();
}
diff --git a/platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/package.html b/platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/package.html
similarity index 100%
rename from platform/platform-api/src/com/intellij/ide/util/treeView/smartTree/package.html
rename to platform/structure-view-api/src/com/intellij/ide/util/treeView/smartTree/package.html
diff --git a/platform/lang-api/src/com/intellij/lang/LanguageStructureViewBuilder.java b/platform/structure-view-api/src/com/intellij/lang/LanguageStructureViewBuilder.java
similarity index 97%
rename from platform/lang-api/src/com/intellij/lang/LanguageStructureViewBuilder.java
rename to platform/structure-view-api/src/com/intellij/lang/LanguageStructureViewBuilder.java
index 924f53f6f6f5..df4d76cabf1b 100644
--- a/platform/lang-api/src/com/intellij/lang/LanguageStructureViewBuilder.java
+++ b/platform/structure-view-api/src/com/intellij/lang/LanguageStructureViewBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/lang-api/src/com/intellij/lang/PsiStructureViewFactory.java b/platform/structure-view-api/src/com/intellij/lang/PsiStructureViewFactory.java
similarity index 96%
rename from platform/lang-api/src/com/intellij/lang/PsiStructureViewFactory.java
rename to platform/structure-view-api/src/com/intellij/lang/PsiStructureViewFactory.java
index ca9ab8589ed6..afe96269e775 100644
--- a/platform/lang-api/src/com/intellij/lang/PsiStructureViewFactory.java
+++ b/platform/structure-view-api/src/com/intellij/lang/PsiStructureViewFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/lang-api/src/com/intellij/navigation/AnonymousElementProvider.java b/platform/structure-view-api/src/com/intellij/navigation/AnonymousElementProvider.java
similarity index 85%
rename from platform/lang-api/src/com/intellij/navigation/AnonymousElementProvider.java
rename to platform/structure-view-api/src/com/intellij/navigation/AnonymousElementProvider.java
index 2d56cd99c7f3..f7369ca57278 100644
--- a/platform/lang-api/src/com/intellij/navigation/AnonymousElementProvider.java
+++ b/platform/structure-view-api/src/com/intellij/navigation/AnonymousElementProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,7 @@ package com.intellij.navigation;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
/**
* @author Konstantin Bulenkov
@@ -24,5 +25,6 @@ import com.intellij.psi.PsiElement;
public interface AnonymousElementProvider {
ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.anonymousElementProvider");
- PsiElement[] getAnonymousElements(PsiElement parent);
+ @NotNull
+ PsiElement[] getAnonymousElements(@NotNull PsiElement parent);
}
diff --git a/platform/platform-api/src/com/intellij/openapi/util/PropertyOwner.java b/platform/structure-view-api/src/com/intellij/openapi/util/PropertyOwner.java
similarity index 94%
rename from platform/platform-api/src/com/intellij/openapi/util/PropertyOwner.java
rename to platform/structure-view-api/src/com/intellij/openapi/util/PropertyOwner.java
index d8aa8b40840b..c344f15a4e23 100644
--- a/platform/platform-api/src/com/intellij/openapi/util/PropertyOwner.java
+++ b/platform/structure-view-api/src/com/intellij/openapi/util/PropertyOwner.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/structure-view-api/structure-view-api.iml b/platform/structure-view-api/structure-view-api.iml
new file mode 100644
index 000000000000..199e5f92fca9
--- /dev/null
+++ b/platform/structure-view-api/structure-view-api.iml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/platform/lang-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java b/platform/structure-view-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java
similarity index 97%
rename from platform/lang-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java
rename to platform/structure-view-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java
index 9601bfb5dc26..e07d30e77c6e 100644
--- a/platform/lang-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/highlighter/LanguageFileTypeStructureViewBuilderProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewExtension.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewExtension.java
similarity index 96%
rename from platform/lang-impl/src/com/intellij/ide/structureView/StructureViewExtension.java
rename to platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewExtension.java
index f92690bacb90..ee94c38030b8 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewExtension.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewExtension.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java
similarity index 85%
rename from platform/lang-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java
rename to platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java
index dd371e72ed63..d1cf194d0ddb 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewFactoryEx.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,6 +18,7 @@ package com.intellij.ide.structureView;
import com.intellij.openapi.project.Project;
import com.intellij.psi.PsiElement;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.Collection;
@@ -30,7 +31,8 @@ public abstract class StructureViewFactoryEx extends StructureViewFactory {
@Nullable
public abstract StructureViewWrapper getStructureViewWrapper();
- public abstract Collection getAllExtensions(Class extends PsiElement> type);
+ @NotNull
+ public abstract Collection getAllExtensions(@NotNull Class extends PsiElement> type);
public abstract void setActiveAction(final String name, final boolean state);
@@ -40,5 +42,5 @@ public abstract class StructureViewFactoryEx extends StructureViewFactory {
return (StructureViewFactoryEx)getInstance(project);
}
- public abstract void runWhenInitialized(Runnable runnable);
-}
\ No newline at end of file
+ public abstract void runWhenInitialized(@NotNull Runnable runnable);
+}
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java
similarity index 95%
rename from platform/lang-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java
rename to platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java
index 17edcf03b9e1..df3f820f708c 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/StructureViewWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java
similarity index 98%
rename from platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java
rename to platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java
index 5d5f42974461..7251d0917ad4 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewComposite.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java
similarity index 98%
rename from platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java
rename to platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java
index 55f09ca297d8..63f77962fced 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewElementWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -51,6 +51,7 @@ public class StructureViewElementWrapper implements Struct
return (V)myTreeElement.getValue();
}
+ @NotNull
@Override
public StructureViewTreeElement[] getChildren() {
TreeElement[] baseChildren = myTreeElement.getChildren();
@@ -63,6 +64,7 @@ public class StructureViewElementWrapper implements Struct
return result.toArray(new StructureViewTreeElement[result.size()]);
}
+ @NotNull
@Override
public ItemPresentation getPresentation() {
return myTreeElement.getPresentation();
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java
similarity index 87%
rename from platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java
rename to platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java
index e7301cd5be8b..dbc91a77dec6 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewModelWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -45,22 +45,22 @@ public class StructureViewModelWrapper implements StructureViewModel {
}
@Override
- public void addEditorPositionListener(final FileEditorPositionListener listener) {
+ public void addEditorPositionListener(@NotNull final FileEditorPositionListener listener) {
myStructureViewModel.addEditorPositionListener(listener);
}
@Override
- public void removeEditorPositionListener(final FileEditorPositionListener listener) {
+ public void removeEditorPositionListener(@NotNull final FileEditorPositionListener listener) {
myStructureViewModel.removeEditorPositionListener(listener);
}
@Override
- public void addModelListener(final ModelListener modelListener) {
+ public void addModelListener(@NotNull final ModelListener modelListener) {
myStructureViewModel.addModelListener(modelListener);
}
@Override
- public void removeModelListener(final ModelListener modelListener) {
+ public void removeModelListener(@NotNull final ModelListener modelListener) {
myStructureViewModel.removeModelListener(modelListener);
}
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java
similarity index 96%
rename from platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java
rename to platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java
index 2e2f7252b81a..403487d4a8e1 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/StructureViewState.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/lang-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java
similarity index 98%
rename from platform/lang-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java
rename to platform/structure-view-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java
index 513e31f6be73..9d851c00f31e 100644
--- a/platform/lang-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/structureView/impl/common/PsiTreeElementBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -40,6 +40,7 @@ public abstract class PsiTreeElementBase implements Struc
myValue = psiElement;
}
+ @NotNull
@Override
public ItemPresentation getPresentation() {
return this;
@@ -94,6 +95,7 @@ public abstract class PsiTreeElementBase implements Struc
return element != null ? element.toString() : "";
}
+ @NotNull
@Override
public final StructureViewTreeElement[] getChildren() {
final T element = getElement();
diff --git a/platform/lang-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.java b/platform/structure-view-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.java
similarity index 81%
rename from platform/lang-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.java
rename to platform/structure-view-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.java
index 1ffb48293675..c74d7e06887e 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/util/InheritedMembersNodeProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -21,26 +21,33 @@ import com.intellij.ide.util.treeView.smartTree.ActionPresentation;
import com.intellij.ide.util.treeView.smartTree.ActionPresentationData;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.openapi.actionSystem.Shortcut;
-import com.intellij.openapi.keymap.KeymapManager;
+import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
/**
* @author Konstantin Bulenkov
*/
-public abstract class InheritedMembersNodeProvider implements FileStructureNodeProvider {
+public abstract class InheritedMembersNodeProvider implements FileStructureNodeProvider, ActionShortcutProvider {
@NonNls public static final String ID = "SHOW_INHERITED";
+ @NotNull
@Override
public String getCheckBoxText() {
return IdeBundle.message("file.structure.toggle.show.inherited");
}
+ @NotNull
@Override
public Shortcut[] getShortcut() {
- return KeymapManager.getInstance().getActiveKeymap().getShortcuts("FileStructurePopup");
+ throw new IncorrectOperationException("see getActionIdForShortcut()");
}
+ @NotNull
+ @Override
+ public String getActionIdForShortcut() {
+ return "FileStructurePopup";
+ }
@Override
@NotNull
diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java
similarity index 95%
rename from platform/lang-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java
rename to platform/structure-view-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java
index 6ba301ad9b67..0a516ae16501 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/AbstractTreeStructureBase.java
@@ -16,7 +16,7 @@
package com.intellij.ide.util.treeView;
-import com.intellij.ide.projectView.ProjectViewNode;
+import com.intellij.ide.projectView.SettingsProvider;
import com.intellij.ide.projectView.TreeStructureProvider;
import com.intellij.ide.projectView.ViewSettings;
import com.intellij.openapi.diagnostic.Logger;
@@ -47,7 +47,7 @@ public abstract class AbstractTreeStructureBase extends AbstractTreeStructure {
Collection extends AbstractTreeNode> elements = treeNode.getChildren();
List providers = getProvidersDumbAware();
if (!providers.isEmpty()) {
- ViewSettings settings = treeNode instanceof ProjectViewNode ? ((ProjectViewNode) treeNode).getSettings() : ViewSettings.DEFAULT;
+ ViewSettings settings = treeNode instanceof SettingsProvider ? ((SettingsProvider)treeNode).getSettings() : ViewSettings.DEFAULT;
for (TreeStructureProvider provider : providers) {
try {
elements = provider.modify(treeNode, (Collection)elements, settings);
diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java
similarity index 88%
rename from platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java
rename to platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java
index a81d18f13792..f08fb99cf4bf 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/CachingChildrenTreeNode.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,6 +18,7 @@ package com.intellij.ide.util.treeView.smartTree;
import com.intellij.ide.structureView.impl.StructureViewElementWrapper;
import com.intellij.ide.util.treeView.AbstractTreeNode;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
import com.intellij.pom.Navigatable;
import gnu.trove.THashMap;
@@ -26,6 +27,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.*;
public abstract class CachingChildrenTreeNode extends AbstractTreeNode {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.CachingChildrenTreeNode");
private List myChildren;
private List myOldChildren = null;
protected final TreeModel myTreeModel;
@@ -95,12 +97,13 @@ public abstract class CachingChildrenTreeNode extends AbstractTreeNode children = getChildren();
for (Filter filter : filters) {
for (Iterator eachNode = children.iterator(); eachNode.hasNext();) {
TreeElementWrapper eachChild = (TreeElementWrapper)eachNode.next();
- if (!filter.isVisible(eachChild.getValue())) {
+ TreeElement value = eachChild.getValue();
+ if (value == null || !filter.isVisible(value)) {
eachNode.remove();
}
}
@@ -108,7 +111,7 @@ public abstract class CachingChildrenTreeNode extends AbstractTreeNode extends AbstractTreeNode> ungrouped, Grouper grouper) {
+ private void processUngrouped(@NotNull List> ungrouped, @NotNull Grouper grouper) {
Map ungroupedObjects = collectValues(ungrouped);
Collection groups = grouper.group(this, ungroupedObjects.keySet());
Map groupNodes = createGroupNodes(groups);
for (Group group : groups) {
+ if (group == null) {
+ LOG.error(grouper + " returned null group: "+groups);
+ }
GroupWrapper groupWrapper = groupNodes.get(group);
Collection children = group.getChildren();
for (TreeElement node : children) {
+ if (node == null) {
+ LOG.error(group + " returned null child: " + children);
+ }
CachingChildrenTreeNode child = createChildNode(node);
groupWrapper.addSubElement(child);
AbstractTreeNode abstractTreeNode = ungroupedObjects.get(node);
@@ -165,7 +174,7 @@ public abstract class CachingChildrenTreeNode extends AbstractTreeNode extends AbstractTreeNode createGroupNodes(Collection groups) {
+ private Map createGroupNodes(@NotNull Collection groups) {
Map result = new THashMap();
for (Group group : groups) {
result.put(group, createGroupWrapper(getProject(), group, myTreeModel));
@@ -185,7 +194,7 @@ public abstract class CachingChildrenTreeNode extends AbstractTreeNode extends AbstractTreeNode {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.GroupWrapper");
public GroupWrapper(Project project, Group value, TreeModel treeModel) {
super(project, value, treeModel);
clearChildren();
}
@Override
- public void copyFromNewInstance(final CachingChildrenTreeNode newInstance) {
+ public void copyFromNewInstance(@NotNull final CachingChildrenTreeNode newInstance) {
clearChildren();
setChildren(newInstance.getChildren());
synchronizeChildren();
@@ -43,8 +45,12 @@ public class GroupWrapper extends CachingChildrenTreeNode {
@Override
public void initChildren() {
clearChildren();
- Collection children = getValue().getChildren();
+ Group group = getValue();
+ Collection children = group.getChildren();
for (TreeElement child : children) {
+ if (child == null) {
+ LOG.error(group + " returned null child: " + children);
+ }
TreeElementWrapper childNode = createChildNode(child);
addSubElement(childNode);
}
diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java
similarity index 98%
rename from platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java
rename to platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java
index e2a10b4d421b..478c160b8c14 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/SmartTreeStructure.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java
similarity index 74%
rename from platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java
rename to platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java
index a0dafb0ed58f..ac1660aea6a0 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeElementWrapper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,17 +18,21 @@ package com.intellij.ide.util.treeView.smartTree;
import com.intellij.ide.projectView.PresentationData;
import com.intellij.ide.structureView.StructureViewTreeElement;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
+import java.util.Arrays;
import java.util.Collection;
public class TreeElementWrapper extends CachingChildrenTreeNode {
+ private static final Logger LOG = Logger.getInstance("#com.intellij.ide.util.treeView.smartTree.TreeElementWrapper");
public TreeElementWrapper(Project project, TreeElement value, TreeModel treeModel) {
super(project, value, treeModel);
}
@Override
- public void copyFromNewInstance(final CachingChildrenTreeNode oldInstance) {
+ public void copyFromNewInstance(@NotNull final CachingChildrenTreeNode oldInstance) {
}
@Override
@@ -41,16 +45,23 @@ public class TreeElementWrapper extends CachingChildrenTreeNode {
@Override
public void initChildren() {
clearChildren();
- TreeElement[] children = getValue().getChildren();
+ TreeElement value = getValue();
+ TreeElement[] children = value.getChildren();
for (TreeElement child : children) {
+ if (child == null) {
+ LOG.error(value + " returned null child: " + Arrays.toString(children));
+ }
addSubElement(createChildNode(child));
}
if (myTreeModel instanceof ProvidingTreeModel) {
final Collection providers = ((ProvidingTreeModel)myTreeModel).getNodeProviders();
for (NodeProvider provider : providers) {
if (((ProvidingTreeModel)myTreeModel).isEnabled(provider)) {
- final Collection nodes = provider.provideNodes(getValue());
+ final Collection nodes = provider.provideNodes(value);
for (TreeElement node : nodes) {
+ if (node == null) {
+ LOG.error(provider + " returned null node: " + nodes);
+ }
addSubElement(createChildNode(node));
}
}
diff --git a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java
similarity index 71%
rename from platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java
rename to platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java
index a08f3180b109..ce62a748559e 100644
--- a/platform/lang-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java
+++ b/platform/structure-view-impl/src/com/intellij/ide/util/treeView/smartTree/TreeStructureUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,6 +17,9 @@
package com.intellij.ide.util.treeView.smartTree;
import com.intellij.ide.util.treeView.AbstractTreeStructure;
+import com.intellij.ui.PlaceHolder;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
import java.util.HashSet;
@@ -24,6 +27,8 @@ import java.util.HashSet;
* @author Maxim.Mossienko
*/
public class TreeStructureUtil {
+ public static final String PLACE = "StructureViewPopup";
+
private TreeStructureUtil() {}
public static Object[] getChildElementsFromTreeStructure(AbstractTreeStructure treeStructure, Object element) {
@@ -37,4 +42,13 @@ public class TreeStructureUtil {
return items;
}
+
+ public static boolean isInStructureViewPopup(@NotNull PlaceHolder model) {
+ return PLACE.equals(model.getPlace());
+ }
+
+ @NonNls
+ public static String getPropertyName(String propertyName) {
+ return propertyName + ".file.structure.state";
+ }
}
diff --git a/platform/structure-view-impl/structure-view-impl.iml b/platform/structure-view-impl/structure-view-impl.iml
new file mode 100644
index 000000000000..35a80b95dec3
--- /dev/null
+++ b/platform/structure-view-impl/structure-view-impl.iml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/platform/testFramework/src/com/intellij/mock/Mock.java b/platform/testFramework/src/com/intellij/mock/Mock.java
index 87e13adf2473..d511f2fd2d35 100644
--- a/platform/testFramework/src/com/intellij/mock/Mock.java
+++ b/platform/testFramework/src/com/intellij/mock/Mock.java
@@ -1,3 +1,18 @@
+/*
+ * Copyright 2000-2014 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.mock;
import com.intellij.codeHighlighting.BackgroundEditorHighlighter;
@@ -135,6 +150,7 @@ public class Mock {
return new ActionCallback.Done();
}
+ @NotNull
@Override
public ActionCallback getReady(@NotNull Object requestor) {
return new ActionCallback.Done();
diff --git a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java
index 3c6911e18dca..070dab81e348 100644
--- a/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java
+++ b/platform/testFramework/src/com/intellij/testFramework/LightPlatformCodeInsightTestCase.java
@@ -350,9 +350,9 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
* @param ignoreTrailingSpaces - whether trailing spaces in editor in data file should be stripped prior to comparing.
*/
protected void checkResultByText(final String message, @NotNull String fileText, final boolean ignoreTrailingSpaces) {
- checkResultByText(message, fileText, ignoreTrailingSpaces, null);
+ checkResultByText(message, fileText, ignoreTrailingSpaces, null);
}
-
+
/**
* Same as checkResultByFile but text is provided directly.
* @param message - this check specific message. Added to text, caret position, selection checking. May be null
@@ -547,7 +547,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
protected static void paste() {
executeAction(IdeActions.ACTION_EDITOR_PASTE);
}
-
+
protected static void moveCaretToPreviousWordWithSelection() {
executeAction("EditorPreviousWordWithSelection");
}
@@ -559,7 +559,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
protected static void cutLineBackward() {
executeAction("EditorCutLineBackward");
}
-
+
protected static void cutToLineEnd() {
executeAction("EditorCutLineEnd");
}
@@ -567,7 +567,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
protected static void killToWordStart() {
executeAction("EditorKillToWordStart");
}
-
+
protected static void killToWordEnd() {
executeAction("EditorKillToWordEnd");
}
@@ -591,7 +591,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
protected static void lineComment() {
new CommentByLineCommentHandler().invoke(getProject(), getEditor(), getFile());
}
-
+
protected static void executeAction(@NonNls @NotNull final String actionId) {
CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() {
@Override
@@ -636,14 +636,14 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
*/
/**
- * @Parameterized.Parameter fields are injected on parameterized test creation.
+ * @Parameterized.Parameter fields are injected on parameterized test creation.
*/
@Parameterized.Parameter(0)
public String myFileSuffix;
/**
- * path to the root of test data in case of com.intellij.testFramework.FileBasedTestCaseHelperEx
- * or
+ * path to the root of test data in case of com.intellij.testFramework.FileBasedTestCaseHelperEx
+ * or
* path to the directory with current test data in case of @TestDataPath
*/
@Parameterized.Parameter(1)
@@ -697,7 +697,7 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
}
return result;
}
-
+
@Override
public String getName() {
if (myFileSuffix != null) {
@@ -747,4 +747,27 @@ public abstract class LightPlatformCodeInsightTestCase extends LightPlatformTest
}
}
+ protected void runSingleTest(final Runnable testRunnable) throws Throwable {
+ final Throwable[] throwables = new Throwable[1];
+
+ Runnable runnable = new Runnable() {
+ @Override
+ public void run() {
+ try {
+ testRunnable.run();
+ }
+ catch (Throwable e) {
+ throwables[0] = e;
+ }
+ }
+ };
+
+ invokeTestRunnable(runnable);
+
+ if (throwables[0] != null) {
+ throw throwables[0];
+ }
+
+ }
+
}
diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java
index a4f6e9dd5779..d6edbbb655bc 100644
--- a/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java
+++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewTreeCellRenderer.java
@@ -238,14 +238,14 @@ class UsageViewTreeCellRenderer extends ColoredTreeCellRenderer {
public RowLocation isRowVisible(int row, @NotNull Rectangle visibleRect) {
Dimension pref;
if (cachedPreferredSize == null) {
- pref = cachedPreferredSize = getPreferredSize();
+ cachedPreferredSize = pref = getPreferredSize();
}
else {
pref = cachedPreferredSize;
}
pref.width = Math.max(visibleRect.width, pref.width);
myRowBoundsCalled = true;
- final JTree tree = getTree();
+ JTree tree = getTree();
final Rectangle bounds = tree == null ? null : tree.getRowBounds(row);
myRowBoundsCalled = false;
int y = bounds == null ? 0 : bounds.y;
diff --git a/platform/util-rt/src/com/intellij/openapi/util/Comparing.java b/platform/util-rt/src/com/intellij/openapi/util/Comparing.java
index 7efc489dfc11..6813404f0539 100644
--- a/platform/util-rt/src/com/intellij/openapi/util/Comparing.java
+++ b/platform/util-rt/src/com/intellij/openapi/util/Comparing.java
@@ -90,7 +90,7 @@ public class Comparing {
}
}
- public static boolean strEqual(String arg1, String arg2){
+ public static boolean strEqual(@Nullable String arg1, @Nullable String arg2){
return strEqual(arg1, arg2, true);
}
diff --git a/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java b/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java
index 41feba6d1584..4db826f55837 100644
--- a/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java
+++ b/platform/util/src/com/intellij/openapi/util/MultiValuesMap.java
@@ -15,6 +15,7 @@
*/
package com.intellij.openapi.util;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.*;
@@ -32,35 +33,38 @@ public class MultiValuesMap{
myBaseMap = ordered ? new LinkedHashMap>() : new HashMap>();
}
- public void putAll(K key, Collection values) {
+ public void putAll(K key, @NotNull Collection values) {
for (V value : values) {
put(key, value);
}
}
- public void putAll(K key, V... values) {
+ public void putAll(K key, @NotNull V... values) {
for (V value : values) {
put(key, value);
}
}
public void put(K key, V value) {
- if (!myBaseMap.containsKey(key)) {
- myBaseMap.put(key, myOrdered ? new LinkedHashSet() : new HashSet());
+ Collection collection = myBaseMap.get(key);
+ if (collection == null) {
+ collection = myOrdered ? new LinkedHashSet() : new HashSet();
+ myBaseMap.put(key, collection);
}
- myBaseMap.get(key).add(value);
+ collection.add(value);
}
- @Nullable
public Collection get(K key){
return myBaseMap.get(key);
}
+ @NotNull
public Set keySet() {
return myBaseMap.keySet();
}
+ @NotNull
public Collection values() {
Set result = myOrdered ? new LinkedHashSet() : new HashSet();
for (final Collection values : myBaseMap.values()) {
@@ -88,6 +92,7 @@ public class MultiValuesMap{
return myBaseMap.remove(key);
}
+ @NotNull
public Set>> entrySet() {
return myBaseMap.entrySet();
}
@@ -100,6 +105,7 @@ public class MultiValuesMap{
return myBaseMap.containsKey(key);
}
+ @NotNull
public Collection collectValues() {
Collection result = new HashSet();
for (Collection v : myBaseMap.values()) {
diff --git a/platform/util/src/com/intellij/util/ReflectionUtil.java b/platform/util/src/com/intellij/util/ReflectionUtil.java
index 897c3c392770..df768fdfa56d 100644
--- a/platform/util/src/com/intellij/util/ReflectionUtil.java
+++ b/platform/util/src/com/intellij/util/ReflectionUtil.java
@@ -367,7 +367,7 @@ public class ReflectionUtil {
}
}
- public static boolean isAssignable(@NotNull Class> ancestor, Class> descendant) {
+ public static boolean isAssignable(@NotNull Class> ancestor, @NotNull Class> descendant) {
return ancestor == descendant || ancestor.isAssignableFrom(descendant);
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
index bb07eea52682..ea407a2cfcd4 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
@@ -45,6 +45,7 @@ import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.fileEditor.OpenFileDescriptor;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
+import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.wm.ToolWindowId;
import com.intellij.ui.AppUIUtil;
@@ -601,14 +602,15 @@ public class XDebugSessionImpl implements XDebugSession {
CustomizedBreakpointPresentation presentation;
synchronized (myRegisteredBreakpoints) {
presentation = myRegisteredBreakpoints.get(breakpoint);
- if (presentation != null) {
- presentation.setErrorMessage(errorMessage);
- presentation.setIcon(icon);
+ if (presentation == null ||
+ (Comparing.equal(presentation.getIcon(), icon) && Comparing.strEqual(presentation.getErrorMessage(), errorMessage))) {
+ return;
}
+
+ presentation.setErrorMessage(errorMessage);
+ presentation.setIcon(icon);
}
- if (presentation != null) {
- myDebuggerManager.getBreakpointManager().getLineBreakpointManager().queueBreakpointUpdate((XLineBreakpointImpl>)breakpoint);
- }
+ myDebuggerManager.getBreakpointManager().getLineBreakpointManager().queueBreakpointUpdate((XLineBreakpointImpl>)breakpoint);
}
@Override
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java
index 579798caec5d..e5e511bc1f13 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java
@@ -85,7 +85,7 @@ public class XSourcePositionImpl implements XSourcePosition {
offset = -1;
}
else {
- Document document = FileDocumentManager.getInstance().getDocument(file);
+ Document document = file.isValid() ? FileDocumentManager.getInstance().getDocument(file) : null;
if (document == null) {
return null;
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
index 138052e88714..98bb91ed5219 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/breakpoints/XLineBreakpointManager.java
@@ -38,7 +38,10 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.startup.StartupManager;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.io.FileUtil;
-import com.intellij.openapi.vfs.*;
+import com.intellij.openapi.vfs.VirtualFile;
+import com.intellij.openapi.vfs.VirtualFileEvent;
+import com.intellij.openapi.vfs.VirtualFileManager;
+import com.intellij.openapi.vfs.VirtualFileUrlChangeAdapter;
import com.intellij.psi.PsiDocumentManager;
import com.intellij.util.containers.BidirectionalMap;
import com.intellij.util.ui.update.MergingUpdateQueue;
@@ -80,6 +83,7 @@ public class XLineBreakpointManager {
final MyDependentBreakpointListener myDependentBreakpointListener = new MyDependentBreakpointListener();
myDependentBreakpointManager.addListener(myDependentBreakpointListener);
Disposer.register(project, new Disposable() {
+ @Override
public void dispose() {
myDependentBreakpointManager.removeListener(myDependentBreakpointListener);
}
@@ -127,6 +131,7 @@ public class XLineBreakpointManager {
if (myProject.isDefault()) return;
Runnable runnable = new DumbAwareRunnable() {
+ @Override
public void run() {
for (XLineBreakpointImpl breakpoint : myBreakpoints.keySet()) {
breakpoint.updateUI();
@@ -177,7 +182,8 @@ public class XLineBreakpointManager {
private void removeBreakpoints(final List extends XBreakpoint>> toRemove) {
new WriteAction() {
- protected void run(final Result result) {
+ @Override
+ protected void run(@NotNull final Result result) {
for (XBreakpoint> breakpoint : toRemove) {
XDebuggerManager.getInstance(myProject).getBreakpointManager().removeBreakpoint(breakpoint);
}
@@ -201,6 +207,7 @@ public class XLineBreakpointManager {
public void queueBreakpointUpdate(@NotNull final XLineBreakpointImpl> breakpoint) {
myBreakpointsUpdateQueue.queue(new Update(breakpoint) {
+ @Override
public void run() {
breakpoint.updateUI();
}
@@ -209,6 +216,7 @@ public class XLineBreakpointManager {
public void queueAllBreakpointsUpdate() {
myBreakpointsUpdateQueue.queue(new Update("all breakpoints") {
+ @Override
public void run() {
for (XLineBreakpointImpl breakpoint : myBreakpoints.keySet()) {
breakpoint.updateUI();
@@ -218,11 +226,13 @@ public class XLineBreakpointManager {
}
private class MyDocumentListener extends DocumentAdapter {
+ @Override
public void documentChanged(final DocumentEvent e) {
final Document document = e.getDocument();
Collection breakpoints = myBreakpoints.getKeysByValue(document);
if (breakpoints != null && !breakpoints.isEmpty()) {
myBreakpointsUpdateQueue.queue(new Update(document) {
+ @Override
public void run() {
updateBreakpoints(document);
}
@@ -232,6 +242,7 @@ public class XLineBreakpointManager {
}
private class MyEditorMouseListener extends EditorMouseAdapter {
+ @Override
public void mouseClicked(final EditorMouseEvent e) {
final Editor editor = e.getEditor();
final MouseEvent mouseEvent = e.getMouseEvent();
@@ -245,12 +256,14 @@ public class XLineBreakpointManager {
}
PsiDocumentManager.getInstance(myProject).commitAndRunReadAction(new Runnable() {
+ @Override
public void run() {
final int line = editor.xyToLogicalPosition(mouseEvent.getPoint()).line;
final Document document = editor.getDocument();
final VirtualFile file = FileDocumentManager.getInstance().getFile(document);
if (line >= 0 && line < document.getLineCount() && file != null) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
+ @Override
public void run() {
if (!myProject.isDisposed() && myProject.isInitialized() && file.isValid()) {
@@ -274,10 +287,12 @@ public class XLineBreakpointManager {
}
private class MyDependentBreakpointListener implements XDependentBreakpointListener {
+ @Override
public void dependencySet(final XBreakpoint> slave, final XBreakpoint> master) {
queueBreakpointUpdate(slave);
}
+ @Override
public void dependencyCleared(final XBreakpoint> breakpoint) {
queueBreakpointUpdate(breakpoint);
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
index d34ebcd9ad43..47485e568a14 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/ExecutionPointHighlighter.java
@@ -102,7 +102,7 @@ public class ExecutionPointHighlighter {
mySourcePosition = position;
myOpenFileDescriptor = XSourcePositionImpl.createOpenFileDescriptor(myProject, mySourcePosition);
- myEditor = FileEditorManager.getInstance(myProject).openTextEditor(myOpenFileDescriptor, false);
+ myEditor = myOpenFileDescriptor.getFile().isValid() ? FileEditorManager.getInstance(myProject).openTextEditor(myOpenFileDescriptor, false) : null;
myUseSelection = useSelection;
myGutterIconRenderer = renderer;
if (myEditor != null) {
diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/BooleanConstructorInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/BooleanConstructorInspection.java
index 1a560a01b1db..882496df4484 100644
--- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/BooleanConstructorInspection.java
+++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/performance/BooleanConstructorInspection.java
@@ -20,7 +20,6 @@ import com.intellij.openapi.project.Project;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiUtil;
-import com.intellij.util.IncorrectOperationException;
import com.siyeh.InspectionGadgetsBundle;
import com.siyeh.ig.BaseInspection;
import com.siyeh.ig.BaseInspectionVisitor;
@@ -84,8 +83,12 @@ public class BooleanConstructorInspection extends BaseInspection {
}
@Override
- public void doFix(Project project, ProblemDescriptor descriptor) throws IncorrectOperationException {
- final PsiNewExpression expression = (PsiNewExpression)descriptor.getPsiElement();
+ public void doFix(Project project, ProblemDescriptor descriptor) {
+ final PsiElement element = descriptor.getPsiElement().getParent();
+ if (!(element instanceof PsiNewExpression)) {
+ return;
+ }
+ final PsiNewExpression expression = (PsiNewExpression)element;
final PsiExpressionList argumentList = expression.getArgumentList();
if (argumentList == null) {
return;
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java
index f8013fd5acfa..b56c340f5400 100644
--- a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/IGQuickFixesTestCase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,10 +16,14 @@
package com.siyeh.ig;
import com.intellij.codeInsight.intention.IntentionAction;
+import com.intellij.ide.highlighter.JavaFileType;
import com.intellij.openapi.application.PluginPathManager;
import com.intellij.pom.java.LanguageLevel;
import com.intellij.testFramework.builders.JavaModuleFixtureBuilder;
import com.intellij.testFramework.fixtures.JavaCodeInsightFixtureTestCase;
+import org.intellij.lang.annotations.Language;
+import org.jetbrains.annotations.NonNls;
+import org.jetbrains.annotations.NotNull;
/**
* @author anna
@@ -30,6 +34,20 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas
protected String myDefaultHint = null;
protected String myRelativePath = null;
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+
+ final BaseInspection inspection = getInspection();
+ if (inspection != null) {
+ myFixture.enableInspections(inspection);
+ }
+ }
+
+ protected BaseInspection getInspection() {
+ return null;
+ }
+
@Override
protected void tuneFixture(final JavaModuleFixtureBuilder builder) throws Exception {
builder.setLanguageLevel(LanguageLevel.JDK_1_7);
@@ -59,6 +77,29 @@ public abstract class IGQuickFixesTestCase extends JavaCodeInsightFixtureTestCas
myFixture.checkResultByFile(getRelativePath() + "/" + testName + ".after.java");
}
+ protected void doExpressionTest(
+ String hint,
+ @Language(value = "JAVA", prefix = "class X {{System.out.print(", suffix = ");}}") @NotNull @NonNls String before,
+ @Language(value = "JAVA", prefix = "class X {{System.out.print(", suffix = ");}}") @NotNull @NonNls String after) {
+ doTest(hint, "class X {{System.out.print(" + before + ");}}", "class X {{System.out.print(" + after + ");}}");
+ }
+
+ protected void doMemberTest(
+ String hint,
+ @Language(value = "JAVA", prefix = "class X {", suffix = "}") @NotNull @NonNls String before,
+ @Language(value = "JAVA", prefix = "class X {", suffix = "}") @NotNull @NonNls String after) {
+ doTest(hint, "class X {" + before + "}", "class X {" + after + "}");
+ }
+
+ protected void doTest(String hint, @Language("JAVA") @NotNull @NonNls String before, @Language("JAVA") @NotNull @NonNls String after) {
+ before = before.replace("/**/", "");
+ myFixture.configureByText(JavaFileType.INSTANCE, before);
+ final IntentionAction intention = myFixture.findSingleIntention(hint);
+ assertNotNull(intention);
+ myFixture.launchAction(intention);
+ myFixture.checkResult(after);
+ }
+
protected String getRelativePath() {
assertNotNull(myRelativePath);
return myRelativePath;
diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/BooleanConstructorFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/BooleanConstructorFixTest.java
new file mode 100644
index 000000000000..feb1ad046183
--- /dev/null
+++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/performance/BooleanConstructorFixTest.java
@@ -0,0 +1,43 @@
+/*
+ * Copyright 2000-2014 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.siyeh.ig.fixes.performance;
+
+import com.siyeh.InspectionGadgetsBundle;
+import com.siyeh.ig.BaseInspection;
+import com.siyeh.ig.IGQuickFixesTestCase;
+import com.siyeh.ig.performance.BooleanConstructorInspection;
+
+/**
+ * @author Bas Leijdekkers
+ */
+public class BooleanConstructorFixTest extends IGQuickFixesTestCase {
+
+ @Override
+ protected BaseInspection getInspection() {
+ return new BooleanConstructorInspection();
+ }
+
+ public void testSimple() {
+ doExpressionTest(InspectionGadgetsBundle.message("boolean.constructor.simplify.quickfix"),
+ "new Boolean/**/(true)", "Boolean.TRUE");
+ }
+
+ public void testSimple2() {
+ doMemberTest(InspectionGadgetsBundle.message("boolean.constructor.simplify.quickfix"),
+ "void m(boolean b) { Boolean c = new /**/Boolean(b); }",
+ "void m(boolean b) { Boolean c = Boolean.valueOf(b); }");
+ }
+}
diff --git a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/lambda2anonymous/CyclicInference_after.java b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/lambda2anonymous/CyclicInference_after.java
index dfa25f3d143b..f99f071cb472 100644
--- a/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/lambda2anonymous/CyclicInference_after.java
+++ b/plugins/IntentionPowerPak/test/com/siyeh/ipp/types/lambda2anonymous/CyclicInference_after.java
@@ -8,9 +8,9 @@ class Test2 {
static I bar(I i){return i;}
{
- bar(new I() {
+ bar(new I() {
@Override
- public Object foo(Y x) {
+ public Object foo(Y x) {
return x;
}
});
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubOpenInBrowserAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubOpenInBrowserAction.java
index f587d44c8cb6..cec5ba269721 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubOpenInBrowserAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubOpenInBrowserAction.java
@@ -22,6 +22,7 @@ import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.editor.SelectionModel;
import com.intellij.openapi.project.DumbAwareAction;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeListManager;
import com.intellij.openapi.vfs.VirtualFile;
@@ -156,7 +157,12 @@ public class GithubOpenInBrowserAction extends DumbAwareAction {
if (githubRepoUrl == null) {
return null;
}
- builder.append(githubRepoUrl).append("/blob/").append(branch).append(relativePath);
+ if (StringUtil.isEmptyOrSpaces(relativePath)) {
+ builder.append(githubRepoUrl).append("/tree/").append(branch);
+ }
+ else {
+ builder.append(githubRepoUrl).append("/blob/").append(branch).append(relativePath);
+ }
if (editor != null && editor.getDocument().getLineCount() >= 1) {
// lines are counted internally from 0, but from 1 on github
diff --git a/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java b/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java
index aad06e1f24f7..2036b3546030 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/api/GithubApiUtil.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2012 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,6 +16,7 @@
package org.jetbrains.plugins.github.api;
import com.google.gson.*;
+import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.net.HttpConfigurable;
@@ -93,8 +94,8 @@ public class GithubApiUtil {
@Nullable String requestBody,
@NotNull Collection headers,
@NotNull HttpVerb verb) throws IOException {
- LOG.assertTrue(!EventQueue.isDispatchThread(), "Network operation in EDT");
- EventQueue.isDispatchThread();
+ LOG.assertTrue(!EventQueue.isDispatchThread() || ApplicationManager.getApplication().isUnitTestMode(), "Network operation in EDT");
+
HttpMethod method = null;
try {
String uri = GithubUrlUtil.getApiUrl(auth.getHost()) + path;
diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleAction.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleAction.java
index 9f725754c5bc..308f932ddd18 100644
--- a/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleAction.java
+++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/console/GroovyConsoleAction.java
@@ -16,11 +16,11 @@
package org.jetbrains.plugins.groovy.console;
import com.intellij.execution.console.LanguageConsoleImpl;
+import com.intellij.openapi.editor.Document;
import com.intellij.openapi.module.Module;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.psi.PsiFile;
-import com.intellij.util.PairFunction;
+import com.intellij.testFramework.LightVirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.plugins.groovy.GroovyFileType;
import org.jetbrains.plugins.groovy.debugger.fragments.GroovyCodeFragment;
@@ -40,13 +40,13 @@ public class GroovyConsoleAction extends GroovyShellActionBase {
}
@Override
- protected LanguageConsoleImpl createConsole(@NotNull Project project, String title) {
- return new LanguageConsoleImpl(project, title, GroovyFileType.GROOVY_LANGUAGE, new PairFunction() {
+ protected LanguageConsoleImpl createConsole(Project project, String title) {
+ return new LanguageConsoleImpl(project, title, GroovyFileType.GROOVY_LANGUAGE) {
@NotNull
@Override
- public PsiFile fun(@NotNull VirtualFile file, @NotNull Project project) {
- return new GroovyCodeFragment(project, file);
+ protected PsiFile createFile(@NotNull LightVirtualFile virtualFile, @NotNull Document document, @NotNull Project project) {
+ return new GroovyCodeFragment(getProject(), virtualFile);
}
- });
+ };
}
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java
index cc38c8d74500..7547e9772c0b 100644
--- a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -34,7 +34,7 @@ public class PropertiesGroupingStructureViewComponent extends StructureViewCompo
protected PropertiesGroupingStructureViewComponent(Project project,
FileEditor editor,
PropertiesGroupingStructureViewModel structureViewModel) {
- super(editor, structureViewModel, project);
+ super(editor, structureViewModel, project, true);
showToolbar();
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
index b180a42b53da..2a1f94af4c95 100644
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleFileStructureViewElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -26,6 +26,7 @@ import com.intellij.lang.properties.ResourceBundle;
import com.intellij.lang.properties.psi.PropertiesFile;
import com.intellij.navigation.ItemPresentation;
import com.intellij.openapi.project.Project;
+import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.util.ArrayList;
@@ -46,6 +47,7 @@ public class ResourceBundleFileStructureViewElement implements StructureViewTree
return myResourceBundle;
}
+ @NotNull
public StructureViewTreeElement[] getChildren() {
List propertiesFiles = myResourceBundle.getPropertiesFiles(myProject);
Map propertyNames = new LinkedHashMap();
@@ -66,6 +68,7 @@ public class ResourceBundleFileStructureViewElement implements StructureViewTree
return result.toArray(new StructureViewTreeElement[result.size()]);
}
+ @NotNull
public ItemPresentation getPresentation() {
return new ItemPresentation() {
public String getPresentableText() {
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
index b1eb6126bca0..e521047cb9ba 100644
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundlePropertyStructureViewElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -30,6 +30,7 @@ import com.intellij.openapi.editor.colors.TextAttributesKey;
import com.intellij.openapi.editor.markup.TextAttributes;
import com.intellij.openapi.project.Project;
import com.intellij.util.PlatformIcons;
+import org.jetbrains.annotations.NotNull;
import javax.swing.*;
import java.awt.*;
@@ -58,24 +59,32 @@ public class ResourceBundlePropertyStructureViewElement implements StructureView
myPresentableName = presentableName;
}
+ @Override
public String getValue() {
return myPropertyName;
}
+ @Override
+ @NotNull
public StructureViewTreeElement[] getChildren() {
return EMPTY_ARRAY;
}
+ @Override
+ @NotNull
public ItemPresentation getPresentation() {
return new ColoredItemPresentation() {
+ @Override
public String getPresentableText() {
return myPresentableName == null ? myPropertyName : myPresentableName;
}
+ @Override
public String getLocationString() {
return null;
}
+ @Override
public Icon getIcon(boolean open) {
return PlatformIcons.PROPERTY_ICON;
}
@@ -92,14 +101,17 @@ public class ResourceBundlePropertyStructureViewElement implements StructureView
};
}
+ @Override
public void navigate(boolean requestFocus) {
//todo
}
+ @Override
public boolean canNavigate() {
return false;
}
+ @Override
public boolean canNavigateToSource() {
return false;
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java
index 90a08c81aa4a..6d3d266e8ae3 100644
--- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java
+++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -75,19 +75,19 @@ public class ResourceBundleStructureViewModel implements PropertiesGroupingStruc
return null;
}
- public void addEditorPositionListener(FileEditorPositionListener listener) {
+ public void addEditorPositionListener(@NotNull FileEditorPositionListener listener) {
}
- public void removeEditorPositionListener(FileEditorPositionListener listener) {
+ public void removeEditorPositionListener(@NotNull FileEditorPositionListener listener) {
}
- public void addModelListener(ModelListener modelListener) {
+ public void addModelListener(@NotNull ModelListener modelListener) {
}
- public void removeModelListener(ModelListener modelListener) {
+ public void removeModelListener(@NotNull ModelListener modelListener) {
}
diff --git a/plugins/properties/src/com/intellij/lang/properties/projectView/ResourceBundleGrouper.java b/plugins/properties/src/com/intellij/lang/properties/projectView/ResourceBundleGrouper.java
index 3394011ab309..fca0b172c561 100644
--- a/plugins/properties/src/com/intellij/lang/properties/projectView/ResourceBundleGrouper.java
+++ b/plugins/properties/src/com/intellij/lang/properties/projectView/ResourceBundleGrouper.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -29,6 +29,7 @@ import com.intellij.openapi.util.Computable;
import com.intellij.psi.PsiFile;
import com.intellij.util.SmartList;
import gnu.trove.THashMap;
+import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collection;
@@ -42,7 +43,8 @@ public class ResourceBundleGrouper implements TreeStructureProvider, DumbAware {
myProject = project;
}
- public Collection modify(AbstractTreeNode parent, final Collection children, final ViewSettings settings) {
+ @NotNull
+ public Collection modify(@NotNull AbstractTreeNode parent, @NotNull final Collection children, final ViewSettings settings) {
if (parent instanceof ResourceBundleNode) return children;
return ApplicationManager.getApplication().runReadAction(new Computable>() {
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java b/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
index bd3393591167..b67f6bfbea3f 100644
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
+++ b/plugins/properties/src/com/intellij/lang/properties/structureView/GroupByWordPrefixes.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -49,8 +49,9 @@ public class GroupByWordPrefixes implements Grouper, Sorter {
return mySeparator;
}
+ @Override
@NotNull
- public Collection group(final AbstractTreeNode parent, Collection children) {
+ public Collection group(@NotNull final AbstractTreeNode parent, @NotNull Collection children) {
List keys = new ArrayList();
String parentPrefix;
@@ -78,6 +79,7 @@ public class GroupByWordPrefixes implements Grouper, Sorter {
keys.add(new Key(words, element));
}
Collections.sort(keys, new Comparator() {
+ @Override
public int compare(final Key k1, final Key k2) {
List o1 = k1.words;
List o2 = k2.words;
@@ -146,6 +148,7 @@ public class GroupByWordPrefixes implements Grouper, Sorter {
return !Comparing.strEqual(words.get(parentPrefixLength), prevWords.get(parentPrefixLength));
}
+ @Override
@NotNull
public ActionPresentation getPresentation() {
return new ActionPresentationData(PropertiesBundle.message("structure.view.group.by.prefixes.action.name"),
@@ -153,11 +156,13 @@ public class GroupByWordPrefixes implements Grouper, Sorter {
AllIcons.Actions.GroupByPrefix);
}
+ @Override
@NotNull
public String getName() {
return ID;
}
+ @NotNull
@Override
public Comparator getComparator() {
return Sorter.ALPHA_SORTER.getComparator();
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
index 44909dd3c43a..d0a203a7644f 100644
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
+++ b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesFileStructureViewElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -52,6 +52,7 @@ public class PropertiesFileStructureViewElement extends PsiTreeElementBase getChildren() {
Collection result = new ArrayList();
List prefixWords = StringUtil.split(myPrefix, mySeparator);
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java
index fb14390904e6..477e80fed24b 100644
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java
+++ b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewBuilderFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -34,7 +34,7 @@ public class PropertiesStructureViewBuilderFactory implements PsiStructureViewFa
public StructureViewBuilder getStructureViewBuilder(final PsiFile psiFile) {
return new StructureViewBuilder() {
@NotNull
- public StructureView createStructureView(FileEditor fileEditor, Project project) {
+ public StructureView createStructureView(FileEditor fileEditor, @NotNull Project project) {
return new PropertiesFileStructureViewComponent(project, (PropertiesFileImpl)psiFile, fileEditor);
}
};
diff --git a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
index 5ababdd5bf44..77946f442518 100644
--- a/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
+++ b/plugins/properties/src/com/intellij/lang/properties/structureView/PropertiesStructureViewElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,6 +18,7 @@ package com.intellij.lang.properties.structureView;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.lang.properties.psi.Property;
import com.intellij.navigation.ItemPresentation;
+import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -48,10 +49,12 @@ public class PropertiesStructureViewElement implements StructureViewTreeElement
return myProperty.canNavigateToSource();
}
+ @NotNull
public StructureViewTreeElement[] getChildren() {
return EMPTY_ARRAY;
}
+ @NotNull
public ItemPresentation getPresentation() {
return new ItemPresentation() {
public String getPresentableText() {
diff --git a/plugins/ui-designer/src/com/intellij/uiDesigner/projectView/FormMergerTreeStructureProvider.java b/plugins/ui-designer/src/com/intellij/uiDesigner/projectView/FormMergerTreeStructureProvider.java
index 5c6786eaaa76..aed97d66243d 100644
--- a/plugins/ui-designer/src/com/intellij/uiDesigner/projectView/FormMergerTreeStructureProvider.java
+++ b/plugins/ui-designer/src/com/intellij/uiDesigner/projectView/FormMergerTreeStructureProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -43,7 +43,8 @@ public class FormMergerTreeStructureProvider implements TreeStructureProvider {
myProject = project;
}
- public Collection modify(AbstractTreeNode parent, Collection children, ViewSettings settings) {
+ @NotNull
+ public Collection modify(@NotNull AbstractTreeNode parent, @NotNull Collection children, ViewSettings settings) {
if (parent.getValue() instanceof Form) return children;
// Optimization. Check if there are any forms at all.
diff --git a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltTreeStructureProvider.java b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltTreeStructureProvider.java
index 5bb3a31cff75..78dd117627a4 100644
--- a/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltTreeStructureProvider.java
+++ b/plugins/xpath/xpath-lang/src/org/intellij/lang/xpath/xslt/impl/XsltTreeStructureProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -28,6 +28,7 @@ import icons.XpathIcons;
import org.intellij.lang.xpath.xslt.XsltConfig;
import org.intellij.lang.xpath.xslt.XsltSupport;
import org.intellij.lang.xpath.xslt.associations.FileAssociationsManager;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -43,8 +44,9 @@ public class XsltTreeStructureProvider implements TreeStructureProvider {
myProject = project;
}
+ @NotNull
@SuppressWarnings({"RawUseOfParameterizedType", "unchecked"})
- public Collection modify(AbstractTreeNode parent, Collection children, ViewSettings settings) {
+ public Collection modify(@NotNull AbstractTreeNode parent, @NotNull Collection children, ViewSettings settings) {
Collection l = children;
int i = 0;
for (AbstractTreeNode o : children) {
diff --git a/python/python-rest/src/com/jetbrains/rest/RestFileProviderFactory.java b/python/python-rest/src/com/jetbrains/rest/RestFileProviderFactory.java
index 121ef6ecd8f4..5c61251d9ba6 100644
--- a/python/python-rest/src/com/jetbrains/rest/RestFileProviderFactory.java
+++ b/python/python-rest/src/com/jetbrains/rest/RestFileProviderFactory.java
@@ -27,7 +27,7 @@ import org.jetbrains.annotations.NotNull;
*/
public class RestFileProviderFactory implements FileViewProviderFactory {
- public FileViewProvider createFileViewProvider(@NotNull VirtualFile virtualFile, Language language, @NotNull PsiManager psiManager, boolean physical) {
- return new RestFileViewProvider(psiManager, virtualFile, physical);
+ public FileViewProvider createFileViewProvider(@NotNull VirtualFile virtualFile, Language language, @NotNull PsiManager psiManager, boolean eventSystemEnabled) {
+ return new RestFileViewProvider(psiManager, virtualFile, eventSystemEnabled);
}
}
diff --git a/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewElement.java b/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewElement.java
index 0ba21cc3a7c4..bb2244580dd6 100644
--- a/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewElement.java
+++ b/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -22,6 +22,7 @@ import com.intellij.psi.PsiElement;
import com.intellij.psi.PsiElementVisitor;
import com.jetbrains.rest.psi.RestElement;
import com.jetbrains.rest.psi.RestTitle;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -56,6 +57,7 @@ public class RestStructureViewElement implements StructureViewTreeElement {
return myElement.canNavigateToSource();
}
+ @NotNull
public StructureViewTreeElement[] getChildren() {
final Set childrenElements = new LinkedHashSet();
myElement.acceptChildren(new PsiElementVisitor() {
@@ -77,6 +79,7 @@ public class RestStructureViewElement implements StructureViewTreeElement {
return children;
}
+ @NotNull
public ItemPresentation getPresentation() {
return new ItemPresentation() {
public String getPresentableText() {
diff --git a/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewModel.java b/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewModel.java
index 0897b996e4f6..8d96f83aa23f 100644
--- a/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewModel.java
+++ b/python/rest/src/com/jetbrains/rest/structureView/RestStructureViewModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -48,7 +48,7 @@ public class RestStructureViewModel extends StructureViewModelBase implements St
}
@Override
- public boolean isAutoExpand(StructureViewTreeElement element) {
+ public boolean isAutoExpand(@NotNull StructureViewTreeElement element) {
return element.getValue() instanceof PsiFile;
}
diff --git a/python/src/com/jetbrains/python/console/PyOpenDebugConsoleAction.java b/python/src/com/jetbrains/python/console/PyOpenDebugConsoleAction.java
index 3f4e8011c88a..45906d513f21 100644
--- a/python/src/com/jetbrains/python/console/PyOpenDebugConsoleAction.java
+++ b/python/src/com/jetbrains/python/console/PyOpenDebugConsoleAction.java
@@ -22,7 +22,6 @@ import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataContext;
-import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.project.DumbAware;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.wm.IdeFocusManager;
@@ -53,6 +52,7 @@ public class PyOpenDebugConsoleAction extends AnAction implements DumbAware {
}
}
+ @Override
public void actionPerformed(final AnActionEvent e) {
final Project project = e.getData(CommonDataKeys.PROJECT);
if (project != null) {
diff --git a/python/src/com/jetbrains/python/console/PythonDebugLanguageConsoleView.java b/python/src/com/jetbrains/python/console/PythonDebugLanguageConsoleView.java
index b807b3c0a54b..495c26df74c8 100644
--- a/python/src/com/jetbrains/python/console/PythonDebugLanguageConsoleView.java
+++ b/python/src/com/jetbrains/python/console/PythonDebugLanguageConsoleView.java
@@ -63,7 +63,7 @@ public class PythonDebugLanguageConsoleView extends JPanel implements ConsoleVie
public PythonDebugLanguageConsoleView(final Project project, Sdk sdk, ConsoleView consoleView) {
super(new CardLayout());
- myPydevConsoleView = createConsoleView(project, sdk);
+ myPydevConsoleView = new PythonConsoleView(project, "Python Console", sdk);
myTextConsole = consoleView;
add(myTextConsole.getComponent(), TEXT_CONSOLE_PANEL);
@@ -85,10 +85,6 @@ public class PythonDebugLanguageConsoleView extends JPanel implements ConsoleVie
getPydevConsoleView().executeCode(code, e);
}
- private static PythonConsoleView createConsoleView(Project project, Sdk sdk) {
- return new PythonConsoleView(project, "Python Console", sdk);
- }
-
private void doShowConsole(String type) {
CardLayout cl = (CardLayout)(getLayout());
cl.show(this, type);
diff --git a/python/src/com/jetbrains/python/debugger/PyDebugRunner.java b/python/src/com/jetbrains/python/debugger/PyDebugRunner.java
index bec10b801ae0..3199200de432 100644
--- a/python/src/com/jetbrains/python/debugger/PyDebugRunner.java
+++ b/python/src/com/jetbrains/python/debugger/PyDebugRunner.java
@@ -40,7 +40,6 @@ import com.jetbrains.python.PythonHelpersLocator;
import com.jetbrains.python.console.PythonConsoleView;
import com.jetbrains.python.console.PythonDebugConsoleCommunication;
import com.jetbrains.python.console.PythonDebugLanguageConsoleView;
-import com.jetbrains.python.console.pydev.ConsoleCommunication;
import com.jetbrains.python.run.AbstractPythonRunConfiguration;
import com.jetbrains.python.run.CommandLinePatcher;
import com.jetbrains.python.run.PythonCommandLineState;
@@ -123,19 +122,14 @@ public class PyDebugRunner extends GenericProgramRunner {
@NotNull final ExecutionResult result,
@NotNull PyDebugProcess debugProcess) {
ExecutionConsole console = result.getExecutionConsole();
- ProcessHandler processHandler = result.getProcessHandler();
-
if (console instanceof PythonDebugLanguageConsoleView) {
PythonConsoleView pythonConsoleView = ((PythonDebugLanguageConsoleView)console).getPydevConsoleView();
+ pythonConsoleView.setConsoleCommunication(new PythonDebugConsoleCommunication(project, debugProcess));
-
- ConsoleCommunication consoleCommunication = new PythonDebugConsoleCommunication(project, debugProcess);
- pythonConsoleView.setConsoleCommunication(consoleCommunication);
-
+ ProcessHandler processHandler = result.getProcessHandler();
PydevDebugConsoleExecuteActionHandler consoleExecuteActionHandler = new PydevDebugConsoleExecuteActionHandler(pythonConsoleView,
processHandler,
- consoleCommunication);
-
+ new PythonDebugConsoleCommunication(project, debugProcess));
pythonConsoleView.setExecutionHandler(consoleExecuteActionHandler);
debugProcess.getSession().addSessionListener(consoleExecuteActionHandler);
diff --git a/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java b/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java
index ae923ed2d7e8..cb9e2577e1f8 100644
--- a/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java
+++ b/python/src/com/jetbrains/python/projectView/PyTreeStructureProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -32,6 +32,7 @@ import com.jetbrains.python.psi.PyDocStringOwner;
import com.jetbrains.python.psi.PyFile;
import com.jetbrains.python.psi.PyFunction;
import com.jetbrains.python.sdk.PythonSdkType;
+import org.jetbrains.annotations.NotNull;
import java.util.ArrayList;
import java.util.Collection;
@@ -41,8 +42,9 @@ import java.util.List;
* @author yole
*/
public class PyTreeStructureProvider implements SelectableTreeStructureProvider, DumbAware {
+ @NotNull
@Override
- public Collection modify(AbstractTreeNode parent, Collection children, ViewSettings settings) {
+ public Collection modify(@NotNull AbstractTreeNode parent, @NotNull Collection children, ViewSettings settings) {
if (parent instanceof NamedLibraryElementNode) {
return hideSkeletons((NamedLibraryElementNode)parent, children);
}
diff --git a/python/src/com/jetbrains/python/structureView/PyInheritedMembersFilter.java b/python/src/com/jetbrains/python/structureView/PyInheritedMembersFilter.java
index b61edd6e361a..2b5483f58891 100644
--- a/python/src/com/jetbrains/python/structureView/PyInheritedMembersFilter.java
+++ b/python/src/com/jetbrains/python/structureView/PyInheritedMembersFilter.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -64,11 +64,13 @@ public class PyInheritedMembersFilter implements FileStructureFilter {
AllIcons.Hierarchy.Supertypes);
}
+ @NotNull
@Override
public String getCheckBoxText() {
return IdeBundle.message("file.structure.toggle.show.inherited");
}
+ @NotNull
@Override
public Shortcut[] getShortcut() {
return KeymapManager.getInstance().getActiveKeymap().getShortcuts("FileStructurePopup");
diff --git a/python/src/com/jetbrains/python/structureView/PyStructureViewElement.java b/python/src/com/jetbrains/python/structureView/PyStructureViewElement.java
index fd043ce5dcec..93c44f7f2a17 100644
--- a/python/src/com/jetbrains/python/structureView/PyStructureViewElement.java
+++ b/python/src/com/jetbrains/python/structureView/PyStructureViewElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -27,6 +27,7 @@ import com.intellij.util.Function;
import com.jetbrains.python.PyNames;
import com.jetbrains.python.psi.*;
import icons.PythonIcons;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
@@ -120,6 +121,7 @@ public class PyStructureViewElement implements StructureViewTreeElement {
return name != null ? name.hashCode() : 0;
}
+ @NotNull
public StructureViewTreeElement[] getChildren() {
final Collection children = new ArrayList();
for (PyElement e : getElementChildren(myElement)) {
@@ -232,6 +234,7 @@ public class PyStructureViewElement implements StructureViewTreeElement {
return false;
}
+ @NotNull
@Override
public ItemPresentation getPresentation() {
return new ColoredItemPresentation() {
diff --git a/python/src/com/jetbrains/python/structureView/PyStructureViewModel.java b/python/src/com/jetbrains/python/structureView/PyStructureViewModel.java
index 662179240530..3e8e4f177568 100644
--- a/python/src/com/jetbrains/python/structureView/PyStructureViewModel.java
+++ b/python/src/com/jetbrains/python/structureView/PyStructureViewModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -66,7 +66,7 @@ public class PyStructureViewModel extends StructureViewModelBase implements Stru
}
@Override
- public boolean isAutoExpand(StructureViewTreeElement element) {
+ public boolean isAutoExpand(@NotNull StructureViewTreeElement element) {
return element.getValue() instanceof PsiFile;
}
diff --git a/resources/src/META-INF/IdeaPlugin.xml b/resources/src/META-INF/IdeaPlugin.xml
index e6d8f987a166..967283cbc4cd 100644
--- a/resources/src/META-INF/IdeaPlugin.xml
+++ b/resources/src/META-INF/IdeaPlugin.xml
@@ -350,6 +350,8 @@
+
@@ -1464,7 +1466,7 @@
-
+
diff --git a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java
index 4794cf59fb2a..548276faf5e9 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -52,10 +52,12 @@ public class DomStructureTreeElement implements StructureViewTreeElement, ItemPr
return myElement.isValid() ? myElement.getXmlElement() : null;
}
+ @NotNull
public ItemPresentation getPresentation() {
return this;
}
+ @NotNull
public TreeElement[] getChildren() {
if (!myElement.isValid()) return EMPTY_ARRAY;
final ArrayList result = new ArrayList();
diff --git a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewBuilder.java b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewBuilder.java
index a8fb409e7c2a..0b86f4365492 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewBuilder.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewBuilder.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -59,8 +59,8 @@ public class DomStructureViewBuilder extends TreeBasedStructureViewBuilder {
@Override
@NotNull
- public StructureView createStructureView(final FileEditor fileEditor, final Project project) {
- return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project) {
+ public StructureView createStructureView(final FileEditor fileEditor, @NotNull final Project project) {
+ return new StructureViewComponent(fileEditor, createStructureViewModel(fileEditor instanceof TextEditor ? ((TextEditor)fileEditor).getEditor() : null), project, true) {
@Override
public AsyncResult expandPathToElement(final Object element) {
if (element instanceof XmlElement) {
diff --git a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewTreeModel.java b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewTreeModel.java
index bb5b01b008f4..d7fd6d50a4e5 100644
--- a/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewTreeModel.java
+++ b/xml/dom-impl/src/com/intellij/util/xml/structure/DomStructureViewTreeModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -19,10 +19,8 @@ package com.intellij.util.xml.structure;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.structureView.impl.xml.XmlFileTreeElement;
import com.intellij.ide.structureView.impl.xml.XmlStructureViewTreeModel;
-import com.intellij.ide.util.treeView.smartTree.Sorter;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.editor.Editor;
-import com.intellij.psi.PsiFile;
import com.intellij.psi.xml.XmlFile;
import com.intellij.util.Function;
import com.intellij.util.xml.*;
@@ -33,20 +31,18 @@ import org.jetbrains.annotations.Nullable;
* @author Gregory.Shrago
*/
public class DomStructureViewTreeModel extends XmlStructureViewTreeModel implements Disposable {
- private final XmlFile myFile;
private final DomElementNavigationProvider myNavigationProvider;
private final Function myDescriptor;
- public DomStructureViewTreeModel(final XmlFile file, final Function descriptor, @Nullable Editor editor) {
+ public DomStructureViewTreeModel(@NotNull XmlFile file, @NotNull Function descriptor, @Nullable Editor editor) {
this(file, DomElementsNavigationManager.getManager(file.getProject()).getDomElementsNavigateProvider(DomElementsNavigationManager.DEFAULT_PROVIDER_NAME), descriptor, editor);
}
- public DomStructureViewTreeModel(final XmlFile file,
+ public DomStructureViewTreeModel(@NotNull XmlFile file,
final DomElementNavigationProvider navigationProvider,
- final Function descriptor,
+ @NotNull Function descriptor,
@Nullable Editor editor) {
super(file, editor);
- myFile = file;
myNavigationProvider = navigationProvider;
myDescriptor = descriptor;
}
@@ -54,6 +50,7 @@ public class DomStructureViewTreeModel extends XmlStructureViewTreeModel impleme
@Override
@NotNull
public StructureViewTreeElement getRoot() {
+ XmlFile myFile = getPsiFile();
final DomFileElement fileElement = DomManager.getDomManager(myFile.getProject()).getFileElement(myFile, DomElement.class);
return fileElement == null?
new XmlFileTreeElement(myFile) :
@@ -63,15 +60,4 @@ public class DomStructureViewTreeModel extends XmlStructureViewTreeModel impleme
protected DomElementNavigationProvider getNavigationProvider() {
return myNavigationProvider;
}
-
- @Override
- @NotNull
- public Sorter[] getSorters() {
- return new Sorter[]{Sorter.ALPHA_SORTER};
- }
-
- @Override
- protected PsiFile getPsiFile() {
- return myFile;
- }
}
diff --git a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java
index 06f71c74c5b3..1a4a5842443d 100644
--- a/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java
+++ b/xml/impl/src/com/intellij/codeInsight/daemon/impl/analysis/InsertRequiredAttributeFix.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,12 +18,10 @@ package com.intellij.codeInsight.daemon.impl.analysis;
import com.intellij.codeInsight.FileModificationService;
import com.intellij.codeInsight.daemon.XmlErrorMessages;
import com.intellij.codeInsight.intention.HighPriorityAction;
-import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInsight.lookup.LookupElement;
import com.intellij.codeInsight.lookup.LookupElementBuilder;
import com.intellij.codeInsight.template.*;
-import com.intellij.codeInspection.LocalQuickFix;
-import com.intellij.codeInspection.ProblemDescriptor;
+import com.intellij.codeInspection.LocalQuickFixAndIntentionActionOnPsiElement;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.command.CommandProcessor;
@@ -39,20 +37,20 @@ import com.intellij.xml.XmlElementDescriptor;
import com.intellij.xml.XmlExtension;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
/**
* User: anna
* Date: 18-Nov-2005
*/
-public class InsertRequiredAttributeFix implements IntentionAction, LocalQuickFix, HighPriorityAction {
- private final XmlTag myTag;
+public class InsertRequiredAttributeFix extends LocalQuickFixAndIntentionActionOnPsiElement implements HighPriorityAction {
private final String myAttrName;
private final String[] myValues;
@NonNls
private static final String NAME_TEMPLATE_VARIABLE = "name";
public InsertRequiredAttributeFix(@NotNull XmlTag tag, @NotNull String attrName,@NotNull String... values) {
- myTag = tag;
+ super(tag);
myAttrName = attrName;
myValues = values;
}
@@ -63,12 +61,6 @@ public class InsertRequiredAttributeFix implements IntentionAction, LocalQuickFi
return XmlErrorMessages.message("insert.required.attribute.quickfix.text", myAttrName);
}
- @Override
- @NotNull
- public String getName() {
- return getText();
- }
-
@Override
@NotNull
public String getFamilyName() {
@@ -76,18 +68,13 @@ public class InsertRequiredAttributeFix implements IntentionAction, LocalQuickFi
}
@Override
- public void applyFix(@NotNull final Project project, @NotNull final ProblemDescriptor descriptor) {
- invoke(project, null, myTag.getContainingFile());
- }
-
- @Override
- public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
- return myTag.isValid();
- }
-
- @Override
- public void invoke(@NotNull final Project project, final Editor editor, PsiFile file) {
+ public void invoke(@NotNull final Project project,
+ @NotNull PsiFile file,
+ @Nullable("is null when called from inspection") final Editor editor,
+ @NotNull PsiElement startElement,
+ @NotNull PsiElement endElement) {
if (!FileModificationService.getInstance().prepareFileForWrite(file)) return;
+ XmlTag myTag = (XmlTag)startElement;
ASTNode treeElement = SourceTreeToPsiMap.psiElementToTree(myTag);
final XmlElementDescriptor descriptor = myTag.getDescriptor();
diff --git a/xml/impl/src/com/intellij/codeInspection/XmlQuickFixFactoryImpl.java b/xml/impl/src/com/intellij/codeInspection/XmlQuickFixFactoryImpl.java
index 8065ebf5221f..c095bd1cf49f 100644
--- a/xml/impl/src/com/intellij/codeInspection/XmlQuickFixFactoryImpl.java
+++ b/xml/impl/src/com/intellij/codeInspection/XmlQuickFixFactoryImpl.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,7 +17,6 @@ package com.intellij.codeInspection;
import com.intellij.codeInsight.daemon.impl.analysis.CreateNSDeclarationIntentionFix;
import com.intellij.codeInsight.daemon.impl.analysis.InsertRequiredAttributeFix;
-import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.psi.PsiElement;
import com.intellij.psi.xml.XmlTag;
import com.intellij.psi.xml.XmlToken;
@@ -27,7 +26,7 @@ import org.jetbrains.annotations.Nullable;
public class XmlQuickFixFactoryImpl extends XmlQuickFixFactory {
@NotNull
@Override
- public IntentionAction insertRequiredAttributeFix(@NotNull XmlTag tag, @NotNull String attrName, @NotNull String... values) {
+ public LocalQuickFixAndIntentionActionOnPsiElement insertRequiredAttributeFix(@NotNull XmlTag tag, @NotNull String attrName, @NotNull String... values) {
return new InsertRequiredAttributeFix(tag, attrName, values);
}
diff --git a/xml/impl/src/com/intellij/ide/browsers/ConfigurableWebBrowser.java b/xml/impl/src/com/intellij/ide/browsers/ConfigurableWebBrowser.java
index d15c59d28581..7cae777e4163 100644
--- a/xml/impl/src/com/intellij/ide/browsers/ConfigurableWebBrowser.java
+++ b/xml/impl/src/com/intellij/ide/browsers/ConfigurableWebBrowser.java
@@ -1,6 +1,7 @@
package com.intellij.ide.browsers;
import com.intellij.icons.AllIcons;
+import com.intellij.ide.IdeBundle;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.PathUtil;
@@ -10,7 +11,10 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.util.UUID;
-final class ConfigurableWebBrowser extends WebBrowserBase {
+final class ConfigurableWebBrowser extends WebBrowser {
+ private final UUID id;
+ @NotNull private BrowserFamily family;
+ @NotNull private String name;
private boolean active;
private String path;
@@ -31,7 +35,9 @@ final class ConfigurableWebBrowser extends WebBrowserBase {
@Nullable String path,
boolean active,
@Nullable BrowserSpecificSettings specificSettings) {
- super(id, family, name);
+ this.id = id;
+ this.family = family;
+ this.name = name;
this.path = StringUtil.nullize(path);
this.active = active;
@@ -120,4 +126,33 @@ final class ConfigurableWebBrowser extends WebBrowserBase {
public int hashCode() {
return getId().hashCode();
}
+
+ @Override
+ @NotNull
+ public String getName() {
+ return name;
+ }
+
+ @Override
+ @NotNull
+ public final UUID getId() {
+ return id;
+ }
+
+ @Override
+ @NotNull
+ public BrowserFamily getFamily() {
+ return family;
+ }
+
+ @Override
+ @NotNull
+ public String getBrowserNotFoundMessage() {
+ return IdeBundle.message("error.0.browser.path.not.specified", getName());
+ }
+
+ @Override
+ public String toString() {
+ return getName() + " (" + getPath() + ")";
+ }
}
\ No newline at end of file
diff --git a/xml/impl/src/com/intellij/ide/browsers/WebBrowserBase.java b/xml/impl/src/com/intellij/ide/browsers/WebBrowserBase.java
deleted file mode 100644
index af7ff95ec08e..000000000000
--- a/xml/impl/src/com/intellij/ide/browsers/WebBrowserBase.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Copyright 2000-2014 JetBrains s.r.o.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.intellij.ide.browsers;
-
-import com.intellij.ide.IdeBundle;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-
-import java.util.UUID;
-
-public abstract class WebBrowserBase extends WebBrowser {
- protected @NotNull BrowserFamily family;
- protected @NotNull String name;
- private final UUID id;
-
- protected WebBrowserBase(@NotNull UUID id, @NotNull BrowserFamily family, @NotNull String name) {
- this.id = id;
- this.family = family;
- this.name = name;
- }
-
- @Override
- @NotNull
- public String getName() {
- return name;
- }
-
- @Override
- @NotNull
- public final UUID getId() {
- return id;
- }
-
- @Override
- @NotNull
- public BrowserFamily getFamily() {
- return family;
- }
-
- @Override
- @NotNull
- public String getBrowserNotFoundMessage() {
- return IdeBundle.message("error.0.browser.path.not.specified", getName());
- }
-
- @Override
- @Nullable
- public BrowserSpecificSettings getSpecificSettings() {
- return null;
- }
-
- @Override
- public String toString() {
- return getName() + " (" + getPath() + ")";
- }
-}
\ No newline at end of file
diff --git a/xml/impl/xml.iml b/xml/impl/xml.iml
index 20135bdba460..2fda30d0d4af 100644
--- a/xml/impl/xml.iml
+++ b/xml/impl/xml.iml
@@ -20,6 +20,7 @@
+
diff --git a/xml/openapi/xml-openapi.iml b/xml/openapi/xml-openapi.iml
index 934360bb80c9..ca52bae6ea88 100644
--- a/xml/openapi/xml-openapi.iml
+++ b/xml/openapi/xml-openapi.iml
@@ -9,6 +9,8 @@
+
+
diff --git a/xml/tests/src/com/intellij/xml/structureView/HtmlFileStructureTest.java b/xml/tests/src/com/intellij/xml/structureView/HtmlFileStructureTest.java
index 77aab443bd03..d71aa3b25e87 100644
--- a/xml/tests/src/com/intellij/xml/structureView/HtmlFileStructureTest.java
+++ b/xml/tests/src/com/intellij/xml/structureView/HtmlFileStructureTest.java
@@ -1,7 +1,22 @@
+/*
+ * Copyright 2000-2014 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.xml.structureView;
-import com.intellij.ide.util.FileStructurePopup;
import com.intellij.ide.util.PropertiesComponent;
+import com.intellij.ide.util.treeView.smartTree.TreeStructureUtil;
import com.intellij.lang.html.structureView.Html5SectionsNodeProvider;
import com.intellij.testFramework.FileStructureTestBase;
@@ -22,7 +37,7 @@ public class HtmlFileStructureTest extends FileStructureTestBase {
}
private static String getHtml5OutlineModePropertyName() {
- return FileStructurePopup.getPropertyName(Html5SectionsNodeProvider.HTML5_OUTLINE_PROVIDER_PROPERTY);
+ return TreeStructureUtil.getPropertyName(Html5SectionsNodeProvider.HTML5_OUTLINE_PROVIDER_PROPERTY);
}
@Override
diff --git a/xml/xml-analysis-api/src/com/intellij/codeInspection/XmlQuickFixFactory.java b/xml/xml-analysis-api/src/com/intellij/codeInspection/XmlQuickFixFactory.java
index e99bbab3d48a..c0c5b1081785 100644
--- a/xml/xml-analysis-api/src/com/intellij/codeInspection/XmlQuickFixFactory.java
+++ b/xml/xml-analysis-api/src/com/intellij/codeInspection/XmlQuickFixFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,7 +15,6 @@
*/
package com.intellij.codeInspection;
-import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.openapi.components.ServiceManager;
import com.intellij.psi.PsiElement;
import com.intellij.psi.xml.XmlTag;
@@ -29,7 +28,7 @@ public abstract class XmlQuickFixFactory {
}
@NotNull
- public abstract IntentionAction insertRequiredAttributeFix(@NotNull XmlTag tag, @NotNull String attrName,@NotNull String... values);
+ public abstract LocalQuickFixAndIntentionActionOnPsiElement insertRequiredAttributeFix(@NotNull XmlTag tag, @NotNull String attrName,@NotNull String... values);
@NotNull
public abstract LocalQuickFix createNSDeclarationIntentionFix(@NotNull final PsiElement element,
diff --git a/xml/openapi/src/com/intellij/xml/XmlTagRuleProvider.java b/xml/xml-analysis-api/src/com/intellij/xml/XmlTagRuleProvider.java
similarity index 91%
rename from xml/openapi/src/com/intellij/xml/XmlTagRuleProvider.java
rename to xml/xml-analysis-api/src/com/intellij/xml/XmlTagRuleProvider.java
index 69d3bbef1951..b81172014831 100644
--- a/xml/openapi/src/com/intellij/xml/XmlTagRuleProvider.java
+++ b/xml/xml-analysis-api/src/com/intellij/xml/XmlTagRuleProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -30,7 +30,7 @@ public abstract class XmlTagRuleProvider {
public static final Rule[] EMPTY_ARRAY = new Rule[0];
- public void annotate(@NotNull XmlTag tag, ProblemsHolder holder) {
+ public void annotate(@NotNull XmlTag tag, @NotNull ProblemsHolder holder) {
}
diff --git a/xml/impl/src/com/intellij/xml/util/TagSetRuleProvider.java b/xml/xml-analysis-impl/src/com/intellij/xml/util/TagSetRuleProvider.java
similarity index 98%
rename from xml/impl/src/com/intellij/xml/util/TagSetRuleProvider.java
rename to xml/xml-analysis-impl/src/com/intellij/xml/util/TagSetRuleProvider.java
index e4e20b9ac570..a3bef9d3ca2e 100644
--- a/xml/impl/src/com/intellij/xml/util/TagSetRuleProvider.java
+++ b/xml/xml-analysis-impl/src/com/intellij/xml/util/TagSetRuleProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2011 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/xml/util/XmlTagRuleProviderBase.java b/xml/xml-analysis-impl/src/com/intellij/xml/util/XmlTagRuleProviderBase.java
similarity index 92%
rename from xml/impl/src/com/intellij/xml/util/XmlTagRuleProviderBase.java
rename to xml/xml-analysis-impl/src/com/intellij/xml/util/XmlTagRuleProviderBase.java
index 66aed47b71d3..6f93f029bbbe 100644
--- a/xml/impl/src/com/intellij/xml/util/XmlTagRuleProviderBase.java
+++ b/xml/xml-analysis-impl/src/com/intellij/xml/util/XmlTagRuleProviderBase.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -15,10 +15,10 @@
*/
package com.intellij.xml.util;
-import com.intellij.codeInsight.daemon.impl.analysis.InsertRequiredAttributeFix;
import com.intellij.codeInspection.LocalQuickFix;
import com.intellij.codeInspection.ProblemHighlightType;
import com.intellij.codeInspection.ProblemsHolder;
+import com.intellij.codeInspection.XmlQuickFixFactory;
import com.intellij.codeInspection.htmlInspections.RemoveAttributeIntentionAction;
import com.intellij.lang.ASTNode;
import com.intellij.openapi.util.Condition;
@@ -117,7 +117,7 @@ public abstract class XmlTagRuleProviderBase extends XmlTagRuleProvider {
// ---=== Classes ===---
public abstract static class Effect {
- public abstract void annotate(@NotNull XmlTag tag, ProblemsHolder holder);
+ public abstract void annotate(@NotNull XmlTag tag, @NotNull ProblemsHolder holder);
}
public static class InvalidAttrEffect extends Effect {
@@ -132,7 +132,7 @@ public abstract class XmlTagRuleProviderBase extends XmlTagRuleProvider {
}
@Override
- public void annotate(@NotNull XmlTag tag, ProblemsHolder holder) {
+ public void annotate(@NotNull XmlTag tag, @NotNull ProblemsHolder holder) {
XmlAttribute attribute = tag.getAttribute(myAttrName);
if (attribute != null) {
PsiElement attributeNameElement = getAttributeNameElement(attribute);
@@ -155,7 +155,7 @@ public abstract class XmlTagRuleProviderBase extends XmlTagRuleProvider {
}
@Override
- public void annotate(@NotNull XmlTag tag, ProblemsHolder holder) {
+ public void annotate(@NotNull XmlTag tag, @NotNull ProblemsHolder holder) {
for (XmlAttribute xmlAttribute : tag.getAttributes()) {
String attrName = xmlAttribute.getName();
if (!ArrayUtil.contains(attrName, myAttrNames)) {
@@ -178,7 +178,7 @@ public abstract class XmlTagRuleProviderBase extends XmlTagRuleProvider {
}
@Override
- public void annotate(@NotNull XmlTag tag, ProblemsHolder holder) {
+ public void annotate(@NotNull XmlTag tag, @NotNull ProblemsHolder holder) {
if (myCondition.value(tag)) {
for (Effect effect : myEffect) {
effect.annotate(tag, holder);
@@ -214,7 +214,7 @@ public abstract class XmlTagRuleProviderBase extends XmlTagRuleProvider {
}
@Override
- public void annotate(@NotNull XmlTag tag, ProblemsHolder holder) {
+ public void annotate(@NotNull XmlTag tag, @NotNull ProblemsHolder holder) {
for (String attributeName : myAttributeNames) {
if (tag.getAttribute(attributeName) != null) {
return;
@@ -228,7 +228,7 @@ public abstract class XmlTagRuleProviderBase extends XmlTagRuleProvider {
LocalQuickFix[] fixes = new LocalQuickFix[myAttributeNames.length];
for (int i = 0; i < myAttributeNames.length; i++) {
- fixes[i] = new InsertRequiredAttributeFix(tag, myAttributeNames[i]);
+ fixes[i] = XmlQuickFixFactory.getInstance().insertRequiredAttributeFix(tag, myAttributeNames[i]);
}
holder.registerProblem(tagNameElement, "Tag should have one of following attributes: " + StringUtil.join(myAttributeNames, ", "),
diff --git a/xml/openapi/src/com/intellij/ide/structureView/xml/XmlStructureViewBuilderProvider.java b/xml/xml-structure-view-api/src/com/intellij/ide/structureView/xml/XmlStructureViewBuilderProvider.java
similarity index 96%
rename from xml/openapi/src/com/intellij/ide/structureView/xml/XmlStructureViewBuilderProvider.java
rename to xml/xml-structure-view-api/src/com/intellij/ide/structureView/xml/XmlStructureViewBuilderProvider.java
index 8099e2de1107..6ca6a5953729 100644
--- a/xml/openapi/src/com/intellij/ide/structureView/xml/XmlStructureViewBuilderProvider.java
+++ b/xml/xml-structure-view-api/src/com/intellij/ide/structureView/xml/XmlStructureViewBuilderProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/openapi/src/com/intellij/ide/structureView/xml/XmlStructureViewElementProvider.java b/xml/xml-structure-view-api/src/com/intellij/ide/structureView/xml/XmlStructureViewElementProvider.java
similarity index 96%
rename from xml/openapi/src/com/intellij/ide/structureView/xml/XmlStructureViewElementProvider.java
rename to xml/xml-structure-view-api/src/com/intellij/ide/structureView/xml/XmlStructureViewElementProvider.java
index 74b0aae2965d..4ff17cac86b4 100644
--- a/xml/openapi/src/com/intellij/ide/structureView/xml/XmlStructureViewElementProvider.java
+++ b/xml/xml-structure-view-api/src/com/intellij/ide/structureView/xml/XmlStructureViewElementProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/xml-structure-view-api/xml-structure-view-api.iml b/xml/xml-structure-view-api/xml-structure-view-api.iml
new file mode 100644
index 000000000000..15af705d61aa
--- /dev/null
+++ b/xml/xml-structure-view-api/xml-structure-view-api.iml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/xml/impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java
similarity index 98%
rename from xml/impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java
rename to xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java
index fde490604718..2383784267ae 100644
--- a/xml/impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/AbstractXmlTagTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java
similarity index 99%
rename from xml/impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java
rename to xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java
index c8f23585d100..8ca2b8933572 100644
--- a/xml/impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/DtdFileTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java
similarity index 98%
rename from xml/impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java
rename to xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java
index e1cd6a213410..f13fe1ccba61 100644
--- a/xml/impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlFileTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/ide/structureView/impl/xml/XmlStructureViewTreeModel.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlStructureViewTreeModel.java
similarity index 78%
rename from xml/impl/src/com/intellij/ide/structureView/impl/xml/XmlStructureViewTreeModel.java
rename to xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlStructureViewTreeModel.java
index 19408e7eff1c..34790afb56d3 100644
--- a/xml/impl/src/com/intellij/ide/structureView/impl/xml/XmlStructureViewTreeModel.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlStructureViewTreeModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -23,24 +23,23 @@ import com.intellij.ide.util.treeView.smartTree.Sorter;
import com.intellij.lang.dtd.DTDLanguage;
import com.intellij.openapi.editor.Editor;
import com.intellij.psi.PsiElement;
-import com.intellij.psi.PsiFile;
import com.intellij.psi.xml.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class XmlStructureViewTreeModel extends TextEditorBasedStructureViewModel {
- private final XmlFile myFile;
- private static final Class[] myClasses = new Class[]{XmlTag.class, XmlFile.class, XmlEntityDecl.class, XmlElementDecl.class, XmlAttlistDecl.class, XmlConditionalSection.class};
- private static final Sorter[] mySorters = {Sorter.ALPHA_SORTER};
+ private static final Class[] CLASSES =
+ {XmlTag.class, XmlFile.class, XmlEntityDecl.class, XmlElementDecl.class, XmlAttlistDecl.class, XmlConditionalSection.class};
+ private static final Sorter[] SORTERS = {Sorter.ALPHA_SORTER};
- public XmlStructureViewTreeModel(XmlFile file, @Nullable Editor editor) {
+ public XmlStructureViewTreeModel(@NotNull XmlFile file, @Nullable Editor editor) {
super(editor, file);
- myFile = file;
}
@Override
@NotNull
public StructureViewTreeElement getRoot() {
+ XmlFile myFile = getPsiFile();
if (myFile.getLanguage() == DTDLanguage.INSTANCE) return new DtdFileTreeElement(myFile);
return new XmlFileTreeElement(myFile);
}
@@ -51,21 +50,21 @@ public class XmlStructureViewTreeModel extends TextEditorBasedStructureViewModel
}
@Override
- protected PsiFile getPsiFile() {
- return myFile;
+ protected XmlFile getPsiFile() {
+ return (XmlFile)super.getPsiFile();
}
@Override
@NotNull
protected Class[] getSuitableClasses() {
- return myClasses;
+ return CLASSES;
}
@Override
public Object getCurrentEditorElement() {
final Object editorElement = super.getCurrentEditorElement();
if (editorElement instanceof XmlTag) {
- for (StructureViewExtension extension : StructureViewFactoryEx.getInstanceEx(myFile.getProject()).getAllExtensions(XmlTag.class)) {
+ for (StructureViewExtension extension : StructureViewFactoryEx.getInstanceEx(getPsiFile().getProject()).getAllExtensions(XmlTag.class)) {
final Object element = extension.getCurrentEditorElement(getEditor(), (PsiElement)editorElement);
if (element != null) return element;
}
@@ -76,6 +75,6 @@ public class XmlStructureViewTreeModel extends TextEditorBasedStructureViewModel
@Override
@NotNull
public Sorter[] getSorters() {
- return mySorters;
+ return SORTERS;
}
}
\ No newline at end of file
diff --git a/xml/impl/src/com/intellij/ide/structureView/impl/xml/XmlTagTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlTagTreeElement.java
similarity index 98%
rename from xml/impl/src/com/intellij/ide/structureView/impl/xml/XmlTagTreeElement.java
rename to xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlTagTreeElement.java
index ee75742ad237..eddd19cf5b4c 100644
--- a/xml/impl/src/com/intellij/ide/structureView/impl/xml/XmlTagTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/ide/structureView/impl/xml/XmlTagTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/lang/dtd/DtdStructureViewBuilderFactory.java b/xml/xml-structure-view-impl/src/com/intellij/lang/dtd/DtdStructureViewBuilderFactory.java
similarity index 97%
rename from xml/impl/src/com/intellij/lang/dtd/DtdStructureViewBuilderFactory.java
rename to xml/xml-structure-view-impl/src/com/intellij/lang/dtd/DtdStructureViewBuilderFactory.java
index fcccefe44f88..d6dc3c8cade3 100644
--- a/xml/impl/src/com/intellij/lang/dtd/DtdStructureViewBuilderFactory.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/dtd/DtdStructureViewBuilderFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionTreeElement.java
similarity index 98%
rename from xml/impl/src/com/intellij/lang/html/structureView/Html5SectionTreeElement.java
rename to xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionTreeElement.java
index f18222f69592..baee9a1534ec 100644
--- a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java
similarity index 83%
rename from xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java
rename to xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java
index dd3341df4133..97409f894622 100644
--- a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsNodeProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -16,18 +16,19 @@
package com.intellij.lang.html.structureView;
import com.intellij.icons.AllIcons;
+import com.intellij.ide.util.ActionShortcutProvider;
import com.intellij.ide.util.FileStructureNodeProvider;
import com.intellij.ide.util.treeView.smartTree.ActionPresentation;
import com.intellij.ide.util.treeView.smartTree.ActionPresentationData;
import com.intellij.ide.util.treeView.smartTree.TreeElement;
import com.intellij.openapi.actionSystem.Shortcut;
-import com.intellij.openapi.keymap.KeymapManager;
import com.intellij.openapi.util.PropertyOwner;
import com.intellij.psi.filters.XmlTagFilter;
import com.intellij.psi.scope.processor.FilterElementProcessor;
import com.intellij.psi.xml.XmlDocument;
import com.intellij.psi.xml.XmlFile;
import com.intellij.psi.xml.XmlTag;
+import com.intellij.util.IncorrectOperationException;
import com.intellij.xml.XmlBundle;
import org.jetbrains.annotations.NotNull;
@@ -36,7 +37,8 @@ import java.util.Collection;
import java.util.Collections;
import java.util.List;
-public class Html5SectionsNodeProvider implements FileStructureNodeProvider, PropertyOwner {
+public class Html5SectionsNodeProvider implements FileStructureNodeProvider, PropertyOwner,
+ ActionShortcutProvider {
public static final String ACTION_ID = "HTML5_OUTLINE_MODE";
public static final String HTML5_OUTLINE_PROVIDER_PROPERTY = "html5.sections.node.provider";
@@ -53,14 +55,22 @@ public class Html5SectionsNodeProvider implements FileStructureNodeProvider provideNodes(final TreeElement node) {
+ public Collection provideNodes(@NotNull final TreeElement node) {
if (!(node instanceof HtmlFileTreeElement)) return Collections.emptyList();
final XmlFile xmlFile = ((HtmlFileTreeElement)node).getElement();
diff --git a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java
similarity index 99%
rename from xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java
rename to xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java
index ea1761222ad0..2ca1c8b3ca63 100644
--- a/xml/impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/Html5SectionsProcessor.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java
similarity index 94%
rename from xml/impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java
rename to xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java
index de191736db75..244f16677c3b 100644
--- a/xml/impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlFileTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -18,8 +18,8 @@ package com.intellij.lang.html.structureView;
import com.intellij.ide.structureView.StructureViewFactoryEx;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.structureView.impl.common.PsiTreeElementBase;
-import com.intellij.ide.util.FileStructurePopup;
import com.intellij.ide.util.PropertiesComponent;
+import com.intellij.ide.util.treeView.smartTree.TreeStructureUtil;
import com.intellij.psi.filters.XmlTagFilter;
import com.intellij.psi.scope.processor.FilterElementProcessor;
import com.intellij.psi.xml.XmlDocument;
@@ -88,7 +88,7 @@ class HtmlFileTreeElement extends PsiTreeElementBase {
if (xmlFile == null) return false;
if (myInStructureViewPopup) {
- final String propertyName = FileStructurePopup.getPropertyName(Html5SectionsNodeProvider.HTML5_OUTLINE_PROVIDER_PROPERTY);
+ final String propertyName = TreeStructureUtil.getPropertyName(Html5SectionsNodeProvider.HTML5_OUTLINE_PROVIDER_PROPERTY);
if (PropertiesComponent.getInstance().getBoolean(propertyName, false)) {
return true;
}
diff --git a/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewBuilderProvider.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlStructureViewBuilderProvider.java
similarity index 97%
rename from xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewBuilderProvider.java
rename to xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlStructureViewBuilderProvider.java
index 9a8741d308a8..91e17be3b451 100644
--- a/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewBuilderProvider.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlStructureViewBuilderProvider.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java
similarity index 90%
rename from xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java
rename to xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java
index 8a9f6f7fe54b..6efe68c75ceb 100644
--- a/xml/impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlStructureViewTreeModel.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
@@ -17,7 +17,6 @@ package com.intellij.lang.html.structureView;
import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
-import com.intellij.ide.actions.ViewStructureAction;
import com.intellij.ide.structureView.StructureViewTreeElement;
import com.intellij.ide.structureView.impl.xml.XmlStructureViewTreeModel;
import com.intellij.ide.util.treeView.smartTree.*;
@@ -36,7 +35,8 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl
private final Collection myNodeProviders;
private String myStructureViewPlace;
- private static Sorter HTML_ALPHA_SORTER = new Sorter() {
+ private static final Sorter HTML_ALPHA_SORTER = new Sorter() {
+ @NotNull
@Override
public Comparator getComparator() {
return new Comparator() {
@@ -93,7 +93,7 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl
}
@Override
- public void setPlace(final String place) {
+ public void setPlace(@NotNull final String place) {
myStructureViewPlace = place;
}
@@ -105,7 +105,7 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl
@Override
@NotNull
public Sorter[] getSorters() {
- if (ViewStructureAction.isInStructureViewPopup(this)) {
+ if (TreeStructureUtil.isInStructureViewPopup(this)) {
return Sorter.EMPTY_ARRAY; // because in popup there's no option to disable sorter
}
@@ -121,6 +121,6 @@ class HtmlStructureViewTreeModel extends XmlStructureViewTreeModel implements Pl
@Override
@NotNull
public StructureViewTreeElement getRoot() {
- return new HtmlFileTreeElement(ViewStructureAction.isInStructureViewPopup(this), (XmlFile)getPsiFile());
+ return new HtmlFileTreeElement(TreeStructureUtil.isInStructureViewPopup(this), (XmlFile)getPsiFile());
}
}
diff --git a/xml/impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java
similarity index 99%
rename from xml/impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java
rename to xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java
index f896146608db..ad060e2261e3 100644
--- a/xml/impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/html/structureView/HtmlTagTreeElement.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2013 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/impl/src/com/intellij/lang/xml/XmlStructureViewBuilderFactory.java b/xml/xml-structure-view-impl/src/com/intellij/lang/xml/XmlStructureViewBuilderFactory.java
similarity index 98%
rename from xml/impl/src/com/intellij/lang/xml/XmlStructureViewBuilderFactory.java
rename to xml/xml-structure-view-impl/src/com/intellij/lang/xml/XmlStructureViewBuilderFactory.java
index ba2721457763..97bb3ec1460c 100644
--- a/xml/impl/src/com/intellij/lang/xml/XmlStructureViewBuilderFactory.java
+++ b/xml/xml-structure-view-impl/src/com/intellij/lang/xml/XmlStructureViewBuilderFactory.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2000-2009 JetBrains s.r.o.
+ * Copyright 2000-2014 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.
diff --git a/xml/xml-structure-view-impl/xml-structure-view-impl.iml b/xml/xml-structure-view-impl/xml-structure-view-impl.iml
new file mode 100644
index 000000000000..538b123a1fc9
--- /dev/null
+++ b/xml/xml-structure-view-impl/xml-structure-view-impl.iml
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+