mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master' into develar/is
This commit is contained in:
Generated
+2
-5
@@ -1,12 +1,9 @@
|
||||
<component name="libraryTable">
|
||||
<library name="CGLIB">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/cglib-2.2.2.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/cglib-nodep-3.2.4.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/cglib-src-2.2.2.jar!/src/proxy" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/cglib-src-2.2.2.jar!/src/test" />
|
||||
</SOURCES>
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
Generated
-12
@@ -1,12 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="asm">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/asm.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/asm-commons.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/src/asm-src.zip!/" />
|
||||
</SOURCES>
|
||||
</library>
|
||||
</component>
|
||||
Generated
-11
@@ -1,11 +0,0 @@
|
||||
<component name="libraryTable">
|
||||
<library name="asm-tools">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/android/android/lib/asm-5.0.3.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/android/android/lib/asm-analysis-5.0.3.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/android/android/lib/asm-tree-5.0.3.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.intellij.lang.regexp;
|
||||
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.application.ex.PathManagerEx;
|
||||
import com.intellij.testFramework.ParsingTestCase;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -31,7 +31,7 @@ public class RegExpParsingTest extends ParsingTestCase {
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PathManager.getHomePath() + "/community/RegExpSupport/testData/";
|
||||
return PathManagerEx.getCommunityHomePath() + "/RegExpSupport/testData";
|
||||
}
|
||||
|
||||
public void testSimple1() throws IOException { doCodeTest("|"); }
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
<include name="protobuf*.jar"/>
|
||||
<include name="netty*.jar"/>
|
||||
<include name="asm-all.jar"/>
|
||||
<include name="asm-commons.jar"/>
|
||||
<include name="jgoodies-forms.jar"/>
|
||||
<include name="guava*.jar"/>
|
||||
<include name="picocontainer.jar"/>
|
||||
|
||||
@@ -993,8 +993,6 @@ def layout_core(String home, String target) {
|
||||
include(name: "guava-17.0.jar")
|
||||
include(name: "picocontainer.jar")
|
||||
include(name: "trove4j.jar")
|
||||
include(name: "asm.jar")
|
||||
include(name: "asm-commons.jar")
|
||||
include(name: "cli-parser-1.1.jar")
|
||||
include(name: "snappy-in-java-0.3.1.jar")
|
||||
include(name: "jayatana-1.2.4.jar")
|
||||
|
||||
+1
-1
@@ -35,7 +35,7 @@ echo "Updating $WORK_IDEA_HOME from compiled classes in $DEV_IDEA_HOME"
|
||||
|
||||
ANT_HOME="$DEV_IDEA_HOME/lib/ant"
|
||||
ANT_CLASSPATH="$DEV_IDEA_HOME/build/lib/gant/lib/jps.jar"
|
||||
$JAVA_BIN -Xms64m -Xmx512m -Dant.home="$ANT_HOME" -classpath "$ANT_HOME/lib/ant-launcher.jar" org.apache.tools.ant.launch.Launcher \
|
||||
"$JAVA_BIN" -Xms64m -Xmx512m -Dant.home="$ANT_HOME" -classpath "$ANT_HOME/lib/ant-launcher.jar" org.apache.tools.ant.launch.Launcher \
|
||||
-lib "$ANT_CLASSPATH" -f "$DEV_IDEA_HOME/build/update.xml" -Dwork.idea.home="$WORK_IDEA_HOME" $TARGET
|
||||
|
||||
if [ "$?" != "0" ]; then
|
||||
|
||||
+39
-4
@@ -34,6 +34,7 @@ public class SimplifyStreamApiCallChainsInspection extends BaseJavaBatchLocalIns
|
||||
private static final Logger LOG = Logger.getInstance("#" + SimplifyStreamApiCallChainsInspection.class.getName());
|
||||
|
||||
private static final String FOR_EACH_METHOD = "forEach";
|
||||
private static final String FOR_EACH_ORDERED_METHOD = "forEachOrdered";
|
||||
private static final String STREAM_METHOD = "stream";
|
||||
private static final String AS_LIST_METHOD = "asList";
|
||||
private static final String OF_METHOD = "of";
|
||||
@@ -67,12 +68,22 @@ public class SimplifyStreamApiCallChainsInspection extends BaseJavaBatchLocalIns
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isCallOf(methodCall, CommonClassNames.JAVA_UTIL_STREAM_STREAM, FOR_EACH_METHOD, 1)) {
|
||||
else {
|
||||
final String name;
|
||||
if (isCallOf(methodCall, CommonClassNames.JAVA_UTIL_STREAM_STREAM, FOR_EACH_METHOD, 1)) {
|
||||
name = FOR_EACH_METHOD;
|
||||
}
|
||||
else if (isCallOf(methodCall, CommonClassNames.JAVA_UTIL_STREAM_STREAM, FOR_EACH_ORDERED_METHOD, 1)) {
|
||||
name = FOR_EACH_ORDERED_METHOD;
|
||||
}
|
||||
else {
|
||||
return;
|
||||
}
|
||||
final PsiMethodCallExpression qualifierCall = getQualifierMethodCall(methodCall);
|
||||
if (isCallOf(qualifierCall, CommonClassNames.JAVA_UTIL_COLLECTION, STREAM_METHOD, 0)) {
|
||||
holder.registerProblem(methodCall, getCallChainRange(methodCall, qualifierCall),
|
||||
"Collection.stream().forEach() can be replaced with Collection.forEach()",
|
||||
new CollectionForEachFix());
|
||||
"Collection.stream()." + name + "() can be replaced with Collection.forEach()",
|
||||
FOR_EACH_METHOD.equals(name) ? new CollectionForEachFix() : new CollectionForEachOrderedFix());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -192,7 +203,7 @@ public class SimplifyStreamApiCallChainsInspection extends BaseJavaBatchLocalIns
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return "Replace Collection.stream().forEach() with Collection.forEach()";
|
||||
return "Replace Collection.stream()." + FOR_EACH_METHOD + "() with Collection.forEach()";
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -204,4 +215,28 @@ public class SimplifyStreamApiCallChainsInspection extends BaseJavaBatchLocalIns
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static class CollectionForEachOrderedFix extends CollectionForEachFix {
|
||||
@Nls
|
||||
@NotNull
|
||||
@Override
|
||||
public String getFamilyName() {
|
||||
return "Replace Collection.stream()." + FOR_EACH_ORDERED_METHOD + "() with Collection.forEach()";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void replaceMethodCall(@NotNull PsiMethodCallExpression methodCall,
|
||||
@NotNull PsiMethodCallExpression qualifierCall,
|
||||
@Nullable PsiExpression qualifierExpression) {
|
||||
if (qualifierExpression != null) {
|
||||
final PsiElement nameElement = methodCall.getMethodExpression().getReferenceNameElement();
|
||||
if (nameElement != null) {
|
||||
qualifierCall.replace(qualifierExpression);
|
||||
final Project project = methodCall.getProject();
|
||||
PsiIdentifier forEachIdentifier = JavaPsiFacade.getElementFactory(project).createIdentifier(FOR_EACH_METHOD);
|
||||
nameElement.replace(forEachIdentifier);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+7
-8
@@ -18,7 +18,6 @@ package com.intellij.codeInspection.deadCode;
|
||||
import com.intellij.ToolExtensionPoints;
|
||||
import com.intellij.analysis.AnalysisScope;
|
||||
import com.intellij.codeInsight.daemon.GroupNames;
|
||||
import com.intellij.codeInsight.daemon.ImplicitUsageProvider;
|
||||
import com.intellij.codeInsight.daemon.impl.HighlightInfoType;
|
||||
import com.intellij.codeInsight.daemon.impl.analysis.HighlightUtilBase;
|
||||
import com.intellij.codeInspection.*;
|
||||
@@ -37,7 +36,6 @@ import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.extensions.PluginDescriptor;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
import com.intellij.openapi.util.WriteExternalException;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -372,7 +370,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
|
||||
|
||||
public boolean isEntryPoint(@NotNull RefElement owner) {
|
||||
final PsiElement element = owner.getElement();
|
||||
if (RefUtil.isImplicitUsage(element)) return true;
|
||||
if (isImplicitUsage(element)) return true;
|
||||
if (element instanceof PsiModifierListOwner) {
|
||||
final EntryPointsManager entryPointsManager = EntryPointsManager.getInstance(element.getProject());
|
||||
if (entryPointsManager.isEntryPoint(element)) {
|
||||
@@ -389,6 +387,11 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
|
||||
return false;
|
||||
}
|
||||
|
||||
private static boolean isImplicitUsage(PsiElement element) {
|
||||
return element instanceof PsiField ? RefUtil.isImplicitRead(element)
|
||||
: RefUtil.isImplicitUsage(element);
|
||||
}
|
||||
|
||||
public boolean isEntryPoint(@NotNull PsiElement element) {
|
||||
final Project project = element.getProject();
|
||||
final JavaPsiFacade psiFacade = JavaPsiFacade.getInstance(project);
|
||||
@@ -417,11 +420,7 @@ public class UnusedDeclarationInspectionBase extends GlobalInspectionTool {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
|
||||
for (ImplicitUsageProvider provider : implicitUsageProviders) {
|
||||
if (provider.isImplicitUsage(element)) return true;
|
||||
}
|
||||
return false;
|
||||
return isImplicitUsage(element);
|
||||
}
|
||||
|
||||
public boolean isGlobalEnabledInEditor() {
|
||||
|
||||
+27
-38
@@ -22,16 +22,16 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.controlFlow.DefUseUtil;
|
||||
import com.intellij.util.ObjectUtils;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import java.awt.*;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class DefUseInspectionBase extends BaseJavaBatchLocalInspectionTool {
|
||||
public boolean REPORT_PREFIX_EXPRESSIONS;
|
||||
@@ -39,17 +39,19 @@ public class DefUseInspectionBase extends BaseJavaBatchLocalInspectionTool {
|
||||
public boolean REPORT_REDUNDANT_INITIALIZER = true;
|
||||
|
||||
public static final String DISPLAY_NAME = InspectionsBundle.message("inspection.unused.assignment.display.name");
|
||||
@NonNls public static final String SHORT_NAME = "UnusedAssignment";
|
||||
public static final String SHORT_NAME = "UnusedAssignment";
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public PsiElementVisitor buildVisitor(@NotNull final ProblemsHolder holder, final boolean isOnTheFly) {
|
||||
return new JavaElementVisitor() {
|
||||
@Override public void visitMethod(PsiMethod method) {
|
||||
@Override
|
||||
public void visitMethod(PsiMethod method) {
|
||||
checkCodeBlock(method.getBody(), holder, isOnTheFly);
|
||||
}
|
||||
|
||||
@Override public void visitClassInitializer(PsiClassInitializer initializer) {
|
||||
@Override
|
||||
public void visitClassInitializer(PsiClassInitializer initializer) {
|
||||
checkCodeBlock(initializer.getBody(), holder, isOnTheFly);
|
||||
}
|
||||
};
|
||||
@@ -118,17 +120,21 @@ public class DefUseInspectionBase extends BaseJavaBatchLocalInspectionTool {
|
||||
}
|
||||
}
|
||||
|
||||
body.accept(new JavaRecursiveElementWalkingVisitor() {
|
||||
@Override public void visitClass(PsiClass aClass) { }
|
||||
if (!isOnTheFly) {
|
||||
body.accept(new JavaRecursiveElementWalkingVisitor() {
|
||||
@Override
|
||||
public void visitClass(PsiClass aClass) { }
|
||||
|
||||
@Override public void visitLocalVariable(PsiLocalVariable variable) {
|
||||
if (!usedVariables.contains(variable) && variable.getInitializer() == null && !isOnTheFly) {
|
||||
holder.registerProblem(ObjectUtils.notNull(variable.getNameIdentifier(), variable),
|
||||
InspectionsBundle.message("inspection.unused.assignment.problem.descriptor5", "<code>#ref</code> #loc"),
|
||||
ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
@Override
|
||||
public void visitLocalVariable(PsiLocalVariable variable) {
|
||||
if (!usedVariables.contains(variable) && variable.getInitializer() == null) {
|
||||
PsiElement element = ObjectUtils.notNull(variable.getNameIdentifier(), variable);
|
||||
String message = InspectionsBundle.message("inspection.unused.assignment.problem.descriptor5", "<code>#ref</code> #loc");
|
||||
holder.registerProblem(element, message, ProblemHighlightType.LIKE_UNUSED_SYMBOL);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isOnTheFlyOrNoSideEffects(boolean isOnTheFly,
|
||||
@@ -166,44 +172,27 @@ public class DefUseInspectionBase extends BaseJavaBatchLocalInspectionTool {
|
||||
|
||||
myReportInitializer = new JCheckBox(InspectionsBundle.message("inspection.unused.assignment.option2"));
|
||||
myReportInitializer.setSelected(REPORT_REDUNDANT_INITIALIZER);
|
||||
myReportInitializer.getModel().addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
REPORT_REDUNDANT_INITIALIZER = myReportInitializer.isSelected();
|
||||
}
|
||||
});
|
||||
gc.insets = new Insets(0, 0, 15, 0);
|
||||
myReportInitializer.getModel().addChangeListener(e -> REPORT_REDUNDANT_INITIALIZER = myReportInitializer.isSelected());
|
||||
gc.insets = JBUI.insetsBottom(15);
|
||||
gc.gridy = 0;
|
||||
add(myReportInitializer, gc);
|
||||
|
||||
myReportPrefix = new JCheckBox(InspectionsBundle.message("inspection.unused.assignment.option"));
|
||||
myReportPrefix.setSelected(REPORT_PREFIX_EXPRESSIONS);
|
||||
myReportPrefix.getModel().addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
REPORT_PREFIX_EXPRESSIONS = myReportPrefix.isSelected();
|
||||
}
|
||||
});
|
||||
gc.insets = new Insets(0, 0, 0, 0);
|
||||
myReportPrefix.getModel().addChangeListener(e -> REPORT_PREFIX_EXPRESSIONS = myReportPrefix.isSelected());
|
||||
gc.insets = JBUI.emptyInsets();
|
||||
gc.gridy++;
|
||||
add(myReportPrefix, gc);
|
||||
|
||||
myReportPostfix = new JCheckBox(InspectionsBundle.message("inspection.unused.assignment.option1"));
|
||||
myReportPostfix.setSelected(REPORT_POSTFIX_EXPRESSIONS);
|
||||
myReportPostfix.getModel().addChangeListener(new ChangeListener() {
|
||||
@Override
|
||||
public void stateChanged(ChangeEvent e) {
|
||||
REPORT_POSTFIX_EXPRESSIONS = myReportPostfix.isSelected();
|
||||
}
|
||||
});
|
||||
|
||||
myReportPostfix.getModel().addChangeListener(e -> REPORT_POSTFIX_EXPRESSIONS = myReportPostfix.isSelected());
|
||||
gc.weighty = 1;
|
||||
gc.gridy++;
|
||||
add(myReportPostfix, gc);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getDisplayName() {
|
||||
|
||||
+10
-2
@@ -18,6 +18,7 @@ package com.intellij.codeInspection.miscGenerics;
|
||||
import com.intellij.codeInspection.*;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.TypeConversionUtil;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -42,7 +43,14 @@ public class MakeTypeGenericInspection extends BaseJavaBatchLocalInspectionTool
|
||||
final String typeText = type.getCanonicalText();
|
||||
final String message =
|
||||
InspectionsBundle.message("inspection.raw.variable.type.make.generic.text", variable.getName(), typeText);
|
||||
holder.registerProblem(variable, message, new MyLocalQuickFix(message));
|
||||
final PsiElement beforeInitializer =
|
||||
PsiTreeUtil.skipSiblingsBackward(variable.getInitializer(), PsiWhiteSpace.class, PsiComment.class);
|
||||
final ProblemDescriptor descriptor =
|
||||
holder.getManager().createProblemDescriptor(variable.getTypeElement(),
|
||||
beforeInitializer != null ? beforeInitializer : variable.getTypeElement(),
|
||||
message, ProblemHighlightType.GENERIC_ERROR_OR_WARNING,
|
||||
isOnTheFly, new MyLocalQuickFix(message));
|
||||
holder.registerProblem(descriptor);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -96,7 +104,7 @@ public class MakeTypeGenericInspection extends BaseJavaBatchLocalInspectionTool
|
||||
|
||||
@Override
|
||||
public void applyFix(@NotNull Project project, @NotNull ProblemDescriptor descriptor) {
|
||||
final PsiElement element = descriptor.getPsiElement();
|
||||
final PsiElement element = descriptor.getStartElement().getParent();
|
||||
if (element instanceof PsiVariable) {
|
||||
final PsiVariable variable = (PsiVariable)element;
|
||||
final PsiTypeElement typeElement = variable.getTypeElement();
|
||||
|
||||
@@ -21,7 +21,6 @@ import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.ClassUtil;
|
||||
import com.intellij.psi.util.PsiFormatUtil;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
@@ -122,7 +121,7 @@ public class RefFieldImpl extends RefJavaElementImpl implements RefField {
|
||||
refUtil.addReferences(psiField, this, psiField);
|
||||
}
|
||||
|
||||
if (psiField.getInitializer() != null || psiField instanceof PsiEnumConstant) {
|
||||
if (psiField.getInitializer() != null || psiField instanceof PsiEnumConstant || RefUtil.isWriteImplicitly(psiField)) {
|
||||
if (!checkFlag(USED_FOR_WRITING_MASK)) {
|
||||
setFlag(true, ASSIGNED_ONLY_IN_INITIALIZER_MASK);
|
||||
setFlag(true, USED_FOR_WRITING_MASK);
|
||||
|
||||
@@ -29,7 +29,6 @@
|
||||
<orderEntry type="module" module-name="jsp-openapi" />
|
||||
<orderEntry type="module" module-name="jsp-spi" />
|
||||
<orderEntry type="module" module-name="execution-openapi" />
|
||||
<orderEntry type="library" name="asm" level="project" />
|
||||
<orderEntry type="module" module-name="dom-openapi" />
|
||||
<orderEntry type="module" module-name="dom-impl" />
|
||||
<orderEntry type="module" module-name="vcs-impl" />
|
||||
|
||||
@@ -58,7 +58,7 @@ public class InheritanceImplUtil {
|
||||
final PsiClass baseCandidateClass = ((PsiAnonymousClass)candidateClass).getBaseClassType().resolve();
|
||||
if (baseCandidateClass != null) {
|
||||
if (!checkDeep) {
|
||||
return baseCandidateClass.equals(baseClass);
|
||||
return manager.areElementsEquivalent(baseCandidateClass, baseClass);
|
||||
}
|
||||
return InheritanceUtil.isInheritorOrSelf(baseCandidateClass, baseClass, true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
import java.util.*;
|
||||
|
||||
public class F {
|
||||
List list = new ArrayList<caret><String>();
|
||||
}
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems />
|
||||
<problems/>
|
||||
@@ -0,0 +1,11 @@
|
||||
public class MyMTest {
|
||||
@org.mockito.Mock
|
||||
private String myFoo;
|
||||
|
||||
{
|
||||
System.out.println(myFoo);
|
||||
}
|
||||
|
||||
@org.junit.Test
|
||||
public void testName() throws Exception {}
|
||||
}
|
||||
+2
-2
@@ -1,10 +1,10 @@
|
||||
public class Foo {
|
||||
class Foo {
|
||||
int myOffset;
|
||||
void foo() {
|
||||
int offset = myOffset + 4;
|
||||
byte[] a = new byte[10];
|
||||
byte b1 = a[offset++];
|
||||
byte b2 = a[offset++];
|
||||
byte b2 = a[<warning descr="The value changed at 'offset++' is never used">offset++</warning>];
|
||||
System.out.println(b1);
|
||||
System.out.println(b2);
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public class Foo {
|
||||
class Foo {
|
||||
public void foo() {
|
||||
int[] array = new int[5];
|
||||
for (int i = 0; i < array.length; i++) {}
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
+19
-1
@@ -1,4 +1,22 @@
|
||||
public class DefUse {
|
||||
class DefUse {
|
||||
interface JZlib {
|
||||
int Z_NO_FLUSH = 0;
|
||||
int Z_HUFFMAN_ONLY = 2;
|
||||
int Z_FINISH = 4;
|
||||
}
|
||||
|
||||
static class ZStream {
|
||||
int avail_out;
|
||||
}
|
||||
|
||||
int strategy, ins_h, strstart, match_start, hash_shift, hash_mask, hash_head, w_size, w_mask, max_lazy_match;
|
||||
byte[] window;
|
||||
short[] prev, head;
|
||||
ZStream strm;
|
||||
|
||||
int longest_match(int cur_match) { throw new UnsupportedOperationException(); }
|
||||
boolean _tr_tally(int dist, int lc) { throw new UnsupportedOperationException(); }
|
||||
void flush_block_only(boolean eof) { throw new UnsupportedOperationException(); }
|
||||
|
||||
private int deflate_fast(int flush, int lookahead, int match_length) {
|
||||
// short hash_head = 0; // head of the hash chain
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
class Foo {
|
||||
private void f() {
|
||||
int x = 10;
|
||||
int t = x;
|
||||
<warning descr="The value 10 assigned to 'x' is never used">x</warning> += 10;
|
||||
System.out.println(t);
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>Foo.java</file>
|
||||
<line>5</line>
|
||||
<problem_class severity="WARNING" attribute_key="NOT_USED_ELEMENT_ATTRIBUTES">Unused assignment</problem_class>
|
||||
<description>The value 10 assigned to <code>x</code> is never used</description>
|
||||
</problem>
|
||||
</problems>
|
||||
@@ -1,8 +0,0 @@
|
||||
public class Foo {
|
||||
private void f() {
|
||||
int x = 10;
|
||||
int t = x;
|
||||
x += 10;
|
||||
System.out.println(t);
|
||||
}
|
||||
}
|
||||
+6
-5
@@ -1,9 +1,10 @@
|
||||
import java.util.Stack;
|
||||
class AsynchronousImageLoader extends Thread {
|
||||
interface Stack {
|
||||
boolean isEmpty();
|
||||
Object pop();
|
||||
}
|
||||
|
||||
public class AsynchronousImageLoader extends Thread {
|
||||
private final Stack _tasks = new Stack();
|
||||
|
||||
private void threadBody() throws InterruptedException {
|
||||
private void threadBody(Stack _tasks) throws InterruptedException {
|
||||
while (true) {
|
||||
final Runnable task;
|
||||
synchronized (this) {
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
package spike;
|
||||
|
||||
public class A
|
||||
class A
|
||||
{
|
||||
public static void main (String[] args)
|
||||
{
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public class AssignTest {
|
||||
class AssignTest {
|
||||
public static void main(String[] args) {
|
||||
int foo = 0;
|
||||
|
||||
@@ -1,3 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems />
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
class NotUsedTest {
|
||||
public static void main(String[] args) {
|
||||
boolean unused = true;
|
||||
<warning descr="The value true assigned to 'unused' is never used">unused</warning> = true;
|
||||
<warning descr="The value true assigned to 'unused' is never used">unused</warning> = true;
|
||||
}
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>NotUsedTest.java</file>
|
||||
<line>3</line>
|
||||
<description>Variable is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>NotUsedTest.java</file>
|
||||
<line>4</line>
|
||||
<description>The value assigned is never used</description>
|
||||
</problem>
|
||||
<problem>
|
||||
<file>NotUsedTest.java</file>
|
||||
<line>5</line>
|
||||
<description>The value assigned is never used</description>
|
||||
</problem>
|
||||
|
||||
</problems>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
public class NotUsedTest {
|
||||
public static void main(String[] args) {
|
||||
boolean unused = true;
|
||||
unused = true;
|
||||
unused = true;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
public class Foo {
|
||||
class Foo {
|
||||
public void foo() {
|
||||
int i;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
class Foo {
|
||||
public void foo() {
|
||||
int i = 4;
|
||||
int[] array = new int[] {i};
|
||||
for (int j = 0; j < array.length; j++) {}
|
||||
}
|
||||
}
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
</problems>
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
public class Foo {
|
||||
public void foo() {
|
||||
int i = 4
|
||||
int[] array = new int[] {i};
|
||||
for (int i = 0; i < array.length; i++) {}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>Foo.java</file>
|
||||
<line>7</line>
|
||||
<description>The value changed is never used</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<problems>
|
||||
<problem>
|
||||
<file>Foo.java</file>
|
||||
<line>3</line>
|
||||
<description>Variable i is never used</description>
|
||||
</problem>
|
||||
</problems>
|
||||
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace Collection.stream().forEachOrdered() with Collection.forEach()" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
class Test {
|
||||
void print() {
|
||||
Arrays.asList('d', 'e', 'f').forEach(c -> System.out.print(" " + c));
|
||||
}
|
||||
}
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
// "Replace Collection.stream().forEachOrdered() with Collection.forEach()" "true"
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
class Test {
|
||||
void print() {
|
||||
Arrays.asList('d', 'e', 'f').str<caret>eam().forEachOrdered(c -> System.out.print(" " + c));
|
||||
}
|
||||
}
|
||||
@@ -1,3 +1,3 @@
|
||||
public @interface Observer {
|
||||
@interface Observer {
|
||||
String value();
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
public class Test {
|
||||
public static final String CONST = "const";
|
||||
static final String CONST = "const";
|
||||
public static void main(String[] args){
|
||||
System.out.println(CONST);
|
||||
}
|
||||
|
||||
@@ -1,44 +1,43 @@
|
||||
/*
|
||||
* 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.codeInspection;
|
||||
|
||||
import com.intellij.JavaTestUtil;
|
||||
import com.intellij.codeInspection.defUse.DefUseInspection;
|
||||
import com.intellij.testFramework.InspectionTestCase;
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase;
|
||||
|
||||
public class DefUseTest extends InspectionTestCase {
|
||||
public class DefUseTest extends LightCodeInsightFixtureTestCase {
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return JavaTestUtil.getJavaTestDataPath() + "/inspection";
|
||||
protected String getBasePath() {
|
||||
return JavaTestUtil.getRelativeJavaTestDataPath() + "/inspection/defUse";
|
||||
}
|
||||
|
||||
private void doTest() throws Exception {
|
||||
doTest("defUse/" + getTestName(false), new DefUseInspection());
|
||||
public void testSCR5144() { doTest(); }
|
||||
public void testSCR6843() { doTest(); }
|
||||
public void testUnusedVariable() { doTest(); }
|
||||
public void testArrayIndexUsages() { doTest(); }
|
||||
public void testSCR28019() { doTest(); }
|
||||
public void testSCR40364() { doTest(); }
|
||||
public void testArrayLength() { doTest(); }
|
||||
public void testUsedInArrayInitializer() { doTest(); }
|
||||
public void testHang() { doTest(); }
|
||||
public void testOperatorAssignment() { doTest(); }
|
||||
|
||||
private void doTest() {
|
||||
myFixture.enableInspections(new DefUseInspection());
|
||||
myFixture.testHighlighting(getTestName(false) + ".java");
|
||||
}
|
||||
|
||||
|
||||
public void testSCR5144() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSCR6843() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testunusedVariable() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testarrayIndexUsages() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
// TODO:
|
||||
public void testSCR28019() throws Exception {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testSCR40364() throws Exception { doTest(); }
|
||||
public void testArrayLength() throws Exception { doTest(); }
|
||||
public void testUsedInArrayInitializer() throws Exception { doTest(); }
|
||||
public void testHang() throws Exception { doTest(); }
|
||||
public void testOperatorAssignment() throws Exception { doTest(); }
|
||||
}
|
||||
}
|
||||
@@ -61,6 +61,10 @@ public class MakeTypeGenericTest extends LightCodeInsightFixtureTestCase {
|
||||
doTest("Change type of list to java.util.List<java.lang.String>");
|
||||
}
|
||||
|
||||
public void testAtInitializer() {
|
||||
assertIntentionNotAvailable("Change type of list to java.util.List<java.lang.String>");
|
||||
}
|
||||
|
||||
public void testImplementedRaw() {
|
||||
assertIntentionNotAvailable("Change type of");
|
||||
}
|
||||
|
||||
@@ -164,6 +164,10 @@ public class UnusedDeclarationTest extends InspectionTestCase {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testMockedField() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
public void testConstructorCalls() {
|
||||
doTest();
|
||||
}
|
||||
|
||||
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,8 +1,6 @@
|
||||
asm-commons.jar
|
||||
asm.jar
|
||||
asm-all.jar
|
||||
automaton.jar
|
||||
cglib-2.2.2.jar
|
||||
cglib-nodep-3.2.4.jar
|
||||
cli-parser-1.1.jar
|
||||
commons-codec-1.9.jar
|
||||
commons-httpclient-3.1-patched.jar
|
||||
|
||||
@@ -41,6 +41,14 @@ public class RefUtil {
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isImplicitRead(PsiElement element) {
|
||||
final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
|
||||
for (ImplicitUsageProvider provider : implicitUsageProviders) {
|
||||
if (provider.isImplicitRead(element)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean contains(RefEntity element, @NotNull Collection<RefEntity> entities){
|
||||
for (RefEntity refEntity : entities) {
|
||||
if (Comparing.equal(refEntity, element)) {
|
||||
@@ -49,4 +57,12 @@ public class RefUtil {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static boolean isWriteImplicitly(PsiElement element) {
|
||||
final ImplicitUsageProvider[] implicitUsageProviders = Extensions.getExtensions(ImplicitUsageProvider.EP_NAME);
|
||||
for (ImplicitUsageProvider provider : implicitUsageProviders) {
|
||||
if (provider.isImplicitWrite(element)) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,6 @@
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
<orderEntry type="library" name="asm" level="project" />
|
||||
<orderEntry type="library" name="CGLIB" level="project" />
|
||||
<orderEntry type="library" name="KotlinJavaRuntime" level="project" />
|
||||
</component>
|
||||
|
||||
@@ -18,11 +18,11 @@ package com.intellij.util;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import com.intellij.util.containers.ConcurrentFactoryMap;
|
||||
import net.sf.cglib.asm.$ClassVisitor;
|
||||
import net.sf.cglib.asm.$Label;
|
||||
import net.sf.cglib.asm.$Type;
|
||||
import net.sf.cglib.core.*;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
@@ -34,7 +34,7 @@ public class InstanceofCheckerGenerator {
|
||||
|
||||
static {
|
||||
try {
|
||||
ClassGenerator.class.getDeclaredMethod("generateClass", ClassVisitor.class);
|
||||
ClassGenerator.class.getDeclaredMethod("generateClass", $ClassVisitor.class);
|
||||
}
|
||||
catch (NoSuchMethodException e) {
|
||||
throw new IllegalStateException("Incorrect cglib version in the classpath, source=" + PathManager.getJarPathForClass(ClassGenerator.class));
|
||||
@@ -106,24 +106,24 @@ public class InstanceofCheckerGenerator {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void generateClass(ClassVisitor classVisitor) throws Exception {
|
||||
public void generateClass($ClassVisitor classVisitor) throws Exception {
|
||||
ClassEmitter cv = new ClassEmitter(classVisitor);
|
||||
|
||||
cv.visit(Constants.V1_2, Modifier.PUBLIC, "com/intellij/util/InstanceofChecker$$$$$" + myCheckedClass.getName().replace('.', '$'), null, toInternalName(Object.class), new String[]{toInternalName(Condition.class)});
|
||||
cv.visitSource(Constants.SOURCE_FILE, null);
|
||||
final Signature signature = new Signature("<init>", "()V");
|
||||
final CodeEmitter cons = cv.begin_method(Modifier.PUBLIC, signature, new Type[0]);
|
||||
final CodeEmitter cons = cv.begin_method(Modifier.PUBLIC, signature, new $Type[0]);
|
||||
cons.load_this();
|
||||
cons.dup();
|
||||
cons.super_invoke_constructor(signature);
|
||||
cons.return_value();
|
||||
cons.end_method();
|
||||
|
||||
final CodeEmitter e = cv.begin_method(Modifier.PUBLIC, new Signature("value", "(L" + toInternalName(Object.class) + ";)Z"), new Type[0]);
|
||||
final CodeEmitter e = cv.begin_method(Modifier.PUBLIC, new Signature("value", "(L" + toInternalName(Object.class) + ";)Z"), new $Type[0]);
|
||||
e.load_arg(0);
|
||||
e.instance_of(Type.getType(myCheckedClass));
|
||||
e.instance_of($Type.getType(myCheckedClass));
|
||||
|
||||
Label fail = e.make_label();
|
||||
$Label fail = e.make_label();
|
||||
e.if_jump(CodeEmitter.EQ, fail);
|
||||
e.push(true);
|
||||
e.return_value();
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
package net.sf.cglib.core;
|
||||
|
||||
import com.intellij.reference.SoftReference;
|
||||
import org.objectweb.asm.ClassReader;
|
||||
import net.sf.cglib.asm.$ClassReader;
|
||||
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
@@ -217,7 +217,7 @@ implements ClassGenerator
|
||||
}
|
||||
if (gen == null) {
|
||||
byte[] b = strategy.generate(this);
|
||||
String className = ClassNameReader.getClassName(new ClassReader(b));
|
||||
String className = ClassNameReader.getClassName(new $ClassReader(b));
|
||||
getClassNameCache(loader).add(className);
|
||||
gen = ReflectUtils.defineClass(className, b, loader);
|
||||
}
|
||||
|
||||
@@ -83,16 +83,20 @@ public class CompareFilesAction extends BaseShowDiffAction {
|
||||
}
|
||||
|
||||
if (files.length == 1) {
|
||||
return files[0].isValid();
|
||||
return isValidAndLocal(files[0]);
|
||||
}
|
||||
else if (files.length == 2) {
|
||||
return files[0].isValid() && files[1].isValid();
|
||||
return isValidAndLocal(files[0]) && isValidAndLocal(files[1]);
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private static boolean isValidAndLocal(VirtualFile file) {
|
||||
return file.isValid() && file.isInLocalFileSystem();
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
protected DiffRequest getDiffRequest(@NotNull AnActionEvent e) {
|
||||
|
||||
@@ -105,7 +105,7 @@ public class FontOptions extends JPanel implements OptionsPanel{
|
||||
myEnableLigaturesCheckbox.setBorder(null);
|
||||
panel.add(myEnableLigaturesCheckbox);
|
||||
JLabel warningIcon = new JLabel(AllIcons.General.BalloonWarning);
|
||||
warningIcon.setToolTipText(ApplicationBundle.message("ligatures.jre.warning", ApplicationNamesInfo.getInstance().getProductName()));
|
||||
warningIcon.setToolTipText(ApplicationBundle.message("ligatures.jre.warning", ApplicationNamesInfo.getInstance().getFullProductName()));
|
||||
warningIcon.setBorder(JBUI.Borders.emptyLeft(5));
|
||||
updateWarningIconVisibility(warningIcon);
|
||||
panel.add(warningIcon);
|
||||
|
||||
+21
-17
@@ -170,27 +170,31 @@ public class CreateFileFix extends LocalQuickFixAndIntentionActionOnPsiElement {
|
||||
text = psiElement.getText();
|
||||
}
|
||||
|
||||
final FileEditorManager editorManager = FileEditorManager.getInstance(directory.getProject());
|
||||
final FileEditor[] fileEditors = editorManager.openFile(newFile.getVirtualFile(), true);
|
||||
|
||||
if (text != null) {
|
||||
for(FileEditor fileEditor: fileEditors) {
|
||||
if (fileEditor instanceof TextEditor) { // JSP is not safe to edit via Psi
|
||||
final Document document = ((TextEditor)fileEditor).getEditor().getDocument();
|
||||
document.setText(text);
|
||||
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
FileDocumentManager.getInstance().saveDocument(document);
|
||||
}
|
||||
PsiDocumentManager.getInstance(project).commitDocument(document);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
openFile(project, directory, newFile, text);
|
||||
}
|
||||
}
|
||||
catch (IncorrectOperationException e) {
|
||||
myIsAvailable = false;
|
||||
}
|
||||
}
|
||||
|
||||
protected void openFile(@NotNull Project project, PsiDirectory directory, PsiFile newFile, String text) {
|
||||
final FileEditorManager editorManager = FileEditorManager.getInstance(directory.getProject());
|
||||
final FileEditor[] fileEditors = editorManager.openFile(newFile.getVirtualFile(), true);
|
||||
|
||||
if (text != null) {
|
||||
for(FileEditor fileEditor: fileEditors) {
|
||||
if (fileEditor instanceof TextEditor) { // JSP is not safe to edit via Psi
|
||||
final Document document = ((TextEditor)fileEditor).getEditor().getDocument();
|
||||
document.setText(text);
|
||||
|
||||
if (ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
FileDocumentManager.getInstance().saveDocument(document);
|
||||
}
|
||||
PsiDocumentManager.getInstance(project).commitDocument(document);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+21
-2
@@ -20,6 +20,7 @@ import com.intellij.codeInsight.daemon.impl.quickfix.RenameFileFix;
|
||||
import com.intellij.codeInspection.LocalQuickFix;
|
||||
import com.intellij.ide.fileTemplates.FileTemplate;
|
||||
import com.intellij.ide.fileTemplates.FileTemplateManager;
|
||||
import com.intellij.ide.fileTemplates.actions.CreateFromTemplateActionBase;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
@@ -169,8 +170,7 @@ public class FileReferenceQuickFixProvider {
|
||||
if (!isDirectory && myNewFileTemplateName != null) {
|
||||
Project project = getStartElement().getProject();
|
||||
FileTemplateManager fileTemplateManager = FileTemplateManager.getInstance(project);
|
||||
FileTemplate template = fileTemplateManager.getTemplate(myNewFileTemplateName);
|
||||
if (template == null) template = fileTemplateManager.findInternalTemplate(myNewFileTemplateName);
|
||||
FileTemplate template = findTemplate(fileTemplateManager);
|
||||
|
||||
if (template != null) {
|
||||
try {
|
||||
@@ -182,5 +182,24 @@ public class FileReferenceQuickFixProvider {
|
||||
}
|
||||
return super.getFileText();
|
||||
}
|
||||
|
||||
private FileTemplate findTemplate(FileTemplateManager fileTemplateManager) {
|
||||
FileTemplate template = fileTemplateManager.getTemplate(myNewFileTemplateName);
|
||||
if (template == null) template = fileTemplateManager.findInternalTemplate(myNewFileTemplateName);
|
||||
return template;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void openFile(@NotNull Project project, PsiDirectory directory, PsiFile newFile, String text) {
|
||||
super.openFile(project, directory, newFile, text);
|
||||
if (!isDirectory && myNewFileTemplateName != null) {
|
||||
FileTemplateManager fileTemplateManager = FileTemplateManager.getInstance(project);
|
||||
FileTemplate template = findTemplate(fileTemplateManager);
|
||||
|
||||
if (template != null && template.isLiveTemplateEnabled()) {
|
||||
CreateFromTemplateActionBase.startLiveTemplate(newFile);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ui.tabs.impl;
|
||||
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.ui.Messages;
|
||||
import com.intellij.reference.SoftReference;
|
||||
import com.intellij.ui.InplaceButton;
|
||||
import com.intellij.ui.MouseDragHelper;
|
||||
import com.intellij.ui.ScreenUtil;
|
||||
@@ -29,6 +30,8 @@ import org.jetbrains.annotations.Nullable;
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.lang.ref.Reference;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
class DragHelper extends MouseDragHelper {
|
||||
|
||||
@@ -40,7 +43,7 @@ class DragHelper extends MouseDragHelper {
|
||||
private Dimension myHoldDelta;
|
||||
|
||||
private TabInfo myDragOutSource;
|
||||
private TabLabel myPressedTabLabel;
|
||||
private Reference<TabLabel> myPressedTabLabel;
|
||||
|
||||
public DragHelper(JBTabsImpl tabs) {
|
||||
super(tabs, tabs);
|
||||
@@ -57,10 +60,8 @@ class DragHelper extends MouseDragHelper {
|
||||
|
||||
int dX = dragToScreenPoint.x - startScreenPoint.x;
|
||||
int dY = dragToScreenPoint.y - startScreenPoint.y;
|
||||
boolean dragOut =
|
||||
myTabs.getEffectiveLayout().isDragOut(label, dX, dY);
|
||||
|
||||
return dragOut;
|
||||
return myTabs.getEffectiveLayout().isDragOut(label, dX, dY);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -90,7 +91,8 @@ class DragHelper extends MouseDragHelper {
|
||||
protected void processMousePressed(MouseEvent event) {
|
||||
// since selection change can cause tabs to be reordered, we need to remember the tab on which the mouse was pressed, otherwise
|
||||
// we'll end up dragging the wrong tab (IDEA-65073)
|
||||
myPressedTabLabel = findLabel(new RelativePoint(event).getPoint(myTabs));
|
||||
TabLabel label = findLabel(new RelativePoint(event).getPoint(myTabs));
|
||||
myPressedTabLabel = label == null ? null : new WeakReference<TabLabel>(label);
|
||||
}
|
||||
|
||||
protected void processDrag(MouseEvent event, Point targetScreenPoint, Point startPointScreen) {
|
||||
@@ -99,12 +101,13 @@ class DragHelper extends MouseDragHelper {
|
||||
SwingUtilities.convertPointFromScreen(startPointScreen, myTabs);
|
||||
|
||||
if (isDragJustStarted()) {
|
||||
if (myPressedTabLabel == null) return;
|
||||
TabLabel pressedTabLabel = SoftReference.dereference(myPressedTabLabel);
|
||||
if (pressedTabLabel == null) return;
|
||||
|
||||
final Rectangle labelBounds = myPressedTabLabel.getBounds();
|
||||
final Rectangle labelBounds = pressedTabLabel.getBounds();
|
||||
|
||||
myHoldDelta = new Dimension(startPointScreen.x - labelBounds.x, startPointScreen.y - labelBounds.y);
|
||||
myDragSource = myPressedTabLabel.getInfo();
|
||||
myDragSource = pressedTabLabel.getInfo();
|
||||
myDragRec = new Rectangle(startPointScreen, labelBounds.getSize());
|
||||
myDragOriginalRec = (Rectangle)myDragRec.clone();
|
||||
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
<orderEntry type="module" module-name="bootstrap" />
|
||||
<orderEntry type="library" exported="" name="commons-codec" level="project" />
|
||||
<orderEntry type="library" name="OroMatcher" level="project" />
|
||||
<orderEntry type="library" name="asm" level="project" />
|
||||
<orderEntry type="library" name="CGLIB" level="project" />
|
||||
<orderEntry type="module" module-name="lvcs-api" exported="" />
|
||||
<orderEntry type="library" name="JavaHelp" level="project" />
|
||||
|
||||
@@ -19,19 +19,17 @@ import com.apple.eawt.Application;
|
||||
import com.apple.eawt.ApplicationAdapter;
|
||||
import com.apple.eawt.ApplicationEvent;
|
||||
import com.intellij.ide.actions.AboutAction;
|
||||
import com.intellij.ide.actions.ExitAction;
|
||||
import com.intellij.ide.actions.OpenFileAction;
|
||||
import com.intellij.ide.actions.ShowSettingsUtilImpl;
|
||||
import com.intellij.ide.actions.ShowSettingsAction;
|
||||
import com.intellij.ide.impl.ProjectUtil;
|
||||
import com.intellij.idea.IdeaApplication;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.ex.ActionManagerEx;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.TransactionGuard;
|
||||
import com.intellij.openapi.application.ex.ApplicationEx;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.components.ApplicationComponent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.options.ShowSettingsUtil;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectManager;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -124,31 +122,20 @@ public class MacOSApplicationProvider implements ApplicationComponent {
|
||||
application.addApplicationListener(new ApplicationAdapter() {
|
||||
@Override
|
||||
public void handleAbout(ApplicationEvent applicationEvent) {
|
||||
AboutAction.showAbout();
|
||||
AboutAction.perform(getProject());
|
||||
applicationEvent.setHandled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handlePreferences(ApplicationEvent applicationEvent) {
|
||||
Project project = getNotNullProject();
|
||||
ShowSettingsUtilImpl showSettingsUtil = (ShowSettingsUtilImpl)ShowSettingsUtil.getInstance();
|
||||
if (!showSettingsUtil.isAlreadyShown()) {
|
||||
TransactionGuard.submitTransaction(project, () ->
|
||||
showSettingsUtil.showSettingsDialog(project, ShowSettingsUtilImpl.getConfigurableGroups(project, true)));
|
||||
}
|
||||
TransactionGuard.submitTransaction(project, () -> ShowSettingsAction.perform(project));
|
||||
applicationEvent.setHandled(true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private Project getNotNullProject() {
|
||||
Project project = getProject();
|
||||
return project == null ? ProjectManager.getInstance().getDefaultProject() : project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleQuit(ApplicationEvent applicationEvent) {
|
||||
ApplicationEx app = ApplicationManagerEx.getApplicationEx();
|
||||
TransactionGuard.submitTransaction(app, app::exit);
|
||||
TransactionGuard.submitTransaction(ApplicationManager.getApplication(), ExitAction::perform);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -208,5 +195,11 @@ public class MacOSApplicationProvider implements ApplicationComponent {
|
||||
private static Project getProject() {
|
||||
return CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Project getNotNullProject() {
|
||||
Project project = getProject();
|
||||
return project != null ? project : ProjectManager.getInstance().getDefaultProject();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.ide.actions;
|
||||
|
||||
import com.intellij.ide.DataManager;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
@@ -27,29 +26,19 @@ import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.wm.WindowManager;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
|
||||
public class AboutAction extends AnAction implements DumbAware {
|
||||
@Override
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setVisible(!SystemInfo.isMacSystemMenu || !ActionPlaces.MAIN_MENU.equals(e.getPlace()));
|
||||
e.getPresentation().setEnabledAndVisible(!SystemInfo.isMacSystemMenu || !ActionPlaces.MAIN_MENU.equals(e.getPlace()));
|
||||
e.getPresentation().setDescription("Show information about " + ApplicationNamesInfo.getInstance().getFullProductName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
Project project = e.getData(CommonDataKeys.PROJECT);
|
||||
Window window = WindowManager.getInstance().suggestParentWindow(project);
|
||||
showAboutDialog(window);
|
||||
perform(e.getData(CommonDataKeys.PROJECT));
|
||||
}
|
||||
|
||||
public static void showAbout() {
|
||||
@SuppressWarnings("deprecation") Project project = CommonDataKeys.PROJECT.getData(DataManager.getInstance().getDataContext());
|
||||
Window window = WindowManager.getInstance().suggestParentWindow(project);
|
||||
showAboutDialog(window);
|
||||
}
|
||||
|
||||
private static void showAboutDialog(@Nullable Window window) {
|
||||
AboutPopup.show(window);
|
||||
public static void perform(@Nullable Project project) {
|
||||
AboutPopup.show(WindowManager.getInstance().suggestParentWindow(project));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
*
|
||||
@@ -19,16 +18,20 @@ package com.intellij.ide.actions;
|
||||
import com.intellij.openapi.actionSystem.ActionPlaces;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.application.ex.ApplicationManagerEx;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
|
||||
public class ExitAction extends AnAction implements DumbAware {
|
||||
public void update(AnActionEvent e) {
|
||||
e.getPresentation().setVisible(!SystemInfo.isMacSystemMenu || !ActionPlaces.MAIN_MENU.equals(e.getPlace()));
|
||||
e.getPresentation().setEnabledAndVisible(!SystemInfo.isMacSystemMenu || !ActionPlaces.MAIN_MENU.equals(e.getPlace()));
|
||||
}
|
||||
|
||||
public void actionPerformed(AnActionEvent e) {
|
||||
ApplicationManagerEx.getApplicationEx().exit();
|
||||
perform();
|
||||
}
|
||||
|
||||
public static void perform() {
|
||||
ApplicationManager.getApplication().exit();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,6 +37,7 @@ public class ShowSettingsAction extends AnAction implements DumbAware {
|
||||
|
||||
@Override
|
||||
public void update(@NotNull AnActionEvent e) {
|
||||
e.getPresentation().setEnabledAndVisible(!SystemInfo.isMacSystemMenu || !ActionPlaces.MAIN_MENU.equals(e.getPlace()));
|
||||
if (SystemInfo.isMac && ActionPlaces.isMainMenuOrActionSearch(e.getPlace())) {
|
||||
// It's called from Preferences in App menu.
|
||||
e.getPresentation().setVisible(false);
|
||||
@@ -48,10 +49,10 @@ public class ShowSettingsAction extends AnAction implements DumbAware {
|
||||
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
Project project = e.getProject();
|
||||
if (project == null) {
|
||||
project = ProjectManager.getInstance().getDefaultProject();
|
||||
}
|
||||
perform(project != null ? project : ProjectManager.getInstance().getDefaultProject());
|
||||
}
|
||||
|
||||
public static void perform(@NotNull Project project) {
|
||||
final long startTime = System.nanoTime();
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
final long endTime = System.nanoTime();
|
||||
|
||||
@@ -36,14 +36,12 @@ import org.jetbrains.annotations.Nullable;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.ide.actions.ShowSettingsUtilImpl");
|
||||
private final AtomicBoolean myShown = new AtomicBoolean(false);
|
||||
|
||||
@NotNull
|
||||
private static Project getProject(@Nullable Project project) {
|
||||
@@ -90,15 +88,11 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
@Override
|
||||
public void showSettingsDialog(@NotNull Project project, @NotNull ConfigurableGroup[] group) {
|
||||
try {
|
||||
myShown.set(true);
|
||||
getDialog(project, group, null).show();
|
||||
}
|
||||
catch (Exception e) {
|
||||
LOG.error(e);
|
||||
}
|
||||
finally {
|
||||
myShown.set(false);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -237,8 +231,4 @@ public class ShowSettingsUtilImpl extends ShowSettingsUtil {
|
||||
public boolean editConfigurable(Component parent, String dimensionServiceKey, Configurable configurable) {
|
||||
return editConfigurable(parent, null, configurable, dimensionServiceKey, null, isWorthToShowApplyButton(configurable));
|
||||
}
|
||||
|
||||
public boolean isAlreadyShown() {
|
||||
return myShown.get();
|
||||
}
|
||||
}
|
||||
|
||||
+7
@@ -154,6 +154,13 @@ public class WelcomeBalloonLayoutImpl extends BalloonLayoutImpl {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void queueRelayout() {
|
||||
if (myVisible) {
|
||||
layoutPopup();
|
||||
}
|
||||
}
|
||||
|
||||
private void layoutPopup() {
|
||||
Dimension layeredSize = myLayeredPane.getSize();
|
||||
Dimension size = new Dimension(myPopupBalloon.getPreferredSize());
|
||||
|
||||
@@ -18,10 +18,10 @@ package net.sf.cglib.proxy;
|
||||
import com.intellij.ide.plugins.PluginManagerCore;
|
||||
import com.intellij.ide.plugins.cl.PluginClassLoader;
|
||||
import com.intellij.util.ReflectionUtil;
|
||||
import net.sf.cglib.asm.$ClassVisitor;
|
||||
import net.sf.cglib.asm.$Label;
|
||||
import net.sf.cglib.asm.$Type;
|
||||
import net.sf.cglib.core.*;
|
||||
import org.objectweb.asm.ClassVisitor;
|
||||
import org.objectweb.asm.Label;
|
||||
import org.objectweb.asm.Type;
|
||||
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
@@ -82,42 +82,42 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
private static final String SET_STATIC_CALLBACKS_NAME = "CGLIB$SET_STATIC_CALLBACKS";
|
||||
private static final String CONSTRUCTED_FIELD = "CGLIB$CONSTRUCTED";
|
||||
|
||||
private static final Type FACTORY =
|
||||
private static final $Type FACTORY =
|
||||
TypeUtils.parseType("net.sf.cglib.proxy.Factory");
|
||||
private static final Type ILLEGAL_STATE_EXCEPTION =
|
||||
private static final $Type ILLEGAL_STATE_EXCEPTION =
|
||||
TypeUtils.parseType("IllegalStateException");
|
||||
private static final Type ILLEGAL_ARGUMENT_EXCEPTION =
|
||||
private static final $Type ILLEGAL_ARGUMENT_EXCEPTION =
|
||||
TypeUtils.parseType("IllegalArgumentException");
|
||||
private static final Type THREAD_LOCAL =
|
||||
private static final $Type THREAD_LOCAL =
|
||||
TypeUtils.parseType("ThreadLocal");
|
||||
private static final Type CALLBACK =
|
||||
private static final $Type CALLBACK =
|
||||
TypeUtils.parseType("net.sf.cglib.proxy.Callback");
|
||||
private static final Type CALLBACK_ARRAY =
|
||||
Type.getType(Callback[].class);
|
||||
private static final $Type CALLBACK_ARRAY =
|
||||
$Type.getType(Callback[].class);
|
||||
private static final Signature CSTRUCT_NULL =
|
||||
TypeUtils.parseConstructor("");
|
||||
private static final Signature SET_THREAD_CALLBACKS =
|
||||
new Signature(SET_THREAD_CALLBACKS_NAME, Type.VOID_TYPE, new Type[]{ CALLBACK_ARRAY });
|
||||
new Signature(SET_THREAD_CALLBACKS_NAME, $Type.VOID_TYPE, new $Type[]{ CALLBACK_ARRAY });
|
||||
private static final Signature SET_STATIC_CALLBACKS =
|
||||
new Signature(SET_STATIC_CALLBACKS_NAME, Type.VOID_TYPE, new Type[]{ CALLBACK_ARRAY });
|
||||
new Signature(SET_STATIC_CALLBACKS_NAME, $Type.VOID_TYPE, new $Type[]{ CALLBACK_ARRAY });
|
||||
private static final Signature NEW_INSTANCE =
|
||||
new Signature("newInstance", Constants.TYPE_OBJECT, new Type[]{ CALLBACK_ARRAY });
|
||||
new Signature("newInstance", Constants.TYPE_OBJECT, new $Type[]{ CALLBACK_ARRAY });
|
||||
private static final Signature MULTIARG_NEW_INSTANCE =
|
||||
new Signature("newInstance", Constants.TYPE_OBJECT, new Type[]{
|
||||
new Signature("newInstance", Constants.TYPE_OBJECT, new $Type[]{
|
||||
Constants.TYPE_CLASS_ARRAY,
|
||||
Constants.TYPE_OBJECT_ARRAY,
|
||||
CALLBACK_ARRAY,
|
||||
});
|
||||
private static final Signature SINGLE_NEW_INSTANCE =
|
||||
new Signature("newInstance", Constants.TYPE_OBJECT, new Type[]{ CALLBACK });
|
||||
new Signature("newInstance", Constants.TYPE_OBJECT, new $Type[]{ CALLBACK });
|
||||
private static final Signature SET_CALLBACK =
|
||||
new Signature("setCallback", Type.VOID_TYPE, new Type[]{ Type.INT_TYPE, CALLBACK });
|
||||
new Signature("setCallback", $Type.VOID_TYPE, new $Type[]{ $Type.INT_TYPE, CALLBACK });
|
||||
private static final Signature GET_CALLBACK =
|
||||
new Signature("getCallback", CALLBACK, new Type[]{ Type.INT_TYPE });
|
||||
new Signature("getCallback", CALLBACK, new $Type[]{ $Type.INT_TYPE });
|
||||
private static final Signature SET_CALLBACKS =
|
||||
new Signature("setCallbacks", Type.VOID_TYPE, new Type[]{ CALLBACK_ARRAY });
|
||||
new Signature("setCallbacks", $Type.VOID_TYPE, new $Type[]{ CALLBACK_ARRAY });
|
||||
private static final Signature GET_CALLBACKS =
|
||||
new Signature("getCallbacks", CALLBACK_ARRAY, new Type[0]);
|
||||
new Signature("getCallbacks", CALLBACK_ARRAY, new $Type[0]);
|
||||
private static final Signature THREAD_LOCAL_GET =
|
||||
TypeUtils.parseSignature("Object get()");
|
||||
private static final Signature THREAD_LOCAL_SET =
|
||||
@@ -136,7 +136,7 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
Object newInstance(String type,
|
||||
String[] interfaces,
|
||||
CallbackFilter filter,
|
||||
Type[] callbackTypes,
|
||||
$Type[] callbackTypes,
|
||||
boolean useFactory,
|
||||
boolean interceptDuringConstruction,
|
||||
Long serialVersionUID);
|
||||
@@ -145,7 +145,7 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
private Class[] interfaces;
|
||||
private CallbackFilter filter;
|
||||
private Callback[] callbacks;
|
||||
private Type[] callbackTypes;
|
||||
private $Type[] callbackTypes;
|
||||
private boolean classOnly;
|
||||
private Class superclass;
|
||||
private Class[] argumentTypes;
|
||||
@@ -328,7 +328,7 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
if (callbacks.length != callbackTypes.length) {
|
||||
throw new IllegalStateException("Lengths of callback and callback types array must be the same");
|
||||
}
|
||||
Type[] check = CallbackInfo.determineTypes(callbacks);
|
||||
$Type[] check = CallbackInfo.determineTypes(callbacks);
|
||||
for (int i = 0; i < check.length; i++) {
|
||||
if (!check[i].equals(callbackTypes[i])) {
|
||||
throw new IllegalStateException("Callback " + check[i] + " is not assignable to " + callbackTypes[i]);
|
||||
@@ -429,7 +429,7 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
CollectionUtils.filter(methods, new VisibilityPredicate(superclass, true));
|
||||
}
|
||||
|
||||
public void generateClass(ClassVisitor v) throws Exception {
|
||||
public void generateClass($ClassVisitor v) throws Exception {
|
||||
Class sc = (superclass == null) ? Object.class : superclass;
|
||||
|
||||
if (TypeUtils.isFinal(sc.getModifiers())) {
|
||||
@@ -461,21 +461,21 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
e.begin_class(Constants.V1_2,
|
||||
Constants.ACC_PUBLIC,
|
||||
getClassName(),
|
||||
Type.getType(sc),
|
||||
$Type.getType(sc),
|
||||
(useFactory ?
|
||||
TypeUtils.add(TypeUtils.getTypes(interfaces), FACTORY) :
|
||||
TypeUtils.getTypes(interfaces)),
|
||||
Constants.SOURCE_FILE);
|
||||
List constructorInfo = CollectionUtils.transform(constructors, MethodInfoTransformer.getInstance());
|
||||
|
||||
e.declare_field(Constants.ACC_PRIVATE, BOUND_FIELD, Type.BOOLEAN_TYPE, null);
|
||||
e.declare_field(Constants.ACC_PRIVATE, BOUND_FIELD, $Type.BOOLEAN_TYPE, null);
|
||||
if (!interceptDuringConstruction) {
|
||||
e.declare_field(Constants.ACC_PRIVATE, CONSTRUCTED_FIELD, Type.BOOLEAN_TYPE, null);
|
||||
e.declare_field(Constants.ACC_PRIVATE, CONSTRUCTED_FIELD, $Type.BOOLEAN_TYPE, null);
|
||||
}
|
||||
e.declare_field(Constants.PRIVATE_FINAL_STATIC, THREAD_CALLBACKS_FIELD, THREAD_LOCAL, null);
|
||||
e.declare_field(Constants.PRIVATE_FINAL_STATIC, STATIC_CALLBACKS_FIELD, CALLBACK_ARRAY, null);
|
||||
if (serialVersionUID != null) {
|
||||
e.declare_field(Constants.PRIVATE_FINAL_STATIC, Constants.SUID_FIELD_NAME, Type.LONG_TYPE, serialVersionUID);
|
||||
e.declare_field(Constants.PRIVATE_FINAL_STATIC, Constants.SUID_FIELD_NAME, $Type.LONG_TYPE, serialVersionUID);
|
||||
}
|
||||
|
||||
for (int i = 0; i < callbackTypes.length; i++) {
|
||||
@@ -670,7 +670,7 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
e.load_this();
|
||||
e.load_arg(0);
|
||||
e.process_switch(keys, new ProcessSwitchCallback() {
|
||||
public void processCase(int key, Label end) {
|
||||
public void processCase(int key, $Label end) {
|
||||
e.getfield(getCallbackField(key));
|
||||
e.goTo(end);
|
||||
}
|
||||
@@ -689,13 +689,13 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
e.load_arg(1);
|
||||
e.load_arg(0);
|
||||
e.process_switch(keys, new ProcessSwitchCallback() {
|
||||
public void processCase(int key, Label end) {
|
||||
public void processCase(int key, $Label end) {
|
||||
e.checkcast(callbackTypes[key]);
|
||||
e.putfield(getCallbackField(key));
|
||||
e.goTo(end);
|
||||
}
|
||||
public void processDefault() {
|
||||
final Type type = Type.getType(AssertionError.class);
|
||||
final $Type type = $Type.getType(AssertionError.class);
|
||||
e.new_instance(type);
|
||||
e.dup();
|
||||
e.invoke_constructor(type);
|
||||
@@ -785,9 +785,9 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
e.dup();
|
||||
e.load_arg(0);
|
||||
EmitUtils.constructor_switch(e, constructors, new ObjectSwitchCallback() {
|
||||
public void processCase(Object key, Label end) {
|
||||
public void processCase(Object key, $Label end) {
|
||||
MethodInfo constructor = (MethodInfo)key;
|
||||
Type types[] = constructor.getSignature().getArgumentTypes();
|
||||
$Type types[] = constructor.getSignature().getArgumentTypes();
|
||||
for (int i = 0; i < types.length; i++) {
|
||||
e.load_arg(1);
|
||||
e.push(i);
|
||||
@@ -871,7 +871,7 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
CodeEmitter e = EmitUtils.begin_method(ce, method);
|
||||
if (!interceptDuringConstruction &&
|
||||
!TypeUtils.isAbstract(method.getModifiers())) {
|
||||
Label constructed = e.make_label();
|
||||
$Label constructed = e.make_label();
|
||||
e.load_this();
|
||||
e.getfield(CONSTRUCTED_FIELD);
|
||||
e.if_jump(e.NE, constructed);
|
||||
@@ -931,7 +931,7 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
e.load_this();
|
||||
e.getfield(getCallbackField(index));
|
||||
e.dup();
|
||||
Label end = e.make_label();
|
||||
$Label end = e.make_label();
|
||||
e.ifnonnull(end);
|
||||
e.pop(); // stack height
|
||||
e.load_this();
|
||||
@@ -950,7 +950,7 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
e.checkcast_this();
|
||||
e.store_local(me);
|
||||
|
||||
Label end = e.make_label();
|
||||
$Label end = e.make_label();
|
||||
e.load_local(me);
|
||||
e.getfield(BOUND_FIELD);
|
||||
e.if_jump(e.NE, end);
|
||||
@@ -961,7 +961,7 @@ public class AdvancedEnhancer extends AbstractClassGenerator
|
||||
e.getfield(THREAD_CALLBACKS_FIELD);
|
||||
e.invoke_virtual(THREAD_LOCAL, THREAD_LOCAL_GET);
|
||||
e.dup();
|
||||
Label found_callback = e.make_label();
|
||||
$Label found_callback = e.make_label();
|
||||
e.ifnonnull(found_callback);
|
||||
e.pop();
|
||||
|
||||
|
||||
@@ -533,7 +533,7 @@ checkbox.show.only.monospaced.fonts=Show only monospaced fonts
|
||||
primary.font=Primary font:
|
||||
secondary.font=Secondary font:
|
||||
use.ligatures=Enable font ligatures
|
||||
ligatures.jre.warning=Running {0} with bundled JRE is recommended.\nOther JREs have known functional and performance issues\nrelated to ligatures support.
|
||||
ligatures.jre.warning=The JRE you are running {0} with might have\nfunctional and performance issues related to ligatures support.\nTo avoid such issues, run IntelliJ IDEA with the bundled JRE.
|
||||
editbox.enter.tag.name=Enter tag name:
|
||||
title.tag.name=Tag Name
|
||||
title.xml=XML
|
||||
|
||||
+10
-10
@@ -55,7 +55,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
future.get();
|
||||
}
|
||||
assertEquals(0, executor.shutdownNow().size());
|
||||
assertTrue(executor.awaitTermination(N + N, TimeUnit.MILLISECONDS));
|
||||
assertTrue(executor.awaitTermination(N + N + 100000, TimeUnit.MILLISECONDS));
|
||||
assertEquals(maxTasks, max.get());
|
||||
assertEquals(N, executed.get());
|
||||
}
|
||||
@@ -93,7 +93,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
future.get();
|
||||
}
|
||||
assertEquals(0, executor.shutdownNow().size());
|
||||
assertTrue(executor.awaitTermination(N + N, TimeUnit.MILLISECONDS));
|
||||
assertTrue(executor.awaitTermination(N + N+100000, TimeUnit.MILLISECONDS));
|
||||
assertEquals(maxTasks, max.get());
|
||||
assertEquals(N, executed.get());
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
Integer result = f1.get();
|
||||
assertEquals(42, result.intValue());
|
||||
executor.shutdownNow();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
public void testEarlyCancelPreventsRunning() throws ExecutionException, InterruptedException {
|
||||
@@ -126,7 +126,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
assertFalse(run.get());
|
||||
assertTrue(s1.isDone());
|
||||
executor.shutdownNow();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
public void testStressWhenSomeTasksCallOtherTasksGet() throws ExecutionException, InterruptedException {
|
||||
@@ -175,7 +175,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
}
|
||||
finally {
|
||||
executor.shutdownNow();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
assertTrue("Max threads was: "+maxThreads+" but bound was: "+maxSimultaneousTasks, maxThreads.get() <= maxSimultaneousTasks);
|
||||
@@ -202,7 +202,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
String logs = log.toString();
|
||||
assertEquals(expected.toString(), logs);
|
||||
executor.shutdownNow();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
|
||||
@@ -238,7 +238,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
|
||||
String logs = log.toString();
|
||||
assertEquals("", logs);
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
public void testShutdownMustDisableSubmit() throws ExecutionException, InterruptedException {
|
||||
@@ -272,7 +272,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
|
||||
String logs = log.toString();
|
||||
assertEquals("", logs);
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
public void testAwaitTerminationDoesWait() throws InterruptedException {
|
||||
@@ -286,7 +286,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
futures[i] = executor.submit(() -> log.append(" "));
|
||||
}
|
||||
executor.shutdown();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
|
||||
String logs = log.toString();
|
||||
assertEquals(N, logs.length());
|
||||
@@ -304,7 +304,7 @@ public class BoundedScheduledExecutorTest extends TestCase {
|
||||
assertFalse(executor2.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertFalse(future.isDone());
|
||||
assertFalse(future.isCancelled());
|
||||
assertTrue(executor2.awaitTermination(1000, TimeUnit.SECONDS));
|
||||
assertTrue(executor2.awaitTermination(100, TimeUnit.SECONDS));
|
||||
assertTrue(future.isDone());
|
||||
assertFalse(future.isCancelled());
|
||||
}
|
||||
|
||||
+10
-10
@@ -88,9 +88,9 @@ public class BoundedTaskExecutorTest extends TestCase {
|
||||
}
|
||||
|
||||
executor.shutdown();
|
||||
assertTrue(executor.awaitTermination(N + 5000, TimeUnit.MILLISECONDS));
|
||||
assertTrue(executor.awaitTermination(N + 50000, TimeUnit.MILLISECONDS));
|
||||
backendExecutor.shutdownNow();
|
||||
assertTrue(backendExecutor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(backendExecutor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
assertEquals(maxTasks, max.get());
|
||||
assertEquals(N, executed.get());
|
||||
}
|
||||
@@ -104,7 +104,7 @@ public class BoundedTaskExecutorTest extends TestCase {
|
||||
Integer result = f1.get();
|
||||
assertEquals(42, result.intValue());
|
||||
executor.shutdownNow();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
backendExecutor.shutdownNow();
|
||||
assertTrue(backendExecutor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
@@ -127,7 +127,7 @@ public class BoundedTaskExecutorTest extends TestCase {
|
||||
assertFalse(run.get());
|
||||
assertTrue(s1.isDone());
|
||||
executor.shutdownNow();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
backendExecutor.shutdownNow();
|
||||
assertTrue(backendExecutor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
@@ -199,7 +199,7 @@ public class BoundedTaskExecutorTest extends TestCase {
|
||||
String logs = log.toString();
|
||||
assertEquals(expected.toString(), logs);
|
||||
executor.shutdownNow();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
backendExecutor.shutdownNow();
|
||||
assertTrue(backendExecutor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
@@ -345,7 +345,7 @@ public class BoundedTaskExecutorTest extends TestCase {
|
||||
assertTrue(futures[i].isDone());
|
||||
}
|
||||
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
public void testShutdownMustDisableSubmit() throws ExecutionException, InterruptedException {
|
||||
@@ -380,7 +380,7 @@ public class BoundedTaskExecutorTest extends TestCase {
|
||||
|
||||
String logs = log.toString();
|
||||
assertEquals(StringUtil.repeat(" ",N), logs);
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
|
||||
public void testNoExtraThreadsAreEverCreated() throws ExecutionException, InterruptedException {
|
||||
@@ -434,7 +434,7 @@ public class BoundedTaskExecutorTest extends TestCase {
|
||||
assertTrue("Must create no more than "+nMaxThreads+" workers but got: "+workers,
|
||||
workers.size() <= nMaxThreads);
|
||||
executor.shutdownNow();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -465,7 +465,7 @@ public class BoundedTaskExecutorTest extends TestCase {
|
||||
});
|
||||
}
|
||||
executor.shutdown();
|
||||
assertTrue(executor.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertTrue(executor.awaitTermination(100, TimeUnit.SECONDS));
|
||||
|
||||
for (Future future : futures) {
|
||||
assertTrue(future.isDone());
|
||||
@@ -482,7 +482,7 @@ public class BoundedTaskExecutorTest extends TestCase {
|
||||
assertFalse(executor2.awaitTermination(1, TimeUnit.SECONDS));
|
||||
assertFalse(future.isDone());
|
||||
assertFalse(future.isCancelled());
|
||||
assertTrue(executor2.awaitTermination(10, TimeUnit.SECONDS));
|
||||
assertTrue(executor2.awaitTermination(100, TimeUnit.SECONDS));
|
||||
assertTrue(future.isDone());
|
||||
assertFalse(future.isCancelled());
|
||||
}
|
||||
|
||||
@@ -318,7 +318,7 @@ find.search.in.project.files=true
|
||||
structureView.coalesceTime=500
|
||||
|
||||
keymap.show.alias.actions=false
|
||||
keymap.windows.as.meta=true
|
||||
keymap.windows.as.meta=false
|
||||
frameworks.download.libraries.server.url=http://pluginsrepo-test:8080
|
||||
caches.indexerThreadsCount=-1
|
||||
navBar.updateMergeTime=100
|
||||
|
||||
@@ -449,7 +449,6 @@ public class PatchApplier<BinaryType extends FilePatch> {
|
||||
for (FilePath filePath : directlyAffected) {
|
||||
lfs.refreshAndFindFileByIoFile(filePath.getIOFile());
|
||||
}
|
||||
lfs.refreshFiles(indirectlyAffected, false, true, null);
|
||||
if (project.isDisposed()) return;
|
||||
|
||||
final ChangeListManager changeListManager = ChangeListManager.getInstance(project);
|
||||
|
||||
@@ -104,15 +104,8 @@ public class MainFrame extends JPanel implements DataProvider, Disposable {
|
||||
myDetailsSplitter.setFirstComponent(setupScrolledGraph());
|
||||
setupDetailsSplitter(uiProperties.isShowDetails());
|
||||
|
||||
JComponent toolbars = new JPanel(new BorderLayout());
|
||||
toolbars.add(myToolbar, BorderLayout.NORTH);
|
||||
toolbars.add(myBranchesPanel.getMainComponent(), BorderLayout.CENTER);
|
||||
JComponent toolbarsAndTable = new JPanel(new BorderLayout());
|
||||
toolbarsAndTable.add(toolbars, BorderLayout.NORTH);
|
||||
toolbarsAndTable.add(myDetailsSplitter, BorderLayout.CENTER);
|
||||
|
||||
ProgressStripe progressStripe =
|
||||
new ProgressStripe(toolbarsAndTable, toolbars, this, ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS) {
|
||||
new ProgressStripe(myDetailsSplitter, this, ProgressWindow.DEFAULT_PROGRESS_DIALOG_POSTPONE_TIME_MILLIS) {
|
||||
@Override
|
||||
public void updateUI() {
|
||||
super.updateUI();
|
||||
@@ -131,8 +124,16 @@ public class MainFrame extends JPanel implements DataProvider, Disposable {
|
||||
}
|
||||
}, this);
|
||||
|
||||
|
||||
JComponent toolbars = new JPanel(new BorderLayout());
|
||||
toolbars.add(myToolbar, BorderLayout.NORTH);
|
||||
toolbars.add(myBranchesPanel.getMainComponent(), BorderLayout.CENTER);
|
||||
JComponent toolbarsAndTable = new JPanel(new BorderLayout());
|
||||
toolbarsAndTable.add(toolbars, BorderLayout.NORTH);
|
||||
toolbarsAndTable.add(progressStripe, BorderLayout.CENTER);
|
||||
|
||||
myChangesBrowserSplitter = new OnePixelSplitter(false, "vcs.log.changes.splitter.proportion", 0.7f);
|
||||
myChangesBrowserSplitter.setFirstComponent(progressStripe);
|
||||
myChangesBrowserSplitter.setFirstComponent(toolbarsAndTable);
|
||||
myChangesBrowserSplitter.setSecondComponent(myChangesLoadingPane);
|
||||
|
||||
setLayout(new BorderLayout());
|
||||
|
||||
@@ -35,7 +35,7 @@ public class ProgressStripe extends JBPanel {
|
||||
private final NotNullComputable<MyLoadingDecorator> myCreateLoadingDecorator;
|
||||
protected MyLoadingDecorator myDecorator;
|
||||
|
||||
public ProgressStripe(@NotNull JComponent targetComponent, @NotNull JComponent toolbar, @NotNull Disposable parent, int startDelayMs) {
|
||||
public ProgressStripe(@NotNull JComponent targetComponent, @NotNull Disposable parent, int startDelayMs) {
|
||||
super(new BorderLayout());
|
||||
myPanel = new JBPanel(new BorderLayout());
|
||||
myPanel.setOpaque(false);
|
||||
@@ -44,7 +44,7 @@ public class ProgressStripe extends JBPanel {
|
||||
myCreateLoadingDecorator = () -> {
|
||||
Disposable disposable = Disposer.newDisposable();
|
||||
Disposer.register(parent, disposable);
|
||||
return new MyLoadingDecorator(targetComponent, toolbar, myPanel, disposable, startDelayMs);
|
||||
return new MyLoadingDecorator(targetComponent, myPanel, disposable, startDelayMs);
|
||||
};
|
||||
createLoadingDecorator();
|
||||
}
|
||||
@@ -82,36 +82,13 @@ public class ProgressStripe extends JBPanel {
|
||||
private static class MyLoadingDecorator extends LoadingDecorator {
|
||||
@NotNull
|
||||
private final Disposable myDisposable;
|
||||
@NotNull
|
||||
private final JComponent myToolbar;
|
||||
@NotNull
|
||||
private final ComponentAdapter myListener;
|
||||
private Box.Filler myFiller;
|
||||
|
||||
public MyLoadingDecorator(@NotNull JComponent component,
|
||||
@NotNull JComponent toolbar,
|
||||
@NotNull JPanel contentPanel,
|
||||
@NotNull Disposable disposable,
|
||||
int startDelayMs) {
|
||||
super(contentPanel, disposable, startDelayMs, false, ProgressStripeIcon.generateIcon(component));
|
||||
myDisposable = disposable;
|
||||
myToolbar = toolbar;
|
||||
myListener = new ComponentAdapter() {
|
||||
@Override
|
||||
public void componentResized(ComponentEvent e) {
|
||||
super.componentResized(e);
|
||||
adjustFiller();
|
||||
}
|
||||
};
|
||||
myToolbar.addComponentListener(myListener);
|
||||
adjustFiller();
|
||||
}
|
||||
|
||||
private void adjustFiller() {
|
||||
if (myFiller != null && myToolbar.getHeight() != 0) {
|
||||
Dimension dimension = new Dimension(0, myToolbar.getHeight() - ProgressStripeIcon.getHeight() / 2);
|
||||
myFiller.changeShape(dimension, dimension, dimension);
|
||||
}
|
||||
}
|
||||
|
||||
public void startLoadingImmediately() {
|
||||
@@ -124,8 +101,6 @@ public class ProgressStripe extends JBPanel {
|
||||
|
||||
NonOpaquePanel result = new NonOpaquePanel();
|
||||
result.setLayout(new BoxLayout(result, BoxLayout.Y_AXIS));
|
||||
myFiller = new Box.Filler(new Dimension(), new Dimension(), new Dimension());
|
||||
result.add(myFiller);
|
||||
result.add(icon);
|
||||
|
||||
parent.add(result, BorderLayout.NORTH);
|
||||
@@ -134,7 +109,6 @@ public class ProgressStripe extends JBPanel {
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
myToolbar.removeComponentListener(myListener);
|
||||
Disposer.dispose(myDisposable);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.vcs.log.ui.frame;
|
||||
|
||||
import com.intellij.ide.ui.laf.IntelliJLaf;
|
||||
import com.intellij.openapi.ui.GraphicsConfig;
|
||||
import com.intellij.ui.ColorUtil;
|
||||
import com.intellij.ui.Gray;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
@@ -79,8 +80,8 @@ public abstract class ProgressStripeIcon implements Icon {
|
||||
}
|
||||
|
||||
private static class StripeIcon extends ProgressStripeIcon {
|
||||
private static final JBColor BG_COLOR = new JBColor(Gray._165, Gray._88);
|
||||
private static final JBColor FG_COLOR = new JBColor(Gray._255, Gray._128);
|
||||
private static final double ALPHA = 0.8;
|
||||
private static final JBColor BG_COLOR = new JBColor(ColorUtil.withAlpha(Gray._165, ALPHA), ColorUtil.withAlpha(Gray._88, ALPHA));
|
||||
private static final int WIDTH = 16;
|
||||
|
||||
private StripeIcon(@NotNull JComponent component, int shift) {
|
||||
@@ -95,9 +96,6 @@ public abstract class ProgressStripeIcon implements Icon {
|
||||
@Override
|
||||
protected void paint(@NotNull Graphics2D g2, int x, int y, int shift) {
|
||||
g2.setColor(BG_COLOR);
|
||||
g2.fillRect(x + shift, y, JBUI.scale(WIDTH), JBUI.scale(HEIGHT));
|
||||
|
||||
g2.setColor(FG_COLOR);
|
||||
|
||||
Path2D.Double path = new Path2D.Double();
|
||||
int height = JBUI.scale(HEIGHT);
|
||||
@@ -118,11 +116,13 @@ public abstract class ProgressStripeIcon implements Icon {
|
||||
// this icon is not used under darcula
|
||||
@SuppressWarnings("UseJBColor")
|
||||
private static class GradientIcon extends ProgressStripeIcon {
|
||||
private static final double ALPHA = 0.5;
|
||||
private static final Color DARK_BLUE = new Color(0x4d9ff8);
|
||||
private static final Color DARK_GRAY = Gray._165;
|
||||
private static final Color LIGHT_BLUE = new Color(0x90c2f8);
|
||||
private static final Color LIGHT_GRAY = new Color(0xdbdbdb);
|
||||
private static final Color LIGHT_BLUE = ColorUtil.withAlpha(DARK_BLUE, ALPHA);
|
||||
private static final Color LIGHT_GRAY = ColorUtil.withAlpha(DARK_GRAY, ALPHA);
|
||||
private static final int GRADIENT = 128;
|
||||
private static final int GRADIENT_HEIGHT = 2;
|
||||
|
||||
private GradientIcon(@NotNull JComponent component, int shift) {
|
||||
super(component, shift);
|
||||
@@ -148,6 +148,11 @@ public abstract class ProgressStripeIcon implements Icon {
|
||||
g2.setPaint(new GradientPaint(x + shift + JBUI.scale(GRADIENT), y, light, x + shift + 2 * JBUI.scale(GRADIENT), y, dark));
|
||||
g2.fill(new Rectangle(x + shift + JBUI.scale(GRADIENT), y, JBUI.scale(GRADIENT), getIconHeight()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconHeight() {
|
||||
return JBUI.scale(GRADIENT_HEIGHT);
|
||||
}
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+16
-5
@@ -165,7 +165,15 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid
|
||||
|
||||
@Override
|
||||
public boolean willHandle(@NotNull CommonActionsPanel.Buttons type, Project project, @NotNull Set<Object> selectedObjects) {
|
||||
return (selectedObjects.size() == 1 && (type == CommonActionsPanel.Buttons.EDIT || type == CommonActionsPanel.Buttons.REMOVE)) &&
|
||||
if (selectedObjects.size() >= 1 && type == CommonActionsPanel.Buttons.REMOVE) {
|
||||
for (Object selectedObject : selectedObjects) {
|
||||
if (!(((AbstractTreeNode)selectedObject).getValue() instanceof BreakpointItem)) {
|
||||
return false; // Not all selected items are breakpoints
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
return selectedObjects.size() == 1 && type == CommonActionsPanel.Buttons.EDIT &&
|
||||
((AbstractTreeNode)selectedObjects.iterator().next()).getValue() instanceof BreakpointItem;
|
||||
}
|
||||
|
||||
@@ -179,15 +187,18 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid
|
||||
bounds = tree.getVisibleRect().intersection(bounds);
|
||||
}
|
||||
Point whereToShow = new Point((int)bounds.getCenterX(), (int)bounds.getCenterY());
|
||||
BreakpointItem breakpointItem = (BreakpointItem)((AbstractTreeNode)selectedObjects.iterator().next()).getValue();
|
||||
switch (type) {
|
||||
case EDIT:
|
||||
BreakpointItem breakpointItem = (BreakpointItem)((AbstractTreeNode)selectedObjects.iterator().next()).getValue();
|
||||
DebuggerSupport debuggerSupport = XBreakpointUtil.getDebuggerSupport(myProject, breakpointItem);
|
||||
if (debuggerSupport == null) return;
|
||||
if (debuggerSupport == null || breakpointItem == null) return;
|
||||
debuggerSupport.getEditBreakpointAction().editBreakpoint(myProject, component, whereToShow, breakpointItem);
|
||||
break;
|
||||
case REMOVE:
|
||||
breakpointItem.removed(myProject);
|
||||
for (Object selectedObject : selectedObjects) {
|
||||
BreakpointItem removeBreakpointItem = (BreakpointItem)((AbstractTreeNode)selectedObject).getValue();
|
||||
removeBreakpointItem.removed(myProject);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
}
|
||||
@@ -224,4 +235,4 @@ public class BreakpointsFavoriteListProvider extends AbstractFavoritesListProvid
|
||||
renderer.append(String.valueOf(value));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
package org.groovy.debug.hotswap;
|
||||
|
||||
import org.objectweb.asm.*;
|
||||
import com.tonicsystems.jarjar.asm.*;
|
||||
|
||||
import java.lang.String;
|
||||
import java.lang.instrument.ClassFileTransformer;
|
||||
|
||||
@@ -4,9 +4,10 @@
|
||||
<property name="build.lib.path" value="${idea.home}/build/lib"/>
|
||||
<property name="idea.lib.path" value="${idea.home}/lib"/>
|
||||
<property name="output.jar.path" value="${module.home}/gragent.jar"/>
|
||||
<property name="jarjar.path" value="${build.lib.path}/jarjar-1.0.jar"/>
|
||||
<property environment="env"/>
|
||||
|
||||
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${build.lib.path}/jarjar-1.0.jar"/>
|
||||
<taskdef name="jarjar" classname="com.tonicsystems.jarjar.JarJarTask" classpath="${jarjar.path}"/>
|
||||
|
||||
<target name="gragent">
|
||||
<delete dir="anttask.classes" failonerror="false"/>
|
||||
@@ -27,16 +28,14 @@
|
||||
<fileset dir="${build.lib.path}">
|
||||
<include name="*.jar"/>
|
||||
</fileset>
|
||||
<fileset dir="${idea.lib.path}">
|
||||
<include name="asm*.jar"/>
|
||||
</fileset>
|
||||
<file name="${jarjar.path}"/>
|
||||
</classpath>
|
||||
</javac>
|
||||
|
||||
<jarjar jarfile="${output.jar.path}" manifest="${module.home}/agentSrc/META-INF/MANIFEST.MF">
|
||||
<fileset dir="anttask.classes"/>
|
||||
<zipfileset src="${idea.lib.path}/asm.jar"/>
|
||||
<rule pattern="org.objectweb.**" result="groovyResetJarjarAsm.@1"/>
|
||||
<zipfileset src="${jarjar.path}" includes="com/tonicsystems/jarjar/asm/*"/>
|
||||
<rule pattern="com.tonicsystems.jarjar.asm.**" result="groovyResetJarjarAsm.@1"/>
|
||||
</jarjar>
|
||||
|
||||
<delete dir="anttask.classes" failonerror="false"/>
|
||||
|
||||
Binary file not shown.
+22
-7
@@ -24,6 +24,7 @@ import com.intellij.patterns.StandardPatterns;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiRecursiveElementWalkingVisitor;
|
||||
import com.intellij.util.ProcessingContext;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import icons.JetgroovyIcons;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -51,6 +52,8 @@ import java.util.Map;
|
||||
*/
|
||||
class MapArgumentCompletionProvider extends CompletionProvider<CompletionParameters> {
|
||||
|
||||
// @formatter:off
|
||||
|
||||
// [<caret>]
|
||||
// [<some values, initializers or named arguments>, <caret>]
|
||||
// foo <caret>
|
||||
@@ -64,6 +67,8 @@ class MapArgumentCompletionProvider extends CompletionProvider<CompletionParamet
|
||||
// [<some values>, <caret> : ]
|
||||
public static final ElementPattern<PsiElement> IN_LABEL = PlatformPatterns.psiElement(GroovyTokenTypes.mIDENT).withParent(GrArgumentLabel.class);
|
||||
|
||||
// @formatter:on
|
||||
|
||||
private MapArgumentCompletionProvider() {
|
||||
}
|
||||
|
||||
@@ -87,10 +92,7 @@ class MapArgumentCompletionProvider extends CompletionProvider<CompletionParamet
|
||||
result.stopHere();
|
||||
}
|
||||
|
||||
Map<String, NamedArgumentDescriptor> map = calcNamedArgumentsForCall(mapOrArgumentList);
|
||||
if (map == null || map.isEmpty()) {
|
||||
map = findOtherNamedArgumentsInFile(mapOrArgumentList);
|
||||
}
|
||||
final Map<String, NamedArgumentDescriptor> map = ContainerUtil.newHashMap(calculateNamedArguments(mapOrArgumentList));
|
||||
|
||||
for (GrNamedArgument argument : getSiblingNamedArguments(mapOrArgumentList)) {
|
||||
map.remove(argument.getLabelName());
|
||||
@@ -131,6 +133,7 @@ class MapArgumentCompletionProvider extends CompletionProvider<CompletionParamet
|
||||
return parent.getParent().getParent();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Map<String, NamedArgumentDescriptor> findOtherNamedArgumentsInFile(PsiElement mapOrArgumentList) {
|
||||
final Map<String, NamedArgumentDescriptor> map = new HashMap<String, NamedArgumentDescriptor>();
|
||||
mapOrArgumentList.getContainingFile().accept(new PsiRecursiveElementWalkingVisitor() {
|
||||
@@ -163,6 +166,21 @@ class MapArgumentCompletionProvider extends CompletionProvider<CompletionParamet
|
||||
return GrNamedArgument.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static Map<String, NamedArgumentDescriptor> calculateNamedArguments(@NotNull PsiElement mapOrArgumentList) {
|
||||
Map<String, NamedArgumentDescriptor> map = calcNamedArgumentsForCall(mapOrArgumentList);
|
||||
|
||||
if ((map == null || map.isEmpty()) && mapOrArgumentList instanceof GrListOrMap) {
|
||||
map = NamedArgumentUtilKt.getDescriptors((GrListOrMap)mapOrArgumentList);
|
||||
}
|
||||
|
||||
if (map == null || map.isEmpty()) {
|
||||
map = findOtherNamedArgumentsInFile(mapOrArgumentList);
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Map<String, NamedArgumentDescriptor> calcNamedArgumentsForCall(@NotNull PsiElement mapOrArgumentList) {
|
||||
PsiElement argumentList = mapOrArgumentList instanceof GrArgumentList ? mapOrArgumentList : mapOrArgumentList.getParent();
|
||||
@@ -178,9 +196,6 @@ class MapArgumentCompletionProvider extends CompletionProvider<CompletionParamet
|
||||
return GroovyNamedArgumentProvider.getNamedArgumentsFromAllProviders((GrCall)argumentList.getParent(), null, true);
|
||||
}
|
||||
}
|
||||
else if (mapOrArgumentList instanceof GrListOrMap) {
|
||||
return NamedArgumentUtilKt.getDescriptors((GrListOrMap)mapOrArgumentList);
|
||||
}
|
||||
|
||||
return Collections.emptyMap();
|
||||
}
|
||||
|
||||
+45
-1
@@ -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.
|
||||
@@ -14,6 +14,7 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.plugins.groovy.lang
|
||||
|
||||
import com.intellij.codeInsight.lookup.LookupElement
|
||||
import com.intellij.openapi.module.Module
|
||||
import com.intellij.openapi.roots.ContentEntry
|
||||
@@ -23,15 +24,22 @@ import com.intellij.openapi.roots.libraries.Library
|
||||
import com.intellij.openapi.vfs.JarFileSystem
|
||||
import com.intellij.openapi.vfs.VirtualFile
|
||||
import com.intellij.testFramework.LightProjectDescriptor
|
||||
import com.intellij.testFramework.PlatformTestUtil
|
||||
import com.intellij.testFramework.fixtures.DefaultLightProjectDescriptor
|
||||
import com.intellij.testFramework.fixtures.LightCodeInsightFixtureTestCase
|
||||
import groovy.transform.CompileStatic
|
||||
import org.jetbrains.annotations.NotNull
|
||||
import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyAssignabilityCheckInspection
|
||||
import org.jetbrains.plugins.groovy.codeInspection.assignment.GroovyUncheckedAssignmentOfMemberOfRawTypeInspection
|
||||
import org.jetbrains.plugins.groovy.extensions.GroovyNamedArgumentProvider
|
||||
import org.jetbrains.plugins.groovy.extensions.NamedArgumentDescriptor
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.auxiliary.GrListOrMap
|
||||
import org.jetbrains.plugins.groovy.util.TestUtils
|
||||
|
||||
/**
|
||||
* @author Sergey Evdokimov
|
||||
*/
|
||||
@CompileStatic
|
||||
class GroovyMapAttributeTest extends LightCodeInsightFixtureTestCase {
|
||||
final LightProjectDescriptor projectDescriptor = new DefaultLightProjectDescriptor() {
|
||||
@Override
|
||||
@@ -451,4 +459,40 @@ class Test {
|
||||
""", true
|
||||
}
|
||||
|
||||
public void 'test completion within some map'() {
|
||||
doTestCompletionWithinMap '[<caret>]', '[bar: <caret>]'
|
||||
}
|
||||
|
||||
public void 'test completion within map in argument list'() {
|
||||
doTestCompletionWithinMap 'foo(1, 2, 3, [<caret>])', 'foo(1, 2, 3, [bar: <caret>])'
|
||||
}
|
||||
|
||||
private doTestCompletionWithinMap(String text, String text2 = null) {
|
||||
PlatformTestUtil.registerExtension GroovyNamedArgumentProvider.EP_NAME, new GroovyNamedArgumentProvider() {
|
||||
@Override
|
||||
Map<String, NamedArgumentDescriptor> getNamedArguments(@NotNull GrListOrMap literal) {
|
||||
['foo': NamedArgumentDescriptor.SIMPLE_NORMAL, 'bar': NamedArgumentDescriptor.SIMPLE_NORMAL]
|
||||
}
|
||||
}, testRootDisposable
|
||||
|
||||
myFixture.with {
|
||||
configureByText '_.groovy', text
|
||||
|
||||
completeBasic()
|
||||
lookupElementStrings.with {
|
||||
assert 'foo' in it
|
||||
assert 'bar' in it
|
||||
}
|
||||
|
||||
type 'ba\n'
|
||||
if (text2) checkResult text2
|
||||
|
||||
type ',' as char
|
||||
completeBasic()
|
||||
lookupElementStrings.with {
|
||||
assert 'foo' in it
|
||||
assert !('bar' in it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
<codeInsight.externalLibraryResolver implementation="com.intellij.execution.junit.codeInsight.JUnitExternalLibraryResolver"/>
|
||||
<junitListener implementation="com.intellij.junit4.JUnitTestDiscoveryListener"/>
|
||||
<runConfigurationProducer implementation="com.intellij.execution.junit.testDiscovery.JUnitTestDiscoveryConfigurationProducer"/>
|
||||
<implicitUsageProvider implementation="com.intellij.execution.junit2.inspection.JUnitImplicitUsageProvider"/>
|
||||
</extensions>
|
||||
|
||||
<extensionPoints>
|
||||
|
||||
@@ -104,10 +104,6 @@ public class JUnitEntryPoint extends EntryPoint {
|
||||
@Override
|
||||
public String[] getIgnoreAnnotations() {
|
||||
return new String[]{"org.junit.Rule",
|
||||
"org.mockito.Mock",
|
||||
"org.mockito.Spy",
|
||||
"org.mockito.Captor",
|
||||
"org.mockito.InjectMocks",
|
||||
"org.junit.ClassRule",
|
||||
"org.junit.experimental.theories.DataPoint"};
|
||||
}
|
||||
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* 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.execution.junit2.inspection;
|
||||
|
||||
import com.intellij.codeInsight.AnnotationUtil;
|
||||
import com.intellij.codeInsight.daemon.ImplicitUsageProvider;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiField;
|
||||
import com.intellij.psi.PsiParameter;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class JUnitImplicitUsageProvider implements ImplicitUsageProvider {
|
||||
private static final String MOCK = "org.mockito.Mock";
|
||||
private static final List<String> INJECTED_FIELD_ANNOTATIONS = Arrays.asList(
|
||||
MOCK,
|
||||
"org.mockito.Spy",
|
||||
"org.mockito.Captor",
|
||||
"org.mockito.InjectMocks");
|
||||
|
||||
|
||||
@Override
|
||||
public boolean isImplicitUsage(PsiElement element) {
|
||||
return isImplicitWrite(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImplicitRead(PsiElement element) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isImplicitWrite(PsiElement element) {
|
||||
if (element instanceof PsiParameter) {
|
||||
return AnnotationUtil.isAnnotated((PsiParameter)element, MOCK, false);
|
||||
}
|
||||
return element instanceof PsiField && AnnotationUtil.isAnnotated((PsiField) element, INJECTED_FIELD_ANNOTATIONS);
|
||||
}
|
||||
}
|
||||
@@ -1,116 +0,0 @@
|
||||
<project name="testng" default="dist">
|
||||
|
||||
<property file="build.properties"/>
|
||||
<property name="src.dir" value="src"/>
|
||||
<property name="test.dir" value="tests"/>
|
||||
<property name="lib.dir" value="lib"/>
|
||||
<property name="bin.dir" value="build"/>
|
||||
<property name="dst.dir" value="dist"/>
|
||||
|
||||
<property name="idea.home" value="/Users/amrk/Applications/Selena.app"/>
|
||||
<property name="idea.plugins.home" value="/Users/amrk/Applications/Selena.app/plugins"/>
|
||||
|
||||
<path id="compile.classpath">
|
||||
<fileset dir="${idea.home}/lib">
|
||||
<include name="openapi.jar"/>
|
||||
<include name="idea.jar"/>
|
||||
<include name="idea_rt.jar"/>
|
||||
<include name="jdom.jar"/>
|
||||
<include name="bcel.jar"/>
|
||||
<include name="junit.jar"/>
|
||||
<include name="log4j.jar"/>
|
||||
<include name="extensions.jar"/>
|
||||
<include name="picocontainer.jar"/>
|
||||
<include name="trove4j.jar"/>
|
||||
</fileset>
|
||||
<fileset dir="${idea.home}/redist">
|
||||
<include name="annotations.jar"/>
|
||||
<include name="forms_rt.jar"/>
|
||||
<include name="extensions.jar"/>
|
||||
<include name="javac2.jar"/>
|
||||
</fileset>
|
||||
<fileset dir="lib">
|
||||
<include name="testng-*.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
|
||||
<path id="uidesigner.classpath">
|
||||
<fileset dir="${idea.home}/lib">
|
||||
<include name="jdom.jar"/>
|
||||
<include name="bcel.jar"/>
|
||||
<include name="asm.jar"/>
|
||||
<include name="asm-commons.jar"/>
|
||||
<include name="jgoodies-forms.jar"/>
|
||||
</fileset>
|
||||
<fileset dir="${idea.home}/redist">
|
||||
<include name="annotations.jar"/>
|
||||
<include name="forms_rt.jar"/>
|
||||
<include name="extensions.jar"/>
|
||||
<include name="javac2.jar"/>
|
||||
</fileset>
|
||||
</path>
|
||||
|
||||
<taskdef name="javac2"
|
||||
classname="com.intellij.ant.Javac2"
|
||||
classpathref="uidesigner.classpath"/>
|
||||
|
||||
<target name="init">
|
||||
<mkdir dir="${bin.dir}/classes"/>
|
||||
<mkdir dir="${bin.dir}/classes.test"/>
|
||||
<mkdir dir="${bin.dir}/jars"/>
|
||||
<mkdir dir="${dst.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="clean">
|
||||
<delete dir="${bin.dir}"/>
|
||||
<delete dir="${dst.dir}"/>
|
||||
</target>
|
||||
|
||||
<target name="compile" depends="init">
|
||||
<javac2 srcdir="${src.dir}" destdir="${bin.dir}/classes" debug="true" classpathref="compile.classpath"
|
||||
deprecation="true" source="1.5" target="jsr14"/>
|
||||
<copy todir="${bin.dir}/classes">
|
||||
<fileset dir="${src.dir}">
|
||||
<include name="**/*.properties"/>
|
||||
</fileset>
|
||||
</copy>
|
||||
</target>
|
||||
|
||||
<target name="build" depends="clean, compile"/>
|
||||
|
||||
|
||||
<target name="dist" depends="build">
|
||||
|
||||
<jar jarfile="${bin.dir}/jars/${ant.project.name}.jar">
|
||||
<zipfileset dir="${bin.dir}/classes"/>
|
||||
<zipfileset dir="${src.dir}/resources" prefix="resources"/>
|
||||
<zipfileset dir="src/META-INF" prefix="META-INF">
|
||||
<include name="plugin.xml"/>
|
||||
</zipfileset>
|
||||
</jar>
|
||||
<jar jarfile="${bin.dir}/jars/resources_en.jar">
|
||||
<zipfileset dir="${src.dir}">
|
||||
<include name="**/*.html"/>
|
||||
</zipfileset>
|
||||
</jar>
|
||||
<zip destfile="${dst.dir}/${ant.project.name}.zip" compress="true">
|
||||
<zipfileset dir="${lib.dir}" prefix="${ant.project.name}/lib">
|
||||
<include name="testng-jdk15.jar"/>
|
||||
</zipfileset>
|
||||
<zipfileset dir="${bin.dir}/jars" prefix="${ant.project.name}/lib" includes="*.jar"/>
|
||||
<zipfileset dir="${lib.dir}" prefix="${ant.project.name}/lib-jdk14">
|
||||
<include name="testng-jdk14.jar"/>
|
||||
</zipfileset>
|
||||
<zipfileset dir="src/META-INF" prefix="${ant.project.name}/META-INF">
|
||||
<include name="plugin.xml"/>
|
||||
</zipfileset>
|
||||
</zip>
|
||||
|
||||
</target>
|
||||
|
||||
<target name="deploy" depends="dist">
|
||||
<unzip src="${dst.dir}/${ant.project.name}.zip" dest="${idea.plugins.home}"/>
|
||||
</target>
|
||||
|
||||
</project>
|
||||
@@ -1,5 +1,5 @@
|
||||
<component>
|
||||
<version major="2016" minor="2" eap="true"/>
|
||||
<version major="3" minor="0" eap="true"/>
|
||||
<company name="JetBrains s.r.o." url="https://www.jetbrains.com/?fromIDE"/>
|
||||
<build number="__BUILD_NUMBER__" date="__BUILD_DATE__"/>
|
||||
<logo url="/pycharm_edu_logo.png" textcolor="313131" progressColor="20d688" progressY="281" progressTailIcon="/community_progress_tail.png"/>
|
||||
|
||||
@@ -5,16 +5,81 @@ It supports any runner, but well-known runners (py.test and unittest) are switch
|
||||
better support
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
|
||||
from tox import config as tox_config, session as tox_session
|
||||
from tox.session import Reporter
|
||||
|
||||
from tcmessages import TeamcityServiceMessages
|
||||
from tox import exception
|
||||
|
||||
teamcity = TeamcityServiceMessages()
|
||||
|
||||
helpers_dir = str(os.path.split(__file__)[0])
|
||||
|
||||
|
||||
class _MySession(tox_session.Session):
|
||||
"""
|
||||
Session is extended to overwrite "setupenv" as "env begin" ans "_summary" as "end of all"
|
||||
Hooks API is not enough to cover each case, reporter is not enough as well
|
||||
Session inheritance is the only way to go, even it is not stable and should be checked
|
||||
against each version
|
||||
"""
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
tox_session.Session.__init__(self, *args, **kwargs)
|
||||
self.current_env = None
|
||||
|
||||
def setupenv(self, venv):
|
||||
"""
|
||||
Launched before each setup.
|
||||
It means prev env (if any) just finished and new is going to be created
|
||||
:param venv: current virtual env
|
||||
"""
|
||||
self._finish_current_env_if_need()
|
||||
self.current_env = venv
|
||||
teamcity.testSuiteStarted(venv.name, location="tox_env://" + str(venv.name))
|
||||
return tox_session.Session.setupenv(self, venv)
|
||||
|
||||
def _finish_current_env_if_need(self):
|
||||
"""
|
||||
Finishes currently running env. reporting its state
|
||||
"""
|
||||
if not self.current_env:
|
||||
return
|
||||
|
||||
status = self.current_env.status
|
||||
if isinstance(status, exception.InterpreterNotFound):
|
||||
if self.config.option.skip_missing_interpreters:
|
||||
self._reportSuiteStateLeaf("SKIP", status)
|
||||
else:
|
||||
self._reportSuiteStateLeaf("ERROR", status)
|
||||
elif status == "platform mismatch":
|
||||
self._reportSuiteStateLeaf("SKIP", status)
|
||||
elif status and status == "ignored failed command":
|
||||
print(" %s: %s" % (self.current_env.name, str(status)))
|
||||
elif status and status != "skipped tests":
|
||||
self._reportSuiteStateLeaf("ERROR", status)
|
||||
teamcity.testStdOut(self.current_env.name, "\n")
|
||||
teamcity.testSuiteFinished(self.current_env.name)
|
||||
self.current_env = None
|
||||
|
||||
def _reportSuiteStateLeaf(self, state, message):
|
||||
"""
|
||||
Since platform does not support empty suite, we need to output something.
|
||||
:param state: SKIP or ERROR (suite result)
|
||||
"""
|
||||
teamcity.testStarted(state, "tox_env://" + str(self.current_env.name))
|
||||
if state == "SKIP":
|
||||
teamcity.testIgnored(state, str(message))
|
||||
else:
|
||||
teamcity.testFailed(state, str(message))
|
||||
|
||||
def _summary(self):
|
||||
"""
|
||||
To be called after whole suite.
|
||||
"""
|
||||
self._finish_current_env_if_need()
|
||||
|
||||
|
||||
class _Unit2(object):
|
||||
def fix(self, command, dir_to_run, bin):
|
||||
if command[0] == "unit2":
|
||||
@@ -39,45 +104,8 @@ class _Nose(object):
|
||||
return [bin, os.path.join(helpers_dir, "noserunner.py"), dir_to_run] + command[1:]
|
||||
|
||||
|
||||
|
||||
_RUNNERS = [_Unit2(), _PyTest(), _Nose()]
|
||||
|
||||
teamcity = TeamcityServiceMessages()
|
||||
|
||||
|
||||
class _Reporter(Reporter):
|
||||
def logaction_start(self, action):
|
||||
super(_Reporter, self).logaction_start(action)
|
||||
if action.activity == "getenv":
|
||||
teamcity.output.write("\n")
|
||||
teamcity.testSuiteStarted(action.id, location="tox_env://" + str(action.id))
|
||||
self.current_suite = action.id
|
||||
|
||||
def logaction_finish(self, action):
|
||||
super(_Reporter, self).logaction_finish(action)
|
||||
if action.activity == "runtests":
|
||||
teamcity.testSuiteFinished(action.id)
|
||||
teamcity.output.write("\n")
|
||||
|
||||
def error(self, msg):
|
||||
super(_Reporter, self).error(msg)
|
||||
name = teamcity.current_test_name()
|
||||
if name:
|
||||
if name != teamcity.topmost_suite:
|
||||
teamcity.testFailed(name, msg)
|
||||
else:
|
||||
teamcity.testFailed("ERROR", msg)
|
||||
teamcity.testSuiteFinished(name)
|
||||
else:
|
||||
sys.stderr.write(msg)
|
||||
|
||||
def skip(self, msg):
|
||||
super(_Reporter, self).skip(msg)
|
||||
name = teamcity.current_test_name()
|
||||
if name:
|
||||
teamcity.testFinished(name)
|
||||
|
||||
|
||||
config = tox_config.parseconfig()
|
||||
for env, tmp_config in config.envconfigs.items():
|
||||
if not tmp_config.setenv:
|
||||
@@ -90,11 +118,12 @@ for env, tmp_config in config.envconfigs.items():
|
||||
_env = config.envconfigs[env]
|
||||
dir_to_run = str(_env.changedir)
|
||||
for i, command in enumerate(commands):
|
||||
fixed_command = fixer.fix(command, dir_to_run, str(_env.envpython))
|
||||
if fixed_command:
|
||||
commands[i] = fixed_command
|
||||
if command:
|
||||
fixed_command = fixer.fix(command, dir_to_run, str(_env.envpython))
|
||||
if fixed_command:
|
||||
commands[i] = fixed_command
|
||||
tmp_config.commands = commands
|
||||
|
||||
session = tox_session.Session(config, Report=_Reporter)
|
||||
session = _MySession(config)
|
||||
teamcity.testMatrixEntered()
|
||||
session.runcommand()
|
||||
|
||||
@@ -187,9 +187,13 @@ if IS_PY3K:
|
||||
return list(d.items())
|
||||
|
||||
else:
|
||||
dict_keys = None
|
||||
try:
|
||||
dict_keys = dict.keys
|
||||
except:
|
||||
pass
|
||||
|
||||
if IS_JYTHON or not dict_keys:
|
||||
def dict_keys(d):
|
||||
return d.keys()
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ envs {
|
||||
conda "django17", "2.7", ["django==1.7"]
|
||||
textfile "django17/tags.txt", "django\nskeletons"
|
||||
|
||||
conda "python34", "3.4", ["ipython==2.1", "django==1.6", "behave", "jinja2", "tox==2.0", "pandas"]
|
||||
conda "python34", "3.4", ["ipython==2.1", "django==1.6", "behave", "jinja2", "tox>=2.0", "pandas"]
|
||||
textfile "python34/tags.txt", "python3\nipython\nipython200\nskeletons\ndjango\nbehave\ntox\njinja2\npython34\npackaging\npandas"
|
||||
|
||||
if (!Os.isFamily(Os.FAMILY_WINDOWS)) {
|
||||
|
||||
@@ -107,12 +107,16 @@ public class PydevConsoleRunnerFactory extends PythonConsoleRunnerFactory {
|
||||
}
|
||||
|
||||
Map<String, String> envs = Maps.newHashMap(settingsProvider.getEnvs());
|
||||
String ipythonEnabled = PyConsoleOptions.getInstance(project).isIpythonEnabled() ? "True" : "False";
|
||||
envs.put(PythonEnvUtil.IPYTHONENABLE, ipythonEnabled);
|
||||
putIPythonEnvFlag(project, envs);
|
||||
|
||||
return createConsoleRunner(project, sdk, workingDir, envs, PyConsoleType.PYTHON, settingsProvider, setupFragment);
|
||||
}
|
||||
|
||||
public static void putIPythonEnvFlag(@NotNull Project project, Map<String, String> envs) {
|
||||
String ipythonEnabled = PyConsoleOptions.getInstance(project).isIpythonEnabled() ? "True" : "False";
|
||||
envs.put(PythonEnvUtil.IPYTHONENABLE, ipythonEnabled);
|
||||
}
|
||||
|
||||
protected PydevConsoleRunner createConsoleRunner(Project project,
|
||||
Sdk sdk,
|
||||
String workingDir,
|
||||
|
||||
@@ -38,6 +38,7 @@ import com.intellij.xdebugger.XDebugProcessStarter;
|
||||
import com.intellij.xdebugger.XDebugSession;
|
||||
import com.intellij.xdebugger.XDebuggerManager;
|
||||
import com.jetbrains.python.PythonHelper;
|
||||
import com.jetbrains.python.console.PydevConsoleRunnerFactory;
|
||||
import com.jetbrains.python.console.PythonConsoleView;
|
||||
import com.jetbrains.python.console.PythonDebugConsoleCommunication;
|
||||
import com.jetbrains.python.console.PythonDebugLanguageConsoleView;
|
||||
@@ -316,6 +317,8 @@ public class PyDebugRunner extends GenericProgramRunner {
|
||||
environment.put(PYDEVD_FILTER_LIBRARIES, "True");
|
||||
}
|
||||
|
||||
PydevConsoleRunnerFactory.putIPythonEnvFlag(project, environment);
|
||||
|
||||
addProjectRootsToEnv(project, environment);
|
||||
addSdkRootsToEnv(project, environment);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
[tox]
|
||||
skipsdist=True
|
||||
envlist = py26, py27, py34, py32
|
||||
skip_missing_interpreters = True
|
||||
[testenv:py27]
|
||||
commands=python --version
|
||||
whitelist_externals = python
|
||||
+27
@@ -112,6 +112,25 @@ public final class PyToxTest extends PyEnvTestCase {
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks empty envs for all but 2.7
|
||||
*/
|
||||
@Test
|
||||
public void textToxOneInterpreter() throws Exception {
|
||||
runPythonTest(new MyPyProcessWithConsoleTestTask("/toxtest/toxOneInterpreter/", 0,
|
||||
new MyTestProcessRunner(),
|
||||
Arrays.asList(
|
||||
Pair.create("py26", new InterpreterExpectations("", true)),
|
||||
Pair.create("py27", new InterpreterExpectations("ython 2.7", true)),
|
||||
Pair.create("py32", new InterpreterExpectations("", true)),
|
||||
Pair.create("py34", new InterpreterExpectations("", true))
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Big test which should run on any interpreter and check its output
|
||||
*/
|
||||
@@ -183,6 +202,7 @@ public final class PyToxTest extends PyEnvTestCase {
|
||||
// Interpreter failed to run
|
||||
final String testOutput = getTestOutput(interpreterSuite.getChildren().get(0));
|
||||
if (testOutput.contains("InterpreterNotFound")) {
|
||||
// Skipped with out of "skip_missing_interpreters = True"
|
||||
Logger.getInstance(PyToxTest.class).warn(String.format("Interpreter %s does not exit", interpreterName));
|
||||
skippedInterpreters.add(interpreterName); // Interpreter does not exit
|
||||
continue;
|
||||
@@ -195,6 +215,13 @@ public final class PyToxTest extends PyEnvTestCase {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (interpreterSuite.getChildren().size() == 1 && interpreterSuite.getChildren().get(0).getName().endsWith("SKIP")) {
|
||||
// The only reason it may be skipped is it does not exist and skip_missing_interpreters = True
|
||||
final String output = getTestOutput(interpreterSuite);
|
||||
Assert.assertThat("Test marked skipped but not because interpreter not found", output, Matchers.containsString("InterpreterNotFound"));
|
||||
}
|
||||
|
||||
|
||||
// Interpretr run success,
|
||||
//At least one interpreter tests should passed
|
||||
Assert.assertThat(String.format("No test passed, should %s at least", myMinimumSuccessTestCount),
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="dom-openapi" exported="" />
|
||||
<orderEntry type="library" name="asm" level="project" />
|
||||
<orderEntry type="library" exported="" name="CGLIB" level="project" />
|
||||
<orderEntry type="module" module-name="xml" />
|
||||
<orderEntry type="module" module-name="util" />
|
||||
|
||||
@@ -139,7 +139,7 @@ public class CodeStyleHtmlPanel extends CodeStyleAbstractPanel {
|
||||
}
|
||||
|
||||
private ArrayList<String> createCollectionOn(final String data) {
|
||||
if (data == null) {
|
||||
if (data == null || data.trim().isEmpty()) {
|
||||
return new ArrayList<String>();
|
||||
}
|
||||
return new ArrayList<String>(Arrays.asList(data.split(",")));
|
||||
|
||||
Reference in New Issue
Block a user