Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ilya.Kazakevich
2015-04-17 23:22:45 +03:00
16 changed files with 189 additions and 78 deletions
@@ -471,7 +471,9 @@ public abstract class AbstractJavaBlock extends AbstractBlock implements JavaBlo
mySettings.ALIGN_MULTILINE_PARAMETERS_IN_CALLS);
}
else if (childType == JavaTokenType.LPARENTH && nodeType == JavaElementType.PARAMETER_LIST) {
Wrap wrapToUse = getMethodParametersWrap();
ASTNode parent = myNode.getTreeParent();
boolean isLambdaParameterList = parent != null && parent.getElementType() == JavaElementType.LAMBDA_EXPRESSION;
Wrap wrapToUse = isLambdaParameterList ? null : getMethodParametersWrap();
WrappingStrategy wrapStrategy = WrappingStrategy.createDoNotWrapCommaStrategy(wrapToUse);
child = processParenthesisBlock(result, child, wrapStrategy, mySettings.ALIGN_MULTILINE_PARAMETERS);
}
@@ -15,13 +15,10 @@
*/
package com.intellij.psi.formatter.java;
import com.intellij.idea.Bombed;
import com.intellij.openapi.util.TextRange;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.codeStyle.CommonCodeStyleSettings;
import java.util.Calendar;
/**
* Is intended to hold specific java formatting tests for 'wrapping' settings.
*
@@ -475,5 +472,30 @@ public class JavaFormatterWrapTest extends AbstractJavaFormatterTest {
);
}
public void test_Wrap_On_Method_Parameter_Declaration() {
getSettings().METHOD_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
doClassTest(
" public static void main(String[] args) {\n" +
" boolean ssuuuuuuuuuuuuuuuuuuupaaaaaaaaaaaaa = false;\n" +
" soo.ifTrue(ssuuuuuuuuuuuuuuuuuuupaaaaaaaaaaaaa, (v) -> v.setText(\"syyycuuuuuuuuurrrrrrrrrrrrrrennnnnnnnnnnnnnnnnnnnnt\"));\n" +
"}",
"public static void main(String[] args) {\n" +
" boolean ssuuuuuuuuuuuuuuuuuuupaaaaaaaaaaaaa = false;\n" +
" soo.ifTrue(ssuuuuuuuuuuuuuuuuuuupaaaaaaaaaaaaa, (v) -> v.setText(\"syyycuuuuuuuuurrrrrrrrrrrrrrennnnnnnnnnnnnnnnnnnnnt\"));\n" +
"}"
);
getSettings().CALL_PARAMETERS_WRAP = CommonCodeStyleSettings.WRAP_AS_NEEDED;
doClassTest(
" public static void main(String[] args) {\n" +
" boolean ssuuuuuuuuuuuuuuuuuuupaaaaaaaaaaaaa = false;\n" +
" soo.ifTrue(ssuuuuuuuuuuuuuuuuuuupaaaaaaaaaaaaa, (v) -> v.setText(\"syyycuuuuuuuuurrrrrrrrrrrrrrennnnnnnnnnnnnnnnnnnnnt\"));\n" +
"}",
"public static void main(String[] args) {\n" +
" boolean ssuuuuuuuuuuuuuuuuuuupaaaaaaaaaaaaa = false;\n" +
" soo.ifTrue(ssuuuuuuuuuuuuuuuuuuupaaaaaaaaaaaaa,\n" +
" (v) -> v.setText(\"syyycuuuuuuuuurrrrrrrrrrrrrrennnnnnnnnnnnnnnnnnnnnt\"));\n" +
"}"
);
}
}
@@ -7,7 +7,6 @@ import com.intellij.openapi.fileTypes.FileType;
import com.intellij.openapi.fileTypes.FileTypes;
import com.intellij.openapi.fileTypes.PlainTextFileType;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.FilePath;
import com.intellij.openapi.vfs.CharsetToolkit;
@@ -100,10 +99,7 @@ public class FileAwareDocumentContent extends DocumentContentImpl {
@NotNull
private Builder create(@NotNull byte[] content) {
assert myCharset != null;
// TODO: detect charset like in LoadTextUtil (Native2Ascii, etc) ?
Pair<String, Charset> pair = CharsetToolkit.bytesToStringWithCharset(content, myCharset);
myCharset = pair.second;
return create(pair.first);
return create(CharsetToolkit.decodeString(content, myCharset));
}
@NotNull
@@ -22,15 +22,18 @@ import com.intellij.codeInsight.template.Macro;
import com.intellij.codeInsight.template.macro.MacroFactory;
import com.intellij.lexer.Lexer;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.psi.tree.IElementType;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@VisibleForTesting
public class MacroParser {
private static final Logger LOG = Logger.getInstance("#com.intellij.codeInsight.template.impl.MacroParser");
//-----------------------------------------------------------------------------------
public static Expression parse(String expression) {
if (expression.length() == 0) {
@NotNull
public static Expression parse(@Nullable String expression) {
if (StringUtil.isEmpty(expression)) {
return new ConstantNode("");
}
Lexer lexer = new MacroLexer();
@@ -17,20 +17,23 @@
package com.intellij.codeInsight.template.impl;
import com.intellij.codeInsight.template.Expression;
import com.intellij.openapi.util.text.StringUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public class Variable implements Cloneable {
private final String myName;
private boolean myAlwaysStopAt;
private String myExpressionString;
@Nullable private String myExpressionString;
private Expression myExpression = null;
private String myDefaultValueString;
private Expression myDefaultValueExpression;
private final boolean mySkipOnStart;
public Variable(@NotNull String name, Expression expression, Expression defaultValueExpression, boolean alwaysStopAt, boolean skipOnStart) {
public Variable(@NotNull String name, @Nullable Expression expression, @Nullable Expression defaultValueExpression,
boolean alwaysStopAt, boolean skipOnStart) {
myName = name;
myExpression = expression;
myDefaultValueExpression = defaultValueExpression;
@@ -38,23 +41,25 @@ public class Variable implements Cloneable {
mySkipOnStart = skipOnStart;
}
public Variable(String name, String expression, String defaultValueString, boolean alwaysStopAt) {
public Variable(@NotNull String name, @Nullable String expression, @Nullable String defaultValueString, boolean alwaysStopAt) {
myName = name;
myExpressionString = expression;
myDefaultValueString = defaultValueString;
myExpressionString = StringUtil.notNullize(expression);
myDefaultValueString = StringUtil.notNullize(defaultValueString);
myAlwaysStopAt = alwaysStopAt;
mySkipOnStart = false;
}
@NotNull
public String getExpressionString() {
return myExpressionString;
return StringUtil.notNullize(myExpressionString);
}
public void setExpressionString(String expressionString) {
public void setExpressionString(@Nullable String expressionString) {
myExpressionString = expressionString;
myExpression = null;
}
@NotNull
public Expression getExpression() {
if (myExpression == null) {
if (myName.equals(TemplateImpl.SELECTION)) {
@@ -67,15 +72,17 @@ public class Variable implements Cloneable {
return myExpression;
}
@NotNull
public String getDefaultValueString() {
return myDefaultValueString;
return StringUtil.notNullize(myDefaultValueString);
}
public void setDefaultValueString(String defaultValueString) {
public void setDefaultValueString(@Nullable String defaultValueString) {
myDefaultValueString = defaultValueString;
myDefaultValueExpression = null;
}
@NotNull
public Expression getDefaultValueExpression() {
if (myDefaultValueExpression == null) {
myDefaultValueExpression = MacroParser.parse(myDefaultValueString);
@@ -112,14 +119,14 @@ public class Variable implements Cloneable {
if (mySkipOnStart != variable.mySkipOnStart) return false;
if (myDefaultValueString != null ? !myDefaultValueString.equals(variable.myDefaultValueString) : variable.myDefaultValueString != null) return false;
if (myExpressionString != null ? !myExpressionString.equals(variable.myExpressionString) : variable.myExpressionString != null) return false;
if (myName != null ? !myName.equals(variable.myName) : variable.myName != null) return false;
if (!myName.equals(variable.myName)) return false;
return true;
}
public int hashCode() {
int result;
result = (myName != null ? myName.hashCode() : 0);
result = myName.hashCode();
result = 29 * result + (myAlwaysStopAt ? 1 : 0);
result = 29 * result + (mySkipOnStart ? 1 : 0);
result = 29 * result + (myExpressionString != null ? myExpressionString.hashCode() : 0);
@@ -249,7 +249,10 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
}
private static class ComponentTreeCellRenderer extends ColoredTreeCellRenderer {
ComponentTreeCellRenderer() {
private final Component myInitialSelection;
ComponentTreeCellRenderer(Component initialSelection) {
myInitialSelection = initialSelection;
setFont(JBUI.Fonts.label(11));
setBorder(BorderFactory.createEmptyBorder(0, 3, 0, 3));
}
@@ -266,7 +269,7 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
Color background = selected ? UIUtil.getTreeSelectionBackground() : null;
if (value instanceof HierarchyTree.ComponentNode) {
HierarchyTree.ComponentNode componentNode = (HierarchyTree.ComponentNode)value;
Component component = componentNode.getOwnComponent();
Component component = componentNode.getComponent();
Class<?> clazz0 = component.getClass();
Class<?> clazz = clazz0.isAnonymousClass() ? clazz0.getSuperclass() : clazz0;
String name = component.getName();
@@ -284,7 +287,7 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
foreground = PlatformColors.BLUE;
}
if (componentNode.getToSelect() == componentNode.getOwnComponent()) {
if (myInitialSelection == componentNode.getComponent()) {
background = new Color(31, 128, 8, 58);
}
}
@@ -309,13 +312,23 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
}
}
private static TreeModel buildModel(Component c) {
Component parent = c.getParent();
while (parent != null) {
c = parent;
parent = c.getParent();//Find root window
}
return new DefaultTreeModel(new UiInspectorAction.HierarchyTree.ComponentNode(c));
}
private abstract static class HierarchyTree extends JTree implements TreeSelectionListener {
final Component myComponent;
private HierarchyTree(Component c) {
myComponent = c;
setModel(buildModel(c));
setCellRenderer(new ComponentTreeCellRenderer());
setCellRenderer(new ComponentTreeCellRenderer(c));
getSelectionModel().addTreeSelectionListener(this);
new TreeSpeedSearch(this);
}
@@ -323,7 +336,7 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
public void expandPath() {
TreeUtil.expandAll(this);
int count = getRowCount();
ComponentNode node = new ComponentNode(myComponent, myComponent.getParent());
ComponentNode node = new ComponentNode(myComponent);
for (int i = 0; i < count; i++) {
TreePath row = getPathForRow(i);
@@ -344,59 +357,49 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
}
Object component = path.getLastPathComponent();
if (component instanceof ComponentNode) {
Component c = ((ComponentNode)component).getOwnComponent();
Component c = ((ComponentNode)component).getComponent();
onComponentChanged(c);
}
}
private static TreeModel buildModel(Component c) {
return new DefaultTreeModel(new ComponentNode(c, null));
}
public abstract void onComponentChanged(Component c);
private static class ComponentNode extends DefaultMutableTreeNode {
private final Component myParent;
private final Component myToSelect;
private final Component myComponent;
private ComponentNode(Object userObject, Component parent) {
super(userObject);
myParent = parent == null ? SwingUtilities.getWindowAncestor((Component) userObject) : parent;
myToSelect = (Component)userObject;
children = prepareChildren(myToSelect, parent);
private ComponentNode(@NotNull Component component) {
super(component);
myComponent = component;
children = prepareChildren(myComponent);
}
public Component getOwnComponent() {
return myParent;
}
public Component getToSelect() {
return myToSelect;
Component getComponent() {
return myComponent;
}
@Override
public String toString() {
return myParent.getClass().getName();
return myComponent.getClass().getName();
}
@Override
public boolean equals(Object obj) {
return obj instanceof ComponentNode && ((ComponentNode)obj).getOwnComponent() == getOwnComponent();
return obj instanceof ComponentNode && ((ComponentNode)obj).getComponent() == getComponent();
}
@SuppressWarnings("UseOfObsoleteCollectionType")
private static Vector prepareChildren(Component toSelect, Component parent) {
private static Vector prepareChildren(Component parent) {
Vector<ComponentNode> result = new Vector<ComponentNode>();
if (parent == null) {
Container root = SwingUtilities.windowForComponent(toSelect);
for (Component component : root.getComponents()) {
result.add(new ComponentNode(toSelect, component));
if (parent instanceof Container) {
for (Component component : ((Container)parent).getComponents()) {
result.add(new ComponentNode(component));
}
} else {
if (parent instanceof Container) {
for (Component component : ((Container)parent).getComponents()) {
result.add(new ComponentNode(toSelect, component));
}
}
if (parent instanceof Window) {
Window[] children = ((Window)parent).getOwnedWindows();
for (Window child : children) {
if (child instanceof InspectorWindow) continue;
result.add(new ComponentNode(child));
}
}
@@ -817,6 +820,10 @@ public class UiInspectorAction extends ToggleAction implements DumbAware {
public void showInspector(@NotNull Component c) {
InspectorWindow window = myComponentToInspector.get(c);
if (window != null) {
window.myHierarchyTree.setModel(buildModel(c));
window.myHierarchyTree.setCellRenderer(new ComponentTreeCellRenderer(c));
window.myHierarchyTree.expandPath();
window.switchInfo(c);
window.setHighlightingEnabled(true);
window.setVisible(true);
@@ -148,7 +148,7 @@ cannot.start.other.instance.is.running.error.message={0} was unable to create a
button.load.file=Load File
date.frequency=Once {0}
name.label.text=Na&me:
smth.already.exist.error.message={0} with name ''{1}'' already exist.
smth.already.exist.error.message={0} with name ''{1}'' already exists
comparison.policy.default.name=Default
comparison.policy.trim.space.name=Trim space
comparison.policy.ignore.spaces.name=Ignore spaces
@@ -15,7 +15,6 @@
*/
package com.intellij.openapi.vfs;
import com.intellij.openapi.util.Pair;
import com.intellij.util.ArrayUtil;
import gnu.trove.THashMap;
import org.jetbrains.annotations.NonNls;
@@ -297,16 +296,16 @@ public class CharsetToolkit {
@NotNull
public static String bytesToString(@NotNull byte[] bytes, @NotNull final Charset defaultCharset) {
return bytesToStringWithCharset(bytes, defaultCharset).getFirst();
Charset charset = new CharsetToolkit(bytes, defaultCharset).guessEncoding(bytes.length);
if (charset == null) charset = defaultCharset; // binary content. This is silly but method contract says to return something anyway
return decodeString(bytes, charset);
}
@NotNull
public static Pair<String, Charset> bytesToStringWithCharset(@NotNull byte[] bytes, @NotNull final Charset defaultCharset) {
Charset charset = new CharsetToolkit(bytes, defaultCharset).guessEncoding(bytes.length);
if (charset == null) charset = defaultCharset; // binary content. This is silly but method contract says to return something anyway
public static String decodeString(@NotNull byte[] bytes, @NotNull final Charset charset) {
int bomLength = getBOMLength(bytes, charset);
final CharBuffer charBuffer = charset.decode(ByteBuffer.wrap(bytes, bomLength, bytes.length - bomLength));
return Pair.create(charBuffer.toString(), charset);
return charBuffer.toString();
}
public enum GuessedEncoding {
@@ -69,7 +69,7 @@ class TryIdenticalCatches {
catch(ClassNotFoundException cnfe) {
System.out.println();
}
<warning descr="catch branch identical to 'ClassNotFoundException' branch">catch(NumberFormatException nfe)</warning> {
<warning descr="'catch' branch identical to 'ClassNotFoundException' branch">catch(NumberFormatException nfe)</warning> {
System.out.println();
}
}
@@ -86,7 +86,7 @@ class TryIdenticalCatches {
catch(ClassNotFoundException cnfe) {
log(cnfe);
}
<warning descr="catch branch identical to 'ClassNotFoundException' branch">catch(NumberFormatException n<caret>fe)</warning> {
<warning descr="'catch' branch identical to 'ClassNotFoundException' branch">catch(NumberFormatException n<caret>fe)</warning> {
log(nfe);
}
}
@@ -103,9 +103,9 @@ class TryIdenticalCatches {
try {
} catch (E4 e) {
} <warning descr="catch branch identical to 'E4' branch">catch (E2 e)</warning> {
} <warning descr="catch branch identical to 'E4' branch">catch (E3 e)</warning> {
} <warning descr="catch branch identical to 'E2' branch">catch (E1 e)</warning> {
} <warning descr="'catch' branch identical to 'E4' branch">catch (E2 e)</warning> {
} <warning descr="'catch' branch identical to 'E4' branch">catch (E3 e)</warning> {
} <warning descr="'catch' branch identical to 'E2' branch">catch (E1 e)</warning> {
}
}
@@ -127,9 +127,9 @@ class TryIdenticalCatches {
throw new NullPointerException();
} catch (final NullPointerException e) {
causeException = e;
} <warning descr="catch branch identical to 'NullPointerException' branch">catch (final IllegalArgumentException e)</warning> {
} <warning descr="'catch' branch identical to 'NullPointerException' branch">catch (final IllegalArgumentException e)</warning> {
causeException = e;
} <warning descr="catch branch identical to 'NullPointerException' branch">catch (final IndexOutOfBoundsException e)</warning> {
} <warning descr="'catch' branch identical to 'NullPointerException' branch">catch (final IndexOutOfBoundsException e)</warning> {
causeException = e;
}
System.out.println("causeException = " + causeException);
@@ -2,7 +2,7 @@ package com.siyeh.igtest.naming.static_method_naming_convention;
public class StaticMethodNamingConvention
{
public static void <warning descr="static method name 'UpperaseMethod' doesn't match regex '[a-z][A-Za-z\d]*'">UpperaseMethod</warning>()
public static void <warning descr="'static' method name 'UpperaseMethod' doesn't match regex '[a-z][A-Za-z\d]*'">UpperaseMethod</warning>()
{
}
@@ -74,7 +74,7 @@ public abstract class GitRebaseActionBase extends GitRepositoryAction {
GitRepositoryManager manager = GitUtil.getRepositoryManager(project);
manager.updateRepository(root);
root.refresh(false, true);
notifyAboutResult(result, resultListener, exceptions, project);
notifyAboutResult(result, resultListener, editor.wasNoopSituationDetected(), exceptions, project);
}
finally {
DvcsUtil.workingTreeChangeFinished(project, token);
@@ -85,6 +85,7 @@ public abstract class GitRebaseActionBase extends GitRepositoryAction {
private static void notifyAboutResult(@NotNull GitCommandResult commandResult,
@NotNull GitRebaseLineListener resultListener,
boolean noopSituation,
@NotNull List<VcsException> exceptions,
@NotNull Project project) {
final GitRebaseLineListener.Result result = resultListener.getResult();
@@ -110,6 +111,9 @@ public abstract class GitRebaseActionBase extends GitRepositoryAction {
case FINISHED:
isError = false;
messageId = "rebase.result.success";
if (noopSituation) {
message = "Current branch was reset to the base branch";
}
break;
default:
throw new IllegalStateException("Unsupported rebase result: " + result.status);
@@ -67,6 +67,8 @@ public class GitInteractiveRebaseEditorHandler implements Closeable, GitRebaseEd
*/
protected boolean myRebaseEditorShown = false;
private boolean myNoopSituation;
/**
* The constructor from fields that is expected to be
* accessed only from {@link git4idea.rebase.GitRebaseEditorService}.
@@ -138,6 +140,7 @@ public class GitInteractiveRebaseEditorHandler implements Closeable, GitRebaseEd
CommonBundle.getCancelButtonText(), Messages.getQuestionIcon());
if (rebase == Messages.OK) {
isSuccess.set(true);
myNoopSituation = true;
return;
}
}
@@ -183,4 +186,11 @@ public class GitInteractiveRebaseEditorHandler implements Closeable, GitRebaseEd
public int getHandlerNo() {
return myHandlerNo;
}
/**
* Tells if there was a "noop" situation during rebase (no commits were rebase, just the label was moved).
*/
public boolean wasNoopSituationDetected() {
return myNoopSituation;
}
}
@@ -15,6 +15,11 @@
*/
package git4idea.rebase;
import com.intellij.ide.CopyProvider;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.openapi.actionSystem.DataProvider;
import com.intellij.openapi.actionSystem.PlatformDataKeys;
import com.intellij.openapi.ide.CopyPasteManager;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.DialogWrapper;
import com.intellij.openapi.util.text.StringUtil;
@@ -27,11 +32,13 @@ import com.intellij.ui.table.JBTable;
import com.intellij.util.ArrayUtil;
import com.intellij.util.ListWithSelection;
import com.intellij.util.PairFunction;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.ComboBoxTableCellRenderer;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import git4idea.GitUtil;
import git4idea.i18n.GitBundle;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -42,6 +49,7 @@ import javax.swing.event.TableModelEvent;
import javax.swing.event.TableModelListener;
import javax.swing.table.AbstractTableModel;
import javax.swing.table.TableColumn;
import java.awt.datatransfer.StringSelection;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.io.IOException;
@@ -53,7 +61,7 @@ import java.util.List;
* Editor for rebase entries. It allows reordering of
* the entries and changing commit status.
*/
public class GitRebaseEditor extends DialogWrapper {
public class GitRebaseEditor extends DialogWrapper implements DataProvider {
/**
* The table that lists all commits
*/
@@ -79,6 +87,8 @@ public class GitRebaseEditor extends DialogWrapper {
*/
private final MyTableModel myTableModel;
@NotNull private final CopyProvider myCopyProvider;
/**
* The constructor
*
@@ -143,6 +153,7 @@ public class GitRebaseEditor extends DialogWrapper {
});
installSpeedSearch();
myCopyProvider = new MyCopyProvider();
adjustColumnWidth(0);
adjustColumnWidth(1);
@@ -224,6 +235,15 @@ public class GitRebaseEditor extends DialogWrapper {
return myTableModel.myEntries;
}
@Nullable
@Override
public Object getData(@NonNls String dataId) {
if (PlatformDataKeys.COPY_PROVIDER.is(dataId)) {
return myCopyProvider;
}
return null;
}
/**
* The table model for the commits
@@ -325,6 +345,15 @@ public class GitRebaseEditor extends DialogWrapper {
}
}
@Nullable
public String getStringToCopy(int row) {
if (row < 0 || row >= myEntries.size()) {
return null;
}
GitRebaseEntry e = myEntries.get(row);
return e.getCommit() + " " + e.getSubject();
}
private void setSelection(ContiguousIntIntervalTracker intervalBuilder) {
myCommitsTable.getSelectionModel().setSelectionInterval(intervalBuilder.getMin(), intervalBuilder.getMax());
}
@@ -373,6 +402,7 @@ public class GitRebaseEditor extends DialogWrapper {
assert rowIndex < myEntries.size();
}
}
}
private static class ContiguousIntIntervalTracker {
@@ -445,4 +475,24 @@ public class GitRebaseEditor extends DialogWrapper {
}
}
private class MyCopyProvider implements CopyProvider {
@Override
public void performCopy(@NotNull DataContext dataContext) {
List<String> data = ContainerUtil.newArrayList();
for (int row : myCommitsTable.getSelectedRows()) {
data.add(myTableModel.getStringToCopy(row));
}
CopyPasteManager.getInstance().setContents(new StringSelection(StringUtil.join(data, "\n")));
}
@Override
public boolean isCopyEnabled(@NotNull DataContext dataContext) {
return myCommitsTable.getSelectedRowCount() > 0;
}
@Override
public boolean isCopyVisible(@NotNull DataContext dataContext) {
return true;
}
}
}
+1 -1
View File
@@ -1,4 +1,4 @@
class Foo {
}
print <warning descr="Type 'Foo' doesnt implement Comparable"><warning descr="Type 'Foo' cannot be iterated in range because it does not have method 'previous()'"><warning descr="Type 'Foo' cannot be iterated in range because it does not have method 'next()'">new Foo()..new Foo()</warning></warning></warning>
print <warning descr="Type 'Foo' cannot be iterated in range because it does not have method 'next()'"><warning descr="Type 'Foo' cannot be iterated in range because it does not have method 'previous()'"><warning descr="Type 'Foo' doesn't implement Comparable">new Foo()..new Foo()</warning></warning></warning>
@@ -48,7 +48,9 @@ public class PythonEnterHandler extends EnterHandlerDelegateAdapter {
private int myPostprocessShift = 0;
public static final Class[] IMPLICIT_WRAP_CLASSES = new Class[] {
PySequenceExpression.class,
PyListLiteralExpression.class,
PySetLiteralExpression.class,
PyDictLiteralExpression.class,
PyDictLiteralExpression.class,
PyParenthesizedExpression.class,
PyArgumentList.class,
@@ -464,4 +464,13 @@ public class PyEditingTest extends PyTestCase {
doTestEnter("(\"some <caret>string\", 1)", "(\"some \"\n" +
" \"string\", 1)");
}
// PY-15609
public void testEnterInStringInTupleWithoutParenthesis() {
doTestEnter("def hello_world():\n" +
" return bar, 'so<caret>me'",
"def hello_world():\n" +
" return bar, 'so' \\\n" +
" 'me'");
}
}