Merge remote-tracking branch 'origin/master'

This commit is contained in:
Alexey Utkin
2017-04-05 15:21:26 +03:00
24 changed files with 264 additions and 269 deletions
+12 -13
View File
@@ -60,24 +60,23 @@ task setupJdk18(dependsOn: downloadJdk18) {
def unpackJdk(jdkArchive, outputDir) {
logger.info("Unpacking $jdkArchive to ${outputDir}")
file(outputDir).deleteDir()
if (!org.gradle.internal.os.OperatingSystem.current().isWindows()) {
exec { commandLine 'mkdir', '-p', outputDir }
exec { commandLine 'tar', 'xpf', "${jdkArchive.absolutePath}", '--directory', outputDir }
def jdkContents = file("${outputDir}/jdk/Contents")
if (org.gradle.internal.os.OperatingSystem.current().isMacOsX() && jdkContents.exists()) {
copy {
from fileTree(jdkContents)
into outputDir
}
jdkContents.deleteDir()
}
}
else {
def currentOs = org.gradle.internal.os.OperatingSystem.current()
if (currentOs.isWindows()) {
copy {
from tarTree(jdkArchive)
into outputDir
}
}
else {
exec { commandLine 'mkdir', '-p', outputDir }
exec { commandLine 'tar', 'xpf', "$jdkArchive.absolutePath", '--directory', outputDir }
def jdkContents = file("${outputDir}/jdk/Contents")
if (currentOs.isMacOsX() && jdkContents.exists()) {
jdkContents.listFiles().each { file ->
exec { commandLine 'mv', "$file.absolutePath", outputDir }
}
}
}
}
static def currentPlatformName() {
-111
View File
@@ -1,111 +0,0 @@
/*
* Copyright 2000-2017 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
includeTargets << new File("${guessHome(this)}/build/scripts/utils.gant")
requireProperty("out", "$home/out")
target(compile: "Compile project") {
ant.delete(failonerror: false) {
fileset(dir: "$home/reports")
fileset(dir: "$home/bin", includes: "*.hprof")
}
loadProject()
prepareOutputFolder()
if (System.getProperty("tests.only")) {
ant.delete(dir: "$home/out")
ant.unzip(src: "$home/out.zip", dest: "$home/out")
return
}
if (!isDefined("avoid.project.rebuild")) {
projectBuilder.cleanOutput()
projectBuilder.buildAll()
}
}
private pass(List<String> args, String prop) {
if (isDefined(prop)) {
args << "-D$prop=${p(prop)}"
}
}
target('run_tests': 'Run java tests') {
depends([compile])
def classpathFile = "$home/junit.classpath"
//todo[nik] currently runtime classpath includes path to JDKs from all modules in it so we need to manually exclude paths from JDK 1.6
List<String> testRuntimeClasspath = removeJdkJarFiles(projectBuilder.moduleRuntimeClasspath(findModule("community-main"), true))
testRuntimeClasspath << "${jdk8Home}/lib/tools.jar"
projectBuilder.info("Test runtime classpath=" + testRuntimeClasspath)
new File(classpathFile).text = testRuntimeClasspath.findAll({ new File((String)it).exists() }).join('\n')
List<String> bootstrapClasspath = removeJdkJarFiles(projectBuilder.moduleRuntimeClasspath(findModule("tests_bootstrap"), false))
bootstrapClasspath << "${jdk8Home}/lib/tools.jar"
projectBuilder.info("Bootstrap classpath=" + bootstrapClasspath)
testcases.each { testCase ->
List<String> jvmArgs = [
"-Dclasspath.file=${classpathFile}",
"-Didea.platform.prefix=Idea",
"-Dbootstrap.testcases=$testCase"
]
[
"idea.test.group",
"idea.test.patterns",
"idea.coverage.enabled.build",
"teamcity.tests.recentlyFailedTests.file"
].each { pass(jvmArgs, it) }
def tempDir = p("teamcity.build.tempDir", p("java.io.tmpdir"))
jvmArgs << "-Djava.io.tmpdir=${tempDir}"
jvmArgs << "-Dteamcity.build.tempDir=${tempDir}"
System.getProperties().entrySet().each {
if (it.key.startsWith("pass.")) {
def trimmed = it.key.substring("pass.".length());
jvmArgs << "-D${trimmed}=${it.value}"
};
}
jvmArgs.addAll(commonJvmArgsForTests())
if (isDefined("jvm_args")) {
jvmArgs.addAll(jvm_args)
}
projectBuilder.info("Starting JUnit $testCase, JVM options: $jvmArgs")
ant.junit(fork: "yes", showoutput: "true", logfailedtests: false) {
jvmArgs.each {
jvmarg(value: it)
}
classpath {
bootstrapClasspath.each {
pathelement(location: it)
}
}
test(name: 'com.intellij.tests.BootstrapTests')
}
}
}
target('default' : "Run all tests") {
depends([compile, run_tests])
}
-39
View File
@@ -1,39 +0,0 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
def home = guessHome(this)
includeTargets << new File("${home}/build/scripts/common_tests.gant")
def args = []
def mem = System.getProperty("test.jvm.memory")
if (mem != null) {
args.addAll(mem.split())
}
else {
args += [
"-Xmx450m",
"-Dsun.io.useCanonCaches=false"
]
}
args << "-Djna.nosys=true"
setProperty("jvm_args", args)
setProperty("testcases", ["com.intellij.AllTests"])
@@ -25,6 +25,7 @@ import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.debugger.jdi.VirtualMachineProxyImpl;
import com.intellij.debugger.requests.ClassPrepareRequestor;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.project.Project;
@@ -203,18 +204,26 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
return new JavaSourcePosition(sourcePosition, location.declaringType(), method, lambdaOrdinal);
}
private static class JavaSourcePosition extends RemappedSourcePosition {
public static class JavaSourcePosition extends RemappedSourcePosition {
private final String myExpectedClassName;
private final String myExpectedMethodName;
private final int myLambdaOrdinal;
public JavaSourcePosition(SourcePosition delegate, ReferenceType declaringType, Method method, int lambdaOrdinal) {
public JavaSourcePosition(@NotNull SourcePosition delegate, ReferenceType declaringType, Method method, int lambdaOrdinal) {
super(delegate);
myExpectedClassName = declaringType != null ? declaringType.name() : null;
myExpectedMethodName = method != null ? method.name() : null;
myLambdaOrdinal = lambdaOrdinal;
}
public JavaSourcePosition(@NotNull SourcePosition delegate, int lambdaOrdinal) {
super(delegate);
assert lambdaOrdinal > -1;
myExpectedClassName = null;
myExpectedMethodName = "lambda$"; // fake lambda name
myLambdaOrdinal = lambdaOrdinal;
}
private PsiElement remapElement(PsiElement element) {
String name = JVMNameUtil.getClassVMName(getEnclosingClass(element));
if (name != null && !name.equals(myExpectedClassName)) {
@@ -244,37 +253,34 @@ public class PositionManagerImpl implements PositionManager, MultiRequestPositio
@Override
public SourcePosition mapDelegate(final SourcePosition original) {
return ApplicationManager.getApplication().runReadAction(new Computable<SourcePosition>() {
@Override
public SourcePosition compute() {
PsiFile file = original.getFile();
int line = original.getLine();
if (DebuggerUtilsEx.isLambdaName(myExpectedMethodName) && myLambdaOrdinal > -1) {
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(original, true);
return ReadAction.compute(() -> {
PsiFile file = original.getFile();
int line = original.getLine();
if (DebuggerUtilsEx.isLambdaName(myExpectedMethodName) && myLambdaOrdinal > -1) {
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(original, true);
Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
if (document == null || line >= document.getLineCount()) {
return original;
}
if (myLambdaOrdinal < lambdas.size()) {
PsiElement firstElem = DebuggerUtilsEx.getFirstElementOnTheLine(lambdas.get(myLambdaOrdinal), document, line);
if (firstElem != null) {
return SourcePosition.createFromElement(firstElem);
}
Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
if (document == null || line >= document.getLineCount()) {
return original;
}
if (myLambdaOrdinal < lambdas.size()) {
PsiElement firstElem = DebuggerUtilsEx.getFirstElementOnTheLine(lambdas.get(myLambdaOrdinal), document, line);
if (firstElem != null) {
return SourcePosition.createFromElement(firstElem);
}
}
else {
// There may be more than one class/method code on the line, so we need to find out the correct place
for (PsiElement elem : getLineElements(file, line)) {
PsiElement remappedElement = remapElement(elem);
if (remappedElement != null) {
if (remappedElement.getTextOffset() <= original.getOffset()) break;
return SourcePosition.createFromElement(remappedElement);
}
}
}
return original;
}
else {
// There may be more than one class/method code on the line, so we need to find out the correct place
for (PsiElement elem : getLineElements(file, line)) {
PsiElement remappedElement = remapElement(elem);
if (remappedElement != null) {
if (remappedElement.getTextOffset() <= original.getOffset()) break;
return SourcePosition.createFromElement(remappedElement);
}
}
}
return original;
});
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2015 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -28,7 +28,7 @@ abstract class RemappedSourcePosition extends SourcePosition {
private SourcePosition myDelegate;
private boolean myMapped = false;
public RemappedSourcePosition(SourcePosition delegate) {
public RemappedSourcePosition(@NotNull SourcePosition delegate) {
myDelegate = delegate;
}
@@ -761,6 +761,20 @@ public abstract class DebuggerUtilsEx extends DebuggerUtils {
return null;
}
@Nullable
public static SourcePosition toSourcePosition(@Nullable XSourcePosition position, Project project) {
if (position != null) {
if (position instanceof JavaXSourcePosition) {
return ((JavaXSourcePosition)position).mySourcePosition;
}
PsiFile psiFile = PsiManager.getInstance(project).findFile(position.getFile());
if (psiFile != null) {
return SourcePosition.createFromLine(psiFile, position.getLine());
}
}
return null;
}
private static class JavaXSourcePosition implements XSourcePosition, ExecutionPointHighlighter.HighlighterProvider {
private final SourcePosition mySourcePosition;
@NotNull private final VirtualFile myFile;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -23,6 +23,7 @@ import com.intellij.debugger.engine.JVMNameUtil;
import com.intellij.debugger.engine.events.DebuggerCommandImpl;
import com.intellij.debugger.engine.requests.RequestManagerImpl;
import com.intellij.debugger.impl.DebuggerContextImpl;
import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.editor.Document;
@@ -235,14 +236,9 @@ public abstract class BreakpointWithHighlighter<P extends JavaBreakpointProperti
@Override
public void reload() {
ApplicationManager.getApplication().assertReadAccessAllowed();
XSourcePosition position = myXBreakpoint.getSourcePosition();
PsiFile psiFile = getPsiFile();
if (position != null && psiFile != null) {
mySourcePosition = SourcePosition.createFromLine(psiFile, position.getLine());
reload(psiFile);
}
else {
mySourcePosition = null;
mySourcePosition = DebuggerUtilsEx.toSourcePosition(myXBreakpoint.getSourcePosition(), myProject);
if (mySourcePosition != null) {
reload(mySourcePosition.getFile());
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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,9 +15,8 @@
*/
package com.intellij.debugger.ui.breakpoints;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.Computable;
import com.intellij.psi.PsiClass;
import com.intellij.xdebugger.XDebuggerUtil;
import com.intellij.xdebugger.XSourcePosition;
@@ -47,13 +46,13 @@ public abstract class JavaBreakpointTypeBase<T extends JavaBreakpointProperties>
return true;
}
@Nullable
@NotNull
@Override
public final XBreakpointCustomPropertiesPanel<XBreakpoint<T>> createCustomRightPropertiesPanel(@NotNull Project project) {
return new JavaBreakpointFiltersPanel<>(project);
}
@Nullable
@NotNull
@Override
public final XDebuggerEditorsProvider getEditorsProvider(@NotNull XBreakpoint<T> breakpoint, @NotNull Project project) {
return new JavaDebuggerEditorsProvider();
@@ -64,14 +63,9 @@ public abstract class JavaBreakpointTypeBase<T extends JavaBreakpointProperties>
public XSourcePosition getSourcePosition(@NotNull XBreakpoint<T> breakpoint) {
Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
if (javaBreakpoint != null) {
final PsiClass aClass = javaBreakpoint.getPsiClass();
PsiClass aClass = javaBreakpoint.getPsiClass();
if (aClass != null) {
return ApplicationManager.getApplication().runReadAction(new Computable<XSourcePosition>() {
@Override
public XSourcePosition compute() {
return XDebuggerUtil.getInstance().createPositionByElement(aClass);
}
});
return ReadAction.compute(() -> XDebuggerUtil.getInstance().createPositionByElement(aClass));
}
}
return null;
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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,6 +18,7 @@ package com.intellij.debugger.ui.breakpoints;
import com.intellij.debugger.DebuggerBundle;
import com.intellij.debugger.HelpID;
import com.intellij.debugger.SourcePosition;
import com.intellij.debugger.engine.PositionManagerImpl;
import com.intellij.debugger.impl.DebuggerUtilsEx;
import com.intellij.icons.AllIcons;
import com.intellij.openapi.editor.Document;
@@ -33,6 +34,7 @@ import com.intellij.xdebugger.breakpoints.XBreakpoint;
import com.intellij.xdebugger.breakpoints.XLineBreakpoint;
import com.intellij.xdebugger.breakpoints.ui.XBreakpointGroupingRule;
import com.intellij.xdebugger.impl.XSourcePositionImpl;
import com.intellij.xdebugger.impl.breakpoints.XLineBreakpointImpl;
import org.jetbrains.annotations.Nls;
import org.jetbrains.annotations.NonNls;
import org.jetbrains.annotations.NotNull;
@@ -99,12 +101,11 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
@NotNull
@Override
public List<JavaBreakpointVariant> computeVariants(@NotNull Project project, @NotNull XSourcePosition position) {
PsiFile file = PsiManager.getInstance(project).findFile(position.getFile());
if (file == null) {
SourcePosition pos = DebuggerUtilsEx.toSourcePosition(position, project);
if (pos == null) {
return Collections.emptyList();
}
SourcePosition pos = SourcePosition.createFromLine(file, position.getLine());
List<PsiLambdaExpression> lambdas = DebuggerUtilsEx.collectLambdas(pos, true);
if (lambdas.isEmpty()) {
return Collections.emptyList();
@@ -116,7 +117,7 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
return Collections.emptyList();
}
Document document = PsiDocumentManager.getInstance(file.getProject()).getDocument(file);
Document document = PsiDocumentManager.getInstance(project).getDocument(pos.getFile());
if (document == null) {
return Collections.emptyList();
}
@@ -246,22 +247,49 @@ public class JavaLineBreakpointType extends JavaLineBreakpointTypeBase<JavaLineB
@Nullable
@Override
public TextRange getHighlightRange(XLineBreakpoint<JavaLineBreakpointProperties> breakpoint) {
JavaLineBreakpointProperties properties = breakpoint.getProperties();
if (properties != null) {
Integer ordinal = properties.getLambdaOrdinal();
if (ordinal != null) {
Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
if (javaBreakpoint instanceof LineBreakpoint) {
PsiElement method = getContainingMethod((LineBreakpoint)javaBreakpoint);
if (method != null) {
return method.getTextRange();
}
Integer ordinal = getLambdaOrdinal(breakpoint);
if (ordinal != null) {
Breakpoint javaBreakpoint = BreakpointManager.getJavaBreakpoint(breakpoint);
if (javaBreakpoint instanceof LineBreakpoint) {
PsiElement method = getContainingMethod((LineBreakpoint)javaBreakpoint);
if (method != null) {
return method.getTextRange();
}
}
}
return null;
}
@Override
public XSourcePosition getSourcePosition(@NotNull XBreakpoint<JavaLineBreakpointProperties> breakpoint) {
Integer ordinal = getLambdaOrdinal(breakpoint);
if (ordinal != null && ordinal > -1) {
SourcePosition linePosition = createLineSourcePosition((XLineBreakpointImpl)breakpoint);
if (linePosition != null) {
return DebuggerUtilsEx.toXSourcePosition(new PositionManagerImpl.JavaSourcePosition(linePosition, ordinal));
}
}
return null;
}
@Nullable
private static Integer getLambdaOrdinal(XBreakpoint<JavaLineBreakpointProperties> breakpoint) {
JavaLineBreakpointProperties properties = breakpoint.getProperties();
return properties != null ? properties.getLambdaOrdinal() : null;
}
@Nullable
private static SourcePosition createLineSourcePosition(XLineBreakpointImpl breakpoint) {
VirtualFile file = breakpoint.getFile();
if (file != null) {
PsiFile psiFile = PsiManager.getInstance(breakpoint.getProject()).findFile(file);
if (psiFile != null) {
return SourcePosition.createFromLine(psiFile, breakpoint.getLine());
}
}
return null;
}
@Override
public boolean canBeHitInOtherPlaces() {
return true; // line breakpoints could be hit in other versions of the same classes
@@ -68,7 +68,8 @@ public class ActionHint {
* @return true if this ActionHint checks that some action should be present
* or false if it checks that some action should be absent
*/
boolean shouldPresent() {
@SuppressWarnings("WeakerAccess") // used in kotlin
public boolean shouldPresent() {
return myShouldPresent;
}
@@ -225,6 +225,6 @@ public class DarculaCheckBoxUI extends MetalCheckBoxUI {
@Override
public Icon getDefaultIcon() {
return JBUI.scale(EmptyIcon.create(20)).asUIResource();
return EmptyIcon.create(JBUI.scale(20)).asUIResource();
}
}
@@ -3017,8 +3017,6 @@ public final class EditorImpl extends UserDataHolderBase implements EditorEx, Hi
type == VERTICAL_SCROLLBAR_LEFT
? JBScrollPane.Flip.HORIZONTAL
: null);
JScrollBar vsb = myScrollPane.getVerticalScrollBar();
if (vsb != null) vsb.setOpaque(true);
myScrollingModel.scrollHorizontally(currentHorOffset);
}
@@ -33,6 +33,7 @@ import com.intellij.openapi.util.Disposer;
import com.intellij.openapi.util.ModificationTracker;
import com.intellij.openapi.util.Pair;
import com.intellij.openapi.util.ShutDownTracker;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.wm.AppIconScheme;
import com.intellij.openapi.wm.IdeFrame;
import com.intellij.openapi.wm.WindowManager;
@@ -488,7 +489,7 @@ public class DumbServiceImpl extends DumbService implements Disposable, Modifica
Disposer.dispose(prevTask);
}
if (PowerSaveMode.isEnabled()) {
if (PowerSaveMode.isEnabled() && Registry.is("pause.indexing.in.power.save.mode")) {
indicator.setText("Indexing paused during Power Save mode...");
runWhenPowerSaveModeChanges(() -> result.complete(pollTaskQueue()));
completeWhenProjectClosed(result);
@@ -38,6 +38,7 @@ import javax.swing.tree.TreePath;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.atomic.AtomicReference;
import java.util.function.Consumer;
import static java.util.Collections.emptyList;
import static java.util.Collections.unmodifiableList;
@@ -137,15 +138,68 @@ public final class AsyncTreeModel extends AbstractTreeModel implements Disposabl
return model instanceof Navigatable ? resolve(((Navigatable)model).prevTreePath(path, object)) : rejectedPromise();
}
private Promise<TreePath> resolve(Promise<TreePath> promise) {
@NotNull
public Promise<TreePath> resolve(TreePath path) {
AsyncPromise<TreePath> async = new AsyncPromise<>();
promise.rejected(error -> processor.foreground.invokeLaterIfNeeded(() -> async.setError(error)));
promise.done(result -> processor.foreground.invokeLaterIfNeeded(() -> sync(async, result)));
processor.foreground.invokeLaterIfNeeded(() -> resolve(async, path, entry -> async.setResult(entry)));
return async;
}
private void sync(AsyncPromise<TreePath> promise, TreePath path) {
promise.setResult(path);//todo load
private Promise<TreePath> resolve(Promise<TreePath> promise) {
AsyncPromise<TreePath> async = new AsyncPromise<>();
promise.rejected(error -> processor.foreground.invokeLaterIfNeeded(() -> async.setError(error)));
promise.done(result -> processor.foreground.invokeLaterIfNeeded(() -> resolve(async, result, entry -> async.setResult(entry))));
return async;
}
private void resolve(AsyncPromise<TreePath> async, TreePath path, Consumer<Entry<Object>> consumer) {
if (path == null) {
async.setError("path is null");
return;
}
Object object = path.getLastPathComponent();
if (object == null) {
async.setError("path is wrong");
return;
}
if (!consume(consumer, tree.findEntry(object))) {
TreePath parent = path.getParentPath();
if (parent == null) {
promiseRootEntry().done(entry -> {
if (entry == null) {
async.setError("root is null");
}
else if (object != entry.getNode()) {
async.setError("root is wrong");
}
else {
consumer.accept(entry);
}
});
}
else {
resolve(async, parent, entry -> processor.process(new Command<List<Pair<Object, Boolean>>>() {
private CmdGetChildren command = new CmdGetChildren("Sync children", entry, false);
@Override
public List<Pair<Object, Boolean>> get() {
return command.get();
}
@Override
public void accept(List<Pair<Object, Boolean>> children) {
command.accept(children);
if (!consume(consumer, tree.findEntry(object))) async.setError("path not found");
}
}));
}
}
}
private static boolean consume(Consumer<Entry<Object>> consumer, Entry<Object> entry) {
if (entry == null) return false;
consumer.accept(entry);
return true;
}
@Override
@@ -278,17 +332,26 @@ public final class AsyncTreeModel extends AbstractTreeModel implements Disposabl
Object object = entry.getNode();
if (model.isLeaf(object)) return null;
if (model instanceof ChildrenProvider) {
//noinspection unchecked
ChildrenProvider<Object> provider = (ChildrenProvider)model;
ArrayList<Pair<Object, Boolean>> children = new ArrayList<>();
provider.getChildren(object).forEach(child -> add(children, child));
return unmodifiableList(children);
}
int count = model.getChildCount(object);
if (count <= 0) return emptyList();
ArrayList<Pair<Object, Boolean>> children = new ArrayList<>(count);
for (int i = 0; i < count; i++) {
Object child = model.getChild(object, i);
children.add(Pair.create(child, model.isLeaf(child)));
}
for (int i = 0; i < count; i++) add(children, model.getChild(object, i));
return unmodifiableList(children);
}
private void add(List<Pair<Object, Boolean>> children, Object child) {
if (child != null) children.add(Pair.create(child, model.isLeaf(child)));
}
@Override
public void accept(List<Pair<Object, Boolean>> children) {
Object object = entry.getNode();
@@ -0,0 +1,39 @@
/*
* Copyright 2000-2017 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ui.tree;
import org.jetbrains.annotations.NotNull;
import javax.swing.tree.TreeModel;
import java.util.List;
/**
* This is an extension for the {@link TreeModel} which is supported by {@link AsyncTreeModel}.
* It is intended to simplify implementing of a couple corresponding methods in a model.
*
* @see TreeModel#getChildCount(Object)
* @see TreeModel#getChild(Object, int)
*
* @author Sergey.Malenkov
*/
public interface ChildrenProvider<T> {
/**
* @param parent a tree node
* @return all children of the specified parent node
*/
@NotNull
List<T> getChildren(Object parent);
}
@@ -449,7 +449,7 @@ command.find.next=Find Next
command.find.previous=Find Previous
command.select.all=Select All
message.no.targets.available=No targets available in this context
title.popup.select.target=Select Target
title.popup.select.target=Select In
title.popup.recent.files=Recent Files
action.split.vertically=Split _Vertically
action.split.horizontally=Split Hori_zontally
@@ -966,6 +966,9 @@ dumb.aware.run.configurations.description=Enable executing run configurations in
select.run.configuration.from.context=true
select.run.configuration.from.context.description=Select run configuration when run from context (gutter icon, popup menu)
pause.indexing.in.power.save.mode=false
pause.indexing.in.power.save.mode.description=Whether indexing activities should be paused during Power Save Mode to reduce power consumption. If enabled, code insight functionality won't be available after changes to project model and after project opening.
ide.run.dashboard=false
ide.run.dashboard.description=Enable Run Dashboard tool window
ide.run.dashboard.restartRequired=true
@@ -17,6 +17,7 @@
package com.intellij.util.ui;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import javax.swing.plaf.UIResource;
@@ -115,7 +116,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
@Override
public EmptyIcon withJBUIPreScaled(boolean preScaled) {
if (myUseCache && isJBUIPreScaled() != preScaled) {
Integer key = key(width, height, isJBUIPreScaled());
Integer key = key(width, height);
if (key != null) cache.remove(key); // rather useless to keep it in cache
return create(width, height, preScaled);
}
@@ -123,7 +124,7 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
}
private static EmptyIcon create(int width, int height, boolean preScaled) {
Integer key = key(width, height, preScaled);
Integer key = key(width, height);
EmptyIcon icon = key != null ? cache.get(key) : null;
if (icon == null) {
icon = new EmptyIcon(width, height, true);
@@ -133,8 +134,9 @@ public class EmptyIcon extends JBUI.CachingScalableJBIcon<EmptyIcon> {
return icon;
}
private static Integer key(int width, int height, boolean preScaled) {
return width == height && width < 129 ? preScaled ? width : JBUI.scale(width) : null;
@Nullable
private static Integer key(int width, int height) {
return width == height && width < 129 ? width : null;
}
@Override
@@ -20,6 +20,7 @@ import com.intellij.openapi.vcs.RepositoryLocation;
import com.intellij.openapi.vcs.changes.Change;
import com.intellij.openapi.vcs.versionBrowser.CommittedChangeList;
import com.intellij.util.containers.MultiMap;
import gnu.trove.THashSet;
import java.util.ArrayList;
import java.util.Collection;
@@ -68,12 +69,13 @@ public abstract class VcsCommittedListsZipperAdapter implements VcsCommittedList
return lists.get(0);
}
final CommittedChangeList result = lists.get(0);
Set<Change> processed = new THashSet<>(result.getChanges());
for (int i = 1; i < lists.size(); i++) {
final CommittedChangeList list = lists.get(i);
for (Change change : list.getChanges()) {
final Collection<Change> resultChanges = result.getChanges();
if (! resultChanges.contains(change)) {
resultChanges.add(change);
for (Change change : lists.get(i).getChanges()) {
if (!processed.add(change)) {
result.getChanges().add(change);
}
}
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -76,10 +76,10 @@ public abstract class XLineBreakpointType<P extends XBreakpointProperties> exten
}
/**
* Source position for line breakpoint is determined by its file and line
* Source position for line breakpoint by default is determined by its file and line
*/
@Override
public final XSourcePosition getSourcePosition(@NotNull XBreakpoint<P> breakpoint) {
public XSourcePosition getSourcePosition(@NotNull XBreakpoint<P> breakpoint) {
return null;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2016 JetBrains s.r.o.
* Copyright 2000-2017 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.
@@ -17,8 +17,6 @@ package com.intellij.xdebugger.impl.breakpoints;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.application.ApplicationManager;
import com.intellij.openapi.application.ReadAction;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.editor.Document;
import com.intellij.openapi.editor.colors.EditorColorsManager;
import com.intellij.openapi.editor.colors.EditorColorsScheme;
@@ -148,7 +146,7 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak
}
@Nullable
private VirtualFile getFile() {
public VirtualFile getFile() {
return VirtualFileManager.getInstance().findFileByUrl(getFileUrl());
}
@@ -191,13 +189,12 @@ public class XLineBreakpointImpl<P extends XBreakpointProperties> extends XBreak
@Override
public XSourcePosition getSourcePosition() {
if (mySourcePosition != null) {
return mySourcePosition;
}
mySourcePosition = super.getSourcePosition();
if (mySourcePosition == null) {
new ReadAction() {
@Override
protected void run(@NotNull Result result) {
mySourcePosition = XDebuggerUtil.getInstance().createPosition(getFile(), getLine());
}
}.execute();
mySourcePosition = XDebuggerUtil.getInstance().createPosition(getFile(), getLine());
}
return mySourcePosition;
}
@@ -16,6 +16,7 @@
package org.jetbrains.idea.maven.dom;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vfs.JarFileSystem;
import com.intellij.openapi.vfs.LocalFileSystem;
import com.intellij.openapi.vfs.VirtualFile;
@@ -58,7 +59,7 @@ public class MavenPluginDomUtil {
String groupId = pluginElement.getGroupId().getStringValue();
String artifactId = pluginElement.getArtifactId().getStringValue();
String version = pluginElement.getVersion().getStringValue();
if (version == null) {
if (StringUtil.isEmpty(version)) {
MavenProject mavenProject = findMavenProject(element);
if (mavenProject != null) {
for (MavenPlugin plugin : mavenProject.getPlugins()) {
+1 -1
View File
@@ -38,7 +38,7 @@
</target>
<!--
<target name="test" depends="init">
<call_gant script="${project.home}/build/scripts/tests.gant"/>
<call_gant script="${project.home}/build/scripts/tests_in_community.gant"/>
</target>
-->
@@ -224,6 +224,7 @@ public class BreadcrumbsXmlWrapper implements Disposable {
breadcrumbs.onHover(this::itemHovered);
breadcrumbs.onSelect(this::itemSelected);
breadcrumbs.setFont(getEditorFont(myEditor));
breadcrumbs.setBorder(BorderFactory.createEmptyBorder(above ? 2 : 0, 0, above ? 0 : 2, 0));
myComponent.setOpaque(false);
myComponent.add(BorderLayout.CENTER, breadcrumbs);