From fa3529fe188426fafff3e94ab6ee780ef12a15b5 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 14 Aug 2012 13:56:10 +0400 Subject: [PATCH] cleanup --- .../find/findUsages/JavaClassFindUsagesOptions.java | 8 ++++---- .../ide/util/scopeChooser/ScopeChooserCombo.java | 13 ++++++++++--- .../openapi/actionSystem/CompositeShortcutSet.java | 4 ++++ .../openapi/actionSystem/CustomShortcutSet.java | 11 ++++++++--- .../intellij/openapi/actionSystem/ShortcutSet.java | 3 +++ .../openapi/actionSystem/impl/ProxyShortcutSet.java | 2 ++ 6 files changed, 31 insertions(+), 10 deletions(-) diff --git a/java/java-impl/src/com/intellij/find/findUsages/JavaClassFindUsagesOptions.java b/java/java-impl/src/com/intellij/find/findUsages/JavaClassFindUsagesOptions.java index 88e4ea421fa8..076f700d3ab1 100644 --- a/java/java-impl/src/com/intellij/find/findUsages/JavaClassFindUsagesOptions.java +++ b/java/java-impl/src/com/intellij/find/findUsages/JavaClassFindUsagesOptions.java @@ -24,16 +24,16 @@ public class JavaClassFindUsagesOptions extends JavaFindUsagesOptions { @Override protected void addUsageTypes(LinkedHashSet strings) { - if (this.isUsages || this.isMethodsUsages || this.isFieldsUsages) { + if (isUsages || isMethodsUsages || isFieldsUsages) { strings.add(FindBundle.message("find.usages.panel.title.usages")); } - if (this.isDerivedClasses) { + if (isDerivedClasses) { strings.add(FindBundle.message("find.usages.panel.title.derived.classes")); } - if (this.isImplementingClasses) { + if (isImplementingClasses) { strings.add(FindBundle.message("find.usages.panel.title.implementing.classes")); } - if (this.isDerivedInterfaces) { + if (isDerivedInterfaces) { strings.add(FindBundle.message("find.usages.panel.title.derived.interfaces")); } } diff --git a/platform/lang-impl/src/com/intellij/ide/util/scopeChooser/ScopeChooserCombo.java b/platform/lang-impl/src/com/intellij/ide/util/scopeChooser/ScopeChooserCombo.java index 9ad98476dc81..5036959a0765 100644 --- a/platform/lang-impl/src/com/intellij/ide/util/scopeChooser/ScopeChooserCombo.java +++ b/platform/lang-impl/src/com/intellij/ide/util/scopeChooser/ScopeChooserCombo.java @@ -88,6 +88,7 @@ public class ScopeChooserCombo extends ComboboxWithBrowseButton implements Dispo myPrevSearchFiles = prevSearchWholeFiles; myProject = project; myScopeListener = new NamedScopesHolder.ScopeListener() { + @Override public void scopesChanged() { final SearchScope selectedScope = getSelectedScope(); rebuildModel(); @@ -140,6 +141,7 @@ public class ScopeChooserCombo extends ComboboxWithBrowseButton implements Dispo private ActionListener createScopeChooserListener() { return new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { final String selection = getSelectedScopeName(); final EditScopesDialog dlg = EditScopesDialog.showDialog(myProject, selection); @@ -313,22 +315,27 @@ public class ScopeChooserCombo extends ComboboxWithBrowseButton implements Dispo } if (!files.isEmpty()) { GlobalSearchScope prev = new GlobalSearchScope(project) { + @Override public String getDisplayName() { return IdeBundle.message("scope.files.in.previous.search.result"); } + @Override public boolean contains(VirtualFile file) { return files.contains(file); } + @Override public int compare(VirtualFile file1, VirtualFile file2) { return 0; } + @Override public boolean isSearchInModuleContent(@NotNull Module aModule) { return true; } + @Override public boolean isSearchInLibraries() { return true; } @@ -447,12 +454,12 @@ public class ScopeChooserCombo extends ComboboxWithBrowseButton implements Dispo @Override public void setSelectedIndex(final int anIndex) { - Object item = super.getItemAt(anIndex); + Object item = getItemAt(anIndex); if (!(item instanceof ScopeSeparator)) { super.setSelectedIndex(anIndex); } else if (myDirection != 0) { - item = super.getItemAt(anIndex + myDirection); + item = getItemAt(anIndex + myDirection); if (!(item instanceof ScopeSeparator)) { super.setSelectedIndex(anIndex + myDirection); } @@ -461,7 +468,7 @@ public class ScopeChooserCombo extends ComboboxWithBrowseButton implements Dispo } private static class ScopeSeparator extends ScopeDescriptor { - private String myText; + private final String myText; public ScopeSeparator(final String text) { super(null); diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/CompositeShortcutSet.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/CompositeShortcutSet.java index 531a72d5e7b7..33dfa7cf4e90 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/CompositeShortcutSet.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/CompositeShortcutSet.java @@ -15,6 +15,8 @@ */ package com.intellij.openapi.actionSystem; +import org.jetbrains.annotations.NotNull; + import java.util.ArrayList; import java.util.Collections; import java.util.List; @@ -26,6 +28,8 @@ public class CompositeShortcutSet implements ShortcutSet { mySets = sets; } + @Override + @NotNull public Shortcut[] getShortcuts() { List result = new ArrayList(); for (ShortcutSet each : mySets) { diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/CustomShortcutSet.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/CustomShortcutSet.java index 94475390fb65..9dcdc76680f9 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/CustomShortcutSet.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/CustomShortcutSet.java @@ -15,6 +15,8 @@ */ package com.intellij.openapi.actionSystem; +import org.jetbrains.annotations.NotNull; + import javax.swing.*; /** @@ -28,7 +30,7 @@ public final class CustomShortcutSet implements ShortcutSet { * Creates CustomShortcutSet which contains only one * single stroke keyboard shortcut. */ - public CustomShortcutSet(KeyStroke keyStroke){ + public CustomShortcutSet(@NotNull KeyStroke keyStroke){ this(new KeyboardShortcut(keyStroke, null)); } @@ -38,15 +40,18 @@ public final class CustomShortcutSet implements ShortcutSet { * * @param shortcuts keyboard shortcuts */ - public CustomShortcutSet(Shortcut... shortcuts){ + public CustomShortcutSet(@NotNull Shortcut... shortcuts){ myShortcuts = shortcuts.length == 0 ? Shortcut.EMPTY_ARRAY : shortcuts.clone(); } + @Override + @NotNull public Shortcut[] getShortcuts(){ return myShortcuts.length == 0 ? Shortcut.EMPTY_ARRAY : myShortcuts.clone(); } - public static CustomShortcutSet fromString(String... keyboardShortcuts) { + @NotNull + public static CustomShortcutSet fromString(@NotNull String... keyboardShortcuts) { final KeyboardShortcut[] shortcuts = new KeyboardShortcut[keyboardShortcuts.length]; for (int i = 0; i < keyboardShortcuts.length; i++) { shortcuts[i] = KeyboardShortcut.fromString(keyboardShortcuts[i]); diff --git a/platform/platform-api/src/com/intellij/openapi/actionSystem/ShortcutSet.java b/platform/platform-api/src/com/intellij/openapi/actionSystem/ShortcutSet.java index c956c296bdd7..d7b34b3ba5bb 100644 --- a/platform/platform-api/src/com/intellij/openapi/actionSystem/ShortcutSet.java +++ b/platform/platform-api/src/com/intellij/openapi/actionSystem/ShortcutSet.java @@ -15,6 +15,8 @@ */ package com.intellij.openapi.actionSystem; +import org.jetbrains.annotations.NotNull; + /** * Represents a set of keyboard and/or mouse shortcuts. * @@ -26,5 +28,6 @@ public interface ShortcutSet { * @return array of keyboard Shortcuts that are in the set. * The method returns an empty array if there are no keyboard Shortcuts */ + @NotNull Shortcut[] getShortcuts(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ProxyShortcutSet.java b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ProxyShortcutSet.java index b627c13e0b56..69f50d99e732 100644 --- a/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ProxyShortcutSet.java +++ b/platform/platform-impl/src/com/intellij/openapi/actionSystem/impl/ProxyShortcutSet.java @@ -19,6 +19,7 @@ import com.intellij.openapi.actionSystem.Shortcut; import com.intellij.openapi.actionSystem.ShortcutSet; import com.intellij.openapi.keymap.Keymap; import com.intellij.openapi.keymap.KeymapManager; +import org.jetbrains.annotations.NotNull; /** * Please do not use this class outside impl package!!! @@ -35,6 +36,7 @@ final class ProxyShortcutSet implements ShortcutSet { myKeymapManager = keymapManager; } + @NotNull public Shortcut[] getShortcuts() { Keymap keymap=myKeymapManager.getActiveKeymap(); return keymap.getShortcuts(myActionId);