mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -109,7 +109,6 @@ public abstract class JavaTestFrameworkRunnableState<T extends ModuleBasedConfig
|
||||
return null;
|
||||
}
|
||||
getJavaParameters().getVMParametersList().addProperty("idea." + getFrameworkId() + ".sm_runner");
|
||||
getJavaParameters().getClassPath().addFirst(PathUtil.getJarPathForClass(ServiceMessageTypes.class));
|
||||
|
||||
final RunnerSettings runnerSettings = getRunnerSettings();
|
||||
|
||||
|
||||
+1
-1
@@ -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.formatting.Block;
|
||||
import com.intellij.formatting.FormattingModel;
|
||||
+25
@@ -71,4 +71,29 @@ public class DetectIndentAndTypeTest extends LightPlatformCodeInsightFixtureTest
|
||||
"\t}\n" +
|
||||
"}\n");
|
||||
}
|
||||
|
||||
public void testWhenTabsDetected_SetContinuationIndentSizeToDoubleTabSize() {
|
||||
CommonCodeStyleSettings common = mySettings.getCommonSettings(JavaLanguage.INSTANCE);
|
||||
CommonCodeStyleSettings.IndentOptions indentOptions = common.getIndentOptions();
|
||||
|
||||
assert indentOptions != null;
|
||||
|
||||
indentOptions.INDENT_SIZE = 1;
|
||||
indentOptions.TAB_SIZE = 2;
|
||||
indentOptions.CONTINUATION_INDENT_SIZE = 8;
|
||||
|
||||
myFixture.configureByText(JavaFileType.INSTANCE,
|
||||
"public class T {\n" +
|
||||
"\tvoid run() {\n" +
|
||||
"\t\tint a = 2 <caret>+ 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<caret>+ 2;\n" +
|
||||
"\t}\n" +
|
||||
"}\n");
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -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;
|
||||
+1
-1
@@ -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;
|
||||
@@ -26,6 +26,7 @@ public class CachesBasedRefSearcher extends QueryExecutorBase<PsiReference, Refe
|
||||
@Override
|
||||
public void processQuery(@NotNull ReferencesSearch.SearchParameters p, @NotNull Processor<PsiReference> 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<PsiReference, Refe
|
||||
if (vFile != null) {
|
||||
text = vFile.getNameWithoutExtension();
|
||||
}
|
||||
// We must not look for file references with the file language's case-sensitivity,
|
||||
// since case-sensitivity of the references themselves depends either on file system
|
||||
// or on the rules of the language of reference
|
||||
caseSensitive = false;
|
||||
}
|
||||
else if (refElement instanceof PsiNamedElement) {
|
||||
text = ((PsiNamedElement)refElement).getName();
|
||||
@@ -48,7 +53,7 @@ public class CachesBasedRefSearcher extends QueryExecutorBase<PsiReference, Refe
|
||||
}
|
||||
if (StringUtil.isNotEmpty(text)) {
|
||||
final SearchScope searchScope = p.getEffectiveSearchScope();
|
||||
p.getOptimizer().searchWord(text, searchScope, refElement.getLanguage().isCaseSensitive(), refElement);
|
||||
p.getOptimizer().searchWord(text, searchScope, caseSensitive, refElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
+1
@@ -82,6 +82,7 @@ public class IndentOptionsDetectorImpl implements IndentOptionsDetector {
|
||||
if (linesWithTabs > 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);
|
||||
|
||||
@@ -323,7 +323,9 @@
|
||||
<action id="ParameterInfo">
|
||||
<keyboard-shortcut first-keystroke="shift meta P" />
|
||||
</action>
|
||||
<action id="ExpressionTypeInfo"/>
|
||||
<action id="ExpressionTypeInfo">
|
||||
<keyboard-shortcut first-keystroke="control alt P" />
|
||||
</action>
|
||||
<action id="PreviousEditorTab" />
|
||||
<action id="PreviousProjectWindow" />
|
||||
<action id="Print">
|
||||
|
||||
@@ -137,10 +137,13 @@ public abstract class XLineBreakpointType<P extends XBreakpointProperties> exten
|
||||
public abstract class XLineBreakpointVariant {
|
||||
public abstract String getText();
|
||||
|
||||
@Nullable
|
||||
public abstract Icon getIcon();
|
||||
|
||||
@Nullable
|
||||
public abstract TextRange getHighlightRange();
|
||||
|
||||
@Nullable
|
||||
public abstract P createProperties();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -189,6 +189,21 @@ public class XDebuggerUtilImpl extends XDebuggerUtil {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// calculate default item
|
||||
int caretOffset = editor.getCaretModel().getOffset();
|
||||
XLineBreakpointType<P>.XLineBreakpointVariant defaultVariant = null;
|
||||
for (XLineBreakpointType<P>.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<XLineBreakpointType.XLineBreakpointVariant>("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);
|
||||
|
||||
@@ -9,7 +9,5 @@
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="JUnit4" level="project" />
|
||||
<orderEntry type="module" module-name="java-runtime" />
|
||||
<orderEntry type="library" name="tcServiceMessages" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
</module>
|
||||
@@ -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) {
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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<String, String> attributes) {
|
||||
String text = "##teamcity[" + messageName;
|
||||
for (final String attrName : attributes.keySet()) {
|
||||
text += " " + attrName + "='" + escapeStr(attributes.get(attrName), STD_ESCAPER) + "'";
|
||||
}
|
||||
text += "]";
|
||||
return text;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,7 +8,6 @@
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="TestNG" level="project" />
|
||||
<orderEntry type="library" name="tcServiceMessages" level="project" />
|
||||
<orderEntry type="module" module-name="java-runtime" />
|
||||
</component>
|
||||
</module>
|
||||
Reference in New Issue
Block a user