Merge remote-tracking branch 'origin/master'

This commit is contained in:
Anna Kozlova
2014-06-19 13:38:27 +02:00
16 changed files with 76 additions and 26 deletions
@@ -25,12 +25,14 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.debugger.ui.DebuggerExpressionTextField;
import com.intellij.debugger.ui.JavaDebuggerSupport;
import com.intellij.debugger.ui.tree.render.*;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ModalityState;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.options.ConfigurationException;
import com.intellij.openapi.options.UnnamedConfigurable;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.Pair;
import com.intellij.psi.*;
import com.intellij.psi.search.GlobalSearchScope;
@@ -141,10 +143,17 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
}
}
}, myProject);
myClassNameField.getEditorTextField().addFocusListener(new FocusAdapter() {
final EditorTextField textField = myClassNameField.getEditorTextField();
final FocusAdapter updateContextListener = new FocusAdapter() {
public void focusLost(FocusEvent e) {
final String qName = myClassNameField.getText();
updateContext(qName);
updateContext(myClassNameField.getText());
}
};
textField.addFocusListener(updateContextListener);
Disposer.register(myClassNameField, new Disposable() {
@Override
public void dispose() {
textField.removeFocusListener(updateContextListener);
}
});
@@ -388,10 +397,12 @@ public class CompoundRendererConfigurable implements UnnamedConfigurable {
myChildrenEditor.dispose();
myChildrenExpandedEditor.dispose();
myListChildrenEditor.dispose();
Disposer.dispose(myClassNameField);
myLabelEditor = null;
myChildrenEditor = null;
myChildrenExpandedEditor = null;
myListChildrenEditor = null;
myClassNameField = null;
myProject = null;
}
@@ -154,6 +154,11 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
@Override
protected final void doOKAction() {
if (!doFinishAction()) return;
super.doOKAction();
}
public boolean doFinishAction() {
int idx = getCurrentStep();
try {
do {
@@ -162,7 +167,7 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
step.updateStep();
}
if (!commitStepData(step)) {
return;
return false;
}
step.onStepLeaving();
try {
@@ -170,18 +175,19 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
}
catch (CommitStepException e) {
handleCommitException(e);
return;
return false;
}
if (!isLastStep(idx)) {
idx = getNextStep(idx);
} else {
}
else {
for (ModuleWizardStep wizardStep : mySteps) {
try {
wizardStep.onWizardFinished();
}
catch (CommitStepException e) {
handleCommitException(e);
return;
return false;
}
}
break;
@@ -192,7 +198,7 @@ public abstract class AbstractProjectWizard extends AbstractWizard<ModuleWizardS
myCurrentStep = idx;
updateStep();
}
super.doOKAction();
return true;
}
private void handleCommitException(CommitStepException e) {
@@ -757,6 +757,7 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{
}
@NotNull
@Override
public Collection<PsiReference> findReferencesToHighlight(@NotNull final PsiElement target, @NotNull final SearchScope searchScope) {
if (target instanceof PsiMethod) {
@@ -58,7 +58,6 @@ import java.util.List;
*/
@SuppressWarnings("unchecked")
public abstract class ProjectWizardTestCase<T extends AbstractProjectWizard> extends PlatformTestCase {
protected static final String DEFAULT_SDK = "default";
protected final List<Sdk> mySdks = new ArrayList<Sdk>();
protected T myWizard;
@@ -133,6 +132,7 @@ public abstract class ProjectWizardTestCase<T extends AbstractProjectWizard> ext
throw new RuntimeException(currentStep + " is not validated");
}
}
myWizard.doFinishAction();
}
protected void createWizard(Project project) throws IOException {
@@ -29,6 +29,7 @@ import java.io.*;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Locale;
@SuppressWarnings({"UseOfSystemOutOrSystemErr", "MethodNamesDifferingOnlyByCase"})
public class Main {
@@ -122,7 +123,7 @@ public class Main {
private static void installPatch() throws IOException {
String platform = System.getProperty(PLATFORM_PREFIX_PROPERTY, "idea");
String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase();
String patchFileName = ("jetbrains.patch.jar." + platform).toLowerCase(Locale.US);
String tempDir = System.getProperty("java.io.tmpdir");
// always delete previous patch copy
@@ -148,6 +149,7 @@ public class Main {
args.add(Restarter.createTempExecutable(launcher).getPath());
}
//noinspection SpellCheckingInspection
Collections.addAll(args,
System.getProperty("java.home") + "/bin/java",
"-Xmx500m",
@@ -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.
@@ -27,17 +27,14 @@ import java.util.concurrent.atomic.AtomicReference;
public class TooManyUsagesStatus {
private static final Key<TooManyUsagesStatus> KEY = Key.create("TooManyUsagesStatus");
private static final Null NULL = new Null();
private static final NullStatus NULL_STATUS = new NullStatus();
@NotNull
public static TooManyUsagesStatus getFrom(@Nullable ProgressIndicator indicator) {
TooManyUsagesStatus data = null;
if (indicator instanceof UserDataHolder) {
data = ((UserDataHolder)indicator).getUserData(KEY);
}
if (data == null) data = NULL;
return data;
TooManyUsagesStatus data = indicator instanceof UserDataHolder ? ((UserDataHolder)indicator).getUserData(KEY) : null;
return data == null ? NULL_STATUS : data;
}
public static TooManyUsagesStatus createFor(@NotNull ProgressIndicator indicator) {
TooManyUsagesStatus data = null;
if (indicator instanceof UserDataHolder) {
@@ -76,7 +73,7 @@ public class TooManyUsagesStatus {
}
}
private static class Null extends TooManyUsagesStatus {
private static class NullStatus extends TooManyUsagesStatus {
@Override
public boolean switchTooManyUsagesStatus() {
return false;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -143,6 +143,7 @@ public abstract class AbstractFindUsagesDialog extends DialogWrapper {
return panel;
}
@NotNull
public final FindUsagesOptions calcFindUsagesOptions() {
calcFindUsagesOptions(myFindUsagesOptions);
return myFindUsagesOptions;
@@ -47,6 +47,7 @@ import java.util.Collections;
*/
public abstract class FindUsagesHandler {
// return this handler if you want to cancel the search
@NotNull
public static final FindUsagesHandler NULL_HANDLER = new FindUsagesHandler(PsiUtilCore.NULL_PSI_ELEMENT){};
private final PsiElement myPsiElement;
@@ -204,6 +205,7 @@ public abstract class FindUsagesHandler {
return false;
}
@NotNull
public Collection<PsiReference> findReferencesToHighlight(@NotNull PsiElement target, @NotNull SearchScope searchScope) {
return ReferencesSearch.search(target, searchScope, false).findAll();
}
@@ -116,6 +116,7 @@ public class PsiElement2UsageTargetAdapter
return getElement();
}
@Override
public String toString() {
return getPresentableText();
}
@@ -209,7 +210,7 @@ public class PsiElement2UsageTargetAdapter
@Override
public String getLongDescriptiveName() {
SearchScope searchScope = myOptions.searchScope;
String scopeString = searchScope == null ? null : searchScope.getDisplayName();
String scopeString = searchScope.getDisplayName();
PsiElement psiElement = getElement();
return psiElement == null ? UsageViewBundle.message("node.invalid") :
@@ -218,7 +218,13 @@ public class IdeaApplication {
@Nullable
private SplashScreen getSplashScreen() {
return SplashScreen.getSplashScreen();
try {
return SplashScreen.getSplashScreen();
}
catch (Throwable t) {
LOG.warn(t);
return null;
}
}
@Override
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 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.
@@ -55,10 +55,12 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
if (myDumbModeAction == DumbModeAction.CANCEL) {
task.getProject().getMessageBus().connect(this).subscribe(DumbService.DUMB_MODE, new DumbService.DumbModeListener() {
@Override
public void enteredDumbMode() {
cancel();
}
@Override
public void exitDumbMode() {
}
});
@@ -69,6 +71,7 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
super(info.isCancellable(), true, project, info.getCancelText());
if (project != null) {
final ProjectManagerAdapter myListener = new ProjectManagerAdapter() {
@Override
public void projectClosing(Project closingProject) {
if (isRunning()) {
cancel();
@@ -107,23 +110,28 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
@Nls final String cancelButtonText,
@Nls final String backgroundStopTooltip, final boolean cancellable) {
this(project, new TaskInfo() {
@Override
public String getProcessId() {
return "<unknown>";
}
@Override
@NotNull
public String getTitle() {
return progressTitle;
}
@Override
public String getCancelText() {
return cancelButtonText;
}
@Override
public String getCancelTooltipText() {
return backgroundStopTooltip;
}
@Override
public boolean isCancellable() {
return cancellable;
}
@@ -134,6 +142,7 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
return myDumbModeAction;
}
@Override
protected void showDialog() {
if (myDisposed) return;
@@ -144,6 +153,7 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
super.showDialog();
}
@Override
public void background() {
if (myDisposed) return;
@@ -158,6 +168,7 @@ public class BackgroundableProcessIndicator extends ProgressWindow {
}
}
@Override
public void dispose() {
super.dispose();
myDisposed = true;
@@ -15,6 +15,11 @@ public abstract class ServerRuntimeInstance<D extends DeploymentConfiguration> {
public abstract void computeDeployments(@NotNull ComputeDeploymentsCallback callback);
@NotNull
public String getDeploymentName(@NotNull DeploymentSource source, D configuration) {
return getDeploymentName(source);
}
@NotNull
public String getDeploymentName(@NotNull DeploymentSource source) {
return source.getPresentableName();
@@ -110,7 +110,7 @@ public class ServerConnectionImpl<D extends DeploymentConfiguration> implements
@Override
public void connected(@NotNull ServerRuntimeInstance<D> instance) {
DeploymentSource source = task.getSource();
String deploymentName = instance.getDeploymentName(source);
String deploymentName = instance.getDeploymentName(source, task.getConfiguration());
DeploymentImpl deployment;
synchronized (myLocalDeployments) {
deployment = new DeploymentImpl(deploymentName, DeploymentStatus.DEPLOYING, null, null, task);
@@ -174,7 +174,7 @@ public class UsageViewManagerImpl extends UsageViewManager {
final SearchForUsagesRunnable runnable = new SearchForUsagesRunnable(myProject, usageView, presentation, searchFor, searcherFactory, processPresentation, listener);
final Factory<ProgressIndicator> progressIndicatorFactory = processPresentation.getProgressIndicatorFactory();
final ProgressIndicator progressIndicator = progressIndicatorFactory != null ? progressIndicatorFactory.create() : null;
final ProgressIndicator progressIndicator = progressIndicatorFactory == null ? null : progressIndicatorFactory.create();
final AtomicBoolean findUsagesStartedShown = new AtomicBoolean();
ApplicationManager.getApplication().executeOnPooledThread(new Runnable() {
@@ -25,6 +25,7 @@ import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.changes.ChangeList;
import com.intellij.openapi.vcs.changes.ContentRevision;
import com.intellij.openapi.vcs.changes.VcsDirtyScopeManager;
import com.intellij.openapi.vcs.checkin.CheckinEnvironment;
import com.intellij.openapi.vcs.ui.RefreshableOnComponent;
import com.intellij.openapi.vfs.VirtualFile;
@@ -109,6 +110,11 @@ public class HgCheckinEnvironment implements CheckinEnvironment {
//abort
return exceptions;
}
//firstly selected changes marked dirty in CommitHelper -> postRefresh, so we need to mark others
VcsDirtyScopeManager dirtyManager = VcsDirtyScopeManager.getInstance(myProject);
for (HgFile hgFile : changedFilesNotInCommit) {
dirtyManager.fileDirty(hgFile.toFilePath());
}
}
// else : all was included, or it was OK to commit everything,
// so no need to set the files on the command, because then mercurial will complain
@@ -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.
@@ -72,6 +72,7 @@ public class PyModuleFindUsagesHandler extends FindUsagesHandler {
};
}
@NotNull
@Override
public Collection<PsiReference> findReferencesToHighlight(@NotNull PsiElement target, @NotNull SearchScope searchScope) {
if (target instanceof PyImportedModule) {