From 4da23bc3bf538c78f0a8d18942cbee196816d099 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 24 Sep 2015 15:26:01 +0300 Subject: [PATCH 01/23] IDEA-CR-4999 followup --- platform/platform-api/src/com/intellij/ui/tabs/TabInfo.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-api/src/com/intellij/ui/tabs/TabInfo.java b/platform/platform-api/src/com/intellij/ui/tabs/TabInfo.java index 91536d53deaa..527eaf22abb2 100644 --- a/platform/platform-api/src/com/intellij/ui/tabs/TabInfo.java +++ b/platform/platform-api/src/com/intellij/ui/tabs/TabInfo.java @@ -108,7 +108,7 @@ public final class TabInfo implements Queryable, PlaceProvider { public TabInfo setText(String text) { List attributes = myText.getAttributes(); - TextAttributes textAttributes = attributes.isEmpty() ? null : attributes.get(0).toTextAttributes(); + TextAttributes textAttributes = attributes.size() == 1 ? attributes.get(0).toTextAttributes() : null; TextAttributes defaultAttributes = getDefaultAttributes().toTextAttributes(); if (!myText.toString().equals(text) || !Comparing.equal(textAttributes, defaultAttributes)) { clearText(false); From c0284062e56f5ea14fd3c577978323bf96b5cf60 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 24 Sep 2015 15:34:11 +0300 Subject: [PATCH 02/23] make test more portable --- .../intellij/application/ApplicationImplTest.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java b/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java index 308a6545a5a2..0afee92585c4 100644 --- a/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java @@ -15,6 +15,7 @@ */ package com.intellij.application; +import com.intellij.concurrency.JobSchedulerImpl; import com.intellij.openapi.Disposable; import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.Application; @@ -105,8 +106,8 @@ public class ApplicationImplTest extends PlatformTestCase { } - public void testReadWriteLockPerformance() throws InterruptedException { - int iterations = Timings.adjustAccordingToMySpeed(300000, true); + public void testRead50Write50LockPerformance() throws InterruptedException { + int iterations = Timings.adjustAccordingToMySpeed(400000, true); System.out.println("iterations = " + iterations); final int readIterations = iterations; final int writeIterations = iterations; @@ -114,8 +115,8 @@ public class ApplicationImplTest extends PlatformTestCase { runReadWrites(readIterations, writeIterations, 2000); } - public void testReadLockPerformance() throws InterruptedException { - int iterations = Timings.adjustAccordingToMySpeed(300000, true); + public void testRead100Write0LockPerformance() throws InterruptedException { + int iterations = Timings.adjustAccordingToMySpeed(400000, true); System.out.println("iterations = " + iterations); final int readIterations = iterations; final int writeIterations = 0; @@ -129,7 +130,7 @@ public class ApplicationImplTest extends PlatformTestCase { application.disableEventsUntil(disposable); try { - final int numOfThreads = 10; + final int numOfThreads = JobSchedulerImpl.CORES_COUNT; PlatformTestUtil.startPerformanceTest("lock performance", expectedMs, () -> { final CountDownLatch reads = new CountDownLatch(numOfThreads); for (int i = 0; i < numOfThreads; i++) { @@ -155,7 +156,7 @@ public class ApplicationImplTest extends PlatformTestCase { System.out.println("write end"); } reads.await(); - }).assertTiming(); + }).cpuBound().assertTiming(); } finally { Disposer.dispose(disposable); From 305dae3a13b9a85f2fbc3dabf8f8e370d714aa1c Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 24 Sep 2015 17:38:24 +0300 Subject: [PATCH 03/23] cleanup --- .../src/com/intellij/util/containers/TransferToEDTQueue.java | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/platform/util/src/com/intellij/util/containers/TransferToEDTQueue.java b/platform/util/src/com/intellij/util/containers/TransferToEDTQueue.java index ba9ebb5a8f7d..654e290c110d 100644 --- a/platform/util/src/com/intellij/util/containers/TransferToEDTQueue.java +++ b/platform/util/src/com/intellij/util/containers/TransferToEDTQueue.java @@ -22,6 +22,7 @@ import com.intellij.util.concurrency.Semaphore; import gnu.trove.Equality; import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.TestOnly; import javax.swing.*; import java.util.Collection; @@ -160,6 +161,8 @@ public class TransferToEDTQueue { } } + @TestOnly + @NotNull public Collection dump() { synchronized (myQueue) { return myQueue.toList(); @@ -169,11 +172,9 @@ public class TransferToEDTQueue { // process all queue in current thread public void drain() { int processed = 0; - long start = System.currentTimeMillis(); while (processNext()) { processed++; } - long finish = System.currentTimeMillis(); } // blocks until all elements in the queue are processed From c351671a1853c49c4e0644af92d8f5c7b542fe76 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 24 Sep 2015 18:43:04 +0300 Subject: [PATCH 04/23] introduce timeouts --- .../application/ApplicationImplTest.java | 84 ++++++++++--------- 1 file changed, 46 insertions(+), 38 deletions(-) diff --git a/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java b/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java index 0afee92585c4..f2eee2542ebb 100644 --- a/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java +++ b/platform/platform-tests/testSrc/com/intellij/application/ApplicationImplTest.java @@ -53,6 +53,7 @@ public class ApplicationImplTest extends PlatformTestCase { protected void setUp() throws Exception { super.setUp(); exception = null; + timeOut = System.currentTimeMillis() + 2*60*1000; } private volatile Throwable exception; @@ -187,7 +188,7 @@ public class ApplicationImplTest extends PlatformTestCase { try { System.out.println("read lock1 acquired"); read1Acquired.set(true); - while (holdRead1.get()); + while (holdRead1.get() && ok()); } finally { lock.unlockRead(stamp); @@ -195,20 +196,20 @@ public class ApplicationImplTest extends PlatformTestCase { System.out.println("read lock1 released"); } } - catch (Exception e) { + catch (Throwable e) { exception = e; - throw e; + throw new RuntimeException(e); } }, "read lock1"); readAction1.start(); - while (!read1Acquired.get()); + while (!read1Acquired.get() && ok()); AtomicBoolean aboutToAcquireWrite = new AtomicBoolean(); // readActions2 should try to acquire read action when write action is pending Thread readActions2 = new Thread(() -> { try { assertFalse(ApplicationManager.getApplication().isDispatchThread()); - while (!aboutToAcquireWrite.get()); + while (!aboutToAcquireWrite.get() && ok()); TimeoutUtil.sleep(2000); // make sure it called writelock long stamp = lock.readLock(); try { @@ -221,9 +222,9 @@ public class ApplicationImplTest extends PlatformTestCase { System.out.println("read lock2 released"); } } - catch (Exception e) { + catch (Throwable e) { exception = e; - throw e; + throw new RuntimeException(e); } }, "read lock2"); readActions2.start(); @@ -231,12 +232,12 @@ public class ApplicationImplTest extends PlatformTestCase { Thread checkThread = new Thread(()->{ try { assertFalse(ApplicationManager.getApplication().isDispatchThread()); - while (!aboutToAcquireWrite.get()); - while (!read1Acquired.get()); + while (!aboutToAcquireWrite.get() && ok()); + while (!read1Acquired.get() && ok()); TimeoutUtil.sleep(2000); // make sure it called writelock long timeout = System.currentTimeMillis() + 10000; - while (System.currentTimeMillis() < timeout) { + while (System.currentTimeMillis() < timeout && ok()) { assertTrue(aboutToAcquireWrite.get()); assertTrue(read1Acquired.get()); assertFalse(read1Released.get()); @@ -250,10 +251,10 @@ public class ApplicationImplTest extends PlatformTestCase { } holdRead1.set(false); - while (!writeAcquired.get()); + while (!writeAcquired.get() && ok()); timeout = System.currentTimeMillis() + 10000; - while (System.currentTimeMillis() < timeout) { + while (System.currentTimeMillis() < timeout && ok()) { assertTrue(aboutToAcquireWrite.get()); assertTrue(read1Acquired.get()); assertTrue(read1Released.get()); @@ -267,11 +268,11 @@ public class ApplicationImplTest extends PlatformTestCase { holdWrite.set(false); - while (!read2Acquired.get()); + while (!read2Acquired.get() && ok()); TimeoutUtil.sleep(1000); // wait for immediate release of read lock2 timeout = System.currentTimeMillis() + 10000; - while (System.currentTimeMillis() < timeout) { + while (System.currentTimeMillis() < timeout && ok()) { assertTrue(aboutToAcquireWrite.get()); assertTrue(read1Acquired.get()); assertTrue(read1Released.get()); @@ -281,9 +282,9 @@ public class ApplicationImplTest extends PlatformTestCase { assertTrue(writeReleased.get()); } } - catch (Exception e) { + catch (Throwable e) { exception = e; - throw e; + throw new RuntimeException(e); } }, "check"); checkThread.start(); @@ -293,7 +294,7 @@ public class ApplicationImplTest extends PlatformTestCase { try { System.out.println("write lock acquired"); writeAcquired.set(true); - while (holdWrite.get() && exception == null); + while (holdWrite.get() && ok()); } finally { lock.unlockWrite(stamp); @@ -307,6 +308,12 @@ public class ApplicationImplTest extends PlatformTestCase { if (exception != null) throw exception; } + private static long timeOut; + private boolean ok() throws Throwable { + if (exception != null) throw exception; + return System.currentTimeMillis() < timeOut; + } + public void testAppLockReadWritePreference() throws Throwable { // take read lock1. // try to take write lock - must wait (because of taken read lock) @@ -330,7 +337,7 @@ public class ApplicationImplTest extends PlatformTestCase { try { System.out.println("read lock1 acquired"); read1Acquired.set(true); - while (holdRead1.get()); + while (holdRead1.get() && ok()); } finally { stamp.finish(); @@ -338,20 +345,20 @@ public class ApplicationImplTest extends PlatformTestCase { System.out.println("read lock1 released"); } } - catch (Exception e) { + catch (Throwable e) { exception = e; - throw e; + throw new RuntimeException(e); } }, "read lock1"); readAction1.start(); - while (!read1Acquired.get()); + while (!read1Acquired.get() && ok()); AtomicBoolean aboutToAcquireWrite = new AtomicBoolean(); // readActions2 should try to acquire read action when write action is pending Thread readActions2 = new Thread(() -> { try { assertFalse(ApplicationManager.getApplication().isDispatchThread()); - while (!aboutToAcquireWrite.get()); + while (!aboutToAcquireWrite.get() && ok()); TimeoutUtil.sleep(2000); // make sure it called writelock AccessToken stamp = application.acquireReadActionLock(); try { @@ -364,9 +371,9 @@ public class ApplicationImplTest extends PlatformTestCase { System.out.println("read lock2 released"); } } - catch (Exception e) { + catch (Throwable e) { exception = e; - throw e; + throw new RuntimeException(e); } }, "read lock2"); readActions2.start(); @@ -374,12 +381,12 @@ public class ApplicationImplTest extends PlatformTestCase { Thread checkThread = new Thread(()->{ try { assertFalse(ApplicationManager.getApplication().isDispatchThread()); - while (!aboutToAcquireWrite.get()); - while (!read1Acquired.get()); + while (!aboutToAcquireWrite.get() && ok()); + while (!read1Acquired.get() && ok()); TimeoutUtil.sleep(2000); // make sure it called writelock long timeout = System.currentTimeMillis() + 10000; - while (System.currentTimeMillis() < timeout) { + while (System.currentTimeMillis() < timeout && ok()) { assertTrue(aboutToAcquireWrite.get()); assertTrue(read1Acquired.get()); assertFalse(read1Released.get()); @@ -392,10 +399,10 @@ public class ApplicationImplTest extends PlatformTestCase { } holdRead1.set(false); - while (!writeAcquired.get()); + while (!writeAcquired.get() && ok()); timeout = System.currentTimeMillis() + 10000; - while (System.currentTimeMillis() < timeout) { + while (System.currentTimeMillis() < timeout && ok()) { assertTrue(aboutToAcquireWrite.get()); assertTrue(read1Acquired.get()); assertTrue(read1Released.get()); @@ -409,11 +416,11 @@ public class ApplicationImplTest extends PlatformTestCase { holdWrite.set(false); - while (!read2Acquired.get()); + while (!read2Acquired.get() && ok()); TimeoutUtil.sleep(1000); // wait for immediate release of read lock2 timeout = System.currentTimeMillis() + 10000; - while (System.currentTimeMillis() < timeout) { + while (System.currentTimeMillis() < timeout && ok()) { assertTrue(aboutToAcquireWrite.get()); assertTrue(read1Acquired.get()); assertTrue(read1Released.get()); @@ -423,9 +430,9 @@ public class ApplicationImplTest extends PlatformTestCase { assertTrue(writeReleased.get()); } } - catch (Exception e) { + catch (Throwable e) { exception = e; - throw e; + throw new RuntimeException(e); } }, "check"); checkThread.start(); @@ -435,7 +442,7 @@ public class ApplicationImplTest extends PlatformTestCase { try { System.out.println("write lock acquired"); writeAcquired.set(true); - while (holdWrite.get() && exception == null); + while (holdWrite.get() && ok()); } finally { stamp.finish(); @@ -462,10 +469,10 @@ public class ApplicationImplTest extends PlatformTestCase { final StringBuffer LOG = new StringBuffer(); new Thread(() -> { try { - ApplicationManager.getApplication().runReadAction(() -> { + ApplicationManager.getApplication().runReadAction((ThrowableComputable)() -> { LOG.append("inside read action\n"); readStarted = true; - while (!tryingToStartWriteAction); + while (!tryingToStartWriteAction && ok()); TimeoutUtil.sleep(100); for (int i = 0; i < anotherReadActionStarted.length; i++) { @@ -490,7 +497,7 @@ public class ApplicationImplTest extends PlatformTestCase { } for (AtomicBoolean threadStarted : anotherThreadStarted) { - while (!threadStarted.get()) ; + while (!threadStarted.get() && ok()) ; } // now the other threads try to get read lock. we should not let them for (int i=0; i<10; i++) { @@ -500,6 +507,7 @@ public class ApplicationImplTest extends PlatformTestCase { TimeoutUtil.sleep(20); } LOG.append("\nfinished read action"); + return null; }); } catch (Throwable e) { @@ -508,7 +516,7 @@ public class ApplicationImplTest extends PlatformTestCase { }, "read").start(); - while (!readStarted); + while (!readStarted && ok()); tryingToStartWriteAction = true; LOG.append("\nwrite about to start"); ApplicationManager.getApplication().runWriteAction(() -> { From 1230a1efe6010ad2c264b184f518d6d7c31b0d43 Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 24 Sep 2015 18:42:56 +0300 Subject: [PATCH 05/23] [git] simplify and fix NPE: use utility method returning boolean instead of overriding onCancel --- .../src/git4idea/commands/GitHandlerUtil.java | 8 ++++---- .../src/git4idea/ui/GitUnstashDialog.java | 18 +++++++----------- 2 files changed, 11 insertions(+), 15 deletions(-) diff --git a/plugins/git4idea/src/git4idea/commands/GitHandlerUtil.java b/plugins/git4idea/src/git4idea/commands/GitHandlerUtil.java index a840249f1f89..a15bab7ca2f0 100644 --- a/plugins/git4idea/src/git4idea/commands/GitHandlerUtil.java +++ b/plugins/git4idea/src/git4idea/commands/GitHandlerUtil.java @@ -251,19 +251,19 @@ public class GitHandlerUtil { /** * a progress manager to use */ - private final ProgressIndicator myProgressIndicator; + @Nullable private final ProgressIndicator myProgressIndicator; /** * A constructor * - * @param manager the project manager + * @param indicator the project manager * @param handler a handler instance * @param operationName an operation name * @param showErrors if true, the errors are shown when process is terminated */ - public GitLineHandlerListenerProgress(final ProgressIndicator manager, GitHandler handler, String operationName, boolean showErrors) { + public GitLineHandlerListenerProgress(@Nullable ProgressIndicator indicator, GitHandler handler, String operationName, boolean showErrors) { super(handler, operationName, showErrors); //To change body of overridden methods use File | Settings | File Templates. - myProgressIndicator = manager; + myProgressIndicator = indicator; } /** diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java index dfc2d6bc9b38..ec5c56b37347 100644 --- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java +++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java @@ -361,21 +361,17 @@ public class GitUnstashDialog extends DialogWrapper { AccessToken token = DvcsUtil.workingTreeChangeStarted(myProject); try { final Ref result = Ref.create(); - final Ref cancelled = Ref.create(); - ProgressManager.getInstance().run(new Task.Modal(h.project(), GitBundle.getString("unstash.unstashing"), true) { + final ProgressManager progressManager = ProgressManager.getInstance(); + boolean completed = progressManager.runProcessWithProgressSynchronously(new Runnable() { @Override - public void run(@NotNull final ProgressIndicator indicator) { - indicator.setIndeterminate(true); - h.addLineListener(new GitHandlerUtil.GitLineHandlerListenerProgress(indicator, h, "stash", false)); + public void run() { + h.addLineListener(new GitHandlerUtil.GitLineHandlerListenerProgress(progressManager.getProgressIndicator(), h, "stash", false)); Git git = ServiceManager.getService(Git.class); result.set(git.runCommand(new Computable.PredefinedValueComputable(h))); } - @Override - public void onCancel() { - cancelled.set(true); - } - }); - if (cancelled.get()) return; + }, GitBundle.getString("unstash.unstashing"), true, myProject); + + if (!completed) return; ServiceManager.getService(myProject, GitPlatformFacade.class).hardRefresh(root); GitCommandResult res = result.get(); From 69af05f4e168edd1111cb3ae27f7848a4d07b96f Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 24 Sep 2015 18:50:45 +0300 Subject: [PATCH 06/23] IDEA-145420 Shortcut has strange FG color in popup menu --- .../src/com/intellij/ide/ui/laf/darcula/darcula_mac.properties | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/darcula_mac.properties b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/darcula_mac.properties index 32f21a8df73c..463569a981c4 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/darcula_mac.properties +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/darcula_mac.properties @@ -1,3 +1,4 @@ # suppress inspection "UnusedProperty" for whole file darcula.selectionBackground=2F65CA -Menu.arrowIcon=AllIcons.Mac.Tree_white_right_arrow \ No newline at end of file +Menu.arrowIcon=AllIcons.Mac.Tree_white_right_arrow +MenuItem.acceleratorSelectionForeground=ffffff \ No newline at end of file From 6e6afdaa652d9cc2d376f5633872106f19e2750d Mon Sep 17 00:00:00 2001 From: Dmitry Batkovich Date: Thu, 24 Sep 2015 19:02:16 +0300 Subject: [PATCH 07/23] IDEA-51447 Help button in the structure tool window opens wrong page, when a *.properties file structure is shown. --- .../editor/PropertiesGroupingStructureViewComponent.java | 6 ------ .../editor/ResourceBundleStructureViewComponent.java | 9 ++++++--- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java index 8993be097090..894c03e7ddde 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/PropertiesGroupingStructureViewComponent.java @@ -24,7 +24,6 @@ import com.intellij.openapi.fileEditor.FileEditor; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.Messages; import com.intellij.util.ArrayUtil; -import org.jetbrains.annotations.NonNls; import java.util.LinkedHashSet; import java.util.Set; @@ -138,10 +137,5 @@ public class PropertiesGroupingStructureViewComponent extends StructureViewCompo } } } - - @NonNls - public String getHelpID() { - return "editing.propertyFile.bundleEditor"; - } } diff --git a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java index 435f0c3a8c86..9c36ee1fa648 100644 --- a/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java +++ b/plugins/properties/src/com/intellij/lang/properties/editor/ResourceBundleStructureViewComponent.java @@ -29,12 +29,9 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.ide.CopyPasteManager; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.text.StringUtil; -import com.intellij.pom.PomTargetPsiElement; -import com.intellij.pom.references.PomService; import com.intellij.psi.PsiElement; import com.intellij.psi.PsiFile; import com.intellij.psi.PsiNamedElement; -import com.intellij.psi.PsiTarget; import com.intellij.psi.util.PsiUtilCore; import com.intellij.refactoring.safeDelete.SafeDeleteHandler; import com.intellij.ui.PopupHandler; @@ -43,6 +40,7 @@ import com.intellij.usages.UsageView; import com.intellij.util.ArrayFactory; import com.intellij.util.NullableFunction; import com.intellij.util.containers.ContainerUtil; +import org.jetbrains.annotations.NonNls; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -235,5 +233,10 @@ public class ResourceBundleStructureViewComponent extends PropertiesGroupingStru return true; } } + + @NonNls + public String getHelpID() { + return "editing.propertyFile.bundleEditor"; + } } From 9f59a40bee4a6fe516a077e8d038eb911c5ec70d Mon Sep 17 00:00:00 2001 From: Kirill Likhodedov Date: Thu, 24 Sep 2015 19:06:47 +0300 Subject: [PATCH 08/23] [git] don't close the 'add remote' dialog if validation is cancelled or fails --- .../git4idea/push/GitDefineRemoteDialog.java | 60 ++++++++++++++++++- .../src/git4idea/push/GitPushTargetPanel.java | 39 +----------- 2 files changed, 59 insertions(+), 40 deletions(-) diff --git a/plugins/git4idea/src/git4idea/push/GitDefineRemoteDialog.java b/plugins/git4idea/src/git4idea/push/GitDefineRemoteDialog.java index 989e73edb9fc..945a7b8db8e8 100644 --- a/plugins/git4idea/src/git4idea/push/GitDefineRemoteDialog.java +++ b/plugins/git4idea/src/git4idea/push/GitDefineRemoteDialog.java @@ -15,13 +15,22 @@ */ package git4idea.push; -import com.intellij.openapi.project.Project; +import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.progress.ProcessCanceledException; +import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.ui.DialogWrapper; +import com.intellij.openapi.ui.Messages; +import com.intellij.openapi.util.ThrowableComputable; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.ui.components.JBLabel; import com.intellij.util.ui.GridBag; import com.intellij.util.ui.UIUtil; +import git4idea.commands.Git; +import git4idea.commands.GitCommandResult; import git4idea.repo.GitRemote; +import git4idea.repo.GitRepository; +import git4idea.validators.GitRefNameValidator; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -30,11 +39,18 @@ import java.awt.*; class GitDefineRemoteDialog extends DialogWrapper { + private static final Logger LOG = Logger.getInstance(GitDefineRemoteDialog.class); + + @NotNull private final GitRepository myRepository; + @NotNull private final Git myGit; + @NotNull private final JTextField myRemoteName; @NotNull private final JTextField myRemoteUrl; - GitDefineRemoteDialog(@NotNull Project project) { - super(project); + GitDefineRemoteDialog(@NotNull GitRepository repository, @NotNull Git git) { + super(repository.getProject()); + myRepository = repository; + myGit = git; myRemoteName = new JTextField(GitRemote.ORIGIN_NAME, 20); myRemoteUrl = new JTextField(20); setTitle("Define Remote"); @@ -71,4 +87,42 @@ class GitDefineRemoteDialog extends DialogWrapper { public JComponent getPreferredFocusedComponent() { return myRemoteUrl; } + + @Override + protected void doOKAction() { + try { + String name = getRemoteName(); + String url = getRemoteUrl(); + String error = validateRemoteUnderModal(name, url); + if (error != null) { + LOG.warn(String.format("Invalid remote. Name: [%s], URL: [%s], error: %s", name, url, error)); + Messages.showErrorDialog(myRepository.getProject(), error, "Invalid Remote URL"); + } + else { + super.doOKAction(); + } + } + catch (ProcessCanceledException pce) { + // let the dialog stay open + } + } + + @Nullable + private String validateRemoteUnderModal(final String name, final String url) { + if (url.isEmpty()) { + return "URL can't be empty"; + } + if (!GitRefNameValidator.getInstance().checkInput(name)) { + return "Remote name is invalid"; + } + + return ProgressManager.getInstance().runProcessWithProgressSynchronously(new ThrowableComputable() { + @Override + public String compute() throws ProcessCanceledException { + final GitCommandResult result = myGit.lsRemote(myRepository.getProject(), VfsUtilCore.virtualToIoFile(myRepository.getRoot()), url); + return !result.success() ? "Remote URL is invalid: " + result.getErrorOutputAsHtmlString() : null; + } + }, "Checking URL...", true, myRepository.getProject()); + } + } diff --git a/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java b/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java index ef36f95e59f6..fa0a7882b780 100644 --- a/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java +++ b/plugins/git4idea/src/git4idea/push/GitPushTargetPanel.java @@ -31,8 +31,6 @@ import com.intellij.openapi.ui.ValidationInfo; import com.intellij.openapi.ui.popup.ListPopup; import com.intellij.openapi.ui.popup.PopupStep; import com.intellij.openapi.ui.popup.util.BaseListPopupStep; -import com.intellij.openapi.util.Ref; -import com.intellij.openapi.vfs.VfsUtilCore; import com.intellij.openapi.wm.IdeFocusManager; import com.intellij.ui.ColoredTreeCellRenderer; import com.intellij.ui.SimpleTextAttributes; @@ -47,7 +45,6 @@ import git4idea.commands.Git; import git4idea.commands.GitCommandResult; import git4idea.repo.GitRemote; import git4idea.repo.GitRepository; -import git4idea.validators.GitRefNameValidator; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -162,44 +159,12 @@ public class GitPushTargetPanel extends PushTargetPanel { } private void showDefineRemoteDialog() { - GitDefineRemoteDialog dialog = new GitDefineRemoteDialog(myRepository.getProject()); + GitDefineRemoteDialog dialog = new GitDefineRemoteDialog(myRepository, myGit); if (dialog.showAndGet()) { - String name = dialog.getRemoteName(); - String url = dialog.getRemoteUrl(); - String error = validateRemoteUnderModal(name, url); - if (error != null) { - LOG.warn(String.format("Invalid remote. Name: [%s], URL: [%s], error: %s", name, url, error)); - Messages.showErrorDialog(myRepository.getProject(), error, "Invalid Remote URL"); - } - else { - addRemoteUnderModal(name, url); - } + addRemoteUnderModal(dialog.getRemoteName(), dialog.getRemoteUrl()); } } - @Nullable - private String validateRemoteUnderModal(final String name, final String url) { - if (url.isEmpty()) { - return "URL can't be empty"; - } - if (!GitRefNameValidator.getInstance().checkInput(name)) { - return "Remote name is invalid"; - } - - final Ref error = Ref.create(); - ProgressManager.getInstance().run(new Task.Modal(myRepository.getProject(), "Checking URL...", true) { - @Override - public void run(@NotNull ProgressIndicator indicator) { - indicator.setIndeterminate(true); - final GitCommandResult result = myGit.lsRemote(myRepository.getProject(), VfsUtilCore.virtualToIoFile(myRepository.getRoot()), url); - if (!result.success()) { - error.set("Remote URL is invalid: " + result.getErrorOutputAsHtmlString()); - } - } - }); - return error.get(); - } - private void addRemoteUnderModal(@NotNull final String remoteName, @NotNull final String remoteUrl) { ProgressManager.getInstance().run(new Task.Modal(myRepository.getProject(), "Adding remote...", true) { private GitCommandResult myResult; From d94d0f404f2791f64b005a0b6a257333cfc64ba2 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 24 Sep 2015 17:43:34 +0200 Subject: [PATCH 09/23] PsiFileImpl: fix race condition between AST and stub loading, which resulted in stub elements being not bound to AST --- .../intellij/psi/impl/source/PsiFileImpl.java | 21 +++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java b/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java index d36d802a8008..93faaab938dd 100644 --- a/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java +++ b/platform/core-impl/src/com/intellij/psi/impl/source/PsiFileImpl.java @@ -186,15 +186,32 @@ public abstract class PsiFileImpl extends ElementBase implements PsiFileEx, PsiF FileElement treeElement = createFileElement(viewProvider.getContents()); treeElement.setPsi(this); - final StubTree stub = derefStub(); - List> bindings = calcStubAstBindings(treeElement, cachedDocument, stub); + while (true) { + StubTree stub = derefStub(); + List> bindings = calcStubAstBindings(treeElement, cachedDocument, stub); + FileElement savedTree = ensureTreeElement(viewProvider, treeElement, stub, bindings); + if (savedTree != null) { + return savedTree; + } + } + } + + @Nullable + private FileElement ensureTreeElement(@NotNull FileViewProvider viewProvider, + @NotNull FileElement treeElement, + @Nullable StubTree stub, + @NotNull List> bindings) { synchronized (PsiLock.LOCK) { FileElement existing = derefTreeElement(); if (existing != null) { return existing; } + if (stub != derefStub()) { + return null; // stub has been just loaded by another thread, it needs to be bound to AST + } + if (stub != null) { treeElement.putUserData(STUB_TREE_IN_PARSED_TREE, new SoftReference(stub)); putUserData(ObjectStubTree.LAST_STUB_TREE_HASH, stub.hashCode()); From ec78edbf02859c9d85ba6a4b77c40f987e76c7a5 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Thu, 24 Sep 2015 19:48:51 +0300 Subject: [PATCH 10/23] making myEntriesList access thread-safe --- .../fileEditor/impl/EditorHistoryManager.java | 40 +++++++++++-------- 1 file changed, 24 insertions(+), 16 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.java b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.java index ed3ffcda0caa..117a3ed7fb5d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.java +++ b/platform/platform-impl/src/com/intellij/openapi/fileEditor/impl/EditorHistoryManager.java @@ -53,7 +53,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme /** * State corresponding to the most recent file is the last */ - private final List myEntriesList = Collections.synchronizedList(new ArrayList()); + private final List myEntriesList = new ArrayList(); /** * Invoked by reflection @@ -81,7 +81,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme //noinspection unchecked for (final Element e : (Iterable)children) { try { - myEntriesList.add(new HistoryEntry(myProject, e)); + addEntry(new HistoryEntry(EditorHistoryManager.this.myProject, e)); } catch (InvalidDataException e1) { // OK here @@ -100,6 +100,14 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme ); } + private synchronized void addEntry(HistoryEntry entry) { + myEntriesList.add(entry); + } + + private synchronized void removeEntry(HistoryEntry entry) { + myEntriesList.remove(entry); + } + @Override @NotNull public String getComponentName(){ @@ -145,8 +153,8 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme final HistoryEntry entry = getEntry(file); if(entry != null){ - myEntriesList.remove(entry); - myEntriesList.add(entry); + removeEntry(entry); + addEntry(entry); } else { final FileEditorState[] states=new FileEditorState[editors.length]; @@ -157,7 +165,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme providers[i] = provider; states[i] = editors[i].getState(FileEditorStateLevel.FULL); } - myEntriesList.add(new HistoryEntry(file, providers, states, providers[selectedProviderIndex])); + addEntry(new HistoryEntry(file, providers, states, providers[selectedProviderIndex])); trimToSize(); } } @@ -222,8 +230,8 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme LOG.assertTrue(entry.mySelectedProvider != null); if(changeEntryOrderOnly){ - myEntriesList.remove(entry); - myEntriesList.add(entry); + removeEntry(entry); + addEntry(entry); } } } @@ -231,7 +239,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme /** * Removes all entries that correspond to invalid files */ - private void validateEntries(){ + private synchronized void validateEntries(){ for(int i=myEntriesList.size()-1; i>=0; i--){ final HistoryEntry entry = myEntriesList.get(i); if(!entry.myFile.isValid()){ @@ -243,7 +251,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme /** * @return array of valid files that are in the history, oldest first. May contain duplicates. */ - public VirtualFile[] getFiles(){ + public synchronized VirtualFile[] getFiles(){ validateEntries(); final VirtualFile[] result = new VirtualFile[myEntriesList.size()]; for(int i=myEntriesList.size()-1; i>=0 ;i--){ @@ -265,7 +273,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme return result; } - public boolean hasBeenOpen(@NotNull VirtualFile f) { + public synchronized boolean hasBeenOpen(@NotNull VirtualFile f) { for (HistoryEntry each : myEntriesList) { if (Comparing.equal(each.myFile, f)) return true; } @@ -276,13 +284,13 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme * Removes specified file from history. The method does * nothing if file is not in the history. * - * @exception java.lang.IllegalArgumentException if file + * @exception IllegalArgumentException if file * is null */ - public void removeFile(@NotNull final VirtualFile file){ + public synchronized void removeFile(@NotNull final VirtualFile file){ final HistoryEntry entry = getEntry(file); if(entry != null){ - myEntriesList.remove(entry); + removeEntry(entry); } } @@ -301,7 +309,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme return entry != null ? entry.mySelectedProvider : null; } - private HistoryEntry getEntry(@NotNull VirtualFile file){ + private synchronized HistoryEntry getEntry(@NotNull VirtualFile file){ validateEntries(); for (int i = myEntriesList.size() - 1; i >= 0; i--) { final HistoryEntry entry = myEntriesList.get(i); @@ -316,7 +324,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme * If total number of files in history more then UISettings.RECENT_FILES_LIMIT * then removes the oldest ones to fit the history to new size. */ - private void trimToSize(){ + private synchronized void trimToSize(){ final int limit = UISettings.getInstance().RECENT_FILES_LIMIT + 1; while(myEntriesList.size()>limit){ myEntriesList.remove(0); @@ -332,7 +340,7 @@ public final class EditorHistoryManager extends AbstractProjectComponent impleme } @Override - public void writeExternal(final Element element){ + public synchronized void writeExternal(final Element element){ // update history before saving final VirtualFile[] openFiles = FileEditorManager.getInstance(myProject).getOpenFiles(); for (int i = openFiles.length - 1; i >= 0; i--) { From 1bdc9a2ceb6145b0018c40c78d5e0de0350c09ca Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 24 Sep 2015 13:40:19 +0300 Subject: [PATCH 11/23] ensure drop target/sources survived commitAllDocuments (following IDEA-CR-5169) --- .../ide/projectView/impl/ProjectViewDropTarget.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java index 56b0d63fa5a1..1e4593f2343d 100644 --- a/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java +++ b/platform/lang-impl/src/com/intellij/ide/projectView/impl/ProjectViewDropTarget.java @@ -318,6 +318,12 @@ class ProjectViewDropTarget implements DnDNativeTarget { final Module module = getModule(targetNode); final DataContext dataContext = DataManager.getInstance().getDataContext(myTree); PsiDocumentManager.getInstance(myProject).commitAllDocuments(); + + if (!targetElement.isValid()) return; + for (PsiElement sourceElement : sourceElements) { + if (!sourceElement.isValid()) return; + } + getActionHandler().invoke(myProject, sourceElements, new DataContext() { @Override @Nullable From 882cff938442ca99c4078627267014e416b6a38e Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 24 Sep 2015 14:02:29 +0300 Subject: [PATCH 12/23] ensure valid containing class; cache number of constructors EA-65064 - PIEAE: StubBasedPsiElementBase.getContainingFile --- .../quickfix/CreateConstructorParameterFromFieldFix.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java index 64c7f351753d..6069486d38c9 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/quickfix/CreateConstructorParameterFromFieldFix.java @@ -57,19 +57,21 @@ public class CreateConstructorParameterFromFieldFix implements IntentionAction { private final SmartPsiElementPointer myField; private final PsiClass myClass; + private int myConstructorsLength; public CreateConstructorParameterFromFieldFix(@NotNull PsiField field) { myClass = field.getContainingClass(); myField = SmartPointerManager.getInstance(field.getProject()).createSmartPsiElementPointer(field); if (myClass != null) { getFieldsToFix().add(myField); + myConstructorsLength = myClass.getConstructors().length; } } @Override @NotNull public String getText() { - if (getFieldsToFix().size() > 1 && myClass.getConstructors().length <= 1) return "Add constructor parameters"; + if (getFieldsToFix().size() > 1 && myConstructorsLength <= 1) return "Add constructor parameters"; return QuickFixBundle.message("add.constructor.parameter.name"); } @@ -81,7 +83,7 @@ public class CreateConstructorParameterFromFieldFix implements IntentionAction { @Override public boolean isAvailable(@NotNull Project project, Editor editor, PsiFile file) { - return isAvailable(getField()); + return (myClass == null || myClass.isValid()) && isAvailable(getField()); } private static boolean isAvailable(PsiField field) { From 9ebe7c76c99f9135324adf50a919fe3f8554c236 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 24 Sep 2015 16:17:48 +0300 Subject: [PATCH 13/23] unused library: bind parameter modifier lists with annotation classes (IDEA-145186) --- .../codeInspection/reference/RefJavaManagerImpl.java | 6 ++++++ .../codeInspection/reference/RefParameterImpl.java | 9 +++++++++ .../unusedLibrary/usedInParameterAnnotation/expected.xml | 3 +++ .../usedInParameterAnnotation/src/MyTest.java | 4 ++++ .../codeInspection/UnusedLibraryInspectionTest.java | 1 + 5 files changed, 23 insertions(+) create mode 100644 java/java-tests/testData/inspection/unusedLibrary/usedInParameterAnnotation/expected.xml create mode 100644 java/java-tests/testData/inspection/unusedLibrary/usedInParameterAnnotation/src/MyTest.java diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java index 8fe745ca59b6..f1a0f269f7bb 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefJavaManagerImpl.java @@ -493,6 +493,12 @@ public class RefJavaManagerImpl extends RefJavaManager { public void visitVariable(PsiVariable variable) { super.visitVariable(variable); myRefUtil.addTypeReference(variable, variable.getType(), myRefManager); + if (variable instanceof PsiParameter) { + final RefElement reference = myRefManager.getReference(variable); + if (reference instanceof RefParameterImpl) { + ((RefParameterImpl)reference).buildReferences(); + } + } } @Override diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefParameterImpl.java b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefParameterImpl.java index f33145fa070e..cef4ea166238 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefParameterImpl.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/reference/RefParameterImpl.java @@ -102,6 +102,15 @@ public class RefParameterImpl extends RefJavaElementImpl implements RefParameter return myIndex; } + @Override + public void buildReferences() { + final RefJavaUtil refUtil = RefJavaUtil.getInstance(); + final PsiParameter parameter = getElement(); + if (parameter != null) { + refUtil.addReferences(parameter, this, parameter.getModifierList()); + } + } + public void updateTemplateValue(PsiExpression expression) { if (myActualValueTemplate == null) return; diff --git a/java/java-tests/testData/inspection/unusedLibrary/usedInParameterAnnotation/expected.xml b/java/java-tests/testData/inspection/unusedLibrary/usedInParameterAnnotation/expected.xml new file mode 100644 index 000000000000..ec272abeaa3a --- /dev/null +++ b/java/java-tests/testData/inspection/unusedLibrary/usedInParameterAnnotation/expected.xml @@ -0,0 +1,3 @@ + + + diff --git a/java/java-tests/testData/inspection/unusedLibrary/usedInParameterAnnotation/src/MyTest.java b/java/java-tests/testData/inspection/unusedLibrary/usedInParameterAnnotation/src/MyTest.java new file mode 100644 index 000000000000..a82545d98af3 --- /dev/null +++ b/java/java-tests/testData/inspection/unusedLibrary/usedInParameterAnnotation/src/MyTest.java @@ -0,0 +1,4 @@ +import junit.framework.TestCase; +public class MyTest { + public static void main(@TestCase String[] args) {} +} diff --git a/java/java-tests/testSrc/com/intellij/codeInspection/UnusedLibraryInspectionTest.java b/java/java-tests/testSrc/com/intellij/codeInspection/UnusedLibraryInspectionTest.java index 7409e200e86a..a06593a2f9cd 100644 --- a/java/java-tests/testSrc/com/intellij/codeInspection/UnusedLibraryInspectionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInspection/UnusedLibraryInspectionTest.java @@ -65,4 +65,5 @@ public class UnusedLibraryInspectionTest extends InspectionTestCase { public void testSimple() throws Exception { doTest(); } public void testUsedJunit() throws Exception { doTest(); } public void testUsedJunitFromField() throws Exception { doTest(); } + public void testUsedInParameterAnnotation() throws Exception { doTest(); } } From e63ff426db4dda214e94a5b16464a4f644409515 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 24 Sep 2015 17:39:56 +0300 Subject: [PATCH 14/23] sm runner: ensure cached children switch performs for each suite change --- .../sm/runner/GeneralToSMTRunnerEventsConvertor.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/GeneralToSMTRunnerEventsConvertor.java b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/GeneralToSMTRunnerEventsConvertor.java index dac259da1dac..0b0bea6cac7c 100644 --- a/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/GeneralToSMTRunnerEventsConvertor.java +++ b/platform/smRunner/src/com/intellij/execution/testframework/sm/runner/GeneralToSMTRunnerEventsConvertor.java @@ -332,6 +332,7 @@ public class GeneralToSMTRunnerEventsConvertor extends GeneralTestEventsProcesso if (mySuite != null) { mySuite.setFinished(); myCurrentChildren.clear(); + myGetChildren = true; //fire events fireOnSuiteFinished(mySuite); @@ -520,6 +521,7 @@ public class GeneralToSMTRunnerEventsConvertor extends GeneralTestEventsProcesso // current suite shouldn't be null otherwise test runner isn't correct // or may be we are in debug mode logProblem("Current suite is undefined. Root suite will be used."); + myGetChildren = true; return myTestsRootNode; } From df9e5dd53328dde53509f1c1cfbb4cb3f8dec1ff Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 24 Sep 2015 18:54:42 +0300 Subject: [PATCH 15/23] isEnabledOnElement: reject vetoed elements --- .../intellij/refactoring/actions/RenameElementAction.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/lang-impl/src/com/intellij/refactoring/actions/RenameElementAction.java b/platform/lang-impl/src/com/intellij/refactoring/actions/RenameElementAction.java index 929d7090016c..efe8f3fb8f28 100644 --- a/platform/lang-impl/src/com/intellij/refactoring/actions/RenameElementAction.java +++ b/platform/lang-impl/src/com/intellij/refactoring/actions/RenameElementAction.java @@ -24,6 +24,7 @@ import com.intellij.psi.PsiFile; import com.intellij.psi.PsiNamedElement; import com.intellij.psi.SyntheticElement; import com.intellij.refactoring.RefactoringActionHandler; +import com.intellij.refactoring.rename.PsiElementRenameHandler; import com.intellij.refactoring.rename.RenameHandlerRegistry; import org.jetbrains.annotations.NotNull; @@ -43,7 +44,9 @@ public class RenameElementAction extends BaseRefactoringAction { if (elements.length != 1) return false; PsiElement element = elements[0]; - return element instanceof PsiNamedElement && !(element instanceof SyntheticElement); + return element instanceof PsiNamedElement && + !(element instanceof SyntheticElement) && + !PsiElementRenameHandler.isVetoed(element); } @Override From 7d92ec966ff63aad2a019608f4c106d025954f43 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 24 Sep 2015 19:20:59 +0300 Subject: [PATCH 16/23] new overload resolution: reject candidates with applicability level less than asked (IDEA-145505) --- .../tree/java/MethodReferenceResolver.java | 12 ++++++++-- ...CandidatesWithLowerApplicabilityLevel.java | 23 +++++++++++++++++++ .../daemon/lambda/OverloadResolutionTest.java | 4 ++++ 3 files changed, 37 insertions(+), 2 deletions(-) create mode 100644 java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/IgnoreCandidatesWithLowerApplicabilityLevel.java diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java index 5f29f99f08c4..01c10792b904 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/tree/java/MethodReferenceResolver.java @@ -272,11 +272,19 @@ public class MethodReferenceResolver implements ResolveCache.PolyVariantContextR private boolean resolveConflicts(List firstCandidates, List secondCandidates, int applicabilityLevel) { - checkApplicability(firstCandidates); + final int firstApplicability = checkApplicability(firstCandidates); checkSpecifics(firstCandidates, applicabilityLevel, myLanguageLevel); - checkApplicability(secondCandidates); + final int secondApplicability = checkApplicability(secondCandidates); checkSpecifics(secondCandidates, applicabilityLevel, myLanguageLevel); + + if (firstApplicability < secondApplicability) { + return secondCandidates.size() == 1; + } + + if (secondApplicability < firstApplicability) { + return firstCandidates.size() == 1; + } return firstCandidates.size() + secondCandidates.size() == 1; } diff --git a/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/IgnoreCandidatesWithLowerApplicabilityLevel.java b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/IgnoreCandidatesWithLowerApplicabilityLevel.java new file mode 100644 index 000000000000..0e95d4b327d7 --- /dev/null +++ b/java/java-tests/testData/codeInsight/daemonCodeAnalyzer/lambda/overloadResolution/IgnoreCandidatesWithLowerApplicabilityLevel.java @@ -0,0 +1,23 @@ +import java.util.function.BiConsumer; + +class MyTest { + + { + BiConsumer, T> builderTBiConsumer = Builder::add; + BiConsumer, T> builderTBiConsumer1 = Builder::add; + + System.out.println(builderTBiConsumer); + System.out.println(builderTBiConsumer1); + } + + public static class Builder { + + public Builder add(E element) { + return this; + } + + public Builder add(E... elements) { + return this; + } + } +} \ No newline at end of file diff --git a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java index 395830cf8117..7b11e93b5cba 100644 --- a/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java +++ b/java/java-tests/testSrc/com/intellij/codeInsight/daemon/lambda/OverloadResolutionTest.java @@ -146,6 +146,10 @@ public class OverloadResolutionTest extends LightDaemonAnalyzerTestCase { doTest(); } + public void testIgnoreCandidatesWithLowerApplicabilityLevel() throws Exception { + doTest(); + } + private void doTest() { doTest(true); } From e8162a75c63c3d78273e61665b95150573623948 Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Thu, 24 Sep 2015 19:50:12 +0300 Subject: [PATCH 17/23] remove separate testDiscoveryInstrumenter.jar --- build/scripts/libLicenses.gant | 1 - lib/required_for_dist.txt | 1 - lib/testDiscoveryInstrumenter.jar | Bin 23538 -> 0 bytes 3 files changed, 2 deletions(-) delete mode 100644 lib/testDiscoveryInstrumenter.jar diff --git a/build/scripts/libLicenses.gant b/build/scripts/libLicenses.gant index 7867afb48412..3007b785c02e 100644 --- a/build/scripts/libLicenses.gant +++ b/build/scripts/libLicenses.gant @@ -312,4 +312,3 @@ jetbrainsLibrary("Maven Embedder") jetbrainsLibrary("tcServiceMessages") jetbrainsLibrary("optimizedFileManager.jar") jetbrainsLibrary("KotlinJavaRuntime") -jetbrainsLibrary("testDiscoveryInstrumenter.jar") diff --git a/lib/required_for_dist.txt b/lib/required_for_dist.txt index 54da6b0d7355..9b124ae26c65 100644 --- a/lib/required_for_dist.txt +++ b/lib/required_for_dist.txt @@ -66,7 +66,6 @@ snappy-in-java-0.3.1.jar swingx-core-1.6.2.jar slf4j-api-1.7.10.jar slf4j-log4j12-1.7.10.jar -testDiscoveryInstrumenter.jar trove4j.jar velocity.jar winp-1.23.jar diff --git a/lib/testDiscoveryInstrumenter.jar b/lib/testDiscoveryInstrumenter.jar deleted file mode 100644 index 00e07bacc2eddbcabd6adc7e022e7b27216537fb..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 23538 zcmb@uV~}OhmMxsNQEA(@Ds9`g?aWG@v~AnAS!vt0Rmrbz^zH7~_lx(Uqoa51eSXco z&RP+Bj;S%Hf;1=?3=j|$5D*vKix|-VaX|xt0m+K02+~Q)i7|YQ0|6=gQxpn_^RFoG zOA}<|U-7EH58B`7KSX5(FgtvBDlRJNIfp{`zk6<^1C=Sd%sY7f$)84VUv@AUV5 z)-I!WHSK&Fp^b_96d57QK`lh{FJB6$%8Ol=O>;IzL1avD(b0gQx(Ub=*%QyB)Q8pa zLOJ*;piWc0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T017O3xX9Eg#<+23(WsbtM@_I9?} zXS)nmvUo!G3Tb7a))J%XjOO5VpXk~Mu;c5ZrbYyzYk}UJax{r%0)Mt*LVPemk-+WB zsQ!^)!B?tXs`L09kF$@`O*CfYMA@l=zX84%e=SH~YFTAzO41L@KN|a*CfPY3OfiBZfkTX7PNHU|OM(5uzloFy6K%pXx9DBsi}f8|6FJS1SkJFkC>G znDwr@9yD$=|Jd@K!v&l_trtP0SBLyJQc`RZwy^Pxw0){Z`K1gO z7U{Q5KQ;&3NOs1#d%Es^iE~z(_)|X_HWAxjbVjT_T_pc0@y}97Yz($V<_wc|dcygi zWB%DGgH6YFG@Q}vX#WrNpZ|8)jj3l4Zl+&^{H;wD`-@;#uAVWR`G1k|51H0K>R7R< z*i}_$RAtfs0`>PAD{Lxu&BYn@iR6EQ`g;WiHWmBe{ftT`^IxF; Date: Thu, 24 Sep 2015 18:26:57 +0200 Subject: [PATCH 18/23] use getLastCommittedDocument a bit --- .../codeInsight/daemon/impl/JavaLineMarkerProvider.java | 2 +- .../plugins/groovy/codeInsight/GroovyLineMarkerProvider.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java index 969d542a8d38..869a6d65d02f 100644 --- a/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java +++ b/java/java-impl/src/com/intellij/codeInsight/daemon/impl/JavaLineMarkerProvider.java @@ -95,7 +95,7 @@ public class JavaLineMarkerProvider implements LineMarkerProvider { } if (isMember && !(element1 instanceof PsiAnonymousClass || element1.getParent() instanceof PsiAnonymousClass)) { PsiFile file = element1.getContainingFile(); - Document document = file == null ? null : PsiDocumentManager.getInstance(file.getProject()).getDocument(file); + Document document = file == null ? null : PsiDocumentManager.getInstance(file.getProject()).getLastCommittedDocument(file); boolean drawSeparator = false; if (document != null) { diff --git a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyLineMarkerProvider.java b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyLineMarkerProvider.java index db2212dd4682..f5e1a04c79df 100644 --- a/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyLineMarkerProvider.java +++ b/plugins/groovy/src/org/jetbrains/plugins/groovy/codeInsight/GroovyLineMarkerProvider.java @@ -116,7 +116,7 @@ public class GroovyLineMarkerProvider implements LineMarkerProvider { } if (isMember && !(element1 instanceof PsiAnonymousClass || element1.getParent() instanceof PsiAnonymousClass)) { PsiFile file = element1.getContainingFile(); - Document document = file == null ? null : PsiDocumentManager.getInstance(file.getProject()).getDocument(file); + Document document = file == null ? null : PsiDocumentManager.getInstance(file.getProject()).getLastCommittedDocument(file); boolean drawSeparator = false; if (document != null) { CharSequence documentChars = document.getCharsSequence(); From 444c67265947bc454dedc376ea20fcfd1ead7e6e Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Thu, 24 Sep 2015 20:49:48 +0300 Subject: [PATCH 19/23] fix painting of hidden border in DarculaComboBoxUI --- .../com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java index 37ed4123f72b..fbcc47eb235f 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java @@ -378,7 +378,7 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border { g.setColor(getArrowButtonFillColor(getBorderColor())); final Shape clip = g.getClip(); final int offX = xxx + JBUI.scale(5); - g.setClip(offX, y, width - offX, height); + g.clipRect(offX, y, width - offX, height); g.drawRoundRect(JBUI.scale(1), JBUI.scale(1), width - JBUI.scale(2), height - JBUI.scale(2), R, R); g.setClip(clip); } From 98b0fd4b7e05d6824bc4d075cdeb8463015cd19e Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Thu, 24 Sep 2015 16:21:54 +0300 Subject: [PATCH 20/23] reasonable toString --- .../src/com/intellij/debugger/engine/JavaExecutionStack.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java index cb145df147dd..4f234ad2fbcc 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java @@ -217,4 +217,9 @@ public class JavaExecutionStack extends XExecutionStack { public int hashCode() { return myThreadProxy.hashCode(); } + + @Override + public String toString() { + return getDisplayName(); + } } From 190b8fa7728ef9af0e94246aae10095ce9908499 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Thu, 24 Sep 2015 20:52:16 +0300 Subject: [PATCH 21/23] IDEA-63378 Switching threads should be optional, not forced - correctly show stepping threads in running state --- .../debugger/engine/DebugProcessEvents.java | 1 + .../debugger/engine/JavaDebugProcess.java | 20 ++++++- .../debugger/engine/JavaExecutionStack.java | 5 +- .../debugger/engine/JavaStackFrame.java | 2 +- .../debugger/engine/SuspendContextImpl.java | 14 +++-- .../debugger/engine/SuspendManagerImpl.java | 9 +-- .../debugger/impl/DebuggerContextImpl.java | 1 - .../debugger/impl/DebuggerSession.java | 58 ++++++++++++------- .../debugger/impl/ReloadClassesWorker.java | 2 +- .../debugger/jdi/StackFrameProxyImpl.java | 1 + .../xdebugger/impl/XDebugSessionImpl.java | 4 ++ .../src/messages/DebuggerBundle.properties | 1 + 12 files changed, 76 insertions(+), 42 deletions(-) diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java index 701eec904a61..df4c905f42c2 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/DebugProcessEvents.java @@ -416,6 +416,7 @@ public class DebugProcessEvents extends DebugProcessImpl { final int nextStepDepth = hint.getNextStepDepth(suspendContext); if (nextStepDepth == RequestHint.RESUME) { getSession().resetIgnoreStepFiltersFlag(); + getSession().clearSteppingThrough(); shouldResume = true; } else if (nextStepDepth != RequestHint.STOP) { diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java index 9b9a571463e3..1b499e146afe 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaDebugProcess.java @@ -40,6 +40,7 @@ import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.project.Project; +import com.intellij.openapi.util.Comparing; import com.intellij.openapi.util.Disposer; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.VirtualFile; @@ -106,7 +107,7 @@ public class JavaDebugProcess extends XDebugProcess { || event == DebuggerSession.Event.REFRESH && myJavaSession.isPaused()) { final SuspendContextImpl newSuspendContext = newContext.getSuspendContext(); - if (newSuspendContext != null && newSuspendContext != getSession().getSuspendContext()) { + if (newSuspendContext != null && shouldApplyContext(newContext)) { process.getManagerThread().schedule(new SuspendContextCommandImpl(newSuspendContext) { @Override public void contextAction() throws Exception { @@ -119,10 +120,12 @@ public class JavaDebugProcess extends XDebugProcess { XBreakpoint xBreakpoint = breakpoint.getXBreakpoint(); if (xBreakpoint != null) { ((XDebugSessionImpl)getSession()).breakpointReachedNoProcessing(xBreakpoint, newSuspendContext); + unsetPausedIfNeeded(newContext); return; } } getSession().positionReached(newSuspendContext); + unsetPausedIfNeeded(newContext); } }); } @@ -181,6 +184,21 @@ public class JavaDebugProcess extends XDebugProcess { }); } + private void unsetPausedIfNeeded(DebuggerContextImpl context) { + SuspendContextImpl suspendContext = context.getSuspendContext(); + if (suspendContext != null && context.getThreadProxy() != suspendContext.getThread()) { + ((XDebugSessionImpl)getSession()).unsetPaused(); + } + } + + private boolean shouldApplyContext(DebuggerContextImpl context) { + SuspendContextImpl suspendContext = context.getSuspendContext(); + SuspendContextImpl currentContext = (SuspendContextImpl)getSession().getSuspendContext(); + if (suspendContext != null && !suspendContext.equals(currentContext)) return true; + JavaExecutionStack currentExecutionStack = currentContext != null ? currentContext.getActiveExecutionStack() : null; + return currentExecutionStack == null || !Comparing.equal(context.getThreadProxy(), currentExecutionStack.getThreadProxy()); + } + public void saveNodeHistory() { saveNodeHistory(getDebuggerStateManager().getContext().getFrameProxy()); } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java index 4f234ad2fbcc..b0d8d3e6539d 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaExecutionStack.java @@ -48,14 +48,11 @@ public class JavaExecutionStack extends XExecutionStack { super(calcRepresentation(threadProxy), calcIcon(threadProxy, current)); myThreadProxy = threadProxy; myDebugProcess = debugProcess; - if (current) { - initTopFrame(); - } } private static Icon calcIcon(ThreadReferenceProxyImpl threadProxy, boolean current) { if (current) { - return AllIcons.Debugger.ThreadCurrent; + return threadProxy.isSuspended() ? AllIcons.Debugger.ThreadCurrent : AllIcons.Debugger.ThreadRunning; } else if (threadProxy.isAtBreakpoint()) { return AllIcons.Debugger.ThreadAtBreakpoint; diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java index 3a8c2b6bac48..8d08444e9b86 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaStackFrame.java @@ -138,7 +138,7 @@ public class JavaStackFrame extends XStackFrame { xFrame.computeChildren(node); return; } - myDebugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(myDebugProcess.getDebuggerContext()) { + myDebugProcess.getManagerThread().schedule(new DebuggerContextCommandImpl(myDebugProcess.getDebuggerContext(), myDescriptor.getFrameProxy().threadProxy()) { @Override public Priority getPriority() { return Priority.NORMAL; diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendContextImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendContextImpl.java index 2a4dd9de6156..e0cacfe51ccd 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendContextImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendContextImpl.java @@ -26,7 +26,6 @@ import com.intellij.debugger.jdi.ThreadReferenceProxyImpl; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.Comparing; import com.intellij.util.containers.HashSet; -import com.intellij.xdebugger.frame.XExecutionStack; import com.intellij.xdebugger.frame.XSuspendContext; import com.sun.jdi.ObjectReference; import com.sun.jdi.ThreadReference; @@ -229,15 +228,18 @@ public abstract class SuspendContextImpl extends XSuspendContext implements Susp @Nullable @Override - public XExecutionStack getActiveExecutionStack() { + public JavaExecutionStack getActiveExecutionStack() { return myActiveExecutionStack; } - public void initExecutionStacks(ThreadReferenceProxyImpl newThread) { + public void initExecutionStacks(ThreadReferenceProxyImpl activeThread) { DebuggerManagerThreadImpl.assertIsManagerThread(); - myThread = newThread; - if (newThread != null) { - myActiveExecutionStack = new JavaExecutionStack(newThread, myDebugProcess, true); + if (myThread == null) { + myThread = activeThread; + } + if (activeThread != null) { + myActiveExecutionStack = new JavaExecutionStack(activeThread, myDebugProcess, myThread == activeThread); + myActiveExecutionStack.initTopFrame(); } } diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java index 2edc16ff6953..0fe1e45cc5dc 100644 --- a/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/engine/SuspendManagerImpl.java @@ -115,13 +115,6 @@ public class SuspendManagerImpl implements SuspendManager { return suspendContext; } - public SuspendContextImpl createDummyContext(@MagicConstant(flagsFromClass = EventRequest.class) int suspendPolicy) { - return new SuspendContextImpl(myDebugProcess, suspendPolicy, 0, null) { - @Override - protected void resumeImpl() {} - }; - } - @Override public SuspendContextImpl pushSuspendContext(final EventSet set) { SuspendContextImpl suspendContext = new SuspendContextImpl(myDebugProcess, set.suspendPolicy(), set.size(), set) { @@ -360,7 +353,7 @@ public class SuspendManagerImpl implements SuspendManager { processVote(suspendContext); } - LinkedList getPausedContexts() { + public List getPausedContexts() { return myPausedContexts; } } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextImpl.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextImpl.java index ad9e01e26409..336871008856 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerContextImpl.java @@ -151,7 +151,6 @@ public final class DebuggerContextImpl implements DebuggerContext { ThreadReferenceProxyImpl threadProxy, StackFrameProxyImpl frameProxy) { LOG.assertTrue(frameProxy == null || threadProxy == null || threadProxy == frameProxy.threadProxy()); - LOG.assertTrue(session == null || session.getProcess() != null); return new DebuggerContextImpl(session, session != null ? session.getProcess() : null, context, threadProxy, frameProxy, null, null, context == null); } diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java index 57f2bbc092a0..b33789a5bc6c 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/DebuggerSession.java @@ -111,7 +111,7 @@ public class DebuggerSession implements AbstractDebuggerSession { mySteppingThroughThread.set(threadProxy); } - void clearSteppingThrough() { + public void clearSteppingThrough() { mySteppingThroughThread.set(null); } @@ -469,6 +469,8 @@ public class DebuggerSession implements AbstractDebuggerSession { LOG.debug("paused"); } + ThreadReferenceProxyImpl currentThread = suspendContext.getThread(); + if (!shouldSetAsActiveContext(suspendContext)) { DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() { @Override @@ -476,7 +478,7 @@ public class DebuggerSession implements AbstractDebuggerSession { getContextManager().fireStateChanged(getContextManager().getContext(), Event.THREADS_REFRESH); } }); - final ThreadReferenceProxyImpl thread = suspendContext.getThread(); + ThreadReferenceProxyImpl thread = suspendContext.getThread(); if (thread != null) { List> descriptors = DebuggerUtilsEx.getEventDescriptors(suspendContext); if (!descriptors.isEmpty()) { @@ -492,7 +494,7 @@ public class DebuggerSession implements AbstractDebuggerSession { @Override public void contextAction() throws Exception { final DebuggerContextImpl debuggerContext = - DebuggerContextImpl.createDebuggerContext(DebuggerSession.this, suspendContext, thread, null); + DebuggerContextUtil.createDebuggerContext(DebuggerSession.this, suspendContext); DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() { @Override @@ -507,12 +509,17 @@ public class DebuggerSession implements AbstractDebuggerSession { }).notify(getProject()); } } - return; + if (((SuspendManagerImpl)myDebugProcess.getSuspendManager()).getPausedContexts().size() > 1) { + return; + } + else { + currentThread = mySteppingThroughThread.get(); + } + } + else { + setSteppingThrough(currentThread); } - setSteppingThrough(suspendContext.getThread()); - - ThreadReferenceProxyImpl currentThread = suspendContext.getThread(); final StackFrameContext positionContext; if (currentThread == null) { @@ -626,7 +633,7 @@ public class DebuggerSession implements AbstractDebuggerSession { DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() { @Override public void run() { - getContextManager().setState(debuggerContext, State.PAUSED, Event.PAUSE, null); + getContextManager().setState(debuggerContext, State.PAUSED, Event.PAUSE, getDescription(debuggerContext)); } }); } @@ -650,25 +657,28 @@ public class DebuggerSession implements AbstractDebuggerSession { @Override public void resumed(SuspendContextImpl suspendContext) { - SuspendManager suspendManager = getProcess().getSuspendManager(); - SuspendContextImpl context = suspendManager.getPausedContext(); + SuspendContextImpl context = getProcess().getSuspendManager().getPausedContext(); + ThreadReferenceProxyImpl steppingThread = null; // single thread stepping - if (suspendContext != null + if (context != null + && suspendContext != null && suspendContext.getSuspendPolicy() == EventRequest.SUSPEND_EVENT_THREAD && isSteppingThrough(suspendContext.getThread())) { - ThreadReferenceProxyImpl thread = suspendContext.getThread(); - if (context == null || !Comparing.equal(context.getThread(), thread)) { - context = ((SuspendManagerImpl)suspendManager).createDummyContext(suspendContext.getSuspendPolicy()); - context.setThread(thread.getThreadReference()); - } + steppingThread = suspendContext.getThread(); } - final SuspendContextImpl currentContext = context; + final DebuggerContextImpl debuggerContext = + context != null ? + DebuggerContextImpl.createDebuggerContext(DebuggerSession.this, + context, + steppingThread != null ? steppingThread : context.getThread(), + null) + : null; + DebuggerInvocationUtil.invokeLater(getProject(), new Runnable() { @Override public void run() { - if (currentContext != null) { - getContextManager().setState(DebuggerContextUtil.createDebuggerContext(DebuggerSession.this, currentContext), - State.PAUSED, Event.CONTEXT, null); + if (debuggerContext != null) { + getContextManager().setState(debuggerContext, State.PAUSED, Event.CONTEXT, getDescription(debuggerContext)); } else { getContextManager().setState(SESSION_EMPTY_CONTEXT, State.RUNNING, Event.CONTEXT, null); @@ -756,6 +766,14 @@ public class DebuggerSession implements AbstractDebuggerSession { } } + private static String getDescription(DebuggerContextImpl debuggerContext) { + SuspendContextImpl suspendContext = debuggerContext.getSuspendContext(); + if (suspendContext != null && debuggerContext.getThreadProxy() != suspendContext.getThread()) { + return DebuggerBundle.message("status.paused.in.another.thread"); + } + return null; + } + private class MyEvaluationListener implements EvaluationListener { @Override public void evaluationStarted(SuspendContextImpl context) { diff --git a/java/debugger/impl/src/com/intellij/debugger/impl/ReloadClassesWorker.java b/java/debugger/impl/src/com/intellij/debugger/impl/ReloadClassesWorker.java index 7b3f46e27c8e..6693150f03aa 100644 --- a/java/debugger/impl/src/com/intellij/debugger/impl/ReloadClassesWorker.java +++ b/java/debugger/impl/src/com/intellij/debugger/impl/ReloadClassesWorker.java @@ -176,7 +176,7 @@ class ReloadClassesWorker { SuspendContextImpl suspendContext = context.getSuspendContext(); if (suspendContext != null) { XExecutionStack stack = suspendContext.getActiveExecutionStack(); - if (stack instanceof JavaExecutionStack) { + if (stack != null) { ((JavaExecutionStack)stack).initTopFrame(); } } diff --git a/java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java b/java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java index 957ada3482a2..c75a41f1f613 100644 --- a/java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java +++ b/java/debugger/impl/src/com/intellij/debugger/jdi/StackFrameProxyImpl.java @@ -193,6 +193,7 @@ public class StackFrameProxyImpl extends JdiProxy implements StackFrameProxy { throw new EvaluateException(error.getMessage(), error); } + @NotNull @Override public ThreadReferenceProxyImpl threadProxy() { return myThreadProxy; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java index 91c788c742c8..40359b2a6dd4 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java @@ -814,6 +814,10 @@ public class XDebugSessionImpl implements XDebugSession { }); } + public void unsetPaused() { + myPaused.set(false); + } + @Override public void positionReached(@NotNull final XSuspendContext suspendContext) { enableBreakpoints(); diff --git a/resources-en/src/messages/DebuggerBundle.properties b/resources-en/src/messages/DebuggerBundle.properties index 8c24513cc9d7..3eb9637f6ca6 100644 --- a/resources-en/src/messages/DebuggerBundle.properties +++ b/resources-en/src/messages/DebuggerBundle.properties @@ -91,6 +91,7 @@ status.step.into=Stepping into status.step.over=Stepping over status.run.to.cursor=Run to cursor status.process.resumed=Process resumed +status.paused.in.another.thread=Paused in another thread error.pop.bottom.stackframe=Cannot pop bottom frame error.pop.stackframe=An error occurred while popping stack frame: {0} error.class.not.loaded=Class not loaded : {0} From 3bc7199097aae6b2e5317ecab04958fc7de9865a Mon Sep 17 00:00:00 2001 From: "Gregory.Shrago" Date: Thu, 24 Sep 2015 21:13:38 +0300 Subject: [PATCH 22/23] FileReferenceSet: support different separators & escaping. last touch amends --- .../resolve/reference/impl/providers/FileReferenceSet.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java b/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java index 29e0cf6c39e6..5d8cc29ae831 100644 --- a/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java +++ b/platform/analysis-impl/src/com/intellij/psi/impl/source/resolve/reference/impl/providers/FileReferenceSet.java @@ -266,7 +266,7 @@ public class FileReferenceSet { if (curSep >= 0 && decoded.length() == wsHead + sepLen + wsTail) { // add extra reference for the only & leading "/" TextRange r = TextRange.create(startInElement, offset(curSep + Math.max(0, sepLen - 1), escaper, valueRange) + 1); - referencesList.add(createFileReference(r, 0, decoded.subSequence(curSep, curSep + sepLen).toString())); + referencesList.add(createFileReference(r, index ++, decoded.subSequence(curSep, curSep + sepLen).toString())); } curSep = curSep == wsHead ? curSep + sepLen : wsHead; // reset offsets & start again for simplicity sepLen = 0; From 2dcecc7f810a91dc19df462df08a3a8d16021605 Mon Sep 17 00:00:00 2001 From: Sergey Malenkov Date: Thu, 24 Sep 2015 21:16:35 +0300 Subject: [PATCH 23/23] fix painting of hidden border in DarculaComboBoxUI (focused state) --- .../ide/ui/laf/darcula/ui/DarculaComboBoxUI.java | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java index fbcc47eb235f..cebbc42aa245 100644 --- a/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java +++ b/platform/platform-impl/src/com/intellij/ide/ui/laf/darcula/ui/DarculaComboBoxUI.java @@ -329,18 +329,18 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border { hasFocus = false; checkFocus(); - final Graphics2D g = (Graphics2D)g2; + final Graphics2D g = (Graphics2D)g2.create(); final Rectangle arrowButtonBounds = arrowButton.getBounds(); final int xxx = arrowButtonBounds.x - JBUI.scale(5); final int H = height - JBUI.scale(2); final int W = width - JBUI.scale(2); - final GraphicsConfig config = new GraphicsConfig(g); + final Shape clip = g.getClip(); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_STROKE_CONTROL, RenderingHints.VALUE_STROKE_NORMALIZE); final int R = JBUI.scale(5); if (hasFocus) { - g.setClip(JBUI.scale(2), JBUI.scale(2), comboBox.getWidth()- JBUI.scale(4), comboBox.getHeight() - JBUI.scale(4)); + g.clipRect(JBUI.scale(2), JBUI.scale(2), comboBox.getWidth()- JBUI.scale(4), comboBox.getHeight() - JBUI.scale(4)); } if (editor != null && comboBox.isEditable()) { ((JComponent)editor).setBorder(null); @@ -368,7 +368,7 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border { paintCurrentValue(g, r, false); if (hasFocus) { - g.setClip(0, 0, comboBox.getWidth(), comboBox.getHeight()); + g.setClip(clip); DarculaUIUtil.paintFocusRing(g, JBUI.scale(2), JBUI.scale(2), width - JBUI.scale(4), height - JBUI.scale(4)); } else { @@ -376,14 +376,12 @@ public class DarculaComboBoxUI extends BasicComboBoxUI implements Border { g.drawRoundRect(JBUI.scale(1), JBUI.scale(1), width - JBUI.scale(2), height - JBUI.scale(2), R, R); if (!UIUtil.isUnderDarcula() && comboBox.isEnabled()) { g.setColor(getArrowButtonFillColor(getBorderColor())); - final Shape clip = g.getClip(); final int offX = xxx + JBUI.scale(5); g.clipRect(offX, y, width - offX, height); g.drawRoundRect(JBUI.scale(1), JBUI.scale(1), width - JBUI.scale(2), height - JBUI.scale(2), R, R); - g.setClip(clip); } } - config.restore(); + g.dispose(); } private void checkFocus() {