From c7515522b9d250807a67c30a4191fd7d3955b3b1 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 9 Feb 2015 10:23:07 +0100 Subject: [PATCH 01/20] fix assertReadAccessAllowed --- .../debugger-ui/src/org/jetbrains/debugger/SourceInfo.java | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java index 0375bee877da..4bfce6088d09 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java @@ -23,15 +23,12 @@ public class SourceInfo extends XSourcePositionWrapper { } XSourcePosition position; - // binary file will be decompiled, must be under read action - AccessToken token = file.getFileType().isBinary() ? ReadAction.start() : null; + AccessToken token = ReadAction.start(); try { position = XDebuggerUtil.getInstance().createPosition(file, line); } finally { - if (token != null) { - token.finish(); - } + token.finish(); } return position == null ? null : new SourceInfo(functionName, position, column); } From dfbb64add25e677be6835ac5e5cdfb0cdd4edc55 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Fri, 6 Feb 2015 22:24:59 +0300 Subject: [PATCH 02/20] diff: refresh after changes update --- .../vcs/changes/CacheChangeProcessor.java | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java index 285d50edaaa5..36e17bf286d0 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java @@ -15,9 +15,17 @@ */ package com.intellij.openapi.vcs.changes; +import com.intellij.diff.chains.DiffRequestProducerException; +import com.intellij.diff.impl.DiffRequestProcessor; +import com.intellij.diff.requests.*; +import com.intellij.diff.tools.util.SoftHardCacheMap; +import com.intellij.diff.util.DiffUserDataKeys; +import com.intellij.diff.util.DiffUserDataKeysEx.ScrollToPolicy; +import com.intellij.diff.util.WaitingBackgroundableTaskExecutor; import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.application.ModalityState; import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.progress.ProcessCanceledException; import com.intellij.openapi.progress.ProgressIndicator; @@ -25,16 +33,9 @@ import com.intellij.openapi.progress.util.ProgressWindow; import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; -import com.intellij.diff.chains.DiffRequestProducerException; -import com.intellij.diff.impl.DiffRequestProcessor; -import com.intellij.diff.requests.*; -import com.intellij.diff.tools.util.SoftHardCacheMap; -import org.jetbrains.annotations.CalledInBackground; -import com.intellij.diff.util.DiffUserDataKeys; -import com.intellij.diff.util.DiffUserDataKeysEx.ScrollToPolicy; -import com.intellij.diff.util.WaitingBackgroundableTaskExecutor; import com.intellij.openapi.vcs.changes.actions.diff.ChangeDiffRequestProducer; import com.intellij.util.containers.Convertor; +import org.jetbrains.annotations.CalledInBackground; import org.jetbrains.annotations.Contract; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -121,6 +122,12 @@ public abstract class CacheChangeProcessor extends DiffRequestProcessor { } if (change.getBeforeRevision() instanceof FakeRevision || change.getAfterRevision() instanceof FakeRevision) { + ChangeListManager.getInstance(myProject).invokeAfterUpdate(new Runnable() { + @Override + public void run() { + refresh(); + } + }, InvokeAfterUpdateMode.BACKGROUND_CANCELLABLE, "", ModalityState.current()); return new LoadingDiffRequest(ChangeDiffRequestProducer.getRequestTitle(change)); } From d1f1b537a524c520c6909672b53b331a64eb8b64 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Sat, 7 Feb 2015 08:24:58 +0300 Subject: [PATCH 03/20] diff: fix title painting * revert TextField due to visual issues on Windows/GTK LAF --- .../diff-impl/src/com/intellij/diff/util/DiffUtil.java | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java index a54a57ede2de..5388b0079cb9 100644 --- a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java @@ -360,13 +360,7 @@ public class DiffUtil { @NotNull private static JComponent createTitlePanel(@NotNull String title) { if (title.isEmpty()) title = " "; // do not collapse - JTextField field = new JTextField(title); - field.setEditable(false); - field.setBorder(null); - field.setFont(UIUtil.getLabelFont()); - field.setBackground(UIUtil.TRANSPARENT_COLOR); - field.setOpaque(false); - return field; + return new JLabel(title); // TODO: allow to copy text } @NotNull From 6b36705f742acd54c96437c40ac72a6649de4bd6 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Sat, 7 Feb 2015 08:36:56 +0300 Subject: [PATCH 04/20] diff: close diff dialog on Ctrl+F4 --- .../src/com/intellij/diff/impl/DiffWindowBase.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/platform/diff-impl/src/com/intellij/diff/impl/DiffWindowBase.java b/platform/diff-impl/src/com/intellij/diff/impl/DiffWindowBase.java index 2f5b81d48dd9..38b0b01cd3df 100644 --- a/platform/diff-impl/src/com/intellij/diff/impl/DiffWindowBase.java +++ b/platform/diff-impl/src/com/intellij/diff/impl/DiffWindowBase.java @@ -18,6 +18,10 @@ package com.intellij.diff.impl; import com.intellij.diff.DiffDialogHints; import com.intellij.diff.util.DiffUserDataKeys; import com.intellij.diff.util.DiffUtil; +import com.intellij.openapi.actionSystem.AnActionEvent; +import com.intellij.openapi.actionSystem.CustomShortcutSet; +import com.intellij.openapi.keymap.KeymapManager; +import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import com.intellij.openapi.ui.WindowWrapper; import com.intellij.openapi.ui.WindowWrapperBuilder; @@ -61,6 +65,13 @@ public abstract class DiffWindowBase { myProcessor.init(); myWrapper.setImage(ImageLoader.loadFromResource("/diff/Diff.png")); Disposer.register(myWrapper, myProcessor); + + new DumbAwareAction() { + public void actionPerformed(final AnActionEvent e) { + myWrapper.close(); + } + }.registerCustomShortcutSet(new CustomShortcutSet(KeymapManager.getInstance().getActiveKeymap().getShortcuts("CloseContent")), + myProcessor.getComponent()); } public void show() { From ef4138e799851080c2b1da18f976e6b37859167b Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Sat, 7 Feb 2015 11:41:56 +0300 Subject: [PATCH 05/20] vcs: move VCS-related changes into separate 'folder' in keymap settings * split them into few groups inside --- .../src/idea/PlatformActions.xml | 32 +++--- .../src/idea/VcsActions.xml | 98 ++++++++++++++++++- .../openapi/vcs/impl/VcsKeymapExtension.java | 68 ++++++++++--- 3 files changed, 173 insertions(+), 25 deletions(-) diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 509812cac808..3809aa2c9fd2 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -154,20 +154,28 @@ - - - + + - - - + + + + - - - + + + - + + + + + + + + + @@ -673,6 +681,8 @@ + + diff --git a/platform/platform-resources/src/idea/VcsActions.xml b/platform/platform-resources/src/idea/VcsActions.xml index 7e291944633e..918e582009ea 100644 --- a/platform/platform-resources/src/idea/VcsActions.xml +++ b/platform/platform-resources/src/idea/VcsActions.xml @@ -1,7 +1,7 @@ + icon="AllIcons.Vcs.History"/> @@ -280,5 +280,101 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsKeymapExtension.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsKeymapExtension.java index c5d4a074ea87..373b53edbec9 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsKeymapExtension.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/impl/VcsKeymapExtension.java @@ -15,10 +15,7 @@ */ package com.intellij.openapi.vcs.impl; -import com.intellij.openapi.actionSystem.ActionGroup; -import com.intellij.openapi.actionSystem.ActionManager; -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.DefaultActionGroup; +import com.intellij.openapi.actionSystem.*; import com.intellij.openapi.keymap.KeyMapBundle; import com.intellij.openapi.keymap.KeymapExtension; import com.intellij.openapi.keymap.KeymapGroup; @@ -27,6 +24,7 @@ import com.intellij.openapi.keymap.impl.ui.ActionsTreeUtil; import com.intellij.openapi.keymap.impl.ui.Group; import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Condition; +import com.intellij.util.containers.ContainerUtil; /** * @author yole @@ -34,17 +32,61 @@ import com.intellij.openapi.util.Condition; public class VcsKeymapExtension implements KeymapExtension { public KeymapGroup createGroup(final Condition filtered, final Project project) { KeymapGroup result = KeymapGroupFactory.getInstance().createGroup(KeyMapBundle.message("version.control.group.title")); - ActionGroup versionControls = (ActionGroup)ActionManager.getInstance().getActionOrStub("VcsGroup"); - AnAction[] mainMenuTopGroups = versionControls instanceof DefaultActionGroup - ? ((DefaultActionGroup)versionControls).getChildActionsOrStubs() - : versionControls.getChildren(null); - for (AnAction action : mainMenuTopGroups) { - Group subGroup = ActionsTreeUtil.createGroup((ActionGroup)action, false, filtered); - if (subGroup.getSize() > 0) { - result.addGroup(subGroup); - } + AnAction[] versionControlsGroups = getActions("VcsGroup"); + AnAction[] keymapGroups = getActions("Vcs.KeymapGroup"); + + for (AnAction action : ContainerUtil.concat(versionControlsGroups, keymapGroups)) { + addAction(result, action, filtered, false); } + + AnAction[] generalActions = getActions("VcsGeneral.KeymapGroup"); + for (AnAction action : generalActions) { + addAction(result, action, filtered, true); + } + + if (result instanceof Group) { + ((Group)result).normalizeSeparators(); + } + return result; } + + private static void addAction(KeymapGroup result, AnAction action, Condition filtered, boolean forceNonPopup) { + if (action instanceof ActionGroup) { + if (forceNonPopup) { + AnAction[] actions = getActions((ActionGroup)action); + for (AnAction childAction : actions) { + addAction(result, childAction, filtered, true); + } + } + else { + Group subGroup = ActionsTreeUtil.createGroup((ActionGroup)action, false, filtered); + if (subGroup.getSize() > 0) { + result.addGroup(subGroup); + } + } + } + else if (action instanceof Separator) { + if (result instanceof Group) { + ((Group)result).addSeparator(); + } + } + else { + if (filtered == null || filtered.value(action)) { + String id = action instanceof ActionStub ? ((ActionStub)action).getId() : ActionManager.getInstance().getId(action); + result.addActionId(id); + } + } + } + + private static AnAction[] getActions(String actionGroup) { + return getActions((ActionGroup)ActionManager.getInstance().getActionOrStub(actionGroup)); + } + + private static AnAction[] getActions(ActionGroup group) { + return group instanceof DefaultActionGroup + ? ((DefaultActionGroup)group).getChildActionsOrStubs() + : group.getChildren(null); + } } \ No newline at end of file From 3335c220b6b2f41972f5bb1b608612fd6a247df9 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Sat, 7 Feb 2015 12:27:07 +0300 Subject: [PATCH 06/20] diff: make DirDiff shortcuts assignable * remove hardcoded alt-left / alt-right shortcuts, as they are causing conflicts --- .../openapi/diff/impl/dir/actions/DirDiffAction.java | 11 +++++++++-- .../openapi/diff/impl/dir/actions/EnableEqual.java | 12 +++--------- .../openapi/diff/impl/dir/actions/EnableLeft.java | 12 +++--------- .../diff/impl/dir/actions/EnableNotEqual.java | 12 +++--------- .../openapi/diff/impl/dir/actions/EnableRight.java | 12 +++--------- .../diff/impl/dir/actions/RefreshDirDiffAction.java | 4 +++- .../diff/impl/dir/actions/SynchronizeDiff.java | 6 +++--- .../platform-resources/src/idea/PlatformActions.xml | 6 ++++++ 8 files changed, 33 insertions(+), 42 deletions(-) diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/DirDiffAction.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/DirDiffAction.java index 97b16d6994d6..f7a79838fd0a 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/DirDiffAction.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/DirDiffAction.java @@ -17,8 +17,10 @@ package com.intellij.openapi.diff.impl.dir.actions; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.ShortcutProvider; +import com.intellij.openapi.actionSystem.ShortcutSet; import com.intellij.openapi.actionSystem.ToggleAction; import com.intellij.openapi.diff.impl.dir.DirDiffTableModel; +import org.jetbrains.annotations.Nullable; import javax.swing.*; @@ -28,8 +30,7 @@ import javax.swing.*; public abstract class DirDiffAction extends ToggleAction implements ShortcutProvider { private final DirDiffTableModel myModel; - protected DirDiffAction(DirDiffTableModel model, String name, Icon icon) { - super(name, name, icon); + protected DirDiffAction(DirDiffTableModel model) { myModel = model; } @@ -69,4 +70,10 @@ public abstract class DirDiffAction extends ToggleAction implements ShortcutProv super.update(e); e.getPresentation().setEnabled(!getModel().isUpdating()); } + + @Nullable + @Override + public ShortcutSet getShortcut() { + return getShortcutSet(); + } } diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableEqual.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableEqual.java index 00405dcd4a6a..b12a8709b0df 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableEqual.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableEqual.java @@ -15,10 +15,8 @@ */ package com.intellij.openapi.diff.impl.dir.actions; -import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CustomShortcutSet; -import com.intellij.openapi.actionSystem.ShortcutSet; +import com.intellij.openapi.actionSystem.EmptyAction; import com.intellij.openapi.diff.impl.dir.DirDiffTableModel; /** @@ -26,7 +24,8 @@ import com.intellij.openapi.diff.impl.dir.DirDiffTableModel; */ public class EnableEqual extends DirDiffAction { public EnableEqual(DirDiffTableModel model) { - super(model, "Show equal files", AllIcons.Vcs.Equal); + super(model); + EmptyAction.setupAction(this, "DirDiffMenu.EnableEqual", null); } @Override @@ -37,9 +36,4 @@ public class EnableEqual extends DirDiffAction { public void updateState(boolean state) { getModel().setShowEqual(state); } - - @Override - public ShortcutSet getShortcut() { - return CustomShortcutSet.fromString("alt EQUALS"); - } } diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableLeft.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableLeft.java index 33968cd40fdd..b735215cbd7d 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableLeft.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableLeft.java @@ -15,10 +15,8 @@ */ package com.intellij.openapi.diff.impl.dir.actions; -import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CustomShortcutSet; -import com.intellij.openapi.actionSystem.ShortcutSet; +import com.intellij.openapi.actionSystem.EmptyAction; import com.intellij.openapi.diff.impl.dir.DirDiffTableModel; /** @@ -26,7 +24,8 @@ import com.intellij.openapi.diff.impl.dir.DirDiffTableModel; */ public class EnableLeft extends DirDiffAction { protected EnableLeft(DirDiffTableModel model) { - super(model, "Show new files on left side", AllIcons.Vcs.Arrow_right); + super(model); + EmptyAction.setupAction(this, "DirDiffMenu.EnableLeft", null); } @Override @@ -37,9 +36,4 @@ public class EnableLeft extends DirDiffAction { public void updateState(boolean state) { getModel().setShowNewOnSource(state); } - - @Override - public ShortcutSet getShortcut() { - return CustomShortcutSet.fromString("alt RIGHT"); - } } diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableNotEqual.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableNotEqual.java index 41e14ac51e5d..5057eb65476a 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableNotEqual.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableNotEqual.java @@ -15,10 +15,8 @@ */ package com.intellij.openapi.diff.impl.dir.actions; -import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CustomShortcutSet; -import com.intellij.openapi.actionSystem.ShortcutSet; +import com.intellij.openapi.actionSystem.EmptyAction; import com.intellij.openapi.diff.impl.dir.DirDiffTableModel; /** @@ -26,7 +24,8 @@ import com.intellij.openapi.diff.impl.dir.DirDiffTableModel; */ public class EnableNotEqual extends DirDiffAction { protected EnableNotEqual(DirDiffTableModel model) { - super(model, "Show difference", AllIcons.Vcs.Not_equal); + super(model); + EmptyAction.setupAction(this, "DirDiffMenu.EnableNotEqual", null); } @Override @@ -37,9 +36,4 @@ public class EnableNotEqual extends DirDiffAction { public void updateState(boolean state) { getModel().setShowDifferent(state); } - - @Override - public ShortcutSet getShortcut() { - return CustomShortcutSet.fromString("alt MINUS"); - } } diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableRight.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableRight.java index ced857a02532..0e6830f307fc 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableRight.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/EnableRight.java @@ -15,10 +15,8 @@ */ package com.intellij.openapi.diff.impl.dir.actions; -import com.intellij.icons.AllIcons; import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.actionSystem.CustomShortcutSet; -import com.intellij.openapi.actionSystem.ShortcutSet; +import com.intellij.openapi.actionSystem.EmptyAction; import com.intellij.openapi.diff.impl.dir.DirDiffTableModel; /** @@ -26,7 +24,8 @@ import com.intellij.openapi.diff.impl.dir.DirDiffTableModel; */ public class EnableRight extends DirDiffAction { protected EnableRight(DirDiffTableModel model) { - super(model, "Show new files on right side", AllIcons.Vcs.Arrow_left); + super(model); + EmptyAction.setupAction(this, "DirDiffMenu.EnableRight", null); } @Override @@ -37,9 +36,4 @@ public class EnableRight extends DirDiffAction { public void updateState(boolean state) { getModel().setShowNewOnTarget(state); } - - @Override - public ShortcutSet getShortcut() { - return CustomShortcutSet.fromString("alt LEFT"); - } } diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/RefreshDirDiffAction.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/RefreshDirDiffAction.java index ac1161335f5b..beee5bfd481d 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/RefreshDirDiffAction.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/RefreshDirDiffAction.java @@ -29,7 +29,9 @@ public class RefreshDirDiffAction extends DirDiffAction { public static final CustomShortcutSet REFRESH_SHORTCUT = CustomShortcutSet.fromString(SystemInfo.isMac ? "meta R" : "F5"); public RefreshDirDiffAction(DirDiffTableModel model) { - super(model, "Refresh", PlatformIcons.SYNCHRONIZE_ICON); + super(model); + getTemplatePresentation().setText("Refresh"); + getTemplatePresentation().setIcon(PlatformIcons.SYNCHRONIZE_ICON); } @Override diff --git a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/SynchronizeDiff.java b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/SynchronizeDiff.java index 571bbd06521f..ed41423e7845 100644 --- a/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/SynchronizeDiff.java +++ b/platform/diff-impl/src/com/intellij/openapi/diff/impl/dir/actions/SynchronizeDiff.java @@ -35,9 +35,9 @@ public class SynchronizeDiff extends DirDiffAction { private final boolean mySelectedOnly; public SynchronizeDiff(DirDiffTableModel model, boolean selectedOnly) { - super(model, - selectedOnly ? "Synchronize Selected" : "Synchronize All", - selectedOnly ? AllIcons.Actions.Resume : AllIcons.Actions.Rerun); + super(model); + getTemplatePresentation().setText(selectedOnly ? "Synchronize Selected" : "Synchronize All"); + getTemplatePresentation().setIcon(selectedOnly ? AllIcons.Actions.Resume : AllIcons.Actions.Rerun); mySelectedOnly = selectedOnly; } diff --git a/platform/platform-resources/src/idea/PlatformActions.xml b/platform/platform-resources/src/idea/PlatformActions.xml index 3809aa2c9fd2..32408b9aa945 100644 --- a/platform/platform-resources/src/idea/PlatformActions.xml +++ b/platform/platform-resources/src/idea/PlatformActions.xml @@ -681,6 +681,12 @@ + + + + + + From 5f43ceace0c04bc29e318abac84517a4ca03e99f Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Sat, 7 Feb 2015 14:50:14 +0300 Subject: [PATCH 07/20] diff: do not destroy range too early --- .../src/com/intellij/diff/tools/simple/SimpleDiffChange.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java index 05d2b03eb278..b57b92a08819 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java @@ -233,8 +233,6 @@ public class SimpleDiffChange { if (!myIsValid) return; - destroyHighlighter(); - final Document document1 = myEditor1.getDocument(); final Document document2 = myEditor2.getDocument(); From 0fb89a9e5d2053e9653abc5a4baa2906e12ba887 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Sat, 7 Feb 2015 14:37:38 +0300 Subject: [PATCH 08/20] diff: change gutter action depending on Ctrl/Shift modifier --- .../diff/tools/simple/DiffOperation.java | 103 ---------- .../diff/tools/simple/SimpleDiffChange.java | 183 ++++++++++++++---- .../diff/tools/simple/SimpleDiffViewer.java | 67 ++++++- .../src/com/intellij/diff/util/DiffIcons.java | 2 +- 4 files changed, 214 insertions(+), 141 deletions(-) delete mode 100644 platform/diff-impl/src/com/intellij/diff/tools/simple/DiffOperation.java diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/DiffOperation.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/DiffOperation.java deleted file mode 100644 index 46b3e05b06cb..000000000000 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/DiffOperation.java +++ /dev/null @@ -1,103 +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. - */ -package com.intellij.diff.tools.simple; - -import com.intellij.openapi.actionSystem.AnAction; -import com.intellij.openapi.actionSystem.AnActionEvent; -import com.intellij.openapi.editor.Editor; -import com.intellij.openapi.editor.markup.GutterIconRenderer; -import com.intellij.openapi.editor.markup.HighlighterLayer; -import com.intellij.openapi.editor.markup.HighlighterTargetArea; -import com.intellij.openapi.editor.markup.RangeHighlighter; -import com.intellij.openapi.project.DumbAwareAction; -import org.jetbrains.annotations.CalledInAwt; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; - -import javax.swing.*; - -public abstract class DiffOperation extends GutterIconRenderer { - @NotNull - public static RangeHighlighter createHighlighter(@NotNull Editor editor, @NotNull DiffOperation operation, int offset) { - RangeHighlighter highlighter = editor.getMarkupModel().addRangeHighlighter(offset, offset, - HighlighterLayer.ADDITIONAL_SYNTAX, - null, - HighlighterTargetArea.LINES_IN_RANGE); - highlighter.setGutterIconRenderer(operation); - return highlighter; - } - - // - // Impl - // - - @NotNull private final String myTooltip; - @NotNull private final Icon myIcon; - - @NotNull private final AnAction myAction; - - public DiffOperation(@NotNull String tooltip, - @NotNull Icon gutterIcon) { - myTooltip = tooltip; - myIcon = gutterIcon; - myAction = createAction(); - } - - @CalledInAwt - public abstract void perform(@NotNull AnActionEvent e); - - @Override - @NotNull - public Icon getIcon() { - return myIcon; - } - - @Override - @NotNull - public String getTooltipText() { - return myTooltip; - } - - public boolean isNavigateAction() { - return true; - } - - @Nullable - @Override - public AnAction getClickAction() { - return myAction; - } - - @NotNull - private AnAction createAction() { - return new DumbAwareAction() { - @Override - public void actionPerformed(@NotNull AnActionEvent e) { - perform(e); - } - }; - } - - @Override - public boolean equals(Object obj) { - return obj == this; - } - - @Override - public int hashCode() { - return System.identityHashCode(this); - } -} diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java index b57b92a08819..84f60ef3e6d4 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java @@ -18,21 +18,25 @@ package com.intellij.diff.tools.simple; import com.intellij.diff.fragments.DiffFragment; import com.intellij.diff.fragments.LineFragment; import com.intellij.diff.util.*; +import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.ex.EditorEx; -import com.intellij.openapi.editor.markup.RangeHighlighter; -import com.intellij.openapi.editor.markup.SeparatorPlacement; +import com.intellij.openapi.editor.markup.*; +import com.intellij.openapi.project.DumbAwareAction; import com.intellij.openapi.project.Project; import org.jetbrains.annotations.CalledWithWriteLock; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; +import javax.swing.*; import java.util.ArrayList; import java.util.List; public class SimpleDiffChange { + @NotNull private final SimpleDiffViewer myViewer; + @NotNull private final LineFragment myFragment; @Nullable private final List myInnerFragments; @@ -40,17 +44,20 @@ public class SimpleDiffChange { @Nullable private final EditorEx myEditor2; @NotNull private final List myHighlighters = new ArrayList(); - @NotNull private final List myActionHighlighters = new ArrayList(); + @NotNull private final List myOperations = new ArrayList(); private boolean myIsValid = true; private int[] myLineStartShifts = new int[2]; private int[] myLineEndShifts = new int[2]; // TODO: adjust color from inner fragments - configurable - public SimpleDiffChange(@NotNull LineFragment fragment, + public SimpleDiffChange(@NotNull SimpleDiffViewer viewer, + @NotNull LineFragment fragment, @Nullable EditorEx editor1, @Nullable EditorEx editor2, boolean inlineHighlight) { + myViewer = viewer; + myFragment = fragment; myInnerFragments = inlineHighlight ? fragment.getInnerFragments() : null; @@ -78,10 +85,10 @@ public class SimpleDiffChange { } myHighlighters.clear(); - for (RangeHighlighter highlighter : myActionHighlighters) { - highlighter.dispose(); + for (MyGutterOperation operation : myOperations) { + operation.destroy(); } - myActionHighlighters.clear(); + myOperations.clear(); } private void doInstallHighlighterSimple() { @@ -103,14 +110,8 @@ public class SimpleDiffChange { private void doInstallActionHighlighters() { if (myEditor1 != null && myEditor2 != null) { - if (DiffUtil.isEditable(myEditor1)) { - MyReplaceOperation operation = new MyReplaceOperation(Side.LEFT); - myActionHighlighters.add(DiffOperation.createHighlighter(myEditor2, operation, myFragment.getStartOffset2())); - } - if (DiffUtil.isEditable(myEditor2)) { - MyReplaceOperation operation = new MyReplaceOperation(Side.RIGHT); - myActionHighlighters.add(DiffOperation.createHighlighter(myEditor1, operation, myFragment.getStartOffset1())); - } + myOperations.add(createOperation(Side.LEFT)); + myOperations.add(createOperation(Side.RIGHT)); } } @@ -152,6 +153,12 @@ public class SimpleDiffChange { myHighlighters.add(highlighter); } + public void update() { + for (MyGutterOperation operation : myOperations) { + operation.update(); + } + } + // // Getters // @@ -189,10 +196,11 @@ public class SimpleDiffChange { return false; } - for (RangeHighlighter highlighter : myActionHighlighters) { - highlighter.dispose(); + for (MyGutterOperation operation : myOperations) { + operation.destroy(); } - myActionHighlighters.clear(); + myOperations.clear(); + myIsValid = false; return true; } @@ -248,30 +256,137 @@ public class SimpleDiffChange { // Helpers // - private class MyReplaceOperation extends DiffOperation { - @NotNull private final Side mySide; + @NotNull + private MyGutterOperation createOperation(@NotNull Side side) { + assert myEditor1 != null && myEditor2 != null; + int offset = side.getStartOffset(myFragment); + EditorEx editor = side.selectN(myEditor1, myEditor2); + RangeHighlighter highlighter = editor.getMarkupModel().addRangeHighlighter(offset, offset, + HighlighterLayer.ADDITIONAL_SYNTAX, + null, + HighlighterTargetArea.LINES_IN_RANGE); + return new MyGutterOperation(side, highlighter); + } - public MyReplaceOperation(@NotNull Side side) { - super("Replace", DiffIcons.getReplaceIcon(Side.RIGHT)); + private class MyGutterOperation { + @NotNull private final Side mySide; + @NotNull private final RangeHighlighter myHighlighter; + + private boolean myCtrlPressed; + private boolean myShiftPressed; + + private MyGutterOperation(@NotNull Side side, @NotNull RangeHighlighter highlighter) { mySide = side; + myHighlighter = highlighter; + + myHighlighter.setGutterIconRenderer(createRenderer()); } - @Override - public void perform(@NotNull AnActionEvent e) { - final Project project = e.getProject(); + public void destroy() { + myHighlighter.dispose(); + } + + public void update() { + if (myCtrlPressed == myViewer.getModifierProvider().isCtrlPressed() && + myShiftPressed == myViewer.getModifierProvider().isShiftPressed()) { + return; + } + myHighlighter.setGutterIconRenderer(createRenderer()); + } + + @Nullable + public GutterIconRenderer createRenderer() { assert myEditor1 != null && myEditor2 != null; - final Document document1 = myEditor1.getDocument(); - final Document document2 = myEditor2.getDocument(); + myCtrlPressed = myViewer.getModifierProvider().isCtrlPressed(); + myShiftPressed = myViewer.getModifierProvider().isShiftPressed(); - if (!myIsValid) return; + boolean isEditable = DiffUtil.isEditable(mySide.selectN(myEditor1, myEditor2)); + boolean isOtherEditable = DiffUtil.isEditable(mySide.other().selectN(myEditor1, myEditor2)); - DiffUtil.executeWriteCommand(mySide.selectN(document1, document2), project, "Replace change", new Runnable() { - @Override - public void run() { - replaceChange(mySide.other()); - } - }); + if (myCtrlPressed && myShiftPressed) return null; + if ((myShiftPressed || !isOtherEditable) && isEditable) { + return createRevertRenderer(mySide); + } + if (myCtrlPressed) { + return createAppendRenderer(mySide); + } + return createApplyRenderer(mySide); } } + + @Nullable + private GutterIconRenderer createApplyRenderer(@NotNull final Side side) { + return createIconRenderer(side, DiffIcons.getReplaceIcon(Side.RIGHT), new Runnable() { + @Override + public void run() { + replaceChange(side); + } + }); + } + + @Nullable + private GutterIconRenderer createAppendRenderer(@NotNull final Side side) { + return createIconRenderer(side, DiffIcons.getAppendIcon(Side.RIGHT), new Runnable() { + @Override + public void run() { + appendChange(side); + } + }); + } + + @Nullable + private GutterIconRenderer createRevertRenderer(@NotNull final Side side) { + return createIconRenderer(side.other(), DiffIcons.getRevertIcon(Side.RIGHT), new Runnable() { + @Override + public void run() { + replaceChange(side.other()); + } + }); + } + + @Nullable + private GutterIconRenderer createIconRenderer(@NotNull final Side sourceSide, @NotNull final Icon icon, @NotNull final Runnable perform) { + assert myEditor1 != null && myEditor2 != null; + if (!DiffUtil.isEditable(sourceSide.other().selectN(myEditor1, myEditor2))) return null; + return new GutterIconRenderer() { + @NotNull + @Override + public Icon getIcon() { + return icon; + } + + @Nullable + @Override + public AnAction getClickAction() { + return new DumbAwareAction() { + @Override + public void actionPerformed(AnActionEvent e) { + final Project project = e.getProject(); + final Document document1 = myEditor1.getDocument(); + final Document document2 = myEditor2.getDocument(); + + if (!myIsValid) return; + + DiffUtil.executeWriteCommand(sourceSide.other().selectN(document1, document2), project, "Replace change", new Runnable() { + @Override + public void run() { + perform.run(); + } + }); + } + }; + } + + @Override + public boolean equals(Object obj) { + return obj == this; + } + + @Override + public int hashCode() { + return System.identityHashCode(this); + } + }; + } } diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java index 5bb932fa0b2c..72fee2e44977 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffViewer.java @@ -37,6 +37,7 @@ import com.intellij.diff.util.DiffUserDataKeysEx.ScrollToPolicy; import com.intellij.diff.util.DiffUtil; import com.intellij.diff.util.DiffUtil.DocumentData; import com.intellij.diff.util.Side; +import com.intellij.ide.IdeEventQueue; import com.intellij.openapi.actionSystem.AnAction; import com.intellij.openapi.actionSystem.AnActionEvent; import com.intellij.openapi.actionSystem.CommonDataKeys; @@ -60,6 +61,7 @@ import org.jetbrains.annotations.*; import javax.swing.*; import java.awt.*; +import java.awt.event.KeyEvent; import java.util.*; import java.util.List; @@ -74,6 +76,7 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { @NotNull private final List myInvalidDiffChanges = new ArrayList(); @Nullable private final SimpleFoldingModel myFoldingModel; + @NotNull private final ModifierProvider myModifierProvider; public SimpleDiffViewer(@NotNull DiffContext context, @NotNull DiffRequest request) { super(context, (ContentDiffRequest)request); @@ -82,6 +85,8 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { myPrevNextDifferenceIterable = new MyPrevNextDifferenceIterable(); myStatusPanel = new MyStatusPanel(); myFoldingModel = createFoldingModel(myEditor1, myEditor2); + + myModifierProvider = new ModifierProvider(); } @Override @@ -282,12 +287,15 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { if (data.getFragments() != null) { for (LineFragment fragment : data.getFragments()) { - myDiffChanges.add(new SimpleDiffChange(fragment, myEditor1, myEditor2, getHighlightPolicy().isFineFragments())); + myDiffChanges.add(new SimpleDiffChange(SimpleDiffViewer.this, fragment, myEditor1, myEditor2, + getHighlightPolicy().isFineFragments())); } } - if (myFoldingModel != null) myFoldingModel.install(data.getFragments(), myRequest, - getTextSettings().isExpandByDefault(), getTextSettings().getContextRange()); + if (myFoldingModel != null) { + myFoldingModel.install(data.getFragments(), myRequest, + getTextSettings().isExpandByDefault(), getTextSettings().getContextRange()); + } scrollOnRediff(); @@ -449,6 +457,11 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { return myStatusPanel; } + @NotNull + public ModifierProvider getModifierProvider() { + return myModifierProvider; + } + // // Misc // @@ -900,4 +913,52 @@ public class SimpleDiffViewer extends TwosideTextDiffViewer { return myStamp2; } } + + public class ModifierProvider { + private boolean myShiftPressed; + private boolean myCtrlPressed; + private boolean myAltPressed; + + public ModifierProvider() { + IdeEventQueue.getInstance().addPostprocessor(new IdeEventQueue.EventDispatcher() { + @Override + public boolean dispatch(AWTEvent e) { + if (e instanceof KeyEvent) { + final int keyCode = ((KeyEvent)e).getKeyCode(); + if (keyCode == KeyEvent.VK_SHIFT) { + myShiftPressed = e.getID() == KeyEvent.KEY_PRESSED; + updateActions(); + } + if (keyCode == KeyEvent.VK_CONTROL) { + myCtrlPressed = e.getID() == KeyEvent.KEY_PRESSED; + updateActions(); + } + if (keyCode == KeyEvent.VK_ALT) { + myAltPressed = e.getID() == KeyEvent.KEY_PRESSED; + updateActions(); + } + } + return false; + } + }, SimpleDiffViewer.this); + } + + public boolean isShiftPressed() { + return myShiftPressed; + } + + public boolean isCtrlPressed() { + return myCtrlPressed; + } + + public boolean isAltPressed() { + return myAltPressed; + } + + public void updateActions() { + for (SimpleDiffChange change : myDiffChanges) { + change.update(); + } + } + } } diff --git a/platform/diff-impl/src/com/intellij/diff/util/DiffIcons.java b/platform/diff-impl/src/com/intellij/diff/util/DiffIcons.java index 8d92288b5d73..1fea0e06add1 100644 --- a/platform/diff-impl/src/com/intellij/diff/util/DiffIcons.java +++ b/platform/diff-impl/src/com/intellij/diff/util/DiffIcons.java @@ -39,7 +39,7 @@ public class DiffIcons { return side.selectN(REPLACE_LEFT, REPLACE_RIGHT); } - @Nullable + @NotNull public static Icon getAppendIcon(@Nullable Side side) { if (side == null) side = Side.LEFT; return side.selectN(APPEND_LEFT, APPEND_RIGHT); From a6cc4b15da99099fdcaaab99b18e6929811c3aba Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Sat, 7 Feb 2015 15:13:34 +0300 Subject: [PATCH 09/20] diff: do not try to append empty range --- .../src/com/intellij/diff/tools/simple/SimpleDiffChange.java | 1 + platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java | 1 + 2 files changed, 2 insertions(+) diff --git a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java index 84f60ef3e6d4..4b91729c3733 100644 --- a/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java +++ b/platform/diff-impl/src/com/intellij/diff/tools/simple/SimpleDiffChange.java @@ -240,6 +240,7 @@ public class SimpleDiffChange { assert myEditor1 != null && myEditor2 != null; if (!myIsValid) return; + if (getStartLine(sourceSide) == getEndLine(sourceSide)) return; final Document document1 = myEditor1.getDocument(); final Document document2 = myEditor2.getDocument(); diff --git a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java index 5388b0079cb9..5cf87e80015e 100644 --- a/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java +++ b/platform/diff-impl/src/com/intellij/diff/util/DiffUtil.java @@ -591,6 +591,7 @@ public class DiffUtil { @NotNull Document document2, int oLine1, int oLine2) { + if (line1 == line2 && oLine1 == oLine2) return; if (line1 == line2) { insertLines(document1, line1, document2, oLine1, oLine2); } From 7e7d2333a373930f426d826bbb5d3273866f4088 Mon Sep 17 00:00:00 2001 From: Aleksey Pivovarov Date: Mon, 9 Feb 2015 11:59:24 +0300 Subject: [PATCH 10/20] diff: cleanup --- .../intellij/openapi/vcs/changes/CacheChangeProcessor.java | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java index 36e17bf286d0..f44497106063 100644 --- a/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java +++ b/platform/vcs-impl/src/com/intellij/openapi/vcs/changes/CacheChangeProcessor.java @@ -35,10 +35,7 @@ import com.intellij.openapi.project.Project; import com.intellij.openapi.util.Pair; import com.intellij.openapi.vcs.changes.actions.diff.ChangeDiffRequestProducer; import com.intellij.util.containers.Convertor; -import org.jetbrains.annotations.CalledInBackground; -import org.jetbrains.annotations.Contract; -import org.jetbrains.annotations.NotNull; -import org.jetbrains.annotations.Nullable; +import org.jetbrains.annotations.*; import java.util.Collections; import java.util.List; @@ -186,6 +183,7 @@ public abstract class CacheChangeProcessor extends DiffRequestProcessor { updateRequest(); } + @CalledInAwt public void refresh() { List selectedChanges = getSelectedChanges(); From 2333ad2f1d38e18292af8f5a2fd8574b655acd3d Mon Sep 17 00:00:00 2001 From: Anna Kozlova Date: Fri, 6 Feb 2015 18:16:15 +0100 Subject: [PATCH 11/20] normalize captured wildcards by position --- .../source/resolve/graphInference/InferenceSession.java | 6 +++--- .../PsiMethodReferenceCompatibilityConstraint.java | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java index 7f080812a558..4eaa6209655d 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/InferenceSession.java @@ -478,7 +478,7 @@ public class InferenceSession { final PsiSubstitutor substitutor = resolveSubset(Collections.singletonList(inferenceVariable), mySiteSubstitutor); final PsiType substitutedReturnType = substitutor.substitute(inferenceVariable.getParameter()); if (substitutedReturnType != null) { - addConstraint(new TypeCompatibilityConstraint(targetType, PsiUtil.captureToplevelWildcards(substitutedReturnType, myContext))); + addConstraint(new TypeCompatibilityConstraint(targetType, PsiImplUtil.normalizeWildcardTypeByPosition(substitutedReturnType, (PsiExpression)myContext))); } } else { @@ -489,7 +489,7 @@ public class InferenceSession { LOG.assertTrue(returnType instanceof PsiClassType); final PsiTypeParameter[] typeParameters = psiClass.getTypeParameters(); InferenceVariable[] copy = initBounds(null, typeParameters); - final PsiType substitutedCapture = PsiUtil.captureToplevelWildcards(returnType, myContext); + final PsiType substitutedCapture = PsiImplUtil.normalizeWildcardTypeByPosition(returnType, (PsiExpression)myContext); myIncorporationPhase.addCapture(copy, (PsiClassType)substituteWithInferenceVariables(returnType)); addConstraint(new TypeCompatibilityConstraint(targetType, substitutedCapture)); } @@ -1134,7 +1134,7 @@ public class InferenceSession { // the type to search is the result of capture conversion (5.1.10) applied to T; // otherwise, the type to search is the same as the type of the first search. Again, the type arguments, if any, are given by the method reference. if (PsiUtil.isRawSubstitutor(containingClass, psiSubstitutor)) { - final PsiClassType.ClassResolveResult pResult = PsiUtil.resolveGenericsClassInType(PsiUtil.captureToplevelWildcards(pType, myContext)); + final PsiClassType.ClassResolveResult pResult = PsiUtil.resolveGenericsClassInType(PsiImplUtil.normalizeWildcardTypeByPosition(pType, (PsiExpression)myContext)); final PsiClass pClass = pResult.getElement(); final PsiSubstitutor receiverSubstitutor = pClass != null ? TypeConversionUtil .getClassSubstitutor(containingClass, pClass, pResult.getSubstitutor()) : null; diff --git a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java index 1d0766573b3f..04b9b2462bd9 100644 --- a/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java +++ b/java/java-psi-impl/src/com/intellij/psi/impl/source/resolve/graphInference/constraints/PsiMethodReferenceCompatibilityConstraint.java @@ -17,6 +17,7 @@ package com.intellij.psi.impl.source.resolve.graphInference.constraints; import com.intellij.openapi.diagnostic.Logger; import com.intellij.psi.*; +import com.intellij.psi.impl.PsiImplUtil; import com.intellij.psi.impl.source.resolve.graphInference.FunctionalInterfaceParameterizationUtil; import com.intellij.psi.impl.source.resolve.graphInference.InferenceSession; import com.intellij.psi.impl.source.resolve.graphInference.PsiPolyExpressionUtil; @@ -165,7 +166,7 @@ public class PsiMethodReferenceCompatibilityConstraint implements ConstraintForm if ( PsiUtil.isRawSubstitutor(qContainingClass, psiSubstitutor)) { if (targetParameters.length == method.getParameterList().getParametersCount() + 1) { final PsiType pType = substitutor.substitute(targetParameters[0].getType()); - PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(PsiUtil.captureToplevelWildcards(pType, myExpression)); + PsiClassType.ClassResolveResult resolveResult = PsiUtil.resolveGenericsClassInType(PsiImplUtil.normalizeWildcardTypeByPosition(pType, myExpression)); PsiClass paramClass = resolveResult.getElement(); LOG.assertTrue(paramClass != null); psiSubstitutor = TypeConversionUtil.getClassSubstitutor(qContainingClass, paramClass, resolveResult.getSubstitutor()); From 865badae548a10abb93b3a4ddbcdcaf71eea354a Mon Sep 17 00:00:00 2001 From: Sergey Simonchik Date: Mon, 9 Feb 2015 13:40:55 +0300 Subject: [PATCH 12/20] fix NPE in tests (environment.getProject() may return null) --- .../execution/testframework/ToolbarPanel.java | 2 +- .../AdjustAutotestDelayActionGroup.java | 18 +++++++++--------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/platform/testRunner/src/com/intellij/execution/testframework/ToolbarPanel.java b/platform/testRunner/src/com/intellij/execution/testframework/ToolbarPanel.java index 7eaf9c1754d5..541f024ea239 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/ToolbarPanel.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/ToolbarPanel.java @@ -102,7 +102,7 @@ public class ToolbarPanel extends JPanel implements OccurenceNavigator, Disposab properties, TestConsoleProperties.OPEN_FAILURE_LINE)).setAsSecondary(true); actionGroup.addAction(new ShowStatisticsAction(properties)).setAsSecondary(true); - actionGroup.addAction(new AdjustAutotestDelayActionGroup(environment.getProject(), parent)).setAsSecondary(true); + actionGroup.addAction(new AdjustAutotestDelayActionGroup(parent)).setAsSecondary(true); for (ToggleModelActionProvider actionProvider : Extensions.getExtensions(ToggleModelActionProvider.EP_NAME)) { final ToggleModelAction toggleModelAction = actionProvider.createToggleModelAction(properties); diff --git a/platform/testRunner/src/com/intellij/execution/testframework/autotest/AdjustAutotestDelayActionGroup.java b/platform/testRunner/src/com/intellij/execution/testframework/autotest/AdjustAutotestDelayActionGroup.java index 4b8a2ffa75ec..02ce8ed431e1 100644 --- a/platform/testRunner/src/com/intellij/execution/testframework/autotest/AdjustAutotestDelayActionGroup.java +++ b/platform/testRunner/src/com/intellij/execution/testframework/autotest/AdjustAutotestDelayActionGroup.java @@ -29,12 +29,10 @@ import javax.swing.*; */ public class AdjustAutotestDelayActionGroup extends ActionGroup { public static final int MAX_DELAY = 10; - private final Project myProject; private final DataContext myDataContext; - public AdjustAutotestDelayActionGroup(@NotNull Project project, @NotNull JComponent parent) { + public AdjustAutotestDelayActionGroup(@NotNull JComponent parent) { super("Set AutoTest Delay", true); - myProject = project; myDataContext = DataManager.getInstance().getDataContext(parent); } @@ -58,29 +56,31 @@ public class AdjustAutotestDelayActionGroup extends ActionGroup { public AnAction[] getChildren(@Nullable AnActionEvent e) { final AnAction[] actions = new AnAction[MAX_DELAY]; for (int i = 0; i < MAX_DELAY; i++) { - actions[i] = new SetAutoTestDelayAction(myProject, i + 1); + actions[i] = new SetAutoTestDelayAction(i + 1); } return actions; } private static class SetAutoTestDelayAction extends ToggleAction { private final int myDelay; - @NotNull private final Project myProject; - public SetAutoTestDelayAction(@NotNull Project project, int delay) { + public SetAutoTestDelayAction(int delay) { super(delay + "s"); - myProject = project; myDelay = delay * 1000; } @Override public boolean isSelected(AnActionEvent e) { - return AutoTestManager.getInstance(myProject).getDelay() == myDelay; + Project project = e.getProject(); + return project != null && AutoTestManager.getInstance(project).getDelay() == myDelay; } @Override public void setSelected(AnActionEvent e, boolean state) { - AutoTestManager.getInstance(myProject).setDelay(myDelay); + Project project = e.getProject(); + if (project != null) { + AutoTestManager.getInstance(project).setDelay(myDelay); + } } } } From 4f0790091ed70390d6d62b1f3a11d5678e1aab5c Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Mon, 9 Feb 2015 14:05:30 +0300 Subject: [PATCH 13/20] fixed artifact set of Community Dist builds. --- build/scripts/dist.gant | 1 + 1 file changed, 1 insertion(+) diff --git a/build/scripts/dist.gant b/build/scripts/dist.gant index 4368e05b6f9d..3d6b4f5e7502 100644 --- a/build/scripts/dist.gant +++ b/build/scripts/dist.gant @@ -152,6 +152,7 @@ def layoutAll(Map args, String home, String out, Paths _paths = null, buildJps = String macZip = "$paths.artifacts/idea${args.buildNumber}.mac.zip" buildMacZip(macAppRoot, macZip, [paths.distAll], paths.distMac) + notifyArtifactBuilt(macZip) buildTarGz("idea-${args.buildNumber}", "$paths.artifacts/idea${args.buildNumber}.tar", [paths.distAll, paths.distUnix]) } From 92019a830e88d36ea8cc6b89e16e121a9901e4f3 Mon Sep 17 00:00:00 2001 From: Sergey Savenko Date: Mon, 9 Feb 2015 14:22:20 +0300 Subject: [PATCH 14/20] DBE-1091: track modification count to update QuickDocs --- .../documentation/DocumentationComponent.java | 19 +++++++++++++++++-- .../documentation/DocumentationManager.java | 5 +++-- 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java index a260439b1c18..895cd2e2ce75 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationComponent.java @@ -48,6 +48,7 @@ import com.intellij.pom.Navigatable; import com.intellij.psi.PsiElement; import com.intellij.psi.SmartPointerManager; import com.intellij.psi.SmartPsiElementPointer; +import com.intellij.psi.util.PsiModificationTracker; import com.intellij.ui.IdeBorderFactory; import com.intellij.ui.JBColor; import com.intellij.ui.SideBorder; @@ -94,6 +95,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr private DocumentationManager myManager; private SmartPsiElementPointer myElement; + private long myModificationCount; private final Stack myBackStack = new Stack(); private final Stack myForwardStack = new Stack(); @@ -485,6 +487,19 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr return myElement != null ? myElement.getElement() : null; } + private void setElement(SmartPsiElementPointer element) { + myElement = element; + myModificationCount = getCurrentModificationCount(); + } + + public boolean isUpToDate() { + return getElement() != null && myModificationCount == getCurrentModificationCount(); + } + + private long getCurrentModificationCount() { + return myElement != null ? PsiModificationTracker.SERVICE.getInstance(myElement.getProject()).getModificationCount() : -1; + } + public void setNavigateCallback(Consumer navigateCallback) { myNavigateCallback = navigateCallback; } @@ -531,7 +546,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr : null; if (element != null) { - myElement = element; + setElement(element); } myIsEmpty = false; @@ -546,7 +561,7 @@ public class DocumentationComponent extends JPanel implements Disposable, DataPr } private void setDataInternal(SmartPsiElementPointer element, String text, final Rectangle viewRect, boolean skip) { - myElement = element; + setElement(element); boolean justShown = false; if (!myIsShown && myHint != null) { diff --git a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java index c5de46f9332a..d1bbdf28bf32 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/documentation/DocumentationManager.java @@ -395,7 +395,8 @@ public class DocumentationManager extends DockablePopupManager Date: Mon, 9 Feb 2015 10:49:55 +0100 Subject: [PATCH 15/20] source info: lazy compute offset --- .../org/jetbrains/debugger/SourceInfo.java | 74 +++++++++++++------ .../xdebugger/impl/XSourcePositionImpl.java | 13 +++- 2 files changed, 63 insertions(+), 24 deletions(-) diff --git a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java index 4bfce6088d09..f1c899be3e04 100644 --- a/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java +++ b/platform/script-debugger/debugger-ui/src/org/jetbrains/debugger/SourceInfo.java @@ -2,42 +2,38 @@ package org.jetbrains.debugger; import com.intellij.openapi.application.AccessToken; import com.intellij.openapi.application.ReadAction; +import com.intellij.openapi.editor.Document; +import com.intellij.openapi.fileEditor.FileDocumentManager; import com.intellij.openapi.fileEditor.OpenFileDescriptor; import com.intellij.openapi.project.Project; import com.intellij.openapi.vfs.VirtualFile; import com.intellij.pom.Navigatable; -import com.intellij.xdebugger.XDebuggerUtil; import com.intellij.xdebugger.XSourcePosition; -import com.intellij.xdebugger.XSourcePositionWrapper; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; -public class SourceInfo extends XSourcePositionWrapper { +public class SourceInfo implements XSourcePosition { private final String functionName; + + private final VirtualFile file; + private final int line; private final int column; + private int offset = -1; + + private SourceInfo(@Nullable String functionName, @NotNull VirtualFile file, int line, int column) { + this.functionName = functionName; + this.file = file; + this.line = line; + this.column = column; + } + @Nullable public static SourceInfo create(@Nullable String functionName, @Nullable VirtualFile file, int line, int column) { - if (file == null) { + if (file == null || !file.isValid()) { return null; } - - XSourcePosition position; - AccessToken token = ReadAction.start(); - try { - position = XDebuggerUtil.getInstance().createPosition(file, line); - } - finally { - token.finish(); - } - return position == null ? null : new SourceInfo(functionName, position, column); - } - - private SourceInfo(@Nullable String functionName, @NotNull XSourcePosition position, int column) { - super(position); - - this.functionName = functionName; - this.column = column; + return new SourceInfo(functionName, file, line, column); } @Nullable @@ -45,18 +41,50 @@ public class SourceInfo extends XSourcePositionWrapper { return functionName; } + @Override + public int getLine() { + return line; + } + public int getColumn() { return column; } + @Override + public int getOffset() { + if (offset == -1) { + Document document; + AccessToken token = ReadAction.start(); + try { + document = file.isValid() ? FileDocumentManager.getInstance().getDocument(file) : null; + } + finally { + token.finish(); + } + + if (document == null) { + return -1; + } + + offset = line < document.getLineCount() ? document.getLineStartOffset(line) : -1; + } + return offset; + } + + @NotNull + @Override + public VirtualFile getFile() { + return file; + } + @NotNull @Override public Navigatable createNavigatable(@NotNull Project project) { - return new OpenFileDescriptor(project, myPosition.getFile(), myPosition.getLine(), column); + return new OpenFileDescriptor(project, getFile(), getLine(), getColumn()); } @Override public String toString() { - return myPosition.getFile() + ":" + myPosition.getLine() + (column == -1 ? "": (":" + getColumn())); + return getFile() + ":" + getLine() + (column == -1 ? "": (":" + getColumn())); } } diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java index c11e8f5547cb..fd68ef40752c 100644 --- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java +++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XSourcePositionImpl.java @@ -113,11 +113,22 @@ public class XSourcePositionImpl implements XSourcePosition { @Override @NotNull public Navigatable createNavigatable(@NotNull Project project) { - return createOpenFileDescriptor(project, this); + return doCreateOpenFileDescriptor(project, this); } @NotNull public static OpenFileDescriptor createOpenFileDescriptor(@NotNull Project project, @NotNull XSourcePosition position) { + Navigatable navigatable = position.createNavigatable(project); + if (navigatable instanceof OpenFileDescriptor) { + return (OpenFileDescriptor)navigatable; + } + else { + return doCreateOpenFileDescriptor(project, position); + } + } + + @NotNull + private static OpenFileDescriptor doCreateOpenFileDescriptor(@NotNull Project project, @NotNull XSourcePosition position) { return position.getOffset() != -1 ? new OpenFileDescriptor(project, position.getFile(), position.getOffset()) : new OpenFileDescriptor(project, position.getFile(), position.getLine(), 0); From 9a19bb2b8e3422eda46703a4f54d557db87529e9 Mon Sep 17 00:00:00 2001 From: Vladimir Krivosheev Date: Mon, 9 Feb 2015 12:22:03 +0100 Subject: [PATCH 16/20] =?UTF-8?q?move=20FileUrlMapper=20to=20community=20?= =?UTF-8?q?=E2=80=94=20kotlin=20should=20be=20able=20to=20use=20this=20API?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../javascript/debugger/FileUrlMapper.java | 54 +++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java diff --git a/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java b/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java new file mode 100644 index 000000000000..b079afcddcd1 --- /dev/null +++ b/platform/script-debugger/debugger-ui/src/com/jetbrains/javascript/debugger/FileUrlMapper.java @@ -0,0 +1,54 @@ +package com.jetbrains.javascript.debugger; + +import com.intellij.openapi.extensions.ExtensionPointName; +import com.intellij.openapi.fileEditor.OpenFileDescriptor; +import com.intellij.openapi.fileTypes.FileType; +import com.intellij.openapi.project.Project; +import com.intellij.openapi.vfs.VirtualFile; +import com.intellij.pom.Navigatable; +import com.intellij.util.Url; +import com.intellij.util.containers.ObjectIntHashMap; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; + +import java.util.List; + +public abstract class FileUrlMapper { + public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.jetbrains.fileUrlMapper"); + + @NotNull + public abstract List getUrls(@NotNull VirtualFile file, @NotNull Project project, @Nullable String currentAuthority); + + /** + * Optional to implement, useful if default navigation position to source file is not equals to 0:0 (java file for example) + */ + @Nullable + public Navigatable getNavigatable(@NotNull Url url, @NotNull Project project, @Nullable Url requestor) { + VirtualFile file = getFile(url, project, requestor); + return file == null ? null : new OpenFileDescriptor(project, file); + } + + @Nullable + public abstract VirtualFile getFile(@NotNull Url url, @NotNull Project project, @Nullable Url requestor); + + /** + * Optional to implement, sometimes you cannot build URL, but can match. + * Lifetime: resolve session lifetime. Could be called multiple times: n <= total sourcemap count + */ + @Nullable + public SourceResolver createSourceResolver(@NotNull VirtualFile file, @NotNull Project project) { + return null; + } + + @Nullable + public FileType getFileType(@NotNull Url url) { + return null; + } + + public static abstract class SourceResolver { + /** + * Return -1 if no match + */ + public abstract int resolve(@NotNull ObjectIntHashMap map, @NotNull Project project); + } +} \ No newline at end of file From 71c6e5f3f02aa55cc57cab882885333e6286dd1a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yann=20C=C3=A9bron?= Date: Mon, 9 Feb 2015 12:37:08 +0100 Subject: [PATCH 17/20] IDEA-126386 Update eclipse logo, re-fix EclipseIcons --- plugins/eclipse/eclipse.iml | 6 ++-- plugins/eclipse/gen/icons/EclipseIcons.java | 17 ++++++++++ .../eclipse/resources/icons/EclipseIcons.java | 32 ------------------ plugins/eclipse/resources/icons/eclipse.png | Bin 0 -> 428 bytes .../eclipse/resources/icons/eclipse@2x.png | Bin 0 -> 751 bytes .../resources/icons/eclipse@2x_dark.png | Bin 0 -> 757 bytes .../eclipse/resources/icons/eclipse_dark.png | Bin 0 -> 438 bytes plugins/eclipse/resources/images/eclipse.gif | Bin 308 -> 0 bytes 8 files changed, 20 insertions(+), 35 deletions(-) create mode 100644 plugins/eclipse/gen/icons/EclipseIcons.java delete mode 100644 plugins/eclipse/resources/icons/EclipseIcons.java create mode 100644 plugins/eclipse/resources/icons/eclipse.png create mode 100644 plugins/eclipse/resources/icons/eclipse@2x.png create mode 100644 plugins/eclipse/resources/icons/eclipse@2x_dark.png create mode 100644 plugins/eclipse/resources/icons/eclipse_dark.png delete mode 100644 plugins/eclipse/resources/images/eclipse.gif diff --git a/plugins/eclipse/eclipse.iml b/plugins/eclipse/eclipse.iml index 30486e5f0e57..c75f9703346e 100644 --- a/plugins/eclipse/eclipse.iml +++ b/plugins/eclipse/eclipse.iml @@ -3,9 +3,10 @@ - + + @@ -22,5 +23,4 @@ - - + \ No newline at end of file diff --git a/plugins/eclipse/gen/icons/EclipseIcons.java b/plugins/eclipse/gen/icons/EclipseIcons.java new file mode 100644 index 000000000000..891304281e9e --- /dev/null +++ b/plugins/eclipse/gen/icons/EclipseIcons.java @@ -0,0 +1,17 @@ +package icons; + +import com.intellij.openapi.util.IconLoader; + +import javax.swing.*; + +/** + * NOTE THIS FILE IS AUTO-GENERATED + * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead + */ +public class EclipseIcons { + private static Icon load(String path) { + return IconLoader.getIcon(path, EclipseIcons.class); + } + + public static final Icon Eclipse = load("/icons/eclipse.png"); // 16x16 +} diff --git a/plugins/eclipse/resources/icons/EclipseIcons.java b/plugins/eclipse/resources/icons/EclipseIcons.java deleted file mode 100644 index ab91ce0e357b..000000000000 --- a/plugins/eclipse/resources/icons/EclipseIcons.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright 2000-2013 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 icons; - -import com.intellij.openapi.util.IconLoader; - -import javax.swing.*; - -/** - * NOTE THIS FILE IS AUTO-GENERATED - * DO NOT EDIT IT BY HAND, run build/scripts/icons.gant instead - */ -public class EclipseIcons { - private static Icon load(String path) { - return IconLoader.getIcon(path, EclipseIcons.class); - } - - public static final Icon Eclipse = load("/images/eclipse.gif"); // 16x16 -} diff --git a/plugins/eclipse/resources/icons/eclipse.png b/plugins/eclipse/resources/icons/eclipse.png new file mode 100644 index 0000000000000000000000000000000000000000..decb2e41988963e79bd741d8cc76ac31f56b361b GIT binary patch literal 428 zcmV;d0aN~oP)if0uBnYRGq2QF%)C>SIrTk0T$(fORdemEYpwNjE>UDa zOa1H%SiP`t_V(ioW^F%#3$I$b_aMj%yLX(J1~Z@uIS^w*n*V3SPQr@QVmR z=~rT8y%V;i8~{qnC6Nh}a3*Dca8kAax(I7t0AUFrt^j4G#<-{sq|7u8XJ(=_I|Bft WKR#rAroZa|0000o5Gj? literal 0 HcmV?d00001 diff --git a/plugins/eclipse/resources/icons/eclipse@2x.png b/plugins/eclipse/resources/icons/eclipse@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..3d636e1cbbcb59efb16a2c8d8ea0467cd24d320a GIT binary patch literal 751 zcmV|x44rdAQ@jE_i(-K|4Tuwg*bRuKfS7?8 zOpF7VfH)3_uLJR^hn<>1K#e6pd>)AZ0r7tv_$Cln0kIe*4p0T+qd@%Q+a&pd5U+xK zpr-eDEX9Vu0dW%$vyhohY6nz! zl|swGILNE`F_2avq(yN#0F>ZP0P%ky?guKE zLQTtII5MzeH;`t;=70pKxwHq-&FR7iAqaa2&{Qy|TR z>;PM+<^LAudfL#^_b{9q*W`}ufKI3b&H^R5_wG6sb?4Tj<+Q}NZ$9!xcEDk%13(GS zX2G0Ib2hBmznhkL&5Au!kR9*>>Htt_cMLta(qkt4&xoBwF%I-BM&yQ|%CE={_z87D z3{cW?&(4z@fzhx9hIei|v2E+7qdUQP%*<4H6Mz zn`G~xO|pylYPDdm5^%@_dzTVwlHCW=%0P#b)+oK+s^$)AZ0r7tv_$Cln0kIe*4p0T+qd@%Q+hqBIjF_H$ zpr-eDEX9Vu0dW%$vymS_YX?+# zl|swGI4!3CF_2avff04Two0OJ2Z+z(VR zg_@Sba8AjzM-1?EqR} zbO+#xf_|z5e^J_e)B*`D3I-w(P90R)&<^T=zpKh3tjBs_$(m`Fb n%H(};X2QgWK-vnM0pUQ+=L(ZLwqnzWjMHQLe-~xWa6vXe1c={G%FXE_ zq#1^@6DNJnNuDeQGobP7B>6SzaT7igYXAs0lrLNaGvLD09-XY++s@89xcAcbO{-5G z#)r3WJiGts!7E!1?YlG;X26fll|iW!I@ez5Yg>1xrE>jye7L=4{i}&x>#j}i*>H&> z115E^zkt;XYnPokzGmt16S(l!b!QHOyl{B`5H3kygrT`Qcg_Fogy~@UoTSO0kfRZvkcyHzHp2|bil6eoAZ0GlMGOAt zCC~n!7Bc~skbV_s&2Yk&lmkFXxh1`960W42l`sjElr4ZR!kQOASOSPEK$)pOJFf#N gGfl&pnJCT90Nzt&JEE`9{{R3007*qoM6N<$g5PD!X#fBK literal 0 HcmV?d00001 diff --git a/plugins/eclipse/resources/images/eclipse.gif b/plugins/eclipse/resources/images/eclipse.gif deleted file mode 100644 index eb7b90c76711ac9cfcea0843bccf09b78457fa7f..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 308 zcmZ?wbhEHb6krfwxXQqA_T;J4$4?$PaBSbsL;H6h-o9!7rZsyvuiLk5!S>|~cPyH- zt*L5RSM#bVee3hn=9T0us4HI@6*wg(cxp<_%b={S9^AQf z_vXdxSI*tOe&OcT^Ow$@`Tzev11*8#PZmZ71_cHkkR>2LF|Y+XOepZsk?Qw&_$)yq zW0Is>iqu3CgJZm{r`9HPa Date: Mon, 9 Feb 2015 12:41:21 +0100 Subject: [PATCH 18/20] allow to create instance of non-public files --- .../src/org/jetbrains/ide/XmlRpcServerImpl.java | 4 +++- .../src/com/intellij/ide/XmlRpcHandlerBean.java | 12 ++---------- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java b/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java index 9b683b53ab65..22fa38db97fb 100644 --- a/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java +++ b/platform/built-in-server/src/org/jetbrains/ide/XmlRpcServerImpl.java @@ -17,7 +17,9 @@ package org.jetbrains.ide; import com.intellij.ide.XmlRpcHandlerBean; import com.intellij.ide.XmlRpcServer; +import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.diagnostic.Logger; +import com.intellij.openapi.extensions.AbstractExtensionPointBean; import com.intellij.openapi.extensions.Extensions; import com.intellij.openapi.util.text.StringUtil; import com.intellij.openapi.vfs.CharsetToolkit; @@ -48,7 +50,7 @@ public class XmlRpcServerImpl implements XmlRpcServer { handlerMapping = new THashMap(); for (XmlRpcHandlerBean handlerBean : Extensions.getExtensions(XmlRpcHandlerBean.EP_NAME)) { try { - handlerMapping.put(handlerBean.name, handlerBean.instantiate()); + handlerMapping.put(handlerBean.name, AbstractExtensionPointBean.instantiate(handlerBean.findClass(handlerBean.implementation), ApplicationManager.getApplication().getPicoContainer(), true)); } catch (ClassNotFoundException e) { LOG.error(e); diff --git a/platform/platform-api/src/com/intellij/ide/XmlRpcHandlerBean.java b/platform/platform-api/src/com/intellij/ide/XmlRpcHandlerBean.java index dff2f1054814..77630f66b30e 100644 --- a/platform/platform-api/src/com/intellij/ide/XmlRpcHandlerBean.java +++ b/platform/platform-api/src/com/intellij/ide/XmlRpcHandlerBean.java @@ -1,5 +1,5 @@ /* - * Copyright 2000-2010 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,14 +15,10 @@ */ package com.intellij.ide; -import com.intellij.openapi.application.ApplicationManager; import com.intellij.openapi.extensions.AbstractExtensionPointBean; import com.intellij.openapi.extensions.ExtensionPointName; import com.intellij.util.xmlb.annotations.Attribute; -/** - * @author yole - */ public class XmlRpcHandlerBean extends AbstractExtensionPointBean { public static final ExtensionPointName EP_NAME = ExtensionPointName.create("com.intellij.xmlRpcHandler"); @@ -31,8 +27,4 @@ public class XmlRpcHandlerBean extends AbstractExtensionPointBean { @Attribute("implementation") public String implementation; - - public Object instantiate() throws ClassNotFoundException { - return instantiate(implementation, ApplicationManager.getApplication().getPicoContainer()); - } -} +} \ No newline at end of file From 8fffa312a176313a19a81bda30b2aef555e3eb5b Mon Sep 17 00:00:00 2001 From: Alexey Kudravtsev Date: Mon, 9 Feb 2015 14:37:06 +0300 Subject: [PATCH 19/20] DaemonRespondToChangesTest fixes; really ignore action of IgnoreDocumentRunnable class --- .../codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java | 6 ------ .../intellij/codeInsight/daemon/impl/DaemonListeners.java | 7 +++---- .../fixtures/impl/CodeInsightTestFixtureImpl.java | 2 ++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java index 215b80e89064..b3de08e25172 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonCodeAnalyzerImpl.java @@ -42,7 +42,6 @@ import com.intellij.openapi.diagnostic.Logger; import com.intellij.openapi.editor.Document; import com.intellij.openapi.editor.Editor; import com.intellij.openapi.editor.RangeMarker; -import com.intellij.openapi.editor.colors.EditorColorsManager; import com.intellij.openapi.editor.ex.RangeHighlighterEx; import com.intellij.openapi.editor.impl.DocumentMarkupModel; import com.intellij.openapi.editor.markup.MarkupModel; @@ -125,7 +124,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements Pers @NotNull DaemonCodeAnalyzerSettings daemonCodeAnalyzerSettings, @NotNull EditorTracker editorTracker, @NotNull PsiDocumentManager psiDocumentManager, - @NotNull EditorColorsManager colorsManager, @SuppressWarnings("UnusedParameters") @NotNull final NamedScopeManager namedScopeManager, @SuppressWarnings("UnusedParameters") @NotNull final DependencyValidationManager dependencyValidationManager) { myProject = project; @@ -305,7 +303,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements Pers UIUtil.dispatchAllInvocationEvents(); Project project = file.getProject(); - setUpdateByTimerEnabled(false); FileStatusMap.getAndClearLog(); FileStatusMap fileStatusMap = getFileStatusMap(); fileStatusMap.allowDirt(canChangeDocument); @@ -367,9 +364,6 @@ public class DaemonCodeAnalyzerImpl extends DaemonCodeAnalyzerEx implements Pers @TestOnly public void prepareForTest() { - //if (!myInitialized) { - // projectOpened(); - //} setUpdateByTimerEnabled(false); waitForTermination(); } diff --git a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java index 884c59cc082c..083ea16e5091 100644 --- a/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java +++ b/platform/lang-impl/src/com/intellij/codeInsight/daemon/impl/DaemonListeners.java @@ -363,6 +363,7 @@ public class DaemonListeners implements Disposable { static boolean isUnderIgnoredAction(@Nullable Object action) { return action instanceof DocumentRunnable.IgnoreDocumentRunnable || + action == DocumentRunnable.IgnoreDocumentRunnable.class || ApplicationManager.getApplication().hasWriteAction(DocumentRunnable.IgnoreDocumentRunnable.class); } @@ -428,15 +429,13 @@ public class DaemonListeners implements Disposable { @Override public void beforeWriteActionStart(Object action) { myDaemonWasRunning = myDaemonCodeAnalyzer.isRunning(); - if (!myDaemonWasRunning) return; // we'll restart in writeActionFinished() + if (!myDaemonWasRunning || isUnderIgnoredAction(action)) return; // we'll restart in writeActionFinished() stopDaemon(true, "Write action start"); } @Override public void writeActionFinished(Object action) { - if (myDaemonWasRunning) { - stopDaemon(true, "Write action finish"); - } + stopDaemon(true, "Write action finish"); } } diff --git a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java index 817b2105d1da..0b958006e33a 100644 --- a/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java +++ b/platform/testFramework/src/com/intellij/testFramework/fixtures/impl/CodeInsightTestFixtureImpl.java @@ -1631,6 +1631,8 @@ public class CodeInsightTestFixtureImpl extends BaseFixture implements CodeInsig return infos; } catch (ProcessCanceledException e) { + PsiDocumentManager.getInstance(project).commitAllDocuments(); + UIUtil.dispatchAllInvocationEvents(); exception = e; } } From 25cdeaec277e735e2ba20886648cf59bea31b2ad Mon Sep 17 00:00:00 2001 From: "Vladimir.Orlov" Date: Mon, 9 Feb 2015 14:52:39 +0300 Subject: [PATCH 20/20] IDEA-136082 IDEA freezes during indexing; OutOfMemoryError: PermGen space --- build/scripts/dist.gant | 1 + 1 file changed, 1 insertion(+) diff --git a/build/scripts/dist.gant b/build/scripts/dist.gant index 3d6b4f5e7502..59e7c9a0beb0 100644 --- a/build/scripts/dist.gant +++ b/build/scripts/dist.gant @@ -199,6 +199,7 @@ private layoutMac(Map _args, String home, Paths paths) { args."idea.properties.path" = "${paths.distAll}/bin/idea.properties" args.urlSchemes = ["idea"] args.mac_no_yjp = true + args.executable = "idea" layoutMacApp(target, home, args) }