mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+3
-1
@@ -272,7 +272,9 @@ public class HighlightMethodUtil {
|
||||
List<PsiClassType> checkedExceptions = new ArrayList<>();
|
||||
for (int i = 0; i < exceptions.length; i++) {
|
||||
PsiClassType exception = exceptions[i];
|
||||
LOG.assertTrue(exception != null, "throws: " + method.getThrowsList().getText() + "; method: " + method);
|
||||
if (exception == null) {
|
||||
LOG.error("throws: " + method.getThrowsList().getText() + "; method: " + method);
|
||||
}
|
||||
if (!ExceptionUtil.isUncheckedException(exception)) {
|
||||
checkedExceptions.add(exception);
|
||||
if (includeRealPositionInfo && i < referenceElements.length) {
|
||||
|
||||
+3
-3
@@ -33,11 +33,11 @@ import org.jetbrains.annotations.Nullable;
|
||||
*/
|
||||
public class DefaultFileTemplateUsageInspection extends BaseJavaLocalInspectionTool {
|
||||
// Fields are left for the compatibility
|
||||
@Deprecated @SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public boolean CHECK_FILE_HEADER = true;
|
||||
@Deprecated @SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public boolean CHECK_TRY_CATCH_SECTION = true;
|
||||
@Deprecated @SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public boolean CHECK_METHOD_BODY = true;
|
||||
|
||||
@Override
|
||||
|
||||
-1
@@ -54,7 +54,6 @@ public class MethodImplementationsSearch implements QueryExecutor<PsiElement, De
|
||||
return OverridingMethodsSearch.search(method, scope, true).forEach(processor);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public static PsiMethod[] getMethodImplementations(final PsiMethod method, SearchScope scope) {
|
||||
List<PsiMethod> result = new ArrayList<>();
|
||||
|
||||
+63
-5
@@ -32,12 +32,10 @@ import com.intellij.structuralsearch.plugin.replace.impl.Replacer;
|
||||
import com.intellij.structuralsearch.plugin.replace.impl.ReplacerUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.siyeh.ig.psiutils.ImportUtils;
|
||||
import com.siyeh.ig.psiutils.PsiElementOrderComparator;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @author Eugene.Kudelevsky
|
||||
@@ -222,13 +220,73 @@ public class JavaReplaceHandler extends StructuralReplaceHandler {
|
||||
copyExtendsListIfNotReplaced(originalClass, queryClass, replacementClass);
|
||||
copyImplementsListIfNotReplaced(originalClass, queryClass, replacementClass);
|
||||
copyTypeParameterListIfNotReplaced(originalClass, queryClass, replacementClass);
|
||||
|
||||
copyUnmatchedMembers(originalClass, originalNamedElements, replacementClass);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyUnmatchedMembers(PsiClass originalClass,
|
||||
Map<String, PsiNamedElement> originalNamedElements,
|
||||
PsiClass replacementClass) {
|
||||
final List<? extends PsiElement> elements = originalClass.getUserData(GlobalMatchingVisitor.UNMATCHED_ELEMENTS_KEY);
|
||||
if (elements == null) {
|
||||
return;
|
||||
}
|
||||
final List<PsiNamedElement> anchors = PsiTreeUtil.getChildrenOfTypeAsList(replacementClass, PsiNamedElement.class);
|
||||
for (PsiNamedElement anchor : anchors) {
|
||||
final String replacedMemberName = anchor.getName();
|
||||
final PsiNamedElement originalMember = originalNamedElements.get(replacedMemberName);
|
||||
if (originalMember == null) {
|
||||
continue;
|
||||
}
|
||||
for (Iterator<? extends PsiElement> iterator = elements.iterator(); iterator.hasNext(); ) {
|
||||
PsiElement element = iterator.next();
|
||||
if (PsiElementOrderComparator.getInstance().compare(element, originalMember) < 0) {
|
||||
addElementAndWhitespaceBeforeAnchor(replacementClass, element, anchor);
|
||||
iterator.remove();
|
||||
}
|
||||
else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
final PsiElement anchor = replacementClass.getRBrace();
|
||||
if (anchor == null) {
|
||||
return;
|
||||
}
|
||||
for (PsiElement element : elements) {
|
||||
addElementAndWhitespaceBeforeAnchor(replacementClass, element, anchor);
|
||||
}
|
||||
}
|
||||
|
||||
private static void addElementAndWhitespaceBeforeAnchor(PsiClass replacementClass, PsiElement element, PsiElement anchor) {
|
||||
final PsiElement replacementSibling = anchor.getPrevSibling();
|
||||
if (replacementSibling instanceof PsiWhiteSpace) {
|
||||
replacementSibling.delete();
|
||||
}
|
||||
final PsiElement prevSibling = element.getPrevSibling();
|
||||
if (prevSibling instanceof PsiWhiteSpace || PsiUtil.isJavaToken(prevSibling, JavaTokenType.COMMA)) {
|
||||
final PsiElement prevPrevSibling = prevSibling.getPrevSibling();
|
||||
if (PsiUtil.isJavaToken(prevPrevSibling, JavaTokenType.COMMA)) {
|
||||
replacementClass.addBefore(prevPrevSibling, anchor);
|
||||
}
|
||||
replacementClass.addBefore(prevSibling, anchor);
|
||||
}
|
||||
replacementClass.addBefore(element, anchor);
|
||||
final PsiElement nextSibling = element.getNextSibling();
|
||||
if (nextSibling instanceof PsiWhiteSpace) {
|
||||
replacementClass.addBefore(nextSibling, anchor);
|
||||
}
|
||||
}
|
||||
|
||||
private static void copyMethodBodyIfNotReplaced(PsiMethod original, PsiMethod query, PsiMethod replacement) {
|
||||
final PsiCodeBlock originalBody = original.getBody();
|
||||
if (originalBody != null && query.getBody() == null && replacement.getBody() == null) {
|
||||
final PsiElement sibling = originalBody.getPrevSibling();
|
||||
if (sibling instanceof PsiWhiteSpace) {
|
||||
replacement.add(sibling);
|
||||
}
|
||||
replacement.add(originalBody);
|
||||
}
|
||||
}
|
||||
@@ -328,7 +386,7 @@ public class JavaReplaceHandler extends StructuralReplaceHandler {
|
||||
|
||||
if (replacement instanceof PsiTryStatement) {
|
||||
final PsiTryStatement tryStatement = (PsiTryStatement)replacement;
|
||||
final List<PsiElement> unmatchedElements = elementToReplace.getUserData(GlobalMatchingVisitor.UNMATCHED_ELEMENTS_KEY);
|
||||
final List<? extends PsiElement> unmatchedElements = elementToReplace.getUserData(GlobalMatchingVisitor.UNMATCHED_ELEMENTS_KEY);
|
||||
if (unmatchedElements != null) {
|
||||
final PsiElement firstElement = unmatchedElements.get(0);
|
||||
if (firstElement instanceof PsiResourceList) addElementAfterAnchor(tryStatement, firstElement, tryStatement.getFirstChild());
|
||||
|
||||
+3
-18
@@ -18,7 +18,6 @@ package com.intellij.structuralsearch;
|
||||
import com.intellij.codeInsight.daemon.DaemonCodeAnalyzer;
|
||||
import com.intellij.codeInsight.template.JavaCodeContextType;
|
||||
import com.intellij.codeInsight.template.TemplateContextType;
|
||||
import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.dupLocator.iterators.NodeIterator;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.lang.Language;
|
||||
@@ -33,6 +32,7 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.structuralsearch.impl.matcher.*;
|
||||
import com.intellij.structuralsearch.impl.matcher.compiler.GlobalCompilingVisitor;
|
||||
@@ -523,27 +523,12 @@ public class JavaStructuralSearchProfile extends StructuralSearchProfile {
|
||||
|
||||
@Override
|
||||
public void provideAdditionalReplaceOptions(@NotNull PsiElement node, final ReplaceOptions options, final ReplacementBuilder builder) {
|
||||
final String templateText = TemplateManager.getInstance(node.getProject()).createTemplate("", "", options.getReplacement()).getTemplateText();
|
||||
node.accept(new JavaRecursiveElementWalkingVisitor() {
|
||||
@Override
|
||||
public void visitReferenceExpression(PsiReferenceExpression expression) {
|
||||
visitElement(expression);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitClass(PsiClass aClass) {
|
||||
super.visitClass(aClass);
|
||||
|
||||
MatchVariableConstraint constraint =
|
||||
options.getMatchOptions().getVariableConstraint(CompiledPattern.ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME);
|
||||
if (constraint != null) {
|
||||
ParameterInfo e = new ParameterInfo();
|
||||
e.setName(CompiledPattern.ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME);
|
||||
e.setStartIndex(templateText.lastIndexOf('}'));
|
||||
builder.addParametrization(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitParameter(PsiParameter parameter) {
|
||||
super.visitParameter(parameter);
|
||||
@@ -603,7 +588,7 @@ public class JavaStructuralSearchProfile extends StructuralSearchProfile {
|
||||
final PsiElement parent = currentElement.getParent();
|
||||
if (parent instanceof PsiVariable) {
|
||||
final PsiElement prevSibling = PsiTreeUtil.skipSiblingsBackward(parent, PsiWhiteSpace.class);
|
||||
if (prevSibling instanceof PsiJavaToken && JavaTokenType.COMMA.equals(((PsiJavaToken)prevSibling).getTokenType())) {
|
||||
if (PsiUtil.isJavaToken(prevSibling, JavaTokenType.COMMA)) {
|
||||
buf.append(',');
|
||||
}
|
||||
}
|
||||
@@ -635,7 +620,7 @@ public class JavaStructuralSearchProfile extends StructuralSearchProfile {
|
||||
}
|
||||
else if (parent instanceof PsiClass) {
|
||||
final PsiElement prevSibling = PsiTreeUtil.skipSiblingsBackward(currentElement, PsiWhiteSpace.class);
|
||||
if (prevSibling instanceof PsiJavaToken && JavaTokenType.COMMA.equals(((PsiJavaToken)prevSibling).getTokenType())) {
|
||||
if (PsiUtil.isJavaToken(prevSibling, JavaTokenType.COMMA)) {
|
||||
buf.append(',');
|
||||
}
|
||||
else {
|
||||
|
||||
+15
-3
@@ -1,6 +1,20 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.structuralsearch.impl.matcher;
|
||||
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.structuralsearch.impl.matcher.strategies.ExprMatchingStrategy;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -63,8 +77,6 @@ public class JavaCompiledPattern extends CompiledPattern {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static final Key<String> ALL_CLASS_CONTENT_VAR_NAME_KEY = Key.create("AllClassContent");
|
||||
|
||||
public boolean isRequestsSuperFields() {
|
||||
return requestsSuperFields;
|
||||
}
|
||||
|
||||
+35
-29
@@ -426,37 +426,43 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
assert pattern instanceof JavaCompiledPattern;
|
||||
final JavaCompiledPattern javaPattern = (JavaCompiledPattern)pattern;
|
||||
|
||||
final String unmatchedHandlerName = clazz.getUserData(JavaCompiledPattern.ALL_CLASS_CONTENT_VAR_NAME_KEY);
|
||||
final MatchingHandler allRemainingClassContentElementHandler = unmatchedHandlerName != null ? pattern.getHandler(unmatchedHandlerName) : null;
|
||||
MatchContext.MatchedElementsListener newListener = null;
|
||||
MatchContext.MatchedElementsListener listener = new MatchContext.MatchedElementsListener() {
|
||||
private Set<PsiElement> myMatchedElements;
|
||||
|
||||
if (allRemainingClassContentElementHandler != null) {
|
||||
myMatchingVisitor.getMatchContext().setMatchedElementsListener(
|
||||
newListener = new MatchContext.MatchedElementsListener() {
|
||||
private Set<PsiElement> myMatchedElements;
|
||||
@Override
|
||||
public void matchedElements(Collection<PsiElement> matchedElements) {
|
||||
if (matchedElements == null) return;
|
||||
if (myMatchedElements == null) {
|
||||
myMatchedElements = new HashSet<>(matchedElements);
|
||||
}
|
||||
else {
|
||||
myMatchedElements.addAll(matchedElements);
|
||||
}
|
||||
}
|
||||
|
||||
public void matchedElements(Collection<PsiElement> matchedElements) {
|
||||
if (matchedElements == null) return;
|
||||
if (myMatchedElements == null) {
|
||||
myMatchedElements = new HashSet<>(matchedElements);
|
||||
}
|
||||
else {
|
||||
myMatchedElements.addAll(matchedElements);
|
||||
}
|
||||
}
|
||||
|
||||
public void commitUnmatched() {
|
||||
final SubstitutionHandler handler = (SubstitutionHandler)allRemainingClassContentElementHandler;
|
||||
|
||||
for (PsiElement el = clazz2.getFirstChild(); el != null; el = el.getNextSibling()) {
|
||||
if (el instanceof PsiMember && (myMatchedElements == null || !myMatchedElements.contains(el))) {
|
||||
handler.handle(el, myMatchingVisitor.getMatchContext());
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void commitUnmatched() {
|
||||
final List<PsiMember> members = PsiTreeUtil.getChildrenOfTypeAsList(clazz2, PsiMember.class);
|
||||
final List<PsiMember> unmatchedElements =
|
||||
ContainerUtil.filter(members, a -> myMatchedElements == null || !myMatchedElements.contains(a));
|
||||
MatchingHandler unmatchedSubstitutionHandler = null;
|
||||
for (PsiElement element = clazz.getFirstChild(); element != null; element = element.getNextSibling()) {
|
||||
if (element instanceof PsiTypeElement && element.getNextSibling() instanceof PsiErrorElement) {
|
||||
unmatchedSubstitutionHandler = pattern.getHandler(element);
|
||||
break;
|
||||
}
|
||||
}
|
||||
);
|
||||
}
|
||||
if (unmatchedSubstitutionHandler instanceof SubstitutionHandler) {
|
||||
final SubstitutionHandler handler = (SubstitutionHandler)unmatchedSubstitutionHandler;
|
||||
for (PsiMember element : unmatchedElements) {
|
||||
handler.handle(element, myMatchingVisitor.getMatchContext());
|
||||
}
|
||||
} else {
|
||||
clazz2.putUserData(GlobalMatchingVisitor.UNMATCHED_ELEMENTS_KEY, unmatchedElements);
|
||||
}
|
||||
}
|
||||
};
|
||||
myMatchingVisitor.getMatchContext().setMatchedElementsListener(listener);
|
||||
|
||||
boolean result = false;
|
||||
try {
|
||||
@@ -534,10 +540,10 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
}
|
||||
|
||||
result = true;
|
||||
return result;
|
||||
return true;
|
||||
}
|
||||
finally {
|
||||
if (result && newListener != null) newListener.commitUnmatched();
|
||||
if (result) listener.commitUnmatched();
|
||||
this.myClazz = saveClazz;
|
||||
myMatchingVisitor.getMatchContext().setMatchedElementsListener(oldListener);
|
||||
}
|
||||
|
||||
+11
-36
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -24,14 +24,19 @@ import com.intellij.psi.search.PsiShortNamesCache;
|
||||
import com.intellij.psi.search.SearchScope;
|
||||
import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.structuralsearch.*;
|
||||
import com.intellij.structuralsearch.MalformedPatternException;
|
||||
import com.intellij.structuralsearch.SSRBundle;
|
||||
import com.intellij.structuralsearch.UnsupportedPatternException;
|
||||
import com.intellij.structuralsearch.impl.matcher.CompiledPattern;
|
||||
import com.intellij.structuralsearch.impl.matcher.JavaCompiledPattern;
|
||||
import com.intellij.structuralsearch.impl.matcher.filters.*;
|
||||
import com.intellij.structuralsearch.impl.matcher.handlers.*;
|
||||
import com.intellij.structuralsearch.impl.matcher.iterators.DocValuesIterator;
|
||||
import com.intellij.structuralsearch.impl.matcher.predicates.RegExpPredicate;
|
||||
import com.intellij.structuralsearch.impl.matcher.strategies.*;
|
||||
import com.intellij.structuralsearch.impl.matcher.strategies.CommentMatchingStrategy;
|
||||
import com.intellij.structuralsearch.impl.matcher.strategies.ExprMatchingStrategy;
|
||||
import com.intellij.structuralsearch.impl.matcher.strategies.JavaDocMatchingStrategy;
|
||||
import com.intellij.structuralsearch.impl.matcher.strategies.MatchingStrategy;
|
||||
import com.intellij.util.Processor;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -348,32 +353,6 @@ public class JavaCompilingVisitor extends JavaRecursiveElementWalkingVisitor {
|
||||
handleReferenceText(psiClass.getName(), myCompilingVisitor.getContext());
|
||||
|
||||
GlobalCompilingVisitor.setFilter(handler, ClassFilter.getInstance());
|
||||
|
||||
boolean hasSubstitutionHandler = false;
|
||||
for (PsiElement element = psiClass.getFirstChild(); element != null; element = element.getNextSibling()) {
|
||||
if (element instanceof PsiTypeElement && element.getNextSibling() instanceof PsiErrorElement) {
|
||||
// found match that
|
||||
MatchingHandler unmatchedSubstitutionHandler = pattern.getHandler(element);
|
||||
if (unmatchedSubstitutionHandler != null) {
|
||||
psiClass.putUserData(JavaCompiledPattern.ALL_CLASS_CONTENT_VAR_NAME_KEY, pattern.getTypedVarString(element));
|
||||
hasSubstitutionHandler = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (!hasSubstitutionHandler) {
|
||||
String name = CompiledPattern.ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME;
|
||||
psiClass.putUserData(JavaCompiledPattern.ALL_CLASS_CONTENT_VAR_NAME_KEY, name);
|
||||
MatchOptions options = myCompilingVisitor.getContext().getOptions();
|
||||
if (pattern.getHandler(name) == null) {
|
||||
pattern.createSubstitutionHandler(name, name, false, 0, Integer.MAX_VALUE, true);
|
||||
MatchVariableConstraint constraint = new MatchVariableConstraint(true);
|
||||
constraint.setName(name);
|
||||
constraint.setMinCount(0);
|
||||
constraint.setMaxCount(Integer.MAX_VALUE);
|
||||
options.addVariableConstraint(constraint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private SubstitutionHandler createAndSetSubstitutionHandlerFromReference(final PsiElement expr, final String referenceText,
|
||||
@@ -398,14 +377,10 @@ public class JavaCompilingVisitor extends JavaRecursiveElementWalkingVisitor {
|
||||
final PsiElement reference = expr.getFirstChild();
|
||||
MatchingHandler referenceHandler = myCompilingVisitor.getContext().getPattern().getHandler(reference);
|
||||
|
||||
if (referenceHandler instanceof SubstitutionHandler &&
|
||||
(reference instanceof PsiReferenceExpression)
|
||||
) {
|
||||
if (referenceHandler instanceof SubstitutionHandler && (reference instanceof PsiReferenceExpression)) {
|
||||
// symbol
|
||||
myCompilingVisitor.getContext().getPattern().setHandler(expr, referenceHandler);
|
||||
referenceHandler.setFilter(
|
||||
SymbolNodeFilter.getInstance()
|
||||
);
|
||||
referenceHandler.setFilter(SymbolNodeFilter.getInstance());
|
||||
|
||||
myCompilingVisitor.setHandler(expr, new SymbolHandler((SubstitutionHandler)referenceHandler));
|
||||
}
|
||||
@@ -582,7 +557,7 @@ public class JavaCompilingVisitor extends JavaRecursiveElementWalkingVisitor {
|
||||
myCompilingVisitor.setCodeBlockLevel(myCompilingVisitor.getCodeBlockLevel() - 1);
|
||||
}
|
||||
|
||||
private MatchingStrategy findStrategy(PsiElement el) {
|
||||
private static MatchingStrategy findStrategy(PsiElement el) {
|
||||
if (el instanceof PsiDocComment) {
|
||||
return JavaDocMatchingStrategy.getInstance();
|
||||
}
|
||||
|
||||
-1
@@ -36,7 +36,6 @@ public abstract class InspectionProjectProfileManager implements InspectionProfi
|
||||
/**
|
||||
* @deprecated use {@link #getCurrentProfile()} instead
|
||||
*/
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
@NotNull
|
||||
public InspectionProfile getInspectionProfile(PsiElement element){
|
||||
return getCurrentProfile();
|
||||
|
||||
@@ -64,8 +64,12 @@ public abstract class DumbService {
|
||||
}
|
||||
|
||||
/**
|
||||
* Executes the runnable immediately if the project is initialized and there's no dumb mode in progress,
|
||||
* or on AWT Event Dispatch thread after the dumb mode ends.
|
||||
* Executes the runnable as soon as possible on AWT Event Dispatch when:
|
||||
* <ul>
|
||||
* <li>project is initialized</li>
|
||||
* <li>and there's no dumb mode in progress</li>
|
||||
* </ul>
|
||||
* This may also happen immediately if these conditions are already met.<p/>
|
||||
* Note that it's not guaranteed that the dumb mode won't start again during this runnable execution, it should manage that situation explicitly
|
||||
* (e.g. by starting a read action; it's still necessary to check isDumb inside the read action).
|
||||
* @param runnable runnable to run
|
||||
|
||||
@@ -54,8 +54,8 @@ public abstract class StartupManager {
|
||||
public abstract void registerPostStartupActivity(@NotNull Runnable runnable);
|
||||
|
||||
/**
|
||||
* Executes the specified runnable immediately if the initialization of the current project
|
||||
* is complete, or registers it as a post-startup activity if the project is being initialized. In the latter case, the runnable will be executed later on AWT thread in a non-modal state.
|
||||
* Executes the specified runnable immediately if invoked from AWT thread and the initialization of the current project
|
||||
* is complete. Otherwise registers it as a post-startup activity. In the latter case, the runnable will be executed later on AWT thread in a non-modal state.
|
||||
*
|
||||
* @param runnable the activity to execute.
|
||||
* @see com.intellij.openapi.application.ModalityState
|
||||
|
||||
@@ -280,7 +280,6 @@ public class ActionCallback implements Disposable {
|
||||
/**
|
||||
* @deprecated use {@link #notifyWhenRejected(ActionCallback)}
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public Runnable createSetRejectedRunnable() {
|
||||
|
||||
@@ -356,7 +356,6 @@ public class SingleRootFileViewProvider extends UserDataHolderBase implements Fi
|
||||
return new PsiPlainTextFileImpl(this);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public static boolean isTooLarge(@NotNull VirtualFile vFile) {
|
||||
return isTooLargeForIntelligence(vFile);
|
||||
|
||||
@@ -163,10 +163,6 @@ public class DocumentCommitThread implements Runnable, Disposable, DocumentCommi
|
||||
if (!project.isInitialized()) return;
|
||||
PsiFile psiFile = PsiDocumentManager.getInstance(project).getCachedPsiFile(document);
|
||||
if (psiFile == null) return;
|
||||
if (psiFile instanceof PsiCompiledFile) {
|
||||
throw new IllegalArgumentException("Can't commit ClsFile: "+psiFile);
|
||||
}
|
||||
|
||||
doQueue(project, document, getAllFileNodes(psiFile), reason, currentModalityState);
|
||||
}
|
||||
|
||||
@@ -429,9 +425,6 @@ public class DocumentCommitThread implements Runnable, Disposable, DocumentCommi
|
||||
@Override
|
||||
public List<Pair<PsiFileImpl, FileASTNode>> compute() {
|
||||
PsiFile file = finalProject.isDisposed() ? null : documentManager.getPsiFile(finalDocument);
|
||||
if (file != null && !file.isValid()) {
|
||||
throw new PsiInvalidElementAccessException(file, "documentManager.getPsiFile(" + finalDocument + ") is invalid");
|
||||
}
|
||||
return file == null ? null : getAllFileNodes(file);
|
||||
}
|
||||
});
|
||||
@@ -461,9 +454,6 @@ public class DocumentCommitThread implements Runnable, Disposable, DocumentCommi
|
||||
throw new RuntimeException(s);
|
||||
}
|
||||
|
||||
if (!psiFile.isValid()) {
|
||||
throw new PsiInvalidElementAccessException(psiFile, "File " + psiFile + " is invalid, can't commit");
|
||||
}
|
||||
List<Pair<PsiFileImpl, FileASTNode>> allFileNodes = getAllFileNodes(psiFile);
|
||||
|
||||
Lock documentLock = getDocumentLock(document);
|
||||
@@ -493,6 +483,13 @@ public class DocumentCommitThread implements Runnable, Disposable, DocumentCommi
|
||||
|
||||
@NotNull
|
||||
private static List<Pair<PsiFileImpl, FileASTNode>> getAllFileNodes(@NotNull PsiFile file) {
|
||||
if (!file.isValid()) {
|
||||
throw new PsiInvalidElementAccessException(file, "File " + file + " is invalid, can't commit");
|
||||
}
|
||||
if (file instanceof PsiCompiledFile) {
|
||||
throw new IllegalArgumentException("Can't commit ClsFile: "+file);
|
||||
}
|
||||
|
||||
return ContainerUtil.map(file.getViewProvider().getAllFiles(), new Function<PsiFile, Pair<PsiFileImpl, FileASTNode>>() {
|
||||
@Override
|
||||
public Pair<PsiFileImpl, FileASTNode> fun(PsiFile root) {
|
||||
|
||||
@@ -66,4 +66,9 @@ public interface EditorColors {
|
||||
ColorKey BORDER_LINES_COLOR = ColorKey.createColorKey("BORDER_LINES_COLOR");
|
||||
|
||||
TextAttributesKey INJECTED_LANGUAGE_FRAGMENT = TextAttributesKey.createTextAttributesKey("INJECTED_LANGUAGE_FRAGMENT");
|
||||
|
||||
TextAttributesKey BREADCRUMBS_DEFAULT = TextAttributesKey.createTextAttributesKey("BREADCRUMBS_DEFAULT");
|
||||
TextAttributesKey BREADCRUMBS_HOVERED = TextAttributesKey.createTextAttributesKey("BREADCRUMBS_HOVERED");
|
||||
TextAttributesKey BREADCRUMBS_CURRENT = TextAttributesKey.createTextAttributesKey("BREADCRUMBS_CURRENT");
|
||||
TextAttributesKey BREADCRUMBS_INACTIVE = TextAttributesKey.createTextAttributesKey("BREADCRUMBS_INACTIVE");
|
||||
}
|
||||
|
||||
@@ -31,7 +31,7 @@ import org.jetbrains.annotations.Nullable;
|
||||
public abstract class GenericProgramRunner<Settings extends RunnerSettings> extends BaseProgramRunner<Settings> {
|
||||
@Deprecated
|
||||
public static final DataKey<RunContentDescriptor> CONTENT_TO_REUSE_DATA_KEY = DataKey.create("contentToReuse");
|
||||
@SuppressWarnings({"UnusedDeclaration", "deprecation"}) @Deprecated @NonNls
|
||||
@Deprecated @NonNls
|
||||
public static final String CONTENT_TO_REUSE = CONTENT_TO_REUSE_DATA_KEY.getName();
|
||||
|
||||
@Override
|
||||
|
||||
@@ -180,13 +180,10 @@ public class CodeStyleSettings extends CommonCodeStyleSettings implements Clonea
|
||||
|
||||
public boolean AUTODETECT_INDENTS = true;
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public final IndentOptions JAVA_INDENT_OPTIONS = new IndentOptions();
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public final IndentOptions JSP_INDENT_OPTIONS = new IndentOptions();
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public final IndentOptions XML_INDENT_OPTIONS = new IndentOptions();
|
||||
|
||||
|
||||
+6
-1
@@ -16,6 +16,7 @@
|
||||
package com.intellij.codeInsight.template.impl;
|
||||
|
||||
import com.intellij.codeInsight.completion.InsertionContext;
|
||||
import com.intellij.codeInsight.template.Template;
|
||||
import com.intellij.codeInsight.template.TemplateManager;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -46,8 +47,12 @@ public class LiveTemplateLookupElementImpl extends LiveTemplateLookupElement {
|
||||
|
||||
@Override
|
||||
public void handleInsert(InsertionContext context) {
|
||||
startTemplate(context, myTemplate);
|
||||
}
|
||||
|
||||
public static void startTemplate(InsertionContext context, @NotNull Template template) {
|
||||
context.getDocument().deleteString(context.getStartOffset(), context.getTailOffset());
|
||||
context.setAddCompletionChar(false);
|
||||
TemplateManager.getInstance(context.getProject()).startTemplate(context.getEditor(), myTemplate);
|
||||
TemplateManager.getInstance(context.getProject()).startTemplate(context.getEditor(), template);
|
||||
}
|
||||
}
|
||||
|
||||
-2
@@ -48,14 +48,12 @@ public class PostfixTemplatesSettings implements PersistentStateComponent<Elemen
|
||||
@NotNull
|
||||
private Map<String, Boolean> myTemplatesState = ContainerUtil.newHashMap();
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public Map<String, Boolean> getTemplatesState() {
|
||||
return myTemplatesState;
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public void setTemplatesState(@NotNull Map<String, Boolean> templatesState) {
|
||||
myTemplatesState = templatesState;
|
||||
|
||||
@@ -49,11 +49,10 @@ public interface FormattingModelBuilderEx extends FormattingModelBuilder {
|
||||
* @param ranges given file's ranges to reformat
|
||||
* @param settings code style settings holder
|
||||
* @return indent options to use for the target formatting operation (if any adjustment is required);
|
||||
* <code>null</code> to trigger default algorithm usage
|
||||
* @deprecated Use <code>FileIndentOptionsProvider</code> instead.
|
||||
* {@code null} to trigger default algorithm usage
|
||||
* @deprecated Use {@code com.intellij.psi.codeStyle.FileIndentOptionsProvider} instead.
|
||||
* @see com.intellij.psi.codeStyle.FileIndentOptionsProvider
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Nullable
|
||||
@Deprecated
|
||||
CommonCodeStyleSettings.IndentOptions getIndentOptionsToUse(@NotNull PsiFile file,
|
||||
|
||||
+6
-1
@@ -97,7 +97,12 @@ public class GeneralColorsPage implements ColorSettingsPage, InspectionColorSett
|
||||
new AttributesDescriptor(OptionsBundle.message("options.java.color.descriptor.full.coverage"), CodeInsightColors.LINE_FULL_COVERAGE),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.java.color.descriptor.partial.coverage"),
|
||||
CodeInsightColors.LINE_PARTIAL_COVERAGE),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.java.color.descriptor.none.coverage"), CodeInsightColors.LINE_NONE_COVERAGE)
|
||||
new AttributesDescriptor(OptionsBundle.message("options.java.color.descriptor.none.coverage"), CodeInsightColors.LINE_NONE_COVERAGE),
|
||||
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.breadcrumbs.default"), EditorColors.BREADCRUMBS_DEFAULT),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.breadcrumbs.hovered"), EditorColors.BREADCRUMBS_HOVERED),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.breadcrumbs.current"), EditorColors.BREADCRUMBS_CURRENT),
|
||||
new AttributesDescriptor(OptionsBundle.message("options.general.color.descriptor.breadcrumbs.inactive"), EditorColors.BREADCRUMBS_INACTIVE)
|
||||
};
|
||||
|
||||
private static final ColorDescriptor[] COLOR_DESCRIPTORS = {
|
||||
|
||||
@@ -25,8 +25,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
public abstract class LocalHistory {
|
||||
public static final Object VFS_EVENT_REQUESTOR = new Object();
|
||||
|
||||
private static class LocalHistoryHolder {
|
||||
static final LocalHistory ourInstance = ApplicationManager.getApplication().getComponent(LocalHistory.class);
|
||||
}
|
||||
|
||||
public static LocalHistory getInstance() {
|
||||
return ApplicationManager.getApplication().getComponent(LocalHistory.class);
|
||||
return LocalHistoryHolder.ourInstance;
|
||||
}
|
||||
|
||||
public abstract LocalHistoryAction startAction(@Nullable String name);
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.vfs.encoding.EncodingRegistry;
|
||||
import com.intellij.openapi.vfs.newvfs.ManagingFS;
|
||||
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.VirtualFileSystemEntry;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -66,21 +67,79 @@ public class IdeaGateway {
|
||||
|
||||
if (!f.isDirectory() && StringUtil.endsWith(f.getNameSequence(), ".class")) return false;
|
||||
|
||||
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
|
||||
LocalHistoryImpl.getInstanceImpl().dispatchPendingEvents();
|
||||
|
||||
VersionedFilterData versionedFilterData;
|
||||
VfsEventDispatchContext vfsEventDispatchContext = ourCurrentEventDispatchContext.get();
|
||||
if (vfsEventDispatchContext != null) {
|
||||
versionedFilterData = vfsEventDispatchContext.myFilterData;
|
||||
if (versionedFilterData == null) versionedFilterData = vfsEventDispatchContext.myFilterData = new VersionedFilterData();
|
||||
} else {
|
||||
versionedFilterData = new VersionedFilterData();
|
||||
}
|
||||
|
||||
boolean isInContent = false;
|
||||
for (Project each : openProjects) {
|
||||
if (each.isDefault()) continue;
|
||||
if (!each.isInitialized()) continue;
|
||||
if (Comparing.equal(each.getWorkspaceFile(), f)) return false;
|
||||
ProjectFileIndex index = ProjectRootManager.getInstance(each).getFileIndex();
|
||||
|
||||
int numberOfOpenProjects = versionedFilterData.myOpenedProjects.size();
|
||||
for (int i = 0; i < numberOfOpenProjects; ++i) {
|
||||
if (Comparing.equal(versionedFilterData.myWorkspaceFiles.get(i), f)) return false;
|
||||
ProjectFileIndex index = versionedFilterData.myProjectFileIndices.get(i);
|
||||
|
||||
if (index.isExcluded(f)) return false;
|
||||
isInContent |= index.isInContent(f);
|
||||
}
|
||||
if (shouldBeInContent && !isInContent) return false;
|
||||
|
||||
|
||||
// optimisation: FileTypeManager.isFileIgnored(f) already checked inside ProjectFileIndex.isIgnored()
|
||||
return openProjects.length != 0 || !FileTypeManager.getInstance().isFileIgnored(f);
|
||||
return numberOfOpenProjects != 0 || !FileTypeManager.getInstance().isFileIgnored(f);
|
||||
}
|
||||
|
||||
private static final ThreadLocal<VfsEventDispatchContext> ourCurrentEventDispatchContext = new ThreadLocal<>();
|
||||
|
||||
private static class VfsEventDispatchContext {
|
||||
final List<? extends VFileEvent> myEvents;
|
||||
final boolean myBeforeEvents;
|
||||
final VfsEventDispatchContext myPreviousContext;
|
||||
|
||||
VersionedFilterData myFilterData;
|
||||
|
||||
VfsEventDispatchContext(List<? extends VFileEvent> events, boolean beforeEvents, VfsEventDispatchContext context) {
|
||||
myEvents = events;
|
||||
myBeforeEvents = beforeEvents;
|
||||
myPreviousContext = context;
|
||||
}
|
||||
|
||||
public void close() {
|
||||
ourCurrentEventDispatchContext.set(myPreviousContext);
|
||||
}
|
||||
}
|
||||
|
||||
public void runWithVfsEventsDispatchContext(List<? extends VFileEvent> events, boolean beforeEvents, Runnable action) {
|
||||
VfsEventDispatchContext vfsEventDispatchContext = new VfsEventDispatchContext(events, beforeEvents, ourCurrentEventDispatchContext.get());
|
||||
ourCurrentEventDispatchContext.set(vfsEventDispatchContext);
|
||||
try {
|
||||
action.run();
|
||||
} finally {
|
||||
vfsEventDispatchContext.close();
|
||||
}
|
||||
}
|
||||
|
||||
private static class VersionedFilterData {
|
||||
final List<Project> myOpenedProjects = new ArrayList<>();
|
||||
final List<ProjectFileIndex> myProjectFileIndices = new ArrayList<>();
|
||||
final List<VirtualFile> myWorkspaceFiles = new ArrayList<>();
|
||||
|
||||
VersionedFilterData() {
|
||||
Project[] openProjects = ProjectManager.getInstance().getOpenProjects();
|
||||
|
||||
for (Project each : openProjects) {
|
||||
if (each.isDefault()) continue;
|
||||
if (!each.isInitialized()) continue;
|
||||
|
||||
myWorkspaceFiles.add(each.getWorkspaceFile());
|
||||
myOpenedProjects.add(each);
|
||||
myProjectFileIndices.add(ProjectRootManager.getInstance(each).getFileIndex());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean areContentChangesVersioned(@NotNull VirtualFile f) {
|
||||
|
||||
+25
-1
@@ -23,10 +23,16 @@ import com.intellij.openapi.command.CommandListener;
|
||||
import com.intellij.openapi.util.Key;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.vfs.impl.BulkVirtualFileListenerAdapter;
|
||||
import com.intellij.openapi.vfs.newvfs.BulkFileListener;
|
||||
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements VirtualFileManagerListener, CommandListener {
|
||||
import java.util.List;
|
||||
|
||||
public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements VirtualFileManagerListener, CommandListener,
|
||||
BulkFileListener {
|
||||
private static final Key<Boolean> WAS_VERSIONED_KEY =
|
||||
Key.create(LocalHistoryEventDispatcher.class.getSimpleName() + ".WAS_VERSIONED_KEY");
|
||||
|
||||
@@ -193,4 +199,22 @@ public class LocalHistoryEventDispatcher extends VirtualFileAdapter implements V
|
||||
private boolean areContentChangesVersioned(VirtualFileEvent e) {
|
||||
return myGateway.areContentChangesVersioned(e.getFile());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void before(@NotNull List<? extends VFileEvent> events) {
|
||||
myGateway.runWithVfsEventsDispatchContext(events, true, () -> {
|
||||
for (VFileEvent event : events) {
|
||||
BulkVirtualFileListenerAdapter.fireBefore(this, event);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void after(@NotNull List<? extends VFileEvent> events) {
|
||||
myGateway.runWithVfsEventsDispatchContext(events, false, () -> {
|
||||
for (VFileEvent event : events) {
|
||||
BulkVirtualFileListenerAdapter.fireAfter(this, event);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -35,6 +35,8 @@ import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
import com.intellij.util.messages.MessageBus;
|
||||
import com.intellij.util.messages.MessageBusConnection;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -47,6 +49,8 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import static com.intellij.history.integration.LocalHistoryUtil.findRevisionIndexToRevert;
|
||||
|
||||
public class LocalHistoryImpl extends LocalHistory implements ApplicationComponent {
|
||||
private final MessageBus myBus;
|
||||
private MessageBusConnection myConnection;
|
||||
private ChangeList myChangeList;
|
||||
private LocalHistoryFacade myVcs;
|
||||
private IdeaGateway myGateway;
|
||||
@@ -60,6 +64,10 @@ public class LocalHistoryImpl extends LocalHistory implements ApplicationCompone
|
||||
return (LocalHistoryImpl)getInstance();
|
||||
}
|
||||
|
||||
public LocalHistoryImpl(@NotNull MessageBus bus) {
|
||||
myBus = bus;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initComponent() {
|
||||
if (!ApplicationManager.getApplication().isUnitTestMode() && ApplicationManager.getApplication().isHeadlessEnvironment()) return;
|
||||
@@ -89,8 +97,10 @@ public class LocalHistoryImpl extends LocalHistory implements ApplicationCompone
|
||||
|
||||
CommandProcessor.getInstance().addCommandListener(myEventDispatcher);
|
||||
|
||||
myConnection = myBus.connect();
|
||||
myConnection.subscribe(VirtualFileManager.VFS_CHANGES, myEventDispatcher);
|
||||
|
||||
VirtualFileManager fm = VirtualFileManager.getInstance();
|
||||
fm.addVirtualFileListener(myEventDispatcher);
|
||||
fm.addVirtualFileManagerListener(myEventDispatcher);
|
||||
|
||||
if (ApplicationManager.getApplication().isInternal() && !ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
@@ -126,8 +136,9 @@ public class LocalHistoryImpl extends LocalHistory implements ApplicationCompone
|
||||
|
||||
long period = Registry.intValue("localHistory.daysToKeep") * 1000L * 60L * 60L * 24L;
|
||||
|
||||
myConnection.disconnect();
|
||||
myConnection = null;
|
||||
VirtualFileManager fm = VirtualFileManager.getInstance();
|
||||
fm.removeVirtualFileListener(myEventDispatcher);
|
||||
fm.removeVirtualFileManagerListener(myEventDispatcher);
|
||||
CommandProcessor.getInstance().removeCommandListener(myEventDispatcher);
|
||||
|
||||
@@ -143,6 +154,10 @@ public class LocalHistoryImpl extends LocalHistory implements ApplicationCompone
|
||||
ShutDownTracker.getInstance().unregisterShutdownTask(myShutdownTask);
|
||||
}
|
||||
|
||||
protected void dispatchPendingEvents() {
|
||||
myConnection.deliverImmediately();
|
||||
}
|
||||
|
||||
@TestOnly
|
||||
public void cleanupForNextTest() {
|
||||
disposeComponent();
|
||||
|
||||
@@ -83,7 +83,6 @@ public class BrowserUtil {
|
||||
/**
|
||||
* @deprecated Use {@link #browse(String)}
|
||||
*/
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
public static void launchBrowser(@NotNull @NonNls String url) {
|
||||
browse(url);
|
||||
@@ -113,7 +112,6 @@ public class BrowserUtil {
|
||||
getBrowserLauncher().browse(url, null, project);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@NotNull
|
||||
@Deprecated
|
||||
public static List<String> getOpenBrowserCommand(@NonNls @NotNull String browserPathOrName) {
|
||||
|
||||
+6
-2
@@ -48,7 +48,11 @@ class MacGestureAdapter extends GestureAdapter {
|
||||
public void gestureBegan(GesturePhaseEvent event) {
|
||||
magnification = 0;
|
||||
|
||||
Point mouse = MouseInfo.getPointerInfo().getLocation();
|
||||
PointerInfo pointerInfo = MouseInfo.getPointerInfo();
|
||||
|
||||
if (pointerInfo == null) return;
|
||||
|
||||
Point mouse = pointerInfo.getLocation();
|
||||
SwingUtilities.convertPointFromScreen(mouse, myFrame.getComponent());
|
||||
Component deepest = SwingUtilities.getDeepestComponentAt(myFrame.getComponent(), mouse.x, mouse.y);
|
||||
ZoomableViewport viewport = (ZoomableViewport) SwingUtilities.getAncestorOfClass(ZoomableViewport.class, deepest);
|
||||
@@ -56,7 +60,7 @@ class MacGestureAdapter extends GestureAdapter {
|
||||
Magnificator magnificator = viewport.getMagnificator();
|
||||
|
||||
if (magnificator != null) {
|
||||
Point at = MouseInfo.getPointerInfo().getLocation();
|
||||
Point at = pointerInfo.getLocation();
|
||||
SwingUtilities.convertPointFromScreen(at, (JComponent)viewport);
|
||||
viewport.magnificationStarted(at);
|
||||
myMagnifyingViewport = viewport;
|
||||
|
||||
@@ -21,15 +21,11 @@ import com.intellij.openapi.util.io.FileAttributes;
|
||||
import com.intellij.openapi.vfs.VfsUtilCore;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.impl.local.LocalFileSystemBase;
|
||||
import com.intellij.openapi.vfs.newvfs.ManagingFS;
|
||||
import com.intellij.openapi.vfs.newvfs.RefreshQueue;
|
||||
import com.intellij.openapi.vfs.newvfs.VfsImplUtil;
|
||||
import com.intellij.openapi.vfs.newvfs.impl.FakeVirtualFile;
|
||||
import com.intellij.openapi.vfs.newvfs.persistent.FSRecords;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.LocalTimeCounter;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -57,7 +53,7 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private FSItem convert(VirtualFile file) {
|
||||
private FSItem convert(@NotNull VirtualFile file) {
|
||||
final VirtualFile parentFile = file.getParent();
|
||||
if (parentFile == null) return myRoot;
|
||||
|
||||
@@ -233,26 +229,6 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
public void refresh(final boolean asynchronous) {
|
||||
RefreshQueue.getInstance().refresh(asynchronous, true, null, ManagingFS.getInstance().getRoots(this));
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualFile findFileByPath(@NotNull @NonNls String path) {
|
||||
return VfsImplUtil.findFileByPath(this, path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualFile findFileByPathIfCached(@NotNull @NonNls String path) {
|
||||
return VfsImplUtil.findFileByPathIfCached(this, path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public VirtualFile refreshAndFindFileByPath(@NotNull String path) {
|
||||
return VfsImplUtil.refreshAndFindFileByPath(this, path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getLength(@NotNull final VirtualFile file) {
|
||||
try {
|
||||
@@ -269,7 +245,7 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
private long myTimestamp;
|
||||
private boolean myWritable;
|
||||
|
||||
protected FSItem(final FSDir parent, final String name) {
|
||||
FSItem(@Nullable FSDir parent, @NotNull String name) {
|
||||
myParent = parent;
|
||||
myName = name;
|
||||
myTimestamp = LocalTimeCounter.currentTime();
|
||||
@@ -283,7 +259,7 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void setName(final String name) {
|
||||
void setName(@NotNull String name) {
|
||||
myName = name;
|
||||
}
|
||||
|
||||
@@ -291,6 +267,7 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
return myParent;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public String[] list() {
|
||||
return ArrayUtil.EMPTY_STRING_ARRAY;
|
||||
}
|
||||
@@ -304,7 +281,7 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
private static class FSDir extends FSItem {
|
||||
private final List<FSItem> myChildren = new ArrayList<>();
|
||||
|
||||
public FSDir(final FSDir parent, final String name) {
|
||||
FSDir(@Nullable FSDir parent, @NotNull String name) {
|
||||
super(parent, name);
|
||||
}
|
||||
|
||||
@@ -325,17 +302,18 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addChild(final FSItem item) {
|
||||
void addChild(@NotNull FSItem item) {
|
||||
myChildren.add(item);
|
||||
}
|
||||
|
||||
public void removeChild(final FSItem fsItem) {
|
||||
void removeChild(@NotNull FSItem fsItem) {
|
||||
if (fsItem.myName.equals("src") && getParent() == null) {
|
||||
throw new RuntimeException("removing src directory");
|
||||
}
|
||||
myChildren.remove(fsItem);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public String[] list() {
|
||||
String[] names = ArrayUtil.newStringArray(myChildren.size());
|
||||
@@ -347,7 +325,7 @@ public class TempFileSystem extends LocalFileSystemBase {
|
||||
}
|
||||
|
||||
private static class FSFile extends FSItem {
|
||||
public FSFile(final FSDir parent, final String name) {
|
||||
FSFile(@NotNull FSDir parent, @NotNull String name) {
|
||||
super(parent, name);
|
||||
}
|
||||
|
||||
|
||||
+1
-5
@@ -447,8 +447,7 @@ public abstract class LocalFileSystemBase extends LocalFileSystem {
|
||||
@Override
|
||||
@NotNull
|
||||
public byte[] contentsToByteArray(@NotNull final VirtualFile file) throws IOException {
|
||||
final InputStream stream = new FileInputStream(convertToIOFileAndCheck(file));
|
||||
try {
|
||||
try (InputStream stream = new FileInputStream(convertToIOFileAndCheck(file))) {
|
||||
long l = file.getLength();
|
||||
if (l > Integer.MAX_VALUE) throw new IOException("File is too large: " + l + ", " + file);
|
||||
final int length = (int)l;
|
||||
@@ -457,9 +456,6 @@ public abstract class LocalFileSystemBase extends LocalFileSystem {
|
||||
// so let's do buffered requests with buffer size 8192 that will use stack allocated buffer
|
||||
return loadBytes(length <= 8192 ? stream : new BufferedInputStream(stream), length);
|
||||
}
|
||||
finally {
|
||||
stream.close();
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+2
-3
@@ -59,7 +59,7 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
|
||||
private final boolean myWatchRecursively;
|
||||
private boolean myDominated;
|
||||
|
||||
public WatchRequestImpl(String rootPath, boolean watchRecursively) {
|
||||
WatchRequestImpl(String rootPath, boolean watchRecursively) {
|
||||
myFSRootPath = rootPath;
|
||||
myWatchRecursively = watchRecursively;
|
||||
}
|
||||
@@ -125,7 +125,6 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
|
||||
String rootPath = request.getRootPath();
|
||||
|
||||
TreeNode currentNode = rootNode;
|
||||
MainLoop:
|
||||
for (String subPath : splitPath(rootPath)) {
|
||||
TreeNode nextNode = currentNode.nodes.get(subPath);
|
||||
if (nextNode != null) {
|
||||
@@ -133,7 +132,7 @@ public final class LocalFileSystemImpl extends LocalFileSystemBase implements Ap
|
||||
if (currentNode.watchRequest != null && currentNode.watchRequest.isToWatchRecursively()) {
|
||||
// a parent path of this request is already being watched recursively - do not need to add this one
|
||||
request.myDominated = true;
|
||||
break MainLoop;
|
||||
break;
|
||||
}
|
||||
}
|
||||
else {
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.ui;
|
||||
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.ex.EditorEx;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class MonospaceEditorCustomization implements EditorCustomization {
|
||||
private static EditorCustomization INSTANCE = new MonospaceEditorCustomization();
|
||||
|
||||
@NotNull
|
||||
public static EditorCustomization getInstance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void customize(@NotNull EditorEx editor) {
|
||||
// ensure we've got a monospace font by loading up the global editor scheme
|
||||
editor.setColorsScheme(EditorColorsManager.getInstance().getGlobalScheme());
|
||||
}
|
||||
}
|
||||
@@ -153,6 +153,10 @@ options.general.color.descriptor.reference.hyperlink=Hyperlinks//Reference
|
||||
options.general.color.descriptor.todo.defaults=Code//TODO defaults
|
||||
options.general.color.descriptor.bookmarks=Editor//Bookmarks
|
||||
options.general.color.soft.wrap.sign=Text//Soft wrap sign
|
||||
options.general.color.descriptor.breadcrumbs.default=Editor//Breadcrumbs//Default
|
||||
options.general.color.descriptor.breadcrumbs.hovered=Editor//Breadcrumbs//Hovered
|
||||
options.general.color.descriptor.breadcrumbs.current=Editor//Breadcrumbs//Current
|
||||
options.general.color.descriptor.breadcrumbs.inactive=Editor//Breadcrumbs//Inactive
|
||||
|
||||
|
||||
options.language.defaults.display.name=Language Defaults
|
||||
|
||||
@@ -58,19 +58,6 @@
|
||||
<option name="VCS_ANNOTATIONS_COLOR_3" value="d9e4f9"/>
|
||||
<option name="VCS_ANNOTATIONS_COLOR_4" value="fffbcf"/>
|
||||
<option name="VCS_ANNOTATIONS_COLOR_5" value="ffbfc3"/>
|
||||
|
||||
<option name="BREADCRUMBS_BACKGROUND" value="f5f5f5"/>
|
||||
<option name="BREADCRUMBS_BACKGROUND_HOVERED" value="dcdcdc"/>
|
||||
<option name="BREADCRUMBS_BACKGROUND_CURRENT" value="fafadc"/>
|
||||
<option name="BREADCRUMBS_BACKGROUND_INACTIVE" value="fdfdfd"/>
|
||||
<option name="BREADCRUMBS_TEXT_COLOR" value="323232"/>
|
||||
<option name="BREADCRUMBS_TEXT_COLOR_HOVERED" value="323232"/>
|
||||
<option name="BREADCRUMBS_TEXT_COLOR_CURRENT" value="323232"/>
|
||||
<option name="BREADCRUMBS_TEXT_COLOR_INACTIVE" value="aaaaaa"/>
|
||||
<option name="BREADCRUMBS_BORDER_COLOR" value="aaaaaa"/>
|
||||
<option name="BREADCRUMBS_BORDER_COLOR_HOVERED" value="aaaaaa"/>
|
||||
<option name="BREADCRUMBS_BORDER_COLOR_CURRENT" value="aaaaaa"/>
|
||||
<option name="BREADCRUMBS_BORDER_COLOR_INACTIVE" value="c8c8c8"/>
|
||||
</colors>
|
||||
|
||||
<attributes>
|
||||
@@ -1049,6 +1036,39 @@
|
||||
<option name="FOREGROUND" value="bc5150" />
|
||||
</value>
|
||||
</option>
|
||||
|
||||
<option name="BREADCRUMBS_DEFAULT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="323232"/>
|
||||
<option name="BACKGROUND" value="f5f5f5"/>
|
||||
<option name="EFFECT_COLOR" value="aaaaaa"/>
|
||||
<option name="EFFECT_TYPE" value="0"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="BREADCRUMBS_HOVERED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="323232"/>
|
||||
<option name="BACKGROUND" value="dcdcdc"/>
|
||||
<option name="EFFECT_COLOR" value="aaaaaa"/>
|
||||
<option name="EFFECT_TYPE" value="0"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="BREADCRUMBS_CURRENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="323232"/>
|
||||
<option name="BACKGROUND" value="fafadc"/>
|
||||
<option name="EFFECT_COLOR" value="aaaaaa"/>
|
||||
<option name="EFFECT_TYPE" value="0"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="BREADCRUMBS_INACTIVE">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="aaaaaa"/>
|
||||
<option name="BACKGROUND" value="fdfdfd"/>
|
||||
<option name="EFFECT_COLOR" value="c8c8c8"/>
|
||||
<option name="EFFECT_TYPE" value="0"/>
|
||||
</value>
|
||||
</option>
|
||||
</attributes>
|
||||
|
||||
</scheme>
|
||||
@@ -1105,19 +1125,6 @@
|
||||
<option name="VCS_ANNOTATIONS_COLOR_3" value="41444a"/>
|
||||
<option name="VCS_ANNOTATIONS_COLOR_4" value="484248"/>
|
||||
<option name="VCS_ANNOTATIONS_COLOR_5" value="4c393a"/>
|
||||
|
||||
<option name="BREADCRUMBS_BACKGROUND" value="65686a"/>
|
||||
<option name="BREADCRUMBS_BACKGROUND_HOVERED" value="797d7f"/>
|
||||
<option name="BREADCRUMBS_BACKGROUND_CURRENT" value="61614b"/>
|
||||
<option name="BREADCRUMBS_BACKGROUND_INACTIVE" value="828282"/>
|
||||
<option name="BREADCRUMBS_TEXT_COLOR" value="bbbbbb"/>
|
||||
<option name="BREADCRUMBS_TEXT_COLOR_HOVERED" value="bbbbbb"/>
|
||||
<option name="BREADCRUMBS_TEXT_COLOR_CURRENT" value="bbbbbb"/>
|
||||
<option name="BREADCRUMBS_TEXT_COLOR_INACTIVE" value="bbbbbb"/>
|
||||
<option name="BREADCRUMBS_BORDER_COLOR" value="323232"/>
|
||||
<option name="BREADCRUMBS_BORDER_COLOR_HOVERED" value="323232"/>
|
||||
<option name="BREADCRUMBS_BORDER_COLOR_CURRENT" value="323232"/>
|
||||
<option name="BREADCRUMBS_BORDER_COLOR_INACTIVE" value="464646"/>
|
||||
</colors>
|
||||
<attributes>
|
||||
<option name="ANNOTATION_ATTRIBUTE_NAME_ATTRIBUTES">
|
||||
@@ -2141,6 +2148,39 @@
|
||||
<option name="FOREGROUND" value="9d527c" />
|
||||
</value>
|
||||
</option>
|
||||
|
||||
<option name="BREADCRUMBS_DEFAULT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="bbbbbb"/>
|
||||
<option name="BACKGROUND" value="65686a"/>
|
||||
<option name="EFFECT_COLOR" value="323232"/>
|
||||
<option name="EFFECT_TYPE" value="0"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="BREADCRUMBS_HOVERED">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="bbbbbb"/>
|
||||
<option name="BACKGROUND" value="797d7f"/>
|
||||
<option name="EFFECT_COLOR" value="323232"/>
|
||||
<option name="EFFECT_TYPE" value="0"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="BREADCRUMBS_CURRENT">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="bbbbbb"/>
|
||||
<option name="BACKGROUND" value="61614b"/>
|
||||
<option name="EFFECT_COLOR" value="323232"/>
|
||||
<option name="EFFECT_TYPE" value="0"/>
|
||||
</value>
|
||||
</option>
|
||||
<option name="BREADCRUMBS_INACTIVE">
|
||||
<value>
|
||||
<option name="FOREGROUND" value="bbbbbb"/>
|
||||
<option name="BACKGROUND" value="828282"/>
|
||||
<option name="EFFECT_COLOR" value="464646"/>
|
||||
<option name="EFFECT_TYPE" value="0"/>
|
||||
</value>
|
||||
</option>
|
||||
</attributes>
|
||||
</scheme>
|
||||
|
||||
|
||||
+15
-1
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.structuralsearch.impl.matcher;
|
||||
|
||||
import com.intellij.dupLocator.iterators.ArrayBackedNodeIterator;
|
||||
@@ -22,7 +37,6 @@ import java.util.List;
|
||||
* Class to hold compiled pattern information
|
||||
*/
|
||||
public abstract class CompiledPattern {
|
||||
public static final String ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME = "__class_unmatched__";
|
||||
private SearchScope scope;
|
||||
private NodeIterator nodes;
|
||||
private MatchingStrategy strategy;
|
||||
|
||||
+16
-1
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.structuralsearch.impl.matcher;
|
||||
|
||||
import com.intellij.dupLocator.AbstractMatchingVisitor;
|
||||
@@ -30,7 +45,7 @@ import java.util.Map;
|
||||
@SuppressWarnings({"RefusedBequest"})
|
||||
public class GlobalMatchingVisitor extends AbstractMatchingVisitor {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.structuralsearch.impl.matcher.GlobalMatchingVisitor");
|
||||
public static final Key<List<PsiElement>> UNMATCHED_ELEMENTS_KEY = Key.create("UnmatchedElements");
|
||||
public static final Key<List<? extends PsiElement>> UNMATCHED_ELEMENTS_KEY = Key.create("UnmatchedElements");
|
||||
|
||||
// the pattern element for visitor check
|
||||
private PsiElement myElement;
|
||||
|
||||
-1
@@ -274,7 +274,6 @@ class EditVarConstraintsDialog extends DialogWrapper {
|
||||
public void actionPerformed(@NotNull final ActionEvent e) {
|
||||
final List<String> variableNames = ContainerUtil.newArrayList(myConfiguration.getMatchOptions().getVariableConstraintNames());
|
||||
variableNames.add(ScriptLog.SCRIPT_LOG_VAR_NAME);
|
||||
variableNames.remove(CompiledPattern.ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME);
|
||||
final EditScriptDialog dialog = new EditScriptDialog(project, customScriptCode.getChildComponent().getText(), variableNames);
|
||||
dialog.show();
|
||||
if (dialog.getExitCode() == OK_EXIT_CODE) {
|
||||
|
||||
-1
@@ -789,7 +789,6 @@ public class SearchDialog extends DialogWrapper {
|
||||
variableNames.add(variable.getName());
|
||||
}
|
||||
variableNames.add(Configuration.CONTEXT_VAR_NAME);
|
||||
variableNames.add(CompiledPattern.ALL_CLASS_UNMATCHED_CONTENT_VAR_ARTIFICIAL_NAME);
|
||||
configuration.getMatchOptions().retainVariableConstraints(variableNames);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,6 @@ package somepackage;
|
||||
* Title: ForecastSummaryReportTest
|
||||
*/
|
||||
public class ForecastSummaryReportTest extends SOTestCase {
|
||||
|
||||
ForecastSummaryReport oReport = null;
|
||||
ScheduleGroupData oSkdgrp = null;
|
||||
SODate oStart = null;
|
||||
@@ -79,4 +78,5 @@ public class ForecastSummaryReportTest extends SOTestCase {
|
||||
oReport.refresh();
|
||||
assertNotNull(oReport);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+177
-461
File diff suppressed because it is too large
Load Diff
+15
-1
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2016 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.structuralsearch;
|
||||
|
||||
import com.intellij.codeInsight.daemon.quickFix.LightQuickFixTestCase;
|
||||
@@ -21,7 +36,6 @@ import java.io.IOException;
|
||||
abstract class StructuralReplaceTestCase extends LightQuickFixTestCase {
|
||||
protected Replacer replacer;
|
||||
protected ReplaceOptions options;
|
||||
protected String actualResult;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
|
||||
@@ -30,7 +30,6 @@ public abstract class TestStatusListener {
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
public static void notifySuiteFinished(AbstractTestProxy root) {
|
||||
for (TestStatusListener statusListener : Extensions.getExtensions(EP_NAME)) {
|
||||
statusListener.testSuiteFinished(root);
|
||||
|
||||
@@ -380,7 +380,6 @@ public class NameUtil {
|
||||
boolean matches(@NotNull String name);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
@NotNull
|
||||
public static com.intellij.util.text.Matcher buildCompletionMatcher(@NotNull String pattern, int exactPrefixLen, boolean allowToUpper, boolean allowToLower) {
|
||||
|
||||
@@ -74,7 +74,7 @@ public final class VcsConfiguration implements PersistentStateComponent<VcsConfi
|
||||
public boolean LIMIT_HISTORY = true;
|
||||
public int MAXIMUM_HISTORY_ROWS = 1000;
|
||||
public String UPDATE_FILTER_SCOPE_NAME = null;
|
||||
public boolean USE_COMMIT_MESSAGE_MARGIN = false;
|
||||
public boolean USE_COMMIT_MESSAGE_MARGIN = true;
|
||||
public int COMMIT_MESSAGE_MARGIN_SIZE = 72;
|
||||
public boolean WRAP_WHEN_TYPING_REACHES_RIGHT_MARGIN = false;
|
||||
public boolean SHOW_UNVERSIONED_FILES_WHILE_COMMIT = true;
|
||||
|
||||
@@ -64,9 +64,9 @@ public class VcsUtil {
|
||||
|
||||
private static int computeLoadedFileSize() {
|
||||
int result = (int)PersistentFSConstants.FILE_LENGTH_TO_CACHE_THRESHOLD;
|
||||
final String userLimitKb = System.getProperty(MAX_VCS_LOADED_SIZE_KB);
|
||||
String userLimitKb = System.getProperty(MAX_VCS_LOADED_SIZE_KB);
|
||||
try {
|
||||
return userLimitKb != null ? Math.min(Integer.parseInt(userLimitKb) * 1024, result) : result;
|
||||
return userLimitKb != null ? Integer.parseInt(userLimitKb) * 1024 : result;
|
||||
}
|
||||
catch (NumberFormatException ignored) {
|
||||
return result;
|
||||
|
||||
@@ -131,6 +131,7 @@ public class CommitMessage extends AbstractDataProviderPanel implements Disposab
|
||||
|
||||
features.add(SoftWrapsEditorCustomization.ENABLED);
|
||||
features.add(AdditionalPageAtBottomEditorCustomization.DISABLED);
|
||||
features.add(MonospaceEditorCustomization.getInstance());
|
||||
|
||||
EditorTextFieldProvider service = ServiceManager.getService(project, EditorTextFieldProvider.class);
|
||||
return service.getEditorField(FileTypes.PLAIN_TEXT.getLanguage(), project, features);
|
||||
|
||||
+2
-5
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.siyeh.ig.errorhandling;
|
||||
|
||||
import com.intellij.codeInspection.ui.SingleCheckboxOptionsPanel;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.InheritanceUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
@@ -24,13 +23,11 @@ import com.siyeh.ig.BaseInspectionVisitor;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class NewExceptionWithoutArgumentsInspection extends BaseInspection {
|
||||
|
||||
@Deprecated
|
||||
@SuppressWarnings({"PublicField", "UnusedDeclaration"})
|
||||
public boolean ignoreWithoutParameters = false;
|
||||
@SuppressWarnings("PublicField")
|
||||
public boolean ignoreWithoutParameters;
|
||||
|
||||
@Nls
|
||||
@NotNull
|
||||
|
||||
@@ -69,7 +69,6 @@ public abstract class CoverageDataManager implements ProjectComponent, JDOMExter
|
||||
/**
|
||||
* TeamCity 3.1.1 compatibility
|
||||
*/
|
||||
@SuppressWarnings({"UnusedDeclaration"})
|
||||
@Deprecated
|
||||
public CoverageSuite addCoverageSuite(String name,
|
||||
CoverageFileProvider fileProvider,
|
||||
|
||||
@@ -145,16 +145,21 @@ class DebugConsoleStdIn(BaseStdIn):
|
||||
BaseStdIn.__init__(self, original_stdin)
|
||||
self.debugger = dbg
|
||||
|
||||
def readline(self, *args, **kwargs):
|
||||
# Notify Java side about input and call original function
|
||||
def __pydev_run_command(self, is_started):
|
||||
try:
|
||||
cmd = self.debugger.cmd_factory.make_input_requested_message()
|
||||
cmd = self.debugger.cmd_factory.make_input_requested_message(is_started)
|
||||
self.debugger.writer.add_command(cmd)
|
||||
except Exception:
|
||||
import traceback
|
||||
traceback.print_exc()
|
||||
return '\n'
|
||||
return self.original_stdin.readline(*args, **kwargs)
|
||||
|
||||
def readline(self, *args, **kwargs):
|
||||
# Notify Java side about input and call original function
|
||||
self.__pydev_run_command(True)
|
||||
result = self.original_stdin.readline(*args, **kwargs)
|
||||
self.__pydev_run_command(False)
|
||||
return result
|
||||
|
||||
|
||||
class CodeFragment:
|
||||
|
||||
@@ -191,6 +191,7 @@ ID_TO_MEANING = {
|
||||
'139': 'CMD_SEND_CURR_EXCEPTION_TRACE_PROCEEDED',
|
||||
'140': 'CMD_IGNORE_THROWN_EXCEPTION_AT',
|
||||
'141': 'CMD_ENABLE_DONT_TRACE',
|
||||
'142': 'CMD_SHOW_CONSOLE',
|
||||
'143': 'CMD_GET_ARRAY',
|
||||
'144': 'CMD_STEP_INTO_MY_CODE',
|
||||
'145': 'CMD_GET_CONCURRENCY_EVENT',
|
||||
@@ -791,9 +792,9 @@ class NetCommandFactory:
|
||||
except:
|
||||
return self.make_error_message(0, get_exception_traceback_str())
|
||||
|
||||
def make_input_requested_message(self):
|
||||
def make_input_requested_message(self, started):
|
||||
try:
|
||||
return NetCommand(CMD_INPUT_REQUESTED, 0, '')
|
||||
return NetCommand(CMD_INPUT_REQUESTED, 0, started)
|
||||
except:
|
||||
return self.make_error_message(0, get_exception_traceback_str())
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ from _pydev_imps._pydev_saved_modules import threading
|
||||
|
||||
from _pydev_bundle import pydev_imports
|
||||
from _pydevd_bundle.pydevd_utils import save_main_module
|
||||
from _pydev_bundle.pydev_console_utils import StdIn
|
||||
|
||||
|
||||
def run_file(file, globals=None, locals=None):
|
||||
@@ -40,7 +41,6 @@ def run_file(file, globals=None, locals=None):
|
||||
# main
|
||||
#=======================================================================================================================
|
||||
if __name__ == '__main__':
|
||||
sys.stdin = BaseStdIn(sys.stdin)
|
||||
port, client_port = sys.argv[1:3]
|
||||
|
||||
del sys.argv[1]
|
||||
@@ -72,6 +72,8 @@ if __name__ == '__main__':
|
||||
server_thread.setDaemon(True)
|
||||
server_thread.start()
|
||||
|
||||
sys.stdin = StdIn(interpreter, host, client_port, sys.stdin)
|
||||
|
||||
globals = run_file(file, None, None)
|
||||
|
||||
interpreter.get_namespace().update(globals)
|
||||
|
||||
@@ -962,6 +962,7 @@ class PyDB:
|
||||
traceback.print_exc()
|
||||
|
||||
pydev_imports.execfile(file, globals, locals) # execute the script
|
||||
return globals
|
||||
|
||||
def exiting(self):
|
||||
sys.stdout.flush()
|
||||
|
||||
@@ -37,7 +37,7 @@ public interface IPyDebugProcess extends PyFrameAccessor {
|
||||
|
||||
boolean isSuspendedOnAllThreadsPolicy();
|
||||
|
||||
void consoleInputRequested();
|
||||
void consoleInputRequested(boolean isStarted);
|
||||
|
||||
XDebugSession getSession();
|
||||
}
|
||||
|
||||
@@ -131,6 +131,10 @@ public class ProtocolParser {
|
||||
return threadingEvent;
|
||||
}
|
||||
|
||||
public static boolean parseInputCommand(String payload) throws PyDebuggerException {
|
||||
return payload.equals("True");
|
||||
}
|
||||
|
||||
public static String parseSourceContent(String payload) throws PyDebuggerException {
|
||||
return payload;
|
||||
}
|
||||
|
||||
@@ -552,7 +552,7 @@ public class RemoteDebugger implements ProcessDebugger {
|
||||
recordConcurrencyEvent(ProtocolParser.parseConcurrencyEvent(frame.getPayload(), myDebugProcess.getPositionConverter()));
|
||||
}
|
||||
else if (AbstractCommand.isInputRequested(frame.getCommand())) {
|
||||
myDebugProcess.consoleInputRequested();
|
||||
myDebugProcess.consoleInputRequested(ProtocolParser.parseInputCommand(frame.getPayload()));
|
||||
}
|
||||
else {
|
||||
placeResponse(frame.getSequence(), frame);
|
||||
|
||||
@@ -103,6 +103,17 @@ open class PydevConsoleExecuteActionHandler(private val myConsoleView: LanguageC
|
||||
}
|
||||
}
|
||||
|
||||
fun inputReceived() {
|
||||
if (consoleCommunication is PythonDebugConsoleCommunication) {
|
||||
if (consoleCommunication.waitingForInput) {
|
||||
consoleCommunication.waitingForInput = false
|
||||
val console = myConsoleView
|
||||
if (PyConsoleUtil.INPUT_PROMPT.equals(console.prompt) || PyConsoleUtil.HELP_PROMPT.equals(console.prompt)) {
|
||||
console.prompt = PyConsoleUtil.ORDINARY_PROMPT
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun inPrompt() {
|
||||
if (ipythonEnabled) {
|
||||
|
||||
@@ -118,6 +118,12 @@ public class PythonConsoleView extends LanguageConsoleImpl implements Observable
|
||||
myExecuteActionHandler = consoleExecuteActionHandler;
|
||||
}
|
||||
|
||||
public void setConsoleEnabled(boolean flag) {
|
||||
if (myExecuteActionHandler != null) {
|
||||
myExecuteActionHandler.setEnabled(flag);
|
||||
}
|
||||
}
|
||||
|
||||
public void showStartMessageForFirstExecution(String startCommand) {
|
||||
if (myFirstRun && myExecuteActionHandler != null) {
|
||||
setPrompt("");
|
||||
@@ -136,6 +142,13 @@ public class PythonConsoleView extends LanguageConsoleImpl implements Observable
|
||||
}
|
||||
}
|
||||
|
||||
public void inputReceived() {
|
||||
// If user's input was entered while debug console was turned off, we shouldn't wait for it anymore
|
||||
if (myExecuteActionHandler != null) {
|
||||
myExecuteActionHandler.inputReceived();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestFocus() {
|
||||
IdeFocusManager.findInstance().requestFocus(getConsoleEditor().getContentComponent(), true);
|
||||
|
||||
@@ -54,6 +54,7 @@ public class PythonDebugLanguageConsoleView extends DuplexConsoleView<ConsoleVie
|
||||
getPydevConsoleView().executeCode(code, e);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public PythonConsoleView getPydevConsoleView() {
|
||||
return getSecondaryConsoleView();
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@ import com.intellij.xdebugger.frame.XSuspendContext;
|
||||
import com.intellij.xdebugger.frame.XValueChildrenList;
|
||||
import com.intellij.xdebugger.stepping.XSmartStepIntoHandler;
|
||||
import com.jetbrains.python.PythonFileType;
|
||||
import com.jetbrains.python.console.PythonConsoleView;
|
||||
import com.jetbrains.python.console.PythonDebugLanguageConsoleView;
|
||||
import com.jetbrains.python.console.pydev.PydevCompletionVariant;
|
||||
import com.jetbrains.python.debugger.pydev.*;
|
||||
@@ -341,14 +342,24 @@ public class PyDebugProcess extends XDebugProcess implements IPyDebugProcess, Pr
|
||||
public void showConsole(PyThreadInfo thread) {
|
||||
myConsoleContextFrame = new PyExecutionStack(this, thread).getTopFrame();
|
||||
if (myExecutionConsole instanceof PythonDebugLanguageConsoleView) {
|
||||
UIUtil.invokeLaterIfNeeded(() -> ((PythonDebugLanguageConsoleView)myExecutionConsole).enableConsole(false));
|
||||
PythonDebugLanguageConsoleView consoleView = (PythonDebugLanguageConsoleView)myExecutionConsole;
|
||||
UIUtil.invokeLaterIfNeeded(() -> {
|
||||
consoleView.enableConsole(false);
|
||||
consoleView.getPydevConsoleView().setConsoleEnabled(true);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void consoleInputRequested() {
|
||||
public void consoleInputRequested(boolean isStarted) {
|
||||
if (myExecutionConsole instanceof PythonDebugLanguageConsoleView) {
|
||||
((PythonDebugLanguageConsoleView)myExecutionConsole).getPydevConsoleView().inputRequested();
|
||||
PythonConsoleView consoleView = ((PythonDebugLanguageConsoleView)myExecutionConsole).getPydevConsoleView();
|
||||
if (isStarted) {
|
||||
consoleView.inputRequested();
|
||||
}
|
||||
else {
|
||||
consoleView.inputReceived();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -18,8 +18,10 @@ package com.intellij.xml.breadcrumbs;
|
||||
import com.intellij.ide.ui.UISettings;
|
||||
import com.intellij.openapi.Disposable;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.colors.ColorKey;
|
||||
import com.intellij.openapi.editor.colors.EditorColors;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsManager;
|
||||
import com.intellij.openapi.editor.colors.TextAttributesKey;
|
||||
import com.intellij.openapi.editor.markup.TextAttributes;
|
||||
import com.intellij.openapi.util.Weighted;
|
||||
import com.intellij.ui.paint.RectanglePainter;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -40,26 +42,6 @@ import java.util.List;
|
||||
* @author spleaner
|
||||
*/
|
||||
public class BreadcrumbsComponent<T extends BreadcrumbsItem> extends JComponent implements Disposable, Weighted {
|
||||
private interface Background {
|
||||
ColorKey DEFAULT = ColorKey.createColorKey("BREADCRUMBS_BACKGROUND");
|
||||
ColorKey HOVERED = ColorKey.createColorKey("BREADCRUMBS_BACKGROUND_HOVERED");
|
||||
ColorKey CURRENT = ColorKey.createColorKey("BREADCRUMBS_BACKGROUND_CURRENT");
|
||||
ColorKey INACTIVE = ColorKey.createColorKey("BREADCRUMBS_BACKGROUND_INACTIVE");
|
||||
}
|
||||
|
||||
private interface TextColor {
|
||||
ColorKey DEFAULT = ColorKey.createColorKey("BREADCRUMBS_TEXT_COLOR");
|
||||
ColorKey HOVERED = ColorKey.createColorKey("BREADCRUMBS_TEXT_COLOR_HOVERED");
|
||||
ColorKey CURRENT = ColorKey.createColorKey("BREADCRUMBS_TEXT_COLOR_CURRENT");
|
||||
ColorKey INACTIVE = ColorKey.createColorKey("BREADCRUMBS_TEXT_COLOR_INACTIVE");
|
||||
}
|
||||
|
||||
private interface BorderColor {
|
||||
ColorKey DEFAULT = ColorKey.createColorKey("BREADCRUMBS_BORDER_COLOR");
|
||||
ColorKey HOVERED = ColorKey.createColorKey("BREADCRUMBS_BORDER_COLOR_HOVERED");
|
||||
ColorKey CURRENT = ColorKey.createColorKey("BREADCRUMBS_BORDER_COLOR_CURRENT");
|
||||
ColorKey INACTIVE = ColorKey.createColorKey("BREADCRUMBS_BORDER_COLOR_INACTIVE");
|
||||
}
|
||||
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.xml.breadcrumbs.BreadcrumbsComponent");
|
||||
private static final Painter DEFAULT_PAINTER = new DefaultPainter(new ButtonSettings());
|
||||
@@ -622,17 +604,17 @@ public class BreadcrumbsComponent<T extends BreadcrumbsItem> extends JComponent
|
||||
abstract static class PainterSettings {
|
||||
@Nullable
|
||||
Color getBackgroundColor(@NotNull final Crumb c) {
|
||||
return getColor(c, Background.DEFAULT, Background.HOVERED, Background.CURRENT, Background.INACTIVE);
|
||||
return getAttributes(c).getBackgroundColor();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Color getForegroundColor(@NotNull final Crumb c) {
|
||||
return getColor(c, TextColor.DEFAULT, TextColor.HOVERED, TextColor.CURRENT, TextColor.INACTIVE);
|
||||
return getAttributes(c).getForegroundColor();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
Color getBorderColor(@NotNull final Crumb c) {
|
||||
return getColor(c, BorderColor.DEFAULT, BorderColor.HOVERED, BorderColor.CURRENT, BorderColor.INACTIVE);
|
||||
return getAttributes(c).getEffectColor();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@@ -640,28 +622,34 @@ public class BreadcrumbsComponent<T extends BreadcrumbsItem> extends JComponent
|
||||
return null;
|
||||
}
|
||||
|
||||
static Color getColor(Crumb c, ColorKey main, ColorKey hovered, ColorKey current, ColorKey inactive) {
|
||||
return EditorColorsManager.getInstance().getGlobalScheme().getColor(
|
||||
@NotNull
|
||||
static TextAttributesKey getKey(Crumb c) {
|
||||
return
|
||||
c.isHovered()
|
||||
? hovered
|
||||
? EditorColors.BREADCRUMBS_HOVERED
|
||||
: c.isSelected()
|
||||
? current
|
||||
? EditorColors.BREADCRUMBS_CURRENT
|
||||
: c.isLight() && !(c instanceof NavigationCrumb)
|
||||
? inactive
|
||||
: main);
|
||||
? EditorColors.BREADCRUMBS_INACTIVE
|
||||
: EditorColors.BREADCRUMBS_DEFAULT;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
static TextAttributes getAttributes(Crumb c) {
|
||||
return EditorColorsManager.getInstance().getGlobalScheme().getAttributes(getKey(c));
|
||||
}
|
||||
}
|
||||
|
||||
static class ButtonSettings extends PainterSettings {
|
||||
static Color getBackgroundColor(boolean selected, boolean hovered, boolean light, boolean navigationCrumb) {
|
||||
return EditorColorsManager.getInstance().getGlobalScheme().getColor(
|
||||
return EditorColorsManager.getInstance().getGlobalScheme().getAttributes(
|
||||
hovered
|
||||
? Background.HOVERED
|
||||
? EditorColors.BREADCRUMBS_HOVERED
|
||||
: selected
|
||||
? Background.CURRENT
|
||||
? EditorColors.BREADCRUMBS_CURRENT
|
||||
: light && !navigationCrumb
|
||||
? Background.INACTIVE
|
||||
: Background.DEFAULT);
|
||||
? EditorColors.BREADCRUMBS_INACTIVE
|
||||
: EditorColors.BREADCRUMBS_DEFAULT).getBackgroundColor();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user