Merge remote-tracking branch 'origin/master'

This commit is contained in:
Ekaterina Tuzova
2014-06-19 16:26:59 +04:00
36 changed files with 205 additions and 113 deletions
+9
View File
@@ -0,0 +1,9 @@
<component name="libraryTable">
<library name="nekohtml">
<CLASSES>
<root url="jar://$PROJECT_DIR$/lib/nekohtml-1.9.14.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</component>
+33 -27
View File
@@ -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<String> 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')
}
}
}
@@ -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) {
+1 -9
View File
@@ -55,15 +55,7 @@
<orderEntry type="module" module-name="testFramework-java" scope="TEST" />
<orderEntry type="module" module-name="java-structure-view" exported="" />
<orderEntry type="module" module-name="spellchecker" />
<orderEntry type="module-library">
<library>
<CLASSES>
<root url="jar://$MODULE_DIR$/../../lib/nekohtml-1.9.14.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>
</orderEntry>
<orderEntry type="library" name="nekohtml" level="project" />
</component>
<component name="copyright">
<Base>
@@ -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) {
@@ -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);
}
}
@@ -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 {
BIN
View File
Binary file not shown.
@@ -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;
@@ -159,17 +159,24 @@ public class FoldingUpdate {
final List<EditorWindow> injectedEditors = new ArrayList<EditorWindow>();
final List<PsiFile> injectedFiles = new ArrayList<PsiFile>();
final List<FoldingMap> maps = new ArrayList<FoldingMap>();
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<PsiLanguageInjectionHost.Shred> 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() {
@@ -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") :
@@ -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<PsiLanguageInjectionHost.Shred> places) {
stillInjectedDocument[0] = (DocumentWindow)injectedPsi.getViewProvider().getDocument();
@@ -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);
@@ -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);
}
}
@@ -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);
@@ -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() {
@@ -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 <T extends TextEditorHighlightingPassFactory> void runTextEditorHighlightingPass(@NotNull Editor editor, @NotNull Class<T> 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<CaretInfo> carets = new ArrayList<CaretInfo>();
@Nullable
@@ -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,8 +25,7 @@
<depends optional="true" config-file="groovy-copyright.xml">com.intellij.copyright</depends>
<depends optional="true" config-file="intellilang-groovy-support.xml">org.intellij.intelliLang</depends>
<depends optional="true">AntSupport</depends>
<depends optional="true">cucumber</depends>
<depends optional="true">ByteCodeViewer</depends>
<depends optional="true" config-file="groovy-byte-code-viewer.xml">ByteCodeViewer</depends>
<extensionPoints>
<extensionPoint name="methodComparator" interface="org.jetbrains.plugins.groovy.lang.resolve.GrMethodComparator"/>
@@ -1510,10 +1509,6 @@
<codeFragmentFactory implementation="org.jetbrains.plugins.groovy.debugger.GroovyCodeFragmentFactory"/>
</extensions>
<extensions defaultExtensionNs="ByteCodeViewer">
<classSearcher implementation="org.jetbrains.plugins.groovy.byteCodeViewer.GroovyScriptClassSearcher"/>
</extensions>
<actions>
<action id="Groovy.Shell.Execute" class="com.intellij.openapi.actionSystem.EmptyAction" text="Execute Groovy Code"
description="Execute Groovy code in console">
@@ -0,0 +1,5 @@
<idea-plugin>
<extensions defaultExtensionNs="ByteCodeViewer">
<classSearcher implementation="org.jetbrains.plugins.groovy.byteCodeViewer.GroovyScriptClassSearcher"/>
</extensions>
</idea-plugin>
@@ -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
@@ -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;
}
@@ -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);
/**
@@ -27,6 +27,7 @@ public interface PyFile extends PyElement, PsiFile, PyDocStringOwner, ScopeOwner
List<PyClass> getTopLevelClasses();
@NotNull
List<PyFunction> getTopLevelFunctions();
List<PyTargetExpression> getTopLevelAttributes();
@@ -236,6 +236,7 @@ public class PyPsiUtils {
}
}
@NotNull
static <T, U extends PsiElement> List<T> collectStubChildren(U e,
final StubElement<U> stub, final IElementType elementType,
final Class<T> itemClass) {
@@ -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) {
@@ -603,6 +603,7 @@ public class PyPackageManagerImpl extends PyPackageManager {
return packages != null ? findPackageByName(name, packages) : null;
}
@Nullable
private static PyPackage findPackageByName(String name, List<PyPackage> packages) {
for (PyPackage pkg : packages) {
if (name.equalsIgnoreCase(pkg.getName())) {
@@ -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<String, PyPackageManagerImpl> myInstances = new HashMap<String, PyPackageManagerImpl>();
@NotNull
@Override
public synchronized PyPackageManager forSdk(Sdk sdk) {
final String name = sdk.getName();
@@ -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<PyFunction> getTopLevelFunctions() {
return PyPsiUtils.collectStubChildren(this, this.getStub(), PyElementTypes.FUNCTION_DECLARATION, PyFunction.class);