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:
@@ -30,6 +30,7 @@ import com.intellij.psi.impl.source.tree.TreeElement;
|
||||
import com.intellij.psi.tree.IElementType;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtilCore;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -177,7 +178,9 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
|
||||
|
||||
@Override
|
||||
public PsiElement findElementAt(int offset) {
|
||||
PsiElement mirrorAt = getMirror().findElementAt(offset);
|
||||
PsiElement mirror = getMirror();
|
||||
if (mirror == null) return null;
|
||||
PsiElement mirrorAt = mirror.findElementAt(offset);
|
||||
while (true) {
|
||||
if (mirrorAt == null) return null;
|
||||
PsiElement elementAt = mirrorToElement(mirrorAt);
|
||||
@@ -188,7 +191,9 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
|
||||
|
||||
@Override
|
||||
public PsiReference findReferenceAt(int offset) {
|
||||
PsiReference mirrorRef = getMirror().findReferenceAt(offset);
|
||||
PsiElement mirror = getMirror();
|
||||
if (mirror == null) return null;
|
||||
PsiReference mirrorRef = mirror.findReferenceAt(offset);
|
||||
if (mirrorRef == null) return null;
|
||||
PsiElement mirrorElement = mirrorRef.getElement();
|
||||
PsiElement element = mirrorToElement(mirrorElement);
|
||||
@@ -235,7 +240,8 @@ public abstract class ClsElementImpl extends PsiElementBase implements PsiCompil
|
||||
@Override
|
||||
@NotNull
|
||||
public char[] textToCharArray() {
|
||||
return getMirror().textToCharArray();
|
||||
PsiElement mirror = getMirror();
|
||||
return mirror != null ? mirror.textToCharArray() : ArrayUtil.EMPTY_CHAR_ARRAY;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -140,7 +140,7 @@ public class ConsoleExecuteAction extends DumbAwareAction {
|
||||
private boolean myAddToHistory = true;
|
||||
final boolean myPreserveMarkup;
|
||||
|
||||
boolean useProcessStdIn;
|
||||
boolean myUseProcessStdIn;
|
||||
|
||||
public ConsoleExecuteActionHandler(boolean preserveMarkup) {
|
||||
myCommandHistoryModel = new ConsoleHistoryModel();
|
||||
@@ -163,14 +163,14 @@ public class ConsoleExecuteAction extends DumbAwareAction {
|
||||
}
|
||||
|
||||
protected void runExecuteAction(@NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) {
|
||||
if (!useProcessStdIn) {
|
||||
if (!myUseProcessStdIn) {
|
||||
beforeExecution(console);
|
||||
}
|
||||
|
||||
String text = console.prepareExecuteAction(myAddToHistory && !useProcessStdIn, myPreserveMarkup, true);
|
||||
String text = console.prepareExecuteAction(myAddToHistory && !myUseProcessStdIn, myPreserveMarkup, true);
|
||||
((UndoManagerImpl)UndoManager.getInstance(console.getProject())).invalidateActionsFor(DocumentReferenceManager.getInstance().create(console.getCurrentEditor().getDocument()));
|
||||
|
||||
if (useProcessStdIn) {
|
||||
if (myUseProcessStdIn) {
|
||||
assert consoleView != null;
|
||||
consoleView.print(text, ConsoleViewContentType.USER_INPUT);
|
||||
consoleView.print("\n", ConsoleViewContentType.USER_INPUT);
|
||||
|
||||
@@ -175,7 +175,7 @@ public final class LanguageConsoleBuilder {
|
||||
if (processInputStateKey != null) {
|
||||
assert executeActionHandler != null;
|
||||
if (PropertiesComponent.getInstance().getBoolean(processInputStateKey, false)) {
|
||||
executeActionHandler.useProcessStdIn = true;
|
||||
executeActionHandler.myUseProcessStdIn = true;
|
||||
DaemonCodeAnalyzer daemonCodeAnalyzer = DaemonCodeAnalyzer.getInstance(consoleView.getProject());
|
||||
daemonCodeAnalyzer.setHighlightingEnabled(consoleView.getConsole().getFile(), false);
|
||||
}
|
||||
|
||||
@@ -51,6 +51,6 @@ final class UseConsoleInputAction extends ToggleAction implements DumbAware {
|
||||
|
||||
List<AnAction> actions = ActionUtil.getActions(consoleView.getConsole().getConsoleEditor().getComponent());
|
||||
ConsoleExecuteAction action = ContainerUtil.findInstance(actions, ConsoleExecuteAction.class);
|
||||
action.myExecuteActionHandler.useProcessStdIn = !state;
|
||||
action.myExecuteActionHandler.myUseProcessStdIn = !state;
|
||||
}
|
||||
}
|
||||
+8
-25
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.idea.Bombed;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.SkipInHeadlessEnvironment;
|
||||
@@ -25,44 +24,28 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Calendar;
|
||||
import java.util.List;
|
||||
|
||||
@SkipInHeadlessEnvironment
|
||||
public class FinderRecursivePanelSelectionUpdateTest extends PlatformTestCase {
|
||||
|
||||
@Bombed(year = 2015, month = Calendar.APRIL, day = 1, user = "Yann Cebron")
|
||||
public void testUpdate() throws InterruptedException {
|
||||
StringFinderRecursivePanel panel_0 = new StringFinderRecursivePanel(getProject()) {
|
||||
@NotNull
|
||||
@Override
|
||||
protected JComponent createRightComponent(String s) {
|
||||
return new StringFinderRecursivePanel(this) {
|
||||
@Override
|
||||
@NotNull
|
||||
protected JComponent createRightComponent(String s) {
|
||||
return new StringFinderRecursivePanel(this) {
|
||||
@Override
|
||||
@NotNull
|
||||
protected JComponent createRightComponent(String s) {
|
||||
return new StringFinderRecursivePanel(this);
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
StringFinderRecursivePanel panel_0 = new StringFinderRecursivePanel(getProject());
|
||||
disposeOnTearDown(panel_0);
|
||||
|
||||
final StringFinderRecursivePanel panel_1 = new StringFinderRecursivePanel(panel_0);
|
||||
panel_1.setSecondComponent(panel_0);
|
||||
panel_0.setTestSelectedIndex(0);
|
||||
|
||||
StringFinderRecursivePanel panel_1 = (StringFinderRecursivePanel)panel_0.getSecondComponent();
|
||||
final StringFinderRecursivePanel panel_2 = new StringFinderRecursivePanel(panel_1);
|
||||
panel_1.setSecondComponent(panel_2);
|
||||
panel_1.setTestSelectedIndex(1);
|
||||
|
||||
StringFinderRecursivePanel panel_2 = (StringFinderRecursivePanel)panel_1.getSecondComponent();
|
||||
final StringFinderRecursivePanel panel_3 = new StringFinderRecursivePanel(panel_2);
|
||||
panel_2.setSecondComponent(panel_3);
|
||||
panel_2.setTestSelectedIndex(2);
|
||||
|
||||
StringFinderRecursivePanel panel_3 = (StringFinderRecursivePanel)panel_2.getSecondComponent();
|
||||
panel_3.setSecondComponent(new StringFinderRecursivePanel(panel_3));
|
||||
panel_3.setTestSelectedIndex(3);
|
||||
|
||||
panel_0.updatePanel();
|
||||
|
||||
@@ -56,7 +56,7 @@ public class IdeaDecompiler extends ClassFileDecompilers.Light {
|
||||
"//\n\n";
|
||||
|
||||
private final IFernflowerLogger myLogger = new IdeaLogger();
|
||||
private final HashMap<String, Object> myOptions = new HashMap<String, Object>();
|
||||
private final Map<String, Object> myOptions = new HashMap<String, Object>();
|
||||
|
||||
public IdeaDecompiler() {
|
||||
myOptions.put(IFernflowerPreferences.HIDE_DEFAULT_CONSTRUCTOR, "0");
|
||||
|
||||
+38
-37
@@ -49,32 +49,16 @@ public class XsltSymbolIndex extends FileBasedIndexExtension<String, XsltSymbolI
|
||||
@NonNls
|
||||
public static final ID<String, Kind> NAME = ID.create("XsltSymbolIndex");
|
||||
|
||||
enum Kind {
|
||||
PARAM(XsltParameter.class), VARIABLE(XsltVariable.class), TEMPLATE(XsltTemplate.class), ANYTHING(null);
|
||||
@SuppressWarnings({ "UnusedDeclaration" })
|
||||
public static Collection<String> getSymbolNames(Project project) {
|
||||
return FileBasedIndex.getInstance().getAllKeys(NAME, project);
|
||||
}
|
||||
|
||||
final Class<? extends XsltElement> myClazz;
|
||||
|
||||
Kind(Class<? extends XsltElement> clazz) {
|
||||
myClazz = clazz;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public XsltElement wrap(XmlTag tag) {
|
||||
final Class<? extends XsltElement> clazz;
|
||||
if (myClazz != null) {
|
||||
if (!name().toLowerCase().equals(tag.getLocalName())) {
|
||||
return null;
|
||||
}
|
||||
clazz = myClazz;
|
||||
} else {
|
||||
try {
|
||||
clazz = valueOf(tag.getLocalName().toUpperCase()).myClazz;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return XsltElementFactory.getInstance().wrapElement(tag, clazz);
|
||||
}
|
||||
public static NavigationItem[] getSymbolsByName(final String name, Project project, boolean includeNonProjectItems) {
|
||||
final GlobalSearchScope scope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
|
||||
final SymbolCollector collector = new SymbolCollector(name, project, scope);
|
||||
FileBasedIndex.getInstance().processValues(NAME, name, null, collector, scope);
|
||||
return collector.getResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -165,16 +149,32 @@ public class XsltSymbolIndex extends FileBasedIndexExtension<String, XsltSymbolI
|
||||
return 0;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "UnusedDeclaration" })
|
||||
public static Collection<String> getSymbolNames(Project project) {
|
||||
return FileBasedIndex.getInstance().getAllKeys(NAME, project);
|
||||
}
|
||||
enum Kind {
|
||||
PARAM(XsltParameter.class), VARIABLE(XsltVariable.class), TEMPLATE(XsltTemplate.class), ANYTHING(null);
|
||||
|
||||
public static NavigationItem[] getSymbolsByName(final String name, Project project, boolean includeNonProjectItems) {
|
||||
final GlobalSearchScope scope = includeNonProjectItems ? GlobalSearchScope.allScope(project) : GlobalSearchScope.projectScope(project);
|
||||
final SymbolCollector collector = new SymbolCollector(name, project, scope);
|
||||
FileBasedIndex.getInstance().processValues(NAME, name, null, collector, scope);
|
||||
return collector.getResult();
|
||||
final Class<? extends XsltElement> myClazz;
|
||||
|
||||
Kind(Class<? extends XsltElement> clazz) {
|
||||
myClazz = clazz;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public XsltElement wrap(XmlTag tag) {
|
||||
final Class<? extends XsltElement> clazz;
|
||||
if (myClazz != null) {
|
||||
if (!name().toLowerCase().equals(tag.getLocalName())) {
|
||||
return null;
|
||||
}
|
||||
clazz = myClazz;
|
||||
} else {
|
||||
try {
|
||||
clazz = valueOf(tag.getLocalName().toUpperCase()).myClazz;
|
||||
} catch (IllegalArgumentException e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return XsltElementFactory.getInstance().wrapElement(tag, clazz);
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyAttributeHandler extends NanoXmlUtil.IXMLBuilderAdapter {
|
||||
@@ -213,12 +213,13 @@ public class XsltSymbolIndex extends FileBasedIndexExtension<String, XsltSymbolI
|
||||
public boolean process(VirtualFile file, Kind kind) {
|
||||
if (myScope.contains(file)) {
|
||||
final PsiFile psiFile = myMgr.findFile(file);
|
||||
if (XsltSupport.isXsltFile(psiFile)) {
|
||||
if (psiFile != null && XsltSupport.isXsltFile(psiFile)) {
|
||||
final XmlTag[] tags;
|
||||
try {
|
||||
final XmlTag root = ((XmlFile)psiFile).getDocument().getRootTag();
|
||||
final XmlTag root = ((XmlFile)psiFile).getRootTag();
|
||||
assert root != null;
|
||||
if (kind == Kind.ANYTHING) {
|
||||
final XmlTag[] v = root.findSubTags("variable", XsltSupport.XSLT_NS);
|
||||
final XmlTag[] v = root.findSubTags("variable", XsltSupport.XSLT_NS);
|
||||
final XmlTag[] p = root.findSubTags("param", XsltSupport.XSLT_NS);
|
||||
final XmlTag[] t = root.findSubTags("template", XsltSupport.XSLT_NS);
|
||||
tags = ArrayUtil.mergeArrays(ArrayUtil.mergeArrays(v, p), t);
|
||||
|
||||
@@ -16,6 +16,9 @@
|
||||
package com.jetbrains.python.psi.resolve;
|
||||
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.fileTypes.ExtensionFileNameMatcher;
|
||||
import com.intellij.openapi.fileTypes.FileNameMatcher;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
@@ -30,6 +33,7 @@ import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.QualifiedName;
|
||||
import com.intellij.util.containers.HashSet;
|
||||
import com.jetbrains.python.PyNames;
|
||||
import com.jetbrains.python.PythonFileType;
|
||||
import com.jetbrains.python.psi.*;
|
||||
import com.jetbrains.python.psi.impl.*;
|
||||
import com.jetbrains.python.psi.types.PyModuleType;
|
||||
@@ -346,8 +350,16 @@ public class ResolveImportUtil {
|
||||
|
||||
@Nullable
|
||||
private static PsiFile findPyFileInDir(PsiDirectory dir, String referencedName) {
|
||||
final PsiFile file = dir.findFile(referencedName + PyNames.DOT_PY);
|
||||
// findFile() does case-insensitive search, and we need exactly matching case (see PY-381)
|
||||
PsiFile file = dir.findFile(referencedName + PyNames.DOT_PY);
|
||||
if (file == null) {
|
||||
final List<FileNameMatcher> associations = FileTypeManager.getInstance().getAssociations(PythonFileType.INSTANCE);
|
||||
for (FileNameMatcher association : associations) {
|
||||
if (association instanceof ExtensionFileNameMatcher) {
|
||||
file = dir.findFile(referencedName + "." + ((ExtensionFileNameMatcher)association).getExtension());
|
||||
if (file != null) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (file != null && FileUtil.getNameWithoutExtension(file.getName()).equals(referencedName)) {
|
||||
return file;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user