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:
+5
-1
@@ -41,6 +41,10 @@ public class GutterIconTooltipHelper {
|
||||
}
|
||||
|
||||
public static String composeText(@NotNull Iterable<? extends PsiElement> elements, String start, final String pattern) {
|
||||
return composeText(elements, start, pattern, "");
|
||||
}
|
||||
|
||||
public static String composeText(@NotNull Iterable<? extends PsiElement> elements, String start, final String pattern, String postfix) {
|
||||
@NonNls StringBuilder result = new StringBuilder();
|
||||
result.append("<html><body>");
|
||||
result.append(start);
|
||||
@@ -69,7 +73,7 @@ public class GutterIconTooltipHelper {
|
||||
sep = "<br>";
|
||||
result.append(name);
|
||||
}
|
||||
|
||||
result.append(postfix);
|
||||
result.append("</body></html>");
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
@@ -24,7 +24,11 @@ import com.intellij.codeInsight.daemon.DaemonBundle;
|
||||
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
|
||||
import com.intellij.codeInsight.navigation.ListBackgroundUpdaterTask;
|
||||
import com.intellij.ide.util.*;
|
||||
import com.intellij.openapi.actionSystem.ActionManager;
|
||||
import com.intellij.openapi.actionSystem.IdeActions;
|
||||
import com.intellij.openapi.actionSystem.Shortcut;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.keymap.KeymapUtil;
|
||||
import com.intellij.openapi.progress.ProgressIndicator;
|
||||
import com.intellij.openapi.progress.ProgressManager;
|
||||
import com.intellij.openapi.project.DumbService;
|
||||
@@ -37,7 +41,10 @@ import com.intellij.psi.search.searches.ClassInheritorsSearch;
|
||||
import com.intellij.psi.search.searches.FunctionalExpressionSearch;
|
||||
import com.intellij.psi.search.searches.OverridingMethodsSearch;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.intellij.util.*;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
import com.intellij.util.CommonProcessors;
|
||||
import com.intellij.util.Function;
|
||||
import com.intellij.util.NullableFunction;
|
||||
import gnu.trove.THashSet;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
@@ -109,7 +116,16 @@ public class MarkerType {
|
||||
else{
|
||||
key = sameSignature ? "method.overrides" : "method.overrides.in";
|
||||
}
|
||||
return GutterIconTooltipHelper.composeText(superMethods, "", DaemonBundle.message(key));
|
||||
return composeText(superMethods, "", DaemonBundle.message(key), "GotoSuperMethod");
|
||||
}
|
||||
|
||||
private static String composeText(PsiElement[] methods, String start, String pattern, String actionId) {
|
||||
Shortcut[] shortcuts = ActionManager.getInstance().getAction(actionId).getShortcutSet().getShortcuts();
|
||||
Shortcut shortcut = ArrayUtil.getFirstElement(shortcuts);
|
||||
String postfix = "<br><div style='margin-top: 5px'><font size='2'>Click";
|
||||
if (shortcut != null) postfix += " or press " + KeymapUtil.getShortcutText(shortcut);
|
||||
postfix += " to navigate</font></div>";
|
||||
return GutterIconTooltipHelper.composeText(Arrays.asList(methods), start, pattern, postfix);
|
||||
}
|
||||
|
||||
public static void navigateToOverridingMethod(MouseEvent e, PsiMethod method, boolean acceptSelf) {
|
||||
@@ -182,7 +198,7 @@ public class MarkerType {
|
||||
|
||||
String start = isAbstract ? DaemonBundle.message("method.is.implemented.header") : DaemonBundle.message("method.is.overriden.header");
|
||||
@NonNls String pattern = " <a href=\"#javaClass/{1}\">{1}</a>";
|
||||
return GutterIconTooltipHelper.composeText(overridings, start, pattern);
|
||||
return composeText(overridings, start, pattern, IdeActions.ACTION_GOTO_IMPLEMENTATION);
|
||||
}
|
||||
|
||||
public static void navigateToOverriddenMethod(MouseEvent e, final PsiMethod method) {
|
||||
@@ -274,7 +290,7 @@ public class MarkerType {
|
||||
? DaemonBundle.message("interface.is.implemented.by.header")
|
||||
: DaemonBundle.message("class.is.subclassed.by.header");
|
||||
@NonNls String pattern = " <a href=\"#javaClass/{0}\">{0}</a>";
|
||||
return GutterIconTooltipHelper.composeText(subclasses, start, pattern);
|
||||
return composeText(subclasses, start, pattern, IdeActions.ACTION_GOTO_IMPLEMENTATION);
|
||||
}
|
||||
|
||||
public static void navigateToSubclassedClass(MouseEvent e, final PsiClass aClass) {
|
||||
|
||||
-210
@@ -1,210 +0,0 @@
|
||||
/*
|
||||
* Copyright 2000-2014 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.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: spleaner
|
||||
* Date: Aug 22, 2007
|
||||
* Time: 3:44:10 PM
|
||||
*/
|
||||
package com.intellij.codeInsight.intention.impl;
|
||||
|
||||
import com.intellij.codeInsight.CodeInsightBundle;
|
||||
import com.intellij.codeInsight.FileModificationService;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.patterns.PsiExpressionPattern;
|
||||
import com.intellij.patterns.PsiJavaPatterns;
|
||||
import com.intellij.patterns.PsiMethodPattern;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.codeStyle.CodeStyleManager;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.ui.ColorChooser;
|
||||
import com.intellij.ui.JBColor;
|
||||
import com.intellij.util.IncorrectOperationException;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
|
||||
/**
|
||||
* @author spleaner
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public class ColorChooserIntentionAction extends BaseColorIntentionAction {
|
||||
private static final PsiMethodPattern DECODE_METHOD = PsiJavaPatterns.psiMethod()
|
||||
.definedInClass(JAVA_AWT_COLOR)
|
||||
.withName("decode");
|
||||
private static final PsiExpressionPattern.Capture<PsiExpression> DECODE_METHOD_CALL_PARAMETER =
|
||||
PsiJavaPatterns.psiExpression().methodCallParameter(0, DECODE_METHOD);
|
||||
|
||||
private static final PsiMethodPattern GET_COLOR_METHOD = PsiJavaPatterns.psiMethod()
|
||||
.definedInClass(JAVA_AWT_COLOR)
|
||||
.withName("getColor");
|
||||
private static final PsiExpressionPattern.Capture<PsiExpression> GET_METHOD_CALL_PARAMETER =
|
||||
PsiJavaPatterns.psiExpression().methodCallParameter(0, GET_COLOR_METHOD);
|
||||
|
||||
|
||||
public ColorChooserIntentionAction() {
|
||||
setText(CodeInsightBundle.message("intention.color.chooser.dialog"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAvailable(@NotNull final Project project, final Editor editor, @NotNull final PsiElement element) {
|
||||
return super.isAvailable(project, editor, element) || isInsideDecodeOrGetColorMethod(element);
|
||||
}
|
||||
|
||||
public static boolean isInsideDecodeOrGetColorMethod(PsiElement element) {
|
||||
if (element instanceof PsiJavaToken && ((PsiJavaToken)element).getTokenType() == JavaTokenType.STRING_LITERAL) {
|
||||
element = element.getParent();
|
||||
}
|
||||
|
||||
return DECODE_METHOD_CALL_PARAMETER.accepts(element) ||
|
||||
GET_METHOD_CALL_PARAMETER.accepts(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
@NotNull
|
||||
public String getFamilyName() {
|
||||
return getText();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void invoke(@NotNull Project project, Editor editor, @NotNull PsiElement element) throws IncorrectOperationException {
|
||||
if (!FileModificationService.getInstance().preparePsiElementForWrite(element)) return;
|
||||
|
||||
final JComponent editorComponent = editor.getComponent();
|
||||
if (isInsideDecodeOrGetColorMethod(element)) {
|
||||
invokeForMethodParam(editorComponent, element);
|
||||
}
|
||||
else {
|
||||
invokeForConstructor(editorComponent, element);
|
||||
}
|
||||
}
|
||||
|
||||
private void invokeForMethodParam(JComponent editorComponent, PsiElement element) {
|
||||
final PsiLiteralExpression literal = PsiTreeUtil.getParentOfType(element, PsiLiteralExpression.class);
|
||||
if (literal == null) return;
|
||||
final String text = StringUtil.unquoteString(literal.getText());
|
||||
final int radix = text.startsWith("0x") || text.startsWith("0X") || text.startsWith("#") ? 16 : text.startsWith("0") ? 8 : 10;
|
||||
final String hexPrefix = radix == 16 ? text.startsWith("#") ? "#" : text.substring(0, 2) : null;
|
||||
|
||||
Color oldColor;
|
||||
try {
|
||||
oldColor = Color.decode(text);
|
||||
}
|
||||
catch (NumberFormatException e) {
|
||||
oldColor = JBColor.GRAY;
|
||||
}
|
||||
Color color = ColorChooser.chooseColor(editorComponent, getText(), oldColor, true);
|
||||
if (color == null) return;
|
||||
final int rgb = color.getRGB() - ((255 & 0xFF) << 24);
|
||||
if (color != null && rgb != oldColor.getRGB()) {
|
||||
final String newText = radix == 16 ? hexPrefix + String.format("%6s", Integer.toHexString(rgb)).replace(' ', '0')
|
||||
: radix == 8 ? "0" + Integer.toOctalString(rgb)
|
||||
: Integer.toString(rgb);
|
||||
final PsiManager manager = literal.getManager();
|
||||
final PsiElementFactory factory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory();
|
||||
final PsiExpression newLiteral = factory.createExpressionFromText("\"" + newText + "\"", literal);
|
||||
literal.replace(newLiteral);
|
||||
}
|
||||
}
|
||||
|
||||
private void invokeForConstructor(JComponent editorComponent, PsiElement element) {
|
||||
final PsiNewExpression expression = PsiTreeUtil.getParentOfType(element, PsiNewExpression.class);
|
||||
if (expression == null) return;
|
||||
|
||||
Color c = null;
|
||||
|
||||
final PsiExpressionList argumentList = expression.getArgumentList();
|
||||
if (argumentList != null) {
|
||||
final PsiExpression[] expressions = argumentList.getExpressions();
|
||||
int[] values = new int[expressions.length];
|
||||
float[] values2 = new float[expressions.length];
|
||||
int i = 0;
|
||||
int j = 0;
|
||||
for (final PsiExpression each : expressions) {
|
||||
if (each instanceof PsiLiteralExpression) {
|
||||
final Object o = ((PsiLiteralExpression)each).getValue();
|
||||
if (o instanceof Integer) {
|
||||
values[i] = ((Integer)o).intValue();
|
||||
i++;
|
||||
}
|
||||
else if (o instanceof Float) {
|
||||
values2[j] = ((Float)o).floatValue();
|
||||
j++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
if (i == expressions.length) {
|
||||
switch (values.length) {
|
||||
case 1:
|
||||
c = new Color(values[0]);
|
||||
break;
|
||||
case 3:
|
||||
c = new Color(values[0], values[1], values[2]);
|
||||
break;
|
||||
case 4:
|
||||
c = new Color(values[0], values[1], values[2], values[3]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
else if (j == expressions.length) {
|
||||
switch (values2.length) {
|
||||
case 3:
|
||||
c = new Color(values2[0], values2[1], values2[2]);
|
||||
break;
|
||||
case 4:
|
||||
c = new Color(values2[0], values2[1], values2[2], values2[3]);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
c = JBColor.GRAY;
|
||||
}
|
||||
}
|
||||
|
||||
c = (c == null) ? JBColor.GRAY : c;
|
||||
|
||||
replaceColor(editorComponent, expression, c);
|
||||
}
|
||||
|
||||
private void replaceColor(JComponent editorComponent, PsiNewExpression expression, Color oldColor) {
|
||||
final Color color = ColorChooser.chooseColor(editorComponent, getText(), oldColor, true);
|
||||
if (color != null) {
|
||||
final PsiManager manager = expression.getManager();
|
||||
final PsiElementFactory factory = JavaPsiFacade.getInstance(manager.getProject()).getElementFactory();
|
||||
final PsiExpression newCall = factory.createExpressionFromText(
|
||||
"new " + getFqn(expression.getClassOrAnonymousClassReference()) + "("
|
||||
+ color.getRed() + ", "
|
||||
+ color.getGreen() + ", "
|
||||
+ color.getBlue()
|
||||
+ (color.getAlpha() < 255 ? ", " + color.getAlpha() : "")
|
||||
+ ")", expression);
|
||||
final PsiElement insertedElement = expression.replace(newCall);
|
||||
final CodeStyleManager codeStyleManager = CodeStyleManager.getInstance(manager.getProject());
|
||||
codeStyleManager.reformat(insertedElement);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -15,9 +15,11 @@
|
||||
*/
|
||||
package com.intellij.codeInsight.preview;
|
||||
|
||||
import com.intellij.codeInsight.intention.impl.ColorChooserIntentionAction;
|
||||
import com.intellij.openapi.util.text.StringUtil;
|
||||
import com.intellij.patterns.PlatformPatterns;
|
||||
import com.intellij.patterns.PsiExpressionPattern;
|
||||
import com.intellij.patterns.PsiJavaPatterns;
|
||||
import com.intellij.patterns.PsiMethodPattern;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.util.ArrayUtil;
|
||||
@@ -31,6 +33,27 @@ import java.awt.*;
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaPreviewHintProvider implements PreviewHintProvider {
|
||||
|
||||
private static final PsiMethodPattern DECODE_METHOD = PsiJavaPatterns.psiMethod()
|
||||
.definedInClass(Color.class.getName())
|
||||
.withName("decode");
|
||||
private static final PsiExpressionPattern.Capture<PsiExpression> DECODE_METHOD_CALL_PARAMETER =
|
||||
PsiJavaPatterns.psiExpression().methodCallParameter(0, DECODE_METHOD);
|
||||
private static final PsiMethodPattern GET_COLOR_METHOD = PsiJavaPatterns.psiMethod()
|
||||
.definedInClass(Color.class.getName())
|
||||
.withName("getColor");
|
||||
private static final PsiExpressionPattern.Capture<PsiExpression> GET_METHOD_CALL_PARAMETER =
|
||||
PsiJavaPatterns.psiExpression().methodCallParameter(0, GET_COLOR_METHOD);
|
||||
|
||||
private static boolean isInsideDecodeOrGetColorMethod(PsiElement element) {
|
||||
if (element instanceof PsiJavaToken && ((PsiJavaToken)element).getTokenType() == JavaTokenType.STRING_LITERAL) {
|
||||
element = element.getParent();
|
||||
}
|
||||
|
||||
return DECODE_METHOD_CALL_PARAMETER.accepts(element) ||
|
||||
GET_METHOD_CALL_PARAMETER.accepts(element);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSupportedFile(PsiFile file) {
|
||||
return file instanceof PsiJavaFile;
|
||||
@@ -120,7 +143,7 @@ public class JavaPreviewHintProvider implements PreviewHintProvider {
|
||||
}
|
||||
}
|
||||
|
||||
if (ColorChooserIntentionAction.isInsideDecodeOrGetColorMethod(element)) {
|
||||
if (isInsideDecodeOrGetColorMethod(element)) {
|
||||
final String color = StringUtil.unquoteString(element.getText());
|
||||
try {
|
||||
return new ColorPreviewComponent(Color.decode(color));
|
||||
|
||||
@@ -36,7 +36,9 @@ public class JavaGotoSuperTest extends LightDaemonAnalyzerTestCase {
|
||||
List<LineMarkerInfo> markers = DaemonCodeAnalyzerImpl.getLineMarkers(document, getProject());
|
||||
for (LineMarkerInfo info : markers) {
|
||||
if (info.endOffset >= offset && info.startOffset <= offset) {
|
||||
assertEquals("<html><body>Overrides method in <a href=\"#javaClass/I\">I</a></body></html>", info.getLineMarkerTooltip());
|
||||
assertEquals(
|
||||
"<html><body>Overrides method in <a href=\"#javaClass/I\">I</a><br><div style='margin-top: 5px'><font size='2'>Click or press Ctrl+U to navigate</font></div></body></html>",
|
||||
info.getLineMarkerTooltip());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.intellij.openapi.actionSystem.AnAction;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.ShortcutSet;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.event.MouseEvent;
|
||||
|
||||
@@ -31,11 +32,13 @@ public class NavigateAction<T extends PsiElement> extends AnAction {
|
||||
|
||||
public NavigateAction(String text,
|
||||
LineMarkerInfo<T> info,
|
||||
String originalActionId) {
|
||||
@Nullable String originalActionId) {
|
||||
super(text);
|
||||
myInfo = info;
|
||||
ShortcutSet set = ActionManager.getInstance().getAction(originalActionId).getShortcutSet();
|
||||
setShortcutSet(set);
|
||||
if (originalActionId != null) {
|
||||
ShortcutSet set = ActionManager.getInstance().getAction(originalActionId).getShortcutSet();
|
||||
setShortcutSet(set);
|
||||
}
|
||||
}
|
||||
|
||||
public NavigateAction(LineMarkerInfo<T> info) {
|
||||
@@ -53,7 +56,7 @@ public class NavigateAction<T extends PsiElement> extends AnAction {
|
||||
}
|
||||
}
|
||||
|
||||
public static <T extends PsiElement> LineMarkerInfo<T> setNavigateAction(LineMarkerInfo<T> info, String text, String originalActionId) {
|
||||
public static <T extends PsiElement> LineMarkerInfo<T> setNavigateAction(LineMarkerInfo<T> info, String text, @Nullable String originalActionId) {
|
||||
NavigateAction<T> action = new NavigateAction<T>(text, info, originalActionId);
|
||||
info.setNavigateAction(action);
|
||||
return info;
|
||||
|
||||
+1
-1
@@ -393,7 +393,7 @@
|
||||
<grid row="3" column="0" row-span="1" col-span="1" vsize-policy="0" hsize-policy="0" anchor="8" fill="0" indent="0" use-parent-layout="false"/>
|
||||
</constraints>
|
||||
<properties>
|
||||
<text value="Show quick doc on mouse move"/>
|
||||
<text value="Show quick documentation on mouse move"/>
|
||||
</properties>
|
||||
</component>
|
||||
<component id="ec4ad" class="javax.swing.JTextField" binding="myQuickDocDelayTextField">
|
||||
|
||||
@@ -16,10 +16,7 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.codeHighlighting.Pass;
|
||||
import com.intellij.codeInsight.daemon.GutterIconNavigationHandler;
|
||||
import com.intellij.codeInsight.daemon.LineMarkerInfo;
|
||||
import com.intellij.codeInsight.daemon.LineMarkerProvider;
|
||||
import com.intellij.codeInsight.daemon.MergeableLineMarkerInfo;
|
||||
import com.intellij.codeInsight.daemon.*;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.application.AccessToken;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
@@ -44,6 +41,7 @@ import java.util.List;
|
||||
* @author Konstantin Bulenkov
|
||||
*/
|
||||
public final class ColorLineMarkerProvider implements LineMarkerProvider {
|
||||
|
||||
private final ElementColorProvider[] myExtensions = ElementColorProvider.EP_NAME.getExtensions();
|
||||
|
||||
@Override
|
||||
@@ -51,7 +49,9 @@ public final class ColorLineMarkerProvider implements LineMarkerProvider {
|
||||
for (ElementColorProvider colorProvider : myExtensions) {
|
||||
final Color color = colorProvider.getColorFrom(element);
|
||||
if (color != null) {
|
||||
return new MyInfo(element, color, colorProvider);
|
||||
MyInfo info = new MyInfo(element, color, colorProvider);
|
||||
NavigateAction.setNavigateAction(info, "Choose color", null);
|
||||
return info;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
@@ -78,7 +78,7 @@ public final class ColorLineMarkerProvider implements LineMarkerProvider {
|
||||
|
||||
final Editor editor = PsiUtilBase.findEditor(element);
|
||||
assert editor != null;
|
||||
final Color c = ColorChooser.chooseColor(editor.getComponent(), "Choose color", color, true);
|
||||
final Color c = ColorChooser.chooseColor(editor.getComponent(), "Choose Color", color, true);
|
||||
if (c != null) {
|
||||
AccessToken token = ApplicationManager.getApplication().acquireWriteActionLock(ColorLineMarkerProvider.class);
|
||||
try {
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -32,10 +33,10 @@ public class ColorChooser {
|
||||
@Nullable
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated Use {@link #chooseColor(java.awt.Component, String, java.awt.Color, boolean, java.util.List, boolean)}
|
||||
* @deprecated Use {@link #chooseColor(Component, String, Color, boolean, java.util.List, boolean)}
|
||||
*/
|
||||
public static Color chooseColor(Component parent,
|
||||
String caption,
|
||||
@Nls(capitalization = Nls.Capitalization.Title) String caption,
|
||||
@Nullable Color preselectedColor,
|
||||
boolean enableOpacity,
|
||||
ColorPickerListener[] listeners,
|
||||
@@ -45,7 +46,7 @@ public class ColorChooser {
|
||||
|
||||
@Nullable
|
||||
public static Color chooseColor(Component parent,
|
||||
String caption,
|
||||
@Nls(capitalization = Nls.Capitalization.Title) String caption,
|
||||
@Nullable Color preselectedColor,
|
||||
boolean enableOpacity,
|
||||
List<ColorPickerListener> listeners,
|
||||
@@ -54,18 +55,18 @@ public class ColorChooser {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Color chooseColor(Component parent, String caption, @Nullable Color preselectedColor, boolean enableOpacity) {
|
||||
public static Color chooseColor(Component parent, @Nls(capitalization = Nls.Capitalization.Title) String caption, @Nullable Color preselectedColor, boolean enableOpacity) {
|
||||
return chooseColor(parent, caption, preselectedColor, enableOpacity, Collections.<ColorPickerListener>emptyList(), false);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Color chooseColor(Component parent, String caption, @Nullable Color preselectedColor, boolean enableOpacity,
|
||||
public static Color chooseColor(Component parent, @Nls(capitalization = Nls.Capitalization.Title) String caption, @Nullable Color preselectedColor, boolean enableOpacity,
|
||||
boolean opacityInPercent) {
|
||||
return chooseColor(parent, caption, preselectedColor, enableOpacity, Collections.<ColorPickerListener>emptyList(), opacityInPercent);
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public static Color chooseColor(Component parent, String caption, @Nullable Color preselectedColor) {
|
||||
public static Color chooseColor(Component parent, @Nls(capitalization = Nls.Capitalization.Title) String caption, @Nullable Color preselectedColor) {
|
||||
return chooseColor(parent, caption, preselectedColor, false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
package com.intellij.ui;
|
||||
|
||||
import com.intellij.openapi.components.ServiceManager;
|
||||
import org.jetbrains.annotations.Nls;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.awt.*;
|
||||
@@ -32,20 +33,20 @@ public abstract class ColorChooserService {
|
||||
@Nullable
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated Use {@link #showDialog(java.awt.Component, String, java.awt.Color, boolean, java.util.List, boolean)}
|
||||
* @deprecated Use {@link #showDialog(Component, String, Color, boolean, java.util.List, boolean)}
|
||||
*/
|
||||
public abstract Color showDialog(Component parent, String caption, Color preselectedColor, boolean enableOpacity,
|
||||
public abstract Color showDialog(Component parent, @Nls(capitalization = Nls.Capitalization.Title) String caption, Color preselectedColor, boolean enableOpacity,
|
||||
ColorPickerListener[] listeners);
|
||||
|
||||
@Nullable
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated Use {@link #showDialog(java.awt.Component, String, java.awt.Color, boolean, java.util.List, boolean)}
|
||||
* @deprecated Use {@link #showDialog(Component, String, Color, boolean, java.util.List, boolean)}
|
||||
*/
|
||||
public abstract Color showDialog(Component parent, String caption, Color preselectedColor, boolean enableOpacity,
|
||||
public abstract Color showDialog(Component parent, @Nls(capitalization = Nls.Capitalization.Title) String caption, Color preselectedColor, boolean enableOpacity,
|
||||
ColorPickerListener[] listeners, boolean opacityInPercent);
|
||||
|
||||
@Nullable
|
||||
public abstract Color showDialog(Component parent, String caption, Color preselectedColor, boolean enableOpacity,
|
||||
public abstract Color showDialog(Component parent, @Nls(capitalization = Nls.Capitalization.Title) String caption, Color preselectedColor, boolean enableOpacity,
|
||||
List<ColorPickerListener> listeners, boolean opacityInPercent);
|
||||
}
|
||||
|
||||
@@ -399,11 +399,12 @@ public class ActionMacroManager implements ExportableApplicationComponent, Named
|
||||
|
||||
public void messageEdt(PlaybackContext context, String text, Type type) {
|
||||
if (type == Type.message || type == Type.error) {
|
||||
StatusBar statusBar = frame.getStatusBar();
|
||||
if (context != null) {
|
||||
frame.getStatusBar().setInfo("Line " + context.getCurrentLine() + ": " + text);
|
||||
if (statusBar != null) statusBar.setInfo("Line " + context.getCurrentLine() + ": " + text);
|
||||
}
|
||||
else {
|
||||
frame.getStatusBar().setInfo(text);
|
||||
if (statusBar != null) statusBar.setInfo(text);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -414,7 +415,8 @@ public class ActionMacroManager implements ExportableApplicationComponent, Named
|
||||
runner.run()
|
||||
.doWhenDone(new Runnable() {
|
||||
public void run() {
|
||||
frame.getStatusBar().setInfo("Script execution finished");
|
||||
StatusBar statusBar = frame.getStatusBar();
|
||||
statusBar.setInfo("Script execution finished");
|
||||
}
|
||||
})
|
||||
.doWhenProcessed(new Runnable() {
|
||||
|
||||
+3
-2
@@ -31,6 +31,7 @@ import com.intellij.openapi.fileEditor.ex.FileEditorManagerEx;
|
||||
import com.intellij.openapi.fileEditor.ex.IdeDocumentHistory;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.openapi.vfs.*;
|
||||
import com.intellij.openapi.wm.ToolWindowManager;
|
||||
import gnu.trove.THashSet;
|
||||
@@ -48,8 +49,8 @@ import java.util.*;
|
||||
public class IdeDocumentHistoryImpl extends IdeDocumentHistory implements ProjectComponent, PersistentStateComponent<IdeDocumentHistoryImpl.RecentlyChangedFilesState> {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.fileEditor.impl.IdeDocumentHistoryImpl");
|
||||
|
||||
private static final int BACK_QUEUE_LIMIT = 25;
|
||||
private static final int CHANGE_QUEUE_LIMIT = 25;
|
||||
private static final int BACK_QUEUE_LIMIT = Registry.intValue("editor.navigation.history.stack.size");
|
||||
private static final int CHANGE_QUEUE_LIMIT = Registry.intValue("editor.navigation.history.stack.size");
|
||||
|
||||
private final Project myProject;
|
||||
|
||||
|
||||
+16
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.jetbrains.debugger.sourcemap;
|
||||
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
@@ -93,6 +108,7 @@ public class SourceResolver {
|
||||
if (canonicalPath != null && !canonicalPath.equals(path)) {
|
||||
absoluteLocalPathToSourceIndex.put(canonicalPath, sourceIndex);
|
||||
}
|
||||
return Urls.newLocalFileUrl(path);
|
||||
}
|
||||
}
|
||||
return new UrlImpl(baseUrl.getScheme(), baseUrl.getAuthority(), path, null);
|
||||
|
||||
+16
-1
@@ -1,3 +1,18 @@
|
||||
/*
|
||||
* 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.javascript.debugger;
|
||||
|
||||
import com.google.common.base.CharMatcher;
|
||||
@@ -82,7 +97,7 @@ public class NameMapper {
|
||||
public static void warnSeveralMapping(@NotNull PsiElement element) {
|
||||
// see https://dl.dropboxusercontent.com/u/43511007/s/Screen%20Shot%202015-01-21%20at%2020.33.44.png
|
||||
// var1 mapped to the whole "var c, notes, templates, ..." expression text + unrelated text " ;"
|
||||
LOG.warn("incorrect sourcemap, several mappings for named element " + element);
|
||||
LOG.warn("incorrect sourcemap, several mappings for named element " + element.getText());
|
||||
}
|
||||
|
||||
@NotNull
|
||||
|
||||
+1
-14
@@ -96,7 +96,7 @@ public class GeneralIdBasedToSMTRunnerEventsConvertor extends GeneralTestEventsP
|
||||
// or it finished after all tests have been run
|
||||
// Lets assume, if at finish all nodes except root suite have final state (passed, failed or ignored),
|
||||
// then all is ok otherwise process was terminated by user
|
||||
boolean completeTree = isTreeComplete();
|
||||
boolean completeTree = isTreeComplete(myRunningTestNodes, myTestsRootProxy);
|
||||
if (completeTree) {
|
||||
myTestsRootProxy.setFinished();
|
||||
} else {
|
||||
@@ -113,19 +113,6 @@ public class GeneralIdBasedToSMTRunnerEventsConvertor extends GeneralTestEventsP
|
||||
});
|
||||
}
|
||||
|
||||
private boolean isTreeComplete() {
|
||||
if (!myRunningTestNodes.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
List<? extends SMTestProxy> children = myTestsRootProxy.getChildren();
|
||||
for (SMTestProxy child : children) {
|
||||
if (!child.isFinal() || child.wasTerminated()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPrinterProvider(@NotNull TestProxyPrinterProvider printerProvider) {
|
||||
myTestProxyPrinterProvider = printerProvider;
|
||||
|
||||
+17
@@ -29,6 +29,9 @@ import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Processes events of test runner in general text-based form.
|
||||
@@ -135,4 +138,18 @@ public abstract class GeneralTestEventsProcessor implements Disposable {
|
||||
myTransferToEDTQueue.offer(runnable);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected static <T> boolean isTreeComplete(Collection<T> runningTests, SMTestProxy.SMRootTestProxy rootNode) {
|
||||
if (!runningTests.isEmpty()) {
|
||||
return false;
|
||||
}
|
||||
List<? extends SMTestProxy> children = rootNode.getChildren();
|
||||
for (SMTestProxy child : children) {
|
||||
if (!child.isFinal() || child.wasTerminated()) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -100,7 +100,7 @@ public class GeneralToSMTRunnerEventsConvertor extends GeneralTestEventsProcesso
|
||||
// or it finished after all tests have been run
|
||||
// Lets assume, if at finish all suites except root suite are passed
|
||||
// then all is ok otherwise process was terminated by user
|
||||
if (!myTestsRootNode.equals(mySuitesStack.getCurrentSuite())) {
|
||||
if (!isTreeComplete(myRunningTestsFullNameToProxy.keySet(), myTestsRootNode)) {
|
||||
myTestsRootNode.setTerminated();
|
||||
myRunningTestsFullNameToProxy.clear();
|
||||
}
|
||||
|
||||
+2
-1
@@ -26,6 +26,7 @@ import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.ui.Splitter;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.registry.Registry;
|
||||
import com.intellij.ui.OnePixelSplitter;
|
||||
import com.intellij.ui.ScrollPaneFactory;
|
||||
import com.intellij.ui.SideBorder;
|
||||
import com.intellij.util.ui.AwtVisitor;
|
||||
@@ -174,7 +175,7 @@ public abstract class TestResultsPanel extends JPanel implements Disposable, Dat
|
||||
}
|
||||
|
||||
protected static Splitter createSplitter(final String proportionProperty, final float defaultProportion) {
|
||||
final Splitter splitter = new Splitter(false);
|
||||
final Splitter splitter = new OnePixelSplitter(false);
|
||||
splitter.setHonorComponentsMinimumSize(true);
|
||||
final PropertiesComponent propertiesComponent = PropertiesComponent.getInstance();
|
||||
float proportion;
|
||||
|
||||
+10
-7
@@ -22,6 +22,7 @@ import com.intellij.ui.JBProgressBar;
|
||||
import com.intellij.ui.SimpleColoredComponent;
|
||||
import com.intellij.ui.SimpleTextAttributes;
|
||||
import com.intellij.util.ui.JBDimension;
|
||||
import com.intellij.util.ui.JBEmptyBorder;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
@@ -37,16 +38,18 @@ public class TestStatusLine extends JPanel {
|
||||
protected final SimpleColoredComponent myState = new SimpleColoredComponent();
|
||||
|
||||
public TestStatusLine() {
|
||||
super(new GridLayout(1, 2));
|
||||
final JPanel progressPanel = new JPanel(new GridBagLayout());
|
||||
add(progressPanel);
|
||||
super(new BorderLayout());
|
||||
JPanel progressPanel = new JPanel(new GridBagLayout());
|
||||
add(progressPanel, BorderLayout.WEST);
|
||||
myProgressBar.setMaximum(100);
|
||||
myProgressBar.setBorder(null);
|
||||
myProgressBar.setMaximumSize(new JBDimension(450, -1));
|
||||
final Dimension size = new JBDimension(450, -1);
|
||||
progressPanel.setMaximumSize(size);
|
||||
progressPanel.setMinimumSize(size);
|
||||
progressPanel.setPreferredSize(size);
|
||||
progressPanel.add(myProgressBar, new GridBagConstraints(0, 0, 0, 0, 1, 1, GridBagConstraints.CENTER, GridBagConstraints.HORIZONTAL,
|
||||
new Insets(2, 0, 0, 8), 0, 0));
|
||||
new Insets(2, 2, 0, 8), 0, 0));
|
||||
setStatusColor(ColorProgressBar.GREEN);
|
||||
add(myState);
|
||||
add(myState, BorderLayout.CENTER);
|
||||
myState.append(ExecutionBundle.message("junit.runing.info.starting.label"));
|
||||
}
|
||||
|
||||
|
||||
@@ -138,6 +138,9 @@ editor.durable.folding.state.description=If set, collapsed fold regions will pre
|
||||
editor.soft.wrap.force.limit=10000
|
||||
editor.soft.wrap.force.limit.description=If document contains lines longer than this value, soft wraps will be forcibly enabled in editor due to performance reasons
|
||||
|
||||
editor.navigation.history.stack.size=25
|
||||
editor.navigation.history.stack.size.description=Stack size limit for back/forward and last/next edit location navigation
|
||||
|
||||
ide.showIndexRebuildMessage=false
|
||||
|
||||
ide.tabbedPane.bufferedPaint=true
|
||||
|
||||
@@ -354,13 +354,13 @@ public class LineStatusTrackerDrawing {
|
||||
}
|
||||
}
|
||||
|
||||
EditorFragmentComponent fragmentComponent =
|
||||
JComponent fragmentComponent =
|
||||
EditorFragmentComponent.createEditorFragmentComponent(uEditor, range.getVcsLine1(), range.getVcsLine2(), false, false);
|
||||
int leftBorder = fragmentComponent.getBorder().getBorderInsets(fragmentComponent).left;
|
||||
|
||||
EditorFactory.getInstance().releaseEditor(uEditor);
|
||||
|
||||
return Pair.<JComponent, Integer>create(fragmentComponent, leftBorder);
|
||||
return Pair.create(fragmentComponent, leftBorder);
|
||||
}
|
||||
|
||||
private static String getFileName(final Document document) {
|
||||
|
||||
@@ -931,11 +931,6 @@
|
||||
<category>Declaration</category>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<className>com.intellij.codeInsight.intention.impl.ColorChooserIntentionAction</className>
|
||||
<category>Declaration</category>
|
||||
</intentionAction>
|
||||
|
||||
<intentionAction>
|
||||
<className>com.intellij.codeInsight.intention.impl.ConvertColorRepresentationIntentionAction</className>
|
||||
<category>Declaration</category>
|
||||
|
||||
Reference in New Issue
Block a user