diff --git a/.idea/libraries/nekohtml.xml b/.idea/libraries/nekohtml.xml new file mode 100644 index 000000000000..4817f403af21 --- /dev/null +++ b/.idea/libraries/nekohtml.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/build/scripts/common_tests.gant b/build/scripts/common_tests.gant index 1af3d7a8f248..e7aaf1a5d34e 100644 --- a/build/scripts/common_tests.gant +++ b/build/scripts/common_tests.gant @@ -41,37 +41,43 @@ private pass(String prop) { target('run_tests': 'Run java tests') { depends([compile]) - ant.junit(fork: "yes", showoutput: "true", logfailedtests:false) { - pass("idea.test.group") - pass("idea.test.patterns") - pass("idea.fast.only") - pass("teamcity.build.tempDir") - pass("teamcity.tests.recentlyFailedTests.file") - jvmarg (value: "-Didea.platform.prefix=Idea") - jvmarg (value: "-Djava.system.class.loader=com.intellij.util.lang.UrlClassLoader") + def classpathFile = "$home/junit.classpath" + List testRuntimeClasspath = projectBuilder.moduleRuntimeClasspath(findModule("community-main"), true) + new File(classpathFile).text = testRuntimeClasspath.findAll({ new File((String)it).exists() }).join('\n') - System.getProperties().entrySet().each { - if (it.key.startsWith("pass.")) { - def trimmed = it.key.substring("pass.".length()); - jvmarg(value: "-D${trimmed}=${it.value}"); - }; - } + testcases.each { testCase -> + ant.junit(fork: "yes", showoutput: "true", logfailedtests: false) { + jvmarg(value: "-Dclasspath.file=${classpathFile}") + pass("idea.test.group") + pass("idea.test.patterns") + pass("idea.fast.only") + pass("teamcity.build.tempDir") + pass("teamcity.tests.recentlyFailedTests.file") + jvmarg(value: "-Didea.platform.prefix=Idea") - commonJvmArgs().each { jvmarg(value: it) } - - if (isDefined("jvm_args")) { - jvm_args.each { jvmarg(value: it) } - } - - classpath { - projectBuilder.moduleRuntimeClasspath(findModule("community-main"), true).each { - pathelement(location: it) + System.getProperties().entrySet().each { + if (it.key.startsWith("pass.")) { + def trimmed = it.key.substring("pass.".length()); + jvmarg(value: "-D${trimmed}=${it.value}"); + }; } - pathelement(location: "${jdkHome}/lib/tools.jar") - } - testcases.each { - test (name: it) + commonJvmArgs().each { jvmarg(value: it) } + + jvmarg(value: "-Dbootstrap.testcases=$testCase") + + if (isDefined("jvm_args")) { + jvm_args.each { jvmarg(value: it) } + } + + classpath { + projectBuilder.moduleRuntimeClasspath(findModule("tests_bootstrap"), false).each { + pathelement(location: it) + } + pathelement(location: "${jdkHome}/lib/tools.jar") + } + + test(name: 'com.intellij.tests.BootstrapTests') } } } diff --git a/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java b/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java index 0f813d0bf167..e570b642b2bd 100644 --- a/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java +++ b/java/debugger/impl/src/com/intellij/debugger/settings/CompoundRendererConfigurable.java @@ -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; } diff --git a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AbstractProjectWizard.java b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AbstractProjectWizard.java index 4afaad08b5ba..0b83da74e9f5 100644 --- a/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AbstractProjectWizard.java +++ b/java/idea-ui/src/com/intellij/ide/util/newProjectWizard/AbstractProjectWizard.java @@ -154,6 +154,11 @@ public abstract class AbstractProjectWizard extends AbstractWizard - - - - - - - - - + diff --git a/java/java-impl/src/com/intellij/find/findUsages/JavaFindUsagesHandler.java b/java/java-impl/src/com/intellij/find/findUsages/JavaFindUsagesHandler.java index d19ffadb5bda..9a1b86efd74e 100644 --- a/java/java-impl/src/com/intellij/find/findUsages/JavaFindUsagesHandler.java +++ b/java/java-impl/src/com/intellij/find/findUsages/JavaFindUsagesHandler.java @@ -757,6 +757,7 @@ public class JavaFindUsagesHandler extends FindUsagesHandler{ } + @NotNull @Override public Collection findReferencesToHighlight(@NotNull final PsiElement target, @NotNull final SearchScope searchScope) { if (target instanceof PsiMethod) { diff --git a/java/java-tests/testSrc/com/intellij/openapi/editor/impl/FoldingExceptionTest.java b/java/java-tests/testSrc/com/intellij/openapi/editor/impl/FoldingExceptionTest.java index f40a58b16788..b168bc214014 100644 --- a/java/java-tests/testSrc/com/intellij/openapi/editor/impl/FoldingExceptionTest.java +++ b/java/java-tests/testSrc/com/intellij/openapi/editor/impl/FoldingExceptionTest.java @@ -15,11 +15,8 @@ */ package com.intellij.openapi.editor.impl; -import com.intellij.codeHighlighting.TextEditorHighlightingPass; import com.intellij.codeInsight.daemon.impl.CodeFoldingPassFactory; -import com.intellij.mock.MockProgressIndicator; import com.intellij.psi.PsiDocumentManager; -import com.intellij.psi.PsiFile; import com.intellij.testFramework.EditorTestUtil; import com.intellij.testFramework.LightCodeInsightTestCase; @@ -43,14 +40,7 @@ public class FoldingExceptionTest extends LightCodeInsightTestCase { } private static void runFoldingPass() { - PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(getProject()); - psiDocumentManager.commitAllDocuments(); - PsiFile psiFile = psiDocumentManager.getPsiFile(myEditor.getDocument()); - assertNotNull(psiFile); - - CodeFoldingPassFactory factory = getProject().getComponent(CodeFoldingPassFactory.class); - TextEditorHighlightingPass highlightingPass = factory.createHighlightingPass(psiFile, myEditor); - highlightingPass.collectInformation(new MockProgressIndicator()); - highlightingPass.doApplyInformationToEditor(); + PsiDocumentManager.getInstance(ourProject).commitAllDocuments(); + EditorTestUtil.runTextEditorHighlightingPass(myEditor, CodeFoldingPassFactory.class); } } diff --git a/java/testFramework/src/com/intellij/ide/projectWizard/ProjectWizardTestCase.java b/java/testFramework/src/com/intellij/ide/projectWizard/ProjectWizardTestCase.java index 2050b01ccbb2..25751535842a 100644 --- a/java/testFramework/src/com/intellij/ide/projectWizard/ProjectWizardTestCase.java +++ b/java/testFramework/src/com/intellij/ide/projectWizard/ProjectWizardTestCase.java @@ -58,7 +58,6 @@ import java.util.List; */ @SuppressWarnings("unchecked") public abstract class ProjectWizardTestCase extends PlatformTestCase { - protected static final String DEFAULT_SDK = "default"; protected final List mySdks = new ArrayList(); protected T myWizard; @@ -133,6 +132,7 @@ public abstract class ProjectWizardTestCase ext throw new RuntimeException(currentStep + " is not validated"); } } + myWizard.doFinishAction(); } protected void createWizard(Project project) throws IOException { diff --git a/lib/asm-all.jar b/lib/asm-all.jar index 0257ef24af13..800313398c81 100644 Binary files a/lib/asm-all.jar and b/lib/asm-all.jar differ diff --git a/platform/bootstrap/src/com/intellij/idea/Main.java b/platform/bootstrap/src/com/intellij/idea/Main.java index 7c328536d678..ce8a2d0f14e9 100644 --- a/platform/bootstrap/src/com/intellij/idea/Main.java +++ b/platform/bootstrap/src/com/intellij/idea/Main.java @@ -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", diff --git a/platform/core-impl/src/com/intellij/openapi/progress/util/TooManyUsagesStatus.java b/platform/core-impl/src/com/intellij/openapi/progress/util/TooManyUsagesStatus.java index 74d7bf36b911..f44d497edefa 100644 --- a/platform/core-impl/src/com/intellij/openapi/progress/util/TooManyUsagesStatus.java +++ b/platform/core-impl/src/com/intellij/openapi/progress/util/TooManyUsagesStatus.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. @@ -27,17 +27,14 @@ import java.util.concurrent.atomic.AtomicReference; public class TooManyUsagesStatus { private static final Key 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; diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java index 4f7f3322a05b..7d0b4453c517 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/FoldingUpdate.java @@ -159,17 +159,24 @@ public class FoldingUpdate { final List injectedEditors = new ArrayList(); final List injectedFiles = new ArrayList(); final List maps = new ArrayList(); - for (DocumentWindow injectedDocument : injectedDocuments) { - PsiFile injectedFile = PsiDocumentManager.getInstance(project).getPsiFile(injectedDocument); - if (injectedFile == null || !injectedFile.isValid() || !injectedDocument.isValid()) continue; - Editor injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injectedFile); - if (!(injectedEditor instanceof EditorWindow)) continue; + for (final DocumentWindow injectedDocument : injectedDocuments) { + if (!injectedDocument.isValid()) { + continue; + } + InjectedLanguageUtil.enumerate(injectedDocument, file, new PsiLanguageInjectionHost.InjectedPsiVisitor() { + @Override + public void visit(@NotNull PsiFile injectedFile, @NotNull List places) { + if (!injectedFile.isValid()) return; + Editor injectedEditor = InjectedLanguageUtil.getInjectedEditorForInjectedFile(editor, injectedFile); + if (!(injectedEditor instanceof EditorWindow)) return; - injectedEditors.add((EditorWindow)injectedEditor); - injectedFiles.add(injectedFile); - final FoldingMap map = new FoldingMap(); - maps.add(map); - getFoldingsFor(injectedFile, injectedDocument, map, false); + injectedEditors.add((EditorWindow)injectedEditor); + injectedFiles.add(injectedFile); + final FoldingMap map = new FoldingMap(); + maps.add(map); + getFoldingsFor(injectedFile, injectedDocument, map, false); + } + }); } return new Runnable() { diff --git a/platform/lang-impl/src/com/intellij/find/findUsages/AbstractFindUsagesDialog.java b/platform/lang-impl/src/com/intellij/find/findUsages/AbstractFindUsagesDialog.java index d1bae2c48f57..ee76d0ee4cc2 100644 --- a/platform/lang-impl/src/com/intellij/find/findUsages/AbstractFindUsagesDialog.java +++ b/platform/lang-impl/src/com/intellij/find/findUsages/AbstractFindUsagesDialog.java @@ -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; diff --git a/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesHandler.java b/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesHandler.java index c98f179aaa82..889855d66c79 100644 --- a/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesHandler.java +++ b/platform/lang-impl/src/com/intellij/find/findUsages/FindUsagesHandler.java @@ -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 findReferencesToHighlight(@NotNull PsiElement target, @NotNull SearchScope searchScope) { return ReferencesSearch.search(target, searchScope, false).findAll(); } diff --git a/platform/lang-impl/src/com/intellij/find/findUsages/PsiElement2UsageTargetAdapter.java b/platform/lang-impl/src/com/intellij/find/findUsages/PsiElement2UsageTargetAdapter.java index e5119f26d088..355224f4a9b5 100644 --- a/platform/lang-impl/src/com/intellij/find/findUsages/PsiElement2UsageTargetAdapter.java +++ b/platform/lang-impl/src/com/intellij/find/findUsages/PsiElement2UsageTargetAdapter.java @@ -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") : diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageManagerImpl.java b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageManagerImpl.java index 7c7945d653a3..85472e245b1f 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageManagerImpl.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageManagerImpl.java @@ -43,7 +43,6 @@ import com.intellij.openapi.progress.ProgressManager; import com.intellij.openapi.project.DumbService; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; -import com.intellij.openapi.util.Segment; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.psi.*; @@ -141,18 +140,9 @@ public class InjectedLanguageManagerImpl extends InjectedLanguageManager impleme if (indicator != null && indicator.isCanceled()) return false; if (documentManager.isUncommited(hostDocument) || !hostPsiFile.isValid()) return false; // will be committed later - Segment[] ranges = documentWindow.getHostRanges(); - Segment rangeMarker = ranges.length > 0 ? ranges[0] : null; - PsiElement element = rangeMarker == null ? null : hostPsiFile.findElementAt(rangeMarker.getStartOffset()); - if (element == null) { - synchronized (PsiLock.LOCK) { - injected.remove(documentWindow); - } - return true; - } final DocumentWindow[] stillInjectedDocument = {null}; // it is here where the reparse happens and old file contents replaced - InjectedLanguageUtil.enumerate(element, hostPsiFile, true, new PsiLanguageInjectionHost.InjectedPsiVisitor() { + InjectedLanguageUtil.enumerate(documentWindow, hostPsiFile, new PsiLanguageInjectionHost.InjectedPsiVisitor() { @Override public void visit(@NotNull PsiFile injectedPsi, @NotNull List places) { stillInjectedDocument[0] = (DocumentWindow)injectedPsi.getViewProvider().getDocument(); diff --git a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java index 1d6afc3d1fba..f2863469d614 100644 --- a/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java +++ b/platform/lang-impl/src/com/intellij/psi/impl/source/tree/injected/InjectedLanguageUtil.java @@ -92,6 +92,17 @@ public class InjectedLanguageUtil { return ((DocumentWindowImpl)myFileViewProvider.getDocument()).getShreds(); } + public static void enumerate(@NotNull DocumentWindow documentWindow, + @NotNull PsiFile hostPsiFile, + @NotNull PsiLanguageInjectionHost.InjectedPsiVisitor visitor) { + Segment[] ranges = documentWindow.getHostRanges(); + Segment rangeMarker = ranges.length > 0 ? ranges[0] : null; + PsiElement element = rangeMarker == null ? null : hostPsiFile.findElementAt(rangeMarker.getStartOffset()); + if (element != null) { + enumerate(element, hostPsiFile, true, visitor); + } + } + public static boolean enumerate(@NotNull PsiElement host, @NotNull PsiLanguageInjectionHost.InjectedPsiVisitor visitor) { PsiFile containingFile = host.getContainingFile(); return enumerate(host, containingFile, true, visitor); diff --git a/platform/platform-api/src/com/intellij/openapi/ui/FixedSizeButton.java b/platform/platform-api/src/com/intellij/openapi/ui/FixedSizeButton.java index a041fd2dd446..6fe5554299da 100644 --- a/platform/platform-api/src/com/intellij/openapi/ui/FixedSizeButton.java +++ b/platform/platform-api/src/com/intellij/openapi/ui/FixedSizeButton.java @@ -111,5 +111,18 @@ public class FixedSizeButton extends JButton { public void setSize(int size) { mySize = size; } -} + @Override + public void setBounds(int x, int y, int width, int height) { + int size = Math.min(width, height); + super.setBounds(x, y, size, size); + } + + @Override + public void setBounds(Rectangle r) { + int size = Math.min(r.width, r.height); + r.width = size; + r.height = size; + super.setBounds(r); + } +} diff --git a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java index 432fcb975812..94b25a1b3c94 100644 --- a/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java +++ b/platform/platform-impl/src/com/intellij/idea/IdeaApplication.java @@ -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 diff --git a/platform/platform-impl/src/com/intellij/openapi/progress/impl/BackgroundableProcessIndicator.java b/platform/platform-impl/src/com/intellij/openapi/progress/impl/BackgroundableProcessIndicator.java index 30ddb76d1f5f..5b06c79a3ad2 100644 --- a/platform/platform-impl/src/com/intellij/openapi/progress/impl/BackgroundableProcessIndicator.java +++ b/platform/platform-impl/src/com/intellij/openapi/progress/impl/BackgroundableProcessIndicator.java @@ -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 ""; } + @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; diff --git a/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/deployment/ServerRuntimeInstance.java b/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/deployment/ServerRuntimeInstance.java index b057fb30a7fa..b43598945b40 100644 --- a/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/deployment/ServerRuntimeInstance.java +++ b/platform/remote-servers/api/src/com/intellij/remoteServer/runtime/deployment/ServerRuntimeInstance.java @@ -15,6 +15,11 @@ public abstract class ServerRuntimeInstance { 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(); diff --git a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java index fe43f2aa4f4d..da16b9e72609 100644 --- a/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java +++ b/platform/remote-servers/impl/src/com/intellij/remoteServer/impl/runtime/ServerConnectionImpl.java @@ -110,7 +110,7 @@ public class ServerConnectionImpl implements @Override public void connected(@NotNull ServerRuntimeInstance 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); diff --git a/platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.java b/platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.java index 2afd09168420..4daee2640c27 100644 --- a/platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.java +++ b/platform/testFramework/src/com/intellij/psi/formatter/FormatterTestCase.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. @@ -15,10 +15,8 @@ */ package com.intellij.psi.formatter; -import com.intellij.codeHighlighting.TextEditorHighlightingPass; import com.intellij.codeInsight.daemon.impl.CodeFoldingPassFactory; import com.intellij.lang.Language; -import com.intellij.mock.MockProgressIndicator; import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.application.ex.PathManagerEx; import com.intellij.openapi.command.CommandProcessor; @@ -42,6 +40,7 @@ import com.intellij.psi.codeStyle.CodeStyleManager; import com.intellij.psi.codeStyle.CodeStyleSettings; import com.intellij.psi.codeStyle.CodeStyleSettingsManager; import com.intellij.psi.codeStyle.CommonCodeStyleSettings; +import com.intellij.testFramework.EditorTestUtil; import com.intellij.testFramework.LightPlatformTestCase; import com.intellij.util.IncorrectOperationException; import com.intellij.util.LocalTimeCounter; @@ -199,7 +198,7 @@ public abstract class FormatterTestCase extends LightPlatformTestCase { assertEquals(file.getText(), document.getText()); if (false && doCheckDocumentUpdate()) { - makeFolding(file, editor); + EditorTestUtil.runTextEditorHighlightingPass(editor, CodeFoldingPassFactory.class); } try { if (doReformatRangeTest) { @@ -225,13 +224,6 @@ public abstract class FormatterTestCase extends LightPlatformTestCase { assertEquals(textAfter, file.getText()); } - protected static void makeFolding(final PsiFile file, final EditorImpl editor) { - final CodeFoldingPassFactory factory = getProject().getComponent(CodeFoldingPassFactory.class); - final TextEditorHighlightingPass highlightingPass = factory.createHighlightingPass(file, editor); - highlightingPass.collectInformation(new MockProgressIndicator()); - highlightingPass.doApplyInformationToEditor(); - } - @SuppressWarnings({"UNUSED_SYMBOL"}) private void checkPsi(final PsiFile file, String textAfter) { CommandProcessor.getInstance().executeCommand(getProject(), new Runnable() { diff --git a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java index 0d4453820c33..d42e639438c2 100644 --- a/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java +++ b/platform/testFramework/src/com/intellij/testFramework/EditorTestUtil.java @@ -15,7 +15,10 @@ */ package com.intellij.testFramework; +import com.intellij.codeHighlighting.TextEditorHighlightingPass; +import com.intellij.codeHighlighting.TextEditorHighlightingPassFactory; import com.intellij.ide.DataManager; +import com.intellij.mock.MockProgressIndicator; import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.application.Result; import com.intellij.openapi.command.WriteCommandAction; @@ -32,10 +35,13 @@ import com.intellij.openapi.editor.impl.SoftWrapModelImpl; import com.intellij.openapi.editor.impl.softwrap.SoftWrapDrawingType; import com.intellij.openapi.editor.impl.softwrap.SoftWrapPainter; import com.intellij.openapi.editor.impl.softwrap.mapping.SoftWrapApplianceManager; +import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Ref; import com.intellij.openapi.util.TextRange; import com.intellij.openapi.util.registry.Registry; import com.intellij.openapi.util.text.StringUtil; +import com.intellij.psi.PsiDocumentManager; +import com.intellij.psi.PsiFile; import com.intellij.psi.tree.IElementType; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -432,6 +438,20 @@ public class EditorTestUtil { return ref.get(); } + public static void runTextEditorHighlightingPass(@NotNull Editor editor, @NotNull Class passFactory) { + Project project = editor.getProject(); + assertNotNull(project); + PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project); + PsiFile psiFile = psiDocumentManager.getPsiFile(editor.getDocument()); + assertNotNull(psiFile); + + T factory = project.getComponent(passFactory); + TextEditorHighlightingPass pass = factory.createHighlightingPass(psiFile, editor); + assertNotNull(pass); + pass.collectInformation(new MockProgressIndicator()); + pass.applyInformationToEditor(); + } + public static class CaretAndSelectionState { public final List carets = new ArrayList(); @Nullable diff --git a/platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java b/platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java index 0e7bae22d452..055414932b33 100644 --- a/platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java +++ b/platform/usageView/src/com/intellij/usages/impl/UsageViewManagerImpl.java @@ -174,7 +174,7 @@ public class UsageViewManagerImpl extends UsageViewManager { final SearchForUsagesRunnable runnable = new SearchForUsagesRunnable(myProject, usageView, presentation, searchFor, searcherFactory, processPresentation, listener); final Factory 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() { diff --git a/plugins/groovy/groovy-psi/src/META-INF/GroovyPlugin.xml b/plugins/groovy/groovy-psi/src/META-INF/GroovyPlugin.xml index 0c3122457e19..85949a53df2b 100644 --- a/plugins/groovy/groovy-psi/src/META-INF/GroovyPlugin.xml +++ b/plugins/groovy/groovy-psi/src/META-INF/GroovyPlugin.xml @@ -25,8 +25,7 @@ com.intellij.copyright org.intellij.intelliLang AntSupport - cucumber - ByteCodeViewer + ByteCodeViewer @@ -1510,10 +1509,6 @@ - - - - diff --git a/plugins/groovy/groovy-psi/src/META-INF/groovy-byte-code-viewer.xml b/plugins/groovy/groovy-psi/src/META-INF/groovy-byte-code-viewer.xml new file mode 100644 index 000000000000..ee9aeea6ff67 --- /dev/null +++ b/plugins/groovy/groovy-psi/src/META-INF/groovy-byte-code-viewer.xml @@ -0,0 +1,5 @@ + + + + + diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java index 15fbbe5a07c0..c60e46c63ced 100644 --- a/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java +++ b/plugins/hg4idea/src/org/zmlx/hg4idea/provider/commit/HgCheckinEnvironment.java @@ -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 diff --git a/python/openapi/src/com/jetbrains/python/packaging/PyPackageManager.java b/python/openapi/src/com/jetbrains/python/packaging/PyPackageManager.java index df6b91b1bfe8..4999b1bb519b 100644 --- a/python/openapi/src/com/jetbrains/python/packaging/PyPackageManager.java +++ b/python/openapi/src/com/jetbrains/python/packaging/PyPackageManager.java @@ -17,6 +17,7 @@ package com.jetbrains.python.packaging; import com.intellij.openapi.project.Project; import com.intellij.openapi.projectRoots.Sdk; +import org.jetbrains.annotations.Nullable; import java.awt.*; @@ -39,6 +40,7 @@ public abstract class PyPackageManager { public abstract void showInstallationError(Project project, String title, String description); public abstract void showInstallationError(Component owner, String title, String description); public abstract void refresh(); + @Nullable public abstract PyPackage findPackage(String name) throws PyExternalProcessException; } diff --git a/python/openapi/src/com/jetbrains/python/packaging/PyPackageManagers.java b/python/openapi/src/com/jetbrains/python/packaging/PyPackageManagers.java index 796bc47286ac..9f598748aa7b 100644 --- a/python/openapi/src/com/jetbrains/python/packaging/PyPackageManagers.java +++ b/python/openapi/src/com/jetbrains/python/packaging/PyPackageManagers.java @@ -18,6 +18,7 @@ package com.jetbrains.python.packaging; import com.intellij.openapi.components.ServiceManager; import com.intellij.openapi.module.Module; import com.intellij.openapi.projectRoots.Sdk; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.List; @@ -26,10 +27,13 @@ import java.util.List; * @author yole */ public abstract class PyPackageManagers { + + @NotNull public static PyPackageManagers getInstance() { return ServiceManager.getService(PyPackageManagers.class); } + @NotNull public abstract PyPackageManager forSdk(Sdk sdk); /** diff --git a/python/psi-api/src/com/jetbrains/python/psi/PyFile.java b/python/psi-api/src/com/jetbrains/python/psi/PyFile.java index 1786b934159b..48d1b50b5800 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/PyFile.java +++ b/python/psi-api/src/com/jetbrains/python/psi/PyFile.java @@ -27,6 +27,7 @@ public interface PyFile extends PyElement, PsiFile, PyDocStringOwner, ScopeOwner List getTopLevelClasses(); + @NotNull List getTopLevelFunctions(); List getTopLevelAttributes(); diff --git a/python/psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java b/python/psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java index b3a1134a2e03..f4f3a74f5a9f 100644 --- a/python/psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java +++ b/python/psi-api/src/com/jetbrains/python/psi/impl/PyPsiUtils.java @@ -236,6 +236,7 @@ public class PyPsiUtils { } } + @NotNull static List collectStubChildren(U e, final StubElement stub, final IElementType elementType, final Class itemClass) { diff --git a/python/src/com/jetbrains/python/findUsages/PyModuleFindUsagesHandler.java b/python/src/com/jetbrains/python/findUsages/PyModuleFindUsagesHandler.java index 6588d2d389a6..fd0eef003d6f 100644 --- a/python/src/com/jetbrains/python/findUsages/PyModuleFindUsagesHandler.java +++ b/python/src/com/jetbrains/python/findUsages/PyModuleFindUsagesHandler.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. @@ -72,6 +72,7 @@ public class PyModuleFindUsagesHandler extends FindUsagesHandler { }; } + @NotNull @Override public Collection findReferencesToHighlight(@NotNull PsiElement target, @NotNull SearchScope searchScope) { if (target instanceof PyImportedModule) { diff --git a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java index f8850376370a..a5961c4e3b8e 100644 --- a/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java +++ b/python/src/com/jetbrains/python/packaging/PyPackageManagerImpl.java @@ -603,6 +603,7 @@ public class PyPackageManagerImpl extends PyPackageManager { return packages != null ? findPackageByName(name, packages) : null; } + @Nullable private static PyPackage findPackageByName(String name, List packages) { for (PyPackage pkg : packages) { if (name.equalsIgnoreCase(pkg.getName())) { diff --git a/python/src/com/jetbrains/python/packaging/PyPackageManagersImpl.java b/python/src/com/jetbrains/python/packaging/PyPackageManagersImpl.java index 714bf8212b58..054e9e01d23f 100644 --- a/python/src/com/jetbrains/python/packaging/PyPackageManagersImpl.java +++ b/python/src/com/jetbrains/python/packaging/PyPackageManagersImpl.java @@ -17,6 +17,7 @@ package com.jetbrains.python.packaging; import com.intellij.openapi.module.Module; import com.intellij.openapi.projectRoots.Sdk; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.util.HashMap; @@ -29,6 +30,7 @@ import java.util.Map; public class PyPackageManagersImpl extends PyPackageManagers { private final Map myInstances = new HashMap(); + @NotNull @Override public synchronized PyPackageManager forSdk(Sdk sdk) { final String name = sdk.getName(); diff --git a/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java b/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java index c723aedb6b0d..030fcfe3d7e5 100644 --- a/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java +++ b/python/src/com/jetbrains/python/psi/impl/PyFileImpl.java @@ -419,6 +419,7 @@ public class PyFileImpl extends PsiFileBase implements PyFile, PyExpression { return PyPsiUtils.collectStubChildren(this, this.getStub(), PyElementTypes.CLASS_DECLARATION, PyClass.class); } + @NotNull @Override public List getTopLevelFunctions() { return PyPsiUtils.collectStubChildren(this, this.getStub(), PyElementTypes.FUNCTION_DECLARATION, PyFunction.class);