From 018ae5d1683a7b957b7a9483a2b2d5d56131ea3a Mon Sep 17 00:00:00 2001 From: Konstantin Bulenkov Date: Tue, 13 Dec 2016 16:10:47 +0100 Subject: [PATCH 01/13] put patcher version in manifest file --- updater/src/META-INF/MANIFEST.MF | 1 + 1 file changed, 1 insertion(+) diff --git a/updater/src/META-INF/MANIFEST.MF b/updater/src/META-INF/MANIFEST.MF index 46dd11d476b4..5e3a49240f30 100644 --- a/updater/src/META-INF/MANIFEST.MF +++ b/updater/src/META-INF/MANIFEST.MF @@ -1,2 +1,3 @@ Manifest-Version: 1.0 Main-Class: com.intellij.updater.Bootstrap +Patcher-Version: 2.0 From d9f5d747ee6979f02d5dbe9cb5f52b83d5121e7a Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 13 Dec 2016 16:14:15 +0100 Subject: [PATCH 02/13] Cleanup (compacts FileUrlLocationTest) --- .../testframework/sm/FileUrlLocationTest.java | 47 ++++++------ .../sm/SMLightFixtureTestCase.java | 72 ------------------- 2 files changed, 21 insertions(+), 98 deletions(-) delete mode 100644 platform/smRunner/testSrc/com/intellij/execution/testframework/sm/SMLightFixtureTestCase.java diff --git a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/FileUrlLocationTest.java b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/FileUrlLocationTest.java index 2fd894225b9b..52e1aba1425d 100644 --- a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/FileUrlLocationTest.java +++ b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/FileUrlLocationTest.java @@ -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" + - "\n" + - " \n" + - "\n" + - "\n"); + VirtualFile file = myFixture.configureByText( + "my_example_spec.xml", + "\n" + + "\n" + + " \n" + + "\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()); } -} +} \ No newline at end of file diff --git a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/SMLightFixtureTestCase.java b/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/SMLightFixtureTestCase.java deleted file mode 100644 index 828e9a6f39a1..000000000000 --- a/platform/smRunner/testSrc/com/intellij/execution/testframework/sm/SMLightFixtureTestCase.java +++ /dev/null @@ -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 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()); - } -} From 4b99990fd8b54b1a03f5d06c6b0a0e91c51526c0 Mon Sep 17 00:00:00 2001 From: Roman Shevchenko Date: Tue, 13 Dec 2016 16:17:33 +0100 Subject: [PATCH 03/13] Cleanup (deprecation) --- .../execution/testframework/sm/runner/SMTestLocator.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTestLocator.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTestLocator.java index 75655deebe5b..e2f1f23d914f 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTestLocator.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/SMTestLocator.java @@ -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 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 myLocators; @@ -59,4 +60,4 @@ public interface SMTestLocator { return Collections.emptyList(); } } -} +} \ No newline at end of file From a24d23864b7920fc89c0f6338229fb899eb20345 Mon Sep 17 00:00:00 2001 From: "Liana.Bakradze" Date: Tue, 13 Dec 2016 18:34:57 +0300 Subject: [PATCH 04/13] EDU-798 Task text editing is broken since the focus is not in the editor there is no virtual file in context --- .../coursecreator/actions/CCEditTaskTextAction.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCEditTaskTextAction.java b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCEditTaskTextAction.java index 151afcd0d472..d254409d5e4b 100644 --- a/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCEditTaskTextAction.java +++ b/python/educational-core/course-creator/src/com/jetbrains/edu/coursecreator/actions/CCEditTaskTextAction.java @@ -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; From 244d51c8b80a72b75520e26b04413220e3c03e28 Mon Sep 17 00:00:00 2001 From: Anton Tarasov Date: Tue, 13 Dec 2016 18:34:26 +0300 Subject: [PATCH 05/13] IDEA-164566 [temp disable bounds conversion on Linux] --- platform/platform-api/src/com/intellij/ui/ScreenUtil.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/platform/platform-api/src/com/intellij/ui/ScreenUtil.java b/platform/platform-api/src/com/intellij/ui/ScreenUtil.java index 384b485f55f9..90aec41f3fdd 100644 --- a/platform/platform-api/src/com/intellij/ui/ScreenUtil.java +++ b/platform/platform-api/src/com/intellij/ui/ScreenUtil.java @@ -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()); From 0513a71fae72bd79c44bb650001a546dd37d54e0 Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Mon, 12 Dec 2016 19:53:32 +0300 Subject: [PATCH 06/13] Minor wording change --- .../src/messages/ApplicationBundle.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/platform/platform-resources-en/src/messages/ApplicationBundle.properties b/platform/platform-resources-en/src/messages/ApplicationBundle.properties index 4970024f9110..ee4332d1802e 100644 --- a/platform/platform-resources-en/src/messages/ApplicationBundle.properties +++ b/platform/platform-resources-en/src/messages/ApplicationBundle.properties @@ -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 \ No newline at end of file +title.save.code.style.scheme.as=Duplicate Code Style Scheme As +title.save.color.scheme.as=Duplicate Color Scheme As \ No newline at end of file From 8d1b536b7d8473d86991343c6c545897f7cff889 Mon Sep 17 00:00:00 2001 From: Rustam Vishnyakov Date: Tue, 13 Dec 2016 19:07:27 +0300 Subject: [PATCH 07/13] Common schemes UI elements moved to 'schemes' package --- .../options/codeStyle/CodeStyleSchemesActions.java | 2 +- .../application/options/codeStyle/CodeStyleSchemesPanel.java | 2 +- .../application/options/colors/ColorSchemeActions.java | 2 +- .../com/intellij/application/options/colors/SchemesPanel.java | 2 +- .../options/{ => schemes}/DefaultSchemeActions.java | 2 +- .../options/schemes}/ManageSchemesComboAction.java | 4 ++-- 6 files changed, 7 insertions(+), 7 deletions(-) rename platform/lang-impl/src/com/intellij/application/options/{ => schemes}/DefaultSchemeActions.java (99%) rename platform/lang-impl/src/com/intellij/{ui => application/options/schemes}/ManageSchemesComboAction.java (94%) diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesActions.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesActions.java index 198aaa43fa97..0652ce0e0f47 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesActions.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesActions.java @@ -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; diff --git a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesPanel.java b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesPanel.java index b1bac0db77e2..b94474c97cc6 100644 --- a/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesPanel.java +++ b/platform/lang-impl/src/com/intellij/application/options/codeStyle/CodeStyleSchemesPanel.java @@ -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; diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/ColorSchemeActions.java b/platform/lang-impl/src/com/intellij/application/options/colors/ColorSchemeActions.java index 0de3060b4bc6..62621020c210 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/ColorSchemeActions.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/ColorSchemeActions.java @@ -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; diff --git a/platform/lang-impl/src/com/intellij/application/options/colors/SchemesPanel.java b/platform/lang-impl/src/com/intellij/application/options/colors/SchemesPanel.java index eca8a685b483..be41fc261945 100644 --- a/platform/lang-impl/src/com/intellij/application/options/colors/SchemesPanel.java +++ b/platform/lang-impl/src/com/intellij/application/options/colors/SchemesPanel.java @@ -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; diff --git a/platform/lang-impl/src/com/intellij/application/options/DefaultSchemeActions.java b/platform/lang-impl/src/com/intellij/application/options/schemes/DefaultSchemeActions.java similarity index 99% rename from platform/lang-impl/src/com/intellij/application/options/DefaultSchemeActions.java rename to platform/lang-impl/src/com/intellij/application/options/schemes/DefaultSchemeActions.java index 6651df2439b9..86eeede73f7d 100644 --- a/platform/lang-impl/src/com/intellij/application/options/DefaultSchemeActions.java +++ b/platform/lang-impl/src/com/intellij/application/options/schemes/DefaultSchemeActions.java @@ -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; diff --git a/platform/lang-impl/src/com/intellij/ui/ManageSchemesComboAction.java b/platform/lang-impl/src/com/intellij/application/options/schemes/ManageSchemesComboAction.java similarity index 94% rename from platform/lang-impl/src/com/intellij/ui/ManageSchemesComboAction.java rename to platform/lang-impl/src/com/intellij/application/options/schemes/ManageSchemesComboAction.java index 8b35a36b4230..e6f43164683b 100644 --- a/platform/lang-impl/src/com/intellij/ui/ManageSchemesComboAction.java +++ b/platform/lang-impl/src/com/intellij/application/options/schemes/ManageSchemesComboAction.java @@ -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; From 3bd79228de7ce834a2746be5932607b4fd272bca Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 13 Dec 2016 13:29:25 +0100 Subject: [PATCH 08/13] deprecate ProgressManager#setCancelButtonText --- .../src/com/intellij/openapi/progress/ProgressManager.java | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java b/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java index 1f4aaf3c80c3..6e5117db91d6 100644 --- a/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java +++ b/platform/core-api/src/com/intellij/openapi/progress/ProgressManager.java @@ -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); /** From a05bb94315427911bd3b476ee80ebaaccafe9a76 Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 13 Dec 2016 16:47:15 +0100 Subject: [PATCH 09/13] always create console alarm for heavy filters, as they can appear dynamically (EA-92863 - assert: ConsoleViewImpl.runHeavyFilters) --- .../src/com/intellij/execution/impl/ConsoleViewImpl.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java index fc948372407e..61de784b38e5 100644 --- a/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java +++ b/platform/lang-impl/src/com/intellij/execution/impl/ConsoleViewImpl.java @@ -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() { From 1b0fe6e744ffa0b975c67fdf28a2dd9ae98d15da Mon Sep 17 00:00:00 2001 From: peter Date: Tue, 13 Dec 2016 17:01:08 +0100 Subject: [PATCH 10/13] disallow model changes during undo confirmation dialog (EA-92445 - ISE: DocumentUndoProvider$MyEditorDocumentListener.beforeDocumentChange) --- .../intellij/openapi/command/impl/UndoRedo.java | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/command/impl/UndoRedo.java b/platform/platform-impl/src/com/intellij/openapi/command/impl/UndoRedo.java index 37363ee907b1..0fb1b2db0a08 100644 --- a/platform/platform-impl/src/com/intellij/openapi/command/impl/UndoRedo.java +++ b/platform/platform-impl/src/com/intellij/openapi/command/impl/UndoRedo.java @@ -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) { From 4d7afe1e60411f4111d2c1517d94cc4862e890f5 Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Tue, 13 Dec 2016 18:45:40 +0300 Subject: [PATCH 11/13] [vcs-log] use round instead of ceil for label icon width calculation --- .../impl/src/com/intellij/vcs/log/ui/render/LabelIcon.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelIcon.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelIcon.java index 6aadd0e10f26..bdfa969aed17 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelIcon.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelIcon.java @@ -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 From 36199b43df95715e19e5eb3fae590b1312c366dc Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Tue, 13 Dec 2016 18:46:12 +0300 Subject: [PATCH 12/13] [vcs-log] fix right padding in non-compact mode --- .../com/intellij/vcs/log/ui/render/LabelPainter.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java index b031ab540540..2e687266e968 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java @@ -60,7 +60,7 @@ import java.util.Map; 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); @@ -155,7 +155,7 @@ public class LabelPainter { for (RefGroup group : refGroups) { List 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 +184,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 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 +198,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 { @@ -321,7 +321,7 @@ public class LabelPainter { if (myGreyBackground != null) { 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); } From 5f4540ef52edc97299e3c158b9e572244bdfac9c Mon Sep 17 00:00:00 2001 From: Julia Beliaeva Date: Tue, 13 Dec 2016 19:06:40 +0300 Subject: [PATCH 13/13] [vcs-log] break grey background in non-compact mode, round edges --- .../vcs/log/ui/render/LabelPainter.java | 22 +++++++++++++++---- .../vcs/log/ui/render/RectanglePainter.java | 2 +- 2 files changed, 19 insertions(+), 5 deletions(-) diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java index 2e687266e968..1504aeefddb8 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/LabelPainter.java @@ -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(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 refGroups = manager == null ? ContainerUtil.emptyList() : manager.groupForTable(references, myCompact, myShowTagNames); - myGreyBackground = calculateGreyBackground(refGroups, background, isSelected); + myGreyBackground = calculateGreyBackground(refGroups, background, isSelected, myCompact); Pair>, Integer> presentation = calculatePresentation(refGroups, metrics, myHeight, myGreyBackground != null ? myGreyBackground : myBackground, availableWidth, myCompact); @@ -264,8 +267,12 @@ public class LabelPainter { } @Nullable - private static Color calculateGreyBackground(@NotNull List refGroups, @NotNull Color background, boolean isSelected) { + private static Color calculateGreyBackground(@NotNull List 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,7 +325,7 @@ 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, @@ -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(); diff --git a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/RectanglePainter.java b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/RectanglePainter.java index 5c2180b44c29..645fecce7874 100644 --- a/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/RectanglePainter.java +++ b/platform/vcs-log/impl/src/com/intellij/vcs/log/ui/render/RectanglePainter.java @@ -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;