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:
@@ -90,6 +90,10 @@ public abstract class ProgressManager extends ProgressIndicatorProvider {
|
||||
|
||||
public abstract void executeNonCancelableSection(@NotNull Runnable runnable);
|
||||
|
||||
/**
|
||||
* to be removed in 2017.2
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract void setCancelButtonText(String cancelButtonText);
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.application.options.codeStyle;
|
||||
|
||||
import com.intellij.application.options.DefaultSchemeActions;
|
||||
import com.intellij.application.options.schemes.DefaultSchemeActions;
|
||||
import com.intellij.application.options.SaveSchemeDialog;
|
||||
import com.intellij.application.options.SchemesToImportPopup;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ package com.intellij.application.options.codeStyle;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.psi.codeStyle.CodeStyleScheme;
|
||||
import com.intellij.ui.ListCellRendererWrapper;
|
||||
import com.intellij.ui.ManageSchemesComboAction;
|
||||
import com.intellij.application.options.schemes.ManageSchemesComboAction;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
|
||||
+1
-1
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.application.options.colors;
|
||||
|
||||
import com.intellij.application.options.DefaultSchemeActions;
|
||||
import com.intellij.application.options.schemes.DefaultSchemeActions;
|
||||
import com.intellij.application.options.SaveSchemeDialog;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
|
||||
@@ -22,7 +22,7 @@ import com.intellij.openapi.editor.colors.EditorColorsScheme;
|
||||
import com.intellij.openapi.editor.colors.impl.AbstractColorsScheme;
|
||||
import com.intellij.openapi.extensions.Extensions;
|
||||
import com.intellij.openapi.ui.ComboBox;
|
||||
import com.intellij.ui.ManageSchemesComboAction;
|
||||
import com.intellij.application.options.schemes.ManageSchemesComboAction;
|
||||
import com.intellij.util.EventDispatcher;
|
||||
import com.intellij.util.ui.JBInsets;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
+1
-1
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.application.options;
|
||||
package com.intellij.application.options.schemes;
|
||||
|
||||
import com.intellij.openapi.actionSystem.*;
|
||||
import com.intellij.openapi.application.ApplicationBundle;
|
||||
+2
-2
@@ -13,7 +13,7 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package com.intellij.ui;
|
||||
package com.intellij.application.options.schemes;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnAction;
|
||||
@@ -21,7 +21,7 @@ import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.DefaultActionGroup;
|
||||
import com.intellij.openapi.actionSystem.Presentation;
|
||||
import com.intellij.openapi.actionSystem.ex.ComboBoxAction;
|
||||
import com.intellij.application.options.DefaultSchemeActions;
|
||||
import com.intellij.application.options.schemes.DefaultSchemeActions;
|
||||
import com.intellij.openapi.options.Scheme;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -120,7 +120,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
private ConsoleState myState;
|
||||
|
||||
private final Alarm mySpareTimeAlarm = new Alarm(this);
|
||||
@Nullable
|
||||
@NotNull
|
||||
private final Alarm myHeavyAlarm;
|
||||
private volatile int myHeavyUpdateTicket;
|
||||
|
||||
@@ -288,7 +288,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
myFilters = new CompositeFilter(project, usePredefinedMessageFilter ? computeConsoleFilters(project, searchScope) : new SmartList<>());
|
||||
myFilters.setForceUseAllFilters(true);
|
||||
myHeavyUpdateTicket = 0;
|
||||
myHeavyAlarm = myFilters.isAnyHeavy() ? new Alarm(Alarm.ThreadToUse.POOLED_THREAD, this) : null;
|
||||
myHeavyAlarm = new Alarm(Alarm.ThreadToUse.POOLED_THREAD, this);
|
||||
|
||||
ConsoleInputFilterProvider[] inputFilters = Extensions.getExtensions(ConsoleInputFilterProvider.INPUT_FILTER_PROVIDERS);
|
||||
if (inputFilters.length > 0) {
|
||||
@@ -786,7 +786,7 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
}
|
||||
|
||||
private void cancelHeavyAlarm() {
|
||||
if (myHeavyAlarm != null && !myHeavyAlarm.isDisposed()) {
|
||||
if (!myHeavyAlarm.isDisposed()) {
|
||||
myHeavyAlarm.cancelAllRequests();
|
||||
++myHeavyUpdateTicket;
|
||||
}
|
||||
@@ -1013,7 +1013,6 @@ public class ConsoleViewImpl extends JPanel implements ConsoleView, ObservableCo
|
||||
|
||||
myJLayeredPane.startUpdating();
|
||||
final int currentValue = myHeavyUpdateTicket;
|
||||
assert myHeavyAlarm != null;
|
||||
myHeavyAlarm.addRequest(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.ui;
|
||||
|
||||
import com.intellij.Patches;
|
||||
import com.intellij.openapi.util.Pair;
|
||||
import com.intellij.openapi.util.SystemInfo;
|
||||
import com.intellij.util.containers.WeakHashMap;
|
||||
import com.intellij.util.ui.JBInsets;
|
||||
import com.intellij.util.ui.JBUI;
|
||||
@@ -535,6 +536,7 @@ public class ScreenUtil {
|
||||
*/
|
||||
public static Rectangle boundsFromDeviceSpace(@NotNull Rectangle bounds) {
|
||||
Rectangle b = bounds.getBounds();
|
||||
if (SystemInfo.isLinux/* && !UIUtil.isJDKManagedHiDPI()*/) return b; // [tav] todo: leave default on Linux so far
|
||||
try {
|
||||
for (GraphicsDevice gd : GraphicsEnvironment.getLocalGraphicsEnvironment().getScreenDevices()) {
|
||||
Rectangle screenBounds = screenBoundsToDeviceSpace(gd);
|
||||
@@ -561,6 +563,7 @@ public class ScreenUtil {
|
||||
*/
|
||||
public static Rectangle boundsToDeviceSpace(Graphics2D g, @NotNull Rectangle bounds) {
|
||||
Rectangle b = bounds.getBounds();
|
||||
if (SystemInfo.isLinux/* && !UIUtil.isJDKManagedHiDPI()*/) return b; // [tav] todo: leave default on Linux so far
|
||||
try {
|
||||
if (g != null) {
|
||||
float screenScale = screenScale(g.getDeviceConfiguration().getDevice());
|
||||
|
||||
@@ -17,6 +17,7 @@ package com.intellij.openapi.command.impl;
|
||||
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.openapi.application.ApplicationManager;
|
||||
import com.intellij.openapi.application.TransactionGuard;
|
||||
import com.intellij.openapi.command.undo.DocumentReference;
|
||||
import com.intellij.openapi.command.undo.UndoableAction;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
@@ -194,14 +195,18 @@ abstract class UndoRedo {
|
||||
}
|
||||
|
||||
private boolean askUser() {
|
||||
String actionText = getActionName(myUndoableGroup.getCommandName());
|
||||
final boolean[] isOk = new boolean[1];
|
||||
TransactionGuard.getInstance().submitTransactionAndWait(() -> {
|
||||
String actionText = getActionName(myUndoableGroup.getCommandName());
|
||||
|
||||
if (actionText.length() > 80) {
|
||||
actionText = actionText.substring(0, 80) + "... ";
|
||||
}
|
||||
if (actionText.length() > 80) {
|
||||
actionText = actionText.substring(0, 80) + "... ";
|
||||
}
|
||||
|
||||
return Messages.showOkCancelDialog(myManager.getProject(), actionText + "?", getActionName(),
|
||||
Messages.getQuestionIcon()) == Messages.OK;
|
||||
isOk[0] = Messages.showOkCancelDialog(myManager.getProject(), actionText + "?", getActionName(),
|
||||
Messages.getQuestionIcon()) == Messages.OK;
|
||||
});
|
||||
return isOk[0];
|
||||
}
|
||||
|
||||
private boolean restore(EditorAndState pair) {
|
||||
|
||||
@@ -575,7 +575,6 @@ error.readonly.scheme.cannot.be.modified=Read-only scheme cannot be modified. Pl
|
||||
error.shared.scheme.cannot.be.modified=Shared scheme cannot be modified. Please do "Save As..." first.
|
||||
title.cannot.modify.readonly.scheme=Cannot Modify Read-Only Scheme
|
||||
hint.readonly.scheme.cannot.be.modified=Read-only scheme, copy to edit
|
||||
title.save.color.scheme.as=Save Color Scheme As
|
||||
title.path.variables=Path Variables
|
||||
editbox.path.macro.value=Value:
|
||||
editbox.path.macro.name=Name:
|
||||
@@ -782,4 +781,5 @@ settings.editor.scheme.copy.to.ide.title=Copy Project Scheme to IDE
|
||||
settings.editor.scheme.copy.to.ide.label=IDE Scheme Name:
|
||||
settings.editor.scheme.copy.to.project.title=Copy Setting to Project
|
||||
settings.editor.scheme.copy.to.project.message=Overwrite project settings with values from {0}?
|
||||
title.save.code.style.scheme.as=Duplicate Code Style Scheme As
|
||||
title.save.code.style.scheme.as=Duplicate Code Style Scheme As
|
||||
title.save.color.scheme.as=Duplicate Color Scheme As
|
||||
+3
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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,6 +36,7 @@ public interface SMTestLocator {
|
||||
@NotNull
|
||||
List<Location> getLocation(@NotNull String protocol, @NotNull String path, @NotNull Project project, @NotNull GlobalSearchScope scope);
|
||||
|
||||
/** @deprecated consoles should provide specific locators; the implementation is trivial (to be removed in IDEA 18) */
|
||||
class Composite implements SMTestLocator, DumbAware {
|
||||
private final Map<String, ? extends SMTestLocator> myLocators;
|
||||
|
||||
@@ -59,4 +60,4 @@ public interface SMTestLocator {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+21
-26
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2015 JetBrains s.r.o.
|
||||
* Copyright 2000-2016 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.
|
||||
@@ -17,41 +17,36 @@ package com.intellij.execution.testframework.sm;
|
||||
|
||||
import com.intellij.execution.Location;
|
||||
import com.intellij.execution.testframework.sm.runner.SMTestProxy;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.PsiElement;
|
||||
import com.intellij.psi.search.GlobalSearchScope;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.fixtures.LightPlatformCodeInsightFixtureTestCase;
|
||||
|
||||
/**
|
||||
* @author Roman Chernyatchik
|
||||
*/
|
||||
public class FileUrlLocationTest extends SMLightFixtureTestCase {
|
||||
@Override
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return LightProjectDescriptor.EMPTY_PROJECT_DESCRIPTOR;
|
||||
}
|
||||
|
||||
public class FileUrlLocationTest extends LightPlatformCodeInsightFixtureTestCase {
|
||||
public void testSpecNavigation() {
|
||||
createAndAddFile("my_example_spec.xml",
|
||||
"\n" +
|
||||
"<describe>\n" +
|
||||
" <a></a>\n" +
|
||||
"</describe>\n" +
|
||||
"\n");
|
||||
VirtualFile file = myFixture.configureByText(
|
||||
"my_example_spec.xml",
|
||||
"\n" +
|
||||
"<describe>\n" +
|
||||
" <a></a>\n" +
|
||||
"</describe>\n" +
|
||||
"\n").getVirtualFile();
|
||||
|
||||
final String path = myFixture.getFile().getVirtualFile().getPath();
|
||||
doTest(1, "<", path, 2);
|
||||
doTest(16, "<", path, 3);
|
||||
doTest(1, file.getPath(), 2);
|
||||
doTest(16, file.getPath(), 3);
|
||||
}
|
||||
|
||||
private void doTest(int expectedOffset, String expectedStartsWith, String filePath, int lineNum) {
|
||||
final SMTestProxy testProxy = new SMTestProxy("myTest", false, "file://" + filePath + ":" + lineNum);
|
||||
private void doTest(int expectedOffset, String filePath, int lineNum) {
|
||||
SMTestProxy testProxy = new SMTestProxy("myTest", false, "file://" + filePath + ":" + lineNum);
|
||||
testProxy.setLocator(FileUrlProvider.INSTANCE);
|
||||
|
||||
final Location location = testProxy.getLocation(getProject(), GlobalSearchScope.allScope(getProject()));
|
||||
Location location = testProxy.getLocation(getProject(), GlobalSearchScope.allScope(getProject()));
|
||||
assertNotNull(location);
|
||||
assertNotNull(location.getPsiElement());
|
||||
assertEquals(expectedOffset, location.getPsiElement().getTextOffset());
|
||||
|
||||
final String element = location.getPsiElement().getText();
|
||||
assertTrue(element, element.startsWith(expectedStartsWith));
|
||||
PsiElement element = location.getPsiElement();
|
||||
assertNotNull(element);
|
||||
assertEquals(expectedOffset, element.getTextOffset());
|
||||
}
|
||||
}
|
||||
}
|
||||
-72
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* 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.execution.testframework.sm;
|
||||
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.PsiFile;
|
||||
import com.intellij.testFramework.LightProjectDescriptor;
|
||||
import com.intellij.testFramework.UsefulTestCase;
|
||||
import com.intellij.testFramework.fixtures.CodeInsightTestFixture;
|
||||
import com.intellij.testFramework.fixtures.IdeaProjectTestFixture;
|
||||
import com.intellij.testFramework.fixtures.IdeaTestFixtureFactory;
|
||||
import com.intellij.testFramework.fixtures.TestFixtureBuilder;
|
||||
import com.intellij.testFramework.fixtures.impl.LightTempDirTestFixtureImpl;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* @author Roman.Chernyatchik
|
||||
*/
|
||||
public abstract class SMLightFixtureTestCase extends UsefulTestCase {
|
||||
protected CodeInsightTestFixture myFixture;
|
||||
|
||||
@Override
|
||||
protected void setUp() throws Exception {
|
||||
super.setUp();
|
||||
|
||||
final IdeaTestFixtureFactory factory = IdeaTestFixtureFactory.getFixtureFactory();
|
||||
final TestFixtureBuilder<IdeaProjectTestFixture> fixtureBuilder = factory.createLightFixtureBuilder(getProjectDescriptor());
|
||||
final IdeaProjectTestFixture fixture = fixtureBuilder.getFixture();
|
||||
final LightTempDirTestFixtureImpl tempDirTestFixture = new LightTempDirTestFixtureImpl(true);
|
||||
myFixture = IdeaTestFixtureFactory.getFixtureFactory().createCodeInsightFixture(fixture, tempDirTestFixture);
|
||||
myFixture.setUp();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() throws Exception {
|
||||
try {
|
||||
myFixture.tearDown();
|
||||
}
|
||||
finally {
|
||||
myFixture = null;
|
||||
|
||||
super.tearDown();
|
||||
}
|
||||
}
|
||||
|
||||
@Nullable
|
||||
protected LightProjectDescriptor getProjectDescriptor() {
|
||||
return null;
|
||||
}
|
||||
|
||||
protected Project getProject() {
|
||||
return myFixture.getProject();
|
||||
}
|
||||
|
||||
protected void createAndAddFile(final String relativePath, final String text) {
|
||||
final PsiFile psiFile = myFixture.addFileToProject(relativePath, text);
|
||||
myFixture.configureFromExistingVirtualFile(psiFile.getVirtualFile());
|
||||
}
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class LabelIcon implements Icon {
|
||||
|
||||
public static int getWidth(int height, int labelsCount) {
|
||||
float scale = height / 8.0f;
|
||||
return (int)Math.ceil((7 + 2 * (labelsCount - 1)) * scale);
|
||||
return Math.round((7 + 2 * (labelsCount - 1)) * scale);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -52,18 +52,21 @@ import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import javax.swing.*;
|
||||
import java.awt.*;
|
||||
import java.awt.geom.RoundRectangle2D;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.intellij.vcs.log.ui.render.RectanglePainter.LABEL_ARC;
|
||||
|
||||
public class LabelPainter {
|
||||
public static final int TOP_TEXT_PADDING = JBUI.scale(1);
|
||||
public static final int BOTTOM_TEXT_PADDING = JBUI.scale(2);
|
||||
public static final int RIGHT_PADDING = JBUI.scale(2);
|
||||
public static final int RIGHT_PADDING = JBUI.scale(4);
|
||||
public static final int LEFT_PADDING = JBUI.scale(2);
|
||||
public static final int COMPACT_MIDDLE_PADDING = JBUI.scale(2);
|
||||
public static final int MIDDLE_PADDING = JBUI.scale(6);
|
||||
public static final int MIDDLE_PADDING = JBUI.scale(12);
|
||||
private static final int MAX_LENGTH = 22;
|
||||
private static final String THREE_DOTS = "...";
|
||||
private static final String TWO_DOTS = "..";
|
||||
@@ -115,7 +118,7 @@ public class LabelPainter {
|
||||
VcsLogRefManager manager = getRefManager(myLogData, references);
|
||||
List<RefGroup> refGroups = manager == null ? ContainerUtil.emptyList() : manager.groupForTable(references, myCompact, myShowTagNames);
|
||||
|
||||
myGreyBackground = calculateGreyBackground(refGroups, background, isSelected);
|
||||
myGreyBackground = calculateGreyBackground(refGroups, background, isSelected, myCompact);
|
||||
Pair<List<Pair<String, LabelIcon>>, Integer> presentation =
|
||||
calculatePresentation(refGroups, metrics, myHeight, myGreyBackground != null ? myGreyBackground : myBackground, availableWidth,
|
||||
myCompact);
|
||||
@@ -155,7 +158,7 @@ public class LabelPainter {
|
||||
for (RefGroup group : refGroups) {
|
||||
List<Color> colors = group.getColors();
|
||||
LabelIcon labelIcon = new LabelIcon(height, background, colors.toArray(new Color[colors.size()]));
|
||||
int newWidth = width + labelIcon.getIconWidth() + COMPACT_MIDDLE_PADDING;
|
||||
int newWidth = width + labelIcon.getIconWidth() + (group != ContainerUtil.getLastItem(refGroups) ? COMPACT_MIDDLE_PADDING : 0);
|
||||
|
||||
String text = shortenRefName(group.getName(), fontMetrics, availableWidth - newWidth);
|
||||
newWidth += fontMetrics.stringWidth(text);
|
||||
@@ -184,12 +187,12 @@ public class LabelPainter {
|
||||
int doNotFitWidth = 0;
|
||||
if (i < refGroups.size() - 1) {
|
||||
LabelIcon lastIcon = new LabelIcon(height, background, getColors(refGroups.subList(i + 1, refGroups.size())));
|
||||
doNotFitWidth = lastIcon.getIconWidth() + MIDDLE_PADDING;
|
||||
doNotFitWidth = lastIcon.getIconWidth();
|
||||
}
|
||||
|
||||
List<Color> colors = group.getColors();
|
||||
LabelIcon labelIcon = new LabelIcon(height, background, colors.toArray(new Color[colors.size()]));
|
||||
int newWidth = width + labelIcon.getIconWidth() + MIDDLE_PADDING;
|
||||
int newWidth = width + labelIcon.getIconWidth() + (i != refGroups.size() - 1 ? MIDDLE_PADDING : 0);
|
||||
|
||||
String text = getGroupText(group, fontMetrics, availableWidth - newWidth - doNotFitWidth);
|
||||
newWidth += fontMetrics.stringWidth(text);
|
||||
@@ -198,7 +201,7 @@ public class LabelPainter {
|
||||
LabelIcon lastIcon = new LabelIcon(height, background, getColors(refGroups.subList(i, refGroups.size())));
|
||||
String name = labels.isEmpty() ? text : "";
|
||||
labels.add(Pair.create(name, lastIcon));
|
||||
width += fontMetrics.stringWidth(name) + lastIcon.getIconWidth() + MIDDLE_PADDING;
|
||||
width += fontMetrics.stringWidth(name) + lastIcon.getIconWidth();
|
||||
break;
|
||||
}
|
||||
else {
|
||||
@@ -264,8 +267,12 @@ public class LabelPainter {
|
||||
}
|
||||
|
||||
@Nullable
|
||||
private static Color calculateGreyBackground(@NotNull List<RefGroup> refGroups, @NotNull Color background, boolean isSelected) {
|
||||
private static Color calculateGreyBackground(@NotNull List<RefGroup> refGroups,
|
||||
@NotNull Color background,
|
||||
boolean isSelected,
|
||||
boolean isCompact) {
|
||||
if (isSelected) return null;
|
||||
if (!isCompact) return ColorUtil.mix(background, BACKGROUND, BALANCE);
|
||||
|
||||
boolean paintGreyBackground;
|
||||
for (RefGroup group : refGroups) {
|
||||
@@ -318,10 +325,10 @@ public class LabelPainter {
|
||||
g2.setColor(myBackground);
|
||||
g2.fillRect(x, y, myWidth, height);
|
||||
|
||||
if (myGreyBackground != null) {
|
||||
if (myGreyBackground != null && myCompact) {
|
||||
g2.setColor(myGreyBackground);
|
||||
g2.fillRect(x, y + baseLine - fontMetrics.getAscent() - TOP_TEXT_PADDING,
|
||||
myWidth - RIGHT_PADDING + LEFT_PADDING,
|
||||
myWidth,
|
||||
fontMetrics.getHeight() + TOP_TEXT_PADDING + BOTTOM_TEXT_PADDING);
|
||||
}
|
||||
|
||||
@@ -331,6 +338,13 @@ public class LabelPainter {
|
||||
LabelIcon icon = label.second;
|
||||
String text = label.first;
|
||||
|
||||
if (myGreyBackground != null && !myCompact) {
|
||||
g2.setColor(myGreyBackground);
|
||||
g2.fill(new RoundRectangle2D.Double(x - LEFT_PADDING, y + baseLine - fontMetrics.getAscent() - TOP_TEXT_PADDING,
|
||||
icon.getIconWidth() + fontMetrics.stringWidth(text) + 3 * LEFT_PADDING,
|
||||
fontMetrics.getHeight() + TOP_TEXT_PADDING + BOTTOM_TEXT_PADDING, LABEL_ARC, LABEL_ARC));
|
||||
}
|
||||
|
||||
icon.paintIcon(null, g2, x, y + (height - icon.getIconHeight()) / 2);
|
||||
x += icon.getIconWidth();
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class RectanglePainter {
|
||||
protected static final int TEXT_PADDING_X = JBUI.scale(5);
|
||||
public static final int TOP_TEXT_PADDING = JBUI.scale(2);
|
||||
public static final int BOTTOM_TEXT_PADDING = JBUI.scale(1);
|
||||
private static final int LABEL_ARC = JBUI.scale(5);
|
||||
public static final int LABEL_ARC = JBUI.scale(6);
|
||||
|
||||
private final boolean mySquare;
|
||||
|
||||
|
||||
+7
-4
@@ -2,11 +2,12 @@ package com.jetbrains.edu.coursecreator.actions;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.actionSystem.CommonDataKeys;
|
||||
import com.intellij.openapi.actionSystem.ToggleAction;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.editor.Document;
|
||||
import com.intellij.openapi.editor.Editor;
|
||||
import com.intellij.openapi.fileEditor.FileDocumentManager;
|
||||
import com.intellij.openapi.fileEditor.FileEditorManager;
|
||||
import com.intellij.openapi.project.DumbAware;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
@@ -44,9 +45,11 @@ public class CCEditTaskTextAction extends ToggleAction implements DumbAware {
|
||||
if (window == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
final VirtualFile virtualFile = CommonDataKeys.VIRTUAL_FILE.getData(e.getDataContext());
|
||||
|
||||
Editor editor = FileEditorManager.getInstance(project).getSelectedTextEditor();
|
||||
if (editor == null) {
|
||||
return;
|
||||
}
|
||||
VirtualFile virtualFile = FileDocumentManager.getInstance().getFile(editor.getDocument());
|
||||
if (virtualFile == null) {
|
||||
StudyTaskManager.getInstance(project).setTurnEditingMode(true);
|
||||
return;
|
||||
|
||||
@@ -1,2 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: com.intellij.updater.Bootstrap
|
||||
Patcher-Version: 2.0
|
||||
|
||||
Reference in New Issue
Block a user