diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefClassImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefClassImpl.java index 9cb0c3a2318e..17416a0b99de 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefClassImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefClassImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -33,6 +33,7 @@ import com.intellij.psi.*; import com.intellij.psi.util.ClassUtil; import com.intellij.psi.util.PsiFormatUtil; import com.intellij.psi.util.PsiUtilCore; +import com.intellij.util.containers.ContainerUtil; import gnu.trove.THashSet; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -45,7 +46,7 @@ import java.util.Set; public class RefClassImpl extends RefJavaElementImpl implements RefClass { private static final Set EMPTY_SET = Collections.emptySet(); private static final Set EMPTY_CLASS_SET = Collections.emptySet(); - private static final List EMPTY_METHOD_LIST = new ArrayList(0); + private static final List EMPTY_METHOD_LIST = ContainerUtil.emptyList(); private static final int IS_ANONYMOUS_MASK = 0x10000; private static final int IS_INTERFACE_MASK = 0x20000; private static final int IS_UTILITY_MASK = 0x40000; diff --git a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefElementImpl.java b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefElementImpl.java index acb7d5418231..066bf033c019 100644 --- a/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefElementImpl.java +++ b/platform/analysis-impl/src/com/intellij/codeInspection/reference/RefElementImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -36,6 +36,7 @@ import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.SmartPointerManager; import com.intellij.psi.SmartPsiElementPointer; +import com.intellij.util.containers.ContainerUtil; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -48,7 +49,6 @@ import java.util.Collection; import java.util.List; public abstract class RefElementImpl extends RefEntityImpl implements RefElement { - private static final List EMPTY_REFERNCES_LIST = new ArrayList(0); protected static final Logger LOG = Logger.getInstance("#com.intellij.codeInspection.reference.RefElement"); private static final int IS_ENTRY_MASK = 0x80; @@ -168,7 +168,7 @@ public abstract class RefElementImpl extends RefEntityImpl implements RefElement @NotNull public Collection getOutReferences() { if (myOutReferences == null){ - return EMPTY_REFERNCES_LIST; + return ContainerUtil.emptyList(); } return myOutReferences; } @@ -177,7 +177,7 @@ public abstract class RefElementImpl extends RefEntityImpl implements RefElement @NotNull public Collection getInReferences() { if (myInReferences == null){ - return EMPTY_REFERNCES_LIST; + return ContainerUtil.emptyList(); } return myInReferences; } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeActionGroup.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeActionGroup.java index 7ed4118a35e6..89556b2b5a85 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeActionGroup.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeActionGroup.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -22,7 +22,7 @@ import com.intellij.openapi.diff.impl.highlighting.FragmentSide; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; +import java.util.List; public class MergeActionGroup extends ActionGroup { private final MergeOperations myOperations; @@ -31,14 +31,16 @@ public class MergeActionGroup extends ActionGroup { myOperations = new MergeOperations(diffPanel, side); } + @Override @NotNull public AnAction[] getChildren(@Nullable AnActionEvent e) { - ArrayList operations = myOperations.getOperations(); + List operations = myOperations.getOperations(); AnAction[] actions = new AnAction[operations.size() + 2]; actions[0] = new SelectSuggestionAction(myOperations); actions[1] = Separator.getInstance(); - for (int i = 2; i < actions.length; i++) + for (int i = 2; i < actions.length; i++) { actions[i] = new OperationAction(operations.get(i - 2)); + } return actions; } @@ -51,10 +53,12 @@ public class MergeActionGroup extends ActionGroup { myOperations = operations; } + @Override public void actionPerformed(AnActionEvent e) { myOperations.selectSuggestion(); } + @Override public void update(AnActionEvent e) { e.getPresentation().setEnabled(myOperations.getCurrentFragment() != null); } @@ -68,6 +72,7 @@ public class MergeActionGroup extends ActionGroup { myOperation = operation; } + @Override public void actionPerformed(AnActionEvent e) { myOperation.perform(PlatformDataKeys.PROJECT.getData(e.getDataContext())); } diff --git a/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeOperations.java b/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeOperations.java index bcd7d36e0795..2d41d5ab8eb7 100644 --- a/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeOperations.java +++ b/platform/platform-impl/src/com/intellij/openapi/diff/actions/MergeOperations.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * 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. @@ -31,15 +31,18 @@ import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.ReadonlyStatusHandler; import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; import java.util.ArrayList; +import java.util.List; public class MergeOperations { private final DiffPanelImpl myDiffPanel; private final FragmentSide mySide; - private static final ArrayList NO_OPERATIONS = new ArrayList(0); + private static final List NO_OPERATIONS = ContainerUtil.emptyList(); private static final Condition NOT_EQUAL_FRAGMENT = new Condition() { public boolean value(Fragment fragment) { return fragment.getType() != null; @@ -51,7 +54,8 @@ public class MergeOperations { mySide = side; } - public ArrayList getOperations() { + @NotNull + public List getOperations() { Fragment fragment = getCurrentFragment(); if (fragment == null) return NO_OPERATIONS; ArrayList operations = new ArrayList(3);