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:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -18,11 +18,12 @@ package com.intellij.debugger.engine;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Created by Egor on 04.10.2014.
|
||||
* @author egor
|
||||
*/
|
||||
public interface FullValueEvaluatorProvider {
|
||||
@NotNull XFullValueEvaluator getFullValueEvaluator(EvaluationContextImpl evaluationContext, ValueDescriptorImpl valueDescriptor);
|
||||
@Nullable
|
||||
XFullValueEvaluator getFullValueEvaluator(EvaluationContextImpl evaluationContext, ValueDescriptorImpl valueDescriptor);
|
||||
}
|
||||
|
||||
@@ -146,7 +146,11 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
|
||||
presentation = new JavaValuePresentation(value, myValueDescriptor.getIdLabel(), exception != null ? exception.getMessage() : null, myValueDescriptor);
|
||||
|
||||
if (myValueDescriptor.getLastRenderer() instanceof FullValueEvaluatorProvider) {
|
||||
node.setFullValueEvaluator(((FullValueEvaluatorProvider)myValueDescriptor.getLastRenderer()).getFullValueEvaluator(myEvaluationContext, myValueDescriptor));
|
||||
XFullValueEvaluator evaluator = ((FullValueEvaluatorProvider)myValueDescriptor.getLastRenderer())
|
||||
.getFullValueEvaluator(myEvaluationContext, myValueDescriptor);
|
||||
if (evaluator != null) {
|
||||
node.setFullValueEvaluator(evaluator);
|
||||
}
|
||||
}
|
||||
else if (value.length() > XValueNode.MAX_VALUE_LENGTH) {
|
||||
node.setFullValueEvaluator(new XFullValueEvaluator() {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.debugger.settings;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.ui.tree.ValueDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.CompoundReferenceRenderer;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.util.ui.ColorIcon;
|
||||
import com.sun.jdi.*;
|
||||
@@ -29,20 +28,11 @@ import java.awt.*;
|
||||
/**
|
||||
* Created by Egor on 04.10.2014.
|
||||
*/
|
||||
class ColorObjectRenderer extends CompoundReferenceRenderer {
|
||||
|
||||
class ColorObjectRenderer extends ToStringBasedRenderer {
|
||||
public ColorObjectRenderer(final NodeRendererSettings rendererSettings) {
|
||||
super(rendererSettings, "Color", null, null);
|
||||
setClassName("java.awt.Color");
|
||||
}
|
||||
|
||||
public String calcLabel(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener) throws
|
||||
EvaluateException {
|
||||
String res = calcToStringLabel(descriptor, evaluationContext, listener);
|
||||
if (res != null) {
|
||||
return res;
|
||||
}
|
||||
return super.calcLabel(descriptor, evaluationContext, listener);
|
||||
setEnabled(true);
|
||||
}
|
||||
|
||||
public Icon calcValueIcon(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener) throws EvaluateException {
|
||||
@@ -55,6 +45,7 @@ class ColorObjectRenderer extends CompoundReferenceRenderer {
|
||||
if (valueField != null) {
|
||||
final Value rgbValue = objRef.getValue(valueField);
|
||||
if (rgbValue instanceof IntegerValue) {
|
||||
@SuppressWarnings("UseJBColor")
|
||||
final Color color = new Color(((IntegerValue)rgbValue).value(), true);
|
||||
return new ColorIcon(16, 12, color, true);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,64 @@
|
||||
/*
|
||||
* 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.debugger.settings;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.FullValueEvaluatorProvider;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import com.sun.jdi.*;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public class GraphicsObjectRenderer extends ToStringBasedRenderer implements FullValueEvaluatorProvider {
|
||||
public GraphicsObjectRenderer(final NodeRendererSettings rendererSettings) {
|
||||
super(rendererSettings, "Graphics", null, null);
|
||||
setClassName("sun.java2d.SunGraphics2D");
|
||||
setEnabled(true);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public XFullValueEvaluator getFullValueEvaluator(final EvaluationContextImpl evaluationContext, final ValueDescriptorImpl valueDescriptor) {
|
||||
try {
|
||||
ObjectReference value = (ObjectReference)valueDescriptor.getValue();
|
||||
Field surfaceField = ((ClassType)value.type()).fieldByName("surfaceData");
|
||||
if (surfaceField == null) return null;
|
||||
ObjectReference surfaceDataValue = (ObjectReference)value.getValue(surfaceField);
|
||||
final Field bufImgField = ((ClassType)surfaceDataValue.type()).fieldByName("bufImg");
|
||||
if (bufImgField == null) return null;
|
||||
final Value bufImgValue = surfaceDataValue.getValue(bufImgField);
|
||||
Type type = bufImgValue.type();
|
||||
if (!(type instanceof ReferenceType) || !DebuggerUtils.instanceOf(type, "java.awt.Image")) {
|
||||
return null;
|
||||
}
|
||||
return new CustomPopupFullValueEvaluator(DebuggerBundle.message("message.node.show.image"), evaluationContext) {
|
||||
@Override
|
||||
protected JComponent createComponent() {
|
||||
return ImageObjectRenderer.createIconViewer(ImageObjectRenderer.getIcon(myEvaluationContext, bufImgValue,
|
||||
"imageToBytes"));
|
||||
}
|
||||
};
|
||||
} catch (Exception ignored) {}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -15,37 +15,28 @@
|
||||
*/
|
||||
package com.intellij.debugger.settings;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.engine.FullValueEvaluatorProvider;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.debugger.ui.tree.ValueDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.CompoundReferenceRenderer;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
/**
|
||||
* Created by Egor on 04.10.2014.
|
||||
*/
|
||||
class IconObjectRenderer extends CompoundReferenceRenderer implements FullValueEvaluatorProvider {
|
||||
|
||||
class IconObjectRenderer extends ToStringBasedRenderer implements FullValueEvaluatorProvider {
|
||||
public IconObjectRenderer(final NodeRendererSettings rendererSettings) {
|
||||
super(rendererSettings, "Icon", null, null);
|
||||
setClassName("javax.swing.Icon");
|
||||
}
|
||||
|
||||
public String calcLabel(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener) throws
|
||||
EvaluateException {
|
||||
String res = calcToStringLabel(descriptor, evaluationContext, listener);
|
||||
if (res != null) {
|
||||
return res;
|
||||
}
|
||||
return super.calcLabel(descriptor, evaluationContext, listener);
|
||||
setEnabled(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -55,10 +46,10 @@ class IconObjectRenderer extends CompoundReferenceRenderer implements FullValueE
|
||||
return ImageObjectRenderer.getIcon(evaluationContext, descriptor.getValue(), getterName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
@Override
|
||||
public XFullValueEvaluator getFullValueEvaluator(final EvaluationContextImpl evaluationContext, final ValueDescriptorImpl valueDescriptor) {
|
||||
return new CustomPopupFullValueEvaluator(" (Show icon)", evaluationContext) {
|
||||
return new CustomPopupFullValueEvaluator(DebuggerBundle.message("message.node.show.icon"), evaluationContext) {
|
||||
@Override
|
||||
protected JComponent createComponent() {
|
||||
return ImageObjectRenderer.createIconViewer(ImageObjectRenderer.getIcon(myEvaluationContext, valueDescriptor.getValue(), "iconToBytes"));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -15,20 +15,17 @@
|
||||
*/
|
||||
package com.intellij.debugger.settings;
|
||||
|
||||
import com.intellij.debugger.DebuggerBundle;
|
||||
import com.intellij.debugger.engine.DebugProcess;
|
||||
import com.intellij.debugger.engine.FullValueEvaluatorProvider;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContextImpl;
|
||||
import com.intellij.debugger.ui.impl.watch.ValueDescriptorImpl;
|
||||
import com.intellij.debugger.ui.tree.ValueDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.CompoundReferenceRenderer;
|
||||
import com.intellij.debugger.ui.tree.render.DescriptorLabelListener;
|
||||
import com.intellij.rt.debugger.ImageSerializer;
|
||||
import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import com.sun.jdi.*;
|
||||
import org.intellij.images.editor.impl.ImageEditorManagerImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -40,25 +37,17 @@ import java.util.List;
|
||||
/**
|
||||
* Created by Egor on 04.10.2014.
|
||||
*/
|
||||
class ImageObjectRenderer extends CompoundReferenceRenderer implements FullValueEvaluatorProvider {
|
||||
class ImageObjectRenderer extends ToStringBasedRenderer implements FullValueEvaluatorProvider {
|
||||
public ImageObjectRenderer(final NodeRendererSettings rendererSettings) {
|
||||
super(rendererSettings, "Image", null, null);
|
||||
setClassName("java.awt.Image");
|
||||
setEnabled(true);
|
||||
}
|
||||
|
||||
public String calcLabel(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener) throws
|
||||
EvaluateException {
|
||||
String res = calcToStringLabel(descriptor, evaluationContext, listener);
|
||||
if (res != null) {
|
||||
return res;
|
||||
}
|
||||
return super.calcLabel(descriptor, evaluationContext, listener);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Nullable
|
||||
@Override
|
||||
public XFullValueEvaluator getFullValueEvaluator(final EvaluationContextImpl evaluationContext, final ValueDescriptorImpl valueDescriptor) {
|
||||
return new CustomPopupFullValueEvaluator(" (Show image)", evaluationContext) {
|
||||
return new CustomPopupFullValueEvaluator(DebuggerBundle.message("message.node.show.image"), evaluationContext) {
|
||||
@Override
|
||||
protected JComponent createComponent() {
|
||||
return createIconViewer(getIcon(myEvaluationContext, valueDescriptor.getValue(), "imageToBytes"));
|
||||
@@ -66,7 +55,8 @@ class ImageObjectRenderer extends CompoundReferenceRenderer implements FullValue
|
||||
};
|
||||
}
|
||||
|
||||
static JComponent createIconViewer(Icon icon) {
|
||||
static JComponent createIconViewer(@Nullable Icon icon) {
|
||||
if (icon == null) return new JLabel("null", JLabel.CENTER);
|
||||
final int w = icon.getIconWidth();
|
||||
final int h = icon.getIconHeight();
|
||||
final BufferedImage image = GraphicsEnvironment.getLocalGraphicsEnvironment()
|
||||
|
||||
@@ -78,9 +78,6 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
|
||||
private final ClassRenderer myClassRenderer = new ClassRenderer();
|
||||
private final HexRenderer myHexRenderer = new HexRenderer();
|
||||
private final ToStringRenderer myToStringRenderer = new ToStringRenderer();
|
||||
private final CompoundReferenceRenderer myColorRenderer;
|
||||
private final CompoundReferenceRenderer myImageRenderer;
|
||||
private final CompoundReferenceRenderer myIconRenderer;
|
||||
// alternate collections
|
||||
private final NodeRenderer[] myAlternateCollectionRenderers = new NodeRenderer[]{
|
||||
createCompoundReferenceRenderer(
|
||||
@@ -109,16 +106,10 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
|
||||
@NonNls private static final String CUSTOM_RENDERERS_TAG_NAME = "CustomRenderers";
|
||||
|
||||
public NodeRendererSettings() {
|
||||
myColorRenderer = new ColorObjectRenderer(this);
|
||||
myImageRenderer = new ImageObjectRenderer(this);
|
||||
myIconRenderer = new IconObjectRenderer(this);
|
||||
// default configuration
|
||||
myHexRenderer.setEnabled(false);
|
||||
myToStringRenderer.setEnabled(true);
|
||||
setAlternateCollectionViewsEnabled(true);
|
||||
myColorRenderer.setEnabled(true);
|
||||
myImageRenderer.setEnabled(true);
|
||||
myIconRenderer.setEnabled(true);
|
||||
}
|
||||
|
||||
public static NodeRendererSettings getInstance() {
|
||||
@@ -288,9 +279,6 @@ public class NodeRendererSettings implements PersistentStateComponent<Element> {
|
||||
}
|
||||
});
|
||||
Collections.addAll(allRenderers, myAlternateCollectionRenderers);
|
||||
allRenderers.add(myColorRenderer);
|
||||
allRenderers.add(myImageRenderer);
|
||||
allRenderers.add(myIconRenderer);
|
||||
allRenderers.add(myToStringRenderer);
|
||||
allRenderers.add(myArrayRenderer);
|
||||
allRenderers.add(myClassRenderer);
|
||||
|
||||
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* 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.debugger.settings;
|
||||
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.ui.tree.ValueDescriptor;
|
||||
import com.intellij.debugger.ui.tree.render.*;
|
||||
|
||||
/**
|
||||
* @author egor
|
||||
*/
|
||||
public abstract class ToStringBasedRenderer extends CompoundReferenceRenderer {
|
||||
public ToStringBasedRenderer(NodeRendererSettings rendererSettings,
|
||||
String name,
|
||||
ValueLabelRenderer labelRenderer,
|
||||
ChildrenRenderer childrenRenderer) {
|
||||
super(rendererSettings, name, labelRenderer, childrenRenderer);
|
||||
}
|
||||
|
||||
public String calcLabel(ValueDescriptor descriptor,
|
||||
EvaluationContext evaluationContext,
|
||||
DescriptorLabelListener listener) throws EvaluateException {
|
||||
String res = calcToStringLabel(descriptor, evaluationContext, listener);
|
||||
if (res != null) {
|
||||
return res;
|
||||
}
|
||||
return super.calcLabel(descriptor, evaluationContext, listener);
|
||||
}
|
||||
|
||||
protected String calcToStringLabel(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener)
|
||||
throws EvaluateException {
|
||||
final ToStringRenderer toStringRenderer = myRendererSettings.getToStringRenderer();
|
||||
if (toStringRenderer.isEnabled() && DebuggerManagerEx.getInstanceEx(evaluationContext.getProject()).getContext().isEvaluationPossible()) {
|
||||
return toStringRenderer.calcLabel(descriptor, evaluationContext, listener);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
+1
-14
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -15,12 +15,8 @@
|
||||
*/
|
||||
package com.intellij.debugger.ui.tree.render;
|
||||
|
||||
import com.intellij.debugger.DebuggerManagerEx;
|
||||
import com.intellij.debugger.engine.DebuggerUtils;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluateException;
|
||||
import com.intellij.debugger.engine.evaluation.EvaluationContext;
|
||||
import com.intellij.debugger.settings.NodeRendererSettings;
|
||||
import com.intellij.debugger.ui.tree.ValueDescriptor;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.psi.CommonClassNames;
|
||||
import com.sun.jdi.ReferenceType;
|
||||
@@ -110,15 +106,6 @@ public class CompoundReferenceRenderer extends CompoundNodeRenderer{
|
||||
}
|
||||
}
|
||||
|
||||
protected String calcToStringLabel(ValueDescriptor descriptor, EvaluationContext evaluationContext, DescriptorLabelListener listener)
|
||||
throws EvaluateException {
|
||||
final ToStringRenderer toStringRenderer = myRendererSettings.getToStringRenderer();
|
||||
if (toStringRenderer.isEnabled() && DebuggerManagerEx.getInstanceEx(evaluationContext.getProject()).getContext().isEvaluationPossible()) {
|
||||
return toStringRenderer.calcLabel(descriptor, evaluationContext, listener);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public @NotNull String getClassName() {
|
||||
return myProperties.getClassName();
|
||||
}
|
||||
|
||||
@@ -225,9 +225,8 @@ public class NewProjectUtil {
|
||||
if (version != null) {
|
||||
LanguageLevel maxLevel = version.getMaxLanguageLevel();
|
||||
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(ProjectManager.getInstance().getDefaultProject());
|
||||
Boolean aDefault = extension.isDefault();
|
||||
LanguageLevelProjectExtension ext = LanguageLevelProjectExtension.getInstance(project);
|
||||
if (aDefault != null && aDefault || maxLevel.compareTo(ext.getLanguageLevel()) < 0) {
|
||||
if (extension.isDefault() || maxLevel.compareTo(ext.getLanguageLevel()) < 0) {
|
||||
ext.setLanguageLevel(maxLevel);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.openapi.options.ConfigurationException;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -52,6 +53,7 @@ public class ContentEntriesEditor extends JavaContentEntriesEditor {
|
||||
return getModel().getModuleExtension(LanguageLevelModuleExtensionImpl.class);
|
||||
}
|
||||
};
|
||||
myLanguageLevelConfigurable.addProjectDefault(LanguageLevelProjectExtension.getInstance(myProject).getLanguageLevel());
|
||||
mainPanel.add(myLanguageLevelConfigurable.createComponent(), BorderLayout.NORTH);
|
||||
myLanguageLevelConfigurable.reset();
|
||||
}
|
||||
|
||||
+28
-19
@@ -16,16 +16,18 @@
|
||||
package com.intellij.openapi.roots.ui.configuration;
|
||||
|
||||
import com.intellij.core.JavaCoreBundle;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
|
||||
import com.intellij.ui.ListCellRendererWrapper;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.roots.ex.ProjectRootManagerEx;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import com.intellij.ui.ColoredListCellRendererWrapper;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -33,24 +35,30 @@ import javax.swing.*;
|
||||
/**
|
||||
* @author ven
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public class LanguageLevelCombo extends ComboBox {
|
||||
|
||||
public static final String USE_PROJECT_LANGUAGE_LEVEL = ProjectBundle.message("project.language.level.combo.item");
|
||||
/** Default from current SDK */
|
||||
@Nullable
|
||||
private LanguageLevel myDefaultLevel;
|
||||
private Pair<String, String> myProjectDefault;
|
||||
|
||||
public LanguageLevelCombo() {
|
||||
for (LanguageLevel level : LanguageLevel.values()) {
|
||||
addItem(level);
|
||||
}
|
||||
setRenderer(new ListCellRendererWrapper() {
|
||||
setRenderer(new ColoredListCellRendererWrapper() {
|
||||
@Override
|
||||
public void customize(final JList list, final Object value, final int index, final boolean selected, final boolean hasFocus) {
|
||||
protected void doCustomize(JList list, Object value, int index, boolean selected, boolean hasFocus) {
|
||||
if (value instanceof LanguageLevel) {
|
||||
setText(((LanguageLevel)value).getPresentableText());
|
||||
append(((LanguageLevel)value).getPresentableText());
|
||||
}
|
||||
else if (value instanceof String) {
|
||||
setText((String)value);
|
||||
else if (value instanceof Pair) {
|
||||
Pair<String, String> pair = (Pair<String, String>)value;
|
||||
append(pair.first);
|
||||
if (pair.second != null) {
|
||||
append(" (" + pair.second + ")", SimpleTextAttributes.GRAYED_ATTRIBUTES);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
@@ -69,20 +77,19 @@ public class LanguageLevelCombo extends ComboBox {
|
||||
myDefaultLevel = version.getMaxLanguageLevel();
|
||||
}
|
||||
}
|
||||
String item = null;
|
||||
Pair<String, String> item = null;
|
||||
if (myDefaultLevel != null) {
|
||||
item = JavaCoreBundle.message("default.jdk.level.description", myDefaultLevel.getPresentableText());
|
||||
item = Pair.create(JavaCoreBundle.message("default.language.level.description"), myDefaultLevel.getPresentableText());
|
||||
addItem(item);
|
||||
}
|
||||
else if (project.isDefault()) {
|
||||
item = JavaCoreBundle.message("default.language.level.description");
|
||||
item = Pair.create(JavaCoreBundle.message("default.language.level.description"), null);
|
||||
addItem(item);
|
||||
myDefaultLevel = LanguageLevelProjectExtension.getInstance(project).getLanguageLevel();
|
||||
}
|
||||
|
||||
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(project);
|
||||
Boolean aDefault = extension.isDefault();
|
||||
if (item != null && aDefault != null && aDefault) {
|
||||
if (item != null && extension.isDefault()) {
|
||||
setSelectedItem(item);
|
||||
}
|
||||
else {
|
||||
@@ -102,9 +109,11 @@ public class LanguageLevelCombo extends ComboBox {
|
||||
|
||||
@Override
|
||||
public void setSelectedItem(Object anObject) {
|
||||
if (anObject == null) {
|
||||
anObject = USE_PROJECT_LANGUAGE_LEVEL;
|
||||
}
|
||||
super.setSelectedItem(anObject);
|
||||
super.setSelectedItem(anObject == null ? myProjectDefault : anObject);
|
||||
}
|
||||
|
||||
void addProjectDefault(String projectLevel) {
|
||||
myProjectDefault = Pair.create(ProjectBundle.message("project.language.level.combo.item"), projectLevel);
|
||||
insertItemAt(myProjectDefault, 0);
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -21,6 +21,7 @@ import com.intellij.openapi.options.UnnamedConfigurable;
|
||||
import com.intellij.openapi.project.ProjectBundle;
|
||||
import com.intellij.openapi.roots.LanguageLevelModuleExtensionImpl;
|
||||
import com.intellij.pom.java.LanguageLevel;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -44,7 +45,6 @@ public abstract class LanguageLevelConfigurable implements UnnamedConfigurable {
|
||||
getLanguageLevelExtension().setLanguageLevel(languageLevel instanceof LanguageLevel ? (LanguageLevel)languageLevel : null);
|
||||
}
|
||||
});
|
||||
myLanguageLevelCombo.insertItemAt(LanguageLevelCombo.USE_PROJECT_LANGUAGE_LEVEL, 0);
|
||||
|
||||
JLabel label = new JLabel(ProjectBundle.message("module.module.language.level"));
|
||||
label.setLabelFor(myLanguageLevelCombo);
|
||||
@@ -54,6 +54,7 @@ public abstract class LanguageLevelConfigurable implements UnnamedConfigurable {
|
||||
new GridBagConstraints(1, 0, 1, 1, 1, 0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(6, 6, 12, 0), 0, 0));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public JComponent createComponent() {
|
||||
return myPanel;
|
||||
@@ -81,4 +82,8 @@ public abstract class LanguageLevelConfigurable implements UnnamedConfigurable {
|
||||
}
|
||||
|
||||
public abstract LanguageLevelModuleExtensionImpl getLanguageLevelExtension();
|
||||
|
||||
public void addProjectDefault(LanguageLevel projectDefault) {
|
||||
myLanguageLevelCombo.addProjectDefault(projectDefault.getPresentableText());
|
||||
}
|
||||
}
|
||||
|
||||
+24
-6
@@ -22,6 +22,9 @@ package com.intellij.openapi.roots.impl;
|
||||
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.projectRoots.JavaSdk;
|
||||
import com.intellij.openapi.projectRoots.JavaSdkVersion;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.roots.LanguageLevelProjectExtension;
|
||||
import com.intellij.openapi.roots.ProjectExtension;
|
||||
import com.intellij.openapi.util.InvalidDataException;
|
||||
@@ -30,6 +33,7 @@ import com.intellij.pom.java.LanguageLevel;
|
||||
import org.jdom.Element;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class LanguageLevelProjectExtensionImpl extends LanguageLevelProjectExtension {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.roots.impl.LanguageLevelProjectExtensionImpl");
|
||||
@@ -76,7 +80,7 @@ import org.jetbrains.annotations.NotNull;
|
||||
|
||||
private void writeExternal(final Element element) {
|
||||
element.setAttribute(LANGUAGE_LEVEL, myLanguageLevel.name());
|
||||
Boolean aBoolean = isDefault();
|
||||
Boolean aBoolean = getDefault();
|
||||
if (aBoolean != null) {
|
||||
element.setAttribute(DEFAULT_ATTRIBUTE, Boolean.toString(aBoolean));
|
||||
}
|
||||
@@ -116,21 +120,35 @@ import org.jetbrains.annotations.NotNull;
|
||||
LOG.warn("Calling deprecated LanguageLevelProjectExtensionImpl.reloadProjectOnLanguageLevelChange, while project reloading is not needed on language level changes");
|
||||
}
|
||||
|
||||
private void projectSdkChanged(@Nullable Sdk sdk) {
|
||||
if (isDefault() && sdk != null) {
|
||||
JavaSdkVersion version = JavaSdk.getInstance().getVersion(sdk);
|
||||
if (version != null) {
|
||||
setLanguageLevel(version.getMaxLanguageLevel());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static class MyProjectExtension extends ProjectExtension {
|
||||
private final Project myProject;
|
||||
private final LanguageLevelProjectExtensionImpl myInstance;
|
||||
|
||||
public MyProjectExtension(final Project project) {
|
||||
myProject = project;
|
||||
myInstance = ((LanguageLevelProjectExtensionImpl)getInstance(project));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readExternal(final Element element) throws InvalidDataException {
|
||||
((LanguageLevelProjectExtensionImpl)getInstance(myProject)).readExternal(element);
|
||||
myInstance.readExternal(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeExternal(final Element element) throws WriteExternalException {
|
||||
((LanguageLevelProjectExtensionImpl)getInstance(myProject)).writeExternal(element);
|
||||
myInstance.writeExternal(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void projectSdkChanged(@Nullable Sdk sdk) {
|
||||
myInstance.projectSdkChanged(sdk);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -42,7 +42,7 @@ public abstract class LanguageLevelProjectExtension {
|
||||
* @return null if the property is not set yet (e.g. after migration).
|
||||
*/
|
||||
@Nullable
|
||||
public Boolean isDefault() {
|
||||
public Boolean getDefault() {
|
||||
return myDefault;
|
||||
}
|
||||
|
||||
@@ -50,6 +50,10 @@ public abstract class LanguageLevelProjectExtension {
|
||||
myDefault = value;
|
||||
}
|
||||
|
||||
public boolean isDefault() {
|
||||
return myDefault != null && myDefault;
|
||||
}
|
||||
|
||||
public abstract void languageLevelsChanged();
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
psi.error.attempt.to.edit.class.file=Cannot modify compiled element
|
||||
|
||||
default.language.level.description=JDK default
|
||||
default.jdk.level.description=JDK default ({0})
|
||||
default.language.level.description=SDK default
|
||||
jdk.1.3.language.level.description=1.3 - Plain old Java
|
||||
jdk.1.4.language.level.description=1.4 - 'assert' keyword
|
||||
jdk.1.5.language.level.description=5.0 - 'enum' keyword, generics, autoboxing etc.
|
||||
|
||||
@@ -155,7 +155,7 @@ public class JavaModuleBuilder extends ModuleBuilder implements SourcePathsBuild
|
||||
@Override
|
||||
public List<Module> commit(@NotNull Project project, ModifiableModuleModel model, ModulesProvider modulesProvider) {
|
||||
LanguageLevelProjectExtension extension = LanguageLevelProjectExtension.getInstance(ProjectManager.getInstance().getDefaultProject());
|
||||
Boolean aDefault = extension.isDefault();
|
||||
Boolean aDefault = extension.getDefault();
|
||||
LanguageLevelProjectExtension instance = LanguageLevelProjectExtension.getInstance(project);
|
||||
if (aDefault != null && !aDefault) {
|
||||
instance.setLanguageLevel(extension.getLanguageLevel());
|
||||
|
||||
+1
-1
@@ -1453,7 +1453,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
|
||||
if (myMatchingVisitor.getResult()) {
|
||||
final PsiTypeElement checkType = instanceOf.getCheckType();
|
||||
if (checkType != null) {
|
||||
myMatchingVisitor.setResult(matchType(checkType, instanceOf2.getCheckType()));
|
||||
myMatchingVisitor.setResult(myMatchingVisitor.match(checkType, instanceOf2.getCheckType()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,25 +173,26 @@ public abstract class ProjectWizardTestCase<T extends AbstractProjectWizard> ext
|
||||
ApplicationManager.getApplication().runWriteAction(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ProjectJdkTable jdkTable = ProjectJdkTable.getInstance();
|
||||
Sdk defaultJdk = new SimpleJavaSdkType().createJdk(DEFAULT_SDK, SystemProperties.getJavaHome());
|
||||
Sdk otherJdk = new SimpleJavaSdkType().createJdk("_other", SystemProperties.getJavaHome());
|
||||
jdkTable.addJdk(otherJdk);
|
||||
jdkTable.addJdk(defaultJdk);
|
||||
mySdks.add(defaultJdk);
|
||||
mySdks.add(otherJdk);
|
||||
addSdk(new SimpleJavaSdkType().createJdk(DEFAULT_SDK, SystemProperties.getJavaHome()));
|
||||
addSdk(new SimpleJavaSdkType().createJdk("_other", SystemProperties.getJavaHome()));
|
||||
|
||||
//noinspection UseOfSystemOutOrSystemErr
|
||||
System.out.println(Arrays.asList(jdkTable.getAllJdks()));
|
||||
System.out.println(Arrays.asList(ProjectJdkTable.getInstance().getAllJdks()));
|
||||
|
||||
if (getName().contains("DefaultSdk")) {
|
||||
Project defaultProject = ProjectManager.getInstance().getDefaultProject();
|
||||
ProjectRootManager.getInstance(defaultProject).setProjectSdk(defaultJdk);
|
||||
ProjectRootManager.getInstance(defaultProject).setProjectSdk(
|
||||
new SimpleJavaSdkType().createJdk(DEFAULT_SDK, SystemProperties.getJavaHome()));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
protected void addSdk(Sdk sdk) {
|
||||
ProjectJdkTable.getInstance().addJdk(sdk);
|
||||
mySdks.add(sdk);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void tearDown() throws Exception {
|
||||
if (myWizard != null) {
|
||||
|
||||
@@ -530,7 +530,7 @@ public abstract class ChooseByNameBase {
|
||||
return;
|
||||
}
|
||||
|
||||
if (oppositeComponent != null) {
|
||||
if (oppositeComponent != null && myProject != null) {
|
||||
ToolWindowManager toolWindowManager = ToolWindowManager.getInstance(myProject);
|
||||
ToolWindow toolWindow = toolWindowManager.getToolWindow(toolWindowManager.getActiveToolWindowId());
|
||||
if (toolWindow != null) {
|
||||
|
||||
+6
-1
@@ -77,7 +77,12 @@ public abstract class ProfilesConfigurableComboBox extends JPanel {
|
||||
mySaveListener.setDelegate(inputValidator);
|
||||
mySubmitNameComponent.setText(initialValue);
|
||||
myCardLayout.show(myComboBoxPanel, EDIT_CARD);
|
||||
mySubmitNameComponent.requestFocus();
|
||||
SwingUtilities.invokeLater(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
mySubmitNameComponent.requestFocus();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void reset(final Collection<Profile> profiles) {
|
||||
|
||||
+6
-6
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -46,6 +46,7 @@ import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.Consumer;
|
||||
import com.intellij.util.IconUtil;
|
||||
import com.intellij.util.containers.HashMap;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
import com.intellij.util.ui.UIUtil;
|
||||
import com.intellij.util.ui.update.MergingUpdateQueue;
|
||||
import com.intellij.util.ui.update.UiNotifyConnector;
|
||||
@@ -55,7 +56,6 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.border.EmptyBorder;
|
||||
import javax.swing.event.TreeExpansionEvent;
|
||||
import javax.swing.event.TreeExpansionListener;
|
||||
import javax.swing.event.TreeSelectionEvent;
|
||||
@@ -286,7 +286,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
|
||||
final JLabel label = new JLabel(description);
|
||||
label.setBorder(BorderFactory.createCompoundBorder(
|
||||
new SideBorder(UIUtil.getPanelBackground().darker(), SideBorder.BOTTOM),
|
||||
BorderFactory.createEmptyBorder(0, 5, 10, 5)));
|
||||
JBUI.Borders.empty(0, 5, 10, 5)));
|
||||
return label;
|
||||
}
|
||||
|
||||
@@ -297,7 +297,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
|
||||
Disposer.register(myDisposable, myUiUpdater);
|
||||
new UiNotifyConnector(panel, myUiUpdater);
|
||||
|
||||
panel.setBorder(BorderFactory.createEmptyBorder(0, 0, 0, 0));
|
||||
panel.setBorder(JBUI.Borders.empty());
|
||||
|
||||
createTree();
|
||||
|
||||
@@ -316,7 +316,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
|
||||
toolbarPanel.add(myTextFieldAction, BorderLayout.EAST);
|
||||
|
||||
myPathTextFieldWrapper = new JPanel(new BorderLayout());
|
||||
myPathTextFieldWrapper.setBorder(new EmptyBorder(0, 0, 2, 0));
|
||||
myPathTextFieldWrapper.setBorder(JBUI.Borders.emptyBottom(2));
|
||||
myPathTextField = new FileTextFieldImpl.Vfs(
|
||||
FileChooserFactoryImpl.getMacroMap(), getDisposable(),
|
||||
new LocalFsFinder.FileChooserFilter(myChooserDescriptor, myFileSystemTree)) {
|
||||
@@ -344,7 +344,7 @@ public class FileChooserDialogImpl extends DialogWrapper implements FileChooserD
|
||||
JScrollPane scrollPane = ScrollPaneFactory.createScrollPane(myFileSystemTree.getTree());
|
||||
//scrollPane.setBorder(BorderFactory.createLineBorder(new Color(148, 154, 156)));
|
||||
panel.add(scrollPane, BorderLayout.CENTER);
|
||||
panel.setPreferredSize(new Dimension(400, 400));
|
||||
panel.setPreferredSize(JBUI.size(400));
|
||||
|
||||
|
||||
panel.add(new JLabel(
|
||||
|
||||
@@ -32,6 +32,8 @@ html.inspections.check.image.width.fix.message=Set width value to {0}
|
||||
html.inspections.check.image.height.message=Original image height is {0}
|
||||
html.inspections.check.image.height.fix.message=Set height value to {0}
|
||||
html.inspections.check.deprecated.tag=Deprecated HTML tag
|
||||
html.intentions.insert.image.size=Insert background-image size
|
||||
html.intentions.update.image.size=Update background-image size
|
||||
unwrap.enclosing.tag.name.action.name=Remove Enclosing Tag {0}
|
||||
jsp.inspections.group.name=JSP Inspections
|
||||
# color dialog
|
||||
@@ -218,7 +220,7 @@ select.xsd.schema.dialog.title=Select XSD Schema
|
||||
emmet.title=Emmet
|
||||
emmet.update.tag.title=Update tag with Emmet
|
||||
emmet.configuration.title=Emmet
|
||||
emmet.enable.label=&Enable XML Emmet
|
||||
emmet.enable.label=&Enable XML/HTML Emmet
|
||||
emmet.filters.enabled.by.default=Filters enabled by default
|
||||
emmet.enable.preview=Enable &abbreviation preview
|
||||
emmet.expand.abbreviation.with=Expand &abbreviation with
|
||||
|
||||
+4
-1
@@ -37,7 +37,10 @@ public abstract class ProjectRootManagerEx extends ProjectRootManager {
|
||||
|
||||
public abstract void clearScopesCachesForModules();
|
||||
|
||||
|
||||
/**
|
||||
* @see ProjectRootManagerEx#addProjectJdkListener(ProjectJdkListener)
|
||||
* @see ProjectRootManagerEx#removeProjectJdkListener(ProjectJdkListener)
|
||||
*/
|
||||
public interface ProjectJdkListener extends EventListener {
|
||||
void projectJdkChanged();
|
||||
}
|
||||
|
||||
+3
-3
@@ -504,7 +504,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
return myModuleModel.getModules();
|
||||
}
|
||||
|
||||
private Module[] myCachedSortedModules = null;
|
||||
private volatile Module[] myCachedSortedModules = null;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@@ -523,7 +523,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
return myModuleModel.findModuleByName(name);
|
||||
}
|
||||
|
||||
private Comparator<Module> myCachedModuleComparator = null;
|
||||
private volatile Comparator<Module> myCachedModuleComparator = null;
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
@@ -602,7 +602,7 @@ public abstract class ModuleManagerImpl extends ModuleManager implements Project
|
||||
|
||||
class ModuleModelImpl implements ModifiableModuleModel {
|
||||
final Map<String, Module> myPathToModule = new LinkedHashMap<String, Module>(new EqualityPolicy.ByHashingStrategy<String>(FilePathHashingStrategy.create()));
|
||||
private Module[] myModulesCache;
|
||||
private volatile Module[] myModulesCache;
|
||||
|
||||
private final List<Module> myModulesToDispose = new ArrayList<Module>();
|
||||
private final Map<Module, String> myModuleToNewName = new HashMap<Module, String>();
|
||||
|
||||
@@ -21,8 +21,12 @@
|
||||
package com.intellij.openapi.roots;
|
||||
|
||||
import com.intellij.openapi.extensions.ExtensionPointName;
|
||||
import com.intellij.openapi.projectRoots.Sdk;
|
||||
import com.intellij.openapi.util.JDOMExternalizable;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public abstract class ProjectExtension implements JDOMExternalizable{
|
||||
public static final ExtensionPointName<ProjectExtension> EP_NAME = ExtensionPointName.create("com.intellij.projectExtension");
|
||||
|
||||
public void projectSdkChanged(@Nullable Sdk sdk) {}
|
||||
}
|
||||
+9
-6
@@ -231,12 +231,20 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
|
||||
myProjectSdkName = sdk.getName();
|
||||
myProjectSdkType = sdk.getSdkType().getName();
|
||||
}
|
||||
projectJdkChanged();
|
||||
}
|
||||
|
||||
private void projectJdkChanged() {
|
||||
mergeRootsChangesDuring(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myProjectJdkEventDispatcher.getMulticaster().projectJdkChanged();
|
||||
}
|
||||
});
|
||||
Sdk sdk = getProjectSdk();
|
||||
for (ProjectExtension extension : Extensions.getExtensions(ProjectExtension.EP_NAME, myProject)) {
|
||||
extension.projectSdkChanged(sdk);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -244,12 +252,7 @@ public class ProjectRootManagerImpl extends ProjectRootManagerEx implements Proj
|
||||
ApplicationManager.getApplication().assertWriteAccessAllowed();
|
||||
myProjectSdkName = name;
|
||||
|
||||
mergeRootsChangesDuring(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
myProjectJdkEventDispatcher.getMulticaster().projectJdkChanged();
|
||||
}
|
||||
});
|
||||
projectJdkChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -246,7 +246,7 @@ libraries.node.text.module=Libraries contain classes that add up various functio
|
||||
\
|
||||
To attach a library to a module, select that module, click the Dependencies tab, click Add and specify the library location.
|
||||
jdks.node.display.name=SDKs
|
||||
project.language.level.combo.item=<Use project language level>
|
||||
project.language.level.combo.item=Project default
|
||||
add.action.name=Add new ...
|
||||
add.new.jdk.text=Add New SDK
|
||||
add.new.global.library.text=New Global Library
|
||||
|
||||
+8
@@ -2476,6 +2476,14 @@ public class StructuralSearchTest extends StructuralSearchTestCase {
|
||||
"@Deprecated\n" +
|
||||
"package one.two;";
|
||||
assertEquals("Find annotation on package statement", 1, findMatchesCount(source4, "@'_Annotation", true));
|
||||
|
||||
final String source5 ="class A {" +
|
||||
" boolean a(Object o) {" +
|
||||
" return o instanceof @HH String;" +
|
||||
" }" +
|
||||
"}";
|
||||
assertEquals("Find annotation on instanceof expression", 1, findMatchesCount(source5, "'_a instanceof @HH String"));
|
||||
assertEquals("Match annotation correctly on instanceof expression", 0, findMatchesCount(source5, "'_a instanceof @GG String"));
|
||||
}
|
||||
|
||||
public void testBoxingAndUnboxing() {
|
||||
|
||||
-2
@@ -29,6 +29,4 @@ public interface PrintElementGenerator {
|
||||
|
||||
@NotNull
|
||||
PrintElementWithGraphElement toPrintElementWithGraphElement(@NotNull PrintElement printElement);
|
||||
|
||||
void invalidate();
|
||||
}
|
||||
|
||||
+14
-3
@@ -142,8 +142,12 @@ public class VisibleGraphImpl<CommitId> implements VisibleGraph<CommitId> {
|
||||
targetId = edge.getTargetId();
|
||||
}
|
||||
if (edge.getType().isNormalEdge()) {
|
||||
if (printElementType == DOWN_ARROW) targetId = convertToNodeId(edge.getDownNodeIndex());
|
||||
else targetId = convertToNodeId(edge.getUpNodeIndex());
|
||||
if (printElementType == DOWN_ARROW) {
|
||||
targetId = convertToNodeId(edge.getDownNodeIndex());
|
||||
}
|
||||
else {
|
||||
targetId = convertToNodeId(edge.getUpNodeIndex());
|
||||
}
|
||||
}
|
||||
if (targetId == null) return null;
|
||||
|
||||
@@ -198,7 +202,14 @@ public class VisibleGraphImpl<CommitId> implements VisibleGraph<CommitId> {
|
||||
CommitId commitToJump = null;
|
||||
Integer nodeId = answer.getCommitToJump();
|
||||
if (nodeId != null) commitToJump = myPermanentGraph.getPermanentCommitsInfo().getCommitId(nodeId);
|
||||
return new GraphAnswerImpl<CommitId>(answer.getCursorToSet(), commitToJump, answer.getGraphUpdater());
|
||||
final Runnable graphUpdater = answer.getGraphUpdater();
|
||||
return new GraphAnswerImpl<CommitId>(answer.getCursorToSet(), commitToJump, graphUpdater == null ? null : new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
graphUpdater.run();
|
||||
updatePrintElementGenerator();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
-6
@@ -203,12 +203,6 @@ public class PrintElementGeneratorImpl extends AbstractPrintElementGenerator {
|
||||
result.add(new SimpleRowElement(edge, SimplePrintElement.Type.UP_ARROW, position));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invalidate() {
|
||||
myEdgesInRowGenerator.invalidate();
|
||||
cache.clear();
|
||||
}
|
||||
|
||||
private boolean edgeIsVisibleInRow(@NotNull GraphEdge edge, int visibleRowIndex) {
|
||||
Pair<Integer, Integer> normalEdge = LinearGraphUtils.asNormalEdge(edge);
|
||||
if (normalEdge == null) // e.d. edge is special. See addSpecialEdges
|
||||
|
||||
@@ -17,19 +17,15 @@ import com.intellij.vcs.log.data.VcsLogFilterer;
|
||||
import com.intellij.vcs.log.data.VcsLogUiProperties;
|
||||
import com.intellij.vcs.log.data.VisiblePack;
|
||||
import com.intellij.vcs.log.graph.PermanentGraph;
|
||||
import com.intellij.vcs.log.graph.VisibleGraph;
|
||||
import com.intellij.vcs.log.graph.actions.GraphAction;
|
||||
import com.intellij.vcs.log.graph.actions.GraphAnswer;
|
||||
import com.intellij.vcs.log.impl.VcsLogImpl;
|
||||
import com.intellij.vcs.log.ui.frame.MainFrame;
|
||||
import com.intellij.vcs.log.ui.frame.VcsLogGraphTable;
|
||||
import com.intellij.vcs.log.ui.tables.GraphTableModel;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import gnu.trove.TIntProcedure;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.table.AbstractTableModel;
|
||||
import javax.swing.table.TableModel;
|
||||
import java.awt.*;
|
||||
import java.util.ArrayList;
|
||||
@@ -79,7 +75,7 @@ public class VcsLogUiImpl implements VcsLogUi, Disposable {
|
||||
ApplicationManager.getApplication().assertIsDispatchThread();
|
||||
|
||||
PermanentGraph<Integer> previousPermGraph = myVisiblePack.getPermanentGraph();
|
||||
TIntHashSet previouslySelected = getSelectedCommits();
|
||||
VcsLogGraphTable.Selection previousSelection = getTable().getSelection();
|
||||
|
||||
myVisiblePack = pack;
|
||||
boolean permGraphChanged = previousPermGraph != myVisiblePack.getPermanentGraph();
|
||||
@@ -90,7 +86,7 @@ public class VcsLogUiImpl implements VcsLogUi, Disposable {
|
||||
}
|
||||
else {
|
||||
currentModel.setVisiblePack(myVisiblePack);
|
||||
restoreSelection(currentModel, myVisiblePack.getVisibleGraph(), previouslySelected, getTable());
|
||||
previousSelection.restore(myVisiblePack.getVisibleGraph());
|
||||
}
|
||||
getTable().setPaintBusy(false);
|
||||
|
||||
@@ -105,42 +101,6 @@ public class VcsLogUiImpl implements VcsLogUi, Disposable {
|
||||
return myMainFrame;
|
||||
}
|
||||
|
||||
private static void restoreSelection(@NotNull GraphTableModel newModel,
|
||||
@NotNull VisibleGraph<Integer> newVisibleGraph,
|
||||
@NotNull TIntHashSet previouslySelectedCommits,
|
||||
@NotNull final VcsLogGraphTable table) {
|
||||
TIntHashSet rowsToSelect = findNewRowsToSelect(newModel, newVisibleGraph, previouslySelectedCommits);
|
||||
rowsToSelect.forEach(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int row) {
|
||||
table.addRowSelectionInterval(row, row);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static TIntHashSet findNewRowsToSelect(@NotNull GraphTableModel newModel,
|
||||
@NotNull VisibleGraph<Integer> visibleGraph,
|
||||
@NotNull TIntHashSet selectedHashes) {
|
||||
TIntHashSet rowsToSelect = new TIntHashSet();
|
||||
if (newModel.getRowCount() == 0) {
|
||||
// this should have been covered by facade.getVisibleCommitCount,
|
||||
// but if the table is empty (no commits match the filter), the GraphFacade is not updated, because it can't handle it
|
||||
// => it has previous values set.
|
||||
return rowsToSelect;
|
||||
}
|
||||
for (int row = 0;
|
||||
row < visibleGraph.getVisibleCommitCount() && rowsToSelect.size() < selectedHashes.size();
|
||||
row++) { //stop iterating if found all hashes
|
||||
int commit = visibleGraph.getRowInfo(row).getCommit();
|
||||
if (selectedHashes.contains(commit)) {
|
||||
rowsToSelect.add(row);
|
||||
}
|
||||
}
|
||||
return rowsToSelect;
|
||||
}
|
||||
|
||||
public void repaintUI() {
|
||||
myMainFrame.getGraphTable().repaint();
|
||||
}
|
||||
@@ -156,7 +116,7 @@ public class VcsLogUiImpl implements VcsLogUi, Disposable {
|
||||
public void run() {
|
||||
assert updater != null : "Action:" + title + "\nController: " + myVisiblePack.getVisibleGraph().getActionController() + "\nAnswer:" + answer;
|
||||
updater.run();
|
||||
handleAnswer(answer, true);
|
||||
getTable().handleAnswer(answer, true, null);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -226,31 +186,6 @@ public class VcsLogUiImpl implements VcsLogUi, Disposable {
|
||||
return future;
|
||||
}
|
||||
|
||||
public void handleAnswer(@Nullable GraphAnswer<Integer> answer, boolean dataCouldChange) {
|
||||
if (dataCouldChange) {
|
||||
((AbstractTableModel)(getTable().getModel())).fireTableDataChanged();
|
||||
}
|
||||
|
||||
repaintUI();
|
||||
|
||||
if (answer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (answer.getCursorToSet() != null) {
|
||||
myMainFrame.getGraphTable().setCursor(answer.getCursorToSet());
|
||||
}
|
||||
if (answer.getCommitToJump() != null) {
|
||||
int row = myVisiblePack.getVisibleGraph().getVisibleRowIndex(answer.getCommitToJump());
|
||||
if (row >= 0) {
|
||||
myMainFrame.getGraphTable().jumpToRow(row);
|
||||
}
|
||||
else {
|
||||
// TODO wait for the full log and then jump
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private <T> void jumpTo(@NotNull final T commitId,
|
||||
@NotNull final PairFunction<GraphTableModel, T, Integer> rowGetter,
|
||||
@NotNull final SettableFuture<Boolean> future) {
|
||||
@@ -327,23 +262,6 @@ public class VcsLogUiImpl implements VcsLogUi, Disposable {
|
||||
return myColorManager;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public TIntHashSet getSelectedCommits() {
|
||||
int[] selectedRows = getTable().getSelectedRows();
|
||||
return getCommitsAtRows(myVisiblePack.getVisibleGraph(), selectedRows);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private static TIntHashSet getCommitsAtRows(@NotNull VisibleGraph<Integer> graph, int[] rows) {
|
||||
TIntHashSet commits = new TIntHashSet();
|
||||
for (int row : rows) {
|
||||
if (row < graph.getVisibleCommitCount()) {
|
||||
commits.add(graph.getRowInfo(row).getCommit());
|
||||
}
|
||||
}
|
||||
return commits;
|
||||
}
|
||||
|
||||
public void applyFiltersAndUpdateUi() {
|
||||
VcsLogFilterCollection filters = myMainFrame.getFilterUi().getFilters();
|
||||
myFilterer.onFiltersChange(filters);
|
||||
|
||||
@@ -38,10 +38,7 @@ import com.intellij.vcs.log.VcsFullCommitDetails;
|
||||
import com.intellij.vcs.log.VcsLogHighlighter;
|
||||
import com.intellij.vcs.log.data.VcsLogDataHolder;
|
||||
import com.intellij.vcs.log.data.VisiblePack;
|
||||
import com.intellij.vcs.log.graph.ColorGenerator;
|
||||
import com.intellij.vcs.log.graph.PrintElement;
|
||||
import com.intellij.vcs.log.graph.RowInfo;
|
||||
import com.intellij.vcs.log.graph.RowType;
|
||||
import com.intellij.vcs.log.graph.*;
|
||||
import com.intellij.vcs.log.graph.actions.GraphAction;
|
||||
import com.intellij.vcs.log.graph.actions.GraphAnswer;
|
||||
import com.intellij.vcs.log.printer.idea.GraphCellPainter;
|
||||
@@ -52,11 +49,14 @@ import com.intellij.vcs.log.ui.VcsLogUiImpl;
|
||||
import com.intellij.vcs.log.ui.render.GraphCommitCell;
|
||||
import com.intellij.vcs.log.ui.render.GraphCommitCellRender;
|
||||
import com.intellij.vcs.log.ui.tables.GraphTableModel;
|
||||
import gnu.trove.TIntHashSet;
|
||||
import gnu.trove.TIntProcedure;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import sun.swing.table.DefaultTableCellHeaderRenderer;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.event.CellEditorListener;
|
||||
import javax.swing.event.ChangeEvent;
|
||||
import javax.swing.event.ChangeListener;
|
||||
import javax.swing.event.TableModelEvent;
|
||||
@@ -65,9 +65,7 @@ import java.awt.*;
|
||||
import java.awt.datatransfer.StringSelection;
|
||||
import java.awt.event.MouseAdapter;
|
||||
import java.awt.event.MouseEvent;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
import static com.intellij.vcs.log.printer.idea.PrintParameters.HEIGHT_CELL;
|
||||
@@ -85,6 +83,7 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
|
||||
@NotNull private final VcsLogUiImpl myUI;
|
||||
private final VcsLogDataHolder myLogDataHolder;
|
||||
private final GraphCommitCellRender myGraphCommitCellRender;
|
||||
private final MyDummyTableCellEditor myDummyEditor = new MyDummyTableCellEditor();
|
||||
|
||||
private boolean myColumnsSizeInitialized = false;
|
||||
|
||||
@@ -364,6 +363,103 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
|
||||
});
|
||||
}
|
||||
|
||||
public void handleAnswer(@Nullable GraphAnswer<Integer> answer, boolean dataCouldChange, @Nullable Selection previousSelection) {
|
||||
if (dataCouldChange) {
|
||||
GraphTableModel graphTableModel = (GraphTableModel)getModel();
|
||||
|
||||
graphTableModel.fireTableDataChanged();
|
||||
|
||||
// since fireTableDataChanged clears selection we restore it here
|
||||
if (previousSelection != null) {
|
||||
previousSelection.restore(myDataPack.getVisibleGraph());
|
||||
}
|
||||
}
|
||||
|
||||
myUI.repaintUI(); // in case of repaintUI doing something more than just repainting this table in some distant future
|
||||
|
||||
if (answer == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (answer.getCursorToSet() != null) {
|
||||
setCursor(answer.getCursorToSet());
|
||||
}
|
||||
if (answer.getCommitToJump() != null) {
|
||||
Integer row = myDataPack.getVisibleGraph().getVisibleRowIndex(answer.getCommitToJump());
|
||||
if (row != null && row >= 0) {
|
||||
jumpToRow(row);
|
||||
}
|
||||
// TODO wait for the full log and then jump
|
||||
}
|
||||
}
|
||||
|
||||
private GraphTableModel getGraphTableModel() {
|
||||
return (GraphTableModel)getModel();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public Selection getSelection() {
|
||||
return new Selection();
|
||||
}
|
||||
|
||||
public class Selection {
|
||||
private final TIntHashSet myCommits;
|
||||
|
||||
public Selection() {
|
||||
myCommits = getCommitsAtRows(myDataPack.getVisibleGraph(), getSelectedRows());
|
||||
}
|
||||
|
||||
public void restore(@NotNull VisibleGraph<Integer> newVisibleGraph) {
|
||||
TIntHashSet rowsToSelect = findNewRowsToSelect(getGraphTableModel(), newVisibleGraph, myCommits);
|
||||
if (!rowsToSelect.isEmpty()) {
|
||||
rowsToSelect.forEach(new TIntProcedure() {
|
||||
@Override
|
||||
public boolean execute(int row) {
|
||||
addRowSelectionInterval(row, row);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
}
|
||||
// sometimes commits that were selected are now collapsed
|
||||
// currently in this case selection disappears
|
||||
// in the future we need to create a method in LinearGraphController that allows to calculate visible commit for our commit
|
||||
// or answer from collapse action could return a map that gives us some information about what commits were collapsed and where
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private TIntHashSet findNewRowsToSelect(@NotNull GraphTableModel newModel,
|
||||
@NotNull VisibleGraph<Integer> visibleGraph,
|
||||
@NotNull TIntHashSet selectedHashes) {
|
||||
TIntHashSet rowsToSelect = new TIntHashSet();
|
||||
if (newModel.getRowCount() == 0) {
|
||||
// this should have been covered by facade.getVisibleCommitCount,
|
||||
// but if the table is empty (no commits match the filter), the GraphFacade is not updated, because it can't handle it
|
||||
// => it has previous values set.
|
||||
return rowsToSelect;
|
||||
}
|
||||
for (int row = 0;
|
||||
row < visibleGraph.getVisibleCommitCount() && rowsToSelect.size() < selectedHashes.size();
|
||||
row++) { //stop iterating if found all hashes
|
||||
int commit = visibleGraph.getRowInfo(row).getCommit();
|
||||
if (selectedHashes.contains(commit)) {
|
||||
rowsToSelect.add(row);
|
||||
}
|
||||
}
|
||||
return rowsToSelect;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
private TIntHashSet getCommitsAtRows(@NotNull VisibleGraph<Integer> graph, int[] rows) {
|
||||
TIntHashSet commits = new TIntHashSet();
|
||||
for (int row : rows) {
|
||||
if (row < graph.getVisibleCommitCount()) {
|
||||
commits.add(graph.getRowInfo(row).getCommit());
|
||||
}
|
||||
}
|
||||
return commits;
|
||||
}
|
||||
}
|
||||
|
||||
private class MyHeaderMouseAdapter extends MouseAdapter {
|
||||
@Override
|
||||
public void mouseMoved(MouseEvent e) {
|
||||
@@ -423,11 +519,13 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
|
||||
Collection<? extends PrintElement> printElements = myDataPack.getVisibleGraph().getRowInfo(row).getPrintElements();
|
||||
PrintElement printElement = myGraphCellPainter.mouseOver(printElements, point.x, point.y);
|
||||
|
||||
Selection previousSelection = getSelection();
|
||||
GraphAnswer<Integer> answer =
|
||||
myDataPack.getVisibleGraph().getActionController().performAction(new GraphAction.GraphActionImpl(printElement, actionType));
|
||||
myUI.handleAnswer(answer, actionType == GraphAction.Type.MOUSE_CLICK && printElement != null);
|
||||
handleAnswer(answer, actionType == GraphAction.Type.MOUSE_CLICK && printElement != null, previousSelection);
|
||||
}
|
||||
|
||||
|
||||
private boolean isAboveLink(MouseEvent e) {
|
||||
return myLinkListener.getTagAt(e) != null;
|
||||
}
|
||||
@@ -532,6 +630,13 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public TableCellEditor getCellEditor() {
|
||||
// this fixes selection problems by prohibiting selection when user clicks on graph (CellEditor does that)
|
||||
// what is fun about this code is that if you set cell editor in constructor with setCellEditor method it would not work
|
||||
return myDummyEditor;
|
||||
}
|
||||
|
||||
private class StringCellRenderer extends ColoredTableCellRenderer {
|
||||
@Override
|
||||
protected void customizeCellRenderer(JTable table, Object value, boolean selected, boolean hasFocus, int row, int column) {
|
||||
@@ -577,4 +682,55 @@ public class VcsLogGraphTable extends JBTable implements TypeSafeDataProvider, C
|
||||
}
|
||||
}
|
||||
|
||||
private class MyDummyTableCellEditor implements TableCellEditor {
|
||||
@Override
|
||||
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getCellEditorValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCellEditable(EventObject anEvent) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldSelectCell(EventObject anEvent) {
|
||||
if (!(anEvent instanceof MouseEvent)) return true;
|
||||
MouseEvent e = (MouseEvent)anEvent;
|
||||
|
||||
int row = PositionUtil.getRowIndex(e.getPoint());
|
||||
if (row > getRowCount() - 1) {
|
||||
return false;
|
||||
}
|
||||
Point point = calcPoint4Graph(e.getPoint());
|
||||
Collection<? extends PrintElement> printElements = myDataPack.getVisibleGraph().getRowInfo(row).getPrintElements();
|
||||
PrintElement printElement = myGraphCellPainter.mouseOver(printElements, point.x, point.y);
|
||||
return printElement == null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stopCellEditing() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void cancelCellEditing() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCellEditorListener(CellEditorListener l) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeCellEditorListener(CellEditorListener l) {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* 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.
|
||||
@@ -36,7 +36,7 @@ public interface XValueNode extends Obsolescent {
|
||||
* If value text exceeds this constant it's recommended to truncate it and use {@link #setFullValueEvaluator(XFullValueEvaluator)} method
|
||||
* to provide full value
|
||||
*/
|
||||
int MAX_VALUE_LENGTH = 100;
|
||||
int MAX_VALUE_LENGTH = 1000;
|
||||
|
||||
/**
|
||||
* Setup presentation of the value
|
||||
|
||||
@@ -40,6 +40,7 @@ import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import com.intellij.xdebugger.impl.breakpoints.XBreakpointBase;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.BreakpointsDialogFactory;
|
||||
import com.intellij.xdebugger.impl.breakpoints.ui.XLightBreakpointPropertiesPanel;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -127,7 +128,7 @@ public class DebuggerUIUtil {
|
||||
JComponent component,
|
||||
@Nullable final FullValueEvaluationCallbackImpl callback) {
|
||||
ComponentPopupBuilder builder = JBPopupFactory.getInstance().createComponentPopupBuilder(component, null);
|
||||
builder.setResizable(true)/*.setAlpha(1)*/ // alpha disabled because of IDEA-136331
|
||||
builder.setResizable(true)
|
||||
.setMovable(true)
|
||||
.setDimensionServiceKey(project, FULL_VALUE_POPUP_DIMENSION_KEY, false)
|
||||
.setRequestFocus(false);
|
||||
@@ -328,4 +329,14 @@ public class DebuggerUIUtil {
|
||||
return myObsolete.get();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static String getNodeRawValue(@NotNull XValueNodeImpl valueNode) {
|
||||
if (valueNode.getValueContainer() instanceof XValueTextProvider) {
|
||||
return ((XValueTextProvider)valueNode.getValueContainer()).getValueText();
|
||||
}
|
||||
else {
|
||||
return valueNode.getRawValue();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+60
-7
@@ -15,18 +15,24 @@
|
||||
*/
|
||||
package com.intellij.xdebugger.impl.ui.tree;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.ui.AbstractExpandableItemsHandler;
|
||||
import com.intellij.ui.ColoredTreeCellRenderer;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.util.ui.JBInsets;
|
||||
import com.intellij.xdebugger.XDebuggerBundle;
|
||||
import com.intellij.xdebugger.frame.ImmediateFullValueEvaluator;
|
||||
import com.intellij.xdebugger.frame.XDebuggerTreeNodeHyperlink;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XDebuggerTreeNode;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import javax.swing.tree.TreePath;
|
||||
import java.awt.*;
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -37,6 +43,8 @@ class XDebuggerTreeRenderer extends ColoredTreeCellRenderer {
|
||||
private int myLinkOffset;
|
||||
private int myLinkWidth;
|
||||
|
||||
private final MyLongTextHyperlink myLongTextLink = new MyLongTextHyperlink();
|
||||
|
||||
public XDebuggerTreeRenderer() {
|
||||
Insets myLinkIpad = myLink.getIpad();
|
||||
myLink.setIpad(new JBInsets(myLinkIpad.top, 0, myLinkIpad.bottom, myLinkIpad.right));
|
||||
@@ -56,18 +64,38 @@ class XDebuggerTreeRenderer extends ColoredTreeCellRenderer {
|
||||
XDebuggerTreeNode node = (XDebuggerTreeNode)value;
|
||||
node.appendToComponent(this);
|
||||
setIcon(node.getIcon());
|
||||
|
||||
Rectangle treeVisibleRect = tree.getVisibleRect();
|
||||
TreePath path = tree.getPathForRow(row);
|
||||
int rowX = path != null ? ((XDebuggerTree.LinkTreeUI)tree.getUI()).getRowX(row, path.getPathCount() - 1) : 0;
|
||||
|
||||
if (myHaveLink) {
|
||||
Dimension linkSize = myLink.getPreferredSize();
|
||||
myLinkWidth = linkSize.width;
|
||||
myLink.setBounds(0, 0, linkSize.width, linkSize.height);
|
||||
Rectangle treeVisibleRect = tree.getVisibleRect();
|
||||
TreePath path = tree.getPathForRow(row);
|
||||
int rowX = path != null ? ((XDebuggerTree.LinkTreeUI)tree.getUI()).getRowX(row, path.getPathCount() - 1) : 0;
|
||||
myLinkOffset = Math.min(super.getPreferredSize().width, treeVisibleRect.x + treeVisibleRect.width - myLinkWidth - rowX);
|
||||
setupLinkDimensions(treeVisibleRect, rowX);
|
||||
}
|
||||
else {
|
||||
if (rowX + super.getPreferredSize().width > treeVisibleRect.x + treeVisibleRect.width) {
|
||||
// text does not fit visible area - show link
|
||||
if (node instanceof XValueNodeImpl) {
|
||||
final String rawValue = DebuggerUIUtil.getNodeRawValue((XValueNodeImpl)node);
|
||||
if (rawValue != null) {
|
||||
myLongTextLink.setupComponent(rawValue, ((XDebuggerTree)tree).getProject());
|
||||
append(myLongTextLink.getLinkText(), myLongTextLink.getTextAttributes(), myLongTextLink);
|
||||
setupLinkDimensions(treeVisibleRect, rowX);
|
||||
myLinkWidth = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
putClientProperty(AbstractExpandableItemsHandler.DISABLE_EXPANDABLE_HANDLER, myHaveLink ? true : null);
|
||||
}
|
||||
|
||||
private void setupLinkDimensions(Rectangle treeVisibleRect, int rowX) {
|
||||
Dimension linkSize = myLink.getPreferredSize();
|
||||
myLinkWidth = linkSize.width;
|
||||
myLink.setBounds(0, 0, linkSize.width, linkSize.height);
|
||||
myLinkOffset = Math.min(super.getPreferredSize().width, treeVisibleRect.x + treeVisibleRect.width - myLinkWidth - rowX);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void append(@NotNull String fragment, @NotNull SimpleTextAttributes attributes, Object tag) {
|
||||
if (tag instanceof XDebuggerTreeNodeHyperlink && ((XDebuggerTreeNodeHyperlink)tag).alwaysOnScreen()) {
|
||||
@@ -131,4 +159,29 @@ class XDebuggerTreeRenderer extends ColoredTreeCellRenderer {
|
||||
super.doPaint(g);
|
||||
}
|
||||
}
|
||||
|
||||
private static class MyLongTextHyperlink extends XDebuggerTreeNodeHyperlink {
|
||||
private String myText;
|
||||
private Project myProject;
|
||||
|
||||
public MyLongTextHyperlink() {
|
||||
super(XDebuggerBundle.message("node.test.show.full.value"));
|
||||
}
|
||||
|
||||
public void setupComponent(String text, Project project) {
|
||||
myText = text;
|
||||
myProject = project;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean alwaysOnScreen() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(MouseEvent event) {
|
||||
DebuggerUIUtil.showValuePopup(new ImmediateFullValueEvaluator(myText), event, myProject, null);
|
||||
event.consume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-9
@@ -23,7 +23,7 @@ import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.ui.AppUIUtil;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.xdebugger.frame.XFullValueEvaluator;
|
||||
import com.intellij.xdebugger.impl.ui.XValueTextProvider;
|
||||
import com.intellij.xdebugger.impl.ui.DebuggerUIUtil;
|
||||
import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.HeadlessValueEvaluationCallback;
|
||||
import com.intellij.xdebugger.impl.ui.tree.nodes.WatchMessageNode;
|
||||
@@ -76,14 +76,7 @@ public abstract class XFetchValueActionBase extends AnAction {
|
||||
XValueNodeImpl valueNode = (XValueNodeImpl)node;
|
||||
XFullValueEvaluator fullValueEvaluator = valueNode.getFullValueEvaluator();
|
||||
if (fullValueEvaluator == null || !fullValueEvaluator.isShowValuePopup()) {
|
||||
String rawValue;
|
||||
if (valueNode.getValueContainer() instanceof XValueTextProvider) {
|
||||
rawValue = ((XValueTextProvider)valueNode.getValueContainer()).getValueText();
|
||||
}
|
||||
else {
|
||||
rawValue = valueNode.getRawValue();
|
||||
}
|
||||
valueCollector.add(StringUtil.notNullize(rawValue));
|
||||
valueCollector.add(StringUtil.notNullize(DebuggerUIUtil.getNodeRawValue(valueNode)));
|
||||
}
|
||||
else {
|
||||
new CopyValueEvaluationCallback(valueNode, valueCollector).startFetchingValue(fullValueEvaluator);
|
||||
|
||||
+5
-2
@@ -701,6 +701,7 @@ public class GroovyTypeCheckVisitor extends BaseInspectionVisitor {
|
||||
}
|
||||
|
||||
private void registerCannotApplyError(@NotNull String invokedText, @NotNull CallInfo info) {
|
||||
if (info.getArgumentTypes() == null) return;
|
||||
final String typesString = buildArgTypesList(info.getArgumentTypes());
|
||||
registerError(
|
||||
info.getElementToHighlight(),
|
||||
@@ -839,12 +840,14 @@ public class GroovyTypeCheckVisitor extends BaseInspectionVisitor {
|
||||
public void visitCastExpression(GrTypeCastExpression expression) {
|
||||
super.visitCastExpression(expression);
|
||||
|
||||
if (expression.getCastTypeElement() == null) return;
|
||||
final PsiType expectedType = expression.getCastTypeElement().getType();
|
||||
final GrExpression operand = expression.getOperand();
|
||||
if (operand == null) return;
|
||||
final PsiType actualType = operand.getType();
|
||||
if (actualType == null) return;
|
||||
|
||||
if (expression.getCastTypeElement() == null) return;
|
||||
final PsiType expectedType = expression.getCastTypeElement().getType();
|
||||
|
||||
final ConversionResult result = TypesUtil.canCast(expectedType, actualType, expression);
|
||||
if (result == ConversionResult.OK) return;
|
||||
final ProblemHighlightType highlightType = result == ConversionResult.ERROR
|
||||
|
||||
+2
@@ -16,6 +16,7 @@
|
||||
|
||||
package org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions;
|
||||
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.types.GrTypeElement;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import com.intellij.psi.PsiElement;
|
||||
@@ -26,6 +27,7 @@ import com.intellij.psi.PsiElement;
|
||||
public interface GrTypeCastExpression extends GrExpression {
|
||||
GrTypeElement getCastTypeElement();
|
||||
|
||||
@Nullable
|
||||
GrExpression getOperand();
|
||||
|
||||
@NotNull
|
||||
|
||||
+2
@@ -20,6 +20,7 @@ import com.intellij.lang.ASTNode;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.PsiType;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jetbrains.plugins.groovy.lang.lexer.GroovyTokenTypes;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.GroovyElementVisitor;
|
||||
import org.jetbrains.plugins.groovy.lang.psi.api.statements.expressions.GrExpression;
|
||||
@@ -58,6 +59,7 @@ public class GrTypeCastExpressionImpl extends GrExpressionImpl implements GrType
|
||||
}
|
||||
|
||||
@Override
|
||||
@Nullable
|
||||
public GrExpression getOperand() {
|
||||
return findExpressionChild(this);
|
||||
}
|
||||
|
||||
+4
@@ -184,6 +184,10 @@ public abstract class GroovycOutputParser {
|
||||
LOG.debug("Error message: " + message);
|
||||
return true;
|
||||
}
|
||||
if (message.getMessageText().contains(GroovyRtConstants.GROOVYC_STUB_GENERATION_FAILED)) {
|
||||
LOG.debug("Stub failed message: " + message);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (getStdErr().length() > 0) {
|
||||
LOG.debug("Non-empty stderr: '" + getStdErr() + "'");
|
||||
|
||||
+1
@@ -35,4 +35,5 @@ public class GroovyRtConstants {
|
||||
public static final String CLEAR_PRESENTABLE = "$@#$%^ CLEAR_PRESENTABLE";
|
||||
public static final String NO_GROOVY = "Cannot compile Groovy files: no Groovy library is defined";
|
||||
public static final String OPTIMIZE = "optimize";
|
||||
public static final String GROOVYC_STUB_GENERATION_FAILED = "Groovyc stub generation failed";
|
||||
}
|
||||
|
||||
@@ -194,7 +194,7 @@ public class GroovyCompilerWrapper {
|
||||
|
||||
if (forStubs) {
|
||||
collector.add(new CompilerMessage(GroovyCompilerMessageCategories.INFORMATION,
|
||||
"Groovyc stub generation failed", null, -1, -1));
|
||||
GroovyRtConstants.GROOVYC_STUB_GENERATION_FAILED, null, -1, -1));
|
||||
}
|
||||
|
||||
final StringWriter writer = new StringWriter();
|
||||
|
||||
+119
-26
@@ -33,7 +33,10 @@ import com.intellij.psi.util.CachedValuesManager;
|
||||
import com.intellij.psi.xml.XmlFile;
|
||||
import com.intellij.psi.xml.XmlTag;
|
||||
import com.intellij.reference.SoftLazyValue;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import com.intellij.util.SmartList;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
import com.intellij.util.containers.MultiMap;
|
||||
import gnu.trove.THashMap;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
@@ -47,29 +50,54 @@ import java.util.*;
|
||||
* Date: 7/26/11
|
||||
*/
|
||||
public class XmlPropertiesFileImpl extends XmlPropertiesFile {
|
||||
|
||||
private static final Key<CachedValue<PropertiesFile>> KEY = Key.create("xml properties file");
|
||||
private final XmlFile myFile;
|
||||
private final SoftLazyValue<MultiMap<String, IProperty>> myPropertiesMap = new SoftLazyValue<MultiMap<String, IProperty>>() {
|
||||
private final SoftLazyValue<Info> myInfo = new SoftLazyValue<Info>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected MultiMap<String, IProperty> compute() {
|
||||
XmlTag rootTag = myFile.getRootTag();
|
||||
if (rootTag == null) {
|
||||
return MultiMap.emptyInstance();
|
||||
}
|
||||
|
||||
XmlTag[] entries = rootTag.findSubTags("entry");
|
||||
MultiMap<String, IProperty> map = new MultiMap<String, IProperty>();
|
||||
|
||||
for (XmlTag entry : entries) {
|
||||
XmlProperty property = new XmlProperty(entry, XmlPropertiesFileImpl.this);
|
||||
map.putValue(property.getKey(), property);
|
||||
}
|
||||
return map;
|
||||
protected Info compute() {
|
||||
return new Info();
|
||||
}
|
||||
};
|
||||
|
||||
private class Info {
|
||||
private final MultiMap<String, IProperty> myPropertiesMap = MultiMap.create();
|
||||
private List<IProperty> myPropertiesOrder;
|
||||
private boolean mySorted;
|
||||
|
||||
public Info() {
|
||||
XmlTag rootTag = myFile.getRootTag();
|
||||
final List<IProperty> propertiesOrder = new ArrayList<IProperty>();
|
||||
if (rootTag != null) {
|
||||
XmlTag[] entries = rootTag.findSubTags("entry");
|
||||
for (XmlTag entry : entries) {
|
||||
XmlProperty property = new XmlProperty(entry, XmlPropertiesFileImpl.this);
|
||||
propertiesOrder.add(property);
|
||||
myPropertiesMap.putValue(property.getKey(), property);
|
||||
}
|
||||
}
|
||||
mySorted = PropertiesImplUtil.isAlphaSorted(propertiesOrder);
|
||||
myPropertiesOrder = mySorted ? propertiesOrder : null;
|
||||
}
|
||||
|
||||
public void setSorted(boolean sorted) {
|
||||
mySorted = sorted;
|
||||
myPropertiesOrder = null;
|
||||
}
|
||||
|
||||
public MultiMap<String, IProperty> getPropertiesMap() {
|
||||
return myPropertiesMap;
|
||||
}
|
||||
|
||||
public List<IProperty> getPropertiesOrder() {
|
||||
return myPropertiesOrder;
|
||||
}
|
||||
|
||||
public boolean isSorted() {
|
||||
return mySorted;
|
||||
}
|
||||
}
|
||||
|
||||
private XmlPropertiesFileImpl(XmlFile file) {
|
||||
myFile = file;
|
||||
}
|
||||
@@ -83,19 +111,19 @@ public class XmlPropertiesFileImpl extends XmlPropertiesFile {
|
||||
@NotNull
|
||||
@Override
|
||||
public List<IProperty> getProperties() {
|
||||
return new ArrayList<IProperty>(myPropertiesMap.getValue().values());
|
||||
return new ArrayList<IProperty>(myInfo.getValue().getPropertiesMap().values());
|
||||
}
|
||||
|
||||
@Override
|
||||
public IProperty findPropertyByKey(@NotNull @NonNls String key) {
|
||||
Collection<IProperty> properties = myPropertiesMap.getValue().get(key);
|
||||
Collection<IProperty> properties = myInfo.getValue().getPropertiesMap().get(key);
|
||||
return properties.isEmpty() ? null : properties.iterator().next();
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public List<IProperty> findPropertiesByKey(@NotNull @NonNls String key) {
|
||||
return new ArrayList<IProperty>(myPropertiesMap.getValue().get(key));
|
||||
return new ArrayList<IProperty>(myInfo.getValue().getPropertiesMap().get(key));
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@@ -122,22 +150,62 @@ public class XmlPropertiesFileImpl extends XmlPropertiesFile {
|
||||
|
||||
@Override
|
||||
public IProperty addPropertyAfter(String key, String value, Property anchor) {
|
||||
return null;
|
||||
return addPropertyAfterAndCheckAlphaSorting(key, value, anchor, true, true);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
public IProperty addPropertyAfterAndCheckAlphaSorting(String key, String value, @Nullable IProperty anchor, boolean addToEnd, boolean checkAlphaSorting) {
|
||||
final XmlTag anchorTag = anchor == null ? null : (XmlTag)anchor.getPsiElement();
|
||||
final XmlTag rootTag = myFile.getRootTag();
|
||||
final XmlTag entry = createPropertyTag(key, value);
|
||||
final XmlTag addedEntry = (XmlTag) (anchorTag == null ? myFile.getRootTag().addSubTag(entry, !addToEnd) : rootTag.addAfter(entry, anchorTag));
|
||||
final XmlProperty property = new XmlProperty(addedEntry, this);
|
||||
myInfo.getValue().getPropertiesMap().putValue(key, property);
|
||||
if (checkAlphaSorting) {
|
||||
checkAlphaSorting(property);
|
||||
}
|
||||
return property;
|
||||
}
|
||||
|
||||
@NotNull
|
||||
@Override
|
||||
public IProperty addProperty(String key, String value) {
|
||||
final XmlTag entry = createPropertyTag(key, value);
|
||||
if (myInfo.getValue().isSorted()) {
|
||||
final XmlProperty dummyProperty = new XmlProperty(entry, this);
|
||||
final int insertIndex = Collections.binarySearch(myInfo.getValue().getPropertiesOrder(), dummyProperty, new Comparator<IProperty>() {
|
||||
@Override
|
||||
public int compare(IProperty p1, IProperty p2) {
|
||||
final String k1 = p1.getKey();
|
||||
final String k2 = p2.getKey();
|
||||
return k1.compareTo(k2);
|
||||
}
|
||||
});
|
||||
final IProperty insertPosition;
|
||||
final IProperty inserted;
|
||||
if (insertIndex == -1) {
|
||||
inserted = addPropertyAfterAndCheckAlphaSorting(key, value, null, false, false);
|
||||
myInfo.getValue().getPropertiesOrder().add(0, inserted);
|
||||
}
|
||||
else {
|
||||
final int position = insertIndex < 0 ? -insertIndex - 2 : insertIndex;
|
||||
insertPosition = myInfo.getValue().getPropertiesOrder().get(position);
|
||||
inserted = addPropertyAfterAndCheckAlphaSorting(key, value, insertPosition, false, false);
|
||||
myInfo.getValue().getPropertiesOrder().add(position + 1, inserted);
|
||||
}
|
||||
return inserted;
|
||||
} else {
|
||||
return addPropertyAfterAndCheckAlphaSorting(key, value, null, true, false);
|
||||
}
|
||||
}
|
||||
|
||||
private XmlTag createPropertyTag(final String key, final String value) {
|
||||
XmlTag rootTag = myFile.getRootTag();
|
||||
XmlTag entry = rootTag.createChildTag("entry", "", value, false);
|
||||
entry.setAttribute("key", key);
|
||||
rootTag.addSubTag(entry, false);
|
||||
final XmlProperty property = new XmlProperty(entry, this);
|
||||
myPropertiesMap.getValue().putValue(key, property);
|
||||
return property;
|
||||
return entry;
|
||||
}
|
||||
|
||||
|
||||
public static PropertiesFile getPropertiesFile(final PsiFile file) {
|
||||
CachedValuesManager manager = CachedValuesManager.getManager(file.getProject());
|
||||
if (file instanceof XmlFile) {
|
||||
@@ -194,7 +262,7 @@ public class XmlPropertiesFileImpl extends XmlPropertiesFile {
|
||||
|
||||
@Override
|
||||
public boolean isAlphaSorted() {
|
||||
return PropertiesImplUtil.isAlphaSorted(getProperties());
|
||||
return myInfo.getValue().isSorted();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -213,4 +281,29 @@ public class XmlPropertiesFileImpl extends XmlPropertiesFile {
|
||||
public int hashCode() {
|
||||
return myFile.hashCode();
|
||||
}
|
||||
|
||||
private void checkAlphaSorting(final IProperty property) {
|
||||
if (myInfo.getValue().isSorted()) {
|
||||
final String key = property.getKey();
|
||||
final XmlTag prev = getSibling((XmlTag)property.getPsiElement(), true);
|
||||
final String prevKey = prev == null ? null : new XmlProperty(prev, this).getKey();
|
||||
if (prevKey != null && key != null && prevKey.compareTo(key) > 0) {
|
||||
myInfo.getValue().setSorted(false);
|
||||
} else {
|
||||
final XmlTag next = getSibling((XmlTag)property.getPsiElement(), false);
|
||||
final String nextKey = next == null ? null : new XmlProperty(next, this).getKey();
|
||||
if (nextKey != null && key != null && nextKey.compareTo(key) < 0) {
|
||||
myInfo.getValue().setSorted(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static XmlTag getSibling(final XmlTag entry, final boolean prev) {
|
||||
XmlTag sibling = (XmlTag)(prev ? entry.getPrevSibling() : entry.getNextSibling());
|
||||
while (sibling != null && !"entry".equals(sibling.getName())) {
|
||||
sibling = (XmlTag)(prev ? sibling.getPrevSibling() : sibling.getNextSibling());
|
||||
}
|
||||
return sibling;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE properties SYSTEM "http://java.sun.com/dtd/properties.dtd">
|
||||
<properties>
|
||||
<comment>Hi</comment>
|
||||
<entry key="c">bar</entry>
|
||||
<entry key="m">baz</entry>
|
||||
</properties>
|
||||
@@ -9,6 +9,8 @@ import com.intellij.openapi.command.WriteCommandAction;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.PlatformTestCase;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.containers.ContainerUtil;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -81,6 +83,23 @@ public class XmlPropertiesTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
assertEquals("vvv", property2.getValue());
|
||||
}
|
||||
|
||||
public void testAddPropertyInAlphaOrder() {
|
||||
final PsiFile psiFile = myFixture.configureByFile("bar.xml");
|
||||
final PropertiesFile propertiesFile = PropertiesImplUtil.getPropertiesFile(psiFile);
|
||||
assertNotNull(propertiesFile);
|
||||
|
||||
WriteCommandAction.runWriteCommandAction(getProject(), new Runnable() {
|
||||
public void run() {
|
||||
propertiesFile.addProperty("d", "vvv");
|
||||
propertiesFile.addProperty("a", "vvv");
|
||||
propertiesFile.addProperty("l", "vvv");
|
||||
propertiesFile.addProperty("v", "vvv");
|
||||
}
|
||||
});
|
||||
assertTrue(propertiesFile.isAlphaSorted());
|
||||
assertTrue(PropertiesImplUtil.getPropertiesFile(psiFile).isAlphaSorted());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getTestDataPath() {
|
||||
return PluginPathManager.getPluginHomePath("properties") + "/testData/xml/";
|
||||
|
||||
@@ -24,17 +24,26 @@ def report_data(dumper):
|
||||
command = utility.fetch_command(command_name)
|
||||
assert isinstance(command, BaseCommand)
|
||||
dumper.start_command(command_name=command_name,
|
||||
command_help_text=str(command.usage("").replace("%prog", command_name)), # TODO: support subcommands
|
||||
command_help_text=str(command.usage("").replace("%prog", command_name)),
|
||||
# TODO: support subcommands
|
||||
command_args_text=str(command.args))
|
||||
for opt in command.option_list:
|
||||
opt_type = opt.type if opt.type in Option.TYPES else "" # Empty for unknown
|
||||
num_of_args = int(opt.nargs) if opt.nargs else 0
|
||||
opt_type = None
|
||||
if num_of_args > 0:
|
||||
# If option accepts arg, we need to determine its type. It could be int, choices, or something other
|
||||
# See https://docs.python.org/2/library/optparse.html#standard-option-types
|
||||
if opt.type in ["int", "long"]:
|
||||
opt_type = "int"
|
||||
elif opt.choices:
|
||||
assert isinstance(opt.choices, list), "Choices should be list"
|
||||
opt_type = opt.choices
|
||||
|
||||
# There is no official way to access this field, so I use protected one. At least it is public API.
|
||||
# noinspection PyProtectedMember
|
||||
dumper.add_command_option(
|
||||
opt_type=opt_type,
|
||||
choices=opt.choices,
|
||||
long_opt_names=opt._long_opts,
|
||||
short_opt_names=opt._short_opts,
|
||||
help_text=opt.help,
|
||||
num_of_args=opt.nargs)
|
||||
argument_info=(num_of_args, opt_type) if num_of_args else None)
|
||||
dumper.close_command()
|
||||
@@ -6,13 +6,17 @@ It does not have schema (yet!) but here is XML format it uses.
|
||||
|
||||
<commandInfo-array> -- root
|
||||
<commandInfo args="args description" help="human readable text" name="command name"> -- info about command
|
||||
<option help="option help" numberOfArgs="number of values (nargs)" type="option type: Option.TYPES"> -- one entry for each option
|
||||
<option help="option help" numberOfArgs="number of values (nargs)" type="option_type (see below)"> -- one entry for each option
|
||||
<longNames>--each-for-one-long-opt-name</longNames>
|
||||
<shortNames>-each-for-one-short-name</shortNames>
|
||||
<choices>--each-for-one-available-value</choices>
|
||||
</option>
|
||||
</commandInfo>
|
||||
</commandInfo-array>
|
||||
|
||||
"option_type" is only set if "numberOfArgs" > 0, and it can be: "int" (means integer),
|
||||
"choices" (means opt can have one of the values, provided in choices) or "str" that means "string" (option may have any value)
|
||||
|
||||
Classes like DjangoCommandsInfo is used on Java side.
|
||||
|
||||
"""
|
||||
@@ -77,35 +81,45 @@ class XmlDumper(object):
|
||||
self.__command_element.setAttribute("args", command_args_text)
|
||||
self.__root.appendChild(self.__command_element)
|
||||
|
||||
def add_command_option(self, opt_type, choices, long_opt_names, short_opt_names, help_text, num_of_args):
|
||||
def add_command_option(self, long_opt_names, short_opt_names, help_text, argument_info):
|
||||
"""
|
||||
Adds command option
|
||||
|
||||
:param opt_type: "string", "int", "long", "float", "complex", "choice"
|
||||
:param choices: list of choices for "choice" type
|
||||
:param argument_info: None if option does not accept any arguments or tuple of (num_of_args, type_info) \
|
||||
where num_of_args is int > 0 and type_info is str, representing type (only "int" and "string" are supported) \
|
||||
or list of available types in case of choices
|
||||
|
||||
:param long_opt_names: list of long opt names
|
||||
:param short_opt_names: list of short opt names
|
||||
:param help_text: help text
|
||||
:param num_of_args: number of arguments
|
||||
|
||||
:type opt_type str
|
||||
:type choices list of string
|
||||
:type long_opt_names list of str
|
||||
:type short_opt_names list of str
|
||||
:type help_text str
|
||||
:type num_of_args int
|
||||
:type argument_info tuple
|
||||
"""
|
||||
assert isinstance(self.__command_element, Element), "Add option in command only"
|
||||
option = self.__document.createElement("option")
|
||||
option.setAttribute("type", opt_type)
|
||||
|
||||
if choices:
|
||||
self.__create_text_array(option, "choices", choices)
|
||||
option = self.__document.createElement("option")
|
||||
|
||||
opt_type_to_report = None
|
||||
num_of_args = 0
|
||||
|
||||
if argument_info:
|
||||
(num_of_args, type_info) = argument_info
|
||||
if isinstance(type_info, list):
|
||||
self.__create_text_array(option, "choices", type_info)
|
||||
opt_type_to_report = "choices"
|
||||
else:
|
||||
opt_type_to_report = "int" if str(type_info) == "int" else "str"
|
||||
|
||||
if long_opt_names:
|
||||
self.__create_text_array(option, "longNames", long_opt_names)
|
||||
if short_opt_names:
|
||||
self.__create_text_array(option, "shortNames", short_opt_names)
|
||||
|
||||
if opt_type_to_report:
|
||||
option.setAttribute("type", opt_type_to_report)
|
||||
option.setAttribute("help", help_text)
|
||||
if num_of_args:
|
||||
option.setAttribute("numberOfArgs", str(num_of_args))
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.commandInterface.commandBasedChunkDriver;
|
||||
package com.jetbrains.python.commandInterface.command;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.commandInterface.commandBasedChunkDriver;
|
||||
package com.jetbrains.python.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
+10
-2
@@ -13,15 +13,17 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.commandInterface.commandBasedChunkDriver;
|
||||
package com.jetbrains.python.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.module.Module;
|
||||
import com.jetbrains.python.commandLineParser.CommandLineParseResult;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command with arguments
|
||||
* Command with arguments and options
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
@@ -47,6 +49,12 @@ public interface Command {
|
||||
@NotNull
|
||||
ArgumentsInfo getArgumentsInfo();
|
||||
|
||||
/**
|
||||
* @return command options
|
||||
*/
|
||||
@NotNull
|
||||
List<Option> getOptions();
|
||||
|
||||
/**
|
||||
* Execute command
|
||||
*
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.commandInterface.commandBasedChunkDriver;
|
||||
package com.jetbrains.python.commandInterface.command;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.commandInterface.commandBasedChunkDriver;
|
||||
package com.jetbrains.python.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -0,0 +1,92 @@
|
||||
/*
|
||||
* 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.jetbrains.python.commandInterface.command;
|
||||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Command option
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public final class Option {
|
||||
@NotNull
|
||||
private final List<String> myLongNames = new ArrayList<String>();
|
||||
@NotNull
|
||||
private final List<String> myShortNames = new ArrayList<String>();
|
||||
@Nullable
|
||||
private final Pair<Integer, OptionArgumentInfo> myArgumentAndQuantity;
|
||||
@NotNull
|
||||
private final String myHelp;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param argumentAndQuantity if option accepts argument, there should be pair of [argument_quantity, its_type_info]
|
||||
* @param help option help
|
||||
* @param shortNames option short names
|
||||
* @param longNames option long names
|
||||
*/
|
||||
public Option(@Nullable final Pair<Integer, OptionArgumentInfo> argumentAndQuantity,
|
||||
@NotNull final String help,
|
||||
@NotNull final Collection<String> shortNames,
|
||||
@NotNull final Collection<String> longNames) {
|
||||
Preconditions.checkArgument(argumentAndQuantity == null || argumentAndQuantity.first > 0, "Illegal args and quantity: " + argumentAndQuantity);
|
||||
myArgumentAndQuantity = argumentAndQuantity;
|
||||
myShortNames.addAll(shortNames);
|
||||
myLongNames.addAll(longNames);
|
||||
myHelp = help;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Option long names
|
||||
*/
|
||||
@NotNull
|
||||
public List<String> getLongNames() {
|
||||
return Collections.unmodifiableList(myLongNames);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Option short names
|
||||
*/
|
||||
@NotNull
|
||||
public List<String> getShortNames() {
|
||||
return Collections.unmodifiableList(myShortNames);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return if option accepts argument -- pair of [argument_quantity, its_type_info]. Null otherwise.
|
||||
*/
|
||||
@Nullable
|
||||
Pair<Integer, OptionArgumentInfo> getArgumentAndQuantity() {
|
||||
return myArgumentAndQuantity;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Option help
|
||||
*/
|
||||
@NotNull
|
||||
public String getHelp() {
|
||||
return myHelp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.jetbrains.python.commandInterface.command;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Information about option argument
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public interface OptionArgumentInfo {
|
||||
/**
|
||||
* Validates argument value
|
||||
*
|
||||
* @param value value to validate
|
||||
* @return true if valid
|
||||
*/
|
||||
boolean isValid(@NotNull String value);
|
||||
|
||||
/**
|
||||
* @return list of available values (if argument is based on list of choices), or null if any value is accepted (but should be validated)
|
||||
*/
|
||||
@Nullable
|
||||
List<String> getAvailableValues();
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
/*
|
||||
* 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.jetbrains.python.commandInterface.command;
|
||||
|
||||
/**
|
||||
* Argument type to be used with {@link OptionTypedArgumentInfo}
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public enum OptionArgumentType {
|
||||
/**
|
||||
* String (actually, anything)
|
||||
*/
|
||||
STRING,
|
||||
/**
|
||||
* Integer or long
|
||||
*/
|
||||
INTEGER
|
||||
}
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/*
|
||||
* 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.jetbrains.python.commandInterface.command;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* For options, whose argument is based on list of choices
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
public final class OptionChoiceBasedArgumentInfo implements OptionArgumentInfo {
|
||||
@NotNull
|
||||
private final List<String> myChoices = new ArrayList<String>();
|
||||
|
||||
/**
|
||||
* @param choices available choices
|
||||
*/
|
||||
public OptionChoiceBasedArgumentInfo(@NotNull final Collection<String> choices) {
|
||||
myChoices.addAll(choices);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(@NotNull final String value) {
|
||||
return myChoices.contains(value);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getAvailableValues() {
|
||||
return Collections.unmodifiableList(myChoices);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
/*
|
||||
* 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.jetbrains.python.commandInterface.command;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* For options, whose argument is based on certain type.
|
||||
*
|
||||
* @author Ilya.Kazakevich
|
||||
* @see com.jetbrains.python.commandInterface.command.OptionArgumentType
|
||||
*/
|
||||
public final class OptionTypedArgumentInfo implements OptionArgumentInfo {
|
||||
@NotNull
|
||||
private final OptionArgumentType myType;
|
||||
|
||||
/**
|
||||
* @param type type argument(s) of this option may have
|
||||
*/
|
||||
public OptionTypedArgumentInfo(@NotNull final OptionArgumentType type) {
|
||||
myType = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValid(@NotNull final String value) {
|
||||
// We only check integer for now
|
||||
if (myType == OptionArgumentType.INTEGER) {
|
||||
try {
|
||||
// We just parse it to get exception
|
||||
//noinspection ResultOfMethodCallIgnored
|
||||
Integer.parseInt(value);
|
||||
}
|
||||
catch (final NumberFormatException ignored) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public List<String> getAvailableValues() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.jetbrains.python.commandInterface.commandBasedChunkDriver;
|
||||
package com.jetbrains.python.commandInterface.command;
|
||||
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -0,0 +1,23 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
/**
|
||||
* Command with arguments and options.
|
||||
* Each {@link com.jetbrains.python.commandInterface.command.Command} may have one or more positional {@link com.jetbrains.python.commandInterface.command.Argument arguments}
|
||||
* and several {@link com.jetbrains.python.commandInterface.command.Option options}.
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.jetbrains.python.commandInterface.command;
|
||||
+3
@@ -23,6 +23,9 @@ import com.jetbrains.python.commandInterface.chunkDriverBasedPresenter.ChunkDriv
|
||||
import com.jetbrains.python.commandInterface.chunkDriverBasedPresenter.ChunkInfo;
|
||||
import com.jetbrains.python.commandInterface.chunkDriverBasedPresenter.ParseInfo;
|
||||
import com.jetbrains.python.commandInterface.chunkDriverBasedPresenter.SuggestionInfo;
|
||||
import com.jetbrains.python.commandInterface.command.Argument;
|
||||
import com.jetbrains.python.commandInterface.command.ArgumentsInfo;
|
||||
import com.jetbrains.python.commandInterface.command.Command;
|
||||
import com.jetbrains.python.commandLineParser.CommandLineParseResult;
|
||||
import com.jetbrains.python.commandLineParser.CommandLineParser;
|
||||
import com.jetbrains.python.commandLineParser.CommandLinePartType;
|
||||
|
||||
+3
-1
@@ -16,12 +16,14 @@
|
||||
|
||||
/**
|
||||
* {@link com.jetbrains.python.commandInterface.chunkDriverBasedPresenter.ChunkDriver} implementation based on idea of
|
||||
* {@link com.jetbrains.python.commandInterface.commandBasedChunkDriver.Command command} and its {@link com.jetbrains.python.commandInterface.commandBasedChunkDriver.Argument arguments}.
|
||||
* {@link com.jetbrains.python.commandInterface.command command, option and argument}.
|
||||
*
|
||||
* See {@link com.jetbrains.python.commandInterface.commandBasedChunkDriver.CommandBasedChunkDriver} as entry point.
|
||||
* It parses command line using {@link com.jetbrains.python.commandLineParser.CommandLineParser} and finds matching command and arguments
|
||||
* provided by user
|
||||
*
|
||||
* @see com.jetbrains.python.commandInterface.command
|
||||
* @see com.jetbrains.python.commandInterface.command.Command
|
||||
* @author Ilya.Kazakevich
|
||||
*/
|
||||
package com.jetbrains.python.commandInterface.commandBasedChunkDriver;
|
||||
@@ -15,8 +15,10 @@
|
||||
*/
|
||||
package com.jetbrains.python.debugger;
|
||||
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.util.Computable;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.openapi.vfs.JarFileSystem;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
@@ -166,8 +168,14 @@ public class PyLocalPositionConverter implements PyPositionConverter {
|
||||
}
|
||||
}
|
||||
|
||||
private static int convertRemoteLineToLocal(VirtualFile vFile, int line) {
|
||||
final Document document = FileDocumentManager.getInstance().getDocument(vFile);
|
||||
private static int convertRemoteLineToLocal(final VirtualFile vFile, int line) {
|
||||
final Document document = ApplicationManager.getApplication().runReadAction(new Computable<Document>() {
|
||||
@Override
|
||||
public Document compute() {
|
||||
return FileDocumentManager.getInstance().getDocument(vFile);
|
||||
}
|
||||
});
|
||||
|
||||
line--;
|
||||
if (document != null) {
|
||||
while (PyDebugSupportUtils.isContinuationLine(document, line - 1)) {
|
||||
|
||||
@@ -394,7 +394,9 @@ message.node.class.has.no.fields=Class has no fields
|
||||
message.node.object.collected=Object has been garbage collected during method invocation
|
||||
message.node.thread.running=Thread is running
|
||||
message.node.thread.has.no.frames=Thread has no frames
|
||||
message.node.evaluation.not.possible=Target VM is not paused by breakpoint request. Evaluation of methods is not possible in this mode
|
||||
message.node.evaluation.not.possible=Target VM is not paused by breakpoint request. Evaluation of methods is not possible in this mode
|
||||
message.node.show.image=\u2026 Show image
|
||||
message.node.show.icon=\u2026 Show icon
|
||||
label.thread.node.thread.collected=Thread ''{0}'' has been garbage-collected
|
||||
label.thread.node=\"{0}\"@{1}: {2}
|
||||
label.thread.node.in.group=\"{0}\"@{1} in group \"{3}\": {2}
|
||||
|
||||
@@ -1495,6 +1495,11 @@
|
||||
<debugger.syntheticProvider implementation="com.intellij.debugger.engine.DefaultSyntheticProvider"/>
|
||||
<debugger.sourcePositionProvider implementation="com.intellij.debugger.engine.DefaultSourcePositionProvider" order="last"/>
|
||||
|
||||
<debugger.nodeRenderer implementation="com.intellij.debugger.settings.ColorObjectRenderer"/>
|
||||
<debugger.nodeRenderer implementation="com.intellij.debugger.settings.ImageObjectRenderer"/>
|
||||
<debugger.nodeRenderer implementation="com.intellij.debugger.settings.IconObjectRenderer"/>
|
||||
<debugger.nodeRenderer implementation="com.intellij.debugger.settings.GraphicsObjectRenderer"/>
|
||||
|
||||
<applicationService serviceInterface="com.intellij.remoteServer.runtime.deployment.debug.JavaDebuggerLauncher"
|
||||
serviceImplementation="com.intellij.remoteServer.impl.runtime.deployment.debug.JavaDebuggerLauncherImpl"/>
|
||||
|
||||
|
||||
@@ -145,7 +145,7 @@ public class XmlEmmetConfigurable implements SearchableConfigurable, Disposable,
|
||||
@Nls
|
||||
@Override
|
||||
public String getDisplayName() {
|
||||
return "XML";
|
||||
return "HTML";
|
||||
}
|
||||
|
||||
@Nullable
|
||||
|
||||
Reference in New Issue
Block a user