Merge remote-tracking branch 'origin/master'

This commit is contained in:
Konstantin Bulenkov
2014-03-21 16:04:44 +04:00
61 changed files with 1065 additions and 1115 deletions
+1 -1
View File
@@ -101,7 +101,7 @@ def layoutAll(Map args, String home, String out, Paths _paths = null, buildJps =
layouts.layout_core(home, paths.artifacts_core)
notifyArtifactBuilt(paths.artifacts_core)
if (buildJps) {
layouts.layoutCommunityJps(home, paths.artifacts_jps)
layouts.layoutJps(home, paths.artifacts_jps, args.buildNumber, {})
notifyArtifactBuilt(paths.artifacts_jps)
}
+68 -67
View File
@@ -703,75 +703,76 @@ def layoutAndroid(String androidHome) {
}
}
def layoutCommunityJps(String home, String target) {
layout(target) {
jar("util.jar") {
module("annotations")
module("util-rt")
module("util")
}
jar("jps-launcher.jar") {
module("jps-launcher")
}
jar("jps-model.jar") {
module("jps-model-api")
module("jps-model-impl")
module("jps-model-serialization")
}
jar("jps-builders.jar") {
module("forms_rt")
module("forms-compiler")
module("instrumentation-util")
module("jps-builders")
module("jps-plugin-system")
module("jps-standalone-builder")
module("java-runtime")
}
jar("groovy-jps-plugin.jar") {
module("groovy-jps-plugin")
module("groovy-rt-constants")
}
jar("groovy_rt.jar") {
module("groovy_rt")
}
jar("ui-designer-jps-plugin.jar") { module("ui-designer-jps-plugin") }
jar("maven-jps-plugin.jar") { module("maven-jps-plugin") }
fileset(dir: "$home/plugins/maven/maven3-server-impl/lib/maven3/lib") {include(name: "plexus-utils-*.jar")}
jar("eclipse-jps-plugin.jar") {
module("common-eclipse-util")
module("eclipse-jps-plugin")
}
jar("devkit-jps-plugin.jar") { module("devkit-jps-plugin") }
jar("intellilang-jps-plugin.jar") { module("intellilang-jps-plugin") }
fileset(dir: "$home/lib") {
include(name: "jdom.jar")
include(name: "jna.jar")
include(name: "trove4j.jar")
include(name: "asm4-all.jar")
include(name: "nanoxml-*.jar")
include(name: "protobuf-*.jar")
include(name: "cli-parser-*.jar")
include(name: "log4j.jar")
include(name: "jgoodies-forms.jar")
include(name: "ecj*.jar")
include(name: "jsr166e.jar")
}
fileset(dir: "$home/jps/lib") {
include(name: "optimizedFileManager.jar")
}
dir("test") {
jar("jps-build-test.jar") {
moduleTests("jps-builders")
moduleTests("jps-model-tests")
moduleTests("jps-serialization-tests")
def layoutJps(String home, String targetDir, String buildNumber, Closure additionalJars) {
layout(targetDir) {
zip("standalone-jps-${buildNumber}.zip") {
jar("util.jar") {
module("annotations")
module("util-rt")
module("util")
}
jar("jps-launcher.jar") {
module("jps-launcher")
}
jar("jps-model.jar") {
module("jps-model-api")
module("jps-model-impl")
module("jps-model-serialization")
}
jar("jps-builders.jar") {
module("forms_rt")
module("forms-compiler")
module("instrumentation-util")
module("jps-builders")
module("jps-plugin-system")
module("jps-standalone-builder")
module("java-runtime")
}
jar("groovy-jps-plugin.jar") {
module("groovy-jps-plugin")
module("groovy-rt-constants")
}
jar("groovy_rt.jar") {
module("groovy_rt")
}
jar("ui-designer-jps-plugin.jar") { module("ui-designer-jps-plugin") }
jar("maven-jps-plugin.jar") { module("maven-jps-plugin") }
fileset(dir: "$home/plugins/maven/maven3-server-impl/lib/maven3/lib") {include(name: "plexus-utils-*.jar")}
jar("eclipse-jps-plugin.jar") {
module("common-eclipse-util")
module("eclipse-jps-plugin")
}
jar("devkit-jps-plugin.jar") { module("devkit-jps-plugin") }
jar("intellilang-jps-plugin.jar") { module("intellilang-jps-plugin") }
fileset(dir: "$home/lib") {
include(name: "jdom.jar")
include(name: "jna.jar")
include(name: "trove4j.jar")
include(name: "asm4-all.jar")
include(name: "nanoxml-*.jar")
include(name: "protobuf-*.jar")
include(name: "cli-parser-*.jar")
include(name: "log4j.jar")
include(name: "jgoodies-forms.jar")
include(name: "ecj*.jar")
include(name: "jsr166e.jar")
}
fileset(dir: "$home/jps/lib") {
include(name: "optimizedFileManager.jar")
}
jar("ant-jps-plugin.jar") { module("ant-jps-plugin") }
additionalJars()
}
jar("jps-build-test-${buildNumber}.jar") {
moduleTests("jps-builders")
moduleTests("jps-model-tests")
moduleTests("jps-serialization-tests")
}
jar("ant-jps-plugin.jar") { module("ant-jps-plugin") }
}
}
@@ -17,6 +17,7 @@ package com.intellij.debugger.ui;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.DebuggerInvocationUtil;
import com.intellij.debugger.SourcePosition;
import com.intellij.debugger.actions.DebuggerActions;
import com.intellij.debugger.engine.DebugProcessImpl;
import com.intellij.debugger.engine.DebuggerManagerThreadImpl;
@@ -59,7 +60,9 @@ import com.intellij.ui.components.panels.Wrapper;
import com.intellij.util.Alarm;
import com.sun.jdi.ObjectCollectedException;
import com.sun.jdi.VMDisconnectedException;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.border.EmptyBorder;
@@ -76,7 +79,7 @@ import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicLong;
public class FramesPanel extends UpdatableDebuggerView {
public class FramesPanel extends UpdatableDebuggerView implements DataProvider {
private static final Icon FILTER_STACK_FRAMES_ICON = AllIcons.Debugger.Class_filter;
private final JComboBox myThreadsCombo;
@@ -147,6 +150,21 @@ public class FramesPanel extends UpdatableDebuggerView {
return myStateManager;
}
@Nullable
@Override
public Object getData(@NonNls String dataId) {
if (CommonDataKeys.PSI_FILE.is(dataId)) {
DebuggerContextImpl context = myStateManager.getContext();
if (context != null) {
SourcePosition position = context.getSourcePosition();
if (position != null) {
return position.getFile();
}
}
}
return null;
}
private class FramesListener implements ListSelectionListener {
boolean myIsEnabled = true;
@@ -358,8 +358,8 @@ public class GenericsHighlightUtil {
if (inheritedSubstitutor != null) {
final PsiTypeParameter[] typeParameters = superClass.getTypeParameters();
for (PsiTypeParameter typeParameter : typeParameters) {
PsiType type1 = GenericsUtil.eliminateWildcards(inheritedSubstitutor.substitute(typeParameter));
PsiType type2 = GenericsUtil.eliminateWildcards(superTypeSubstitutor.substitute(typeParameter));
PsiType type1 = inheritedSubstitutor.substitute(typeParameter);
PsiType type2 = superTypeSubstitutor.substitute(typeParameter);
if (!Comparing.equal(type1, type2)) {
String description = JavaErrorMessages.message("generics.cannot.be.inherited.with.different.type.arguments",
@@ -48,7 +48,6 @@ import com.intellij.refactoring.BaseRefactoringProcessor;
import com.intellij.refactoring.RefactoringBundle;
import com.intellij.refactoring.introduceParameter.Util;
import com.intellij.refactoring.listeners.RefactoringEventData;
import com.intellij.refactoring.listeners.RefactoringEventListener;
import com.intellij.refactoring.rename.NonCodeUsageInfoFactory;
import com.intellij.refactoring.rename.RenameJavaVariableProcessor;
import com.intellij.refactoring.util.*;
@@ -1265,7 +1264,7 @@ public class InlineMethodProcessor extends BaseRefactoringProcessor {
if (parentStatement != null) {
PsiElement parent = ref.getParent();
while (!parent.equals(parentStatement)) {
if (parent instanceof PsiStatement && !(parent instanceof PsiDeclarationStatement)) {
if (parent instanceof PsiExpressionStatement) {
String text = "{\n}";
PsiBlockStatement blockStatement = (PsiBlockStatement)myFactory.createStatementFromText(text, null);
blockStatement = (PsiBlockStatement)myCodeStyleManager.reformat(blockStatement);
@@ -33,7 +33,7 @@ import com.intellij.psi.stubs.StubElement;
import com.intellij.psi.stubs.StubInputStream;
import com.intellij.psi.stubs.StubOutputStream;
import com.intellij.psi.tree.IElementType;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.SmartList;
import com.intellij.util.io.StringRef;
import gnu.trove.TObjectIntHashMap;
import org.jetbrains.annotations.NotNull;
@@ -81,19 +81,19 @@ public class TypeInfo {
private static final int HAS_ARRAY_COUNT = 0x40;
private static final int HAS_ELLIPSIS = 0x80;
private static final TypeInfo NULL = new TypeInfo((StringRef)null, (byte)0, false, ContainerUtil.<PsiAnnotationStub>emptyList());
private static final TypeInfo NULL = new TypeInfo((StringRef)null, (byte)0, false, PsiAnnotationStub.EMPTY_ARRAY);
public final StringRef text;
public final byte arrayCount;
public final boolean isEllipsis;
private final List<PsiAnnotationStub> myAnnotationStubs;
private final PsiAnnotationStub[] myAnnotationStubs;
public TypeInfo(String text, byte arrayCount, boolean ellipsis, @NotNull List<PsiAnnotationStub> annotationStubs) {
public TypeInfo(String text, byte arrayCount, boolean ellipsis, @NotNull PsiAnnotationStub[] annotationStubs) {
this(StringRef.fromString(text == null ? null : internFrequentType(text)), arrayCount, ellipsis, annotationStubs);
}
private TypeInfo(StringRef text, byte arrayCount, boolean isEllipsis, @NotNull List<PsiAnnotationStub> annotationStubs) {
private TypeInfo(StringRef text, byte arrayCount, boolean isEllipsis, @NotNull PsiAnnotationStub[] annotationStubs) {
this.text = text;
this.arrayCount = arrayCount;
this.isEllipsis = isEllipsis;
@@ -105,15 +105,19 @@ public class TypeInfo {
PsiModifierListStub modifierList = (PsiModifierListStub)owner.findChildStubByType(JavaStubElementTypes.MODIFIER_LIST);
if (modifierList == null) return this;
List<PsiAnnotationStub> annotationStubs = ContainerUtil.newArrayList();
List<PsiAnnotationStub> annotationStubs = null;
for (StubElement child : modifierList.getChildrenStubs()) {
if (!(child instanceof PsiAnnotationStub)) continue;
PsiAnnotationStub annotationStub = (PsiAnnotationStub)child;
if (PsiImplUtil.isTypeAnnotation(annotationStub.getPsiElement())) {
if (annotationStubs == null) annotationStubs = new SmartList<PsiAnnotationStub>();
annotationStubs.add(annotationStub);
}
}
return new TypeInfo(text, arrayCount, isEllipsis, annotationStubs);
PsiAnnotationStub[] stubArray = PsiAnnotationStub.EMPTY_ARRAY;
if (annotationStubs != null) stubArray = annotationStubs.toArray(new PsiAnnotationStub[annotationStubs.size()]);
return new TypeInfo(text, arrayCount, isEllipsis, stubArray);
}
@NotNull
@@ -185,7 +189,7 @@ public class TypeInfo {
text = LightTreeUtil.toFilteredString(tree, typeElement, null);
}
return new TypeInfo(text, arrayCount, isEllipsis, ContainerUtil.<PsiAnnotationStub>emptyList());
return new TypeInfo(text, arrayCount, isEllipsis, PsiAnnotationStub.EMPTY_ARRAY);
}
@NotNull
@@ -198,7 +202,7 @@ public class TypeInfo {
typeText = typeText.substring(0, typeText.length() - 2);
}
return new TypeInfo(typeText, arrayCount, isEllipsis, ContainerUtil.<PsiAnnotationStub>emptyList());
return new TypeInfo(typeText, arrayCount, isEllipsis, PsiAnnotationStub.EMPTY_ARRAY);
}
@NotNull
@@ -225,7 +229,7 @@ public class TypeInfo {
StringRef text = frequentIndex == 0 ? record.readName() : StringRef.fromString(ourIndexFrequentType[frequentIndex]);
return new TypeInfo(text, arrayCount, hasEllipsis, ContainerUtil.<PsiAnnotationStub>emptyList());
return new TypeInfo(text, arrayCount, hasEllipsis, PsiAnnotationStub.EMPTY_ARRAY);
}
public static void writeTYPE(@NotNull StubOutputStream dataStream, @NotNull TypeInfo typeInfo) throws IOException {
@@ -254,7 +258,7 @@ public class TypeInfo {
if (typeInfo == NULL || typeInfo.text == null) {
return null;
}
if (typeInfo.arrayCount == 0 && typeInfo.myAnnotationStubs.isEmpty()) {
if (typeInfo.arrayCount == 0 && typeInfo.myAnnotationStubs.length == 0) {
return typeInfo.text.getString();
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -37,7 +37,6 @@ import java.lang.reflect.Array;
import java.text.CharacterIterator;
import java.text.StringCharacterIterator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.regex.Pattern;
@@ -387,7 +386,7 @@ public class StubBuildingVisitor<T> extends ClassVisitor {
if (dim > 0) {
type = type.getElementType();
}
return new TypeInfo(getTypeText(type), (byte)dim, false, Collections.<PsiAnnotationStub>emptyList()); //todo read annos from .class file
return new TypeInfo(getTypeText(type), (byte)dim, false, PsiAnnotationStub.EMPTY_ARRAY); //todo read annos from .class file
}
private static final String[] parameterNames = {"p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "p9"};
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -22,6 +22,8 @@ import com.intellij.psi.stubs.StubElement;
* @author max
*/
public interface PsiAnnotationStub extends StubElement<PsiAnnotation> {
PsiAnnotationStub[] EMPTY_ARRAY = new PsiAnnotationStub[0];
String getText();
PsiAnnotation getPsiElement();
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,22 +33,24 @@ import com.intellij.util.ReflectionUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import sun.reflect.ConstructorAccessor;
import java.lang.reflect.Constructor;
public interface JavaDocElementType {
class JavaDocCompositeElementType extends IJavaDocElementType implements ICompositeElementType {
private final Constructor<? extends ASTNode> myConstructor;
private final ConstructorAccessor myConstructor;
private JavaDocCompositeElementType(@NonNls final String debugName, final Class<? extends ASTNode> nodeClass) {
super(debugName);
myConstructor = ReflectionUtil.getDefaultConstructor(nodeClass);
Constructor<? extends ASTNode> constructor = ReflectionUtil.getDefaultConstructor(nodeClass);
myConstructor = ReflectionUtil.getConstructorAccessor(constructor);
}
@NotNull
@Override
public ASTNode createCompositeNode() {
return ReflectionUtil.createInstance(myConstructor);
return ReflectionUtil.createInstanceViaConstructorAccessor(myConstructor);
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,12 +35,13 @@ import com.intellij.util.diff.FlyweightCapableTreeStructure;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import sun.reflect.ConstructorAccessor;
import java.lang.reflect.Constructor;
public interface JavaElementType {
class JavaCompositeElementType extends IJavaElementType implements ICompositeElementType {
private final Constructor<? extends ASTNode> myConstructor;
private final ConstructorAccessor myConstructor;
private JavaCompositeElementType(@NonNls final String debugName, final Class<? extends ASTNode> nodeClass) {
this(debugName, nodeClass, false);
@@ -48,13 +49,14 @@ public interface JavaElementType {
private JavaCompositeElementType(@NonNls final String debugName, final Class<? extends ASTNode> nodeClass, final boolean leftBound) {
super(debugName, leftBound);
myConstructor = ReflectionUtil.getDefaultConstructor(nodeClass);
Constructor<? extends ASTNode> constructor = ReflectionUtil.getDefaultConstructor(nodeClass);
myConstructor = ReflectionUtil.getConstructorAccessor(constructor);
}
@NotNull
@Override
public ASTNode createCompositeNode() {
return ReflectionUtil.createInstance(myConstructor);
return ReflectionUtil.createInstanceViaConstructorAccessor(myConstructor);
}
}
@@ -7,7 +7,7 @@ interface A<T>
interface B<T> extends A<T[]> { }
class C<T extends A<Object[]> & B<?>>
class C<T extends A<Object[]> & B<Object>>
{
void foo(T x)
{
@@ -18,7 +18,7 @@ interface IA2<T> {}
interface IB2<T> extends IA2<T[]> {}
class A2 {
<T extends IA2<Object[]> & IB2<?>> void foo(){}
<T extends IA2<Object[]> & IB2<Object>> void foo(){}
}
@@ -0,0 +1,10 @@
import java.util.List;
interface Base<T> {
}
interface Middle<T> extends Base<List<? super T>> {
}
<error descr="'Base' cannot be inherited with different type arguments: 'java.util.List<? super T>' and 'java.util.List<T>'">interface Child<T> extends Middle<T>, Base<List<T>></error> {
}
@@ -18,7 +18,7 @@ interface IA2<T> {}
interface IB2<T> extends IA2<T[]> {}
class A2 {
<T extends IA2<Object[]> & IB2<?>> void foo(){}
<<error descr="'IA2' cannot be inherited with different type arguments: 'java.lang.Object[]' and 'capture<?>[]'"></error>T extends IA2<Object[]> & IB2<?>> void foo(){}
}
@@ -0,0 +1,26 @@
import java.util.ArrayList;
import java.util.List;
class Test {
List<String> foo(String[] strs)
{
final List<String> result = new ArrayList<String>();
int start = -1;
for (int i = 0; i < strs.length; i++)
{
if (idx(i) == 42 && start == -1)
{
start = i;
} else if (idx(i) != 24 && start != -1)
{
result.add("".substring(id<caret>x(start)));
}
}
return result;
}
private static int idx(int i) {
return i;
}
}
@@ -0,0 +1,22 @@
import java.util.ArrayList;
import java.util.List;
class Test {
List<String> foo(String[] strs)
{
final List<String> result = new ArrayList<String>();
int start = -1;
for (int i = 0; i < strs.length; i++)
{
if (i == 42 && start == -1)
{
start = i;
} else if (i != 24 && start != -1)
{
result.add("".substring(start));
}
}
return result;
}
}
@@ -238,6 +238,7 @@ public class GenericsHighlightingTest extends LightDaemonAnalyzerTestCase {
public void testIDEA106964() throws Exception { doTest5(false);}
public void testIDEA107782() throws Exception { doTest5(false);}
public void testInheritedWithDifferentArgsInTypeParams() throws Exception { doTest5(false);}
public void testInheritedWithDifferentArgsInTypeParams1() throws Exception { doTest5(false);}
public void testIllegalForwardReferenceInTypeParameterDefinition() throws Exception { doTest5(false);}
public void testIDEA57877() throws Exception { doTest5(false);}
@@ -260,6 +260,10 @@ public class InlineMethodTest extends LightRefactoringTestCase {
doTest(true);
}
public void testMethodInsideChangeIfStatement() throws Exception {
doTest();
}
private void doTestInlineThisOnly() {
@NonNls String fileName = "/refactoring/inlineMethod/" + getTestName(false) + ".java";
configureByFile(fileName);
@@ -16,7 +16,6 @@
package com.intellij.application.options.codeStyle.arrangement.match;
import com.intellij.application.options.codeStyle.arrangement.ArrangementConstants;
import com.intellij.psi.codeStyle.arrangement.std.ArrangementStandardSettingsManager;
import com.intellij.application.options.codeStyle.arrangement.color.ArrangementColorsProvider;
import com.intellij.application.options.codeStyle.arrangement.ui.ArrangementEditorAware;
import com.intellij.application.options.codeStyle.arrangement.ui.ArrangementRepresentationAware;
@@ -28,8 +27,10 @@ import com.intellij.openapi.diagnostic.Logger;
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementEntryMatcher;
import com.intellij.psi.codeStyle.arrangement.match.StdArrangementMatchRule;
import com.intellij.psi.codeStyle.arrangement.model.ArrangementAtomMatchCondition;
import com.intellij.psi.codeStyle.arrangement.std.ArrangementStandardSettingsManager;
import com.intellij.psi.codeStyle.arrangement.std.ArrangementUiComponent;
import com.intellij.psi.codeStyle.arrangement.std.StdArrangementTokens;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.table.JBTable;
import com.intellij.util.ui.AbstractTableCellEditor;
import gnu.trove.TIntArrayList;
@@ -349,10 +350,10 @@ public class ArrangementMatchingRulesControl extends JBTable {
}
myEditorRow = rowToEdit + 1;
ArrangementEditorComponent editor = new ArrangementEditorComponent(this, myEditorRow, myEditor);
Container parent = getParent();
int width = getBounds().width;
if (parent instanceof JViewport) {
width -= ((JScrollPane)parent.getParent()).getVerticalScrollBar().getWidth();
JScrollPane scrollPane = JBScrollPane.findScrollPane(getParent());
if (scrollPane != null) {
width -= scrollPane.getVerticalScrollBar().getWidth();
}
editor.applyAvailableWidth(width);
myEditor.reset(rowToEdit);
@@ -16,6 +16,7 @@
package com.intellij.codeInsight.lookup.impl;
import com.intellij.ui.ListExpandableItemsHandler;
import com.intellij.ui.components.JBScrollPane;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
@@ -31,9 +32,10 @@ public class CompletionExtender extends ListExpandableItemsHandler {
list.addComponentListener(new ComponentAdapter() {
@Override
public void componentShown(ComponentEvent e) {
if (myComponent.getParent() != null && myComponent.getParent().getParent() instanceof JScrollPane) {
final JScrollBar verticalScrollBar = ((JScrollPane)myComponent.getParent().getParent()).getVerticalScrollBar();
final JScrollBar horizontalScrollBar = ((JScrollPane)myComponent.getParent().getParent()).getVerticalScrollBar();
JScrollPane scrollPane = JBScrollPane.findScrollPane(myComponent);
if (scrollPane != null) {
final JScrollBar verticalScrollBar = scrollPane.getVerticalScrollBar();
final JScrollBar horizontalScrollBar = scrollPane.getVerticalScrollBar();
final AdjustmentListener listener = new AdjustmentListener() {
@Override
public void adjustmentValueChanged(AdjustmentEvent e) {
@@ -362,11 +362,11 @@ public class TemplateState implements Disposable {
mySegments.addSegment(segmentOffset, segmentOffset);
}
LOG.assertTrue(myTemplateRange.isValid(), myTemplateRange.toString());
LOG.assertTrue(myTemplateRange.isValid(), getRangesDebugInfo());
calcResults(false);
LOG.assertTrue(myTemplateRange.isValid(), myTemplateRange.toString());
LOG.assertTrue(myTemplateRange.isValid(), getRangesDebugInfo());
calcResults(false); //Fixed SCR #[vk500] : all variables should be recalced twice on start.
LOG.assertTrue(myTemplateRange.isValid(), myTemplateRange.toString());
LOG.assertTrue(myTemplateRange.isValid(), getRangesDebugInfo());
doReformat(null);
int nextVariableNumber = getNextVariableNumber(-1);
@@ -392,6 +392,16 @@ public class TemplateState implements Disposable {
});
}
private String getRangesDebugInfo() {
return myTemplateRange.toString() +
"\ntemplateKey: " +
myTemplate.getKey() +
"\ntemplateText: " +
myTemplate.getTemplateText() +
"\ntemplateString: " +
myTemplate.getString();
}
private void doReformat(final TextRange range) {
RangeMarker rangeMarker = null;
if (range != null) {
@@ -0,0 +1,77 @@
package com.intellij.execution.console;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.ui.JBColor;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.awt.*;
public class BasicGutterContentProvider extends GutterContentProvider {
public static final String EVAL_OUT_MARKER = "\u200C";
public static final String EVAL_IN_MARKER = EVAL_OUT_MARKER + EVAL_OUT_MARKER;
@Override
public boolean hasText() {
return false;
}
@Nullable
@Override
public String getText(int line, @NotNull Editor editor) {
return null;
}
@Nullable
@Override
public String getToolTip(int line, @NotNull Editor editor) {
return null;
}
@Override
public void doAction(int line, @NotNull Editor editor) {
}
@Override
public void beforeEvaluate(@NotNull Editor editor) {
Document document = editor.getDocument();
document.insertString(document.getTextLength(), EVAL_IN_MARKER);
}
@Override
public boolean drawIcon(int line, @NotNull Graphics g, int y, @NotNull Editor editor) {
int markerCount = getMarkerCount(line, editor.getDocument());
if (markerCount == EVAL_OUT_MARKER.length() || markerCount == EVAL_IN_MARKER.length()) {
g.setColor(JBColor.GRAY);
g.drawString(markerCount == EVAL_IN_MARKER.length() ? ">" : "<", 3, y);
return true;
}
return false;
}
@Override
public final boolean isShowSeparatorLine(int line, @NotNull Editor editor) {
Document document = editor.getDocument();
if ((line + 1) >= document.getLineCount()) {
return true;
}
int markerCount = getMarkerCount(line, document);
if (markerCount == EVAL_IN_MARKER.length()) {
return getMarkerCount(line + 1, document) != EVAL_OUT_MARKER.length();
}
else {
return doIsShowSeparatorLine(line, editor, document);
}
}
protected boolean doIsShowSeparatorLine(int line, @NotNull Editor editor, @NotNull Document document) {
return true;
}
private static int getMarkerCount(int line, @NotNull Document document) {
return StringUtil.countChars(document.getImmutableCharSequence(), EVAL_IN_MARKER.charAt(0), document.getLineStartOffset(line), true);
}
}
@@ -28,7 +28,7 @@ public abstract class GutterContentProvider {
public abstract void doAction(int line, @NotNull Editor editor);
public abstract void drawIcon(int line, @NotNull Graphics g, int y, @NotNull Editor editor);
public abstract boolean drawIcon(int line, @NotNull Graphics g, int y, @NotNull Editor editor);
public boolean isShowSeparatorLine(int line, @NotNull Editor editor) {
return true;
@@ -179,7 +179,6 @@ public final class LanguageConsoleBuilder {
}
private final static class GutteredLanguageConsole extends LanguageConsoleImpl {
@Nullable
private final GutterContentProvider gutterContentProvider;
@Nullable
private final PairFunction<VirtualFile, Project, PsiFile> psiFileFactory;
@@ -193,13 +192,13 @@ public final class LanguageConsoleBuilder {
setShowSeparatorLine(false);
this.gutterContentProvider = gutterContentProvider;
this.gutterContentProvider = gutterContentProvider == null ? new BasicGutterContentProvider() : gutterContentProvider;
this.psiFileFactory = psiFileFactory;
}
@Override
boolean isHistoryViewerForceAdditionalColumnsUsage() {
return gutterContentProvider == null;
return false;
}
@Override
@@ -222,7 +221,7 @@ public final class LanguageConsoleBuilder {
protected void setupEditorDefault(@NotNull EditorEx editor) {
super.setupEditorDefault(editor);
if (editor == getConsoleEditor() || gutterContentProvider == null) {
if (editor == getConsoleEditor()) {
return;
}
@@ -283,12 +282,7 @@ public final class LanguageConsoleBuilder {
@Override
protected void doAddPromptToHistory() {
if (gutterContentProvider == null) {
super.doAddPromptToHistory();
}
else {
gutterContentProvider.beforeEvaluate(getHistoryViewer());
}
gutterContentProvider.beforeEvaluate(getHistoryViewer());
}
private final class GutterUpdateScheduler extends DocumentAdapter implements DocumentBulkUpdateListener {
@@ -350,10 +344,7 @@ public final class LanguageConsoleBuilder {
private void documentCleared() {
gutterSizeUpdater = null;
lineEndGutter.documentCleared();
assert gutterContentProvider != null;
gutterContentProvider.documentCleared(getHistoryViewer());
}
@@ -419,7 +410,6 @@ public final class LanguageConsoleBuilder {
int actualStartLine = startLine == 0 ? 0 : startLine - 1;
int y = (actualStartLine + 1) * lineHeight;
g.setColor(editor.getColorsScheme().getColor(EditorColors.INDENT_GUIDE_COLOR));
assert gutterContentProvider != null;
for (int visualLine = actualStartLine; visualLine < endLine; visualLine++) {
if (gutterContentProvider.isShowSeparatorLine(editor.visualToLogicalPosition(new VisualPosition(visualLine, 0)).line, editor)) {
g.drawLine(0, y, clip.width, y);
@@ -583,6 +583,9 @@ public class LanguageConsoleImpl implements Disposable, TypeSafeDataProvider {
public void queueUiUpdate(boolean forceScrollToEnd) {
myForceScrollToEnd.compareAndSet(false, forceScrollToEnd);
if (myUpdateQueue.isDisposed()) {
return;
}
myUpdateQueue.request();
}
@@ -69,8 +69,6 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc
protected void initComponents() {
myProgramParametersComponent = LabeledComponent.create(new RawCommandLineEditor(),
ExecutionBundle.message("run.configuration.program.parameters"));
final JPanel panel = new JPanel(new BorderLayout());
myWorkingDirectoryField = new TextFieldWithBrowseButton(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
@@ -91,6 +89,8 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc
super.installPathCompletion(FileChooserDescriptorFactory.createSingleFolderDescriptor());
}
};
final JPanel panel = new JPanel(new BorderLayout());
panel.add(myWorkingDirectoryField, BorderLayout.CENTER);
final FixedSizeButton button = new FixedSizeButton(myWorkingDirectoryField);
@@ -171,7 +171,7 @@ public class CommonProgramParametersPanel extends JPanel implements PanelWithAnc
@Override
public void setAnchor(JComponent anchor) {
this.myAnchor = anchor;
myAnchor = anchor;
myProgramParametersComponent.setAnchor(anchor);
myWorkingDirectoryComponent.setAnchor(anchor);
myEnvVariablesComponent.setAnchor(anchor);
@@ -56,12 +56,12 @@ public class ProgramParametersConfigurator {
public String getWorkingDir(CommonProgramRunConfigurationParameters configuration, Project project, Module module) {
String workingDirectory = configuration.getWorkingDirectory();
String defaultWorkingDir = getDefaultWorkingDir(project);
if (workingDirectory == null || workingDirectory.trim().length() == 0) {
if (StringUtil.isEmptyOrSpaces(workingDirectory)) {
workingDirectory = defaultWorkingDir;
if (workingDirectory == null) {
return null;
}
}
if (workingDirectory == null)
return null;
workingDirectory = expandPath(workingDirectory, module, project);
if (!FileUtil.isAbsolute(workingDirectory) && defaultWorkingDir != null) {
if (("$" + PathMacroUtil.MODULE_DIR_MACRO_NAME + "$").equals(workingDirectory)) {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -157,4 +157,11 @@ public class RangeMarkerWindow implements RangeMarkerEx {
public void dispose() {
myHostMarker.dispose();
}
@Override
public String toString() {
return "RangeMarkerWindow" + (isGreedyToLeft() ? "[" : "(") + (isValid() ? "valid" : "invalid") + "," +
getStartOffset() + "," + getEndOffset() +
(isGreedyToRight() ? "]" : ")") + " " + getId();
}
}
@@ -1317,7 +1317,9 @@ public class Messages {
setButtonsAlignment(SwingConstants.CENTER);
setDoNotAskOption(doNotAskOption);
init();
MacUtil.adjustFocusTraversal(myDisposable);
if (isMacSheetEmulation()) {
MacUtil.adjustFocusTraversal(myDisposable);
}
}
@NotNull
@@ -60,6 +60,23 @@ public class JBScrollPane extends JScrollPane {
init();
}
public static JScrollPane findScrollPane(Component c) {
if (c == null) return null;
if (!(c instanceof JViewport)) {
c = c.getParent();
if (!(c instanceof JViewport)) return null;
}
c = c.getParent();
if (c instanceof JLayeredPane) {
c = c.getParent();
}
if (!(c instanceof JBScrollPane)) return null;
return (JBScrollPane)c;
}
@Override
public void setVerticalScrollBar(JScrollBar c) {
JScrollBar old = getVerticalScrollBar();
@@ -86,8 +86,7 @@ public class ZoomingDelegate {
}
protected void scrollTo(int voffset, int hoffset) {
JViewport viewport = (JViewport)myViewportComponent;
JScrollPane pane = (JScrollPane)viewport.getParent();
JScrollPane pane = JBScrollPane.findScrollPane(myViewportComponent);
JScrollBar vsb = pane.getVerticalScrollBar();
vsb.setValue(voffset);
JScrollBar hsb = pane.getHorizontalScrollBar();
@@ -62,7 +62,9 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
private final AdjustmentListener myAdjustmentListener;
private final MouseMotionAdapter myMouseMotionListener;
private final MouseAdapter myMouseListener;
private final AWTEventListener myAWTListener;
private final HierarchyListener myHierarchyListener;
private final AWTEventListener myAWTMouseListener;
private boolean myAWTMouseListenerAdded;
public static final int DELAY_FRAMES = 4;
public static final int FRAMES_COUNT = 10 + DELAY_FRAMES;
@@ -126,19 +128,33 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
}
};
myAWTListener = new AWTEventListener() {
myHierarchyListener = new HierarchyListener() {
@Override
public void hierarchyChanged(HierarchyEvent e) {
if (e.getChanged() == scrollbar
&& (HierarchyEvent.DISPLAYABILITY_CHANGED & e.getChangeFlags()) != 0) {
updateAWTMotionListener(false);
}
}
};
myAWTMouseListener = new AWTEventListener() {
public void eventDispatched(AWTEvent event) {
if (event.getID() == MouseEvent.MOUSE_MOVED) {
// user is moving mouse outside of the scrollbar and fade-out hasn't started yet
if (!myMouseOverScrollbar && !myMacScrollbarHidden && myMacScrollbarFadeLevel == 0) {
resetMacScrollbarFadeout();
// user is moving inside the scrollpane of the scrollbar and fade-out hasn't started yet
Container scrollpane = SwingUtilities.getAncestorOfClass(JScrollPane.class, scrollbar);
if (scrollpane != null) {
Point loc = ((MouseEvent)event).getLocationOnScreen();
SwingUtilities.convertPointFromScreen(loc, scrollpane);
if (scrollpane.contains(loc) && !myMacScrollbarHidden && myMacScrollbarFadeLevel == 0) {
resetMacScrollbarFadeout();
}
}
}
}
};
}
protected static boolean isMacScrollbar() {
return UIUtil.isUnderNativeMacLookAndFeel() && !Registry.is("ui.no.mac.scrollbar");
}
@@ -252,11 +268,27 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
scrollbar.addAdjustmentListener(myAdjustmentListener);
scrollbar.addMouseListener(myMouseListener);
scrollbar.addMouseMotionListener(myMouseMotionListener);
//Toolkit.getDefaultToolkit().addAWTEventListener(myAWTListener, AWTEvent.MOUSE_MOTION_EVENT_MASK);
scrollbar.addHierarchyListener(myHierarchyListener);
updateAWTMotionListener(false);
resetMacScrollbarFadeout();
}
private void updateAWTMotionListener(boolean forceRemove) {
boolean shouldAdd = scrollbar.isDisplayable();
if (myAWTMouseListenerAdded && (!shouldAdd || forceRemove)) {
Toolkit.getDefaultToolkit().removeAWTEventListener(myAWTMouseListener);
myAWTMouseListenerAdded = false;
}
if (!myAWTMouseListenerAdded && shouldAdd && !forceRemove) {
Toolkit.getDefaultToolkit().addAWTEventListener(myAWTMouseListener, AWTEvent.MOUSE_MOTION_EVENT_MASK);
myAWTMouseListenerAdded = true;
}
}
private void initRegularThumbAnimator() {
myThumbFadeAnimator = new Animator("Regular scrollbar thumb animator", FRAMES_COUNT, FRAMES_COUNT * 50, false) {
@Override
@@ -333,6 +365,13 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
super.uninstallListeners();
}
scrollbar.removeAdjustmentListener(myAdjustmentListener);
scrollbar.removeMouseListener(myMouseListener);
scrollbar.removeMouseMotionListener(myMouseMotionListener);
scrollbar.removeHierarchyListener(myHierarchyListener);
updateAWTMotionListener(true);
Disposer.dispose(myThumbFadeAnimator);
myThumbFadeAnimator = null;
@@ -340,11 +379,6 @@ public class ButtonlessScrollBarUI extends BasicScrollBarUI {
myMouseOverScrollbarExpandAnimator = null;
Disposer.dispose(myMacScrollbarFadeAnimator);
myMacScrollbarFadeAnimator = null;
scrollbar.removeAdjustmentListener(myAdjustmentListener);
scrollbar.removeMouseListener(myMouseListener);
scrollbar.removeMouseMotionListener(myMouseMotionListener);
//Toolkit.getDefaultToolkit().removeAWTEventListener(myAWTListener);
}
@Override
@@ -22,24 +22,24 @@ import com.intellij.openapi.vfs.newvfs.BulkFileListener;
import com.intellij.openapi.vfs.newvfs.NewVirtualFile;
import com.intellij.openapi.vfs.newvfs.events.VFileEvent;
import com.intellij.openapi.vfs.newvfs.events.VFilePropertyChangeEvent;
import com.intellij.util.containers.IntArrayList;
import com.intellij.util.containers.ConcurrentBitSet;
import com.intellij.util.containers.ConcurrentIntObjectMap;
import com.intellij.util.containers.StripedLockIntObjectConcurrentHashMap;
import com.intellij.util.messages.MessageBusConnection;
import gnu.trove.TIntHashSet;
import org.jetbrains.annotations.NotNull;
import java.util.BitSet;
import java.util.List;
/**
* @author peter
*/
class IgnoredFileCache {
private final BitSet myCheckedIds = new BitSet();
private final TIntHashSet myIgnoredIds = new TIntHashSet();
private final ConcurrentBitSet myCheckedIds = new ConcurrentBitSet();
private final ConcurrentIntObjectMap<Object> myIgnoredIds = new StripedLockIntObjectConcurrentHashMap<Object>();
private final IgnoredPatternSet myIgnoredPatterns;
private int myVfsEventNesting = 0;
private volatile int myVfsEventNesting = 0;
IgnoredFileCache(IgnoredPatternSet ignoredPatterns) {
IgnoredFileCache(@NotNull IgnoredPatternSet ignoredPatterns) {
myIgnoredPatterns = ignoredPatterns;
MessageBusConnection connect = ApplicationManager.getApplication().getMessageBus().connect();
connect.subscribe(VirtualFileManager.VFS_CHANGES, new BulkFileListener() {
@@ -56,43 +56,27 @@ class IgnoredFileCache {
myVfsEventNesting--;
}
private void clearCacheForChangedFiles(List<? extends VFileEvent> events) {
final IntArrayList ids = collectChangedIds(events);
synchronized (myCheckedIds) {
for (int i : ids.toArray()) {
myCheckedIds.clear(i);
}
}
}
private IntArrayList collectChangedIds(List<? extends VFileEvent> events) {
final IntArrayList ids = new IntArrayList();
private void clearCacheForChangedFiles(@NotNull List<? extends VFileEvent> events) {
for (final VFileEvent event : events) {
VirtualFile file = event.getFile();
if (!(file instanceof NewVirtualFile)) {
continue;
}
if (event instanceof VFilePropertyChangeEvent) {
if (file instanceof NewVirtualFile && event instanceof VFilePropertyChangeEvent) {
int id = ((NewVirtualFile)file).getId();
if (id >= 0) {
ids.add(id);
myCheckedIds.clear(id);
myIgnoredIds.remove(id);
}
}
}
return ids;
}
});
}
void clearCache() {
synchronized (myCheckedIds) {
myCheckedIds.clear();
myIgnoredIds.clear();
}
myCheckedIds.clear();
myIgnoredIds.clear();
}
boolean isFileIgnored(VirtualFile file) {
boolean isFileIgnored(@NotNull VirtualFile file) {
if (myVfsEventNesting != 0 || !(file instanceof NewVirtualFile)) {
return isFileIgnoredNoCache(file);
}
@@ -102,25 +86,23 @@ class IgnoredFileCache {
return isFileIgnoredNoCache(file);
}
synchronized (myCheckedIds) {
if (myCheckedIds.get(id)) {
return myIgnoredIds.contains(id);
}
ConcurrentBitSet checkedIds = myCheckedIds;
if (checkedIds.get(id)) {
return myIgnoredIds.containsKey(id);
}
boolean result = isFileIgnoredNoCache(file);
synchronized (myCheckedIds) {
myCheckedIds.set(id);
if (result) {
myIgnoredIds.add(id);
} else {
myIgnoredIds.remove(id);
}
if (result) {
myIgnoredIds.put(id, Boolean.TRUE);
}
else {
myIgnoredIds.remove(id);
}
checkedIds.set(id);
return result;
}
private boolean isFileIgnoredNoCache(VirtualFile file) {
private boolean isFileIgnoredNoCache(@NotNull VirtualFile file) {
return myIgnoredPatterns.isIgnored(file.getName());
}
}
@@ -55,8 +55,9 @@ public class FileNameCache {
Object rawName = convertToBytesIfAsciiString(name);
IntObjectLinkedMap.MapEntry<Object> entry = new IntObjectLinkedMap.MapEntry<Object>(id, rawName);
synchronized (ourNameCache[stripe]) {
return ourNameCache[stripe].cacheEntry(entry);
IntSLRUCache<IntObjectLinkedMap.MapEntry<Object>> cache = ourNameCache[stripe];
synchronized (cache) {
return cache.cacheEntry(entry);
}
}
@@ -91,8 +92,9 @@ public class FileNameCache {
@NotNull
private static IntObjectLinkedMap.MapEntry<Object> getEntry(int id) {
final int stripe = calcStripeIdFromNameId(id);
synchronized (ourNameCache[stripe]) {
IntObjectLinkedMap.MapEntry<Object> entry = ourNameCache[stripe].getCachedEntry(id);
IntSLRUCache<IntObjectLinkedMap.MapEntry<Object>> cache = ourNameCache[stripe];
synchronized (cache) {
IntObjectLinkedMap.MapEntry<Object> entry = cache.getCachedEntry(id);
if (entry != null) {
return entry;
}
@@ -502,7 +502,7 @@ public class BalloonImpl implements Balloon, IdeTooltip.Ui {
myLayeredPane.remove(myComp);
createComponent();
if (!new Rectangle(myComp.getSize()).contains(new Rectangle(myLayeredPane.getSize()))) { // Balloon is bigger than window, don't show it at all.
if (!new Rectangle(myLayeredPane.getSize()).contains(new Rectangle(myComp.getSize()))) { // Balloon is bigger than window, don't show it at all.
myLayeredPane = null;
hide();
return;
@@ -37,9 +37,6 @@ public class ExpansionHint implements Hint {
myListeners = ContainerUtil.newSmartList();
}
/**
* Shows the hint as the window.
*/
@Override
public void show(@NotNull JComponent parentComponent, int x, int y, @Nullable JComponent focusBackComponent, @Nullable HintHint hh) {
myPopup = JBPopupFactory.getInstance().createComponentPopupBuilder(myComponent, null)
@@ -63,10 +60,6 @@ public class ExpansionHint implements Hint {
return myComponent.isShowing();
}
public JComponent getComponent() {
return myComponent;
}
@Override
public void hide() {
if (myPopup != null) {
@@ -67,6 +67,7 @@
<extensionPoint name="xml.xmlTagRuleProvider" interface="com.intellij.xml.XmlTagRuleProvider"/>
<extensionPoint name="html.embeddedTokenTypesProvider" interface="com.intellij.lexer.HtmlEmbeddedTokenTypesProvider"/>
<extensionPoint name="embeddedTokenTypesProvider" interface="com.intellij.lexer.EmbeddedTokenTypesProvider"/>
<extensionPoint name="xml.html5SchemaProvider" interface="com.intellij.xml.Html5SchemaProvider"/>
<extensionPoint name="xml.implicitIdRefProvider" interface="com.intellij.psi.impl.source.resolve.reference.impl.providers.ImplicitIdRefProvider"/>
@@ -2,7 +2,7 @@
// Each line contains plugin ID and list of versions that are broken.
// If plugin name or version contains a space you can quote it like in command line.
NodeJS 134.1276 134.1163 134.1145 134.1081 134.1039 134.985 134.680 134.31 134.307 134.262 134.198 134.125
NodeJS 134.1276 134.1163 134.1145 134.1081 134.1039 134.985 134.680 134.31 134.307 134.262 134.198 134.125 136.1141
com.jetbrains.php 133.982 133.679 133.51 133.326 131.98 131.374 131.332 131.235 131.205 130.1639 130.1481 130.1176 129.91 129.814 129.672 129.362 127.67 127.100 126.334 123.66 122.875 121.62 121.390 121.215 121.12
com.jetbrains.lang.ejs 131.17 131.12
com.jetbrains.twig 133.51 130.1639
@@ -131,8 +131,9 @@ public abstract class OutputLineSplitter {
myStdOutChunks.clear();
}
final boolean isTCLikeFakeOutput = chunks.size() == 1;
for (OutputChunk chunk : chunks) {
onLineAvailable(chunk.getText(), chunk.getKey(), false);
onLineAvailable(chunk.getText(), chunk.getKey(), isTCLikeFakeOutput);
}
}
@@ -43,35 +43,40 @@ public class OutputToGeneralTestsEventsConverterTest extends BaseSMTRunnerTestCa
}
public void testLineBreaks_ServiceMessage() {
doCheckOutptut("\n##teamcity[enteredTheMatrix timestamp = '2011-06-03T13:00:08.259+0400']\n", "[stdout]\n", true);
doCheckOutptut("\n##teamcity[enteredTheMatrix timestamp = '2011-06-03T13:00:08.259+0400']\n", "", true);
}
public void testLineBreaks_NormalOutput() {
doCheckOutptut("\na\nb\n\nc\n", "[stdout]\n" +
"[stdout]a\n" +
"[stdout]b\n" +
"[stdout]a" +
"[stdout]\n" +
"[stdout]c\n",
"[stdout]b" +
"[stdout]\n" +
"[stdout]\n" +
"[stdout]c" +
"[stdout]\n",
true);
}
public void testLineBreaks_OutptutAndCommands() {
doCheckOutptut("\na\n##teamcity[enteredTheMatrix timestamp = '2011-06-03T13:00:08.259+0400']\nb\n##teamcity[enteredTheMatrix timestamp = '2011-06-03T13:00:08.259+0400']\n\nc\n",
"[stdout]\n" +
"[stdout]a\n" +
"[stdout]b\n" +
"[stdout]a" +
"[stdout]b" +
"[stdout]\n" +
"[stdout]c\n",
"[stdout]c" +
"[stdout]\n",
true);
}
public void testLineBreaks_AutoSplitIfProcessHandlerDoestSupportIt() {
doCheckOutptut("\na\n##teamcity[enteredTheMatrix timestamp = '2011-06-03T13:00:08.259+0400']\nb\n##teamcity[testCount count = '1' timestamp = '2011-06-03T13:00:08.259+0400']\n\nc\n",
"[stdout]\n" +
"[stdout]a\n" +
"[stdout]b\n" +
"[stdout]a" +
"[stdout]b" +
"[stdout]\n" +
"[stdout]c\n",
"[stdout]c" +
"[stdout]\n",
false);
}
@@ -34,7 +34,6 @@ import com.intellij.idea.IdeaLogger;
import com.intellij.idea.IdeaTestApplication;
import com.intellij.openapi.actionSystem.CommonDataKeys;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.application.Application;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ex.ApplicationEx;
@@ -444,7 +443,7 @@ public abstract class LightPlatformTestCase extends UsefulTestCase implements Da
}
});
assertEmpty(unsavedDocuments);
assertEmpty("There are unsaved documents", Arrays.asList(unsavedDocuments));
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -17,6 +17,7 @@ package com.intellij.util;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Factory;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Constructor;
@@ -25,7 +26,7 @@ public class NewInstanceFactory<T> implements Factory<T> {
private final Constructor myConstructor;
private final Object[] myArgs;
private NewInstanceFactory(Constructor constructor, Object[] args) {
private NewInstanceFactory(@NotNull Constructor constructor, @NotNull Object[] args) {
myConstructor = constructor;
myArgs = args;
}
@@ -41,7 +42,7 @@ public class NewInstanceFactory<T> implements Factory<T> {
}
}
public static <T> Factory<T> fromClass(final Class<T> clazz) {
public static <T> Factory<T> fromClass(@NotNull final Class<T> clazz) {
try {
return new NewInstanceFactory<T>(clazz.getConstructor(ArrayUtil.EMPTY_CLASS_ARRAY), ArrayUtil.EMPTY_OBJECT_ARRAY);
}
@@ -16,12 +16,14 @@
package com.intellij.util;
import com.intellij.Patches;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Condition;
import com.intellij.util.containers.ContainerUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import sun.reflect.ConstructorAccessor;
import java.lang.reflect.*;
import java.util.ArrayList;
@@ -347,6 +349,59 @@ public class ReflectionUtil {
}
}
static {
// method getConstructorAccessorMethod is not necessary since JDK7, use acquireConstructorAccessor return value instead
assert Patches.USE_REFLECTION_TO_ACCESS_JDK7;
}
private static final Method acquireConstructorAccessorMethod;
private static final Method getConstructorAccessorMethod;
static {
try {
Method accessor = Constructor.class.getDeclaredMethod("acquireConstructorAccessor");
accessor.setAccessible(true);
acquireConstructorAccessorMethod = accessor;
Method get = Constructor.class.getDeclaredMethod("getConstructorAccessor");
get.setAccessible(true);
getConstructorAccessorMethod = get;
}
catch (NoSuchMethodException e) {
throw new RuntimeException(e);
}
}
@NotNull
public static ConstructorAccessor getConstructorAccessor(@NotNull Constructor constructor) {
constructor.setAccessible(true);
// it is faster to invoke constructor via sun.reflect.ConstructorAccessor; it avoids AccessibleObject.checkAccess()
try {
acquireConstructorAccessorMethod.invoke(constructor);
return (ConstructorAccessor)getConstructorAccessorMethod.invoke(constructor);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
@NotNull
public static <T> T createInstanceViaConstructorAccessor(@NotNull ConstructorAccessor constructorAccessor,
@NotNull Object... arguments) {
try {
return (T)constructorAccessor.newInstance(arguments);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
@NotNull
public static <T> T createInstanceViaConstructorAccessor(@NotNull ConstructorAccessor constructorAccessor) {
try {
return (T)constructorAccessor.newInstance(ArrayUtil.EMPTY_OBJECT_ARRAY);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
@NotNull
public static <T> T createInstance(@NotNull Constructor<T> constructor, @NotNull Object... args) {
try {
File diff suppressed because it is too large Load Diff
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -18,6 +18,7 @@ package com.intellij.util.containers;
import com.intellij.util.ConcurrencyUtil;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.concurrency.AtomicFieldUpdater;
import gnu.trove.TObjectHashingStrategy;
import jsr166e.CountedCompleter;
import jsr166e.ForkJoinPool;
@@ -7137,32 +7138,7 @@ public class ConcurrentHashMap<K, V> extends AbstractMap<K, V> implements Concur
* @return a sun.misc.Unsafe
*/
private static Unsafe getUnsafe() {
try {
return Unsafe.getUnsafe();
}
catch (SecurityException tryReflectionInstead) {
}
try {
return AccessController.doPrivileged
(new PrivilegedExceptionAction<Unsafe>() {
@Override
public Unsafe run() throws Exception {
Class<Unsafe> k = Unsafe.class;
for (Field f : k.getDeclaredFields()) {
f.setAccessible(true);
Object x = f.get(null);
if (k.isInstance(x)) {
return k.cast(x);
}
}
throw new NoSuchFieldError("the Unsafe");
}
});
}
catch (PrivilegedActionException e) {
throw new RuntimeException("Could not initialize intrinsics",
e.getCause());
}
return AtomicFieldUpdater.getUnsafe();
}
////////////////////// IJ specific
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2012 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,11 +15,11 @@
*/
package com.intellij.util.text;
import com.intellij.util.ReflectionUtil;
import org.jetbrains.annotations.NotNull;
import sun.reflect.ConstructorAccessor;
import java.lang.reflect.Constructor;
import java.lang.reflect.Method;
public class StringFactory {
// String(char[], boolean). Works since JDK1.7, earlier JDKs have too slow reflection anyway
@@ -29,11 +29,7 @@ public class StringFactory {
ConstructorAccessor constructorAccessor = null;
try {
Constructor<String> newC = String.class.getDeclaredConstructor(char[].class, boolean.class);
newC.setAccessible(true);
// it is faster to invoke constructor via sun.reflect.ConstructorAccessor; it avoids AccessibleObject.checkAccess()
Method accessor = Constructor.class.getDeclaredMethod("acquireConstructorAccessor");
accessor.setAccessible(true);
constructorAccessor = (ConstructorAccessor)accessor.invoke(newC);
constructorAccessor = ReflectionUtil.getConstructorAccessor(newC);
}
catch (Exception ignored) {
}
@@ -50,12 +46,7 @@ public class StringFactory {
@NotNull
public static String createShared(@NotNull char[] chars) {
if (ourConstructorAccessor != null) {
try {
return (String)ourConstructorAccessor.newInstance(new Object[]{chars, Boolean.TRUE});
}
catch (Exception e) {
throw new RuntimeException(e);
}
return ReflectionUtil.createInstanceViaConstructorAccessor(ourConstructorAccessor, chars, Boolean.TRUE);
}
return new String(chars);
}
@@ -0,0 +1,124 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.util.containers;
import junit.framework.TestCase;
public class ConcurrentBitSetTest extends TestCase {
public void test() {
ConcurrentBitSet bitSet = new ConcurrentBitSet();
final ConcurrentBitSet emptySet = new ConcurrentBitSet();
int N = 3000;
assertEquals(0, bitSet.nextClearBit(0));
assertEquals(bitSet, emptySet);
for (int i=0; i<N;i++) {
assertEquals(-1, bitSet.nextSetBit(i));
assertEquals(i, bitSet.nextClearBit(i));
assertFalse(bitSet.get(i));
bitSet.set(i);
assertTrue(bitSet.get(i));
bitSet.clear(i);
assertFalse(bitSet.get(i));
assertEquals(bitSet, emptySet);
}
bitSet = new ConcurrentBitSet();
for (int b=0;b<N;b++) {
assertEquals(bitSet, emptySet);
boolean set = bitSet.flip(b);
assertTrue(set);
assertEquals(b, bitSet.nextSetBit(0));
assertEquals(b==0?1:0, bitSet.nextClearBit(0));
assertEquals(b+1, bitSet.nextClearBit(b));
assertFalse(bitSet.get(b==0?1:0));
assertTrue(bitSet.get(b));
for (int i=0; i<N;i++) {
assertEquals(i<=b?b:-1, bitSet.nextSetBit(i));
assertEquals(i==b?b+1:i, bitSet.nextClearBit(i));
assertEquals(i == b, bitSet.get(i));
}
boolean after = bitSet.flip(b);
assertFalse(after);
assertEquals(-1, bitSet.nextSetBit(0));
assertEquals(0, bitSet.nextClearBit(0));
assertEquals(b, bitSet.nextClearBit(b));
assertFalse(bitSet.get(0));
assertFalse(bitSet.get(b));
for (int i=0; i<N;i++) {
assertEquals(-1, bitSet.nextSetBit(i));
assertEquals(i, bitSet.nextClearBit(i));
assertFalse(bitSet.get(i));
}
}
bitSet.set(100, true);
assertFalse(bitSet.equals(emptySet));
bitSet.clear();
assertEquals(bitSet, emptySet);
}
public void testStress() throws InterruptedException {
final ConcurrentBitSet bitSet = new ConcurrentBitSet();
int N = 100;
final int L = 100;
Thread[] threads = new Thread[N];
for (int i=0; i<N;i++) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 10000; i++) {
for (int j = 0; j < L; j++) {
bitSet.flip(j);
}
}
}
});
threads[i] = thread;
thread.start();
}
for (Thread thread : threads) {
thread.join();
}
assertEquals(-1, bitSet.nextSetBit(0));
}
public void testStress2() throws InterruptedException {
final ConcurrentBitSet bitSet = new ConcurrentBitSet();
int N = 10;
final int L = 1000000;
Thread[] threads = new Thread[N];
for (int i=0; i<N;i++) {
Thread thread = new Thread(new Runnable() {
@Override
public void run() {
for (int i = 0; i < 100; i++) {
for (int j = 0; j < L; j++) {
bitSet.flip(j);
}
}
}
});
threads[i] = thread;
thread.start();
}
for (Thread thread : threads) {
thread.join();
}
assertEquals(-1, bitSet.nextSetBit(0));
}
}
@@ -288,13 +288,13 @@ public class CvsChangeProvider implements ChangeProvider {
return;
}
final CvsInfo info = myEntriesManager.getCvsInfoFor(dir);
if (info.getIgnoreFilter().shouldBeIgnored(dir.getName())) {
builder.processIgnoredFile(dir);
return;
}
if (info.getRepository() == null) {
// don't report unversioned directories as switched (IDEADEV-17178)
builder.processUnversionedFile(dir);
if (info.getIgnoreFilter().shouldBeIgnored(dir.getName())) {
builder.processIgnoredFile(dir);
}
else {
builder.processUnversionedFile(dir);
}
return;
}
final String dirTag = info.getStickyTag();
@@ -66,7 +66,7 @@ public class GithubApiUtil {
}
private enum HttpVerb {
GET, POST, DELETE, HEAD
GET, POST, DELETE, HEAD, PATCH
}
@Nullable
@@ -77,6 +77,14 @@ public class GithubApiUtil {
return request(auth, path, requestBody, Arrays.asList(headers), HttpVerb.POST).getJsonElement();
}
@Nullable
private static JsonElement patchRequest(@NotNull GithubAuthData auth,
@NotNull String path,
@Nullable String requestBody,
@NotNull Header... headers) throws IOException {
return request(auth, path, requestBody, Arrays.asList(headers), HttpVerb.PATCH).getJsonElement();
}
@Nullable
private static JsonElement deleteRequest(@NotNull GithubAuthData auth, @NotNull String path, @NotNull Header... headers)
throws IOException {
@@ -95,7 +103,7 @@ public class GithubApiUtil {
@NotNull Collection<Header> headers,
@NotNull HttpVerb verb) throws IOException {
if (EventQueue.isDispatchThread() && !ApplicationManager.getApplication().isUnitTestMode()) {
LOG.warn("Network operation in EDT");
LOG.warn("Network operation in EDT"); // TODO: fix
}
HttpMethod method = null;
@@ -152,6 +160,17 @@ public class GithubApiUtil {
((PostMethod)method).setRequestEntity(new StringRequestEntity(requestBody, "application/json", "UTF-8"));
}
break;
case PATCH:
method = new PostMethod(uri) { // TODO: httpclient 4.x
@Override
public String getName() {
return "PATCH";
}
};
if (requestBody != null) {
((PostMethod)method).setRequestEntity(new StringRequestEntity(requestBody, "application/json", "UTF-8"));
}
break;
case GET:
method = new GetMethod(uri);
break;
@@ -408,7 +427,8 @@ public class GithubApiUtil {
public static void askForTwoFactorCodeSMS(@NotNull GithubAuthData auth) {
try {
postRequest(auth, "/authorizations", null, ACCEPT_V3_JSON);
} catch (IOException e) {
}
catch (IOException e) {
LOG.info(e);
}
}
@@ -441,25 +461,78 @@ public class GithubApiUtil {
}
@NotNull
public static String getScopedToken(@NotNull GithubAuthData auth, @NotNull Collection<String> scopes, @Nullable String note)
public static String getScopedToken(@NotNull GithubAuthData auth, @NotNull Collection<String> scopes, @NotNull String note)
throws IOException {
GithubAuthorization token = findToken(auth, note);
if (token == null) {
return getNewScopedToken(auth, scopes, note).getToken();
}
if (token.getScopes().containsAll(scopes)) {
return token.getToken();
}
return updateTokenScopes(auth, token, scopes).getToken();
}
@NotNull
private static GithubAuthorization updateTokenScopes(@NotNull GithubAuthData auth,
@NotNull GithubAuthorization token,
@NotNull Collection<String> scopes) throws IOException {
try {
String path = "/authorizations";
String path = "/authorizations/" + token.getId();
GithubAuthorizationRequest request = new GithubAuthorizationRequest(new ArrayList<String>(scopes), note, null);
GithubAuthorization response =
createDataFromRaw(fromJson(postRequest(auth, path, gson.toJson(request)), GithubAuthorizationRaw.class), GithubAuthorization.class);
GithubAuthorizationUpdateRequest request = new GithubAuthorizationUpdateRequest(new ArrayList<String>(scopes));
return response.getToken();
return createDataFromRaw(fromJson(patchRequest(auth, path, gson.toJson(request), ACCEPT_V3_JSON), GithubAuthorizationRaw.class),
GithubAuthorization.class);
}
catch (GithubConfusingException e) {
e.setDetails("Can't get token: scopes - " + scopes);
e.setDetails("Can't update token: scopes - " + scopes);
throw e;
}
}
@NotNull
public static String getMasterToken(@NotNull GithubAuthData auth, @Nullable String note) throws IOException {
private static GithubAuthorization getNewScopedToken(@NotNull GithubAuthData auth,
@NotNull Collection<String> scopes,
@NotNull String note)
throws IOException {
try {
String path = "/authorizations";
GithubAuthorizationCreateRequest request = new GithubAuthorizationCreateRequest(new ArrayList<String>(scopes), note, null);
return createDataFromRaw(fromJson(postRequest(auth, path, gson.toJson(request), ACCEPT_V3_JSON), GithubAuthorizationRaw.class),
GithubAuthorization.class);
}
catch (GithubConfusingException e) {
e.setDetails("Can't create token: scopes - " + scopes + " - note " + note);
throw e;
}
}
@Nullable
private static GithubAuthorization findToken(@NotNull GithubAuthData auth, @NotNull String note) throws IOException {
try {
String path = "/authorizations";
PagedRequest<GithubAuthorization> request =
new PagedRequest<GithubAuthorization>(path, GithubAuthorization.class, GithubAuthorizationRaw[].class, ACCEPT_V3_JSON);
List<GithubAuthorization> tokens = request.getAll(auth);
for (GithubAuthorization token : tokens) {
if (note.equals(token.getNote())) return token;
}
return null;
}
catch (GithubConfusingException e) {
e.setDetails("Can't get available tokens");
throw e;
}
}
@NotNull
public static String getMasterToken(@NotNull GithubAuthData auth, @NotNull String note) throws IOException {
// "repo" - read/write access to public/private repositories
// "gist" - create/delete gists
List<String> scopes = Arrays.asList("repo", "gist");
@@ -468,7 +541,7 @@ public class GithubApiUtil {
}
@NotNull
public static String getReadOnlyToken(@NotNull GithubAuthData auth, @NotNull String user, @NotNull String repo, @Nullable String note)
public static String getReadOnlyToken(@NotNull GithubAuthData auth, @NotNull String user, @NotNull String repo, @NotNull String note)
throws IOException {
GithubRepo repository = getDetailedRepoInfo(auth, user, repo);
@@ -543,10 +616,14 @@ public class GithubApiUtil {
// One of this may not exist in GitHub enterprise
try {
repos.addAll(getMembershipRepos(auth));
} catch (GithubStatusCodeException ignore) {}
}
catch (GithubStatusCodeException ignore) {
}
try {
repos.addAll(getWatchedRepos(auth));
} catch (GithubStatusCodeException ignore) {}
}
catch (GithubStatusCodeException ignore) {
}
return repos;
}
@@ -16,6 +16,7 @@
package org.jetbrains.plugins.github.api;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.util.List;
@@ -23,12 +24,16 @@ import java.util.List;
* @author Aleksey Pivovarov
*/
public class GithubAuthorization {
private final long myId;
@Nullable private final String myNote;
@NotNull private final String myToken;
@NotNull private final List<String> myScopes;
public GithubAuthorization(@NotNull String token, @NotNull List<String> scopes) {
public GithubAuthorization(long id, @NotNull String token, @NotNull List<String> scopes, @Nullable String note) {
myId = id;
myToken = token;
myScopes = scopes;
myNote = note;
}
@NotNull
@@ -40,4 +45,13 @@ public class GithubAuthorization {
public List<String> getScopes() {
return myScopes;
}
@Nullable
public String getNote() {
return myNote;
}
public long getId() {
return myId;
}
}
@@ -24,13 +24,13 @@ import java.util.List;
* @author Aleksey Pivovarov
*/
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
class GithubAuthorizationRequest {
class GithubAuthorizationCreateRequest {
@NotNull private final List<String> scopes;
@Nullable private final String note;
@Nullable private final String noteUrl;
public GithubAuthorizationRequest(@NotNull List<String> scopes, @Nullable String note, @Nullable String noteUrl) {
public GithubAuthorizationCreateRequest(@NotNull List<String> scopes, @Nullable String note, @Nullable String noteUrl) {
this.scopes = scopes;
this.note = note;
this.noteUrl = noteUrl;
@@ -34,7 +34,7 @@ class GithubAuthorizationRaw implements DataConstructor {
@SuppressWarnings("ConstantConditions")
public GithubAuthorization createAuthorization() {
return new GithubAuthorization(token, scopes);
return new GithubAuthorization(id, token, scopes, note);
}
@SuppressWarnings("unchecked")
@@ -0,0 +1,32 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jetbrains.plugins.github.api;
import org.jetbrains.annotations.NotNull;
import java.util.List;
/**
* @author Aleksey Pivovarov
*/
@SuppressWarnings({"FieldCanBeLocal", "UnusedDeclaration"})
class GithubAuthorizationUpdateRequest {
@NotNull private final List<String> addScopes;
public GithubAuthorizationUpdateRequest(@NotNull List<String> newScopes) {
this.addScopes = newScopes;
}
}
@@ -131,7 +131,7 @@ public class GithubRepositoryEditor extends BaseRepositoryEditor<GithubRepositor
@Override
public String convert(@NotNull GithubAuthData auth) throws IOException {
return GithubApiUtil
.getReadOnlyToken(auth, getRepoAuthor(), getRepoName(), "Intellij tasks plugin");
.getReadOnlyToken(auth, getRepoAuthor(), getRepoName(), "IntelliJ tasks plugin");
}
}
);
@@ -970,7 +970,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
private static void registerFix(Annotation annotation, LocalQuickFix fix, PsiElement place) {
final InspectionManager manager = InspectionManager.getInstance(place.getProject());
assert !place.getTextRange().isEmpty();
assert !place.getTextRange().isEmpty() : place.getContainingFile().getName();
final ProblemDescriptor descriptor = manager.createProblemDescriptor(place, place, annotation.getMessage(),
annotation.getHighlightType(), true, LocalQuickFix.EMPTY_ARRAY);
@@ -1795,7 +1795,7 @@ public class GroovyAnnotator extends GroovyElementVisitor {
if (containingClass != null) {
final PsiModifierList list = containingClass.getModifierList();
if (list != null && !list.hasModifierProperty(ABSTRACT)) {
registerFix(annotation, new GrModifierFix(containingClass, ABSTRACT, false, true, GrModifierFix.MODIFIER_LIST), list);
registerFix(annotation, new GrModifierFix(containingClass, ABSTRACT, false, true, GrModifierFix.MODIFIER_LIST_OWNER), containingClass);
}
}
}
@@ -80,7 +80,7 @@ hg4idea.init.already.under.hg.option.create.repo.here=Create new repository here
hg4idea.init.created.notification.title=Mercurial repository created
hg4idea.init.created.notification.description=Repository was created in {0}
hg4idea.init.error.title=Error creating Mercurial repository
hg4idea.init.error.description=Couldn't create a Mercurial repository in {0}
hg4idea.init.error.description=Couldn''t create a Mercurial repository in {0}
hg4idea.move.progress=Moving files in the VCS...
@@ -22,6 +22,7 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Comparing;
import com.intellij.openapi.util.Pair;
import com.intellij.ui.*;
import com.intellij.ui.components.JBScrollPane;
import com.intellij.ui.treeStructure.Tree;
import com.intellij.util.Alarm;
import com.intellij.util.ui.AbstractLayoutManager;
@@ -346,14 +347,11 @@ public class MavenArtifactSearchPanel extends JPanel {
Insets insets = tree.getInsets();
w -= insets.left + insets.right;
Container parent = tree.getParent();
if (parent != null) {
Container parentParent = parent.getParent();
if (parentParent instanceof JScrollPane) {
JScrollBar sb = ((JScrollPane)parentParent).getVerticalScrollBar();
if (sb != null) {
w -= sb.getWidth();
}
JScrollPane scrollPane = JBScrollPane.findScrollPane(tree);
if (scrollPane != null) {
JScrollBar sb = scrollPane.getVerticalScrollBar();
if (sb != null) {
w -= sb.getWidth();
}
}
return w;
-5
View File
@@ -44,9 +44,4 @@
<configuration name="&lt;template&gt;" type="#org.jetbrains.idea.devkit.run.PluginConfigurationType" default="true" selected="false">
<option name="VM_PARAMETERS" value="-Xmx512m -Xms256m -XX:MaxPermSize=250m -ea" />
</configuration>
<configuration name="&lt;template&gt;" type="WebApp" default="true" selected="false">
<Host>localhost</Host>
<Port>5050</Port>
</configuration>
</component>
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,12 +14,6 @@
* limitations under the License.
*/
/*
* Created by IntelliJ IDEA.
* User: Sergey.Vasiliev
* Date: Nov 13, 2006
* Time: 4:37:22 PM
*/
package com.intellij.util.xml.converters;
import com.intellij.codeInsight.daemon.EmptyResolveMessageProvider;
@@ -33,10 +27,8 @@ import com.intellij.psi.PsiReferenceBase;
import com.intellij.util.ArrayUtil;
import com.intellij.util.Function;
import com.intellij.util.IncorrectOperationException;
import com.intellij.util.xml.ConvertContext;
import com.intellij.util.xml.CustomReferenceConverter;
import com.intellij.util.xml.GenericDomValue;
import com.intellij.util.xml.ResolvingConverter;
import com.intellij.util.xml.*;
import com.intellij.xml.util.XmlTagUtil;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -76,7 +68,7 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
public static <T> void filterVariants(List<T> variants, GenericDomValue<List<T>> genericDomValue) {
final List<T> list = genericDomValue.getValue();
if (list != null) {
for (Iterator<T> i = variants.iterator(); i.hasNext();) {
for (Iterator<T> i = variants.iterator(); i.hasNext(); ) {
final T variant = i.next();
for (T existing : list) {
if (existing.equals(variant)) {
@@ -149,7 +141,15 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
final GenericDomValue<List<T>> genericDomValue,
final boolean delimitersOnly) {
return new MyPsiReference(element, new TextRange(start, end), context, genericDomValue, delimitersOnly);
return new MyPsiReference(element, getTextRange(genericDomValue, start, end), context, genericDomValue, delimitersOnly);
}
protected TextRange getTextRange(GenericDomValue value, int start, int end) {
if (value instanceof GenericAttributeValue) {
return new TextRange(start, end);
}
TextRange tagRange = XmlTagUtil.getTrimmedValueRange(value.getXmlTag());
return new TextRange(tagRange.getStartOffset() + start - 1, tagRange.getStartOffset() + end - 1);
}
@Override
@@ -201,7 +201,7 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
final Ref<IncorrectOperationException> ref = new Ref<IncorrectOperationException>();
PsiElement element = referenceHandleElementRename(this, newElementName, getSuperElementRenameFunction(ref));
if (!ref.isNull()) {
throw ref.get();
throw ref.get();
}
return element;
@@ -210,9 +210,10 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
@Override
public PsiElement bindToElement(@NotNull final PsiElement element) throws IncorrectOperationException {
final Ref<IncorrectOperationException> ref = new Ref<IncorrectOperationException>();
PsiElement bindElement = referenceBindToElement(this, element, getSuperBindToElementFunction(ref), getSuperElementRenameFunction(ref));
PsiElement bindElement =
referenceBindToElement(this, element, getSuperBindToElementFunction(ref), getSuperElementRenameFunction(ref));
if (!ref.isNull()) {
throw ref.get();
throw ref.get();
}
return bindElement;
@@ -261,16 +262,15 @@ public abstract class DelimitedListConverter<T> extends ResolvingConverter<List<
protected PsiElement referenceBindToElement(final PsiReference psiReference, final PsiElement element,
final Function<PsiElement, PsiElement> superBindToElementFunction,
final Function<String, PsiElement> superElementRenameFunction)
throws IncorrectOperationException {
throws IncorrectOperationException {
return superBindToElementFunction.fun(element);
}
protected PsiElement referenceHandleElementRename(final PsiReference psiReference,
final String newName,
final Function<String, PsiElement> superHandleElementRename)
throws IncorrectOperationException {
throws IncorrectOperationException {
return superHandleElementRename.fun(newName);
}
}
@@ -183,14 +183,11 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
if (node == null) {
return;
}
if (surroundedText == null) {
if (node instanceof TemplateNode) {
if (key.equals(((TemplateNode)node).getTemplateToken().getKey()) && callback.findApplicableTemplates(key).size() > 1) {
callback.startTemplate();
return;
}
if (surroundedText == null && node instanceof TemplateNode) {
if (key.equals(((TemplateNode)node).getTemplateToken().getKey()) && callback.findApplicableTemplates(key).size() > 1) {
callback.startTemplate();
return;
}
callback.deleteTemplateKey(key);
}
PsiElement context = callback.getContext();
@@ -198,6 +195,12 @@ public class ZenCodingTemplate extends CustomLiveTemplateBase {
List<ZenCodingFilter> filters = getFilters(node, context);
filters.addAll(extraFilters);
if (surroundedText == null) {
callback.deleteTemplateKey(key);
// commit is required. otherwise injections placed after caret will be broken
PsiDocumentManager.getInstance(callback.getProject()).commitDocument(callback.getEditor().getDocument());
}
expand(node, generator, filters, surroundedText, callback, expandPrimitiveAbbreviations);
}
@@ -0,0 +1,30 @@
/*
* Copyright 2000-2014 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.lexer;
import com.intellij.openapi.extensions.ExtensionPointName;
import com.intellij.psi.tree.IElementType;
/**
* User: avokin
* Date: 14/03/14
*/
public interface EmbeddedTokenTypesProvider {
ExtensionPointName<EmbeddedTokenTypesProvider> EXTENSION_POINT_NAME = ExtensionPointName.create("com.intellij.embeddedTokenTypesProvider");
String getName();
IElementType getElementType();
}