diff --git a/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java b/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java index 827fd3f2dfd7..a43e62da7138 100644 --- a/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java +++ b/java/execution/impl/src/com/intellij/execution/JavaTestFrameworkRunnableState.java @@ -109,7 +109,6 @@ public abstract class JavaTestFrameworkRunnableState+ 2;\n" + + "\t}\n" + + "}\n"); + myFixture.type('\n'); + myFixture.checkResult("public class T {\n" + + "\tvoid run() {\n" + + "\t\tint a = 2 \n" + + "\t\t\t\t+ 2;\n" + + "\t}\n" + + "}\n"); + } } diff --git a/java/java-tests/testSrc/com/intellij/psi/autodetect/JavaAutoDetectIndentTest.java b/java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/JavaAutoDetectIndentTest.java similarity index 97% rename from java/java-tests/testSrc/com/intellij/psi/autodetect/JavaAutoDetectIndentTest.java rename to java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/JavaAutoDetectIndentTest.java index f1b90dced63d..70bca2a7fd66 100644 --- a/java/java-tests/testSrc/com/intellij/psi/autodetect/JavaAutoDetectIndentTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/JavaAutoDetectIndentTest.java @@ -13,10 +13,11 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.psi.autodetect; +package com.intellij.psi.codeStyle.autodetect; import com.intellij.JavaTestUtil; import com.intellij.openapi.fileTypes.PlainTextLanguage; +import com.intellij.psi.autodetect.AbstractIndentAutoDetectionTest; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; import com.intellij.psi.codeStyle.autodetect.LineIndentInfo; import com.intellij.psi.codeStyle.autodetect.LineIndentInfoBuilder; diff --git a/java/java-tests/testSrc/com/intellij/psi/autodetect/NewLineBlocksIteratorTest.java b/java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/NewLineBlocksIteratorTest.java similarity index 96% rename from java/java-tests/testSrc/com/intellij/psi/autodetect/NewLineBlocksIteratorTest.java rename to java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/NewLineBlocksIteratorTest.java index 25c4416ad73a..2e3269ff02b9 100644 --- a/java/java-tests/testSrc/com/intellij/psi/autodetect/NewLineBlocksIteratorTest.java +++ b/java/java-tests/testSrc/com/intellij/psi/codeStyle/autodetect/NewLineBlocksIteratorTest.java @@ -13,7 +13,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ -package com.intellij.psi.autodetect; +package com.intellij.psi.codeStyle.autodetect; import com.intellij.JavaTestUtil; import org.jetbrains.annotations.NotNull; diff --git a/platform/indexing-impl/src/com/intellij/psi/impl/search/CachesBasedRefSearcher.java b/platform/indexing-impl/src/com/intellij/psi/impl/search/CachesBasedRefSearcher.java index 56a2229e9fac..c09e67ccf6b9 100644 --- a/platform/indexing-impl/src/com/intellij/psi/impl/search/CachesBasedRefSearcher.java +++ b/platform/indexing-impl/src/com/intellij/psi/impl/search/CachesBasedRefSearcher.java @@ -26,6 +26,7 @@ public class CachesBasedRefSearcher extends QueryExecutorBase consumer) { final PsiElement refElement = p.getElementToSearch(); + boolean caseSensitive = refElement.getLanguage().isCaseSensitive(); String text = null; if (refElement instanceof PsiFileSystemItem && !(refElement instanceof SyntheticFileSystemItem)) { @@ -33,6 +34,10 @@ public class CachesBasedRefSearcher extends QueryExecutorBase linesWithWhiteSpaceIndent) { setUseTabs(indentOptions, true); indentOptions.INDENT_SIZE = indentOptions.TAB_SIZE; + indentOptions.CONTINUATION_INDENT_SIZE = indentOptions.TAB_SIZE * 2; } else if (linesWithWhiteSpaceIndent > linesWithTabs) { setUseTabs(indentOptions, false); diff --git a/platform/platform-resources/src/idea/Keymap_Xcode.xml b/platform/platform-resources/src/idea/Keymap_Xcode.xml index c814b66d3f87..717ec356eb7e 100644 --- a/platform/platform-resources/src/idea/Keymap_Xcode.xml +++ b/platform/platform-resources/src/idea/Keymap_Xcode.xml @@ -323,7 +323,9 @@ - + + + diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XLineBreakpointType.java b/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XLineBreakpointType.java index 32e35eded48e..09b4a7b550e0 100644 --- a/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XLineBreakpointType.java +++ b/platform/xdebugger-api/src/com/intellij/xdebugger/breakpoints/XLineBreakpointType.java @@ -137,10 +137,13 @@ public abstract class XLineBreakpointType

exten public abstract class XLineBreakpointVariant { public abstract String getText(); + @Nullable public abstract Icon getIcon(); + @Nullable public abstract TextRange getHighlightRange(); + @Nullable public abstract P createProperties(); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java index 6f4a761df82d..f55e80100183 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebuggerUtilImpl.java @@ -189,6 +189,21 @@ public class XDebuggerUtilImpl extends XDebuggerUtil { } } } + + // calculate default item + int caretOffset = editor.getCaretModel().getOffset(); + XLineBreakpointType

.XLineBreakpointVariant defaultVariant = null; + for (XLineBreakpointType

.XLineBreakpointVariant variant : variants) { + TextRange range = variant.getHighlightRange(); + if (range != null && range.contains(caretOffset)) { + //noinspection ConstantConditions + if (defaultVariant == null || defaultVariant.getHighlightRange().getLength() > range.getLength()) { + defaultVariant = variant; + } + } + } + final int defaultIndex = defaultVariant != null ? variants.indexOf(defaultVariant) : 0; + final MySelectionListener selectionListener = new MySelectionListener(); ListPopup popup = JBPopupFactory.getInstance().createListPopup( new BaseListPopupStep("Create breakpoint for", variants) { @@ -220,6 +235,11 @@ public class XDebuggerUtilImpl extends XDebuggerUtil { }); return FINAL_CHOICE; } + + @Override + public int getDefaultOptionIndex() { + return defaultIndex; + } }); popup.addListSelectionListener(selectionListener); popup.show(relativePoint); diff --git a/plugins/junit_rt/junit_rt.iml b/plugins/junit_rt/junit_rt.iml index 37653b53cb5a..28dc623b5f2d 100644 --- a/plugins/junit_rt/junit_rt.iml +++ b/plugins/junit_rt/junit_rt.iml @@ -9,7 +9,5 @@ - - - + \ No newline at end of file diff --git a/plugins/junit_rt/src/com/intellij/junit3/JUnit3IdeaTestRunner.java b/plugins/junit_rt/src/com/intellij/junit3/JUnit3IdeaTestRunner.java index 27ada8d3b4b9..e7bd2692b04b 100644 --- a/plugins/junit_rt/src/com/intellij/junit3/JUnit3IdeaTestRunner.java +++ b/plugins/junit_rt/src/com/intellij/junit3/JUnit3IdeaTestRunner.java @@ -18,8 +18,6 @@ package com.intellij.junit3; import com.intellij.rt.execution.junit.*; import com.intellij.rt.execution.junit.segments.OutputObjectRegistry; import com.intellij.rt.execution.junit.segments.PacketProcessor; -import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; -import jetbrains.buildServer.messages.serviceMessages.ServiceMessageTypes; import junit.framework.*; import junit.textui.ResultPrinter; import junit.textui.TestRunner; @@ -179,7 +177,7 @@ public class JUnit3IdeaTestRunner extends TestRunner implements IdeaTestRunner { final Map attrs = new HashMap(); attrs.put("name", getMethodName(test)); attrs.put("message", failureMessage != null ? failureMessage : ""); - System.out.println(ServiceMessage.asString(ServiceMessageTypes.TEST_FAILED, attrs)); + System.out.println(MapSerializerUtil.asString(MapSerializerUtil.TEST_FAILED, attrs)); } private static String getMethodName(Test test) { diff --git a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java index 9b21ca5fe63f..7d9ceb6a2ec2 100644 --- a/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java +++ b/plugins/junit_rt/src/com/intellij/junit4/JUnit4TestListener.java @@ -21,9 +21,7 @@ package com.intellij.junit4; import com.intellij.rt.execution.junit.ComparisonFailureData; -import jetbrains.buildServer.messages.serviceMessages.MapSerializerUtil; -import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; -import jetbrains.buildServer.messages.serviceMessages.ServiceMessageTypes; +import com.intellij.rt.execution.junit.MapSerializerUtil; import junit.framework.ComparisonFailure; import org.junit.Ignore; import org.junit.runner.Description; @@ -140,11 +138,11 @@ public class JUnit4TestListener extends RunListener { //class setUp failed if (methodName == null) { for (Iterator iterator = description.getChildren().iterator(); iterator.hasNext(); ) { - testFailure(failure, ServiceMessageTypes.TEST_FAILED, getFullMethodName((Description)iterator.next())); + testFailure(failure, MapSerializerUtil.TEST_FAILED, getFullMethodName((Description)iterator.next())); } } else { - testFailure(failure, ServiceMessageTypes.TEST_FAILED, methodName); + testFailure(failure, MapSerializerUtil.TEST_FAILED, methodName); } } @@ -168,7 +166,7 @@ public class JUnit4TestListener extends RunListener { ComparisonFailureData.registerSMAttributes(null, stringWriter.toString(), e.getMessage(), attrs, e); } finally { - myPrintStream.println(ServiceMessage.asString(messageName, attrs)); + myPrintStream.println(MapSerializerUtil.asString(messageName, attrs)); } } @@ -204,7 +202,7 @@ public class JUnit4TestListener extends RunListener { private void testAssumptionFailure(Failure failure, Description testDescription, String name) throws Exception { testStarted(testDescription); - testFailure(failure, ServiceMessageTypes.TEST_IGNORED, name); + testFailure(failure, MapSerializerUtil.TEST_IGNORED, name); testFinished(testDescription); } @@ -224,7 +222,7 @@ public class JUnit4TestListener extends RunListener { //junit < 4.4 } attrs.put("name", getFullMethodName(description)); - myPrintStream.println(ServiceMessage.asString(ServiceMessageTypes.TEST_IGNORED, attrs)); + myPrintStream.println(MapSerializerUtil.asString(MapSerializerUtil.TEST_IGNORED, attrs)); testFinished(description); } diff --git a/plugins/junit_rt/src/com/intellij/rt/execution/junit/MapSerializerUtil.java b/plugins/junit_rt/src/com/intellij/rt/execution/junit/MapSerializerUtil.java new file mode 100644 index 000000000000..dbe9bd597737 --- /dev/null +++ b/plugins/junit_rt/src/com/intellij/rt/execution/junit/MapSerializerUtil.java @@ -0,0 +1,123 @@ +/* + * Copyright 2000-2015 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.rt.execution.junit; + + +import java.util.Iterator; +import java.util.Map; + +public class MapSerializerUtil { + public static final String TEST_FAILED = "testFailed"; + public static final String TEST_IGNORED = "testIgnored"; + + + /** + * String escaping info provider. + */ + public interface EscapeInfoProvider { + /** + * Converts character to its representation in the final string + * @param c character to convert + * @return character representation or 0 if conversion is not applicable to that character + */ + char escape(char c); + + /** + * Escape character to use before escaped characters (before character representations generated by {@link #escape(char)} method) + * @return see above + */ + char escapeCharacter(); + } + + public static final EscapeInfoProvider STD_ESCAPER = new EscapeInfoProvider() { + public char escape(final char c) { + switch (c) { + case '\n': return 'n'; + case '\r': return 'r'; + case '\u0085': return 'x'; // next-line character + case '\u2028': return 'l'; // line-separator character + case '\u2029': return 'p'; // paragraph-separator character + case '|': return '|'; + case '\'': return '\''; + case '[': return '['; + case ']': return ']'; + default:return 0; + } + } + + public char escapeCharacter() { + return '|'; + } + }; + + /** + * Escapes characters specified by provider with '\' and specified character. + * @param str initial string + * @param p escape info provider. + * @return escaped string. + */ + public static String escapeStr(final String str, EscapeInfoProvider p) { + if (str == null) return null; + int finalCount = calcFinalEscapedStringCount(str, p); + + if (str.length() == finalCount) return str; + + char[] resultChars = new char[finalCount]; + int resultPos = 0; + for (int i = 0; i < str.length(); i++) { + char c = str.charAt(i); + final char escaped = p.escape(c); + if (escaped != 0) { + resultChars[resultPos++] = p.escapeCharacter(); + resultChars[resultPos++] = escaped; + } + else { + resultChars[resultPos++] = c; + } + } + + if (resultPos != finalCount) { + throw new RuntimeException("Incorrect escaping for '" + str + "'"); + } + return new String(resultChars); + } + + private static int calcFinalEscapedStringCount(final String name, final EscapeInfoProvider p) { + int result = 0; + for (int i = 0; i < name.length(); i++) { + char c = name.charAt(i); + if (p.escape(c) != 0) { + result += 2; + } + else { + result += 1; + } + } + + return result; + } + + public static String asString(final String messageName, final Map attributes) { + String text = "##teamcity[" + messageName; + for (Iterator iterator = attributes.keySet().iterator(); iterator.hasNext(); ) { + final Object attrName = iterator.next(); + text += " " + attrName + "='" + escapeStr((String)attributes.get(attrName), STD_ESCAPER) + "'"; + } + text += "]"; + return text; + } + +} diff --git a/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java b/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java index 08fe21a74286..6ce51491d450 100644 --- a/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java +++ b/plugins/testng_rt/src/org/testng/IDEATestNGRemoteListener.java @@ -1,9 +1,6 @@ package org.testng; import com.intellij.rt.execution.junit.ComparisonFailureData; -import jetbrains.buildServer.messages.serviceMessages.MapSerializerUtil; -import jetbrains.buildServer.messages.serviceMessages.ServiceMessage; -import jetbrains.buildServer.messages.serviceMessages.ServiceMessageTypes; import org.testng.internal.IResultListener; import org.testng.xml.XmlTest; @@ -166,7 +163,7 @@ public class IDEATestNGRemoteListener implements ISuiteListener, IResultListener notification = null; } ComparisonFailureData.registerSMAttributes(notification, getTrace(ex), failureMessage, attrs, ex); - myPrintStream.println(ServiceMessage.asString(ServiceMessageTypes.TEST_FAILED, attrs)); + myPrintStream.println(MapSerializerUtil.asString("testFailed", attrs)); onTestFinished(result); } diff --git a/plugins/testng_rt/src/org/testng/MapSerializerUtil.java b/plugins/testng_rt/src/org/testng/MapSerializerUtil.java new file mode 100644 index 000000000000..0d28976e66e0 --- /dev/null +++ b/plugins/testng_rt/src/org/testng/MapSerializerUtil.java @@ -0,0 +1,122 @@ +/* + * Copyright 2000-2015 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.testng; + + +import java.util.Iterator; +import java.util.Map; + +public class MapSerializerUtil { + private static final String STD_EX_SUFFIX = + "Valid property list format is (name( )*=( )*\'escaped_value\'( )*)* where escape simbol is \"|\""; + + + /** + * String escaping info provider. + */ + public interface EscapeInfoProvider { + /** + * Converts character to its representation in the final string + * @param c character to convert + * @return character representation or 0 if conversion is not applicable to that character + */ + char escape(char c); + + /** + * Escape character to use before escaped characters (before character representations generated by {@link #escape(char)} method) + * @return see above + */ + char escapeCharacter(); + } + + public static final EscapeInfoProvider STD_ESCAPER = new EscapeInfoProvider() { + public char escape(final char c) { + switch (c) { + case '\n': return 'n'; + case '\r': return 'r'; + case '\u0085': return 'x'; // next-line character + case '\u2028': return 'l'; // line-separator character + case '\u2029': return 'p'; // paragraph-separator character + case '|': return '|'; + case '\'': return '\''; + case '[': return '['; + case ']': return ']'; + default:return 0; + } + } + + public char escapeCharacter() { + return '|'; + } + }; + + /** + * Escapes characters specified by provider with '\' and specified character. + * @param str initial string + * @param p escape info provider. + * @return escaped string. + */ + public static String escapeStr(final String str, EscapeInfoProvider p) { + if (str == null) return null; + int finalCount = calcFinalEscapedStringCount(str, p); + + if (str.length() == finalCount) return str; + + char[] resultChars = new char[finalCount]; + int resultPos = 0; + for (int i = 0; i < str.length(); i++) { + char c = str.charAt(i); + final char escaped = p.escape(c); + if (escaped != 0) { + resultChars[resultPos++] = p.escapeCharacter(); + resultChars[resultPos++] = escaped; + } + else { + resultChars[resultPos++] = c; + } + } + + if (resultPos != finalCount) { + throw new RuntimeException("Incorrect escaping for '" + str + "'"); + } + return new String(resultChars); + } + + private static int calcFinalEscapedStringCount(final String name, final EscapeInfoProvider p) { + int result = 0; + for (int i = 0; i < name.length(); i++) { + char c = name.charAt(i); + if (p.escape(c) != 0) { + result += 2; + } + else { + result += 1; + } + } + + return result; + } + + public static String asString(final String messageName, final Map attributes) { + String text = "##teamcity[" + messageName; + for (final String attrName : attributes.keySet()) { + text += " " + attrName + "='" + escapeStr(attributes.get(attrName), STD_ESCAPER) + "'"; + } + text += "]"; + return text; + } + +} diff --git a/plugins/testng_rt/testng_rt.iml b/plugins/testng_rt/testng_rt.iml index 3921608b92b4..f347fc89bc27 100644 --- a/plugins/testng_rt/testng_rt.iml +++ b/plugins/testng_rt/testng_rt.iml @@ -8,7 +8,6 @@ - \ No newline at end of file