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:
Generated
+11
@@ -0,0 +1,11 @@
|
||||
<component name="libraryTable">
|
||||
<library name="asm5">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/asm-all.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/asm5-src.zip!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -16,17 +16,16 @@
|
||||
package com.intellij.openapi.compiler;
|
||||
|
||||
import com.intellij.compiler.CompilerConfiguration;
|
||||
import com.intellij.ide.highlighter.ProjectFileType;
|
||||
import com.intellij.openapi.application.Application;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectUtilCore;
|
||||
import com.intellij.openapi.roots.CompilerModuleExtension;
|
||||
import com.intellij.openapi.roots.ModuleRootManager;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileManager;
|
||||
@@ -38,7 +37,6 @@ import org.jetbrains.jps.model.java.compiler.AnnotationProcessingConfiguration;
|
||||
import java.io.File;
|
||||
import java.util.Arrays;
|
||||
import java.util.Comparator;
|
||||
import java.util.Locale;
|
||||
|
||||
/**
|
||||
* A set of utility methods for working with paths
|
||||
@@ -47,16 +45,13 @@ public class CompilerPaths {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.compiler.CompilerPaths");
|
||||
private static volatile String ourSystemPath;
|
||||
private static final Comparator<String> URLS_COMPARATOR = new Comparator<String>() {
|
||||
@Override
|
||||
public int compare(String o1, String o2) {
|
||||
return o1.compareTo(o2);
|
||||
}
|
||||
};
|
||||
private static final String DEFAULT_GENERATED_DIR_NAME = "generated";
|
||||
|
||||
/**
|
||||
* Returns a directory
|
||||
* @param project
|
||||
* @param compiler
|
||||
* @return a directory where compiler may generate files. All generated files are not deleted when the application exits
|
||||
*/
|
||||
public static File getGeneratedDataDirectory(Project project, Compiler compiler) {
|
||||
@@ -65,7 +60,6 @@ public class CompilerPaths {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @return a root directory where generated files for various compilers are stored
|
||||
*/
|
||||
public static File getGeneratedDataDirectory(Project project) {
|
||||
@@ -74,7 +68,6 @@ public class CompilerPaths {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @return a root directory where compiler caches for the given project are stored
|
||||
*/
|
||||
public static File getCacheStoreDirectory(final Project project) {
|
||||
@@ -92,7 +85,6 @@ public class CompilerPaths {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param project
|
||||
* @return a directory under IDEA "system" directory where all files related to compiler subsystem are stored (such as compiler caches or generated files)
|
||||
*/
|
||||
public static File getCompilerSystemDirectory(Project project) {
|
||||
@@ -104,36 +96,7 @@ public class CompilerPaths {
|
||||
}
|
||||
|
||||
public static String getCompilerSystemDirectoryName(Project project) {
|
||||
return getPresentableName(project) + "." + project.getLocationHash();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static String getPresentableName(final Project project) {
|
||||
if (project.isDefault()) {
|
||||
return project.getName();
|
||||
}
|
||||
|
||||
String location = project.getPresentableUrl();
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String projectName = FileUtil.toSystemIndependentName(location);
|
||||
if (projectName.endsWith("/")) {
|
||||
projectName = projectName.substring(0, projectName.length() - 1);
|
||||
}
|
||||
|
||||
final int lastSlash = projectName.lastIndexOf('/');
|
||||
if (lastSlash >= 0 && lastSlash + 1 < projectName.length()) {
|
||||
projectName = projectName.substring(lastSlash + 1);
|
||||
}
|
||||
|
||||
if (StringUtil.endsWithIgnoreCase(projectName, ProjectFileType.DOT_DEFAULT_EXTENSION)) {
|
||||
projectName = projectName.substring(0, projectName.length() - ProjectFileType.DOT_DEFAULT_EXTENSION.length());
|
||||
}
|
||||
|
||||
projectName = projectName.toLowerCase(Locale.US).replace(':', '_'); // replace ':' from windows drive names
|
||||
return projectName;
|
||||
return ProjectUtilCore.getPresentableName(project) + "." + project.getLocationHash();
|
||||
}
|
||||
|
||||
public static File getCompilerSystemDirectory() {
|
||||
@@ -143,7 +106,6 @@ public class CompilerPaths {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param module
|
||||
* @param forTestClasses true if directory for test sources, false - for sources.
|
||||
* @return a directory to which the sources (or test sources depending on the second partameter) should be compiled.
|
||||
* Null is returned if output directory is not specified or is not valid
|
||||
@@ -190,6 +152,7 @@ public class CompilerPaths {
|
||||
}
|
||||
else {
|
||||
outPathUrl = application.runReadAction(new Computable<String>() {
|
||||
@Override
|
||||
public String compute() {
|
||||
final String url = extension.getCompilerOutputUrlForTests();
|
||||
return url != null ? url : extension.getCompilerOutputUrl();
|
||||
@@ -203,6 +166,7 @@ public class CompilerPaths {
|
||||
}
|
||||
else {
|
||||
outPathUrl = application.runReadAction(new Computable<String>() {
|
||||
@Override
|
||||
public String compute() {
|
||||
return extension.getCompilerOutputUrl();
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.debugger.ui;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -25,6 +26,13 @@ import javax.swing.*;
|
||||
|
||||
public class XBreakpointClassGroup extends XBreakpointGroup {
|
||||
private static final String DEFAULT_PACKAGE_NAME = DebuggerBundle.message("default.package.name");
|
||||
public static final XBreakpointClassGroup UNKNOWN = new XBreakpointClassGroup("", "") {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return XDebuggerBundle.message("xbreakpoint.group.unknown");
|
||||
}
|
||||
};
|
||||
|
||||
private String myPackageName;
|
||||
private String myClassName;
|
||||
|
||||
@@ -42,17 +42,18 @@ class XBreakpointGroupingByClassRule<B> extends XBreakpointGroupingRule<B, XBrea
|
||||
return XBreakpointsGroupingPriorities.BY_CLASS;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public XBreakpointClassGroup getGroup(@NotNull B b, @NotNull Collection<XBreakpointClassGroup> groups) {
|
||||
if (b instanceof XBreakpoint) {
|
||||
Breakpoint javaBreakpoint = BreakpointManager.findBreakpoint((XBreakpoint)b);
|
||||
if (javaBreakpoint == null) {
|
||||
return null;
|
||||
return XBreakpointClassGroup.UNKNOWN;
|
||||
}
|
||||
String className = javaBreakpoint.getShortClassName();
|
||||
String packageName = javaBreakpoint.getPackageName();
|
||||
if (className == null) {
|
||||
return null;
|
||||
return XBreakpointClassGroup.UNKNOWN;
|
||||
}
|
||||
for (XBreakpointClassGroup group : groups) {
|
||||
if (group.getClassName().equals(className) && group.getPackageName().equals(packageName)) {
|
||||
@@ -61,7 +62,7 @@ class XBreakpointGroupingByClassRule<B> extends XBreakpointGroupingRule<B, XBrea
|
||||
}
|
||||
return new XBreakpointClassGroup(packageName, className);
|
||||
}
|
||||
return null;
|
||||
return XBreakpointClassGroup.UNKNOWN;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
+2
-1
@@ -39,6 +39,7 @@ public class XBreakpointGroupingByPackageRule<B> extends XBreakpointGroupingRule
|
||||
return XBreakpointsGroupingPriorities.BY_PACKAGE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public XBreakpointPackageGroup getGroup(@NotNull B breakpoint, @NotNull Collection<XBreakpointPackageGroup> groups) {
|
||||
String packageName = null;
|
||||
@@ -49,7 +50,7 @@ public class XBreakpointGroupingByPackageRule<B> extends XBreakpointGroupingRule
|
||||
}
|
||||
}
|
||||
if (packageName == null) {
|
||||
return null;
|
||||
return XBreakpointPackageGroup.UNKNOWN;
|
||||
}
|
||||
for (XBreakpointPackageGroup group : groups) {
|
||||
if (StringUtil.equals(group.getPackageName(), packageName)) {
|
||||
|
||||
@@ -18,17 +18,30 @@ package com.intellij.debugger.ui;
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.util.PlatformIcons;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class XBreakpointPackageGroup extends XBreakpointGroup {
|
||||
private static final String DEFAULT_PACKAGE_NAME = DebuggerBundle.message("default.package.name");
|
||||
public static final XBreakpointPackageGroup UNKNOWN = new XBreakpointPackageGroup() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return XDebuggerBundle.message("xbreakpoint.group.unknown");
|
||||
}
|
||||
};
|
||||
|
||||
private String myPackageName;
|
||||
|
||||
public XBreakpointPackageGroup(String packageName) {
|
||||
private XBreakpointPackageGroup() {
|
||||
myPackageName = null;
|
||||
}
|
||||
|
||||
public XBreakpointPackageGroup(@NotNull String packageName) {
|
||||
myPackageName = packageName;
|
||||
}
|
||||
|
||||
@@ -44,7 +57,7 @@ public class XBreakpointPackageGroup extends XBreakpointGroup {
|
||||
return StringUtil.isEmpty(packageName) ? DEFAULT_PACKAGE_NAME : packageName;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
public String getPackageName() {
|
||||
return myPackageName;
|
||||
}
|
||||
|
||||
+11
-10
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -40,23 +40,24 @@ public class NegationBroadScopeFix implements IntentionAction {
|
||||
@Override
|
||||
@NotNull
|
||||
public String getText() {
|
||||
String text = myPrefixExpression.getOperand().getText();
|
||||
text += " ";
|
||||
PsiExpression operand = myPrefixExpression.getOperand();
|
||||
String text = operand == null ? "" : operand.getText() + " ";
|
||||
PsiElement parent = myPrefixExpression.getParent();
|
||||
String operation = parent instanceof PsiInstanceOfExpression
|
||||
? PsiKeyword.INSTANCEOF
|
||||
: ((PsiBinaryExpression)parent).getOperationSign().getText();
|
||||
text += operation + " ";
|
||||
|
||||
String rop;
|
||||
if (parent instanceof PsiInstanceOfExpression) {
|
||||
text += PsiKeyword.INSTANCEOF + " ";
|
||||
final PsiTypeElement type = ((PsiInstanceOfExpression)parent).getCheckType();
|
||||
rop = type == null ? "" : type.getText();
|
||||
}
|
||||
else {
|
||||
else if (parent instanceof PsiBinaryExpression) {
|
||||
text += ((PsiBinaryExpression)parent).getOperationSign().getText() + " ";
|
||||
final PsiExpression rOperand = ((PsiBinaryExpression)parent).getROperand();
|
||||
rop = rOperand == null ? "" : rOperand.getText();
|
||||
}
|
||||
else {
|
||||
rop = "<expr>";
|
||||
}
|
||||
|
||||
text += rop;
|
||||
return QuickFixBundle.message("negation.broader.scope.text", text);
|
||||
@@ -70,7 +71,7 @@ public class NegationBroadScopeFix implements IntentionAction {
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) {
|
||||
if (!myPrefixExpression.isValid()) return false;
|
||||
if (!myPrefixExpression.isValid() || myPrefixExpression.getOperand() == null) return false;
|
||||
|
||||
PsiElement parent = myPrefixExpression.getParent();
|
||||
if (parent instanceof PsiInstanceOfExpression && ((PsiInstanceOfExpression)parent).getOperand() == myPrefixExpression) {
|
||||
@@ -83,7 +84,7 @@ public class NegationBroadScopeFix implements IntentionAction {
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, PsiFile file) throws IncorrectOperationException {
|
||||
if (!FileModificationService.getInstance().preparePsiElementForWrite(myPrefixExpression)) return;
|
||||
if (!isAvailable(project, editor, file) || !FileModificationService.getInstance().preparePsiElementForWrite(myPrefixExpression)) return;
|
||||
PsiExpression operand = myPrefixExpression.getOperand();
|
||||
PsiElement unnegated = myPrefixExpression.replace(operand);
|
||||
PsiElement parent = unnegated.getParent();
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<orderEntry type="module" module-name="java-psi-api" exported="" />
|
||||
<orderEntry type="module" module-name="core-impl" exported="" />
|
||||
<orderEntry type="module" module-name="resources-en" />
|
||||
<orderEntry type="library" name="asm4" level="project" />
|
||||
<orderEntry type="library" name="asm5" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ import static com.intellij.psi.compiled.ClassFileDecompilers.Full;
|
||||
public class ClassFileStubBuilder implements BinaryFileStubBuilder {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.compiled.ClassFileStubBuilder");
|
||||
|
||||
public static final int STUB_VERSION = 9;
|
||||
public static final int STUB_VERSION = 10;
|
||||
|
||||
@Override
|
||||
public boolean acceptsFile(@NotNull VirtualFile file) {
|
||||
|
||||
@@ -63,7 +63,7 @@ import com.intellij.util.cls.ClsFormatException;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.ClassReader;
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collections;
|
||||
@@ -537,7 +537,8 @@ public class ClsFileImpl extends ClsRepositoryPsiElement<PsiClassHolderFileStub>
|
||||
|
||||
try {
|
||||
PsiJavaFileStubImpl stub = new PsiJavaFileStubImpl("do.not.know.yet", true);
|
||||
StubBuildingVisitor<VirtualFile> visitor = new StubBuildingVisitor<VirtualFile>(file, STRATEGY, stub, 0, file.getNameWithoutExtension());
|
||||
String className = file.getNameWithoutExtension();
|
||||
StubBuildingVisitor<VirtualFile> visitor = new StubBuildingVisitor<VirtualFile>(file, STRATEGY, stub, 0, className);
|
||||
try {
|
||||
new ClassReader(bytes).accept(visitor, ClassReader.SKIP_FRAMES);
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
package com.intellij.psi.impl.compiled;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.ClassReader;
|
||||
import org.jetbrains.org.objectweb.asm.ClassReader;
|
||||
|
||||
public interface InnerClassSourceStrategy<T> {
|
||||
@Nullable
|
||||
|
||||
@@ -31,7 +31,7 @@ import com.intellij.util.io.StringRef;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.asm4.*;
|
||||
import org.jetbrains.org.objectweb.asm.*;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.text.CharacterIterator;
|
||||
@@ -56,6 +56,8 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
|
||||
public static final String FLOAT_NEGATIVE_INF = "-1.0f / 0.0";
|
||||
public static final String FLOAT_NAN = "0.0f / 0.0";
|
||||
|
||||
public static final int ASM_API = Opcodes.ASM5;
|
||||
|
||||
@NonNls private static final String SYNTHETIC_CLASS_INIT_METHOD = "<clinit>";
|
||||
@NonNls private static final String SYNTHETIC_INIT_METHOD = "<init>";
|
||||
|
||||
@@ -68,7 +70,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
|
||||
private PsiModifierListStub myModList;
|
||||
|
||||
public StubBuildingVisitor(T classSource, InnerClassSourceStrategy<T> innersStrategy, StubElement parent, int access, String shortName) {
|
||||
super(Opcodes.ASM4);
|
||||
super(ASM_API);
|
||||
mySource = classSource;
|
||||
myInnersStrategy = innersStrategy;
|
||||
myParent = parent;
|
||||
@@ -543,7 +545,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
|
||||
private final String myDesc;
|
||||
|
||||
public AnnotationTextCollector(@Nullable String desc, AnnotationResultCallback callback) {
|
||||
super(Opcodes.ASM4);
|
||||
super(ASM_API);
|
||||
myCallback = callback;
|
||||
|
||||
myDesc = desc;
|
||||
@@ -615,7 +617,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
|
||||
private final PsiModifierListStub myModList;
|
||||
|
||||
private AnnotationCollectingVisitor(final PsiModifierListStub modList) {
|
||||
super(Opcodes.ASM4);
|
||||
super(ASM_API);
|
||||
myModList = modList;
|
||||
}
|
||||
|
||||
@@ -646,7 +648,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
|
||||
final int paramIgnoreCount,
|
||||
final int paramCount,
|
||||
final PsiParameterStubImpl[] paramStubs) {
|
||||
super(Opcodes.ASM4);
|
||||
super(ASM_API);
|
||||
myOwner = owner;
|
||||
myModList = modList;
|
||||
myIgnoreCount = ignoreCount;
|
||||
|
||||
@@ -0,0 +1,385 @@
|
||||
|
||||
// IntelliJ API Decompiler stub source generated from a class file
|
||||
// Implementation of methods is not available
|
||||
|
||||
package java.lang;
|
||||
|
||||
public final class Class <T> implements java.io.Serializable, java.lang.reflect.GenericDeclaration, java.lang.reflect.Type, java.lang.reflect.AnnotatedElement {
|
||||
private static final int ANNOTATION = 8192;
|
||||
private static final int ENUM = 16384;
|
||||
private static final int SYNTHETIC = 4096;
|
||||
private transient volatile java.lang.reflect.Constructor<T> cachedConstructor;
|
||||
private transient volatile java.lang.Class<?> newInstanceCallerCache;
|
||||
private transient java.lang.String name;
|
||||
private static java.security.ProtectionDomain allPermDomain;
|
||||
private static boolean useCaches;
|
||||
private transient volatile java.lang.ref.SoftReference<java.lang.Class.ReflectionData<T>> reflectionData;
|
||||
private transient volatile int classRedefinedCount;
|
||||
private transient volatile sun.reflect.generics.repository.ClassRepository genericInfo;
|
||||
private static final long serialVersionUID = 3206093459760846163L;
|
||||
private static final java.io.ObjectStreamField[] serialPersistentFields;
|
||||
private static sun.reflect.ReflectionFactory reflectionFactory;
|
||||
private static boolean initted;
|
||||
private transient volatile T[] enumConstants;
|
||||
private transient volatile java.util.Map<java.lang.String,T> enumConstantDirectory;
|
||||
private transient volatile java.lang.Class.AnnotationData annotationData;
|
||||
private transient volatile sun.reflect.annotation.AnnotationType annotationType;
|
||||
transient java.lang.ClassValue.ClassValueMap classValueMap;
|
||||
|
||||
private static native void registerNatives();
|
||||
|
||||
private Class() { /* compiled code */ }
|
||||
|
||||
public java.lang.String toString() { /* compiled code */ }
|
||||
|
||||
public java.lang.String toGenericString() { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public static java.lang.Class<?> forName(java.lang.String s) throws java.lang.ClassNotFoundException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public static java.lang.Class<?> forName(java.lang.String s, boolean b, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException { /* compiled code */ }
|
||||
|
||||
private static native java.lang.Class<?> forName0(java.lang.String s, boolean b, java.lang.ClassLoader classLoader) throws java.lang.ClassNotFoundException;
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public T newInstance() throws java.lang.InstantiationException, java.lang.IllegalAccessException { /* compiled code */ }
|
||||
|
||||
public native boolean isInstance(java.lang.Object o);
|
||||
|
||||
public native boolean isAssignableFrom(java.lang.Class<?> aClass);
|
||||
|
||||
public native boolean isInterface();
|
||||
|
||||
public native boolean isArray();
|
||||
|
||||
public native boolean isPrimitive();
|
||||
|
||||
public boolean isAnnotation() { /* compiled code */ }
|
||||
|
||||
public boolean isSynthetic() { /* compiled code */ }
|
||||
|
||||
public java.lang.String getName() { /* compiled code */ }
|
||||
|
||||
private native java.lang.String getName0();
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.ClassLoader getClassLoader() { /* compiled code */ }
|
||||
|
||||
native java.lang.ClassLoader getClassLoader0();
|
||||
|
||||
public java.lang.reflect.TypeVariable<java.lang.Class<T>>[] getTypeParameters() { /* compiled code */ }
|
||||
|
||||
public native java.lang.Class<? super T> getSuperclass();
|
||||
|
||||
public java.lang.reflect.Type getGenericSuperclass() { /* compiled code */ }
|
||||
|
||||
public java.lang.Package getPackage() { /* compiled code */ }
|
||||
|
||||
public java.lang.Class<?>[] getInterfaces() { /* compiled code */ }
|
||||
|
||||
private native java.lang.Class<?>[] getInterfaces0();
|
||||
|
||||
public java.lang.reflect.Type[] getGenericInterfaces() { /* compiled code */ }
|
||||
|
||||
public native java.lang.Class<?> getComponentType();
|
||||
|
||||
public native int getModifiers();
|
||||
|
||||
public native java.lang.Object[] getSigners();
|
||||
|
||||
native void setSigners(java.lang.Object[] objects);
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Method getEnclosingMethod() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
private native java.lang.Object[] getEnclosingMethod0();
|
||||
|
||||
private java.lang.Class.EnclosingMethodInfo getEnclosingMethodInfo() { /* compiled code */ }
|
||||
|
||||
private static java.lang.Class<?> toClass(java.lang.reflect.Type type) { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Constructor<?> getEnclosingConstructor() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.Class<?> getDeclaringClass() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
private native java.lang.Class<?> getDeclaringClass0();
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.Class<?> getEnclosingClass() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
public java.lang.String getSimpleName() { /* compiled code */ }
|
||||
|
||||
public java.lang.String getTypeName() { /* compiled code */ }
|
||||
|
||||
private static boolean isAsciiDigit(char c) { /* compiled code */ }
|
||||
|
||||
public java.lang.String getCanonicalName() { /* compiled code */ }
|
||||
|
||||
public boolean isAnonymousClass() { /* compiled code */ }
|
||||
|
||||
public boolean isLocalClass() { /* compiled code */ }
|
||||
|
||||
public boolean isMemberClass() { /* compiled code */ }
|
||||
|
||||
private java.lang.String getSimpleBinaryName() { /* compiled code */ }
|
||||
|
||||
private boolean isLocalOrAnonymousClass() { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.Class<?>[] getClasses() { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Field[] getFields() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Method[] getMethods() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Constructor<?>[] getConstructors() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Field getField(java.lang.String s) throws java.lang.NoSuchFieldException, java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Method getMethod(java.lang.String s, java.lang.Class<?>... classes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Constructor<T> getConstructor(java.lang.Class<?>... classes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.Class<?>[] getDeclaredClasses() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Field[] getDeclaredFields() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Method[] getDeclaredMethods() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Constructor<?>[] getDeclaredConstructors() throws java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Field getDeclaredField(java.lang.String s) throws java.lang.NoSuchFieldException, java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Method getDeclaredMethod(java.lang.String s, java.lang.Class<?>... classes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
@sun.reflect.CallerSensitive
|
||||
public java.lang.reflect.Constructor<T> getDeclaredConstructor(java.lang.Class<?>... classes) throws java.lang.NoSuchMethodException, java.lang.SecurityException { /* compiled code */ }
|
||||
|
||||
public java.io.InputStream getResourceAsStream(java.lang.String s) { /* compiled code */ }
|
||||
|
||||
public java.net.URL getResource(java.lang.String s) { /* compiled code */ }
|
||||
|
||||
public java.security.ProtectionDomain getProtectionDomain() { /* compiled code */ }
|
||||
|
||||
private native java.security.ProtectionDomain getProtectionDomain0();
|
||||
|
||||
static native java.lang.Class<?> getPrimitiveClass(java.lang.String s);
|
||||
|
||||
private void checkMemberAccess(int i, java.lang.Class<?> aClass, boolean b) { /* compiled code */ }
|
||||
|
||||
private void checkPackageAccess(java.lang.ClassLoader classLoader, boolean b) { /* compiled code */ }
|
||||
|
||||
private java.lang.String resolveName(java.lang.String s) { /* compiled code */ }
|
||||
|
||||
private java.lang.Class.ReflectionData<T> reflectionData() { /* compiled code */ }
|
||||
|
||||
private java.lang.Class.ReflectionData<T> newReflectionData(java.lang.ref.SoftReference<java.lang.Class.ReflectionData<T>> softReference, int i) { /* compiled code */ }
|
||||
|
||||
private native java.lang.String getGenericSignature0();
|
||||
|
||||
private sun.reflect.generics.factory.GenericsFactory getFactory() { /* compiled code */ }
|
||||
|
||||
private sun.reflect.generics.repository.ClassRepository getGenericInfo() { /* compiled code */ }
|
||||
|
||||
native byte[] getRawAnnotations();
|
||||
|
||||
native byte[] getRawTypeAnnotations();
|
||||
|
||||
static byte[] getExecutableTypeAnnotationBytes(java.lang.reflect.Executable executable) { /* compiled code */ }
|
||||
|
||||
native sun.reflect.ConstantPool getConstantPool();
|
||||
|
||||
private java.lang.reflect.Field[] privateGetDeclaredFields(boolean b) { /* compiled code */ }
|
||||
|
||||
private java.lang.reflect.Field[] privateGetPublicFields(java.util.Set<java.lang.Class<?>> set) { /* compiled code */ }
|
||||
|
||||
private static void addAll(java.util.Collection<java.lang.reflect.Field> collection, java.lang.reflect.Field[] fields) { /* compiled code */ }
|
||||
|
||||
private java.lang.reflect.Constructor<T>[] privateGetDeclaredConstructors(boolean b) { /* compiled code */ }
|
||||
|
||||
private java.lang.reflect.Method[] privateGetDeclaredMethods(boolean b) { /* compiled code */ }
|
||||
|
||||
private java.lang.reflect.Method[] privateGetPublicMethods() { /* compiled code */ }
|
||||
|
||||
private static java.lang.reflect.Field searchFields(java.lang.reflect.Field[] fields, java.lang.String s) { /* compiled code */ }
|
||||
|
||||
private java.lang.reflect.Field getField0(java.lang.String s) throws java.lang.NoSuchFieldException { /* compiled code */ }
|
||||
|
||||
private static java.lang.reflect.Method searchMethods(java.lang.reflect.Method[] methods, java.lang.String s, java.lang.Class<?>[] classes) { /* compiled code */ }
|
||||
|
||||
private java.lang.reflect.Method getMethod0(java.lang.String s, java.lang.Class<?>[] classes, boolean b) { /* compiled code */ }
|
||||
|
||||
private java.lang.reflect.Constructor<T> getConstructor0(java.lang.Class<?>[] classes, int i) throws java.lang.NoSuchMethodException { /* compiled code */ }
|
||||
|
||||
private static boolean arrayContentsEq(java.lang.Object[] objects, java.lang.Object[] objects1) { /* compiled code */ }
|
||||
|
||||
private static java.lang.reflect.Field[] copyFields(java.lang.reflect.Field[] fields) { /* compiled code */ }
|
||||
|
||||
private static java.lang.reflect.Method[] copyMethods(java.lang.reflect.Method[] methods) { /* compiled code */ }
|
||||
|
||||
private static <U> java.lang.reflect.Constructor<U>[] copyConstructors(java.lang.reflect.Constructor<U>[] constructors) { /* compiled code */ }
|
||||
|
||||
private native java.lang.reflect.Field[] getDeclaredFields0(boolean b);
|
||||
|
||||
private native java.lang.reflect.Method[] getDeclaredMethods0(boolean b);
|
||||
|
||||
private native java.lang.reflect.Constructor<T>[] getDeclaredConstructors0(boolean b);
|
||||
|
||||
private native java.lang.Class<?>[] getDeclaredClasses0();
|
||||
|
||||
private static java.lang.String argumentTypesToString(java.lang.Class<?>[] classes) { /* compiled code */ }
|
||||
|
||||
public boolean desiredAssertionStatus() { /* compiled code */ }
|
||||
|
||||
private static native boolean desiredAssertionStatus0(java.lang.Class<?> aClass);
|
||||
|
||||
public boolean isEnum() { /* compiled code */ }
|
||||
|
||||
private static sun.reflect.ReflectionFactory getReflectionFactory() { /* compiled code */ }
|
||||
|
||||
private static void checkInitted() { /* compiled code */ }
|
||||
|
||||
public T[] getEnumConstants() { /* compiled code */ }
|
||||
|
||||
T[] getEnumConstantsShared() { /* compiled code */ }
|
||||
|
||||
java.util.Map<java.lang.String,T> enumConstantDirectory() { /* compiled code */ }
|
||||
|
||||
public T cast(java.lang.Object o) { /* compiled code */ }
|
||||
|
||||
private java.lang.String cannotCastMsg(java.lang.Object o) { /* compiled code */ }
|
||||
|
||||
public <U> java.lang.Class<? extends U> asSubclass(java.lang.Class<U> aClass) { /* compiled code */ }
|
||||
|
||||
public <A extends java.lang.annotation.Annotation> A getAnnotation(java.lang.Class<A> aClass) { /* compiled code */ }
|
||||
|
||||
public boolean isAnnotationPresent(java.lang.Class<? extends java.lang.annotation.Annotation> aClass) { /* compiled code */ }
|
||||
|
||||
public <A extends java.lang.annotation.Annotation> A[] getAnnotationsByType(java.lang.Class<A> aClass) { /* compiled code */ }
|
||||
|
||||
public java.lang.annotation.Annotation[] getAnnotations() { /* compiled code */ }
|
||||
|
||||
public <A extends java.lang.annotation.Annotation> A getDeclaredAnnotation(java.lang.Class<A> aClass) { /* compiled code */ }
|
||||
|
||||
public <A extends java.lang.annotation.Annotation> A[] getDeclaredAnnotationsByType(java.lang.Class<A> aClass) { /* compiled code */ }
|
||||
|
||||
public java.lang.annotation.Annotation[] getDeclaredAnnotations() { /* compiled code */ }
|
||||
|
||||
private java.lang.Class.AnnotationData annotationData() { /* compiled code */ }
|
||||
|
||||
private java.lang.Class.AnnotationData createAnnotationData(int i) { /* compiled code */ }
|
||||
|
||||
boolean casAnnotationType(sun.reflect.annotation.AnnotationType annotationType, sun.reflect.annotation.AnnotationType annotationType1) { /* compiled code */ }
|
||||
|
||||
sun.reflect.annotation.AnnotationType getAnnotationType() { /* compiled code */ }
|
||||
|
||||
java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> getDeclaredAnnotationMap() { /* compiled code */ }
|
||||
|
||||
public java.lang.reflect.AnnotatedType getAnnotatedSuperclass() { /* compiled code */ }
|
||||
|
||||
public java.lang.reflect.AnnotatedType[] getAnnotatedInterfaces() { /* compiled code */ }
|
||||
|
||||
private static class AnnotationData {
|
||||
final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> annotations;
|
||||
final java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> declaredAnnotations;
|
||||
final int redefinedCount;
|
||||
|
||||
AnnotationData(java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> map, java.util.Map<java.lang.Class<? extends java.lang.annotation.Annotation>,java.lang.annotation.Annotation> map1, int i) { /* compiled code */ }
|
||||
}
|
||||
|
||||
private static class Atomic {
|
||||
private static final sun.misc.Unsafe unsafe;
|
||||
private static final long reflectionDataOffset;
|
||||
private static final long annotationTypeOffset;
|
||||
private static final long annotationDataOffset;
|
||||
|
||||
private Atomic() { /* compiled code */ }
|
||||
|
||||
private static long objectFieldOffset(java.lang.reflect.Field[] fields, java.lang.String s) { /* compiled code */ }
|
||||
|
||||
static <T> boolean casReflectionData(java.lang.Class<?> aClass, java.lang.ref.SoftReference<java.lang.Class.ReflectionData<T>> softReference, java.lang.ref.SoftReference<java.lang.Class.ReflectionData<T>> softReference1) { /* compiled code */ }
|
||||
|
||||
static <T> boolean casAnnotationType(java.lang.Class<?> aClass, sun.reflect.annotation.AnnotationType annotationType, sun.reflect.annotation.AnnotationType annotationType1) { /* compiled code */ }
|
||||
|
||||
static <T> boolean casAnnotationData(java.lang.Class<?> aClass, java.lang.Class.AnnotationData annotationData, java.lang.Class.AnnotationData annotationData1) { /* compiled code */ }
|
||||
}
|
||||
|
||||
private static final class EnclosingMethodInfo {
|
||||
private java.lang.Class<?> enclosingClass;
|
||||
private java.lang.String name;
|
||||
private java.lang.String descriptor;
|
||||
|
||||
private EnclosingMethodInfo(java.lang.Object[] objects) { /* compiled code */ }
|
||||
|
||||
boolean isPartial() { /* compiled code */ }
|
||||
|
||||
boolean isConstructor() { /* compiled code */ }
|
||||
|
||||
boolean isMethod() { /* compiled code */ }
|
||||
|
||||
java.lang.Class<?> getEnclosingClass() { /* compiled code */ }
|
||||
|
||||
java.lang.String getName() { /* compiled code */ }
|
||||
|
||||
java.lang.String getDescriptor() { /* compiled code */ }
|
||||
}
|
||||
|
||||
static class MethodArray {
|
||||
private java.lang.reflect.Method[] methods;
|
||||
private int length;
|
||||
|
||||
MethodArray() { /* compiled code */ }
|
||||
|
||||
void add(java.lang.reflect.Method method) { /* compiled code */ }
|
||||
|
||||
void addAll(java.lang.reflect.Method[] methods) { /* compiled code */ }
|
||||
|
||||
void addAll(java.lang.Class.MethodArray methodArray) { /* compiled code */ }
|
||||
|
||||
void addIfNotPresent(java.lang.reflect.Method method) { /* compiled code */ }
|
||||
|
||||
void addAllIfNotPresent(java.lang.Class.MethodArray methodArray) { /* compiled code */ }
|
||||
|
||||
void addAllNonStatic(java.lang.reflect.Method[] methods) { /* compiled code */ }
|
||||
|
||||
int length() { /* compiled code */ }
|
||||
|
||||
java.lang.reflect.Method get(int i) { /* compiled code */ }
|
||||
|
||||
void removeByNameAndSignature(java.lang.reflect.Method method) { /* compiled code */ }
|
||||
|
||||
void compactAndTrim() { /* compiled code */ }
|
||||
|
||||
java.lang.reflect.Method[] getArray() { /* compiled code */ }
|
||||
}
|
||||
|
||||
private static class ReflectionData <T> {
|
||||
volatile java.lang.reflect.Field[] declaredFields;
|
||||
volatile java.lang.reflect.Field[] publicFields;
|
||||
volatile java.lang.reflect.Method[] declaredMethods;
|
||||
volatile java.lang.reflect.Method[] publicMethods;
|
||||
volatile java.lang.reflect.Constructor<T>[] declaredConstructors;
|
||||
volatile java.lang.reflect.Constructor<T>[] publicConstructors;
|
||||
volatile java.lang.reflect.Field[] declaredPublicFields;
|
||||
volatile java.lang.reflect.Method[] declaredPublicMethods;
|
||||
volatile java.lang.Class<?>[] interfaces;
|
||||
final int redefinedCount;
|
||||
|
||||
ReflectionData(int i) { /* compiled code */ }
|
||||
}
|
||||
}
|
||||
@@ -18,8 +18,10 @@ package com.intellij.psi;
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.ide.highlighter.JavaFileType;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.openapi.vfs.VirtualFileSystem;
|
||||
import com.intellij.psi.codeStyle.CodeStyleSettingsManager;
|
||||
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
|
||||
import com.intellij.psi.impl.compiled.ClsFileImpl;
|
||||
@@ -52,7 +54,7 @@ public class ClsMirrorBuildingTest extends LightIdeaTestCase {
|
||||
public void testLocalClass() { doTest(); }
|
||||
public void testBounds() { doTest(); }
|
||||
|
||||
public void testTextPsiMismatch() throws Exception {
|
||||
public void testTextPsiMismatch() {
|
||||
CommonCodeStyleSettings.IndentOptions options =
|
||||
CodeStyleSettingsManager.getInstance(getProject()).getCurrentSettings().getIndentOptions(JavaFileType.INSTANCE);
|
||||
int indent = options.INDENT_SIZE;
|
||||
@@ -65,22 +67,31 @@ public class ClsMirrorBuildingTest extends LightIdeaTestCase {
|
||||
}
|
||||
}
|
||||
|
||||
public void testJdk8Class() {
|
||||
String testDir = JavaTestUtil.getJavaTestDataPath();
|
||||
String clsPath = testDir + "/../../mockJDK-1.8/jre/lib/rt.jar!/java/lang/Class.class";
|
||||
String txtPath = testDir + "/psi/cls/mirror/" + "Class.txt";
|
||||
doTest(clsPath, txtPath);
|
||||
}
|
||||
|
||||
private void doTest() {
|
||||
doTest(getTestName(false));
|
||||
}
|
||||
|
||||
private static void doTest(String name) {
|
||||
String testDir = JavaTestUtil.getJavaTestDataPath() + "/psi/cls/mirror/";
|
||||
doTest(testDir + "pkg/" + name + ".class", testDir + name + ".txt");
|
||||
}
|
||||
|
||||
String clsPath = testDir + "pkg/" + name + ".class";
|
||||
VirtualFile vFile = LocalFileSystem.getInstance().findFileByPath(clsPath);
|
||||
private static void doTest(String clsPath, String txtPath) {
|
||||
VirtualFileSystem fs = clsPath.contains("!/") ? JarFileSystem.getInstance() : LocalFileSystem.getInstance();
|
||||
VirtualFile vFile = fs.findFileByPath(clsPath);
|
||||
assertNotNull(clsPath, vFile);
|
||||
PsiFile clsFile = getPsiManager().findFile(vFile);
|
||||
assertNotNull(vFile.getPath(), clsFile);
|
||||
|
||||
String expected;
|
||||
try {
|
||||
String txtPath = testDir + name + ".txt";
|
||||
expected = StringUtil.trimTrailing(PlatformTestUtil.loadFileText(txtPath));
|
||||
}
|
||||
catch (IOException e) {
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,44 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.openapi.application.ex;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.Ref;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class ApplicationUtil {
|
||||
// throws exception if can't grab read action right now
|
||||
public static <T> T tryRunReadAction(@NotNull final Computable<T> computable) throws CannotRunReadActionException {
|
||||
final Ref<T> result = new Ref<T>();
|
||||
if (((ApplicationEx)ApplicationManager.getApplication()).tryRunReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
result.set(computable.compute());
|
||||
}
|
||||
})) {
|
||||
return result.get();
|
||||
}
|
||||
throw new CannotRunReadActionException();
|
||||
}
|
||||
|
||||
public static class CannotRunReadActionException extends RuntimeException{
|
||||
@Override
|
||||
public Throwable fillInStackTrace() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -154,7 +154,7 @@ public class LowLevelSearchUtil {
|
||||
int startOffset = scopeStart;
|
||||
int endOffset = range.getEndOffset();
|
||||
if (endOffset > buffer.length()) {
|
||||
throw new AssertionError("Range for element: '"+scope+"' = "+range+" is out of file '" + file + "' range: " + file.getTextLength());
|
||||
throw new AssertionError("Range for element: '"+scope+"' = "+range+" is out of file '" + file + "' range: " + file.getTextRange()+"; file contents length: "+buffer.length()+"; file provider: "+file.getViewProvider());
|
||||
}
|
||||
|
||||
final char[] bufferArray = CharArrayUtil.fromSequenceWithoutCopying(buffer);
|
||||
|
||||
@@ -18,12 +18,8 @@ package com.intellij.psi.impl.search;
|
||||
|
||||
import com.intellij.concurrency.*;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.ReadAction;
|
||||
import com.intellij.openapi.application.Result;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.application.ex.ApplicationUtil;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.impl.LoadTextUtil;
|
||||
import com.intellij.openapi.progress.ProcessCanceledException;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressIndicatorProvider;
|
||||
@@ -58,13 +54,13 @@ import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ExecutionException;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.psi.impl.search.PsiSearchHelperImpl");
|
||||
private final PsiManagerEx myManager;
|
||||
|
||||
@Override
|
||||
@@ -314,26 +310,6 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
return totalResult;
|
||||
}
|
||||
|
||||
private static class CannotRunReadActionException extends RuntimeException{
|
||||
@Override
|
||||
public Throwable fillInStackTrace() {
|
||||
return this;
|
||||
}
|
||||
}
|
||||
// throws exception if can't grab read action right now
|
||||
private static <T> T tryRead(final Computable<T> computable) throws CannotRunReadActionException {
|
||||
final Ref<T> result = new Ref<T>();
|
||||
if (((ApplicationEx)ApplicationManager.getApplication()).tryRunReadAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
result.set(computable.compute());
|
||||
}
|
||||
})) {
|
||||
return result.get();
|
||||
}
|
||||
throw new CannotRunReadActionException();
|
||||
}
|
||||
|
||||
/**
|
||||
* @param files to scan for references in this pass.
|
||||
* @param totalSize the number of files to scan in both passes. Can be different from <code>files.size()</code> in case of
|
||||
@@ -361,7 +337,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
TooManyUsagesStatus.getFrom(progress).pauseProcessingIfTooManyUsages();
|
||||
processVirtualFile(vfile, progress, localProcessor, canceled, counter, totalSize);
|
||||
}
|
||||
catch (CannotRunReadActionException action) {
|
||||
catch (ApplicationUtil.CannotRunReadActionException action) {
|
||||
failedFiles.add(vfile);
|
||||
}
|
||||
return !canceled.get();
|
||||
@@ -397,7 +373,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
@NotNull final AtomicBoolean canceled,
|
||||
@NotNull AtomicInteger counter,
|
||||
int totalSize) {
|
||||
final PsiFile file = tryRead(new Computable<PsiFile>() {
|
||||
final PsiFile file = ApplicationUtil.tryRunReadAction(new Computable<PsiFile>() {
|
||||
@Override
|
||||
public PsiFile compute() {
|
||||
return vfile.isValid() ? myManager.findFile(vfile) : null;
|
||||
@@ -406,9 +382,14 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
if (file != null && !(file instanceof PsiBinaryFile)) {
|
||||
// load contents outside read action
|
||||
if (FileDocumentManager.getInstance().getCachedDocument(vfile) == null) {
|
||||
LoadTextUtil.loadText(vfile); // cache bytes in vfs
|
||||
// cache bytes in vfs
|
||||
try {
|
||||
vfile.contentsToByteArray();
|
||||
}
|
||||
catch (IOException ignored) {
|
||||
}
|
||||
}
|
||||
tryRead(new Computable<Void>() {
|
||||
ApplicationUtil.tryRunReadAction(new Computable<Void>() {
|
||||
@Override
|
||||
public Void compute() {
|
||||
if (myManager.getProject().isDisposed()) throw new ProcessCanceledException();
|
||||
@@ -416,8 +397,8 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
Set<PsiElement> processed = new THashSet<PsiElement>(psiRoots.size() * 2, (float)0.5);
|
||||
for (final PsiFile psiRoot : psiRoots) {
|
||||
checkCanceled(progress);
|
||||
assert psiRoot != null : "One of the roots of file " + file + " is null. All roots: " + psiRoots +
|
||||
"; ViewProvider: " + file.getViewProvider() + "; Virtual file: " + file.getViewProvider().getVirtualFile();
|
||||
assert psiRoot != null : "One of the roots of file " + file + " is null. All roots: " + psiRoots + "; ViewProvider: " +
|
||||
file.getViewProvider() + "; Virtual file: " + file.getViewProvider().getVirtualFile();
|
||||
if (!processed.add(psiRoot)) continue;
|
||||
if (!psiRoot.isValid()) {
|
||||
continue;
|
||||
@@ -541,14 +522,12 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
progress.setText(PsiBundle.message("psi.search.in.non.java.files.progress"));
|
||||
}
|
||||
|
||||
final SearchScope useScope = new ReadAction<SearchScope>() {
|
||||
final SearchScope useScope = originalElement == null ? null : ApplicationManager.getApplication().runReadAction(new Computable<SearchScope>() {
|
||||
@Override
|
||||
protected void run(final Result<SearchScope> result) {
|
||||
if (originalElement != null) {
|
||||
result.setResult(getUseScope(originalElement));
|
||||
}
|
||||
public SearchScope compute() {
|
||||
return getUseScope(originalElement);
|
||||
}
|
||||
}.execute().getResultObject();
|
||||
});
|
||||
|
||||
final Ref<Boolean> cancelled = new Ref<Boolean>(Boolean.FALSE);
|
||||
for (int i = 0; i < files.length; i++) {
|
||||
@@ -826,7 +805,7 @@ public class PsiSearchHelperImpl implements PsiSearchHelper {
|
||||
return processPsiFileRootsAsync(files, totalSize, alreadyProcessedFiles, progress, new Processor<PsiFile>() {
|
||||
@Override
|
||||
public boolean process(final PsiFile psiRoot) {
|
||||
return tryRead(new Computable<Boolean>() {
|
||||
return ApplicationUtil.tryRunReadAction(new Computable<Boolean>() {
|
||||
@Override
|
||||
public Boolean compute() {
|
||||
final VirtualFile vfile = psiRoot.getVirtualFile();
|
||||
|
||||
@@ -172,8 +172,7 @@ public class Messages {
|
||||
public static boolean canShowMacSheetPanel() {
|
||||
return SystemInfo.isMac
|
||||
&& !isApplicationInUnitTestOrHeadless()
|
||||
&& Registry.is("ide.mac.message.dialogs.as.sheets")
|
||||
&& !SystemInfo.isJavaVersionAtLeast("1.8");
|
||||
&& Registry.is("ide.mac.message.dialogs.as.sheets");
|
||||
//&& !DialogWrapper.isMultipleModalDialogs();
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ import com.intellij.openapi.ui.popup.util.PopupUtil;
|
||||
import com.intellij.openapi.util.ActionCallback;
|
||||
import com.intellij.openapi.util.ActiveRunnable;
|
||||
import com.intellij.openapi.util.Expirable;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -39,6 +40,16 @@ public abstract class FocusCommand extends ActiveRunnable implements Expirable {
|
||||
private boolean myInvalidatesPendingFurtherRequestors = true;
|
||||
private Expirable myExpirable;
|
||||
|
||||
public boolean isForced() {
|
||||
return myForced;
|
||||
}
|
||||
|
||||
public void setForced(boolean forced) {
|
||||
myForced = forced;
|
||||
}
|
||||
|
||||
private boolean myForced;
|
||||
|
||||
protected FocusCommand() {
|
||||
saveAllocation();
|
||||
}
|
||||
@@ -168,7 +179,10 @@ public abstract class FocusCommand extends ActiveRunnable implements Expirable {
|
||||
}
|
||||
|
||||
} else {
|
||||
if (!myToFocus.requestFocusInWindow()) {
|
||||
// This change seems reasonable to me. But as far as some implementations
|
||||
// can ignore the "forced" parameter we can get bad focus behaviour.
|
||||
// So let's start from mac.
|
||||
if (!myToFocus.requestFocusInWindow() && (isForced() && SystemInfo.isMac)) {
|
||||
myToFocus.requestFocus();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@ public abstract class MacMessages {
|
||||
@Nullable DialogWrapper.DoNotAskOption doNotAskOption);
|
||||
|
||||
public static MacMessages getInstance() {
|
||||
return Registry.is("ide.mac.message.sheets.java.emulation.dialogs") && SystemInfo.isJavaVersionAtLeast("1.7")
|
||||
return Registry.is("ide.mac.message.sheets.java.emulation.dialogs")
|
||||
? ServiceManager.getService(MacMessagesEmulation.class)
|
||||
: ServiceManager.getService(MacMessages.class);
|
||||
}
|
||||
|
||||
@@ -1,54 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<form xmlns="http://www.intellij.com/uidesigner/form/" version="1" bind-to-class="com.intellij.internal.focus.FocusTracesDialog">
|
||||
<grid id="27dc6" binding="myRootPanel" layout-manager="GridLayoutManager" row-count="1" column-count="1" same-size-horizontally="false" same-size-vertically="false" hgap="-1" vgap="-1">
|
||||
<margin top="0" left="0" bottom="0" right="0"/>
|
||||
<constraints>
|
||||
<xy x="20" y="20" width="500" height="400"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<preferredSize width="500" height="400"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<splitpane id="227bc">
|
||||
<constraints>
|
||||
<grid row="0" column="0" row-span="1" col-span="1" vsize-policy="3" hsize-policy="3" anchor="0" fill="3" indent="0" use-parent-layout="false">
|
||||
<preferred-size width="200" height="200"/>
|
||||
</grid>
|
||||
</constraints>
|
||||
<properties>
|
||||
<orientation value="0"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="37ff7" class="javax.swing.JTextPane" binding="myStacktrace">
|
||||
<constraints>
|
||||
<splitpane position="right"/>
|
||||
</constraints>
|
||||
<properties/>
|
||||
</component>
|
||||
<scrollpane id="ef29" class="com.intellij.ui.components.JBScrollPane">
|
||||
<constraints>
|
||||
<splitpane position="left"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<minimumSize width="23" height="250"/>
|
||||
</properties>
|
||||
<border type="none"/>
|
||||
<children>
|
||||
<component id="3cc44" class="com.intellij.ui.table.JBTable" binding="myRequestsTable">
|
||||
<constraints/>
|
||||
<properties>
|
||||
<autoResizeMode value="3"/>
|
||||
<autoscrolls value="false"/>
|
||||
<minimumSize width="30" height="250"/>
|
||||
<preferredSize width="150" height="150"/>
|
||||
</properties>
|
||||
</component>
|
||||
</children>
|
||||
</scrollpane>
|
||||
</children>
|
||||
</splitpane>
|
||||
</children>
|
||||
</grid>
|
||||
</form>
|
||||
@@ -20,6 +20,8 @@ import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.wm.impl.FocusRequestInfo;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.JBSplitter;
|
||||
import com.intellij.ui.components.JBScrollPane;
|
||||
import com.intellij.ui.table.JBTable;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -39,9 +41,8 @@ import java.util.List;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class FocusTracesDialog extends DialogWrapper {
|
||||
private JTextPane myStacktrace;
|
||||
private JBTable myRequestsTable;
|
||||
private JPanel myRootPanel;
|
||||
private final JTextPane myStacktrace = new JTextPane();
|
||||
private final JBTable myRequestsTable;
|
||||
private final List<FocusRequestInfo> myRequests;
|
||||
private static final String[] COLUMNS = {"Time", "Forced", "Component"};
|
||||
|
||||
@@ -49,19 +50,24 @@ public class FocusTracesDialog extends DialogWrapper {
|
||||
super(project);
|
||||
myRequests = requests;
|
||||
setTitle("Focus Traces");
|
||||
init();
|
||||
final String[][] data = new String[requests.size()][];
|
||||
for (int i = 0; i < data.length; i++) {
|
||||
final FocusRequestInfo r = requests.get(i);
|
||||
data[i] = new String[]{r.getDate(), String.valueOf(r.isForced()), String.valueOf(r.getComponent())};
|
||||
}
|
||||
myRequestsTable.setModel(new DefaultTableModel(data, COLUMNS));
|
||||
myRequestsTable = new JBTable(new DefaultTableModel(data, COLUMNS) {
|
||||
@Override
|
||||
public boolean isCellEditable(int row, int column) {
|
||||
return false;
|
||||
}
|
||||
});
|
||||
final ListSelectionListener selectionListener = new ListSelectionListener() {
|
||||
@Override
|
||||
public void valueChanged(ListSelectionEvent e) {
|
||||
final int index = myRequestsTable.getSelectedRow();
|
||||
if (-1 < index && index < myRequests.size()) {
|
||||
myStacktrace.setText(myRequests.get(index).getStackTrace());
|
||||
myStacktrace.setCaretPosition(0);
|
||||
}
|
||||
else {
|
||||
myStacktrace.setText("");
|
||||
@@ -70,12 +76,15 @@ public class FocusTracesDialog extends DialogWrapper {
|
||||
};
|
||||
myRequestsTable.getSelectionModel().addListSelectionListener(selectionListener);
|
||||
final TableColumnModel columnModel = myRequestsTable.getColumnModel();
|
||||
columnModel.getColumn(0).setMinWidth(120);
|
||||
columnModel.getColumn(0).setMaxWidth(120);
|
||||
columnModel.getColumn(0).setPreferredWidth(120);
|
||||
columnModel.getColumn(1).setMinWidth(60);
|
||||
columnModel.getColumn(1).setMaxWidth(60);
|
||||
columnModel.getSelectionModel().addListSelectionListener(selectionListener);
|
||||
columnModel.setColumnSelectionAllowed(false);
|
||||
columnModel.getColumn(1).setPreferredWidth(60);
|
||||
myRequestsTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
|
||||
myRequestsTable.changeSelection(0, 0, false, true);
|
||||
init();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,7 +94,13 @@ public class FocusTracesDialog extends DialogWrapper {
|
||||
|
||||
@Override
|
||||
protected JComponent createCenterPanel() {
|
||||
return myRootPanel;
|
||||
JPanel panel = new JPanel(new BorderLayout());
|
||||
JBSplitter splitter = new JBSplitter(true, .5F, .2F, .8F);
|
||||
splitter.setFirstComponent(new JBScrollPane(myRequestsTable, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
|
||||
splitter.setSecondComponent(
|
||||
new JBScrollPane(myStacktrace, ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED, ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER));
|
||||
panel.add(splitter, BorderLayout.CENTER);
|
||||
return panel;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
+8
-20
@@ -1283,8 +1283,8 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat
|
||||
}
|
||||
|
||||
private class MyTimer extends Timer implements ActionListener {
|
||||
private final List<TimerListener> myTimerListeners = Collections.synchronizedList(new ArrayList<TimerListener>());
|
||||
private final List<TimerListener> myTransparentTimerListeners = Collections.synchronizedList(new ArrayList<TimerListener>());
|
||||
private final List<TimerListener> myTimerListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
private final List<TimerListener> myTransparentTimerListeners = ContainerUtil.createLockFreeCopyOnWriteList();
|
||||
private int myLastTimePerformed;
|
||||
|
||||
MyTimer() {
|
||||
@@ -1312,19 +1312,11 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat
|
||||
}
|
||||
|
||||
public void addTimerListener(TimerListener listener, boolean transparent){
|
||||
if (transparent) {
|
||||
myTransparentTimerListeners.add(listener);
|
||||
} else {
|
||||
myTimerListeners.add(listener);
|
||||
}
|
||||
(transparent ? myTransparentTimerListeners : myTimerListeners).add(listener);
|
||||
}
|
||||
|
||||
public void removeTimerListener(TimerListener listener, boolean transparent){
|
||||
if (transparent) {
|
||||
myTransparentTimerListeners.remove(listener);
|
||||
} else {
|
||||
myTimerListeners.remove(listener);
|
||||
}
|
||||
(transparent ? myTransparentTimerListeners : myTimerListeners).remove(listener);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -1341,7 +1333,7 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat
|
||||
boolean transparentOnly = myLastTimePerformed == lastEventCount;
|
||||
|
||||
try {
|
||||
HashSet<TimerListener> notified = new HashSet<TimerListener>();
|
||||
Set<TimerListener> notified = new HashSet<TimerListener>();
|
||||
myTransparentOnlyUpdate = transparentOnly;
|
||||
notifyListeners(myTransparentTimerListeners, notified);
|
||||
|
||||
@@ -1357,13 +1349,9 @@ public final class ActionManagerImpl extends ActionManagerEx implements Applicat
|
||||
}
|
||||
|
||||
private void notifyListeners(final List<TimerListener> timerListeners, final Set<TimerListener> notified) {
|
||||
final TimerListener[] listeners = timerListeners.toArray(new TimerListener[timerListeners.size()]);
|
||||
for (TimerListener listener : listeners) {
|
||||
if (timerListeners.contains(listener)) {
|
||||
if (!notified.contains(listener)) {
|
||||
notified.add(listener);
|
||||
runListenerAction(listener);
|
||||
}
|
||||
for (TimerListener listener : timerListeners) {
|
||||
if (notified.add(listener)) {
|
||||
runListenerAction(listener);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -229,7 +229,8 @@ public class CaretModelImpl implements CaretModel, PrioritizedDocumentListener,
|
||||
@Override
|
||||
@NotNull
|
||||
public CaretImpl getCurrentCaret() {
|
||||
return ApplicationManager.getApplication().isDispatchThread() && myCurrentCaret != null ? myCurrentCaret : getPrimaryCaret();
|
||||
CaretImpl currentCaret = myCurrentCaret;
|
||||
return ApplicationManager.getApplication().isDispatchThread() && currentCaret != null ? currentCaret : getPrimaryCaret();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -298,6 +298,7 @@ public class FocusManagerImpl extends IdeFocusManager implements Disposable {
|
||||
revalidateFurtherRequestors();
|
||||
}
|
||||
|
||||
command.setForced(forced);
|
||||
command.run().doWhenDone(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.ui.GraphicsUtil;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import org.jdesktop.swingx.graphics.GraphicsUtilities;
|
||||
import org.jdesktop.swingx.graphics.ShadowRenderer;
|
||||
|
||||
@@ -16,17 +16,18 @@
|
||||
package com.intellij.ui.messages;
|
||||
|
||||
import com.apple.eawt.FullScreenUtilities;
|
||||
import com.intellij.openapi.application.impl.LaterInvocator;
|
||||
import com.intellij.openapi.ui.DialogWrapper;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.ui.mac.MacMainFrameDecorator;
|
||||
import com.intellij.util.ui.Animator;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.ComponentAdapter;
|
||||
import java.awt.event.ComponentEvent;
|
||||
import java.awt.event.WindowAdapter;
|
||||
import java.awt.event.WindowEvent;
|
||||
|
||||
|
||||
/**
|
||||
@@ -52,13 +53,15 @@ public class SheetMessage {
|
||||
final String focusedButton,
|
||||
final String defaultButton)
|
||||
{
|
||||
myWindow = new JDialog(owner, "This should not be shown", Dialog.ModalityType.APPLICATION_MODAL) {
|
||||
@Override
|
||||
public void paint(Graphics g) {
|
||||
super.paint(g);
|
||||
myWindow = new JDialog(owner, "This should not be shown", Dialog.ModalityType.APPLICATION_MODAL);
|
||||
myWindow.getRootPane().putClientProperty("apple.awt.draggableWindowBackground", Boolean.FALSE);
|
||||
|
||||
myWindow.addWindowListener(new WindowAdapter() {
|
||||
@Override
|
||||
public void windowActivated(WindowEvent e) {
|
||||
super.windowActivated(e);
|
||||
}
|
||||
};
|
||||
});
|
||||
|
||||
myParent = owner;
|
||||
|
||||
@@ -68,8 +71,8 @@ public class SheetMessage {
|
||||
|
||||
imageHeight = 0;
|
||||
registerMoveResizeHandler();
|
||||
myWindow.setFocusableWindowState(true);
|
||||
myWindow.setFocusable(true);
|
||||
myWindow.setFocusableWindowState(true);
|
||||
|
||||
startAnimation(true);
|
||||
myWindow.setSize(myController.SHEET_NC_WIDTH, myController.SHEET_NC_HEIGHT);
|
||||
@@ -78,7 +81,9 @@ public class SheetMessage {
|
||||
FullScreenUtilities.setWindowCanFullScreen(myParent, false);
|
||||
}
|
||||
setPositionRelativeToParent();
|
||||
LaterInvocator.enterModal(myWindow);
|
||||
myWindow.setVisible(true);
|
||||
LaterInvocator.leaveModal(myWindow);
|
||||
}
|
||||
|
||||
private boolean couldBeInFullScreen() {
|
||||
|
||||
@@ -44,6 +44,7 @@ xbreakpoint.master.breakpoint.none=<None>
|
||||
xbreakpoint.master.breakpoint.description=Disabled until selected breakpoint is hit:
|
||||
rule.name.group.by.file=Group by file
|
||||
xbreakpoint.default.display.text=Line {0} in {1}
|
||||
xbreakpoint.group.unknown=Unknown
|
||||
|
||||
xbreakpoint.reached.text=Breakpoint reached:
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2013 JetBrains s.r.o.
|
||||
* Copyright 2000-2014 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.
|
||||
@@ -15,15 +15,21 @@
|
||||
*/
|
||||
package com.intellij.openapi.project;
|
||||
|
||||
import com.intellij.ide.highlighter.ProjectFileType;
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.intellij.openapi.module.ModuleUtilCore;
|
||||
import com.intellij.openapi.roots.JdkOrderEntry;
|
||||
import com.intellij.openapi.roots.OrderEntry;
|
||||
import com.intellij.openapi.roots.libraries.LibraryUtil;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.openapi.vfs.LocalFileProvider;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class ProjectUtilCore {
|
||||
public static String displayUrlRelativeToProject(@NotNull VirtualFile file,
|
||||
@@ -64,4 +70,33 @@ public class ProjectUtilCore {
|
||||
url + " - [" + module.getName() + "]" :
|
||||
"[" + module.getName() + "] - " + url;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getPresentableName(@NotNull Project project) {
|
||||
if (project.isDefault()) {
|
||||
return project.getName();
|
||||
}
|
||||
|
||||
String location = project.getPresentableUrl();
|
||||
if (location == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
String projectName = FileUtil.toSystemIndependentName(location);
|
||||
if (projectName.endsWith("/")) {
|
||||
projectName = projectName.substring(0, projectName.length() - 1);
|
||||
}
|
||||
|
||||
final int lastSlash = projectName.lastIndexOf('/');
|
||||
if (lastSlash >= 0 && lastSlash + 1 < projectName.length()) {
|
||||
projectName = projectName.substring(lastSlash + 1);
|
||||
}
|
||||
|
||||
if (StringUtil.endsWithIgnoreCase(projectName, ProjectFileType.DOT_DEFAULT_EXTENSION)) {
|
||||
projectName = projectName.substring(0, projectName.length() - ProjectFileType.DOT_DEFAULT_EXTENSION.length());
|
||||
}
|
||||
|
||||
projectName = projectName.toLowerCase(Locale.US).replace(':', '_'); // replace ':' from windows drive names
|
||||
return projectName;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -53,7 +53,7 @@ public abstract class XBreakpointGroupingRule<B, G extends XBreakpointGroup> {
|
||||
return XBreakpointsGroupingPriorities.DEFAULT;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@NotNull
|
||||
public abstract G getGroup(@NotNull B breakpoint, @NotNull Collection<G> groups);
|
||||
|
||||
@Nullable
|
||||
|
||||
+22
-1
@@ -15,9 +15,11 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui.grouping;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.presentation.VirtualFilePresentation;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -27,8 +29,26 @@ import javax.swing.*;
|
||||
* @author nik
|
||||
*/
|
||||
public class XBreakpointFileGroup extends XBreakpointGroup {
|
||||
public static final XBreakpointFileGroup UNKNOWN = new XBreakpointFileGroup() {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return XDebuggerBundle.message("xbreakpoint.group.unknown");
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public Icon getIcon(boolean isOpen) {
|
||||
return AllIcons.FileTypes.Text;
|
||||
}
|
||||
};
|
||||
|
||||
private final VirtualFile myFile;
|
||||
|
||||
private XBreakpointFileGroup() {
|
||||
myFile = null;
|
||||
}
|
||||
|
||||
public XBreakpointFileGroup(@NotNull VirtualFile file) {
|
||||
myFile = file;
|
||||
}
|
||||
@@ -43,6 +63,7 @@ public class XBreakpointFileGroup extends XBreakpointGroup {
|
||||
return myFile.getPresentableUrl();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public VirtualFile getFile() {
|
||||
return myFile;
|
||||
}
|
||||
|
||||
+7
-3
@@ -16,6 +16,7 @@
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui.grouping;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.util.Comparing;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.XSourcePosition;
|
||||
@@ -41,17 +42,20 @@ public class XBreakpointFileGroupingRule<B> extends XBreakpointGroupingRule<B, X
|
||||
return XBreakpointsGroupingPriorities.BY_FILE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public XBreakpointFileGroup getGroup(@NotNull final B breakpoint, @NotNull final Collection<XBreakpointFileGroup> groups) {
|
||||
if (!(breakpoint instanceof XLineBreakpoint)) {
|
||||
return null;
|
||||
return XBreakpointFileGroup.UNKNOWN;
|
||||
}
|
||||
XSourcePosition position = ((XLineBreakpoint)breakpoint).getSourcePosition();
|
||||
|
||||
if (position == null) return null;
|
||||
if (position == null) {
|
||||
return XBreakpointFileGroup.UNKNOWN;
|
||||
}
|
||||
|
||||
VirtualFile file = position.getFile();
|
||||
for (XBreakpointFileGroup group : groups) {
|
||||
if (group.getFile().equals(file)) {
|
||||
if (Comparing.equal(group.getFile(), file)) {
|
||||
return group;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -45,6 +45,7 @@ public class XBreakpointGroupingByTypeRule<B> extends XBreakpointGroupingRule<B,
|
||||
return XBreakpointsGroupingPriorities.BY_TYPE;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public XBreakpointTypeGroup getGroup(@NotNull B b, @NotNull Collection<XBreakpointTypeGroup> groups) {
|
||||
if (b instanceof XBreakpoint) {
|
||||
@@ -56,6 +57,6 @@ public class XBreakpointGroupingByTypeRule<B> extends XBreakpointGroupingRule<B,
|
||||
}
|
||||
return new XBreakpointTypeGroup(breakpoint.getType());
|
||||
}
|
||||
return null;
|
||||
return XBreakpointTypeGroup.UNKNOWN;
|
||||
}
|
||||
}
|
||||
|
||||
+16
-1
@@ -15,17 +15,31 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.breakpoints.ui.grouping;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointType;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpointType;
|
||||
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroup;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class XBreakpointTypeGroup extends XBreakpointGroup {
|
||||
public static final XBreakpointTypeGroup UNKNOWN = new XBreakpointTypeGroup(null) {
|
||||
@NotNull
|
||||
@Override
|
||||
public String getName() {
|
||||
return XDebuggerBundle.message("xbreakpoint.group.unknown");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Icon getIcon(boolean isOpen) {
|
||||
return AllIcons.Debugger.Db_set_breakpoint;
|
||||
}
|
||||
};
|
||||
|
||||
private XBreakpointType myBreakpointType;
|
||||
|
||||
@@ -39,6 +53,7 @@ public class XBreakpointTypeGroup extends XBreakpointGroup {
|
||||
return myBreakpointType.getTitle();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public XBreakpointType getBreakpointType() {
|
||||
return myBreakpointType;
|
||||
}
|
||||
|
||||
@@ -196,13 +196,6 @@ public class DebuggerUIUtil {
|
||||
}
|
||||
});
|
||||
|
||||
if (point == null) {
|
||||
balloon.showInCenterOf(component);
|
||||
}
|
||||
else {
|
||||
balloon.show(new RelativePoint(component, point), Balloon.Position.atRight);
|
||||
}
|
||||
|
||||
breakpointManager.addBreakpointListener(breakpointListener);
|
||||
ApplicationManager.getApplication().invokeLater(new Runnable() {
|
||||
@Override
|
||||
|
||||
@@ -15,11 +15,13 @@
|
||||
*/
|
||||
package com.intellij.xdebugger;
|
||||
|
||||
import com.intellij.openapi.util.JDOMUtil;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.xdebugger.breakpoints.SuspendPolicy;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpoint;
|
||||
import com.intellij.xdebugger.breakpoints.XBreakpointAdapter;
|
||||
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
|
||||
import org.jdom.Document;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -156,6 +158,33 @@ public class XBreakpointManagerTest extends XBreakpointsTestCase {
|
||||
assertEmpty(myBreakpointManager.getBreakpoints(MY_LINE_BREAKPOINT_TYPE));
|
||||
}
|
||||
|
||||
public void testConditionConvert() {
|
||||
String condition = "old-style condition";
|
||||
String logExpression = "old-style expression";
|
||||
String oldStyle =
|
||||
"<breakpoint-manager>" +
|
||||
"<breakpoints>" +
|
||||
"<line-breakpoint enabled=\"true\" type=\"" + MY_LINE_BREAKPOINT_TYPE.getId() + "\">" +
|
||||
" <condition>" + condition + "</condition>" +
|
||||
" <url>url</url>" +
|
||||
" <log-expression>" + logExpression + "</log-expression>" +
|
||||
"</line-breakpoint>" +
|
||||
"</breakpoints>" +
|
||||
"<option name=\"time\" value=\"1\" />" +
|
||||
"</breakpoint-manager>";
|
||||
try {
|
||||
Document document = JDOMUtil.loadDocument(oldStyle);
|
||||
load(document.getRootElement());
|
||||
}
|
||||
catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
fail();
|
||||
}
|
||||
XLineBreakpoint<MyBreakpointProperties> breakpoint = assertOneElement(myBreakpointManager.getBreakpoints(MY_LINE_BREAKPOINT_TYPE));
|
||||
assertEquals(condition, breakpoint.getCondition());
|
||||
assertEquals(logExpression, breakpoint.getLogExpression());
|
||||
}
|
||||
|
||||
private XBreakpoint<MyBreakpointProperties> getSingleBreakpoint() {
|
||||
return assertOneElement(myBreakpointManager.getBreakpoints(MY_SIMPLE_BREAKPOINT_TYPE));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user