Merge remote-tracking branch 'origin/master'

This commit is contained in:
Eugene Zhuravlev
2017-03-30 14:51:28 +02:00
18 changed files with 93 additions and 98 deletions
@@ -15,6 +15,7 @@
*/
package com.intellij.debugger.engine;
import com.intellij.debugger.EvaluatingComputable;
import com.intellij.debugger.SourcePosition;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.debugger.impl.DebuggerUtilsEx;
@@ -25,6 +26,7 @@ import com.intellij.psi.util.InheritanceUtil;
import com.intellij.util.Range;
import com.sun.jdi.Location;
import com.sun.jdi.Method;
import com.sun.jdi.ObjectReference;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -65,7 +67,12 @@ public class BasicStepMethodFilter implements NamedMethodFilter {
return myTargetMethodName;
}
public boolean locationMatches(final DebugProcessImpl process, final Location location) throws EvaluateException {
public boolean locationMatches(DebugProcessImpl process, Location location) throws EvaluateException {
return locationMatches(process, location, () -> null);
}
public boolean locationMatches(DebugProcessImpl process, Location location, @NotNull EvaluatingComputable<ObjectReference> thisProvider)
throws EvaluateException {
Method method = location.method();
String name = method.name();
if (!myTargetMethodName.equals(name)) {
@@ -96,7 +103,15 @@ public class BasicStepMethodFilter implements NamedMethodFilter {
if (method.isBridge()) { // skip bridge methods
return false;
}
return DebuggerUtilsEx.isAssignableFrom(myDeclaringClassName.getName(process), location.declaringType());
String declaringClassNameName = myDeclaringClassName.getName(process);
boolean res = DebuggerUtilsEx.isAssignableFrom(declaringClassNameName, location.declaringType());
if (!res && !method.isStatic()) {
ObjectReference thisObject = thisProvider.compute();
if (thisObject != null) {
res = DebuggerUtilsEx.isAssignableFrom(declaringClassNameName, thisObject.referenceType());
}
}
return res;
}
private static boolean signatureMatches(Method method, final String expectedSignature) throws EvaluateException {
@@ -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,13 +15,22 @@
*/
package com.intellij.debugger.engine;
import com.intellij.debugger.EvaluatingComputable;
import com.intellij.debugger.engine.evaluation.EvaluateException;
import com.intellij.util.Range;
import com.sun.jdi.Location;
import com.sun.jdi.ObjectReference;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
public interface MethodFilter {
boolean locationMatches(DebugProcessImpl process, Location location) throws EvaluateException;
default boolean locationMatches(DebugProcessImpl process, Location location, @NotNull EvaluatingComputable<ObjectReference> thisProvider)
throws EvaluateException {
return locationMatches(process, location);
}
@Nullable Range<Integer> getCallingExpressionLines();
default int onReached(SuspendContextImpl context, RequestHint hint) {
@@ -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.
@@ -192,7 +192,7 @@ public class RequestHint {
if (myMethodFilter != null &&
frameProxy != null &&
!(myMethodFilter instanceof BreakpointStepMethodFilter) &&
myMethodFilter.locationMatches(context.getDebugProcess(), frameProxy.location()) &&
myMethodFilter.locationMatches(context.getDebugProcess(), frameProxy.location(), frameProxy::thisObject) &&
!isTheSameFrame(context)
) {
myTargetMethodMatched = true;
@@ -118,35 +118,35 @@ public class ExternalProjectsManager implements PersistentStateComponent<Externa
}
public void init() {
synchronized (isInitializationWasStarted) {
if (isInitializationWasStarted.getAndSet(true)) return;
if (isInitializationWasStarted.getAndSet(true)) return;
myWatcher = new ExternalSystemProjectsWatcher(myProject);
myWatcher.start();
myWatcher = new ExternalSystemProjectsWatcher(myProject);
myWatcher.start();
// load external projects data
ExternalProjectsDataStorage.getInstance(myProject).load();
myRunManagerListener.attach();
// load external projects data
ExternalProjectsDataStorage.getInstance(myProject).load();
myRunManagerListener.attach();
// init shortcuts manager
myShortcutsManager.init();
for (ExternalSystemManager<?, ?, ?, ?, ?> systemManager : ExternalSystemApiUtil.getAllManagers()) {
final Collection<ExternalProjectInfo> externalProjects =
ExternalProjectsDataStorage.getInstance(myProject).list(systemManager.getSystemId());
for (ExternalProjectInfo externalProject : externalProjects) {
if (externalProject.getExternalProjectStructure() == null) continue;
Collection<DataNode<TaskData>> taskData =
ExternalSystemApiUtil.findAllRecursively(externalProject.getExternalProjectStructure(), TASK);
myShortcutsManager.scheduleKeymapUpdate(taskData);
}
if (!externalProjects.isEmpty()) {
myShortcutsManager.scheduleRunConfigurationKeymapUpdate(systemManager.getSystemId());
}
// init shortcuts manager
myShortcutsManager.init();
for (ExternalSystemManager<?, ?, ?, ?, ?> systemManager : ExternalSystemApiUtil.getAllManagers()) {
final Collection<ExternalProjectInfo> externalProjects =
ExternalProjectsDataStorage.getInstance(myProject).list(systemManager.getSystemId());
for (ExternalProjectInfo externalProject : externalProjects) {
if (externalProject.getExternalProjectStructure() == null) continue;
Collection<DataNode<TaskData>> taskData =
ExternalSystemApiUtil.findAllRecursively(externalProject.getExternalProjectStructure(), TASK);
myShortcutsManager.scheduleKeymapUpdate(taskData);
}
// init task activation info
myTaskActivator.init();
if (!externalProjects.isEmpty()) {
myShortcutsManager.scheduleRunConfigurationKeymapUpdate(systemManager.getSystemId());
}
}
// init task activation info
myTaskActivator.init();
synchronized (isInitializationFinished) {
isInitializationFinished.set(true);
ApplicationManager.getApplication().executeOnPooledThread(() -> {
myPostInitializationActivities.run();
@@ -156,10 +156,13 @@ public class ExternalProjectsManager implements PersistentStateComponent<Externa
}
public void runWhenInitialized(Runnable runnable) {
if (isInitializationFinished.get()){
ApplicationManager.getApplication().executeOnPooledThread(runnable);
} else {
myPostInitializationActivities.add(runnable);
synchronized(isInitializationFinished) {
if (isInitializationFinished.get()) {
ApplicationManager.getApplication().executeOnPooledThread(runnable);
}
else {
myPostInitializationActivities.add(runnable);
}
}
}
@@ -17,10 +17,22 @@ package com.intellij.openapi.externalSystem.util;
import com.intellij.util.SmartList;
public class CompositeRunnable extends SmartList<Runnable> implements Runnable {
import java.util.List;
public class CompositeRunnable implements Runnable {
private List<Runnable> list = new SmartList<>();
public boolean add(Runnable runnable) {
return list.add(runnable);
}
public void clear() {
list = new SmartList<>();
}
@Override
public void run() {
for (Runnable runnable : this) {
for (Runnable runnable : list) {
runnable.run();
}
}
@@ -129,7 +129,7 @@ public class DiffManagerImpl extends DiffManager implements PersistentStateCompo
if (!ENABLE_FILES.value(myProperties) || !ENABLE_FOLDERS.value(myProperties) || !ENABLE_MERGE.value(myProperties)) {
DiffTool[] embeddableTools = {
INTERNAL_DIFF,
new MergeTool(),
MergeTool.INSTANCE,
BinaryDiffTool.INSTANCE
};
standardTools = new DiffTool[]{
@@ -138,7 +138,7 @@ public class DiffManagerImpl extends DiffManager implements PersistentStateCompo
ExtMergeFiles.INSTANCE,
new MultiLevelDiffTool(Arrays.asList(embeddableTools)),
INTERNAL_DIFF,
new MergeTool(),
MergeTool.INSTANCE,
BinaryDiffTool.INSTANCE
};
}
@@ -148,7 +148,7 @@ public class DiffManagerImpl extends DiffManager implements PersistentStateCompo
ExtCompareFiles.INSTANCE,
ExtMergeFiles.INSTANCE,
INTERNAL_DIFF,
new MergeTool(),
MergeTool.INSTANCE,
BinaryDiffTool.INSTANCE
};
}
@@ -32,6 +32,8 @@ import java.awt.*;
public class MergeTool implements DiffTool {
public static final Logger LOG = Logger.getInstance(MergeTool.class);
public static final MergeTool INSTANCE = new MergeTool();
public void show(DiffRequest data) {
if (data instanceof MergeRequestImpl) {
showDialog((MergeRequestImpl)data);
@@ -1232,8 +1232,8 @@ action.ChangesView.NewChangeList.text=New Changelist
action.ChangesView.NewChangeList.description=Create new changelist
action.ChangesView.Revert.text=_Revert
action.ChangesView.Revert.description=Revert selected changes
action.ChangesView.RemoveChangeList.text=Delete Changelist
action.ChangesView.RemoveChangeList.description=Remove changelist and move all changes to {0}
action.ChangesView.RemoveChangeList.text=Delete Changelists
action.ChangesView.RemoveChangeList.description=Remove changelists and move all changes to {0}
action.ChangesView.SetDefault.text=Set Active Changelist
action.ChangesView.SetDefault.description=Set changelist to which new changes are placed by default
action.ChangesView.Move.text=Move to Another Changelist...
@@ -162,12 +162,4 @@ public abstract class AbstractTestProxy extends CompositePrintable {
public String getLocationUrl() {
return null;
}
@Deprecated
public interface AssertEqualsDiffChain {
DiffHyperlink getPrevious();
DiffHyperlink getCurrent();
DiffHyperlink getNext();
void setCurrent(DiffHyperlink provider);
}
}
@@ -23,7 +23,6 @@ package com.intellij.execution.testframework.stacktrace;
import com.intellij.execution.ExecutionBundle;
import com.intellij.execution.filters.HyperlinkInfo;
import com.intellij.execution.filters.HyperlinkInfoBase;
import com.intellij.execution.testframework.AbstractTestProxy;
import com.intellij.execution.testframework.Printable;
import com.intellij.execution.testframework.Printer;
import com.intellij.execution.testframework.actions.ViewAssertEqualsDiffAction;
@@ -77,23 +76,6 @@ public class DiffHyperlink implements Printable {
return filePath == null ? null : filePath.replace(File.separatorChar, '/');
}
/**
* Use {@link ViewAssertEqualsDiffAction#openDiff(DataContext, DiffHyperlink)}
*/
@Deprecated
public void openDiff(Project project) {
ViewAssertEqualsDiffAction.openDiff(DataManager.getInstance().getDataContext(), this);
}
/**
* Use {@link ViewAssertEqualsDiffAction#openDiff(DataContext, DiffHyperlink)}
*/
@Deprecated
public void openMultiDiff(final Project project,
final AbstractTestProxy.AssertEqualsDiffChain chain) {
ViewAssertEqualsDiffAction.openDiff(DataManager.getInstance().getDataContext(), this);
}
protected String getTitle() {
return ExecutionBundle.message("strings.equal.failed.dialog.title");
}
@@ -54,6 +54,7 @@ public class RemoveChangeListAction extends AnAction implements DumbAware {
presentation.setDescription(ArrayUtil.isEmpty(e.getData(VcsDataKeys.CHANGES)) ? presentation.getText() : getDescription(changeLists));
}
@NotNull
private static String getDescription(@Nullable ChangeList[] changeLists) {
return ActionsBundle.message("action.ChangesView.RemoveChangeList.description",
containsActiveChangelist(changeLists) ? "another changelist" : "active one");
@@ -17,7 +17,6 @@ package com.intellij.openapi.vcs.changes.actions.migrate;
import com.intellij.diff.DiffDialogHints;
import com.intellij.diff.DiffManager;
import com.intellij.diff.chains.DiffRequestChain;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.diff.DiffRequest;
import com.intellij.openapi.diff.DiffTool;
@@ -39,16 +38,15 @@ public class MigrateDiffTool implements DiffTool {
@Override
public void show(DiffRequest request) {
DiffRequestChain newChain = MigrateToNewDiffUtil.convertRequestChain(request);
com.intellij.diff.requests.DiffRequest newRequest = MigrateToNewDiffUtil.convertRequest(request);
WindowWrapper.Mode mode = FrameDiffTool.shouldOpenDialog(request.getHints()) ? WindowWrapper.Mode.MODAL : WindowWrapper.Mode.FRAME;
DiffManager.getInstance().showDiff(request.getProject(), newChain, new DiffDialogHints(mode));
DiffManager.getInstance().showDiff(request.getProject(), newRequest, new DiffDialogHints(mode));
}
@Override
public boolean canShow(DiffRequest request) {
if (request instanceof MergeRequest) return false;
if (request.getContents().length != 2) return false;
if (request.getHints().contains(MigrateToNewDiffUtil.DO_NOT_TRY_MIGRATE)) return false;
if (request.getOnOkRunnable() != null) return false;
if (!DiffManagerImpl.INTERNAL_DIFF.canShow(request) && !BinaryDiffTool.INSTANCE.canShow(request)) return false;
for (DiffTool tool : DiffManagerImpl.getInstanceEx().getAdditionTools()) {
@@ -1,9 +1,7 @@
package com.intellij.openapi.vcs.changes.actions.migrate;
import com.intellij.diff.chains.DiffRequestChain;
import com.intellij.diff.chains.DiffRequestProducer;
import com.intellij.diff.chains.DiffRequestProducerException;
import com.intellij.diff.chains.SimpleDiffRequestChain;
import com.intellij.diff.contents.DiffContent;
import com.intellij.diff.contents.DocumentContentImpl;
import com.intellij.diff.contents.EmptyContent;
@@ -13,7 +11,6 @@ import com.intellij.diff.requests.ErrorDiffRequest;
import com.intellij.diff.requests.SimpleDiffRequest;
import com.intellij.diff.util.DiffUserDataKeysEx;
import com.intellij.diff.util.LineCol;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.diff.DiffNavigationContext;
import com.intellij.openapi.diff.DiffTool;
import com.intellij.openapi.editor.Document;
@@ -34,16 +31,6 @@ import java.util.List;
import static com.intellij.openapi.util.text.StringUtil.notNullize;
public class MigrateToNewDiffUtil {
private static final Logger LOG = Logger.getInstance(MigrateToNewDiffUtil.class);
@NonNls public static final Object DO_NOT_TRY_MIGRATE = "doNotTryMigrate";
@NotNull
public static DiffRequestChain convertRequestChain(@NotNull com.intellij.openapi.diff.DiffRequest oldRequest) {
DiffRequest request = convertRequest(oldRequest);
return new SimpleDiffRequestChain(request);
}
@NotNull
public static DiffRequest convertRequest(@NotNull com.intellij.openapi.diff.DiffRequest oldRequest) {
DiffRequest request = convertRequestFair(oldRequest);
@@ -431,7 +431,7 @@ public class ApplyPatchDifferentiatedDialog extends DialogWrapper {
private void addNotificationAndWarn(@NotNull String errorMessage) {
LOG.warn(errorMessage);
myErrorNotificationPanel.text(errorMessage);
myErrorNotificationPanel.setText(errorMessage);
myErrorNotificationPanel.setVisible(true);
}
@@ -68,10 +68,10 @@ public class GitPushTargetPanel extends PushTargetPanel<GitPushTarget> {
private static final Comparator<GitRemoteBranch> REMOTE_BRANCH_COMPARATOR = new MyRemoteBranchComparator();
private static final String SEPARATOR = " : ";
private static final Color NEW_BRANCH_LABEL_FG = new JBColor(0x00b53d, 0x6ba65d);
private static final Color NEW_BRANCH_SELECTION_LABEL_FG = UIUtil.getTreeSelectionForeground();
private static final Color NEW_BRANCH_LABEL_SELECTION_FG = UIUtil.getTreeSelectionForeground();
private static final Color NEW_BRANCH_LABEL_BG = new JBColor(0xebfcf1, 0x313b32);
private static final Color NEW_BRANCH_SELECTION_LABEL__BG =
new JBColor(ColorUtil.toAlpha(NEW_BRANCH_SELECTION_LABEL_FG, 20), ColorUtil.toAlpha(NEW_BRANCH_SELECTION_LABEL_FG, 30));
private static final Color NEW_BRANCH_LABEL_SELECTION_BG =
new JBColor(ColorUtil.toAlpha(NEW_BRANCH_LABEL_SELECTION_FG, 20), ColorUtil.toAlpha(NEW_BRANCH_LABEL_SELECTION_FG, 30));
private static final RelativeFont NEW_BRANCH_LABEL_FONT = RelativeFont.TINY.small();
private static final TextIcon NEW_BRANCH_LABEL = new TextIcon("New", NEW_BRANCH_LABEL_FG, NEW_BRANCH_LABEL_BG, 0);
@@ -282,8 +282,8 @@ public class GitPushTargetPanel extends PushTargetPanel<GitPushTarget> {
NEW_BRANCH_LABEL.setInsets(JBUI.insets(2));
NEW_BRANCH_LABEL.setRound(JBUI.scale(4));
NEW_BRANCH_LABEL.setFont(NEW_BRANCH_LABEL_FONT.derive(renderer.getFont()));
NEW_BRANCH_LABEL.setForeground(isSelected ? NEW_BRANCH_SELECTION_LABEL_FG : NEW_BRANCH_LABEL_FG);
NEW_BRANCH_LABEL.setBackground(isSelected ? NEW_BRANCH_SELECTION_LABEL__BG : NEW_BRANCH_LABEL_BG);
NEW_BRANCH_LABEL.setForeground(isSelected ? NEW_BRANCH_LABEL_SELECTION_FG : NEW_BRANCH_LABEL_FG);
NEW_BRANCH_LABEL.setBackground(isSelected ? NEW_BRANCH_LABEL_SELECTION_BG : NEW_BRANCH_LABEL_BG);
renderer.setIcon(NEW_BRANCH_LABEL);
}
}
@@ -69,7 +69,7 @@ public class GradleExtensionsSettings implements PersistentStateComponent<Gradle
public Settings getState() {
// cleanup GradleExtensions entries created by previous version from workspace file
// TODO remove PersistentStateComponent implementation in future version
return myState;
return new Settings();
}
@Override
@@ -103,7 +103,7 @@ USE_LIB_COPY = SUPPORT_GEVENT and \
(IS_PY3K and sys.version_info[1] >= 3))
INTERACTIVE_MODE_AVAILABLE = os.getenv('DISPLAY') is not None
INTERACTIVE_MODE_AVAILABLE = sys.platform in ('darwin', 'win32') or os.getenv('DISPLAY') is not None
def protect_libraries_from_patching():
@@ -17,7 +17,6 @@ package com.intellij.psi.formatter;
import com.intellij.lang.html.HTMLLanguage;
import com.intellij.lang.injection.InjectedLanguageManager;
import com.intellij.openapi.application.PathManager;
import com.intellij.openapi.command.WriteCommandAction;
import com.intellij.openapi.fileEditor.FileEditorManager;
import com.intellij.openapi.vfs.VirtualFile;
@@ -37,7 +36,7 @@ import org.jetbrains.annotations.NotNull;
import java.util.Arrays;
public class HtmlFormatterTest extends FormatterTestCase {
public class HtmlFormatterTest extends XmlFormatterTestBase {
@Override
protected String getBasePath() {
return "psi/formatter/html";
@@ -263,11 +262,6 @@ public class HtmlFormatterTest extends FormatterTestCase {
doTestPerformance("html reformat with range", 5000, null);
}
@Override
protected String getTestDataPath() {
return PathManager.getHomePath() + "/community/xml/tests/testData";
}
public void doTestPerformance(@NotNull String message, int expectedTime, OptionsSetup optionsSetup) throws Exception {
CodeStyleSettings settings = new CodeStyleSettings();
if (optionsSetup != null) optionsSetup.setupOptions(settings);