Merge remote-tracking branch 'origin/master'

This commit is contained in:
Roman Shevchenko
2015-01-06 18:43:16 +01:00
16 changed files with 142 additions and 136 deletions
@@ -286,10 +286,12 @@ class JavaPredefinedConfigurations {
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.fields.variables.read"),"'Symbol:[read]",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.fields_variables.with.given.name.pattern.updated"),"'Symbol:[regex( name ) && write]",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.usage.of.derived.type.in.cast"),"('CastType:*Base ) 'Expr",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.boxing.in.declarations"),"'_Type:Integer|Boolean|Long|Character|Short|Byte 'Var = '_Value:[formal( int|boolean|long|char|short|byte )]",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.unboxing.in.declarations"),"'_Type:int|boolean|long|char|short|byte 'Var = '_Value:[formal( Integer|Boolean|Long|Character|Short|Byte )]",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.boxing.in.method.calls"),"'_Instance?.'Call('_BeforeParam*,'_Param:[ exprtype( int|boolean|long|char|short|byte ) && formal( Integer|Boolean|Long|Character|Short|Byte )],'_AfterParam*)",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.boxing.in.declarations"),"'_Type:Object|Integer|Boolean|Long|Character|Short|Byte 'Var = '_Value:[exprtype( int|boolean|long|char|short|byte )]",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.unboxing.in.declarations"),"'_Type:int|boolean|long|char|short|byte 'Var = '_Value:[exprtype( Integer|Boolean|Long|Character|Short|Byte )]",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.boxing.in.method.calls"),"'_Instance?.'Call('_BeforeParam*,'_Param:[ exprtype( int|boolean|long|char|short|byte ) && formal( Object|Integer|Boolean|Long|Character|Short|Byte )],'_AfterParam*)",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.unboxing.in.method.calls"), "'_Instance?.'Call('_BeforeParam*,'_Param:[ formal( int|boolean|long|char|short|byte ) && exprtype( Integer|Boolean|Long|Character|Short|Byte )],'_AfterParam*)",INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.any.boxing"), "'_expression:[ exprtype( int|boolean|long|char|short|byte ) && formal( Object|Integer|Boolean|Long|Character|Short|Byte )]", INTERESTING_TYPE),
createSearchTemplateInfo(SSRBundle.message("predefined.configuration.any.unboxing"), "'_expression:[ formal( int|boolean|long|char|short|byte ) && exprtype( Integer|Boolean|Long|Character|Short|Byte )]", INTERESTING_TYPE),
//createSearchTemplateInfo("methods called","'_?.'_:[ref('Method)] ('_*)", INTERESTING_TYPE),
//createSearchTemplateInfo("fields selected","'_?.'_:[ref('Field)] ", INTERESTING_TYPE),
//createSearchTemplateInfo("symbols used","'_:[ref('Symbol)] ", INTERESTING_TYPE),
@@ -1,8 +1,9 @@
package com.intellij.structuralsearch.impl.matcher.predicates;
import com.intellij.psi.PsiExpression;
import com.intellij.psi.PsiType;
import com.intellij.structuralsearch.impl.matcher.MatchContext;
import com.intellij.psi.*;
import com.intellij.psi.util.PsiTreeUtil;
import com.siyeh.ig.psiutils.ExpectedTypeUtils;
/**
* Created by IntelliJ IDEA.
@@ -13,26 +14,11 @@ import com.intellij.psi.util.PsiTreeUtil;
*/
public class FormalArgTypePredicate extends ExprTypePredicate {
public FormalArgTypePredicate(String type, String baseName, boolean _withinHierarchy, boolean caseSensitiveMatch,boolean target) {
super(type, baseName, _withinHierarchy, caseSensitiveMatch, target);
public FormalArgTypePredicate(String type, String baseName, boolean withinHierarchy, boolean caseSensitiveMatch, boolean target) {
super(type, baseName, withinHierarchy, caseSensitiveMatch, target);
}
protected PsiType evalType(PsiExpression match, MatchContext context) {
final PsiMethodCallExpression expr = PsiTreeUtil.getParentOfType(match,PsiMethodCallExpression.class);
if (expr == null) return null;
// find our parent in parameters of the method
final PsiMethod psiMethod = expr.resolveMethod();
if (psiMethod == null) return null;
final PsiParameter[] methodParameters = psiMethod.getParameterList().getParameters();
final PsiExpression[] expressions = expr.getArgumentList().getExpressions();
for(int i = 0;i < methodParameters.length; ++i) {
if (expressions[i] == match) {
if (i < methodParameters.length) return methodParameters[i].getType();
break;
}
}
return null;
return ExpectedTypeUtils.findExpectedType(match, true, true);
}
}
@@ -66,8 +66,8 @@ public class CommentByLineCommentHandler extends MultiCaretCodeInsightActionHand
@Override
// first pass - adjacent carets are grouped into blocks
public void invoke(@NotNull Project project, @NotNull Editor editor, @NotNull Caret caret, @NotNull PsiFile file) {
if (!CodeInsightUtilBase.prepareEditorForWrite(editor)) return;
myProject = project;
if (!CodeInsightUtilBase.prepareEditorForWrite(editor)) return;
file = file.getViewProvider().getPsi(file.getViewProvider().getBaseLanguage());
PsiElement context = InjectedLanguageManager.getInstance(file.getProject()).getInjectionHost(file);
@@ -51,7 +51,6 @@ import com.intellij.util.IJSwingUtilities;
import com.intellij.util.ObjectUtils;
import com.intellij.util.PlatformUtils;
import com.intellij.util.containers.ContainerUtil;
import com.intellij.util.ui.JBFont;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import org.jdom.Element;
@@ -729,18 +728,19 @@ public final class LafManagerImpl extends LafManager implements ApplicationCompo
}
private void patchLafFonts(UIDefaults uiDefaults) {
if (JBUI.isHiDPI()) {
HashMap<Object, Font> newFonts = new HashMap<Object, Font>();
for (Object key : uiDefaults.keySet().toArray()) {
Object val = uiDefaults.get(key);
if (val instanceof Font) {
newFonts.put(key, JBFont.create((Font)val));
}
}
for (Map.Entry<Object, Font> entry : newFonts.entrySet()) {
uiDefaults.put(entry.getKey(), entry.getValue());
}
} else if (UISettings.getInstance().OVERRIDE_NONIDEA_LAF_FONTS) {
//if (JBUI.isHiDPI()) {
// HashMap<Object, Font> newFonts = new HashMap<Object, Font>();
// for (Object key : uiDefaults.keySet().toArray()) {
// Object val = uiDefaults.get(key);
// if (val instanceof Font) {
// newFonts.put(key, JBFont.create((Font)val));
// }
// }
// for (Map.Entry<Object, Font> entry : newFonts.entrySet()) {
// uiDefaults.put(entry.getKey(), entry.getValue());
// }
//} else
if (UISettings.getInstance().OVERRIDE_NONIDEA_LAF_FONTS) {
storeOriginalFontDefaults(uiDefaults);
initFontDefaults(uiDefaults, myUiSettings.FONT_FACE, myUiSettings.FONT_SIZE);
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 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.
@@ -19,14 +19,13 @@ import com.intellij.ide.ui.laf.darcula.DarculaUIUtil;
import com.intellij.openapi.ui.GraphicsConfig;
import com.intellij.ui.ColorUtil;
import com.intellij.ui.Gray;
import com.intellij.util.ui.EmptyIcon;
import com.intellij.util.ui.GraphicsUtil;
import com.intellij.util.ui.JBUI;
import com.intellij.util.ui.UIUtil;
import sun.swing.SwingUtilities2;
import javax.swing.*;
import javax.swing.plaf.ComponentUI;
import javax.swing.plaf.IconUIResource;
import javax.swing.plaf.basic.BasicHTML;
import javax.swing.plaf.metal.MetalRadioButtonUI;
import javax.swing.text.View;
@@ -75,13 +74,13 @@ public class DarculaRadioButtonUI extends MetalRadioButtonUI {
g.fillRect(0,0, size.width, size.height);
}
int rad = 5;
int rad = JBUI.scale(5);
// Paint the radio button
final int x = iconRect.x + (rad-1)/2;
final int y = iconRect.y + (rad-1)/2;
final int w = iconRect.width - (rad + 5) / 2;
final int h = iconRect.height - (rad + 5) / 2;
final int x = iconRect.x + (rad - (rad % 2 == 1?1:0))/2;
final int y = iconRect.y + (rad - (rad % 2 == 1?1:0))/2;
final int w = iconRect.width - rad;
final int h = iconRect.height - rad;
g.translate(x, y);
@@ -91,36 +90,37 @@ public class DarculaRadioButtonUI extends MetalRadioButtonUI {
g.setPaint(UIUtil.getGradientPaint(0, 0, ColorUtil.shift(c.getBackground(), 1.5),
0, c.getHeight(), ColorUtil.shift(c.getBackground(), 1.2)));
if (focus) {
g.fillOval(0, 1, w, h);
g.fillOval(0, JBUI.scale(1), w, h);
} else {
g.fillOval(0, 1, w - 1, h - 1);
g.fillOval(0, JBUI.scale(1), w - JBUI.scale(1), h - JBUI.scale(1));
}
if (focus) {
if (UIUtil.isRetina()) {
DarculaUIUtil.paintFocusOval(g, 1, 2, w-2, h-2);
if (UIUtil.isRetina() || JBUI.isHiDPI()) {
DarculaUIUtil.paintFocusOval(g, JBUI.scale(1), JBUI.scale(1)+1, w-JBUI.scale(2), h-JBUI.scale(2));
} else {
DarculaUIUtil.paintFocusOval(g, 0, 1, w, h);
DarculaUIUtil.paintFocusOval(g, 0, JBUI.scale(1), w, h);
}
} else {
if (UIUtil.isUnderDarcula()) {
g.setPaint(UIUtil.getGradientPaint(w / 2, 1, Gray._160.withAlpha(90), w / 2, h, Gray._100.withAlpha(90)));
g.drawOval(0, 2, w - 1, h - 1);
g.drawOval(0, JBUI.scale(1)+1, w - 1, h - 1);
g.setPaint(Gray._40.withAlpha(200));
g.drawOval(0, 1, w - 1, h - 1);
g.drawOval(0, JBUI.scale(1), w - 1, h - 1);
} else {
g.setPaint(b.isEnabled() ? Gray._30 : Gray._130);
g.drawOval(0, 1, w - 1, h - 1);
g.drawOval(0, JBUI.scale(1), w - 1, h - 1);
}
}
if (b.isSelected()) {
final boolean enabled = b.isEnabled();
g.setColor(UIManager.getColor(enabled ? "RadioButton.darcula.selectionEnabledShadowColor" : "RadioButton.darcula.selectionDisabledShadowColor"));// ? Gray._30 : Gray._60);
g.fillOval(w/2 - rad/2, h/2 , rad, rad);
final int yOff = UIUtil.isUnderDarcula() ? 2:1;
g.fillOval(w/2 - rad/2, h/2 - rad/2 + yOff , rad, rad);
g.setColor(UIManager.getColor(enabled ? "RadioButton.darcula.selectionEnabledColor" : "RadioButton.darcula.selectionDisabledColor")); //Gray._170 : Gray._120);
g.fillOval(w/2 - rad/2, h/2 - 1, rad, rad);
g.fillOval(w/2 - rad/2, h/2 - rad/2 -1 + yOff, rad, rad);
}
config.restore();
g.translate(-x, -y);
@@ -147,6 +147,6 @@ public class DarculaRadioButtonUI extends MetalRadioButtonUI {
@Override
public Icon getDefaultIcon() {
return new IconUIResource(EmptyIcon.create(20));
return JBUI.emptyIcon(20).asUIResource();
}
}
@@ -2,20 +2,23 @@ package org.jetbrains.concurrency;
import com.intellij.util.Consumer;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
class CountDownConsumer implements Consumer<Void> {
class CountDownConsumer<T> implements Consumer<T> {
private volatile int countDown;
private final AsyncPromise<Void> promise;
private final AsyncPromise<T> promise;
private final T totalResult;
public CountDownConsumer(int countDown, @NotNull AsyncPromise<Void> promise) {
public CountDownConsumer(int countDown, @NotNull AsyncPromise<T> promise, @Nullable T totalResult) {
this.countDown = countDown;
this.promise = promise;
this.totalResult = totalResult;
}
@Override
public void consume(Void t) {
public void consume(T t) {
if (--countDown == 0) {
promise.setResult(null);
promise.setResult(totalResult);
}
}
}
@@ -51,12 +51,18 @@ public abstract class Promise<T> {
@NotNull
public static Promise<Void> all(@NotNull Collection<Promise<?>> promises) {
return all(promises, null);
}
@NotNull
public static <T> Promise<T> all(@NotNull Collection<Promise<?>> promises, @Nullable T totalResult) {
if (promises.isEmpty()) {
return DONE;
//noinspection unchecked
return (Promise<T>)DONE;
}
final AsyncPromise<Void> totalPromise = new AsyncPromise<Void>();
Consumer done = new CountDownConsumer(promises.size(), totalPromise);
final AsyncPromise<T> totalPromise = new AsyncPromise<T>();
Consumer done = new CountDownConsumer<T>(promises.size(), totalPromise, totalResult);
Consumer<Throwable> rejected = new Consumer<Throwable>() {
@Override
public void consume(Throwable error) {
@@ -1,7 +1,6 @@
package org.jetbrains.debugger.connection;
import com.intellij.ide.browsers.WebBrowser;
import com.intellij.openapi.Disposable;
import com.intellij.util.io.socketConnection.ConnectionState;
import com.intellij.util.io.socketConnection.SocketConnectionListener;
import org.jetbrains.annotations.NotNull;
@@ -11,7 +10,7 @@ public interface BrowserConnection {
@NotNull
ConnectionState getState();
void addListener(@NotNull SocketConnectionListener listener, @NotNull Disposable parentDisposable);
void addListener(@NotNull SocketConnectionListener listener);
void executeOnStart(@NotNull Runnable runnable);
@@ -73,8 +73,8 @@ public abstract class VmConnection<T extends Vm> implements Disposable, BrowserC
}
@Override
public void addListener(@NotNull SocketConnectionListener listener, @NotNull Disposable parentDisposable) {
connectionDispatcher.addListener(listener, parentDisposable);
public void addListener(@NotNull SocketConnectionListener listener) {
connectionDispatcher.addListener(listener);
}
public DebugEventListener getDebugEventListener() {
@@ -90,7 +90,9 @@ public abstract class VmConnection<T extends Vm> implements Disposable, BrowserC
return;
}
opened.setError(Promise.createError("closed"));
if (opened.getState() == Promise.State.PENDING) {
opened.setError(Promise.createError("closed"));
}
setState(status, message);
Disposer.dispose(this, false);
}
@@ -102,7 +104,9 @@ public abstract class VmConnection<T extends Vm> implements Disposable, BrowserC
@NotNull
public Promise<Void> detachAndClose() {
opened.setError(Promise.createError("detached and closed"));
if (opened.getState() == Promise.State.PENDING) {
opened.setError(Promise.createError("detached and closed"));
}
Vm currentVm = vm;
Promise<Void> callback;
@@ -1,21 +1,22 @@
package org.jetbrains.debugger;
import com.intellij.openapi.util.ActionCallback;
import com.intellij.openapi.util.AsyncResult;
import com.intellij.openapi.util.Condition;
import com.intellij.openapi.util.Conditions;
import com.intellij.ui.SimpleTextAttributes;
import com.intellij.util.Consumer;
import com.intellij.xdebugger.frame.*;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.concurrency.AsyncFunction;
import org.jetbrains.concurrency.AsyncPromise;
import org.jetbrains.concurrency.Promise;
import org.jetbrains.debugger.values.ObjectValue;
import javax.swing.*;
import java.util.ArrayList;
import java.util.List;
public class TestCompositeNode implements XCompositeNode {
private final AsyncResult<XValueChildrenList> result = new AsyncResult<XValueChildrenList>();
private final AsyncPromise<XValueChildrenList> result = new AsyncPromise<XValueChildrenList>();
private final XValueChildrenList children = new XValueChildrenList();
private final XValueGroup valueGroup;
@@ -47,13 +48,13 @@ public class TestCompositeNode implements XCompositeNode {
}
if (last) {
result.setDone(this.children);
result.setResult(this.children);
}
}
@Override
public void tooManyChildren(int remaining) {
result.setDone(children);
result.setResult(children);
}
@Override
@@ -62,7 +63,7 @@ public class TestCompositeNode implements XCompositeNode {
@Override
public void setErrorMessage(@NotNull String errorMessage) {
result.reject(errorMessage);
result.setError(Promise.createError(errorMessage));
}
@Override
@@ -80,47 +81,17 @@ public class TestCompositeNode implements XCompositeNode {
}
@NotNull
public AsyncResult<XValueChildrenList> getResult() {
public Promise<XValueChildrenList> getResult() {
return result;
}
@NotNull
public AsyncResult<Content> loadContent(@NotNull final Condition<XValueGroup> groupContentResolveCondition, @NotNull final Condition<VariableView> valueSubContentResolveCondition) {
public Promise<Content> loadContent(@NotNull final Condition<XValueGroup> groupContentResolveCondition, @NotNull final Condition<VariableView> valueSubContentResolveCondition) {
assert content == null;
final AsyncResult<Content> compoundResult = new AsyncResult<Content>();
content = new Content();
result.doWhenDone(new Consumer<XValueChildrenList>() {
@Override
public void consume(XValueChildrenList children) {
ActionCallback.Chunk chunk = new ActionCallback.Chunk();
resolveGroups(children.getTopGroups(), content.topGroups, chunk);
for (int i = 0; i < children.size(); i++) {
XValue value = children.getValue(i);
TestValueNode node = new TestValueNode();
node.myName = children.getName(i);
value.computePresentation(node, XValuePlace.TREE);
content.values.add(node);
chunk.add(node.getResult());
// myHasChildren could be not computed yet
if (value instanceof VariableView && ((VariableView)value).getValue() instanceof ObjectValue && valueSubContentResolveCondition.value((VariableView)value)) {
chunk.add(node.loadChildren(value));
}
}
resolveGroups(children.getBottomGroups(), content.bottomGroups, chunk);
chunk.create().doWhenDone(new Runnable() {
@Override
public void run() {
compoundResult.setDone(content);
}
}).notifyWhenRejected(compoundResult);
}
private void resolveGroups(@NotNull List<XValueGroup> valueGroups, @NotNull List<TestCompositeNode> resultNodes, @NotNull ActionCallback.Chunk chunk) {
return result.then(new AsyncFunction<XValueChildrenList, Content>() {
private void resolveGroups(@NotNull List<XValueGroup> valueGroups, @NotNull List<TestCompositeNode> resultNodes, @NotNull List<Promise<?>> promises) {
for (XValueGroup group : valueGroups) {
TestCompositeNode node = new TestCompositeNode(group);
boolean computeChildren = groupContentResolveCondition.value(group);
@@ -129,11 +100,35 @@ public class TestCompositeNode implements XCompositeNode {
}
resultNodes.add(node);
if (computeChildren) {
chunk.add(node.loadContent(Conditions.<XValueGroup>alwaysFalse(), valueSubContentResolveCondition));
promises.add(node.loadContent(Conditions.<XValueGroup>alwaysFalse(), valueSubContentResolveCondition));
}
}
}
}).notifyWhenRejected(compoundResult);
return compoundResult;
@NotNull
@Override
public Promise<Content> fun(XValueChildrenList list) {
List<Promise<?>> promises = new ArrayList<Promise<?>>();
resolveGroups(children.getTopGroups(), content.topGroups, promises);
for (int i = 0; i < children.size(); i++) {
XValue value = children.getValue(i);
TestValueNode node = new TestValueNode();
node.myName = children.getName(i);
value.computePresentation(node, XValuePlace.TREE);
content.values.add(node);
promises.add(node.getResult());
// myHasChildren could be not computed yet
if (value instanceof VariableView && ((VariableView)value).getValue() instanceof ObjectValue && valueSubContentResolveCondition.value((VariableView)value)) {
promises.add(node.loadChildren(value));
}
}
resolveGroups(children.getBottomGroups(), content.bottomGroups, promises);
return Promise.all(promises, content);
}
});
}
}
@@ -1,6 +1,5 @@
package org.jetbrains.debugger;
import com.intellij.openapi.util.AsyncResult;
import com.intellij.openapi.util.Conditions;
import com.intellij.util.Consumer;
import com.intellij.xdebugger.XTestValueNode;
@@ -9,29 +8,32 @@ import com.intellij.xdebugger.frame.XValueGroup;
import com.intellij.xdebugger.frame.presentation.XValuePresentation;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.jetbrains.concurrency.AsyncPromise;
import org.jetbrains.concurrency.Promise;
import javax.swing.*;
public class TestValueNode extends XTestValueNode {
private final AsyncResult<XTestValueNode> result = new AsyncResult<XTestValueNode>();
private final AsyncPromise<XTestValueNode> result = new AsyncPromise<XTestValueNode>();
private volatile Content children;
@NotNull
public AsyncResult<XTestValueNode> getResult() {
public Promise<XTestValueNode> getResult() {
return result;
}
@NotNull
public AsyncResult<Content> loadChildren(@NotNull XValue value) {
public Promise<Content> loadChildren(@NotNull XValue value) {
TestCompositeNode childrenNode = new TestCompositeNode();
value.computeChildren(childrenNode);
return childrenNode.loadContent(Conditions.<XValueGroup>alwaysFalse(), Conditions.<VariableView>alwaysFalse()).doWhenDone(new Consumer<Content>() {
@Override
public void consume(Content content) {
children = content;
}
});
return childrenNode.loadContent(Conditions.<XValueGroup>alwaysFalse(), Conditions.<VariableView>alwaysFalse())
.done(new Consumer<Content>() {
@Override
public void consume(Content content) {
children = content;
}
});
}
@Nullable
@@ -43,6 +45,6 @@ public class TestValueNode extends XTestValueNode {
public void applyPresentation(@Nullable Icon icon, @NotNull XValuePresentation valuePresentation, boolean hasChildren) {
super.applyPresentation(icon, valuePresentation, hasChildren);
result.setDone(this);
result.setResult(this);
}
}
@@ -86,6 +86,8 @@ predefined.configuration.unboxing.in.method.calls=unboxing in method calls
predefined.configuration.boxing.in.method.calls=boxing in method calls
predefined.configuration.unboxing.in.declarations=unboxing in declarations
predefined.configuration.boxing.in.declarations=boxing in declarations
predefined.configuration.any.unboxing=unboxed expressions
predefined.configuration.any.boxing=boxed expressions
predefined.configuration.filters=filters
predefined.configuration.session.ejb=session ejb
predefined.configuration.fields.variables.read=fields/variables read
@@ -158,8 +160,8 @@ editvarcontraints.maximum.count=Maximum count\:
editvarcontraints.minimum.count=Minimum count\:
editvarcontraints.apply.constraint.within.type.hierarchy=Apply constraint within type hierarchy
editvarcontraints.invert.condition=Invert condition
editvarcontraints.text.regular.expression.for.formal.argument.type.of.the.method=Text/regexp for formal argument type of the method\:
editvarcontraints.text.regular.expression.for.java.expression.type=Text/regexp for java expression type\:
editvarcontraints.text.regular.expression.for.formal.argument.type.of.the.method=Expected type of expression (regexp)\:
editvarcontraints.text.regular.expression.for.java.expression.type=Expression type (regexp)\:
editvarcontraints.value.is.written=Value is written
editvarcontraints.value.is.read=Value is read
editvarcontraints.whole.words.only=Whole words only
@@ -2464,12 +2464,20 @@ public class StructuralSearchTest extends StructuralSearchTestCase {
"a.c(new Integer(2));\n" +
"a.c(new Integer(3));\n" +
"a.c2(new Integer(3));\n" +
"a.c(3);";
"a.c(3);\n" +
"Integer i = 4;\n" +
"int j = Integer.valueOf(4);\n";
String s2 = "a.'b('_Params:[formal( Integer ) && exprtype( int ) ])";
String s2_2 = "a.c('_Params:[formal( int ) && exprtype( Integer ) ])";
assertEquals("Find boxing in method call",1,findMatchesCount(s1,s2,false));
assertEquals("Find unboxing in method call",2,findMatchesCount(s1,s2_2,false));
String pattern1 = "'_a:[formal( Integer ) && exprtype( int ) ]";
assertEquals("Find any boxing", 2, findMatchesCount(s1, pattern1));
String pattern2 = "'_a:[formal( int ) && exprtype( Integer ) ]";
assertEquals("Find any unboxing", 3, findMatchesCount(s1, pattern2));
}
public void testCommentsInDclSearch() {
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 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.
@@ -16,7 +16,6 @@
package com.intellij.util.ui;
import com.intellij.openapi.ui.GraphicsConfig;
import com.intellij.openapi.util.registry.Registry;
import org.jetbrains.annotations.NotNull;
import java.awt.*;
@@ -81,7 +80,7 @@ public class GraphicsUtil {
final GraphicsConfig config = new GraphicsConfig(g);
final Graphics2D g2 = (Graphics2D)g;
g2.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE);
g2.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_PURE);
return config;
}
@@ -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.
@@ -36,7 +36,9 @@ public class JBFont extends Font {
}
Font scaled = font;
if (tryToScale) {
scaled = font.deriveFont(font.getSize() * JBUI.scale(1f));
Object value = Toolkit.getDefaultToolkit().getDesktopProperty("win.systemFixed.font.height");
float scale = value instanceof Integer ? ((Integer)value).floatValue() / 12f : 1f;
scaled = font.deriveFont(font.getSize() / scale * JBUI.scale(1f));
}
if (font instanceof UIResource) {
@@ -16,8 +16,6 @@
package com.intellij.util.ui;
import javax.swing.*;
import javax.swing.border.Border;
import javax.swing.border.EmptyBorder;
import java.awt.*;
/**
@@ -60,7 +58,7 @@ public class JBUI {
public static class Fonts {
public static JBFont label() {
return JBFont.create(UIManager.getFont("Label.font"));
return JBFont.create(UIManager.getFont("Label.font"), false);
}
public static JBFont label(float size) {