From 43eb3641dfe948938aafeeb8682121676a0f4af4 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Tue, 10 Apr 2012 12:58:00 +0400 Subject: [PATCH] @Override added --- .../analysis/AnnotationsHighlightUtil.java | 1 + .../CreateAnnotationMethodFromUsageFix.java | 5 ++++ .../impl/quickfix/CreateClassFromNewFix.java | 1 + .../editorActions/BlockJoinLinesHandler.java | 1 + .../CopyPasteReferenceProcessor.java | 5 ++++ .../DeclarationJoinLinesHandler.java | 1 + .../editorActions/JavaBackspaceHandler.java | 2 ++ .../JavaCopyPasteReferenceProcessor.java | 3 +++ .../editorActions/JavaQuoteHandler.java | 7 ++++++ .../editorActions/JavaTypedHandler.java | 3 +++ .../LiteralJoinLinesHandler.java | 1 + .../ReferenceTransferableData.java | 6 +++++ .../RestoreReferencesDialog.java | 3 +++ .../StringLiteralCopyPasteProcessor.java | 1 + .../AfterSemicolonEnterProcessor.java | 1 + .../smartEnter/BlockBraceFixer.java | 1 + .../smartEnter/CatchDeclarationFixer.java | 1 + .../CommentBreakerEnterProcessor.java | 1 + .../smartEnter/DoWhileConditionFixer.java | 1 + .../smartEnter/EnumFieldFixer.java | 1 + .../smartEnter/IfConditionFixer.java | 1 + .../smartEnter/JavaSmartEnterProcessor.java | 2 ++ .../LeaveCodeBlockEnterProcessor.java | 1 + .../smartEnter/LiteralFixer.java | 1 + .../smartEnter/MethodCallFixer.java | 1 + .../MissingArrayInitializerBraceFixer.java | 1 + .../smartEnter/MissingCatchBodyFixer.java | 1 + .../smartEnter/MissingForBodyFixer.java | 1 + .../smartEnter/MissingForeachBodyFixer.java | 1 + .../smartEnter/MissingIfBranchesFixer.java | 1 + .../smartEnter/MissingMethodBodyFixer.java | 1 + .../MissingReturnExpressionFixer.java | 1 + .../smartEnter/MissingSwitchBodyFixer.java | 1 + .../MissingSynchronizedBodyFixer.java | 1 + .../MissingThrowExpressionFixer.java | 1 + .../smartEnter/MissingWhileBodyFixer.java | 1 + .../smartEnter/ParameterListFixer.java | 1 + .../smartEnter/ParenthesizedFixer.java | 1 + .../smartEnter/PlainEnterProcessor.java | 1 + .../smartEnter/SemicolonFixer.java | 1 + .../smartEnter/SwitchExpressionFixer.java | 1 + .../smartEnter/WhileConditionFixer.java | 1 + .../editorActions/smartEnter/XmlTagFixer.java | 1 + .../AntLikePropertySelectionHandler.java | 2 ++ .../wordSelection/BasicSelectioner.java | 1 + .../CaseStatementsSelectioner.java | 2 ++ .../CodeBlockOrInitializerSelectioner.java | 2 ++ .../wordSelection/DocCommentSelectioner.java | 2 ++ .../wordSelection/DocTagSelectioner.java | 2 ++ .../wordSelection/FieldSelectioner.java | 2 ++ .../FinallyBlockSelectioner.java | 2 ++ .../wordSelection/IfStatementSelectioner.java | 2 ++ .../JavaBasicWordSelectionFilter.java | 1 + .../wordSelection/JavaTokenSelectioner.java | 2 ++ .../wordSelection/ListSelectioner.java | 2 ++ .../wordSelection/LiteralSelectioner.java | 2 ++ .../MethodOrClassSelectioner.java | 2 ++ .../wordSelection/ReferenceSelectioner.java | 2 ++ .../StatementGroupSelectioner.java | 2 ++ .../wordSelection/TypeCastSelectioner.java | 2 ++ .../folding/impl/CollapseBlockHandler.java | 3 +++ .../impl/CollapseExpandJavadocsHandler.java | 3 +++ .../impl/JavaCodeFoldingSettingsImpl.java | 25 +++++++++++++++++++ .../impl/JavaElementSignatureProvider.java | 2 ++ .../folding/impl/JavaFoldingBuilder.java | 1 + .../impl/actions/CollapseBlockAction.java | 1 + .../impl/actions/CollapseJavadocsAction.java | 1 + .../impl/actions/ExpandJavadocsAction.java | 1 + .../HighlightExceptionsHandler.java | 4 +++ .../HighlightExceptionsHandlerFactory.java | 2 ++ .../HighlightExitPointsHandler.java | 3 +++ .../HighlightExitPointsHandlerFactory.java | 1 + .../HighlightOverridingMethodsHandler.java | 4 +++ ...hlightOverridingMethodsHandlerFactory.java | 1 + .../HighlightSuppressedWarningsFactory.java | 1 + .../HighlightSuppressedWarningsHandler.java | 4 +++ .../highlighting/JavaBraceMatcher.java | 3 +++ ...avaHighlightUsagesDescriptionProvider.java | 1 + .../JavaReadWriteAccessDetector.java | 4 +++ .../intention/AddAnnotationFix.java | 2 ++ .../impl/AddAnnotationIntention.java | 1 + .../impl/AddOnDemandStaticImportAction.java | 4 +++ .../impl/AddOverrideAnnotationAction.java | 5 ++++ .../AddSingleMemberStaticImportAction.java | 3 +++ .../impl/AssignFieldFromParameterAction.java | 3 +++ .../impl/ColorChooserIntentionAction.java | 3 +++ .../ConcatenationToMessageFormatAction.java | 5 ++++ ...AbsolutePathToRelativeIntentionAction.java | 2 ++ .../impl/ConvertToBasicLatinAction.java | 9 +++++++ ...opyAbstractMethodImplementationAction.java | 4 +++ ...pyAbstractMethodImplementationHandler.java | 4 +++ .../intention/impl/CreateClassDialog.java | 9 +++++++ .../impl/CreateFieldFromParameterAction.java | 6 +++++ .../impl/CreateFieldFromParameterDialog.java | 13 ++++++++++ .../intention/impl/CreateSubclassAction.java | 5 ++++ .../impl/DeannotateIntentionAction.java | 8 ++++++ .../impl/ExpandStaticImportAction.java | 3 +++ .../impl/ImplementAbstractMethodAction.java | 5 ++++ .../impl/InvertIfConditionAction.java | 4 +++ ...oveFieldAssignmentToInitializerAction.java | 4 +++ .../MoveInitializerToConstructorAction.java | 4 +++ .../impl/SimplifyBooleanExpressionAction.java | 5 ++++ .../impl/SplitDeclarationAction.java | 3 +++ .../intention/impl/SplitIfAction.java | 3 +++ .../intention/impl/TypeExpression.java | 3 +++ .../impl/config/QuickFixFactoryImpl.java | 18 +++++++++++++ 106 files changed, 305 insertions(+) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java index 017ec0dea27d..7c2bfa18efdd 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/analysis/AnnotationsHighlightUtil.java @@ -372,6 +372,7 @@ public class AnnotationsHighlightUtil { public static class AnnotationReturnTypeVisitor extends PsiTypeVisitor { public static final AnnotationReturnTypeVisitor INSTANCE = new AnnotationReturnTypeVisitor(); + @Override public Boolean visitType(PsiType type) { return Boolean.FALSE; } diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAnnotationMethodFromUsageFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAnnotationMethodFromUsageFix.java index 6caa6f64d02c..86f0e4f4d168 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAnnotationMethodFromUsageFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateAnnotationMethodFromUsageFix.java @@ -38,6 +38,7 @@ public class CreateAnnotationMethodFromUsageFix extends CreateFromUsageBaseFix { myNameValuePair = SmartPointerManager.getInstance(valuePair.getProject()).createSmartPsiElementPointer(valuePair); } + @Override protected boolean isAvailableImpl(int offset) { final PsiNameValuePair call = getNameValuePair(); if (call == null || !call.isValid()) return false; @@ -49,12 +50,14 @@ public class CreateAnnotationMethodFromUsageFix extends CreateFromUsageBaseFix { return true; } + @Override protected PsiElement getElement() { final PsiNameValuePair call = getNameValuePair(); if (call == null || !call.getManager().isInProject(call)) return null; return call; } + @Override protected void invokeImpl(final PsiClass targetClass) { if (targetClass == null) return; @@ -121,11 +124,13 @@ public class CreateAnnotationMethodFromUsageFix extends CreateFromUsageBaseFix { } + @Override protected boolean isValidElement(PsiElement element) { final PsiReference reference = element.getReference(); return reference != null && reference.resolve() != null; } + @Override @NotNull public String getFamilyName() { return QuickFixBundle.message("create.method.from.usage.family"); diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateClassFromNewFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateClassFromNewFix.java index 49b37d9b9b2a..44d579c6d34f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateClassFromNewFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateClassFromNewFix.java @@ -107,6 +107,7 @@ public class CreateClassFromNewFix extends CreateFromUsageBaseFix { final Editor editor = positionCursor(project, aClass.getContainingFile(), aClass); final TextRange textRange = aClass.getTextRange(); final Runnable runnable = new Runnable() { + @Override public void run() { new WriteCommandAction(project, getText(), getText()) { @Override diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/BlockJoinLinesHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/BlockJoinLinesHandler.java index b0899222b0cd..ade90ea70a66 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/BlockJoinLinesHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/BlockJoinLinesHandler.java @@ -25,6 +25,7 @@ import com.intellij.util.IncorrectOperationException; public class BlockJoinLinesHandler implements JoinLinesHandlerDelegate { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.editorActions.BlockJoinLinesHandler"); + @Override public int tryJoinLines(final Document document, final PsiFile psiFile, final int start, final int end) { PsiElement elementAtStartLineEnd = psiFile.findElementAt(start); PsiElement elementAtNextLineStart = psiFile.findElementAt(end); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java index fccb67e77d87..cca76290d9f2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/CopyPasteReferenceProcessor.java @@ -42,6 +42,7 @@ import java.util.Comparator; public abstract class CopyPasteReferenceProcessor implements CopyPastePostProcessor { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.editorActions.CopyPasteReferenceProcessor"); + @Override public ReferenceTransferableData collectTransferableData(PsiFile file, final Editor editor, final int[] startOffsets, final int[] endOffsets) { if (file instanceof PsiCompiledFile) { file = ((PsiCompiledFile) file).getDecompiledPsiFile(); @@ -67,6 +68,7 @@ public abstract class CopyPasteReferenceProcessor imple protected abstract void addReferenceData(PsiFile file, int startOffset, PsiElement element, ArrayList to); + @Override @Nullable public ReferenceTransferableData extractTransferableData(final Transferable content) { ReferenceTransferableData referenceData = null; @@ -90,6 +92,7 @@ public abstract class CopyPasteReferenceProcessor imple return null; } + @Override public void processTransferableData(final Project project, final Editor editor, final RangeMarker bounds, @@ -113,6 +116,7 @@ public abstract class CopyPasteReferenceProcessor imple } PsiDocumentManager.getInstance(project).commitAllDocuments(); ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { restoreReferences(referenceData, refs); } @@ -170,6 +174,7 @@ public abstract class CopyPasteReferenceProcessor imple Arrays.sort( selectedObjects, new Comparator() { + @Override public int compare(Object o1, Object o2) { String fqName1 = getFQName(o1); String fqName2 = getFQName(o2); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/DeclarationJoinLinesHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/DeclarationJoinLinesHandler.java index 5cc8800dd415..0df11ad95488 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/DeclarationJoinLinesHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/DeclarationJoinLinesHandler.java @@ -28,6 +28,7 @@ import com.intellij.util.IncorrectOperationException; public class DeclarationJoinLinesHandler implements JoinLinesHandlerDelegate { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.editorActions.DeclarationJoinLinesHandler"); + @Override public int tryJoinLines(final Document document, final PsiFile file, final int start, final int end) { PsiElement elementAtStartLineEnd = file.findElementAt(start); PsiElement elementAtNextLineStart = file.findElementAt(end); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaBackspaceHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaBackspaceHandler.java index 2f1c8991a779..bab448b58c6b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaBackspaceHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaBackspaceHandler.java @@ -28,6 +28,7 @@ import com.intellij.psi.util.PsiUtil; public class JavaBackspaceHandler extends BackspaceHandlerDelegate { private boolean myToDeleteGt; + @Override public void beforeCharDeleted(char c, PsiFile file, Editor editor) { int offset = editor.getCaretModel().getOffset() - 1; myToDeleteGt = c =='<' && @@ -36,6 +37,7 @@ public class JavaBackspaceHandler extends BackspaceHandlerDelegate { && JavaTypedHandler.isAfterClassLikeIdentifierOrDot(offset, editor); } + @Override public boolean charDeleted(final char c, final PsiFile file, final Editor editor) { int offset = editor.getCaretModel().getOffset(); final CharSequence chars = editor.getDocument().getCharsSequence(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaCopyPasteReferenceProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaCopyPasteReferenceProcessor.java index 39ebd1cb7aaf..352a3cc6a5cb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaCopyPasteReferenceProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaCopyPasteReferenceProcessor.java @@ -29,6 +29,7 @@ import java.util.ArrayList; public class JavaCopyPasteReferenceProcessor extends CopyPasteReferenceProcessor { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.editorActions.JavaCopyPasteReferenceProcessor"); + @Override protected void addReferenceData(PsiFile file, int startOffset, PsiElement element, ArrayList to) { if (element instanceof PsiJavaCodeReferenceElement) { if (!((PsiJavaCodeReferenceElement)element).isQualified()) { @@ -57,6 +58,7 @@ public class JavaCopyPasteReferenceProcessor extends CopyPasteReferenceProcessor } + @Override protected PsiJavaCodeReferenceElement[] findReferencesToRestore(PsiFile file, RangeMarker bounds, ReferenceTransferableData.ReferenceData[] referenceData) { @@ -102,6 +104,7 @@ public class JavaCopyPasteReferenceProcessor extends CopyPasteReferenceProcessor return refs; } + @Override protected void restoreReferences(ReferenceTransferableData.ReferenceData[] referenceData, PsiJavaCodeReferenceElement[] refs) { for (int i = 0; i < refs.length; i++) { diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaQuoteHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaQuoteHandler.java index 28b1548eb0e2..67cde2fdcb1a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaQuoteHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaQuoteHandler.java @@ -33,6 +33,7 @@ public class JavaQuoteHandler extends SimpleTokenSetQuoteHandler implements Java concatenatableStrings = TokenSet.create(JavaTokenType.STRING_LITERAL); } + @Override public boolean isOpeningQuote(HighlighterIterator iterator, int offset) { boolean openingQuote = super.isOpeningQuote(iterator, offset); @@ -50,6 +51,7 @@ public class JavaQuoteHandler extends SimpleTokenSetQuoteHandler implements Java return openingQuote; } + @Override public boolean isClosingQuote(HighlighterIterator iterator, int offset) { boolean closingQuote = super.isClosingQuote(iterator, offset); @@ -67,22 +69,27 @@ public class JavaQuoteHandler extends SimpleTokenSetQuoteHandler implements Java return closingQuote; } + @Override public TokenSet getConcatenatableStringTokenTypes() { return concatenatableStrings; } + @Override public String getStringConcatenationOperatorRepresentation() { return "+"; } + @Override public TokenSet getStringTokenTypes() { return myLiteralTokenSet; } + @Override public boolean isAppropriateElementTypeForLiteral(final @NotNull IElementType tokenType) { return isAppropriateElementTypeForLiteralStatic(tokenType); } + @Override public boolean needParenthesesAroundConcatenation(final PsiElement element) { // example code: "some string".length() must become ("some" + " string").length() return element.getParent() instanceof PsiLiteralExpression && element.getParent().getParent() instanceof PsiReferenceExpression; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java index bd44b70fdc28..5f5d12097059 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/JavaTypedHandler.java @@ -51,6 +51,7 @@ public class JavaTypedHandler extends TypedHandlerDelegate { private static void autoPopupMemberLookup(Project project, final Editor editor) { AutoPopupController.getInstance(project).autoPopupMemberLookup(editor, new Condition() { + @Override public boolean value(final PsiFile file) { int offset = editor.getCaretModel().getOffset(); @@ -81,6 +82,7 @@ public class JavaTypedHandler extends TypedHandlerDelegate { }); } + @Override public Result beforeCharTyped(final char c, final Project project, final Editor editor, final PsiFile file, final FileType fileType) { if (c == '@' && file instanceof PsiJavaFile) { autoPopupJavadocLookup(project, editor); @@ -141,6 +143,7 @@ public class JavaTypedHandler extends TypedHandlerDelegate { return Result.CONTINUE; } + @Override public Result charTyped(final char c, final Project project, final Editor editor, @NotNull final PsiFile file) { if (myJavaLTTyped) { myJavaLTTyped = false; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/LiteralJoinLinesHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/LiteralJoinLinesHandler.java index c84fda13b436..b3b8d27591a2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/LiteralJoinLinesHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/LiteralJoinLinesHandler.java @@ -22,6 +22,7 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.PsiJavaToken; public class LiteralJoinLinesHandler implements JoinLinesHandlerDelegate { + @Override public int tryJoinLines(final Document doc, final PsiFile psiFile, final int offsetNear, final int end) { CharSequence text = doc.getCharsSequence(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/ReferenceTransferableData.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/ReferenceTransferableData.java index 637e102e0691..8b2e56e7deb5 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/ReferenceTransferableData.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/ReferenceTransferableData.java @@ -30,14 +30,17 @@ public class ReferenceTransferableData implements TextBlockTransferableData, Clo myReferenceDatas = referenceDatas; } + @Override public DataFlavor getFlavor() { return ReferenceData.getDataFlavor(); } + @Override public int getOffsetCount() { return myReferenceDatas.length * 2; } + @Override public int getOffsets(final int[] offsets, int index) { for (ReferenceData data : myReferenceDatas) { offsets[index++] = data.startOffset; @@ -46,6 +49,7 @@ public class ReferenceTransferableData implements TextBlockTransferableData, Clo return index; } + @Override public int setOffsets(final int[] offsets, int index) { for (ReferenceData data : myReferenceDatas) { data.startOffset = offsets[index++]; @@ -54,6 +58,7 @@ public class ReferenceTransferableData implements TextBlockTransferableData, Clo return index; } + @Override public ReferenceTransferableData clone() { ReferenceData[] newReferenceData = new ReferenceData[myReferenceDatas.length]; for (int i = 0; i < myReferenceDatas.length; i++) { @@ -81,6 +86,7 @@ public class ReferenceTransferableData implements TextBlockTransferableData, Clo this.staticMemberName = staticMemberDescriptor; } + @Override public Object clone() { try{ return super.clone(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/RestoreReferencesDialog.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/RestoreReferencesDialog.java index 4df6f5cf4d24..a50b2b605dc7 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/RestoreReferencesDialog.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/RestoreReferencesDialog.java @@ -54,6 +54,7 @@ class RestoreReferencesDialog extends DialogWrapper { myList.setSelectionInterval(0, myNamedElements.length - 1); } + @Override protected void doOKAction() { Object[] values = myList.getSelectedValues(); mySelectedElements = new Object[values.length]; @@ -61,6 +62,7 @@ class RestoreReferencesDialog extends DialogWrapper { super.doOKAction(); } + @Override protected JComponent createCenterPanel() { final JPanel panel = new JPanel(new BorderLayout()); myList = new JBList(myNamedElements); @@ -89,6 +91,7 @@ class RestoreReferencesDialog extends DialogWrapper { } + @Override protected String getDimensionServiceKey(){ return "#com.intellij.codeInsight.editorActions.RestoreReferencesDialog"; } diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/StringLiteralCopyPasteProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/StringLiteralCopyPasteProcessor.java index 75ea17b574c6..cfb40848e403 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/StringLiteralCopyPasteProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/StringLiteralCopyPasteProcessor.java @@ -118,6 +118,7 @@ public class StringLiteralCopyPasteProcessor implements CopyPastePreProcessor { return unescapeStringCharacters(text); } + @Override public String preprocessOnPaste(final Project project, final PsiFile file, final Editor editor, String text, final RawText rawText) { final Document document = editor.getDocument(); PsiDocumentManager.getInstance(project).commitDocument(document); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/AfterSemicolonEnterProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/AfterSemicolonEnterProcessor.java index 1b254dc1038e..9d43379ce920 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/AfterSemicolonEnterProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/AfterSemicolonEnterProcessor.java @@ -27,6 +27,7 @@ import com.intellij.util.text.CharArrayUtil; * To change this template use Options | File Templates. */ public class AfterSemicolonEnterProcessor implements EnterProcessor { + @Override public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) { if (psiElement instanceof PsiExpressionStatement || psiElement instanceof PsiDeclarationStatement || diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/BlockBraceFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/BlockBraceFixer.java index 46982ddccd02..fa133c893936 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/BlockBraceFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/BlockBraceFixer.java @@ -31,6 +31,7 @@ import com.intellij.util.IncorrectOperationException; * To change this template use Options | File Templates. */ public class BlockBraceFixer implements Fixer{ + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiCodeBlock && afterUnmatchedBrace(editor,psiElement.getContainingFile().getFileType())) { PsiCodeBlock block = (PsiCodeBlock) psiElement; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/CatchDeclarationFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/CatchDeclarationFixer.java index 8873e22f65e4..a1dce0029143 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/CatchDeclarationFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/CatchDeclarationFixer.java @@ -29,6 +29,7 @@ import com.intellij.util.IncorrectOperationException; */ @SuppressWarnings({"HardCodedStringLiteral"}) public class CatchDeclarationFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiCatchSection) { final Document doc = editor.getDocument(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/CommentBreakerEnterProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/CommentBreakerEnterProcessor.java index f5d2e9f261c2..96cf91ab4ad8 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/CommentBreakerEnterProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/CommentBreakerEnterProcessor.java @@ -34,6 +34,7 @@ import com.intellij.psi.util.PsiTreeUtil; * To change this template use Options | File Templates. */ public class CommentBreakerEnterProcessor implements EnterProcessor { + @Override public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) { if (isModified) return false; final PsiElement atCaret = psiElement.getContainingFile().findElementAt(editor.getCaretModel().getOffset()); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/DoWhileConditionFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/DoWhileConditionFixer.java index 39fca93d0ef6..3772face021e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/DoWhileConditionFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/DoWhileConditionFixer.java @@ -32,6 +32,7 @@ import com.intellij.util.IncorrectOperationException; */ @SuppressWarnings({"HardCodedStringLiteral"}) public class DoWhileConditionFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiDoWhileStatement) { final Document doc = editor.getDocument(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/EnumFieldFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/EnumFieldFixer.java index f522327b1224..9f1b25c7f90c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/EnumFieldFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/EnumFieldFixer.java @@ -30,6 +30,7 @@ import com.intellij.util.text.CharArrayUtil; * To change this template use Options | File Templates. */ public class EnumFieldFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiEnumConstant) { int insertionOffset = psiElement.getTextRange().getEndOffset(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/IfConditionFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/IfConditionFixer.java index 1700e7e7ce85..108a68f6bb52 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/IfConditionFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/IfConditionFixer.java @@ -25,6 +25,7 @@ import com.intellij.util.IncorrectOperationException; */ @SuppressWarnings({"HardCodedStringLiteral"}) public class IfConditionFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiIfStatement) { final Document doc = editor.getDocument(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java index b94541a2c94b..eba6e79ffef8 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/JavaSmartEnterProcessor.java @@ -94,6 +94,7 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor { private final JavadocFixer myJavadocFixer = new JavadocFixer(); + @Override public boolean process(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile psiFile) { final Document document = editor.getDocument(); final String textForRollback = document.getText(); @@ -236,6 +237,7 @@ public class JavaSmartEnterProcessor extends SmartEnterProcessor { return element instanceof PsiClass || element instanceof PsiCodeBlock || element instanceof PsiStatement || element instanceof PsiMethod; } + @Override @Nullable protected PsiElement getStatementAtCaret(Editor editor, PsiFile psiFile) { final PsiElement atCaret = super.getStatementAtCaret(editor, psiFile); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/LeaveCodeBlockEnterProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/LeaveCodeBlockEnterProcessor.java index 7284dd0aa2a2..2ec5134359c4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/LeaveCodeBlockEnterProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/LeaveCodeBlockEnterProcessor.java @@ -46,6 +46,7 @@ public class LeaveCodeBlockEnterProcessor implements EnterProcessor { JavaElementType.FOREACH_STATEMENT ); + @Override public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) { PsiElement parent = psiElement.getParent(); if (!(parent instanceof PsiCodeBlock)) { diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/LiteralFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/LiteralFixer.java index 59a3f72cdd27..8601b1f371eb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/LiteralFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/LiteralFixer.java @@ -30,6 +30,7 @@ import com.intellij.util.IncorrectOperationException; * To change this template use Options | File Templates. */ public class LiteralFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiJavaToken) { diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MethodCallFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MethodCallFixer.java index 2b25c1f40c5c..041149cad35a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MethodCallFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MethodCallFixer.java @@ -29,6 +29,7 @@ import com.intellij.util.text.CharArrayUtil; * To change this template use Options | File Templates. */ public class MethodCallFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { PsiExpressionList args = null; if (psiElement instanceof PsiMethodCallExpression && !(psiElement instanceof JspMethodCall)) { diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingArrayInitializerBraceFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingArrayInitializerBraceFixer.java index 7d74c46cb325..ff6688e36fc0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingArrayInitializerBraceFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingArrayInitializerBraceFixer.java @@ -30,6 +30,7 @@ import com.intellij.util.IncorrectOperationException; * To change this template use Options | File Templates. */ public class MissingArrayInitializerBraceFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (!(psiElement instanceof PsiArrayInitializerExpression)) return; PsiArrayInitializerExpression expr = (PsiArrayInitializerExpression)psiElement; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingCatchBodyFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingCatchBodyFixer.java index 2125dbfbb507..1d4d281aea68 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingCatchBodyFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingCatchBodyFixer.java @@ -28,6 +28,7 @@ import com.intellij.util.IncorrectOperationException; * To change this template use Options | File Templates. */ public class MissingCatchBodyFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (!(psiElement instanceof PsiCatchSection)) return; PsiCatchSection catchSection = (PsiCatchSection) psiElement; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingForBodyFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingForBodyFixer.java index b96a8bcc22e5..a742a5e5d1b0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingForBodyFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingForBodyFixer.java @@ -30,6 +30,7 @@ import org.jetbrains.annotations.Nullable; * To change this template use Options | File Templates. */ public class MissingForBodyFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { PsiForStatement forStatement = getForStatementParent(psiElement); if (forStatement == null) return; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingForeachBodyFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingForeachBodyFixer.java index 807043331c77..f35f25627c54 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingForeachBodyFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingForeachBodyFixer.java @@ -25,6 +25,7 @@ import com.intellij.util.IncorrectOperationException; * @author Maxim.Mossienko */ public class MissingForeachBodyFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { PsiForeachStatement forStatement = getForeachStatementParent(psiElement); if (forStatement == null) return; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingIfBranchesFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingIfBranchesFixer.java index 760400f390df..5def648b137f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingIfBranchesFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingIfBranchesFixer.java @@ -24,6 +24,7 @@ import com.intellij.util.IncorrectOperationException; * @author max */ public class MissingIfBranchesFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (!(psiElement instanceof PsiIfStatement)) return; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingMethodBodyFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingMethodBodyFixer.java index 2c90f9f1249b..b15459494abc 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingMethodBodyFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingMethodBodyFixer.java @@ -30,6 +30,7 @@ import com.intellij.util.IncorrectOperationException; * To change this template use Options | File Templates. */ public class MissingMethodBodyFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (!(psiElement instanceof PsiMethod)) return; PsiMethod method = (PsiMethod) psiElement; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingReturnExpressionFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingReturnExpressionFixer.java index 8b1815410175..3b07d684b3be 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingReturnExpressionFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingReturnExpressionFixer.java @@ -31,6 +31,7 @@ import org.jetbrains.annotations.Nullable; */ @SuppressWarnings({"HardCodedStringLiteral"}) public class MissingReturnExpressionFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (!(psiElement instanceof PsiReturnStatement)) { return; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingSwitchBodyFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingSwitchBodyFixer.java index c8e889270932..4bd39f3dab5b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingSwitchBodyFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingSwitchBodyFixer.java @@ -38,6 +38,7 @@ import com.intellij.util.IncorrectOperationException; * To change this template use Options | File Templates. */ public class MissingSwitchBodyFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (!(psiElement instanceof PsiSwitchStatement)) return; PsiSwitchStatement switchStatement = (PsiSwitchStatement) psiElement; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingSynchronizedBodyFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingSynchronizedBodyFixer.java index 14566933a62d..4596a44d0aa9 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingSynchronizedBodyFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingSynchronizedBodyFixer.java @@ -29,6 +29,7 @@ import com.intellij.util.IncorrectOperationException; * To change this template use Options | File Templates. */ public class MissingSynchronizedBodyFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (!(psiElement instanceof PsiSynchronizedStatement)) return; PsiSynchronizedStatement syncStatement = (PsiSynchronizedStatement) psiElement; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingThrowExpressionFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingThrowExpressionFixer.java index 082775ad7a56..1e3694c9fa56 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingThrowExpressionFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingThrowExpressionFixer.java @@ -29,6 +29,7 @@ import com.intellij.util.IncorrectOperationException; */ @SuppressWarnings({"HardCodedStringLiteral"}) public class MissingThrowExpressionFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiThrowStatement) { diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingWhileBodyFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingWhileBodyFixer.java index 490a3745177e..c6136a4f3aa1 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingWhileBodyFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/MissingWhileBodyFixer.java @@ -31,6 +31,7 @@ import com.intellij.util.IncorrectOperationException; * To change this template use Options | File Templates. */ public class MissingWhileBodyFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (!(psiElement instanceof PsiWhileStatement)) return; PsiWhileStatement whileStatement = (PsiWhileStatement) psiElement; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/ParameterListFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/ParameterListFixer.java index 5435e668c983..586f7a75deef 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/ParameterListFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/ParameterListFixer.java @@ -30,6 +30,7 @@ import com.intellij.util.IncorrectOperationException; * To change this template use Options | File Templates. */ public class ParameterListFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiParameterList) { if (!StringUtil.endsWithChar(psiElement.getText(), ')')) { diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/ParenthesizedFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/ParenthesizedFixer.java index 3b42171cebcd..1c7f2039a0cf 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/ParenthesizedFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/ParenthesizedFixer.java @@ -21,6 +21,7 @@ import com.intellij.psi.PsiParenthesizedExpression; import com.intellij.util.IncorrectOperationException; public class ParenthesizedFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiParenthesizedExpression) { final PsiElement lastChild = psiElement.getLastChild(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/PlainEnterProcessor.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/PlainEnterProcessor.java index 74eee25b5f02..4f7737510beb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/PlainEnterProcessor.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/PlainEnterProcessor.java @@ -40,6 +40,7 @@ import org.jetbrains.annotations.Nullable; * To change this template use Options | File Templates. */ public class PlainEnterProcessor implements EnterProcessor { + @Override public boolean doEnter(Editor editor, PsiElement psiElement, boolean isModified) { PsiCodeBlock block = getControlStatementBlock(editor.getCaretModel().getOffset(), psiElement); if (processExistingBlankLine(editor, block, psiElement)) { diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SemicolonFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SemicolonFixer.java index a1f57ff51771..66badf559cee 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SemicolonFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SemicolonFixer.java @@ -39,6 +39,7 @@ import org.jetbrains.annotations.Nullable; */ @SuppressWarnings({"HardCodedStringLiteral"}) public class SemicolonFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { boolean fixed = fixReturn(editor, psiElement) || fixForUpdate(editor, psiElement, processor) || fixAfterLastValidElement(editor, psiElement); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SwitchExpressionFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SwitchExpressionFixer.java index 63f85f95daf8..4c14b13d8502 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SwitchExpressionFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/SwitchExpressionFixer.java @@ -36,6 +36,7 @@ import com.intellij.util.IncorrectOperationException; */ @SuppressWarnings({"HardCodedStringLiteral"}) public class SwitchExpressionFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiSwitchStatement) { final Document doc = editor.getDocument(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/WhileConditionFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/WhileConditionFixer.java index f431b56befae..34bb37f6ae12 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/WhileConditionFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/WhileConditionFixer.java @@ -29,6 +29,7 @@ import com.intellij.util.IncorrectOperationException; */ @SuppressWarnings({"HardCodedStringLiteral"}) public class WhileConditionFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof PsiWhileStatement) { final Document doc = editor.getDocument(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/XmlTagFixer.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/XmlTagFixer.java index a50020e8ca8e..b155ff75b610 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/XmlTagFixer.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/smartEnter/XmlTagFixer.java @@ -28,6 +28,7 @@ import com.intellij.lang.ASTNode; * @author maxim */ public class XmlTagFixer implements Fixer { + @Override public void apply(Editor editor, JavaSmartEnterProcessor processor, PsiElement psiElement) throws IncorrectOperationException { if (psiElement instanceof XmlTag) { final ASTNode emptyTagEnd = XmlChildRole.EMPTY_TAG_END_FINDER.findChild(psiElement.getNode()); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/AntLikePropertySelectionHandler.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/AntLikePropertySelectionHandler.java index 59ae79842bc9..ffd75c7747c0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/AntLikePropertySelectionHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/AntLikePropertySelectionHandler.java @@ -29,6 +29,7 @@ import java.util.Collections; import java.util.List; public class AntLikePropertySelectionHandler implements ExtendWordSelectionHandler { + @Override public boolean canSelect(PsiElement e) { Language l = e.getLanguage(); if (!(l.equals(StdLanguages.JAVA) @@ -40,6 +41,7 @@ public class AntLikePropertySelectionHandler implements ExtendWordSelectionHandl return PsiTreeUtil.getParentOfType(e, PsiComment.class) == null; } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { TextRange range = e.getTextRange(); char prevLeftChar = ' '; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/BasicSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/BasicSelectioner.java index 69caab7004b2..920a5bf3a32c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/BasicSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/BasicSelectioner.java @@ -23,6 +23,7 @@ import com.intellij.codeInsight.editorActions.ExtendWordSelectionHandlerBase; public class BasicSelectioner extends ExtendWordSelectionHandlerBase { + @Override public boolean canSelect(PsiElement e) { return canSelectBasic(e); } diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/CaseStatementsSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/CaseStatementsSelectioner.java index 3829cda6bd9b..0a1b991f3790 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/CaseStatementsSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/CaseStatementsSelectioner.java @@ -24,11 +24,13 @@ import java.util.List; import java.util.ArrayList; public class CaseStatementsSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e.getParent() instanceof PsiCodeBlock && e.getParent().getParent() instanceof PsiSwitchStatement; } + @Override public List select(PsiElement statement, CharSequence editorText, int cursorOffset, Editor editor) { List result = new ArrayList(); PsiElement caseStart = statement; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/CodeBlockOrInitializerSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/CodeBlockOrInitializerSelectioner.java index 219726c8941b..f07d4371f00d 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/CodeBlockOrInitializerSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/CodeBlockOrInitializerSelectioner.java @@ -23,10 +23,12 @@ import java.util.ArrayList; import java.util.List; public class CodeBlockOrInitializerSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiCodeBlock || e instanceof PsiArrayInitializerExpression; } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = new ArrayList(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/DocCommentSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/DocCommentSelectioner.java index 1bd1616d987a..f4d37375cdb0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/DocCommentSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/DocCommentSelectioner.java @@ -26,10 +26,12 @@ import com.intellij.util.text.CharArrayUtil; import java.util.List; public class DocCommentSelectioner extends LineCommentSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiDocComment; } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = super.select(e, editorText, cursorOffset, editor); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/DocTagSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/DocTagSelectioner.java index 9cd9d992a538..c64d304249cb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/DocTagSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/DocTagSelectioner.java @@ -28,10 +28,12 @@ import com.intellij.util.text.CharArrayUtil; import java.util.List; public class DocTagSelectioner extends WordSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiDocTag; } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = super.select(e, editorText, cursorOffset, editor); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/FieldSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/FieldSelectioner.java index 91f13adcec65..8cc70bfa1300 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/FieldSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/FieldSelectioner.java @@ -24,6 +24,7 @@ import com.intellij.openapi.editor.Editor; import java.util.List; public class FieldSelectioner extends WordSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiField; } @@ -38,6 +39,7 @@ public class FieldSelectioner extends WordSelectioner { } } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = super.select(e, editorText, cursorOffset, editor); final PsiField field = (PsiField)e; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/FinallyBlockSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/FinallyBlockSelectioner.java index 7dd305afca44..cd7daad1e0c7 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/FinallyBlockSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/FinallyBlockSelectioner.java @@ -26,11 +26,13 @@ import java.util.List; import java.util.ArrayList; public class FinallyBlockSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiKeyword && PsiKeyword.FINALLY.equals(e.getText()); } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = new ArrayList(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/IfStatementSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/IfStatementSelectioner.java index c1ae5097ebaf..2acc887e1678 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/IfStatementSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/IfStatementSelectioner.java @@ -26,10 +26,12 @@ import java.util.List; import java.util.ArrayList; public class IfStatementSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiIfStatement; } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = new ArrayList(); result.addAll(expandToWholeLine(editorText, e.getTextRange(), false)); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/JavaBasicWordSelectionFilter.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/JavaBasicWordSelectionFilter.java index 2ef03f914e7d..024022e43462 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/JavaBasicWordSelectionFilter.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/JavaBasicWordSelectionFilter.java @@ -23,6 +23,7 @@ import com.intellij.psi.javadoc.PsiDocTag; * @author yole */ public class JavaBasicWordSelectionFilter implements Condition { + @Override public boolean value(final PsiElement e) { return !(e instanceof PsiCodeBlock) && !(e instanceof PsiArrayInitializerExpression) && diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/JavaTokenSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/JavaTokenSelectioner.java index a67aff4a5d85..d4c0eda2428a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/JavaTokenSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/JavaTokenSelectioner.java @@ -22,10 +22,12 @@ import com.intellij.openapi.editor.Editor; import java.util.List; public class JavaTokenSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiJavaToken && !(e instanceof PsiKeyword) && !(e.getParent()instanceof PsiCodeBlock); } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { PsiJavaToken token = (PsiJavaToken)e; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/ListSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/ListSelectioner.java index 65a3dbb1cce2..2404f21a17b0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/ListSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/ListSelectioner.java @@ -23,10 +23,12 @@ import java.util.List; import java.util.ArrayList; public class ListSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiParameterList || e instanceof PsiExpressionList; } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { PsiElement[] children = e.getChildren(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/LiteralSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/LiteralSelectioner.java index 4098ad8249f0..988f7ff4c4a8 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/LiteralSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/LiteralSelectioner.java @@ -27,6 +27,7 @@ import com.intellij.psi.StringEscapesTokenTypes; import java.util.List; public class LiteralSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { PsiElement parent = e.getParent(); return @@ -38,6 +39,7 @@ public class LiteralSelectioner extends BasicSelectioner { ((PsiLiteralExpression)element).getType().equalsToText("java.lang.String") && element.getText().startsWith("\"") && element.getText().endsWith("\""); } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = super.select(e, editorText, cursorOffset, editor); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java index c4cfeebd080d..9efaa06d5feb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/MethodOrClassSelectioner.java @@ -27,10 +27,12 @@ import java.util.List; */ public class MethodOrClassSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiClass && !(e instanceof PsiTypeParameter) || e instanceof PsiMethod; } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = super.select(e, editorText, cursorOffset, editor); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/ReferenceSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/ReferenceSelectioner.java index 5e379eac284a..e17abe2c9939 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/ReferenceSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/ReferenceSelectioner.java @@ -23,10 +23,12 @@ import java.util.List; import java.util.ArrayList; public class ReferenceSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiJavaCodeReferenceElement; } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { PsiElement endElement = e; diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/StatementGroupSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/StatementGroupSelectioner.java index ea2c55811b2a..03074630f7d0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/StatementGroupSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/StatementGroupSelectioner.java @@ -26,10 +26,12 @@ import java.util.List; import java.util.ArrayList; public class StatementGroupSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiStatement || e instanceof PsiComment && !(e instanceof PsiDocComment); } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = new ArrayList(); diff --git a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/TypeCastSelectioner.java b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/TypeCastSelectioner.java index b631ca04fd64..697b45aedbce 100644 --- a/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/TypeCastSelectioner.java +++ b/java/java-impl/src/com/intellij/codeInsight/editorActions/wordSelection/TypeCastSelectioner.java @@ -26,10 +26,12 @@ import java.util.List; import java.util.ArrayList; public class TypeCastSelectioner extends BasicSelectioner { + @Override public boolean canSelect(PsiElement e) { return e instanceof PsiTypeCastExpression; } + @Override public List select(PsiElement e, CharSequence editorText, int cursorOffset, Editor editor) { List result = new ArrayList(); result.addAll(expandToWholeLine(editorText, e.getTextRange(), false)); diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/CollapseBlockHandler.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/CollapseBlockHandler.java index 82fca64c97e5..890268037df3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/CollapseBlockHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/CollapseBlockHandler.java @@ -32,8 +32,10 @@ public class CollapseBlockHandler implements CodeInsightActionHandler { public static final String ourPlaceHolderText = "{...}"; private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.folding.impl.CollapseBlockHandler"); + @Override public void invoke(@NotNull final Project project, @NotNull final Editor editor, @NotNull final PsiFile file) { editor.getFoldingModel().runBatchFoldingOperation(new Runnable() { + @Override public void run() { final EditorFoldingInfo info = EditorFoldingInfo.get(editor); FoldingModelEx model = (FoldingModelEx) editor.getFoldingModel(); @@ -81,6 +83,7 @@ public class CollapseBlockHandler implements CodeInsightActionHandler { }); } + @Override public boolean startInWriteAction() { return true; } diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/CollapseExpandJavadocsHandler.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/CollapseExpandJavadocsHandler.java index e45d07e6e7e7..91b30142ec00 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/CollapseExpandJavadocsHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/CollapseExpandJavadocsHandler.java @@ -33,6 +33,7 @@ public class CollapseExpandJavadocsHandler implements CodeInsightActionHandler { myExpand = isExpand; } + @Override public void invoke(@NotNull Project project, @NotNull final Editor editor, @NotNull PsiFile file){ PsiDocumentManager.getInstance(project).commitAllDocuments(); @@ -40,6 +41,7 @@ public class CollapseExpandJavadocsHandler implements CodeInsightActionHandler { foldingManager.updateFoldRegions(editor); final FoldRegion[] allFoldRegions = editor.getFoldingModel().getAllFoldRegions(); Runnable processor = new Runnable() { + @Override public void run() { for (FoldRegion region : allFoldRegions) { PsiElement element = EditorFoldingInfo.get(editor).getPsiElement(region); @@ -52,6 +54,7 @@ public class CollapseExpandJavadocsHandler implements CodeInsightActionHandler { editor.getFoldingModel().runBatchFoldingOperation(processor); } + @Override public boolean startInWriteAction() { return true; } diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaCodeFoldingSettingsImpl.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaCodeFoldingSettingsImpl.java index 396d335f34dc..f84176824395 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaCodeFoldingSettingsImpl.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaCodeFoldingSettingsImpl.java @@ -37,10 +37,12 @@ import java.io.File; ) public class JavaCodeFoldingSettingsImpl extends JavaCodeFoldingSettings implements PersistentStateComponent, ExportableComponent { + @Override public boolean isCollapseImports() { return CodeFoldingSettings.getInstance().COLLAPSE_IMPORTS; } + @Override public void setCollapseImports(boolean value) { CodeFoldingSettings.getInstance().COLLAPSE_IMPORTS = value; } @@ -50,79 +52,98 @@ public class JavaCodeFoldingSettingsImpl extends JavaCodeFoldingSettings impleme return COLLAPSE_CLOSURES; } + @Override public void setCollapseLambdas(boolean value) { COLLAPSE_CLOSURES = value; } + @Override public boolean isCollapseConstructorGenericParameters() { return COLLAPSE_CONSTRUCTOR_GENERIC_PARAMETERS; } + @Override public void setCollapseConstructorGenericParameters(boolean value) { COLLAPSE_CONSTRUCTOR_GENERIC_PARAMETERS = value; } + @Override public boolean isCollapseMethods() { return CodeFoldingSettings.getInstance().COLLAPSE_METHODS; } + @Override public void setCollapseMethods(boolean value) { CodeFoldingSettings.getInstance().COLLAPSE_METHODS = value; } + @Override public boolean isCollapseAccessors() { return COLLAPSE_ACCESSORS; } + @Override public void setCollapseAccessors(boolean value) { COLLAPSE_ACCESSORS = value; } + @Override public boolean isCollapseInnerClasses() { return COLLAPSE_INNER_CLASSES; } + @Override public void setCollapseInnerClasses(boolean value) { COLLAPSE_INNER_CLASSES = value; } + @Override public boolean isCollapseJavadocs() { return CodeFoldingSettings.getInstance().COLLAPSE_DOC_COMMENTS; } + @Override public void setCollapseJavadocs(boolean value) { CodeFoldingSettings.getInstance().COLLAPSE_DOC_COMMENTS = value; } + @Override public boolean isCollapseFileHeader() { return CodeFoldingSettings.getInstance().COLLAPSE_FILE_HEADER; } + @Override public void setCollapseFileHeader(boolean value) { CodeFoldingSettings.getInstance().COLLAPSE_FILE_HEADER = value; } + @Override public boolean isCollapseAnonymousClasses() { return COLLAPSE_ANONYMOUS_CLASSES; } + @Override public void setCollapseAnonymousClasses(boolean value) { COLLAPSE_ANONYMOUS_CLASSES = value; } + @Override public boolean isCollapseAnnotations() { return COLLAPSE_ANNOTATIONS; } + @Override public void setCollapseAnnotations(boolean value) { COLLAPSE_ANNOTATIONS = value; } + @Override public boolean isCollapseI18nMessages() { return COLLAPSE_I18N_MESSAGES; } + @Override public void setCollapseI18nMessages(boolean value) { COLLAPSE_I18N_MESSAGES = value; } @@ -157,20 +178,24 @@ public class JavaCodeFoldingSettingsImpl extends JavaCodeFoldingSettings impleme @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_SUPPRESS_WARNINGS = true; @SuppressWarnings({"WeakerAccess"}) public boolean COLLAPSE_END_OF_LINE_COMMENTS = false; + @Override @NotNull public File[] getExportFiles() { return new File[]{PathManager.getOptionsFile("editor.codeinsight")}; } + @Override @NotNull public String getPresentableName() { return IdeBundle.message("code.folding.settings"); } + @Override public JavaCodeFoldingSettingsImpl getState() { return this; } + @Override public void loadState(final JavaCodeFoldingSettingsImpl state) { XmlSerializerUtil.copyBean(state, this); } diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaElementSignatureProvider.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaElementSignatureProvider.java index 3bbbba17c091..26ef1e9e13f5 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaElementSignatureProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaElementSignatureProvider.java @@ -29,6 +29,7 @@ import java.util.StringTokenizer; public class JavaElementSignatureProvider extends AbstractElementSignatureProvider { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.folding.impl.JavaElementSignatureProvider"); + @Override @Nullable public String getSignature(@NotNull final PsiElement element) { if (element instanceof PsiImportList) { @@ -152,6 +153,7 @@ public class JavaElementSignatureProvider extends AbstractElementSignatureProvid return null; } + @Override protected PsiElement restoreBySignatureTokens(@NotNull PsiFile file, @NotNull PsiElement parent, @NotNull String type, diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java index 99a45d55fc54..939b55ac9ff5 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/JavaFoldingBuilder.java @@ -635,6 +635,7 @@ public class JavaFoldingBuilder extends CustomFoldingBuilder implements DumbAwar } final String params = StringUtil.join(method.getParameterList().getParameters(), new Function() { + @Override public String fun(final PsiParameter psiParameter) { String typeName; if (quick) { diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseBlockAction.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseBlockAction.java index 85f34e057580..ee56654784f4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseBlockAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseBlockAction.java @@ -23,6 +23,7 @@ import com.intellij.codeInsight.folding.impl.CollapseBlockHandler; * @author ven */ public class CollapseBlockAction extends BaseCodeInsightAction { + @Override protected CodeInsightActionHandler getHandler() { return new CollapseBlockHandler (); } diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseJavadocsAction.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseJavadocsAction.java index a6b11a0636b8..a5bee9a87c8e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseJavadocsAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/CollapseJavadocsAction.java @@ -20,6 +20,7 @@ import com.intellij.codeInsight.actions.BaseCodeInsightAction; import com.intellij.codeInsight.folding.impl.CollapseExpandJavadocsHandler; public class CollapseJavadocsAction extends BaseCodeInsightAction{ + @Override protected CodeInsightActionHandler getHandler(){ return new CollapseExpandJavadocsHandler(false); } diff --git a/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/ExpandJavadocsAction.java b/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/ExpandJavadocsAction.java index 3d7a38b856f2..95c87f3d6db9 100644 --- a/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/ExpandJavadocsAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/folding/impl/actions/ExpandJavadocsAction.java @@ -20,6 +20,7 @@ import com.intellij.codeInsight.actions.BaseCodeInsightAction; import com.intellij.codeInsight.folding.impl.CollapseExpandJavadocsHandler; public class ExpandJavadocsAction extends BaseCodeInsightAction{ + @Override protected CodeInsightActionHandler getHandler(){ return new CollapseExpandJavadocsHandler(true); } diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandler.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandler.java index d6e39146e673..495bad2981b6 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandler.java @@ -42,18 +42,22 @@ public class HighlightExceptionsHandler extends HighlightUsagesHandlerBase getTargets() { return ChooseClassAndDoHighlightRunnable.resolveClasses(myClassTypes); } + @Override protected void selectTargets(final List targets, final Consumer> selectionConsumer) { new ChooseClassAndDoHighlightRunnable(myClassTypes, myEditor, CodeInsightBundle.message("highlight.exceptions.thrown.chooser.title")) { + @Override protected void selected(PsiClass... classes) { selectionConsumer.consume(Arrays.asList(classes)); } }.run(); } + @Override public void computeUsages(final List targets) { final Project project = myEditor.getProject(); final PsiElementFactory factory = JavaPsiFacade.getInstance(project).getElementFactory(); diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandlerFactory.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandlerFactory.java index 343488c8b81a..eabe0be20adb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandlerFactory.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExceptionsHandlerFactory.java @@ -30,6 +30,7 @@ import java.util.Collection; * @author yole */ public class HighlightExceptionsHandlerFactory implements HighlightUsagesHandlerFactory { + @Override public HighlightUsagesHandlerBase createHighlightUsagesHandler(final Editor editor, final PsiFile file) { int offset = TargetElementUtilBase.adjustOffset(editor.getDocument(), editor.getCaretModel().getOffset()); PsiElement target = file.findElementAt(offset); @@ -79,6 +80,7 @@ public class HighlightExceptionsHandlerFactory implements HighlightUsagesHandler final Collection allThrownExceptions = ExceptionUtil.collectUnhandledExceptions(tryStatement.getTryBlock(), tryStatement.getTryBlock()); Condition filter = new Condition() { + @Override public boolean value(PsiType type) { for (PsiParameter parameter : catchBlockParameters) { boolean isAssignable = parameter.getType().isAssignableFrom(type); diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandler.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandler.java index 2fce52aaf437..c606f93dcede 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandler.java @@ -40,14 +40,17 @@ public class HighlightExitPointsHandler extends HighlightUsagesHandlerBase getTargets() { return Collections.singletonList(myTarget); } + @Override protected void selectTargets(final List targets, final Consumer> selectionConsumer) { selectionConsumer.consume(targets); } + @Override public void computeUsages(final List targets) { FeatureUsageTracker.getInstance().triggerFeatureUsed(ProductivityFeatureNames.CODEASSISTS_HIGHLIGHT_RETURN); diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandlerFactory.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandlerFactory.java index 33c0be77d775..9428f5b3183c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandlerFactory.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightExitPointsHandlerFactory.java @@ -25,6 +25,7 @@ import com.intellij.codeInsight.TargetElementUtilBase; * @author yole */ public class HighlightExitPointsHandlerFactory implements HighlightUsagesHandlerFactory { + @Override public HighlightUsagesHandlerBase createHighlightUsagesHandler(final Editor editor, final PsiFile file) { int offset = TargetElementUtilBase.adjustOffset(editor.getDocument(), editor.getCaretModel().getOffset()); PsiElement target = file.findElementAt(offset); diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandler.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandler.java index 2e923da85c1b..5b19711089da 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandler.java @@ -38,6 +38,7 @@ public class HighlightOverridingMethodsHandler extends HighlightUsagesHandlerBas myClass = psiClass; } + @Override public List getTargets() { PsiReferenceList list = PsiKeyword.EXTENDS.equals(myTarget.getText()) ? myClass.getExtendsList() : myClass.getImplementsList(); if (list == null) return Collections.emptyList(); @@ -45,14 +46,17 @@ public class HighlightOverridingMethodsHandler extends HighlightUsagesHandlerBas return ChooseClassAndDoHighlightRunnable.resolveClasses(classTypes); } + @Override protected void selectTargets(final List targets, final Consumer> selectionConsumer) { new ChooseClassAndDoHighlightRunnable(targets, myEditor, CodeInsightBundle.message("highlight.overridden.classes.chooser.title")) { + @Override protected void selected(PsiClass... classes) { selectionConsumer.consume(Arrays.asList(classes)); } }.run(); } + @Override public void computeUsages(final List classes) { FeatureUsageTracker.getInstance().triggerFeatureUsed("codeassists.highlight.implements"); for (PsiMethod method : myClass.getMethods()) { diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandlerFactory.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandlerFactory.java index 00bda3f1ce95..6315771bd5ec 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandlerFactory.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightOverridingMethodsHandlerFactory.java @@ -23,6 +23,7 @@ import com.intellij.codeInsight.TargetElementUtilBase; * @author yole */ public class HighlightOverridingMethodsHandlerFactory implements HighlightUsagesHandlerFactory { + @Override public HighlightUsagesHandlerBase createHighlightUsagesHandler(final Editor editor, final PsiFile file) { int offset = TargetElementUtilBase.adjustOffset(editor.getDocument(), editor.getCaretModel().getOffset()); final PsiElement target = file.findElementAt(offset); diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsFactory.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsFactory.java index 745387aa546e..c27af352d8fb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsFactory.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsFactory.java @@ -29,6 +29,7 @@ import com.intellij.psi.util.PsiTreeUtil; * @author yole */ public class HighlightSuppressedWarningsFactory implements HighlightUsagesHandlerFactory { + @Override public HighlightUsagesHandlerBase createHighlightUsagesHandler(final Editor editor, final PsiFile file) { int offset = TargetElementUtilBase.adjustOffset(editor.getDocument(), editor.getCaretModel().getOffset()); final PsiElement target = file.findElementAt(offset); diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java index 35f856465785..2f72d9a180a1 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/HighlightSuppressedWarningsHandler.java @@ -62,6 +62,7 @@ public class HighlightSuppressedWarningsHandler extends HighlightUsagesHandlerBa mySuppressedExpression = suppressedExpression; } + @Override public List getTargets() { final List result = new ArrayList(); if (mySuppressedExpression != null) { @@ -84,6 +85,7 @@ public class HighlightSuppressedWarningsHandler extends HighlightUsagesHandlerBa return result; } + @Override protected void selectTargets(List targets, final Consumer> selectionConsumer) { if (targets.size() == 1) { selectionConsumer.consume(targets); @@ -106,6 +108,7 @@ public class HighlightSuppressedWarningsHandler extends HighlightUsagesHandlerBa } } + @Override public void computeUsages(List targets) { final Project project = myTarget.getProject(); final PsiElement parent = myTarget.getParent().getParent(); @@ -130,6 +133,7 @@ public class HighlightSuppressedWarningsHandler extends HighlightUsagesHandlerBa ((RefManagerImpl)context.getRefManager()).inspectionReadActionStarted(); ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator(); Runnable inspect = new Runnable() { + @Override public void run() { pass.doInspectInBatch(managerEx, Collections.singletonList(tool)); } diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaBraceMatcher.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaBraceMatcher.java index 14e9db2b9665..471198e146ba 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaBraceMatcher.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaBraceMatcher.java @@ -34,10 +34,12 @@ public class JavaBraceMatcher implements PairedBraceMatcher { new BracePair(JavaDocTokenType.DOC_INLINE_TAG_START, JavaDocTokenType.DOC_INLINE_TAG_END, false), }; + @Override public BracePair[] getPairs() { return pairs; } + @Override public boolean isPairedBracesAllowedBeforeType(@NotNull final IElementType lbraceType, @Nullable final IElementType contextType) { if (contextType instanceof IJavaElementType) return isPairedBracesAllowedBeforeTypeInJava(contextType); return true; @@ -53,6 +55,7 @@ public class JavaBraceMatcher implements PairedBraceMatcher { || tokenType == JavaTokenType.LBRACE; } + @Override public int getCodeConstructStart(final PsiFile file, int openingBraceOffset) { PsiElement element = file.findElementAt(openingBraceOffset); if (element == null || element instanceof PsiFile) return openingBraceOffset; diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaHighlightUsagesDescriptionProvider.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaHighlightUsagesDescriptionProvider.java index 77049cdfa899..b0cafc83a24c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaHighlightUsagesDescriptionProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaHighlightUsagesDescriptionProvider.java @@ -25,6 +25,7 @@ import org.jetbrains.annotations.NotNull; * @author yole */ public class JavaHighlightUsagesDescriptionProvider implements ElementDescriptionProvider { + @Override public String getElementDescription(@NotNull final PsiElement element, @NotNull final ElementDescriptionLocation location) { if (!(location instanceof HighlightUsagesDescriptionLocation)) return null; diff --git a/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaReadWriteAccessDetector.java b/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaReadWriteAccessDetector.java index 4e397ae0c87d..96929e44e462 100644 --- a/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaReadWriteAccessDetector.java +++ b/java/java-impl/src/com/intellij/codeInsight/highlighting/JavaReadWriteAccessDetector.java @@ -23,10 +23,12 @@ import com.intellij.psi.util.PsiUtil; * @author yole */ public class JavaReadWriteAccessDetector extends ReadWriteAccessDetector { + @Override public boolean isReadWriteAccessible(final PsiElement element) { return element instanceof PsiVariable && !(element instanceof ImplicitVariable); } + @Override public boolean isDeclarationWriteAccess(final PsiElement element) { if (element instanceof PsiVariable && ((PsiVariable)element).getInitializer() != null) { return true; @@ -37,10 +39,12 @@ public class JavaReadWriteAccessDetector extends ReadWriteAccessDetector { return false; } + @Override public Access getReferenceAccess(final PsiElement referencedElement, final PsiReference reference) { return getExpressionAccess(reference.getElement()); } + @Override public Access getExpressionAccess(final PsiElement expression) { if (!(expression instanceof PsiExpression)) return Access.Read; PsiExpression expr = (PsiExpression) expression; diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java b/java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java index 943619b7affb..808cee5ae74a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/AddAnnotationFix.java @@ -70,11 +70,13 @@ public class AddAnnotationFix extends LocalQuickFixAndIntentionActionOnPsiElemen return CodeInsightBundle.message("inspection.i18n.quickfix.annotate.as", shortName); } + @Override @NotNull public String getText() { return myText; } + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.add.annotation.family"); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddAnnotationIntention.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddAnnotationIntention.java index c115b96f83ce..4e0642abe1b5 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddAnnotationIntention.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddAnnotationIntention.java @@ -46,6 +46,7 @@ public abstract class AddAnnotationIntention extends BaseIntentionAction { public abstract Pair getAnnotations(@NotNull Project project); // include not in project files + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { CaretModel caretModel = editor.getCaretModel(); int position = caretModel.getOffset(); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOnDemandStaticImportAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOnDemandStaticImportAction.java index 517f21e8def5..01cc21237bfb 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOnDemandStaticImportAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOnDemandStaticImportAction.java @@ -42,6 +42,7 @@ import java.util.List; public class AddOnDemandStaticImportAction extends PsiElementBaseIntentionAction { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.impl.AddOnDemandStaticImportAction"); + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.add.on.demand.static.import.family"); @@ -81,6 +82,7 @@ public class AddOnDemandStaticImportAction extends PsiElementBaseIntentionAction return psiClass; } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { PsiClass classToImport = getClassToPerformStaticImport(element); if (classToImport != null) { @@ -138,6 +140,7 @@ public class AddOnDemandStaticImportAction extends PsiElementBaseIntentionAction }); expressionToDequalifyOffsets.forEachDescending(new TIntProcedure() { + @Override public boolean execute(int offset) { PsiJavaCodeReferenceElement expression = PsiTreeUtil.findElementOfClassAtOffset(root, offset, PsiJavaCodeReferenceElement.class, false); if (expression == null) { @@ -158,6 +161,7 @@ public class AddOnDemandStaticImportAction extends PsiElementBaseIntentionAction } } + @Override public void invoke(@NotNull final Project project, final Editor editor, PsiFile file) throws IncorrectOperationException { PsiElement element = file.findElementAt(editor.getCaretModel().getOffset()); invoke(project, file, editor, element); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOverrideAnnotationAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOverrideAnnotationAction.java index 8a3e048b54e6..4db64387c0f1 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOverrideAnnotationAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddOverrideAnnotationAction.java @@ -33,16 +33,19 @@ import org.jetbrains.annotations.NotNull; public class AddOverrideAnnotationAction implements IntentionAction { private static final String JAVA_LANG_OVERRIDE = "java.lang.Override"; + @Override @NotNull public String getText() { return CodeInsightBundle.message("intention.add.override.annotation"); } + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.add.override.annotation.family"); } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { if (!PsiUtil.isLanguageLevel5OrHigher(file)) return false; PsiMethod method = findMethod(file, editor.getCaretModel().getOffset()); @@ -59,6 +62,7 @@ public class AddOverrideAnnotationAction implements IntentionAction { return false; } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { PsiMethod method = findMethod(file, editor.getCaretModel().getOffset()); if (method != null) { @@ -80,6 +84,7 @@ public class AddOverrideAnnotationAction implements IntentionAction { return res; } + @Override public boolean startInWriteAction() { return true; } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddSingleMemberStaticImportAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddSingleMemberStaticImportAction.java index f4c2a9a92247..703de16a3ee8 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddSingleMemberStaticImportAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AddSingleMemberStaticImportAction.java @@ -40,6 +40,7 @@ public class AddSingleMemberStaticImportAction extends PsiElementBaseIntentionAc private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.impl.AddSingleMemberStaticImportAction"); private static final Key TEMP_REFERENT_USER_DATA = new Key("TEMP_REFERENT_USER_DATA"); + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.add.single.member.static.import.family"); @@ -105,6 +106,7 @@ public class AddSingleMemberStaticImportAction extends PsiElementBaseIntentionAc return aClass; } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { String classQName = getStaticImportClass(element); if (classQName != null) { @@ -198,6 +200,7 @@ public class AddSingleMemberStaticImportAction extends PsiElementBaseIntentionAc } + @Override public void invoke(@NotNull final Project project, final Editor editor, PsiFile file) throws IncorrectOperationException { PsiElement element = file.findElementAt(editor.getCaretModel().getOffset()); invoke(file, element); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AssignFieldFromParameterAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AssignFieldFromParameterAction.java index 75310d6d5558..9bcd9c8706d4 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/AssignFieldFromParameterAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/AssignFieldFromParameterAction.java @@ -46,6 +46,7 @@ public class AssignFieldFromParameterAction extends BaseIntentionAction { return type; } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { PsiParameter myParameter = CreateFieldFromParameterAction.findParameterAtCursor(file, editor); final PsiType type = getType(myParameter); @@ -70,11 +71,13 @@ public class AssignFieldFromParameterAction extends BaseIntentionAction { return true; } + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.assign.field.from.parameter.family"); } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) { PsiParameter myParameter = CreateFieldFromParameterAction.findParameterAtCursor(file, editor); if (!CodeInsightUtilBase.prepareFileForWrite(myParameter.getContainingFile())) return; diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ColorChooserIntentionAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ColorChooserIntentionAction.java index cf54cac9fe4f..d5b05d045673 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ColorChooserIntentionAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ColorChooserIntentionAction.java @@ -62,6 +62,7 @@ public class ColorChooserIntentionAction extends PsiElementBaseIntentionAction { setText(CodeInsightBundle.message("intention.color.chooser.dialog")); } + @Override public boolean isAvailable(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) { // new Color(...) if (psiElement().inside(psiElement(PsiNewExpression.class)).accepts(element)) { @@ -102,11 +103,13 @@ public class ColorChooserIntentionAction extends PsiElementBaseIntentionAction { return false; } + @Override @NotNull public String getFamilyName() { return getText(); } + @Override public void invoke(@NotNull final Project project, final Editor editor, final PsiFile file) throws IncorrectOperationException { if (!CodeInsightUtilBase.prepareFileForWrite(file)) return; PsiElement element = file.findElementAt(editor.getCaretModel().getOffset()); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConcatenationToMessageFormatAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConcatenationToMessageFormatAction.java index 1bb830647e82..8ae1771837f3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConcatenationToMessageFormatAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConcatenationToMessageFormatAction.java @@ -39,16 +39,19 @@ import java.util.List; * @author ven */ public class ConcatenationToMessageFormatAction implements IntentionAction { + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.replace.concatenation.with.formatted.output.family"); } + @Override @NotNull public String getText() { return CodeInsightBundle.message("intention.replace.concatenation.with.formatted.output.text"); } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { if (!CodeInsightUtilBase.prepareFileForWrite(file)) return; final PsiElement element = findElementAtCaret(editor, file); @@ -124,6 +127,7 @@ public class ConcatenationToMessageFormatAction implements IntentionAction { return newExpr; } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { if (PsiUtil.getLanguageLevel(file).compareTo(LanguageLevel.JDK_1_4) < 0) return false; final PsiElement element = findElementAtCaret(editor, file); @@ -155,6 +159,7 @@ public class ConcatenationToMessageFormatAction implements IntentionAction { } } + @Override public boolean startInWriteAction() { return true; } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertAbsolutePathToRelativeIntentionAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertAbsolutePathToRelativeIntentionAction.java index b684ae9ac5f0..e7b50e9782d3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertAbsolutePathToRelativeIntentionAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertAbsolutePathToRelativeIntentionAction.java @@ -77,11 +77,13 @@ public class ConvertAbsolutePathToRelativeIntentionAction extends PsiElementBase return null; } + @Override @NotNull public String getFamilyName() { return "Convert " + (isConvertToRelative() ? "absolute" : "relative") + " path to " + (isConvertToRelative() ? "relative" : "absolute"); } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { final PsiReference reference = file.findReferenceAt(editor.getCaretModel().getOffset()); final FileReference fileReference = reference == null ? null : findFileReference(reference); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertToBasicLatinAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertToBasicLatinAction.java index cb34e61832b9..e0adc5ec9d61 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertToBasicLatinAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ConvertToBasicLatinAction.java @@ -131,6 +131,7 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction { private static class MyLiteralHandler extends Handler { private static final TokenSet LITERALS = TokenSet.create(JavaTokenType.CHARACTER_LITERAL, JavaTokenType.STRING_LITERAL); + @Override public PsiElement findApplicable(final PsiElement element) { final PsiElement parent = element.getParent(); return element instanceof PsiJavaToken && @@ -139,10 +140,12 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction { ? parent : null; } + @Override public PsiElement createReplacement(final PsiElement element, final String newText) { return JavaPsiFacade.getElementFactory(element.getProject()).createExpressionFromText(newText, element.getParent()); } + @Override protected void convert(final StringBuilder sb, final char ch) { sb.append(String.format("\\u%04x", (int)ch)); } @@ -151,6 +154,7 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction { private static class MyDocCommentHandler extends Handler { private static Map ourEntities = null; + @Override public PsiElement findApplicable(final PsiElement element) { if (element instanceof PsiDocComment) return element; if (element instanceof PsiDocToken) return element.getParent(); @@ -167,6 +171,7 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction { return super.processText(element); } + @Override protected void convert(final StringBuilder sb, final char ch) { assert ourEntities != null; final String entity = ourEntities.get(ch); @@ -178,6 +183,7 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction { } } + @Override public PsiElement createReplacement(final PsiElement element, final String newText) { return JavaPsiFacade.getElementFactory(element.getProject()).createDocCommentFromText(newText); } @@ -202,6 +208,7 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction { ourEntities = new HashMap(); final Pattern pattern = Pattern.compile("&#(\\d+);"); XmlUtil.processXmlElements(file, new PsiElementProcessor() { + @Override public boolean execute(@NotNull PsiElement element) { if (element instanceof XmlEntityDecl) { final XmlEntityDecl entity = (XmlEntityDecl)element; @@ -220,10 +227,12 @@ public class ConvertToBasicLatinAction extends PsiElementBaseIntentionAction { } private static class MyCommentHandler extends MyDocCommentHandler { + @Override public PsiElement findApplicable(final PsiElement element) { return element instanceof PsiComment ? element : null; } + @Override public PsiElement createReplacement(final PsiElement element, final String newText) { return JavaPsiFacade.getElementFactory(element.getProject()).createCommentFromText(newText, element.getParent()); } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationAction.java index 1d80106caa00..3ef09967e05b 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationAction.java @@ -25,19 +25,23 @@ import org.jetbrains.annotations.NotNull; * @author yole */ public class CopyAbstractMethodImplementationAction extends ImplementAbstractMethodAction { + @Override @NotNull public String getFamilyName() { return "Copy Abstract Method Implementation"; } + @Override protected String getIntentionName(final PsiMethod method) { return CodeInsightBundle.message("copy.abstract.method.intention.name", method.getName()); } + @Override protected boolean isAvailable(final MyElementProcessor processor) { return processor.hasMissingImplementations() && processor.hasExistingImplementations(); } + @Override protected void invokeHandler(final Project project, final Editor editor, final PsiMethod method) { new CopyAbstractMethodImplementationHandler(project, editor, method).invoke(); } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationHandler.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationHandler.java index 46f19ad29e43..ddddf94430f7 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationHandler.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CopyAbstractMethodImplementationHandler.java @@ -64,6 +64,7 @@ public class CopyAbstractMethodImplementationHandler { public void invoke() { ProgressManager.getInstance().runProcessWithProgressSynchronously(new Runnable() { + @Override public void run() { searchExistingImplementations(); } @@ -78,6 +79,7 @@ public class CopyAbstractMethodImplementationHandler { } else { Collections.sort(mySourceMethods, new Comparator() { + @Override public int compare(final PsiMethod o1, final PsiMethod o2) { PsiClass c1 = o1.getContainingClass(); PsiClass c2 = o2.getContainingClass(); @@ -88,6 +90,7 @@ public class CopyAbstractMethodImplementationHandler { final JList list = new JBList(methodArray); list.setCellRenderer(new MethodCellRenderer(true)); final Runnable runnable = new Runnable() { + @Override public void run() { int index = list.getSelectedIndex(); if (index < 0) return; @@ -148,6 +151,7 @@ public class CopyAbstractMethodImplementationHandler { private void copyImplementation(final PsiMethod sourceMethod) { final List generatedMethods = new ArrayList(); new WriteCommandAction(myProject, getTargetFiles()) { + @Override protected void run(final Result result) throws Throwable { for (PsiEnumConstant enumConstant : myTargetEnumConstants) { PsiClass initializingClass = enumConstant.getOrCreateInitializingClass(); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateClassDialog.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateClassDialog.java index e2c51dc074b9..2de7be61a346 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateClassDialog.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateClassDialog.java @@ -127,18 +127,22 @@ public class CreateClassDialog extends DialogWrapper { return false; } + @Override protected Action[] createActions() { return new Action[]{getOKAction(), getCancelAction()}; } + @Override public JComponent getPreferredFocusedComponent() { return myClassNameEditable ? myTfClassName : myPackageComponent.getChildComponent(); } + @Override protected JComponent createCenterPanel() { return new JPanel(new BorderLayout()); } + @Override protected JComponent createNorthPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); @@ -160,6 +164,7 @@ public class CreateClassDialog extends DialogWrapper { panel.add(myTfClassName, gbConstraints); myTfClassName.getDocument().addDocumentListener(new DocumentAdapter() { + @Override protected void textChanged(DocumentEvent e) { getOKAction().setEnabled(JavaPsiFacade.getInstance(myProject).getNameHelper().isIdentifier(myTfClassName.getText())); } @@ -177,6 +182,7 @@ public class CreateClassDialog extends DialogWrapper { gbConstraints.weightx = 1; new AnAction() { + @Override public void actionPerformed(AnActionEvent e) { myPackageComponent.getButton().doClick(); } @@ -217,6 +223,7 @@ public class CreateClassDialog extends DialogWrapper { } private static class MyTextField extends JTextField { + @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); FontMetrics fontMetrics = getFontMetrics(getFont()); @@ -225,12 +232,14 @@ public class CreateClassDialog extends DialogWrapper { } } + @Override protected void doOKAction() { RecentsManager.getInstance(myProject).registerRecentEntry(RECENTS_KEY, myPackageComponent.getText()); final String packageName = getPackageName(); final String[] errorString = new String[1]; CommandProcessor.getInstance().executeCommand(myProject, new Runnable() { + @Override public void run() { try { final PackageWrapper targetPackage = new PackageWrapper(PsiManager.getInstance(myProject), packageName); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateFieldFromParameterAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateFieldFromParameterAction.java index e9ada060d17e..20c86c13fe67 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateFieldFromParameterAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateFieldFromParameterAction.java @@ -96,12 +96,14 @@ public class CreateFieldFromParameterAction implements IntentionAction { return new PsiType[]{psiClass instanceof PsiTypeParameter ? subst.substitute((PsiTypeParameter)psiClass) : elementFactory.createType(psiClass, substitutor)}; } + @Override @NotNull public String getText() { if (myName == null) return CodeInsightBundle.message("intention.create.fields.from.parameters.text"); return CodeInsightBundle.message("intention.create.field.from.parameter.text", myName); } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { PsiParameter psiParameter = findParameterAtCursor(file, editor); PsiMethod method = null; @@ -212,11 +214,13 @@ public class CreateFieldFromParameterAction implements IntentionAction { return null; } + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.create.field.from.parameter.family"); } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) { invoke(project, editor, file, !ApplicationManager.getApplication().isUnitTestMode()); } @@ -340,6 +344,7 @@ public class CreateFieldFromParameterAction implements IntentionAction { final String fieldName = fieldNameToCalc; final PsiType fieldType = type; ApplicationManager.getApplication().runWriteAction(new Runnable() { + @Override public void run() { try { PsiManager psiManager = PsiManager.getInstance(project); @@ -476,6 +481,7 @@ public class CreateFieldFromParameterAction implements IntentionAction { return i; } + @Override public boolean startInWriteAction() { return false; } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateFieldFromParameterDialog.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateFieldFromParameterDialog.java index 7ae479d31300..7465ed54930c 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateFieldFromParameterDialog.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateFieldFromParameterDialog.java @@ -63,6 +63,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { init(); } + @Override protected void doOKAction() { if (myCbFinal.isEnabled()) { PropertiesComponent.getInstance().setValue(PROPERTY_NAME, ""+myCbFinal.isSelected()); @@ -88,6 +89,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { close(OK_EXIT_CODE); } + @Override protected void init() { super.init(); updateOkStatus(); @@ -111,6 +113,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { return false; } + @Override protected JComponent createNorthPanel() { if (myNames.length > 1) { final ComboBox combobox = new ComboBox(myNames, 200); @@ -121,6 +124,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { combobox.registerKeyboardAction( new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { if (combobox.isPopupVisible()) { combobox.setPopupVisible(false); @@ -136,6 +140,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { combobox.addItemListener( new ItemListener() { + @Override public void itemStateChanged(ItemEvent e) { updateOkStatus(); } @@ -143,14 +148,17 @@ class CreateFieldFromParameterDialog extends DialogWrapper { ); combobox.getEditor().getEditorComponent().addKeyListener( new KeyAdapter() { + @Override public void keyPressed(KeyEvent e) { updateOkStatus(); } + @Override public void keyReleased(KeyEvent e) { updateOkStatus(); } + @Override public void keyTyped(KeyEvent e) { updateOkStatus(); } @@ -159,6 +167,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { } else { JTextField field = new JTextField() { + @Override public Dimension getPreferredSize() { Dimension size = super.getPreferredSize(); return new Dimension(200, size.height); @@ -168,6 +177,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { field.setText(myNames[0]); field.getDocument().addDocumentListener(new DocumentAdapter() { + @Override protected void textChanged(DocumentEvent e) { updateOkStatus(); } @@ -215,6 +225,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { return panel; } + @Override protected JComponent createCenterPanel() { JPanel panel = new JPanel(new GridBagLayout()); GridBagConstraints gbConstraints = new GridBagConstraints(); @@ -237,6 +248,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { gbConstraints.gridy++; panel.add(myCbFinal, gbConstraints); myCbFinal.addActionListener(new ActionListener() { + @Override public void actionPerformed(ActionEvent e) { requestFocusInNameWindow(); if (myCbFinal.isEnabled()) { @@ -261,6 +273,7 @@ class CreateFieldFromParameterDialog extends DialogWrapper { setOKActionEnabled(JavaPsiFacade.getInstance(myProject).getNameHelper().isIdentifier(text)); } + @Override public JComponent getPreferredFocusedComponent() { return myNameField; } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateSubclassAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateSubclassAction.java index 0443aa583b26..8915247aba5e 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateSubclassAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/CreateSubclassAction.java @@ -64,11 +64,13 @@ public class CreateSubclassAction extends BaseIntentionAction { private String myText = CodeInsightBundle.message("intention.implement.abstract.class.default.text"); @NonNls private static final String IMPL_SUFFIX = "Impl"; + @Override @NotNull public String getText() { return myText; } + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.implement.abstract.class.family"); @@ -120,6 +122,7 @@ public class CreateSubclassAction extends BaseIntentionAction { : CodeInsightBundle.message("intention.implement.abstract.class.subclass.text"); } + @Override public void invoke(@NotNull final Project project, Editor editor, final PsiFile file) throws IncorrectOperationException { PsiElement element = file.findElementAt(editor.getCaretModel().getOffset()); final PsiClass psiClass = PsiTreeUtil.getParentOfType(element, PsiClass.class); @@ -196,6 +199,7 @@ public class CreateSubclassAction extends BaseIntentionAction { } catch (final IncorrectOperationException e) { ApplicationManager.getApplication().invokeLater(new Runnable() { + @Override public void run() { Messages.showErrorDialog(project, CodeInsightBundle.message("intention.error.cannot.create.class.message", className) + "\n"+e.getLocalizedMessage(), @@ -308,6 +312,7 @@ public class CreateSubclassAction extends BaseIntentionAction { OverrideImplementUtil.chooseAndImplementMethods(project, editor, targetClass); } + @Override public boolean startInWriteAction() { return false; } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/DeannotateIntentionAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/DeannotateIntentionAction.java index bc58bb5db148..16cecf4d10d0 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/DeannotateIntentionAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/DeannotateIntentionAction.java @@ -43,16 +43,19 @@ public class DeannotateIntentionAction implements IntentionAction { private static final Logger LOG = Logger.getInstance("#" + DeannotateIntentionAction.class.getName()); private String myAnnotationName = null; + @Override @NotNull public String getText() { return CodeInsightBundle.message("deannotate.intention.action.text") + (myAnnotationName != null ? " " + myAnnotationName : ""); } + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("deannotate.intention.action.text"); } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { PsiModifierListOwner listOwner = getContainer(editor, file); if (listOwner != null) { @@ -119,13 +122,16 @@ public class DeannotateIntentionAction implements IntentionAction { return listOwner; } + @Override public void invoke(@NotNull final Project project, Editor editor, final PsiFile file) throws IncorrectOperationException { final PsiModifierListOwner listOwner = getContainer(editor, file); final ExternalAnnotationsManager annotationsManager = ExternalAnnotationsManager.getInstance(project); final PsiAnnotation[] externalAnnotations = annotationsManager.findExternalAnnotations(listOwner); JBPopupFactory.getInstance().createListPopup(new BaseListPopupStep(CodeInsightBundle.message("deannotate.intention.chooser.title"), externalAnnotations) { + @Override public PopupStep onChosen(final PsiAnnotation selectedValue, final boolean finalChoice) { new WriteCommandAction(project){ + @Override protected void run(final Result result) throws Throwable { final VirtualFile virtualFile = file.getVirtualFile(); if (annotationsManager.deannotate(listOwner, selectedValue.getQualifiedName()) && virtualFile != null && virtualFile.isInLocalFileSystem()) { @@ -136,6 +142,7 @@ public class DeannotateIntentionAction implements IntentionAction { return PopupStep.FINAL_CHOICE; } + @Override @NotNull public String getTextFor(final PsiAnnotation value) { final String qualifiedName = value.getQualifiedName(); @@ -145,6 +152,7 @@ public class DeannotateIntentionAction implements IntentionAction { }).showInBestPositionFor(editor); } + @Override public boolean startInWriteAction() { return false; } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ExpandStaticImportAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ExpandStaticImportAction.java index 8bae1c958ce7..3816bb26fdd2 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ExpandStaticImportAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ExpandStaticImportAction.java @@ -40,11 +40,13 @@ public class ExpandStaticImportAction extends PsiElementBaseIntentionAction { private static final String REPLACE_THIS_OCCURRENCE = "Replace this occurrence and keep the method"; private static final String REPLACE_ALL_AND_DELETE_IMPORT = "Replace all and delete the import"; + @Override @NotNull public String getFamilyName() { return "Expand Static Import"; } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { if (!PsiUtil.isLanguageLevel5OrHigher(element)) return false; final PsiElement parent = element.getParent(); @@ -106,6 +108,7 @@ public class ExpandStaticImportAction extends PsiElementBaseIntentionAction { } } + @Override public void invoke(@NotNull final Project project, final Editor editor, PsiFile file) throws IncorrectOperationException { PsiElement element = file.findElementAt(editor.getCaretModel().getOffset()); invoke(project, file, editor, element); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodAction.java index 7cc59283d340..aa96124826ef 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/ImplementAbstractMethodAction.java @@ -38,11 +38,13 @@ import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; public class ImplementAbstractMethodAction extends BaseIntentionAction { + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.implement.abstract.method.family"); } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { int offset = editor.getCaretModel().getOffset(); final PsiMethod method = findMethod(file, offset); @@ -114,6 +116,7 @@ public class ImplementAbstractMethodAction extends BaseIntentionAction { return myHasExistingImplementations; } + @Override public boolean execute(@NotNull PsiElement element) { if (element instanceof PsiClass) { PsiClass aClass = (PsiClass) element; @@ -160,6 +163,7 @@ public class ImplementAbstractMethodAction extends BaseIntentionAction { return PsiTreeUtil.getParentOfType(file.findElementAt(offset), PsiMethod.class); } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { PsiMethod method = findMethod(file, editor.getCaretModel().getOffset()); if (method == null) return; @@ -171,6 +175,7 @@ public class ImplementAbstractMethodAction extends BaseIntentionAction { new ImplementAbstractMethodHandler(project, editor, method).invoke(); } + @Override public boolean startInWriteAction() { return false; } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/InvertIfConditionAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/InvertIfConditionAction.java index 52b60ac4af50..57a689dfd54a 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/InvertIfConditionAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/InvertIfConditionAction.java @@ -44,6 +44,7 @@ import java.util.List; public class InvertIfConditionAction extends PsiElementBaseIntentionAction { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.impl.InvertIfConditionAction"); + @Override public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { int offset = editor.getCaretModel().getOffset(); @@ -66,16 +67,19 @@ public class InvertIfConditionAction extends PsiElementBaseIntentionAction { return block != null; } + @Override @NotNull public String getText() { return getFamilyName(); } + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.invert.if.condition"); } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { if (!CodeInsightUtilBase.prepareFileForWrite(file)) return; diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/MoveFieldAssignmentToInitializerAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/MoveFieldAssignmentToInitializerAction.java index 9a8fe6f60cbe..8c21b3eada95 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/MoveFieldAssignmentToInitializerAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/MoveFieldAssignmentToInitializerAction.java @@ -39,16 +39,19 @@ import java.util.List; * @author cdr */ public class MoveFieldAssignmentToInitializerAction extends BaseIntentionAction { + @Override @NotNull public String getFamilyName() { return getText(); } + @Override @NotNull public String getText() { return CodeInsightBundle.message("intention.move.field.assignment.to.declaration"); } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { final PsiAssignmentExpression assignment = getAssignmentUnderCaret(editor, file); if (assignment == null) return false; @@ -155,6 +158,7 @@ public class MoveFieldAssignmentToInitializerAction extends BaseIntentionAction return PsiTreeUtil.getParentOfType(element, PsiAssignmentExpression.class, false, PsiMember.class); } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { final PsiAssignmentExpression assignment = getAssignmentUnderCaret(editor, file); if (assignment == null) return; diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/MoveInitializerToConstructorAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/MoveInitializerToConstructorAction.java index 4301a17efae9..82deb5925d89 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/MoveInitializerToConstructorAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/MoveInitializerToConstructorAction.java @@ -43,16 +43,19 @@ import java.util.*; * @author cdr */ public class MoveInitializerToConstructorAction extends PsiElementBaseIntentionAction { + @Override @NotNull public String getFamilyName() { return getText(); } + @Override @NotNull public String getText() { return CodeInsightBundle.message("intention.move.initializer.to.constructor"); } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { if (element instanceof PsiCompiledElement) return false; final PsiField field = PsiTreeUtil.getParentOfType(element, PsiField.class, false, PsiMember.class, PsiCodeBlock.class, PsiDocComment.class); @@ -63,6 +66,7 @@ public class MoveInitializerToConstructorAction extends PsiElementBaseIntentionA return psiClass != null && !psiClass.isInterface() && !(psiClass instanceof PsiAnonymousClass) && !(psiClass instanceof JspClass); } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { if (!CodeInsightUtilBase.prepareFileForWrite(file)) return; diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SimplifyBooleanExpressionAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SimplifyBooleanExpressionAction.java index 1d0c42d24475..c70344b874c3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SimplifyBooleanExpressionAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SimplifyBooleanExpressionAction.java @@ -30,16 +30,19 @@ import com.intellij.util.IncorrectOperationException; import org.jetbrains.annotations.NotNull; public class SimplifyBooleanExpressionAction implements IntentionAction{ + @Override @NotNull public String getText() { return getFamilyName(); } + @Override @NotNull public String getFamilyName() { return new SimplifyBooleanExpressionFix(null,null).getFamilyName(); } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { PsiExpression expression = getExpressionToSimplify(editor, file); return expression != null && SimplifyBooleanExpressionFix.canBeSimplified(expression); @@ -58,12 +61,14 @@ public class SimplifyBooleanExpressionAction implements IntentionAction{ return expression; } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { if (!CodeInsightUtilBase.prepareFileForWrite(file)) return; PsiExpression expression = getExpressionToSimplify(editor, file); SimplifyBooleanExpressionFix.simplifyExpression(expression); } + @Override public boolean startInWriteAction() { return true; } diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SplitDeclarationAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SplitDeclarationAction.java index da5558d9c490..2815824f8007 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SplitDeclarationAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SplitDeclarationAction.java @@ -31,11 +31,13 @@ import org.jetbrains.annotations.NotNull; * @author max */ public class SplitDeclarationAction extends PsiElementBaseIntentionAction { + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.split.declaration.family"); } + @Override public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { if (element instanceof PsiCompiledElement) return false; @@ -86,6 +88,7 @@ public class SplitDeclarationAction extends PsiElementBaseIntentionAction { return false; } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException { if (!CodeInsightUtilBase.prepareFileForWrite(file)) return; diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SplitIfAction.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SplitIfAction.java index ecabce5c2eb4..269995d26e09 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/SplitIfAction.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/SplitIfAction.java @@ -35,6 +35,7 @@ import org.jetbrains.annotations.NotNull; public class SplitIfAction extends PsiElementBaseIntentionAction { private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.intention.impl.SplitIfAction"); + @Override public boolean isAvailable(@NotNull Project project, Editor editor, @NotNull PsiElement element) { if (!(element instanceof PsiJavaToken)) { return false; @@ -64,11 +65,13 @@ public class SplitIfAction extends PsiElementBaseIntentionAction { return true; } + @Override @NotNull public String getFamilyName() { return CodeInsightBundle.message("intention.split.if.family"); } + @Override public void invoke(@NotNull Project project, Editor editor, PsiFile file) { try { diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/TypeExpression.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/TypeExpression.java index a7814b6a718c..8f9ad7e76846 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/TypeExpression.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/TypeExpression.java @@ -41,6 +41,7 @@ public class TypeExpression extends Expression { } } + @Override public Result calculateResult(ExpressionContext context) { final Project project = context.getProject(); PsiDocumentManager.getInstance(project).commitAllDocuments(); @@ -55,10 +56,12 @@ public class TypeExpression extends Expression { }; } + @Override public Result calculateQuickResult(ExpressionContext context) { return calculateResult(context); } + @Override public LookupElement[] calculateLookupItems(ExpressionContext context) { if (myItems.size() <= 1) return null; PsiDocumentManager.getInstance(context.getProject()).commitAllDocuments(); diff --git a/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java b/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java index 3d4631a47087..6b241e3080a3 100644 --- a/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java +++ b/java/java-impl/src/com/intellij/codeInsight/intention/impl/config/QuickFixFactoryImpl.java @@ -31,6 +31,7 @@ import org.jetbrains.annotations.Nullable; * @author cdr */ public class QuickFixFactoryImpl extends QuickFixFactory { + @Override public LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierList modifierList, @NotNull String modifier, boolean shouldHave, @@ -38,6 +39,7 @@ public class QuickFixFactoryImpl extends QuickFixFactory { return new ModifierFix(modifierList, modifier, shouldHave,showContainingClass); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createModifierListFix(@NotNull PsiModifierListOwner owner, @NotNull final String modifier, final boolean shouldHave, @@ -45,30 +47,36 @@ public class QuickFixFactoryImpl extends QuickFixFactory { return new ModifierFix(owner, modifier, shouldHave, showContainingClass); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createMethodReturnFix(@NotNull PsiMethod method, @NotNull PsiType toReturn, boolean fixWholeHierarchy) { return new MethodReturnTypeFix(method, toReturn, fixWholeHierarchy); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createAddMethodFix(@NotNull PsiMethod method, @NotNull PsiClass toClass) { return new AddMethodFix(method, toClass); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createAddMethodFix(@NotNull String methodText, @NotNull PsiClass toClass, String... exceptions) { return new AddMethodFix(methodText, toClass, exceptions); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiClass aClass) { return new ImplementMethodsFix(aClass); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createImplementMethodsFix(@NotNull PsiElement psiElement) { return new ImplementMethodsFix(psiElement); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createMethodThrowsFix(@NotNull PsiMethod method, @NotNull PsiClassType exceptionClass, boolean shouldThrow, @@ -76,6 +84,7 @@ public class QuickFixFactoryImpl extends QuickFixFactory { return new MethodThrowsFix(method, exceptionClass, shouldThrow, showContainingClass); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createAddDefaultConstructorFix(@NotNull PsiClass aClass) { return new AddDefaultConstructorFix(aClass); } @@ -85,6 +94,7 @@ public class QuickFixFactoryImpl extends QuickFixFactory { return new AddDefaultConstructorFix(aClass, modifier); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createMethodParameterTypeFix(@NotNull PsiMethod method, int index, @NotNull PsiType newType, @@ -92,38 +102,46 @@ public class QuickFixFactoryImpl extends QuickFixFactory { return new MethodParameterFix(method, newType, index, fixWholeHierarchy); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createMakeClassInterfaceFix(@NotNull PsiClass aClass) { return new MakeClassInterfaceFix(aClass, true); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createMakeClassInterfaceFix(@NotNull PsiClass aClass, final boolean makeInterface) { return new MakeClassInterfaceFix(aClass, makeInterface); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createExtendsListFix(@NotNull PsiClass aClass, @NotNull PsiClassType typeToExtendFrom, boolean toAdd) { return new ExtendsListFix(aClass, typeToExtendFrom, toAdd); } + @Override public LocalQuickFixAndIntentionActionOnPsiElement createRemoveUnusedParameterFix(@NotNull PsiParameter parameter) { return new RemoveUnusedParameterFix(parameter); } + @Override public IntentionAction createRemoveUnusedVariableFix(@NotNull PsiVariable variable) { return new RemoveUnusedVariableFix(variable); } + @Override @Nullable public IntentionAction createCreateClassOrPackageFix(@NotNull final PsiElement context, @NotNull final String qualifiedName, final boolean createClass, final String superClass) { return CreateClassOrPackageFix.createFix(qualifiedName, context, createClass ? ClassKind.CLASS : null, superClass); } + @Override @Nullable public IntentionAction createCreateClassOrInterfaceFix(@NotNull final PsiElement context, @NotNull final String qualifiedName, final boolean createClass, final String superClass) { return CreateClassOrPackageFix.createFix(qualifiedName, context, createClass ? ClassKind.CLASS : ClassKind.INTERFACE, superClass); } + @Override public IntentionAction createCreateFieldOrPropertyFix(final PsiClass aClass, final String name, final PsiType type, final PropertyMemberType targetMember, final PsiAnnotation... annotations) { return new CreateFieldOrPropertyFix(aClass, name, type, targetMember, annotations); }