Merge remote-tracking branch 'origin/master'

This commit is contained in:
Roman Shevchenko
2014-10-31 21:37:31 +01:00
9 changed files with 48 additions and 31 deletions
@@ -546,11 +546,9 @@ public class BuildManager implements ApplicationComponent{
runCommand(new Runnable() {
@Override
public void run() {
LOG.info("Cancelling preloaded process for project " + projectPath);
Pair<RequestFuture<PreloadedProcessMessageHandler>, OSProcessHandler> pair = takePreloadedProcess(projectPath);
if (pair != null) {
final RequestFuture<PreloadedProcessMessageHandler> future = pair.first;
LOG.info("Cancelling preloaded process, sessionID=" + future.getRequestID());
myMessageDispatcher.cancelSession(future.getRequestID());
// waiting for preloaded process from project's task queue guarantees no build is started for this project
// until this one gracefully exits and closes all its storages
@@ -561,9 +559,6 @@ public class BuildManager implements ApplicationComponent{
}
});
}
else {
LOG.info("takePreloadedProcess() returned null");
}
}
});
}
@@ -752,12 +747,14 @@ public class BuildManager implements ApplicationComponent{
if (Registry.is("compiler.process.preload") && !project.isDisposed()) {
runCommand(new Runnable() {
public void run() {
try {
final Future<Pair<RequestFuture<PreloadedProcessMessageHandler>, OSProcessHandler>> preloadResult = launchPreloadedBuildProcess(project, projectTaskQueue);
myPreloadedBuilds.put(projectPath, preloadResult);
}
catch (Exception e) {
LOG.info("Error pre-loading build process for project " + projectPath, e);
if (!myPreloadedBuilds.containsKey(projectPath)) {
try {
final Future<Pair<RequestFuture<PreloadedProcessMessageHandler>, OSProcessHandler>> preloadResult = launchPreloadedBuildProcess(project, projectTaskQueue);
myPreloadedBuilds.put(projectPath, preloadResult);
}
catch (Exception e) {
LOG.info("Error pre-loading build process for project " + projectPath, e);
}
}
}
});
@@ -75,19 +75,11 @@ class BuildMessageDispatcher extends SimpleChannelInboundHandlerAdapter<CmdlineR
}
public void cancelSession(UUID sessionId) {
LOG.info("Cancelling session " + sessionId);
if (myCanceledSessions.add(sessionId)) {
final Channel channel = getConnectedChannel(sessionId);
if (channel != null) {
channel.writeAndFlush(CmdlineProtoUtil.toMessage(sessionId, CmdlineProtoUtil.createCancelCommand()));
LOG.info("Cancelling session " + sessionId + "; message sent");
}
else {
LOG.info("Cancelling session " + sessionId + "; channel not ready");
}
}
else {
LOG.info("Cancelling session " + sessionId + "; already marked as 'cancelled'");
}
}
@@ -98,7 +98,10 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
final PsiMethod method = (PsiMethod)parameter.getDeclarationScope();
PsiMethod[] overrides = OverridingMethodsSearch.search(method, true).toArray(PsiMethod.EMPTY_ARRAY);
for (int i = 0; i < overrides.length; i++) {
overrides[i] = (PsiMethod)overrides[i].getNavigationElement();
final PsiElement navigationElement = overrides[i].getNavigationElement();
if (navigationElement instanceof PsiMethod) {
overrides[i] = (PsiMethod)navigationElement;
}
}
List<PsiElement> elementsToSearch = new ArrayList<PsiElement>(overrides.length + 1);
elementsToSearch.add(parameter);
@@ -94,18 +94,26 @@ public class MergeMethodArguments extends FixableUsageInfo {
}
final List<ParameterInfoImpl> parametersInfo = new ArrayList<ParameterInfoImpl>();
final PsiClassType classType = JavaPsiFacade.getElementFactory(getProject()).createType(psiClass, subst);
parametersInfo.add(new ParameterInfoImpl(-1, parameterName, classType, null) {
final ParameterInfoImpl mergedParamInfo = new ParameterInfoImpl(-1, parameterName, classType, null) {
@Override
public PsiExpression getValue(final PsiCallExpression expr) throws IncorrectOperationException {
return (PsiExpression)JavaCodeStyleManager.getInstance(getProject()).shortenClassReferences(psiFacade.getElementFactory().createExpressionFromText(getMergedParam(expr), expr));
return (PsiExpression)JavaCodeStyleManager.getInstance(getProject())
.shortenClassReferences(psiFacade.getElementFactory().createExpressionFromText(getMergedParam(expr), expr));
}
});
};
int firstIncludedIdx = -1;
final PsiParameter[] parameters = method.getParameterList().getParameters();
for (int i = 0; i < parameters.length; i++) {
if (!isParameterToMerge(i)) {
parametersInfo.add(new ParameterInfoImpl(i, parameters[i].getName(), parameters[i].getType()));
} else if (firstIncludedIdx == -1) {
firstIncludedIdx = i;
}
}
parametersInfo.add(firstIncludedIdx == -1 ? 0 : firstIncludedIdx, mergedParamInfo);
final SmartPsiElementPointer<PsiMethod> meth = SmartPointerManager.getInstance(getProject()).createSmartPsiElementPointer(method);
Runnable performChangeSignatureRunnable = new Runnable() {
@@ -835,7 +835,14 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
}
}
final String text = stripTypeParameters(el.getText());
final boolean equalsIgnorePackage = MatchUtils.compareWithNoDifferenceToPackage(text, stripTypeParameters(el2.getText()));
String text2;
if (el2 instanceof PsiClass) {
text2 = ((PsiClass)el2).getQualifiedName();
} else {
text2 = el2.getText();
}
final boolean equalsIgnorePackage = MatchUtils.compareWithNoDifferenceToPackage(text, stripTypeParameters(text2));
if (equalsIgnorePackage || !(el2 instanceof PsiJavaReference)) {
return equalsIgnorePackage;
}
@@ -846,7 +853,7 @@ public class JavaMatchingVisitor extends JavaElementVisitor {
return text.equals(((PsiClass)element2).getQualifiedName());
}
else {
return MatchUtils.compareWithNoDifferenceToPackage(text, el2.getText());
return MatchUtils.compareWithNoDifferenceToPackage(text, text2);
}
}
}
@@ -16,21 +16,18 @@
package com.intellij.codeInsight.daemon.impl;
import com.intellij.codeInsight.intention.IntentionAction;
import com.intellij.codeInspection.InspectionProfile;
import com.intellij.codeInspection.actions.CodeCleanupAction;
import com.intellij.codeInspection.ex.InspectionToolWrapper;
import com.intellij.openapi.editor.Editor;
import com.intellij.openapi.options.ShowSettingsUtil;
import com.intellij.openapi.project.Project;
import com.intellij.profile.codeInspection.InspectionProfileManager;
import com.intellij.profile.codeInspection.InspectionProjectProfileManager;
import com.intellij.profile.codeInspection.ui.IDEInspectionToolsConfigurable;
import com.intellij.profile.codeInspection.ui.ProjectInspectionToolsConfigurable;
import com.intellij.psi.PsiFile;
import com.intellij.util.IncorrectOperationException;
import org.jetbrains.annotations.NotNull;
import javax.swing.*;
/**
* Created by anna on 5/13/2014.
*/
@@ -64,6 +61,11 @@ class EditCleanupProfileIntentionAction implements IntentionAction {
protected boolean acceptTool(InspectionToolWrapper entry) {
return super.acceptTool(entry) && entry.isCleanupTool();
}
@Override
public String getDisplayName() {
return CodeCleanupAction.CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME;
}
};
ShowSettingsUtil.getInstance().editConfigurable(project, configurable);
}
@@ -28,6 +28,9 @@ import com.intellij.profile.codeInspection.ui.IDEInspectionToolsConfigurable;
import org.jetbrains.annotations.NotNull;
public class CodeCleanupAction extends CodeInspectionAction {
public static final String CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME = "Code Cleanup Inspections";
public CodeCleanupAction() {
super("Code Cleanup", "Code Cleanup");
}
@@ -48,6 +51,11 @@ public class CodeCleanupAction extends CodeInspectionAction {
protected boolean acceptTool(InspectionToolWrapper entry) {
return super.acceptTool(entry) && entry.isCleanupTool();
}
@Override
public String getDisplayName() {
return CODE_CLEANUP_INSPECTIONS_DISPLAY_NAME;
}
};
}
}
@@ -121,7 +121,7 @@ public class IdeaLogger extends Logger {
@Override
public void error(String message, @Nullable Throwable t, @NotNull String... details) {
if (t instanceof ProcessCanceledException) {
myLogger.error(new Throwable("Do not log ProcessCanceledException").initCause(t));
myLogger.error(message, new Throwable("Do not log ProcessCanceledException").initCause(t));
throw (ProcessCanceledException)t;
}
@@ -239,7 +239,7 @@ todo.in.new.review.button=&Review
before.checkin.standard.options.check.smells=Perform code analy&sis
before.checkin.new.todo.check=Check TODO ({0})
before.checkin.new.todo.check.title=Check TODO
before.checkin.cleanup.code=&Cleanup
before.checkin.cleanup.code=C&leanup
# Changes view
changes.nodetitle.unversioned.files=Unversioned Files