diff --git a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodDialog.java b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodDialog.java index fd5b5ae3f2a3..83ada1807a2f 100644 --- a/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodDialog.java +++ b/java/java-impl/src/com/intellij/refactoring/inline/InlineMethodDialog.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,6 +22,7 @@ import com.intellij.psi.PsiJavaCodeReferenceElement; import com.intellij.psi.PsiMethod; import com.intellij.psi.PsiSubstitutor; import com.intellij.psi.util.PsiFormatUtil; +import com.intellij.psi.util.PsiFormatUtilBase; import com.intellij.refactoring.HelpID; import com.intellij.refactoring.JavaRefactoringSettings; import com.intellij.refactoring.RefactoringBundle; @@ -50,20 +51,25 @@ public class InlineMethodDialog extends InlineOptionsWithSearchSettingsDialog { init(); } + @Override protected String getNameLabelText() { String methodText = PsiFormatUtil.formatMethod(myMethod, - PsiSubstitutor.EMPTY, PsiFormatUtil.SHOW_NAME | PsiFormatUtil.SHOW_PARAMETERS, PsiFormatUtil.SHOW_TYPE); + PsiSubstitutor.EMPTY, PsiFormatUtilBase.SHOW_NAME | PsiFormatUtilBase.SHOW_PARAMETERS, + PsiFormatUtilBase.SHOW_TYPE); return RefactoringBundle.message("inline.method.method.label", methodText); } + @Override protected String getBorderTitle() { return RefactoringBundle.message("inline.method.border.title"); } + @Override protected String getInlineThisText() { return RefactoringBundle.message("this.invocation.only.and.keep.the.method"); } + @Override protected String getInlineAllText() { final String occurrencesString = myOccurrencesNumber > -1 ? " (" + myOccurrencesNumber + " occurrence" + (myOccurrencesNumber == 1 ? ")" : "s)") : ""; return (myMethod.isWritable() @@ -71,6 +77,7 @@ public class InlineMethodDialog extends InlineOptionsWithSearchSettingsDialog { : RefactoringBundle.message("all.invocations.in.project")) + occurrencesString; } + @Override protected void doAction() { super.doAction(); invokeRefactoring( @@ -82,15 +89,18 @@ public class InlineMethodDialog extends InlineOptionsWithSearchSettingsDialog { } } + @Override protected void doHelpAction() { if (myMethod.isConstructor()) HelpManager.getInstance().invokeHelp(HelpID.INLINE_CONSTRUCTOR); else HelpManager.getInstance().invokeHelp(HelpID.INLINE_METHOD); } + @Override protected boolean canInlineThisOnly() { return InlineMethodHandler.checkRecursive(myMethod) || myAllowInlineThisOnly; } + @Override protected boolean isInlineThis() { return JavaRefactoringSettings.getInstance().INLINE_METHOD_THIS; } diff --git a/platform/core-api/src/com/intellij/concurrency/DoWhile.java b/platform/core-api/src/com/intellij/concurrency/DoWhile.java index ca30563b0184..b77e3258c984 100644 --- a/platform/core-api/src/com/intellij/concurrency/DoWhile.java +++ b/platform/core-api/src/com/intellij/concurrency/DoWhile.java @@ -20,7 +20,7 @@ import org.jetbrains.annotations.NotNull; /** * Author: dmitrylomov */ -public abstract class DoWhile { +public abstract class DoWhile { private final AsyncFutureResult myResult = AsyncFutureFactory.getInstance().createAsyncFutureResult(); private final SameThreadExecutorWithTrampoline myExecutor = new SameThreadExecutorWithTrampoline(); diff --git a/platform/core-api/src/com/intellij/util/UniqueResultsQuery.java b/platform/core-api/src/com/intellij/util/UniqueResultsQuery.java index 4393040f09ad..83012f461486 100644 --- a/platform/core-api/src/com/intellij/util/UniqueResultsQuery.java +++ b/platform/core-api/src/com/intellij/util/UniqueResultsQuery.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -62,15 +62,15 @@ public class UniqueResultsQuery implements Query { return processAsync(consumer, Collections.synchronizedSet(new THashSet(myHashingStrategy))); } - private boolean process(final Processor consumer, final Set processedElements) { + private boolean process(@NotNull Processor consumer, @NotNull Set processedElements) { return myOriginal.forEach(new MyProcessor(processedElements, consumer)); } - private AsyncFuture processAsync(final Processor consumer, final Set processedElements) { + @NotNull + private AsyncFuture processAsync(@NotNull Processor consumer, @NotNull Set processedElements) { return myOriginal.forEachAsync(new MyProcessor(processedElements, consumer)); } - @Override @NotNull public Collection findAll() { @@ -102,7 +102,7 @@ public class UniqueResultsQuery implements Query { private final Set myProcessedElements; private final Processor myConsumer; - public MyProcessor(Set processedElements, Processor consumer) { + public MyProcessor(@NotNull Set processedElements, @NotNull Processor consumer) { myProcessedElements = processedElements; myConsumer = consumer; } @@ -112,4 +112,10 @@ public class UniqueResultsQuery implements Query { return !myProcessedElements.add(myMapper.fun(t)) || myConsumer.process(t); } } + + @SuppressWarnings("HardCodedStringLiteral") + @Override + public String toString() { + return "UniqueQuery: "+myOriginal; + } } diff --git a/platform/indexing-api/src/com/intellij/psi/search/QuerySearchRequest.java b/platform/indexing-api/src/com/intellij/psi/search/QuerySearchRequest.java index 4160d628087a..08b8f12c1061 100644 --- a/platform/indexing-api/src/com/intellij/psi/search/QuerySearchRequest.java +++ b/platform/indexing-api/src/com/intellij/psi/search/QuerySearchRequest.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2012 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -40,10 +40,11 @@ public class QuerySearchRequest { this.processor = new ReadActionProcessor() { @Override public boolean processInReadAction(PsiReference psiReference) { - return processor.process(psiReference, collector); + return processor.process(psiReference, collector); } }; - } else { + } + else { this.processor = new Processor() { @Override public boolean process(PsiReference psiReference) { @@ -51,10 +52,14 @@ public class QuerySearchRequest { } }; } - } public void runQuery() { query.forEach(processor); } + + @Override + public String toString() { + return query + " -> " + collector; + } } diff --git a/platform/indexing-api/src/com/intellij/psi/search/SearchRequestQuery.java b/platform/indexing-api/src/com/intellij/psi/search/SearchRequestQuery.java index 6ba2f7eb6458..cd0ffad6b7e1 100644 --- a/platform/indexing-api/src/com/intellij/psi/search/SearchRequestQuery.java +++ b/platform/indexing-api/src/com/intellij/psi/search/SearchRequestQuery.java @@ -1,3 +1,18 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.search; import com.intellij.concurrency.AsyncFuture; @@ -29,4 +44,9 @@ public class SearchRequestQuery extends AbstractQuery { protected boolean processResults(@NotNull Processor consumer) { return PsiSearchHelper.SERVICE.getInstance(myProject).processRequests(myRequests, consumer); } + + @Override + public String toString() { + return myRequests.toString(); + } } diff --git a/platform/indexing-api/src/com/intellij/psi/search/searches/ReferenceDescriptor.java b/platform/indexing-api/src/com/intellij/psi/search/searches/ReferenceDescriptor.java index 7621f4d6f16e..7653595d4e2b 100644 --- a/platform/indexing-api/src/com/intellij/psi/search/searches/ReferenceDescriptor.java +++ b/platform/indexing-api/src/com/intellij/psi/search/searches/ReferenceDescriptor.java @@ -1,15 +1,32 @@ +/* + * Copyright 2000-2013 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ package com.intellij.psi.search.searches; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiReference; import com.intellij.util.Function; +import org.jetbrains.annotations.NotNull; /** * @author max */ public class ReferenceDescriptor { public static final Function MAPPER = new Function() { + @Override public ReferenceDescriptor fun(PsiReference psiReference) { final PsiElement element = psiReference.getElement(); final PsiFile file = element.getContainingFile(); @@ -19,7 +36,7 @@ public class ReferenceDescriptor { private final PsiFile file; private final int offset; - ReferenceDescriptor(PsiFile file, int offset) { + ReferenceDescriptor(@NotNull PsiFile file, int offset) { this.file = file; this.offset = offset; } diff --git a/platform/indexing-api/src/com/intellij/psi/search/searches/ReferencesSearch.java b/platform/indexing-api/src/com/intellij/psi/search/searches/ReferencesSearch.java index e197604860ad..4b1df844807b 100644 --- a/platform/indexing-api/src/com/intellij/psi/search/searches/ReferencesSearch.java +++ b/platform/indexing-api/src/com/intellij/psi/search/searches/ReferencesSearch.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2009 JetBrains s.r.o. + * Copyright 2000-2013 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -133,9 +133,7 @@ public class ReferencesSearch extends ExtensibleQueryFactory processor) { final SearchRequestCollector nested = new SearchRequestCollector(collector.getSearchSession()); - collector.searchQuery(new QuerySearchRequest(search(new SearchParameters(element, searchScope, ignoreAccessScope, nested)), nested, - inReadAction, processor)); + Query query = search(new SearchParameters(element, searchScope, ignoreAccessScope, nested)); + collector.searchQuery(new QuerySearchRequest(query, nested, inReadAction, processor)); } - - } diff --git a/platform/util/src/com/intellij/util/text/StringSearcher.java b/platform/util/src/com/intellij/util/text/StringSearcher.java index 3daf80fb5d7b..f08c33d0ebe6 100644 --- a/platform/util/src/com/intellij/util/text/StringSearcher.java +++ b/platform/util/src/com/intellij/util/text/StringSearcher.java @@ -175,13 +175,14 @@ public class StringSearcher { /** * @deprecated Use {@link #scan(CharSequence)} instead - * @param text - * @param startOffset - * @param endOffset - * @return */ public int scan(char[] text, int startOffset, int endOffset){ final int res = scan(new CharArrayCharSequence(text),text, startOffset, endOffset); return res >= 0 ? res: -1; } + + @Override + public String toString() { + return "pattern " + myPattern; + } }