mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge remote-tracking branch 'origin/master'
This commit is contained in:
+2
-1
@@ -768,7 +768,8 @@ public class JavaCompletionContributor extends CompletionContributor {
|
||||
iterator.advance();
|
||||
}
|
||||
|
||||
if (!iterator.atEnd() && (iterator.getTokenType() == JavaTokenType.LPARENTH)) {
|
||||
if (!iterator.atEnd() && iterator.getTokenType() == JavaTokenType.LPARENTH && PsiTreeUtil.getParentOfType(ref, PsiExpression.class, PsiClass.class) == null) {
|
||||
// looks like a method declaration, e.g. StringBui<caret>methodName() inside a class
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2009 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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,7 +15,7 @@
|
||||
*/
|
||||
package com.intellij.ide;
|
||||
|
||||
import com.intellij.lang.StdLanguages;
|
||||
import com.intellij.lang.java.JavaLanguage;
|
||||
import com.intellij.openapi.compiler.CompilerManager;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.fileTypes.StdFileTypes;
|
||||
@@ -36,6 +36,7 @@ import javax.swing.*;
|
||||
* @author yole
|
||||
*/
|
||||
public class JavaFileIconPatcher implements FileIconPatcher {
|
||||
@Override
|
||||
public Icon patchIcon(final Icon baseIcon, final VirtualFile file, final int flags, final Project project) {
|
||||
if (project == null) {
|
||||
return baseIcon;
|
||||
@@ -58,7 +59,7 @@ public class JavaFileIconPatcher implements FileIconPatcher {
|
||||
}
|
||||
|
||||
PsiFile psiFile = PsiManager.getInstance(project).findFile(file);
|
||||
if (psiFile instanceof PsiClassOwner && psiFile.getViewProvider().getBaseLanguage() == StdLanguages.JAVA) {
|
||||
if (psiFile instanceof PsiClassOwner && psiFile.getViewProvider().getBaseLanguage() == JavaLanguage.INSTANCE) {
|
||||
PsiClass[] classes = ((PsiClassOwner)psiFile).getClasses();
|
||||
if (classes.length > 0) {
|
||||
// prefer icon of the class named after file
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -18,7 +18,6 @@ package com.intellij.ide.highlighter;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
@@ -28,14 +27,6 @@ public class JavaClassFileType implements FileType {
|
||||
|
||||
public static final JavaClassFileType INSTANCE = new JavaClassFileType();
|
||||
|
||||
private static final NotNullLazyValue<Icon> ICON = new NotNullLazyValue<Icon>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Icon compute() {
|
||||
return AllIcons.FileTypes.JavaClass;
|
||||
}
|
||||
};
|
||||
|
||||
private JavaClassFileType() {
|
||||
}
|
||||
|
||||
@@ -59,7 +50,7 @@ public class JavaClassFileType implements FileType {
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return ICON.getValue();
|
||||
return AllIcons.FileTypes.JavaClass;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
class Zoo {
|
||||
|
||||
void foo(int x) {
|
||||
if (x < getAnnotati<caret>onsAreaOffset());
|
||||
|
||||
}
|
||||
|
||||
int getAnnotationsAreaOffset() {}
|
||||
}
|
||||
+1
-1
@@ -117,7 +117,7 @@ public class HeavyNormalCompletionTest extends JavaCodeInsightFixtureTestCase {
|
||||
myFixture.completeBasic();
|
||||
assertOrderedEquals(myFixture.getLookupElementStrings(), "getAaa", "getBbb");
|
||||
myFixture.getEditor().getCaretModel().moveToOffset(myFixture.getEditor().getCaretModel().getOffset() + 2);
|
||||
assertNull(myFixture.completeBasic());
|
||||
assert myFixture.completeBasic() == null
|
||||
}
|
||||
|
||||
public void testQualifyInaccessibleClassName() throws Exception {
|
||||
|
||||
+5
@@ -512,6 +512,11 @@ public class NormalCompletionTest extends LightFixtureCompletionTestCase {
|
||||
public void testBreakInIfCondition() throws Throwable { doTest(); }
|
||||
public void testAccessStaticViaInstance() throws Throwable { doTest(); }
|
||||
|
||||
public void testIfConditionLt() {
|
||||
configure()
|
||||
myFixture.assertPreferredCompletionItems 0, 'getAnnotationsAreaOffset'
|
||||
}
|
||||
|
||||
public void testAccessStaticViaInstanceSecond() throws Throwable {
|
||||
configure()
|
||||
myFixture.complete(CompletionType.BASIC, 2)
|
||||
|
||||
+3
-1
@@ -22,6 +22,7 @@ import java.util.List;
|
||||
public class DeclarationStatementHandler extends MatchingHandler {
|
||||
private MatchingHandler myCommentHandler;
|
||||
|
||||
@Override
|
||||
public boolean match(PsiElement patternNode, PsiElement matchedNode, MatchContext context) {
|
||||
if (patternNode instanceof PsiComment) {
|
||||
return myCommentHandler.match(patternNode, matchedNode, context);
|
||||
@@ -59,7 +60,7 @@ public class DeclarationStatementHandler extends MatchingHandler {
|
||||
node = PsiTreeUtil.skipSiblingsForward(node, PsiWhiteSpace.class);
|
||||
while (PsiUtil.isJavaToken(node, JavaTokenType.COMMA)) {
|
||||
node = PsiTreeUtil.skipSiblingsForward(node, PsiWhiteSpace.class);
|
||||
if (node != null) {
|
||||
if (node instanceof PsiField) {
|
||||
matchNodes.add(node);
|
||||
}
|
||||
node = PsiTreeUtil.skipSiblingsForward(node, PsiWhiteSpace.class);
|
||||
@@ -89,6 +90,7 @@ public class DeclarationStatementHandler extends MatchingHandler {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAdvanceTheMatchFor(PsiElement patternElement, PsiElement matchedElement) {
|
||||
if (patternElement instanceof PsiComment &&
|
||||
( matchedElement instanceof PsiField ||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -18,21 +18,12 @@ package com.intellij.ide.highlighter;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.ide.IdeBundle;
|
||||
import com.intellij.openapi.fileTypes.FileType;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class ArchiveFileType implements FileType {
|
||||
private static final NotNullLazyValue<Icon> ICON = new NotNullLazyValue<Icon>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Icon compute() {
|
||||
return AllIcons.FileTypes.Archive;
|
||||
}
|
||||
};
|
||||
|
||||
public static final ArchiveFileType INSTANCE = new ArchiveFileType();
|
||||
|
||||
@Override
|
||||
@@ -55,7 +46,7 @@ public class ArchiveFileType implements FileType {
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return ICON.getValue();
|
||||
return AllIcons.FileTypes.Archive;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2014 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
@@ -16,20 +16,12 @@
|
||||
package com.intellij.openapi.fileTypes;
|
||||
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.util.NotNullLazyValue;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import javax.swing.*;
|
||||
|
||||
public class UnknownFileType implements FileType {
|
||||
private static final NotNullLazyValue<Icon> ICON = new NotNullLazyValue<Icon>() {
|
||||
@NotNull
|
||||
@Override
|
||||
protected Icon compute() {
|
||||
return AllIcons.FileTypes.Unknown;
|
||||
}
|
||||
};
|
||||
public static final FileType INSTANCE = new UnknownFileType();
|
||||
|
||||
private UnknownFileType() {}
|
||||
@@ -54,7 +46,7 @@ public class UnknownFileType implements FileType {
|
||||
|
||||
@Override
|
||||
public Icon getIcon() {
|
||||
return ICON.getValue();
|
||||
return AllIcons.FileTypes.Unknown;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,7 @@ package com.intellij.idea;
|
||||
import com.intellij.CommonBundle;
|
||||
import com.intellij.openapi.application.ApplicationNamesInfo;
|
||||
import com.intellij.openapi.application.PathManager;
|
||||
import com.intellij.openapi.diagnostic.DefaultLogger;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
import com.intellij.openapi.util.Disposer;
|
||||
import com.intellij.openapi.util.io.FileUtil;
|
||||
@@ -42,7 +43,10 @@ import org.jetbrains.io.MessageDecoder;
|
||||
import javax.swing.*;
|
||||
import java.io.*;
|
||||
import java.net.Socket;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.atomic.AtomicReference;
|
||||
|
||||
/**
|
||||
@@ -100,7 +104,7 @@ public final class SocketLock {
|
||||
});
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
logError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,7 +183,7 @@ public final class SocketLock {
|
||||
});
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
logError(e);
|
||||
|
||||
if (Main.isHeadless()) {
|
||||
Main.showMessage("Cannot lock system folders", e);
|
||||
@@ -213,12 +217,22 @@ public final class SocketLock {
|
||||
closeable.close();
|
||||
}
|
||||
catch (Throwable e) {
|
||||
LOG.error(e);
|
||||
logError(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static void logError(@NotNull Throwable e) {
|
||||
// default logger throws AssertionError and it leads to startup failure without error message dialog
|
||||
if (LOG instanceof DefaultLogger) {
|
||||
LOG.warn(e);
|
||||
}
|
||||
else {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings({"SocketOpenedButNotSafelyClosed", "IOResourceOpenedButNotSafelyClosed"})
|
||||
@NotNull
|
||||
private static ActivateStatus tryActivate(int portNumber, @NotNull Collection<String> paths, @NotNull String[] args) {
|
||||
|
||||
+30
@@ -80,6 +80,36 @@ import java.awt.geom.AffineTransform;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Gutter content (left to right):
|
||||
* <ul>
|
||||
* <li>GAP_BETWEEN_AREAS</li>
|
||||
* <li>Line numbers area
|
||||
* <ul>
|
||||
* <li>Line numbers</li>
|
||||
* <li>GAP_BETWEEN_AREAS</li>
|
||||
* <li>Additional line numbers (used in diff)</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>GAP_BETWEEN_AREAS</li>
|
||||
* <li>Annotations area
|
||||
* <ul>
|
||||
* <li>Annotations</li>
|
||||
* <li>Annotations extra (used in distraction free mode)</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>GAP_BETWEEN_AREAS</li>
|
||||
* <li>Line markers area
|
||||
* <ul>
|
||||
* <li>Left free painters</li>
|
||||
* <li>Icons</li>
|
||||
* <li>GAP_BETWEEN_AREAS</li>
|
||||
* <li>Free painters</li>
|
||||
* </ul>
|
||||
* </li>
|
||||
* <li>Folding area</li>
|
||||
*</ul>
|
||||
*/
|
||||
class EditorGutterComponentImpl extends EditorGutterComponentEx implements MouseListener, MouseMotionListener, DataProvider {
|
||||
private static final Logger LOG = Logger.getInstance("#com.intellij.openapi.editor.impl.EditorGutterComponentImpl");
|
||||
private static final int START_ICON_AREA_WIDTH = 15;
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2012 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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.
|
||||
+1
-2
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2000-2011 JetBrains s.r.o.
|
||||
* Copyright 2000-2015 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,7 +15,6 @@
|
||||
*/
|
||||
package com.intellij.openapi.roots.ui.util;
|
||||
|
||||
import com.intellij.openapi.fileTypes.FileTypeManager;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
|
||||
import javax.swing.*;
|
||||
@@ -1,7 +1,7 @@
|
||||
// This file contains list of broken plugins.
|
||||
// Each line contains plugin ID and list of versions that are broken.
|
||||
// If plugin name or version contains a space you can quote it like in command line.
|
||||
NodeJS 142.4100 142.3224 142.2650 142.2492 142.2481 142.2064 141.1108 140.2045 140.1669 140.642 139.173 139.105 139.496 139.1 139.8 138.2196 138.2254 138.1684 138.1744 138.1879 138.2051 138.1367 138.1495 138.1189 138.1145 138.937 138.1013 138.921 138.447 138.172 138.317 138.21 138.35 138.96 138.85 136.1205 134.1276 134.1163 134.1145 134.1081 134.1039 134.985 134.680 134.31 134.307 134.262 134.198 134.125 136.1141
|
||||
NodeJS 142.4100 142.3858 142.3224 142.2650 142.2492 142.2481 142.2064 141.1108 140.2045 140.1669 140.642 139.173 139.105 139.496 139.1 139.8 138.2196 138.2254 138.1684 138.1744 138.1879 138.2051 138.1367 138.1495 138.1189 138.1145 138.937 138.1013 138.921 138.447 138.172 138.317 138.21 138.35 138.96 138.85 136.1205 134.1276 134.1163 134.1145 134.1081 134.1039 134.985 134.680 134.31 134.307 134.262 134.198 134.125 136.1141
|
||||
com.jetbrains.php 140.2765 141.332 139.732 139.659 139.496 139.173 139.105 138.2502 138.2000.2262 138.1751 138.1806 138.1505 138.1161 138.826 136.1768 136.1672 134.1456 133.982 133.679 133.51 133.326 131.98 131.374 131.332 131.235 131.205 130.1639 130.1481 130.1176 129.91 129.814 129.672 129.362 127.67 127.100 126.334 123.66 122.875 121.62 121.390 121.215 121.12
|
||||
com.jetbrains.lang.ejs 131.17 131.12
|
||||
com.jetbrains.twig 133.51 130.1639
|
||||
|
||||
@@ -85,7 +85,7 @@ public class ApplicationImplTest extends LightPlatformTestCase {
|
||||
String msg = "acquireReadActionLock(" + l2 + "ms) vs runReadAction(" + l1 + "ms). Ratio: " + ratioPercent + "%";
|
||||
System.out.println(msg);
|
||||
if (Math.abs(ratioPercent) > 20) {
|
||||
return "Suspiciously different times for " + msg;
|
||||
return "Suspiciously different times for " + msg +" (in "+(ratioPercent<0 ? "my" : "Maxim's") +" favor)";
|
||||
}
|
||||
}
|
||||
catch (Throwable e) {
|
||||
@@ -415,7 +415,7 @@ public class ApplicationImplTest extends LightPlatformTestCase {
|
||||
assertFalse(application.tryRunReadAction(EmptyRunnable.getInstance()));
|
||||
assertTrue(application.isWriteActionInProgress());
|
||||
assertFalse(application.isWriteAccessAllowed());
|
||||
assertTrue(application.isWriteActionPending());
|
||||
assertFalse(application.isWriteActionPending());
|
||||
}
|
||||
|
||||
holdWrite.set(false);
|
||||
@@ -449,11 +449,12 @@ public class ApplicationImplTest extends LightPlatformTestCase {
|
||||
try {
|
||||
System.out.println("write lock acquired");
|
||||
writeAcquired.set(true);
|
||||
assertTrue(application.isWriteActionInProgress());
|
||||
assertTrue(application.isWriteAccessAllowed());
|
||||
assertTrue(application.isWriteActionPending());
|
||||
|
||||
while (holdWrite.get() && ok());
|
||||
while (holdWrite.get() && ok()) {
|
||||
assertTrue(application.isWriteActionInProgress());
|
||||
assertTrue(application.isWriteAccessAllowed());
|
||||
assertFalse(application.isWriteActionPending());
|
||||
}
|
||||
}
|
||||
finally {
|
||||
writeReleased.set(true);
|
||||
|
||||
+7
-4
@@ -117,6 +117,7 @@ public class SMTestRunnerResultsForm extends TestResultsPanel
|
||||
private AbstractTestProxy myLastSelected;
|
||||
private Alarm myUpdateQueue;
|
||||
private Set<Update> myRequests = Collections.synchronizedSet(new HashSet<Update>());
|
||||
private boolean myDisposed = false;
|
||||
|
||||
public SMTestRunnerResultsForm(@NotNull final JComponent console,
|
||||
final TestConsoleProperties consoleProperties) {
|
||||
@@ -337,13 +338,14 @@ public class SMTestRunnerResultsForm extends TestResultsPanel
|
||||
addToHistory(testsRoot, myProperties, this);
|
||||
}
|
||||
|
||||
private static void addToHistory(final SMTestProxy.SMRootTestProxy root,
|
||||
TestConsoleProperties consoleProperties,
|
||||
Disposable parentDisposable) {
|
||||
private void addToHistory(final SMTestProxy.SMRootTestProxy root,
|
||||
TestConsoleProperties consoleProperties,
|
||||
Disposable parentDisposable) {
|
||||
final RunProfile configuration = consoleProperties.getConfiguration();
|
||||
if (configuration instanceof RunConfiguration &&
|
||||
!(consoleProperties instanceof ImportedTestConsoleProperties) &&
|
||||
!ApplicationManager.getApplication().isUnitTestMode()) {
|
||||
!ApplicationManager.getApplication().isUnitTestMode() &&
|
||||
!myDisposed) {
|
||||
final MySaveHistoryTask backgroundable = new MySaveHistoryTask(consoleProperties, root, (RunConfiguration)configuration);
|
||||
final BackgroundableProcessIndicator processIndicator = new BackgroundableProcessIndicator(backgroundable);
|
||||
Disposer.register(parentDisposable, new Disposable() {
|
||||
@@ -532,6 +534,7 @@ public class SMTestRunnerResultsForm extends TestResultsPanel
|
||||
myShowStatisticForProxyHandler = null;
|
||||
myEventListeners.clear();
|
||||
myStatisticsPane.doDispose();
|
||||
myDisposed = true;
|
||||
}
|
||||
|
||||
public void showStatisticsForSelectedProxy() {
|
||||
|
||||
+7
@@ -3291,5 +3291,12 @@ public class StructuralSearchTest extends StructuralSearchTestCase {
|
||||
assertEquals("find declarations with only one field", 1, findMatchesCount(source, "int '_a;"));
|
||||
assertEquals("find all declarations", 4, findMatchesCount(source, "int '_a+;"));
|
||||
assertEquals("find all fields", 9, findMatchesCount(source, "int 'a+;"));
|
||||
|
||||
String source2 = "class ABC {" +
|
||||
" String u;" +
|
||||
" String s,t," +
|
||||
" void m() {}" +
|
||||
"}";
|
||||
assertEquals("find incomplete code", 1, findMatchesCount(source2, "'_a '_b{2,100};"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,6 +49,7 @@ public class LowMemoryWatcher {
|
||||
private static final Runnable ourJanitor = new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LOG.info("Low memory signal received.");
|
||||
try {
|
||||
for (LowMemoryWatcher watcher : ourInstances) {
|
||||
try {
|
||||
|
||||
@@ -96,8 +96,10 @@ public class Restarter {
|
||||
output.write("#!/bin/sh\n");
|
||||
for (int i = 0; i < beforeRestart.length; i++) {
|
||||
output.write(beforeRestart[i]);
|
||||
output.write(i == beforeRestart.length - 1 ? '\n' : ' ');
|
||||
if (i <= beforeRestart.length - 2) output.write(' ');
|
||||
if (i >= beforeRestart.length - 2) output.write('"');
|
||||
}
|
||||
output.write('\n');
|
||||
}
|
||||
finally {
|
||||
output.close();
|
||||
|
||||
@@ -118,7 +118,6 @@ public class PersistentHashMap<Key, Value> extends PersistentEnumeratorDelegate<
|
||||
private final LowMemoryWatcher myAppendCacheFlusher = LowMemoryWatcher.register(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
LOG.info("Low memory signal received. Dropping memory caches...");
|
||||
dropMemoryCaches();
|
||||
}
|
||||
});
|
||||
|
||||
+6
@@ -19,6 +19,7 @@ import com.intellij.codeInspection.ProblemDescriptor;
|
||||
import com.intellij.openapi.project.Project;
|
||||
import com.intellij.psi.*;
|
||||
import com.intellij.psi.util.PsiTreeUtil;
|
||||
import com.intellij.psi.util.PsiUtil;
|
||||
import com.siyeh.InspectionGadgetsBundle;
|
||||
import com.siyeh.ig.BaseInspection;
|
||||
import com.siyeh.ig.BaseInspectionVisitor;
|
||||
@@ -97,6 +98,11 @@ public class UtilityClassCanBeEnumInspection extends BaseInspection {
|
||||
return new UtilityClassCanBeEnumVisitor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldInspect(PsiFile file) {
|
||||
return PsiUtil.isLanguageLevel5OrHigher(file);
|
||||
}
|
||||
|
||||
private static class UtilityClassCanBeEnumVisitor extends BaseInspectionVisitor {
|
||||
|
||||
@Override
|
||||
|
||||
+5
@@ -42,6 +42,11 @@ public abstract class TestNGConfigurationProducer extends JavaRunConfigurationPr
|
||||
super(configurationType);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unused") //used in kotlin
|
||||
public TestNGConfigurationProducer() {
|
||||
super(TestNGConfigurationType.getInstance());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isConfigurationFromContext(TestNGConfiguration testNGConfiguration, ConfigurationContext context) {
|
||||
if (RunConfigurationProducer.getInstance(AbstractTestNGPatternConfigurationProducer.class).isMultipleElementsSelected(context)) {
|
||||
|
||||
+16
@@ -5,6 +5,7 @@ import com.intellij.execution.RunContentExecutor;
|
||||
import com.intellij.execution.configurations.GeneralCommandLine;
|
||||
import com.intellij.execution.process.OSProcessHandler;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.execution.process.ProcessListener;
|
||||
import com.intellij.icons.AllIcons;
|
||||
import com.intellij.openapi.actionSystem.AnActionEvent;
|
||||
import com.intellij.openapi.diagnostic.Logger;
|
||||
@@ -24,12 +25,14 @@ import com.jetbrains.edu.learning.courseFormat.UserTest;
|
||||
import com.jetbrains.edu.learning.editor.StudyEditor;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
public class StudyRunAction extends DumbAwareAction {
|
||||
private static final Logger LOG = Logger.getInstance(StudyRunAction.class.getName());
|
||||
public static final String ACTION_ID = "StudyRunAction";
|
||||
private ProcessHandler myHandler;
|
||||
private List<ProcessListener> myProcessListeners = new LinkedList<ProcessListener>();
|
||||
|
||||
public StudyRunAction() {
|
||||
super("Run File With Tests", "Run your code with tests", AllIcons.General.Run);
|
||||
@@ -75,6 +78,11 @@ public class StudyRunAction extends DumbAwareAction {
|
||||
return;
|
||||
}
|
||||
myHandler = new OSProcessHandler(process);
|
||||
|
||||
for (ProcessListener processListener : myProcessListeners) {
|
||||
myHandler.addProcessListener(processListener);
|
||||
}
|
||||
|
||||
final RunContentExecutor executor = StudyUtils.getExecutor(project, currentTask, myHandler);
|
||||
if (executor != null) {
|
||||
Disposer.register(project, executor);
|
||||
@@ -84,6 +92,14 @@ public class StudyRunAction extends DumbAwareAction {
|
||||
}
|
||||
}
|
||||
|
||||
public void addProcessListener(@NotNull final ProcessListener processListener) {
|
||||
myProcessListeners.add(processListener);
|
||||
}
|
||||
|
||||
public void removeProcessListener(@NotNull final ProcessListener processListener) {
|
||||
myProcessListeners.remove(processListener);
|
||||
}
|
||||
|
||||
public void actionPerformed(@NotNull AnActionEvent e) {
|
||||
final Project project = e.getProject();
|
||||
if (project != null) {
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.intellij.openapi.projectRoots.SdkType;
|
||||
import com.intellij.openapi.projectRoots.impl.ProjectJdkImpl;
|
||||
import com.intellij.openapi.roots.OrderRootType;
|
||||
import com.intellij.openapi.vfs.LocalFileSystem;
|
||||
import com.intellij.openapi.vfs.VirtualFile;
|
||||
import com.intellij.psi.stubs.StubUpdatingIndex;
|
||||
import com.intellij.util.indexing.FileBasedIndex;
|
||||
import com.jetbrains.python.codeInsight.userSkeletons.PyUserSkeletonsUtil;
|
||||
@@ -29,6 +30,7 @@ import com.jetbrains.python.psi.stubs.PyModuleNameIndex;
|
||||
import com.jetbrains.python.sdk.PySdkUpdater;
|
||||
import com.jetbrains.python.sdk.PythonSdkType;
|
||||
import org.jetbrains.annotations.NonNls;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
@@ -42,17 +44,17 @@ public class PythonMockSdk {
|
||||
private PythonMockSdk() {
|
||||
}
|
||||
|
||||
public static Sdk findOrCreate(String version) {
|
||||
public static Sdk findOrCreate(final String version, @NotNull final VirtualFile ... additionalRoots) {
|
||||
final List<Sdk> sdkList = ProjectJdkTable.getInstance().getSdksOfType(PythonSdkType.getInstance());
|
||||
for (Sdk sdk : sdkList) {
|
||||
if (sdk.getName().equals(MOCK_SDK_NAME + " " + version)) {
|
||||
return sdk;
|
||||
}
|
||||
}
|
||||
return create(version);
|
||||
return create(version, additionalRoots);
|
||||
}
|
||||
|
||||
public static Sdk create(final String version) {
|
||||
public static Sdk create(final String version, @NotNull final VirtualFile ... additionalRoots) {
|
||||
final String mock_path = PythonTestUtil.getTestDataPath() + "/MockSdk" + version + "/";
|
||||
|
||||
String sdkHome = new File(mock_path, "bin/python"+version).getPath();
|
||||
@@ -78,6 +80,10 @@ public class PythonMockSdk {
|
||||
String mock_stubs_path = mock_path + PythonSdkType.SKELETON_DIR_NAME;
|
||||
sdkModificator.addRoot(LocalFileSystem.getInstance().refreshAndFindFileByPath(mock_stubs_path), PythonSdkType.BUILTIN_ROOT_TYPE);
|
||||
|
||||
for (final VirtualFile root : additionalRoots) {
|
||||
sdkModificator.addRoot(root, OrderRootType.CLASSES);
|
||||
}
|
||||
|
||||
sdkModificator.commitChanges();
|
||||
|
||||
final FileBasedIndex index = FileBasedIndex.getInstance();
|
||||
|
||||
@@ -47,7 +47,15 @@ public class PyLightProjectDescriptor extends LightProjectDescriptor {
|
||||
|
||||
@Override
|
||||
public Sdk getSdk() {
|
||||
return PythonMockSdk.findOrCreate(myPythonVersion);
|
||||
return PythonMockSdk.findOrCreate(myPythonVersion, getAdditionalRoots());
|
||||
}
|
||||
|
||||
/**
|
||||
* @return additional roots to add to mock python
|
||||
*/
|
||||
@NotNull
|
||||
protected VirtualFile[] getAdditionalRoots() {
|
||||
return VirtualFile.EMPTY_ARRAY;
|
||||
}
|
||||
|
||||
protected void createLibrary(ModifiableRootModel model, final String name, final String path) {
|
||||
|
||||
Reference in New Issue
Block a user