From 799d362c8b1a60db4eaa007503b0aaf692d8fdfd Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Tue, 14 Oct 2014 13:33:02 +0400 Subject: [PATCH 01/64] IDEA-130912 Use different keys (also different from keys used by SVNKit) for caching password/passphrase for svn+ssh repositories for command line (not to use incorrect data from cache or possibly get ClassCastException as objects of different types could be cached with the same key) --- .../src/org/jetbrains/idea/svn/auth/AuthenticationService.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java index cadd6088eb76..7e7b33ccfd15 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java @@ -153,7 +153,7 @@ public class AuthenticationService { public String requestSshCredentials(@NotNull final String realm, @NotNull final SimpleCredentialsDialog.Mode mode, @NotNull final String key) { - return requestCredentials(realm, ISVNAuthenticationManager.SSH, new Getter() { + return requestCredentials(realm, StringUtil.toLowerCase(mode.toString()), new Getter() { @Override public String get() { final Ref answer = new Ref(); From 8b3bcbcdafaecdedf2d7f2391b29d19dd4ae9af8 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Tue, 14 Oct 2014 13:51:55 +0400 Subject: [PATCH 02/64] svn: Use different keys (also different from keys used by SVNKit) for caching server certificate acceptance result (for https repositories) for usual command line and "run under terminal" command line modes (not to get ClassCastException as objects of different types could be cached with the same key) --- .../src/org/jetbrains/idea/svn/auth/AuthenticationService.java | 2 +- .../org/jetbrains/idea/svn/auth/CertificateTrustManager.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java index 7e7b33ccfd15..f35cefb83efd 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/AuthenticationService.java @@ -184,7 +184,7 @@ public class AuthenticationService { @NotNull public AcceptResult acceptCertificate(@NotNull final SVNURL url, @NotNull final String certificateInfo) { // TODO: Probably explicitly construct server url for realm here - like in CertificateTrustManager. - String kind = "svn.ssl.server"; + String kind = "terminal.ssl.server"; String realm = url.toDecodedString(); Object data = SvnConfiguration.RUNTIME_AUTH_CACHE.getDataWithLowerCheck(kind, realm); AcceptResult result; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/CertificateTrustManager.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/CertificateTrustManager.java index c5bd5a54182b..07aed1461c91 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/CertificateTrustManager.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/auth/CertificateTrustManager.java @@ -113,7 +113,7 @@ public class CertificateTrustManager extends ClientOnlyTrustManager { } private void acknowledge(@NotNull X509Certificate certificate) throws CertificateEncodingException { - myAuthenticationService.getVcs().getSvnConfiguration().acknowledge("svn.ssl.server", myRealm, certificate); + myAuthenticationService.getVcs().getSvnConfiguration().acknowledge("cmd.ssl.server", myRealm, certificate); } @Override From 7fbd9c3ff342a950dfa9a96347b3bec570fb5451 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Tue, 14 Oct 2014 14:44:48 +0400 Subject: [PATCH 03/64] svn: Refactored authentication prompts handling in "run under terminal" mode - always rely that repository url of processed command is not null (as it should be correctly set in CommandParametersResolutionModule) --- .../idea/svn/commandLine/BaseTerminalModule.java | 2 +- .../src/org/jetbrains/idea/svn/commandLine/Command.java | 8 ++++++++ .../idea/svn/commandLine/TerminalSshModule.java | 9 ++------- .../svn/commandLine/TerminalUserNamePasswordModule.java | 3 +-- 4 files changed, 12 insertions(+), 10 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseTerminalModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseTerminalModule.java index d4b9475ee5d5..95a0e7474f78 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseTerminalModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/BaseTerminalModule.java @@ -80,6 +80,6 @@ public abstract class BaseTerminalModule extends LineCommandAdapter implements C } protected void cancelAuthentication() { - myExecutor.destroyProcess("Authentication canceled for repository: " + myExecutor.getCommand().getRepositoryUrl()); + myExecutor.destroyProcess("Authentication canceled for repository: " + myExecutor.getCommand().requireRepositoryUrl()); } } diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java index 50215fba76c8..a20e2db48495 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/Command.java @@ -79,6 +79,14 @@ public class Command { return myRepositoryUrl; } + @NotNull + public SVNURL requireRepositoryUrl() { + SVNURL result = getRepositoryUrl(); + assert result != null; + + return result; + } + @NotNull public SvnTarget getTarget() { return myTarget; diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSshModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSshModule.java index 1ebd86485033..740954cf31ca 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSshModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalSshModule.java @@ -112,13 +112,8 @@ public class TerminalSshModule extends BaseTerminalModule { } private boolean handleAuthPrompt(@NotNull final SimpleCredentialsDialog.Mode mode, @NotNull final String key) { - final SVNURL repositoryUrl = myExecutor.getCommand().getRepositoryUrl(); - - // TODO: repositoryUrl could be null for some cases, for instance for info command for file is invoked that requires - // TODO: authentication (like "svn info -r HEAD"), if it is invoked before all working copy roots are resolved. - // TODO: resolving repositoryUrl logic should be updated so that repositoryUrl is not null here. - String auth = - myRuntime.getAuthenticationService().requestSshCredentials(repositoryUrl != null ? repositoryUrl.toDecodedString() : "", mode, key); + SVNURL repositoryUrl = myExecutor.getCommand().requireRepositoryUrl(); + String auth = myRuntime.getAuthenticationService().requestSshCredentials(repositoryUrl.toDecodedString(), mode, key); if (!StringUtil.isEmpty(auth)) { sendData(auth); diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalUserNamePasswordModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalUserNamePasswordModule.java index dbb1d211a8b4..489222ab8190 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalUserNamePasswordModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/TerminalUserNamePasswordModule.java @@ -79,8 +79,7 @@ public class TerminalUserNamePasswordModule extends BaseTerminalModule { * (before any user name prompt) for pre-configured/system user name. */ private boolean handleAuthPrompt(boolean isUserName) { - // TODO: check command is not local and get @NotNull url - also make same for for ssh module - SVNURL repositoryUrl = myExecutor.getCommand().getRepositoryUrl(); + SVNURL repositoryUrl = myExecutor.getCommand().requireRepositoryUrl(); if (needAskAuthentication(isUserName)) { // TODO: Probably pass real realm to dialog From 6aacc9695b87ed79da906657dbba59a62a750582 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Tue, 14 Oct 2014 15:30:29 +0400 Subject: [PATCH 04/64] svn: Refactored IDEA proxy settings handling for command line integration - only pass proxy settings to svn command line client if currently executing command is non-local (requires repository access) --- .../idea/svn/commandLine/ProxyModule.java | 30 +++++++------------ 1 file changed, 10 insertions(+), 20 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyModule.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyModule.java index bdfdd55ed6e1..b9e83e7bf850 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyModule.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/ProxyModule.java @@ -15,7 +15,6 @@ */ package org.jetbrains.idea.svn.commandLine; -import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.util.text.StringUtil; import org.jetbrains.annotations.NotNull; import org.jetbrains.idea.svn.IdeaSVNConfigFile; @@ -31,38 +30,29 @@ import java.net.Proxy; */ public class ProxyModule extends BaseCommandRuntimeModule { - private static final Logger LOG = Logger.getInstance(ProxyModule.class); - public ProxyModule(@NotNull CommandRuntime runtime) { super(runtime); } @Override public void onStart(@NotNull Command command) throws SvnBindException { - if (myAuthenticationService.haveDataForTmpConfig()) { + if (myAuthenticationService.haveDataForTmpConfig() && !CommandRuntime.isLocal(command)) { setupProxy(command); } } private void setupProxy(@NotNull Command command) { - // TODO: We assume that if repository url is null - command is local and do not require repository access - // TODO: Check if this is correct for all cases - SVNURL repositoryUrl = command.getRepositoryUrl(); + SVNURL repositoryUrl = command.requireRepositoryUrl(); + Proxy proxy = AuthenticationService.getIdeaDefinedProxy(repositoryUrl); - if (repositoryUrl != null) { - Proxy proxy = AuthenticationService.getIdeaDefinedProxy(repositoryUrl); + if (proxy != null) { + String hostGroup = ensureGroupForHost(command, repositoryUrl.getHost()); + InetSocketAddress address = (InetSocketAddress)proxy.address(); - if (proxy != null) { - String hostGroup = ensureGroupForHost(command, repositoryUrl.getHost()); - InetSocketAddress address = (InetSocketAddress)proxy.address(); - - command.put("--config-option"); - command.put(String.format("servers:%s:http-proxy-host=%s", hostGroup, address.getHostName())); - command.put("--config-option"); - command.put(String.format("servers:%s:http-proxy-port=%s", hostGroup, address.getPort())); - } - } else { - LOG.info("Configured proxy should be used, but repository url is null for command - " + command.getText()); + command.put("--config-option"); + command.put(String.format("servers:%s:http-proxy-host=%s", hostGroup, address.getHostName())); + command.put("--config-option"); + command.put(String.format("servers:%s:http-proxy-port=%s", hostGroup, address.getPort())); } } From b4686b24827596220c51161ff9a8bd4dd78aeca2 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Tue, 14 Oct 2014 16:46:09 +0400 Subject: [PATCH 05/64] svn: Implemented IDEA proxy settings support for command line integration in "run under terminal" mode --- .../idea/svn/commandLine/CommandRuntime.java | 22 ++++++++++++++----- 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java index caeb1c26cc67..e3fce7f14253 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/commandLine/CommandRuntime.java @@ -126,7 +126,7 @@ public class CommandRuntime { private boolean handleErrorText(CommandExecutor executor, Command command) throws SvnBindException { final String errText = executor.getErrorOutput().trim(); - final AuthCallbackCase callback = executor instanceof TerminalExecutor ? null : createCallback(errText, command.getRepositoryUrl()); + final AuthCallbackCase callback = createCallback(errText, command.getRepositoryUrl(), executor instanceof TerminalExecutor); // do not handle possible authentication errors if command was manually cancelled // force checking if command is cancelled and not just use corresponding value from executor - as there could be cases when command // finishes quickly but with some auth error - this way checkCancelled() is not called by executor itself and so command is repeated @@ -166,13 +166,23 @@ public class CommandRuntime { } @Nullable - private AuthCallbackCase createCallback(@NotNull final String errText, @Nullable final SVNURL url) { + private AuthCallbackCase createCallback(@NotNull final String errText, @Nullable final SVNURL url, boolean isUnderTerminal) { List authCases = ContainerUtil.newArrayList(); - authCases.add(new CertificateCallbackCase(myAuthenticationService, url)); - authCases.add(new ProxyCallback(myAuthenticationService, url)); - authCases.add(new TwoWaySslCallback(myAuthenticationService, url)); - authCases.add(new UsernamePasswordCallback(myAuthenticationService, url)); + if (isUnderTerminal) { + // Subversion client does not prompt for proxy credentials (just fails with error) even in terminal mode. So we handle this case the + // same way as in non-terminal mode - repeat command with new credentials. + // NOTE: We could also try getting proxy credentials from user in advance (by issuing separate request and asking for credentials if + // NOTE: required) - not to execute same command several times like it is currently for all other cases in terminal mode. But such + // NOTE: behaviour is not mandatory for now - so we just use "repeat command" logic. + authCases.add(new ProxyCallback(myAuthenticationService, url)); + } + else { + authCases.add(new CertificateCallbackCase(myAuthenticationService, url)); + authCases.add(new ProxyCallback(myAuthenticationService, url)); + authCases.add(new TwoWaySslCallback(myAuthenticationService, url)); + authCases.add(new UsernamePasswordCallback(myAuthenticationService, url)); + } return ContainerUtil.find(authCases, new Condition() { @Override From 43a99912e162f16598e04645256c7a7bdd85daf4 Mon Sep 17 00:00:00 2001 From: Konstantin Kolosovsky Date: Wed, 15 Oct 2014 17:48:50 +0400 Subject: [PATCH 06/64] svn: Updated settings - renamed "Run under terminal" checkbox to "Interactive mode", added description of "Interactive mode" --- .../jetbrains/idea/svn/SvnBundle.properties | 4 ++++ .../jetbrains/idea/svn/SvnConfigurable.form | 22 +++++++++++++------ 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties index 12364be04841..e6f36b2b2fb7 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnBundle.properties @@ -201,6 +201,10 @@ dialog.edit.http.proxies.settings.test.connection.succes.title=Connection test s confirmation.text.delete.stored.authentication.information=You are about to delete all stored Subversion authentication information.\nWould you like to proceed with deletion? confirmation.title.clear.authentication.cache=Clear Authentication Cache +command.line.interactive.mode.title=Interactive mode +command.line.interactive.mode.description=Emulates behaviour as if Subversion commands were executed directly from terminal (in interactive mode).
\ + Primarily intended to be used for handling password/passphrase prompts for svn+ssh repositories and trusting invalid server certificates for https repositories. + ssh.settings.title=SSH Settings ssh.settings.executable.label=SSH executable\: ssh.settings.browse.executable.dialog.title=SSH executable diff --git a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form index f1e61767844b..822ca320c43b 100644 --- a/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form +++ b/plugins/svn4idea/src/org/jetbrains/idea/svn/SvnConfigurable.form @@ -18,7 +18,7 @@ - + @@ -29,7 +29,7 @@ - + @@ -87,7 +87,7 @@ - + @@ -96,7 +96,7 @@ - + @@ -123,12 +123,12 @@ - + - + @@ -162,7 +162,15 @@ - + + + + + + + + + From 48b0cd807bd866de1cbfbc2d065b0bfd6cd555fc Mon Sep 17 00:00:00 2001 From: Bas Leijdekkers Date: Fri, 17 Oct 2014 10:05:29 +0200 Subject: [PATCH 07/64] IDEA-131187 (Expression could use clarifying parenthesis) --- .../UnclearBinaryExpressionInspection.java | 5 ++- .../SimpleAssignment.after.java | 10 ++++++ .../SimpleAssignment.java | 10 ++++++ .../style/UnclearBinaryExpressionFixTest.java | 36 +++++++++++++++++++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 plugins/InspectionGadgets/test/com/siyeh/igfixes/style/unclear_binary_expression/SimpleAssignment.after.java create mode 100644 plugins/InspectionGadgets/test/com/siyeh/igfixes/style/unclear_binary_expression/SimpleAssignment.java create mode 100644 plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/UnclearBinaryExpressionFixTest.java diff --git a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnclearBinaryExpressionInspection.java b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnclearBinaryExpressionInspection.java index 92fbe8c0d6d0..0d2b13db4d16 100644 --- a/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnclearBinaryExpressionInspection.java +++ b/plugins/InspectionGadgets/InspectionGadgetsAnalysis/src/com/siyeh/ig/style/UnclearBinaryExpressionInspection.java @@ -207,7 +207,10 @@ public class UnclearBinaryExpressionInspection extends BaseInspection { private static boolean isSimpleAssignment(PsiAssignmentExpression assignmentExpression, PsiElement parent) { final IElementType parentTokenType; - if (parent instanceof PsiAssignmentExpression) { + if (parent instanceof PsiExpressionStatement) { + return true; + } + else if (parent instanceof PsiAssignmentExpression) { final PsiAssignmentExpression parentAssignmentExpression = (PsiAssignmentExpression)parent; parentTokenType = parentAssignmentExpression.getOperationTokenType(); } diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/style/unclear_binary_expression/SimpleAssignment.after.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/style/unclear_binary_expression/SimpleAssignment.after.java new file mode 100644 index 000000000000..247b0942ab14 --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/style/unclear_binary_expression/SimpleAssignment.after.java @@ -0,0 +1,10 @@ +class SimpleAssignment { + + public void baz() { + int a = 2; + int b = 3; + int c = 4; + int d; + d = (a / b) * c; + } +} diff --git a/plugins/InspectionGadgets/test/com/siyeh/igfixes/style/unclear_binary_expression/SimpleAssignment.java b/plugins/InspectionGadgets/test/com/siyeh/igfixes/style/unclear_binary_expression/SimpleAssignment.java new file mode 100644 index 000000000000..c64c0c0079f8 --- /dev/null +++ b/plugins/InspectionGadgets/test/com/siyeh/igfixes/style/unclear_binary_expression/SimpleAssignment.java @@ -0,0 +1,10 @@ +class SimpleAssignment { + + public void baz() { + int a = 2; + int b = 3; + int c = 4; + int d; + d = a / b * c; + } +} diff --git a/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/UnclearBinaryExpressionFixTest.java b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/UnclearBinaryExpressionFixTest.java new file mode 100644 index 000000000000..bb2e5a9422f3 --- /dev/null +++ b/plugins/InspectionGadgets/testsrc/com/siyeh/ig/fixes/style/UnclearBinaryExpressionFixTest.java @@ -0,0 +1,36 @@ +/* + * Copyright 2000-2014 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.siyeh.ig.fixes.style; + +import com.siyeh.InspectionGadgetsBundle; +import com.siyeh.ig.IGQuickFixesTestCase; +import com.siyeh.ig.style.UnclearBinaryExpressionInspection; + +/** + * @author Bas Leijdekkers + */ +public class UnclearBinaryExpressionFixTest extends IGQuickFixesTestCase { + + @Override + protected void setUp() throws Exception { + super.setUp(); + myFixture.enableInspections(new UnclearBinaryExpressionInspection()); + myRelativePath = "style/unclear_binary_expression"; + myDefaultHint = InspectionGadgetsBundle.message("unclear.binary.expression.quickfix"); + } + + public void testSimpleAssignment() { doTest(); } +} From 8f9360d237c0d3e939d5e42e16856590617d68c2 Mon Sep 17 00:00:00 2001 From: "Egor.Ushakov" Date: Fri, 17 Oct 2014 12:21:03 +0400 Subject: [PATCH 08/64] IDEA-125136 variables/watches are not updated when changes come from different view --- .../xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java | 4 ++++ .../xdebugger/impl/ui/tree/SetValueInplaceEditor.java | 3 +++ .../impl/ui/tree/nodes/EvaluatingExpressionRootNode.java | 2 ++ 3 files changed, 9 insertions(+) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java index 1bd7e09b20c5..5c8e829b7be0 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/evaluate/XDebuggerEvaluationDialog.java @@ -323,6 +323,10 @@ public class XDebuggerEvaluationDialog extends DialogWrapper { } } + public void evaluationDone() { + mySession.rebuildViews(); + } + @Override public JComponent getPreferredFocusedComponent() { return getInputEditor().getPreferredFocusedComponent(); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/SetValueInplaceEditor.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/SetValueInplaceEditor.java index fb052a410e08..c0a13c07fd54 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/SetValueInplaceEditor.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/SetValueInplaceEditor.java @@ -22,6 +22,7 @@ import com.intellij.ui.AppUIUtil; import com.intellij.ui.SimpleColoredComponent; import com.intellij.xdebugger.frame.XValueModifier; import com.intellij.xdebugger.frame.presentation.XValuePresentation; +import com.intellij.xdebugger.impl.XDebuggerUtilImpl; import com.intellij.xdebugger.impl.breakpoints.XExpressionImpl; import com.intellij.xdebugger.impl.ui.XDebuggerUIConstants; import com.intellij.xdebugger.impl.ui.tree.nodes.XValueNodeImpl; @@ -82,6 +83,7 @@ public class SetValueInplaceEditor extends XDebuggerTreeInplaceEditor { myTree.rebuildAndRestore(treeState); } }); + XDebuggerUtilImpl.rebuildAllSessionsViews(getProject()); } @Override @@ -100,6 +102,7 @@ public class SetValueInplaceEditor extends XDebuggerTreeInplaceEditor { } } }); + XDebuggerUtilImpl.rebuildAllSessionsViews(getProject()); } }); super.doOKAction(); diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/EvaluatingExpressionRootNode.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/EvaluatingExpressionRootNode.java index 381bef8be9a4..2482717d7017 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/EvaluatingExpressionRootNode.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/nodes/EvaluatingExpressionRootNode.java @@ -53,11 +53,13 @@ public class EvaluatingExpressionRootNode extends XValueContainerNode Date: Fri, 17 Oct 2014 12:36:31 +0400 Subject: [PATCH 09/64] EA-61766 - NPE: XDebuggerInstanceTreeCreator$InstanceEvaluatorTreeRootValue.computeChildren --- .../impl/ui/tree/XInspectDialog.java | 2 +- .../actions/ShowReferringObjectsAction.java | 21 +++++++++++-------- .../impl/ui/tree/actions/XInspectAction.java | 11 ++++++---- 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java index b6269228a393..5de988cf3497 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/XInspectDialog.java @@ -49,7 +49,7 @@ public class XInspectDialog extends DialogWrapper { @NotNull String name, @NotNull XValue value, XValueMarkers markers, - XDebugSession session, + @NotNull XDebugSession session, boolean rebuildOnSessionEvents) { super(project, false); myRebuildOnSessionEvents = rebuildOnSessionEvents; diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/ShowReferringObjectsAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/ShowReferringObjectsAction.java index 4884748d5ba7..648a018eb6d4 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/ShowReferringObjectsAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/ShowReferringObjectsAction.java @@ -18,6 +18,7 @@ package com.intellij.xdebugger.impl.ui.tree.actions; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.xdebugger.XDebugSession; import com.intellij.xdebugger.XDebuggerBundle; +import com.intellij.xdebugger.XDebuggerManager; import com.intellij.xdebugger.frame.XReferrersProvider; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree; import com.intellij.xdebugger.impl.ui.tree.XInspectDialog; @@ -39,15 +40,17 @@ public class ShowReferringObjectsAction extends XDebuggerTreeActionBase { XReferrersProvider referrersProvider = node.getValueContainer().getReferrersProvider(); if (referrersProvider != null) { XDebuggerTree tree = node.getTree(); - XDebugSession session = e.getData(XDebugSession.DATA_KEY); - XInspectDialog dialog = new XInspectDialog(tree.getProject(), - tree.getEditorsProvider(), - tree.getSourcePosition(), - nodeName, - referrersProvider.getReferringObjectsValue(), - tree.getValueMarkers(), session, false); - dialog.setTitle(XDebuggerBundle.message("showReferring.dialog.title", nodeName)); - dialog.show(); + XDebugSession session = XDebuggerManager.getInstance(tree.getProject()).getCurrentSession(); + if (session != null) { + XInspectDialog dialog = new XInspectDialog(tree.getProject(), + tree.getEditorsProvider(), + tree.getSourcePosition(), + nodeName, + referrersProvider.getReferringObjectsValue(), + tree.getValueMarkers(), session, false); + dialog.setTitle(XDebuggerBundle.message("showReferring.dialog.title", nodeName)); + dialog.show(); + } } } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XInspectAction.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XInspectAction.java index 0b04da39d1a1..eb82e5e4a75f 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XInspectAction.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/tree/actions/XInspectAction.java @@ -17,6 +17,7 @@ package com.intellij.xdebugger.impl.ui.tree.actions; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.xdebugger.XDebugSession; +import com.intellij.xdebugger.XDebuggerManager; import com.intellij.xdebugger.frame.XValue; import com.intellij.xdebugger.impl.ui.tree.XDebuggerTree; import com.intellij.xdebugger.impl.ui.tree.XInspectDialog; @@ -29,11 +30,13 @@ import org.jetbrains.annotations.NotNull; public class XInspectAction extends XDebuggerTreeActionBase { @Override protected void perform(XValueNodeImpl node, @NotNull final String nodeName, AnActionEvent e) { - XDebugSession session = e.getData(XDebugSession.DATA_KEY); XDebuggerTree tree = node.getTree(); XValue value = node.getValueContainer(); - XInspectDialog dialog = new XInspectDialog(tree.getProject(), tree.getEditorsProvider(), tree.getSourcePosition(), nodeName, value, - tree.getValueMarkers(), session, true); - dialog.show(); + XDebugSession session = XDebuggerManager.getInstance(tree.getProject()).getCurrentSession(); + if (session != null) { + XInspectDialog dialog = new XInspectDialog(tree.getProject(), tree.getEditorsProvider(), tree.getSourcePosition(), nodeName, value, + tree.getValueMarkers(), session, true); + dialog.show(); + } } } From 291e01871a4d758ffb0f9280ac6c8e1a0d53f7a1 Mon Sep 17 00:00:00 2001 From: Dmitry Avdeev Date: Fri, 17 Oct 2014 13:14:34 +0400 Subject: [PATCH 10/64] optimization --- .../impl/include/FileIncludeManagerImpl.java | 21 ++++++++----------- 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeManagerImpl.java index 72a93cfac537..a79e85e91f4d 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/include/FileIncludeManagerImpl.java @@ -19,7 +19,6 @@ package com.intellij.psi.impl.include; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.fileTypes.FileTypes; import com.intellij.openapi.project.Project; -import com.intellij.openapi.util.Condition; import com.intellij.openapi.util.Key; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vfs.VfsUtilCore; @@ -33,7 +32,10 @@ import com.intellij.psi.PsiManager; import com.intellij.psi.impl.source.PsiFileImpl; import com.intellij.psi.impl.source.resolve.reference.impl.providers.FileReferenceSet; import com.intellij.psi.search.GlobalSearchScope; -import com.intellij.psi.util.*; +import com.intellij.psi.util.CachedValueProvider; +import com.intellij.psi.util.CachedValuesManager; +import com.intellij.psi.util.ParameterizedCachedValue; +import com.intellij.psi.util.ParameterizedCachedValueProvider; import com.intellij.util.Processor; import com.intellij.util.containers.ContainerUtil; import com.intellij.util.containers.HashMap; @@ -74,6 +76,7 @@ public class FileIncludeManagerImpl extends FileIncludeManager { return VfsUtilCore.toVirtualFileArray(files); } }; + private final Map myProviderMap; public void processIncludes(PsiFile file, Processor processor) { GlobalSearchScope scope = GlobalSearchScope.allScope(myProject); @@ -127,9 +130,9 @@ public class FileIncludeManagerImpl extends FileIncludeManager { myPsiFileFactory = psiFileFactory; FileIncludeProvider[] providers = Extensions.getExtensions(FileIncludeProvider.EP_NAME); - Map providerMap = new HashMap(providers.length); + myProviderMap = new HashMap(providers.length); for (FileIncludeProvider provider : providers) { - FileIncludeProvider old = providerMap.put(provider.getId(), provider); + FileIncludeProvider old = myProviderMap.put(provider.getId(), provider); assert old == null; } myCachedValuesManager = cachedValuesManager; @@ -163,14 +166,8 @@ public class FileIncludeManagerImpl extends FileIncludeManager { @Nullable private PsiFileSystemItem doResolve(@NotNull final FileIncludeInfo info, @NotNull final PsiFile context) { if (info instanceof FileIncludeInfoImpl) { - final FileIncludeProvider provider = - ContainerUtil.find(FileIncludeProvider.EP_NAME.getExtensions(), new Condition() { - @Override - public boolean value(final FileIncludeProvider provider) { - return provider.getId().equals(((FileIncludeInfoImpl)info).providerId); - } - }); - + String id = ((FileIncludeInfoImpl)info).providerId; + FileIncludeProvider provider = id == null ? null : myProviderMap.get(id); final PsiFileSystemItem resolvedByProvider = provider == null ? null : provider.resolveIncludedFile(info, context); if (resolvedByProvider != null) { return resolvedByProvider; From 6eff36a8d8f78f7766e1662de0422c5f6c763b90 Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Thu, 16 Oct 2014 17:13:21 +0400 Subject: [PATCH 11/64] provide description for heavy running task --- .../ProjectStructureConfigurable.java | 2 +- .../src/com/intellij/dvcs/DvcsUtil.java | 5 ++-- .../ide/startup/impl/StartupManagerImpl.java | 11 ++++++-- .../application/impl/ApplicationImpl.java | 2 +- .../components/impl/ServiceManagerImpl.java | 4 +-- .../openapi/project/DumbServiceImpl.java | 6 +++-- .../openapi/vfs/newvfs/RefreshQueueImpl.java | 2 +- .../vfs/newvfs/RefreshSessionImpl.java | 12 +++++---- .../util/io/storage/HeavyProcessLatch.java | 25 +++++++++++++++---- 9 files changed, 47 insertions(+), 22 deletions(-) diff --git a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java index cad34394837e..d72269f41733 100644 --- a/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java +++ b/java/idea-ui/src/com/intellij/openapi/roots/ui/configuration/ProjectStructureConfigurable.java @@ -352,7 +352,7 @@ public class ProjectStructureConfigurable extends BaseConfigurable implements Se public void reset() { // need this to ensure VFS operations will not block because of storage flushing // and other maintenance IO tasks run in background - HeavyProcessLatch.INSTANCE.processStarted(); + HeavyProcessLatch.INSTANCE.processStarted("Resetting Project Structure"); try { myWasUiDisposed = false; diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java index e0c4ea8dfca3..bd30a10362b3 100644 --- a/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java +++ b/platform/dvcs-impl/src/com/intellij/dvcs/DvcsUtil.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,6 @@ import com.intellij.openapi.wm.StatusBarWidget; import com.intellij.openapi.wm.WindowManager; import com.intellij.openapi.wm.impl.status.StatusBarUtil; import com.intellij.util.Function; -import com.intellij.util.containers.ContainerUtil; import com.intellij.util.io.storage.HeavyProcessLatch; import com.intellij.util.text.DateFormatUtil; import com.intellij.vcs.log.TimedVcsCommit; @@ -191,7 +190,7 @@ public class DvcsUtil { } public static void workingTreeChangeStarted(@NotNull Project project) { - HeavyProcessLatch.INSTANCE.processStarted(); + HeavyProcessLatch.INSTANCE.processStarted("Changing DVCS working tree"); ApplicationManager.getApplication().getMessageBus().syncPublisher(BatchFileChangeListener.TOPIC).batchChangeStarted(project); } diff --git a/platform/platform-impl/src/com/intellij/ide/startup/impl/StartupManagerImpl.java b/platform/platform-impl/src/com/intellij/ide/startup/impl/StartupManagerImpl.java index 64b7dfa9c93d..b4128553a480 100644 --- a/platform/platform-impl/src/com/intellij/ide/startup/impl/StartupManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/ide/startup/impl/StartupManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2013 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -110,9 +110,10 @@ public class StartupManagerImpl extends StartupManagerEx { public void runStartupActivities() { ApplicationManager.getApplication().runReadAction(new Runnable() { + @Override @SuppressWarnings("SynchronizeOnThis") public void run() { - HeavyProcessLatch.INSTANCE.processStarted(); + HeavyProcessLatch.INSTANCE.processStarted("Running Startup Activities"); try { runActivities(myPreStartupActivities); @@ -141,6 +142,7 @@ public class StartupManagerImpl extends StartupManagerEx { public void runPostStartupActivitiesFromExtensions() { for (final StartupActivity extension : Extensions.getExtensions(StartupActivity.POST_STARTUP_ACTIVITY)) { final Runnable runnable = new Runnable() { + @Override public void run() { if (!myProject.isDisposed()) { extension.runActivity(myProject); @@ -173,6 +175,7 @@ public class StartupManagerImpl extends StartupManagerEx { runActivities(myDumbAwarePostStartupActivities); DumbService.getInstance(myProject).runWhenSmart(new Runnable() { + @Override public void run() { //noinspection SynchronizeOnThis synchronized (StartupManagerImpl.this) { @@ -199,6 +202,7 @@ public class StartupManagerImpl extends StartupManagerEx { public void scheduleInitialVfsRefresh() { UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override public void run() { if (myProject.isDisposed()) return; @@ -318,6 +322,7 @@ public class StartupManagerImpl extends StartupManagerEx { final Runnable runnable; if (DumbService.isDumbAware(action)) { runnable = new DumbAwareRunnable() { + @Override public void run() { action.run(); } @@ -325,6 +330,7 @@ public class StartupManagerImpl extends StartupManagerEx { } else { runnable = new Runnable() { + @Override public void run() { action.run(); } @@ -335,6 +341,7 @@ public class StartupManagerImpl extends StartupManagerEx { // in tests which simulate project opening, post-startup activities could have been run already. // Then we should act as if the project was initialized UIUtil.invokeLaterIfNeeded(new Runnable() { + @Override public void run() { if (!myProject.isDisposed()) { runnable.run(); diff --git a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java index cf87cd8c24d6..7194dbddaecb 100644 --- a/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/application/impl/ApplicationImpl.java @@ -502,7 +502,7 @@ public class ApplicationImpl extends PlatformComponentManagerImpl implements App myIsFiringLoadingEvent = false; } - HeavyProcessLatch.INSTANCE.processStarted(); + HeavyProcessLatch.INSTANCE.processStarted("Loading application components"); try { store.load(); } diff --git a/platform/platform-impl/src/com/intellij/openapi/components/impl/ServiceManagerImpl.java b/platform/platform-impl/src/com/intellij/openapi/components/impl/ServiceManagerImpl.java index b7e2ccb011ad..aca587e966cc 100644 --- a/platform/platform-impl/src/com/intellij/openapi/components/impl/ServiceManagerImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/components/impl/ServiceManagerImpl.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2011 JetBrains s.r.o. + * Copyright 2000-2014 JetBrains s.r.o. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -184,7 +184,7 @@ public class ServiceManagerImpl implements BaseComponent { @Override public Object compute() { // prevent storages from flushing and blocking FS - HeavyProcessLatch.INSTANCE.processStarted(); + HeavyProcessLatch.INSTANCE.processStarted("Creating component '" + myDescriptor.getImplementation()+"'"); try { synchronized (MyComponentAdapter.this) { Object instance = myInitializedComponentInstance; diff --git a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java index 137216540874..7860d4364f9d 100644 --- a/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/project/DumbServiceImpl.java @@ -153,7 +153,7 @@ public class DumbServiceImpl extends DumbService implements Disposable { indicator.pushState(); } try { - HeavyProcessLatch.INSTANCE.processStarted(); + HeavyProcessLatch.INSTANCE.processStarted("Performing indexing task"); task.performInDumbMode(indicator != null ? indicator : new EmptyProgressIndicator()); } finally { @@ -309,6 +309,7 @@ public class DumbServiceImpl extends DumbService implements Disposable { return wrapper; } + @Override public void smartInvokeLater(@NotNull final Runnable runnable) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override @@ -318,6 +319,7 @@ public class DumbServiceImpl extends DumbService implements Disposable { }, myProject.getDisposed()); } + @Override public void smartInvokeLater(@NotNull final Runnable runnable, @NotNull ModalityState modalityState) { ApplicationManager.getApplication().invokeLater(new Runnable() { @Override @@ -335,7 +337,7 @@ public class DumbServiceImpl extends DumbService implements Disposable { final ShutDownTracker shutdownTracker = ShutDownTracker.getInstance(); final Thread self = Thread.currentThread(); try { - HeavyProcessLatch.INSTANCE.processStarted(); + HeavyProcessLatch.INSTANCE.processStarted("Performing indexing tasks"); shutdownTracker.registerStopperThread(self); if (visibleIndicator instanceof ProgressIndicatorEx) { diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java index f2c9bf472a6b..8c777e75d21e 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshQueueImpl.java @@ -74,7 +74,7 @@ public class RefreshQueueImpl extends RefreshQueue { public void run() { try { myRefreshIndicator.start(); - HeavyProcessLatch.INSTANCE.processStarted(); + HeavyProcessLatch.INSTANCE.processStarted("Doing file refresh. "+session.toString()); try { doScan(session); } diff --git a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java index f7ad09abf223..220d86b09162 100644 --- a/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/vfs/newvfs/RefreshSessionImpl.java @@ -31,10 +31,7 @@ import com.intellij.util.concurrency.Semaphore; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -import java.util.ArrayList; -import java.util.Collection; -import java.util.LinkedHashSet; -import java.util.List; +import java.util.*; import java.util.concurrent.atomic.AtomicLong; /** @@ -207,7 +204,7 @@ public class RefreshSessionImpl extends RefreshSession { } private List mergeEventsAndReset() { - LinkedHashSet mergedEvents = new LinkedHashSet(myEvents); + Set mergedEvents = new LinkedHashSet(myEvents); List events = new ArrayList(mergedEvents); myEvents = new ArrayList(); return events; @@ -217,4 +214,9 @@ public class RefreshSessionImpl extends RefreshSession { public ModalityState getModalityState() { return myModalityState; } + + @Override + public String toString() { + return myWorkQueue.size() <= 1 ? "" : myWorkQueue.size() + " roots in queue."; + } } diff --git a/platform/util/src/com/intellij/util/io/storage/HeavyProcessLatch.java b/platform/util/src/com/intellij/util/io/storage/HeavyProcessLatch.java index 0f14dcb8511b..29e77633c756 100644 --- a/platform/util/src/com/intellij/util/io/storage/HeavyProcessLatch.java +++ b/platform/util/src/com/intellij/util/io/storage/HeavyProcessLatch.java @@ -24,31 +24,46 @@ import com.intellij.util.EventDispatcher; import org.jetbrains.annotations.NotNull; import java.util.EventListener; -import java.util.concurrent.atomic.AtomicInteger; +import java.util.Stack; public class HeavyProcessLatch { public static final HeavyProcessLatch INSTANCE = new HeavyProcessLatch(); - private final AtomicInteger myHeavyProcessCounter = new AtomicInteger(); + private final Stack myHeavyProcesses = new Stack(); private final EventDispatcher myEventDispatcher = EventDispatcher.create(HeavyProcessListener.class); private HeavyProcessLatch() { } + /** + * @deprecated use {@link #processStarted(java.lang.String)} instead + */ + @Deprecated public void processStarted() { - myHeavyProcessCounter.incrementAndGet(); + processStarted(""); + } + + public void processStarted(@NotNull String operationName) { + myHeavyProcesses.push(operationName); myEventDispatcher.getMulticaster().processStarted(); } public void processFinished() { - myHeavyProcessCounter.decrementAndGet(); + myHeavyProcesses.pop(); myEventDispatcher.getMulticaster().processFinished(); } public boolean isRunning() { - return myHeavyProcessCounter.get() != 0; + return !myHeavyProcesses.isEmpty(); } + public String getRunningOperationName() { + synchronized (myHeavyProcesses) { + return myHeavyProcesses.isEmpty() ? null : myHeavyProcesses.peek(); + } + } + + public interface HeavyProcessListener extends EventListener { public void processStarted(); From d397ca5ad037835ec35307bfd6e672b4fd6d418e Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Fri, 17 Oct 2014 13:09:09 +0400 Subject: [PATCH 12/64] make unused inspection suppression work in upsource --- .../UnusedSymbolLocalInspectionBase.java | 51 ++++++++++++++++++- .../UnusedSymbolLocalInspection.java | 51 +------------------ 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspectionBase.java b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspectionBase.java index 14da43194fe7..6c045fa4270b 100644 --- a/java/java-analysis-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspectionBase.java +++ b/java/java-analysis-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspectionBase.java @@ -15,11 +15,16 @@ */ package com.intellij.codeInspection.unusedSymbol; +import com.intellij.codeInsight.daemon.GroupNames; import com.intellij.codeInsight.daemon.impl.HighlightInfoType; import com.intellij.codeInspection.BaseJavaLocalInspectionTool; +import com.intellij.codeInspection.deadCode.UnusedDeclarationInspectionBase; +import com.intellij.codeInspection.ex.PairedUnfairLocalInspectionTool; +import org.intellij.lang.annotations.Pattern; import org.jetbrains.annotations.NonNls; +import org.jetbrains.annotations.NotNull; -public class UnusedSymbolLocalInspectionBase extends BaseJavaLocalInspectionTool { +public class UnusedSymbolLocalInspectionBase extends BaseJavaLocalInspectionTool implements PairedUnfairLocalInspectionTool { @NonNls public static final String SHORT_NAME = HighlightInfoType.UNUSED_SYMBOL_SHORT_NAME; @NonNls public static final String DISPLAY_NAME = HighlightInfoType.UNUSED_SYMBOL_DISPLAY_NAME; @NonNls public static final String UNUSED_PARAMETERS_SHORT_NAME = "UnusedParameters"; @@ -30,4 +35,48 @@ public class UnusedSymbolLocalInspectionBase extends BaseJavaLocalInspectionTool public boolean CLASS = true; public boolean PARAMETER = true; public boolean REPORT_PARAMETER_FOR_PUBLIC_METHODS = true; + + + @Override + @NotNull + public String getGroupDisplayName() { + return GroupNames.DECLARATION_REDUNDANCY; + } + + @Override + @NotNull + public String getDisplayName() { + return DISPLAY_NAME; + } + + @Override + @NotNull + @NonNls + public String getShortName() { + return SHORT_NAME; + } + + @Override + @Pattern(VALID_ID_PATTERN) + @NotNull + @NonNls + public String getID() { + return "unused"; + } + + @Override + public String getAlternativeID() { + return UnusedDeclarationInspectionBase.ALTERNATIVE_ID; + } + + @Override + public boolean isEnabledByDefault() { + return true; + } + + @NotNull + @Override + public String getInspectionForBatchShortName() { + return UnusedDeclarationInspectionBase.SHORT_NAME; + } } diff --git a/java/java-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspection.java b/java/java-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspection.java index f59f912b7d68..f422a4ca09b3 100644 --- a/java/java-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspection.java +++ b/java/java-impl/src/com/intellij/codeInspection/unusedSymbol/UnusedSymbolLocalInspection.java @@ -16,12 +16,6 @@ package com.intellij.codeInspection.unusedSymbol; -import com.intellij.codeInsight.daemon.GroupNames; -import com.intellij.codeInspection.deadCode.UnusedDeclarationInspection; -import com.intellij.codeInspection.ex.PairedUnfairLocalInspectionTool; -import org.intellij.lang.annotations.Pattern; -import org.jetbrains.annotations.NonNls; -import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -32,7 +26,7 @@ import java.awt.event.ActionListener; * User: anna * Date: 17-Feb-2006 */ -public class UnusedSymbolLocalInspection extends UnusedSymbolLocalInspectionBase implements PairedUnfairLocalInspectionTool { +public class UnusedSymbolLocalInspection extends UnusedSymbolLocalInspectionBase { /** * use {@link com.intellij.codeInspection.deadCode.UnusedDeclarationInspection} instead @@ -41,49 +35,6 @@ public class UnusedSymbolLocalInspection extends UnusedSymbolLocalInspectionBase public UnusedSymbolLocalInspection() { } - @Override - @NotNull - public String getGroupDisplayName() { - return GroupNames.DECLARATION_REDUNDANCY; - } - - @Override - @NotNull - public String getDisplayName() { - return DISPLAY_NAME; - } - - @Override - @NotNull - @NonNls - public String getShortName() { - return SHORT_NAME; - } - - @Override - @Pattern(VALID_ID_PATTERN) - @NotNull - @NonNls - public String getID() { - return "unused"; - } - - @Override - public String getAlternativeID() { - return UnusedDeclarationInspection.ALTERNATIVE_ID; - } - - @Override - public boolean isEnabledByDefault() { - return true; - } - - @NotNull - @Override - public String getInspectionForBatchShortName() { - return UnusedDeclarationInspection.SHORT_NAME; - } - public class OptionsPanel { private JCheckBox myCheckLocalVariablesCheckBox; private JCheckBox myCheckClassesCheckBox; From 0d8f57d4365538f759c7e11d0bc66f2fd7a90f3d Mon Sep 17 00:00:00 2001 From: Michael Golubev Date: Fri, 17 Oct 2014 10:47:33 +0200 Subject: [PATCH 13/64] IDEA-128650 - JBoss Deployment Structure 1.2 is missing from JBoss plugin --- resources-en/src/search/searchableOptions.xml | 1 + 1 file changed, 1 insertion(+) diff --git a/resources-en/src/search/searchableOptions.xml b/resources-en/src/search/searchableOptions.xml index b0aff6232c60..4a76f314caa7 100644 --- a/resources-en/src/search/searchableOptions.xml +++ b/resources-en/src/search/searchableOptions.xml @@ -22026,6 +22026,7 @@