From 1ca73cfc0f01d2ba9b4cbe4be2fd6a22f0f232f9 Mon Sep 17 00:00:00 2001
From: "Egor.Ushakov"
Date: Mon, 18 Aug 2014 15:38:45 +0400
Subject: [PATCH 01/27] reduce debugger views flickering - process all events
with delay
---
.../xdebugger/impl/frame/XDebugView.java | 33 +++++++++----------
.../impl/frame/XDebugViewSessionListener.java | 2 +-
.../xdebugger/impl/frame/XFramesView.java | 4 +--
.../xdebugger/impl/frame/XVariablesView.java | 3 +-
.../impl/frame/XWatchesViewImpl.java | 3 +-
.../xdebugger/impl/ui/XDebugSessionTab.java | 2 +-
6 files changed, 20 insertions(+), 27 deletions(-)
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java
index b92069b6dea7..3e0433b804af 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java
@@ -20,7 +20,7 @@ import com.intellij.ide.DataManager;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.ui.content.ContentManager;
-import com.intellij.util.SingleAlarm;
+import com.intellij.util.Alarm;
import com.intellij.xdebugger.XDebugSession;
import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
import org.jetbrains.annotations.NotNull;
@@ -35,29 +35,26 @@ import java.util.EventObject;
public abstract class XDebugView implements Disposable {
public enum SessionEvent {PAUSED, BEFORE_RESUME, RESUMED, STOPPED, FRAME_CHANGED, SETTINGS_CHANGED}
- private final SingleAlarm myClearAlarm;
- private static final int VIEW_CLEAR_DELAY = 100; //ms
+ private final Alarm myUpdateAlarm;
+ private static final int VIEW_UPDATE_DELAY = 100; //ms
public XDebugView() {
- myClearAlarm = new SingleAlarm(new Runnable() {
- @Override
- public void run() {
- clear();
- }
- }, VIEW_CLEAR_DELAY, this);
- }
-
- protected final void requestClear() {
- myClearAlarm.cancelAndRequest();
- }
-
- protected final void cancelClear() {
- myClearAlarm.cancel();
+ myUpdateAlarm = new Alarm(this);
}
protected abstract void clear();
- public abstract void processSessionEvent(@NotNull SessionEvent event);
+ public void onSessionEvent(@NotNull final SessionEvent event) {
+ myUpdateAlarm.cancelAllRequests();
+ myUpdateAlarm.addRequest(new Runnable() {
+ @Override
+ public void run() {
+ processSessionEvent(event);
+ }
+ }, VIEW_UPDATE_DELAY);
+ }
+
+ protected abstract void processSessionEvent(@NotNull SessionEvent event);
@Nullable
protected static XDebugSession getSession(@NotNull EventObject e) {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java
index d790113b1816..2e21ed0f2248 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java
@@ -36,7 +36,7 @@ public class XDebugViewSessionListener extends XDebugSessionAdapter {
AppUIUtil.invokeLaterIfProjectAlive(session.getProject(), new Runnable() {
@Override
public void run() {
- myDebugView.processSessionEvent(event);
+ myDebugView.onSessionEvent(event);
}
});
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java
index b98440b5d69f..6ab8acd1152e 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java
@@ -221,13 +221,11 @@ public class XFramesView extends XDebugView {
mySelectedStack = null;
XSuspendContext suspendContext = session == null ? null : session.getSuspendContext();
if (suspendContext == null) {
- requestClear();
+ clear();
return;
}
if (event == SessionEvent.PAUSED) {
- // clear immediately
- cancelClear();
clear();
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesView.java
index df43b1147419..c1232b572433 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesView.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesView.java
@@ -57,11 +57,10 @@ public class XVariablesView extends XVariablesViewBase {
tree.markNodesObsolete();
if (stackFrame != null) {
- cancelClear();
buildTreeAndRestoreState(stackFrame);
}
else {
- requestClear();
+ clear();
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
index c510cd17c90a..b8d088d79231 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
@@ -275,7 +275,6 @@ public class XWatchesViewImpl extends XDebugView implements DnDNativeTarget, XWa
XDebugSession session = getSession(getMainPanel());
XStackFrame stackFrame = session == null ? null : session.getCurrentStackFrame();
if (stackFrame != null) {
- cancelClear();
tree.setSourcePosition(stackFrame.getSourcePosition());
myRootNode.updateWatches(stackFrame.getEvaluator());
if (myTreeState != null) {
@@ -283,7 +282,7 @@ public class XWatchesViewImpl extends XDebugView implements DnDNativeTarget, XWa
}
}
else {
- requestClear();
+ clear();
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
index 0fd33b5f0a2d..7f46d0483e2c 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
@@ -198,7 +198,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
@Override
public void run() {
for (XDebugView view : myViews) {
- view.processSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED);
+ view.onSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED);
}
}
});
From 7f95d997fb693eae662708968fdd40bb3dfa6f8a Mon Sep 17 00:00:00 2001
From: Alexander Lobas
Date: Mon, 18 Aug 2014 15:46:34 +0400
Subject: [PATCH 02/27] IDEA-126882 Throwable at
com.intellij.openapi.application.impl.ApplicationImpl.assertIsDispatchThread
---
.../sceneBuilder/SceneBuilderEditor.java | 39 +++++++++++++++----
1 file changed, 32 insertions(+), 7 deletions(-)
diff --git a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderEditor.java b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderEditor.java
index f0c1eccd86f1..a0a90efe9c74 100644
--- a/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderEditor.java
+++ b/plugins/javaFX/src/org/jetbrains/plugins/javaFX/sceneBuilder/SceneBuilderEditor.java
@@ -11,11 +11,13 @@ import com.intellij.openapi.editor.event.DocumentEvent;
import com.intellij.openapi.fileEditor.*;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.Messages;
-import com.intellij.openapi.ui.VerticalFlowLayout;
import com.intellij.openapi.util.UserDataHolderBase;
import com.intellij.openapi.vfs.ReadonlyStatusHandler;
import com.intellij.openapi.vfs.VirtualFile;
import com.intellij.ui.HyperlinkLabel;
+import com.intellij.ui.ScrollPaneFactory;
+import com.intellij.util.ExceptionUtil;
+import com.intellij.util.ui.UIUtil;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -42,8 +44,10 @@ public class SceneBuilderEditor extends UserDataHolderBase implements FileEditor
private final CardLayout myLayout = new CardLayout();
private final JPanel myPanel = new JPanel(myLayout);
- private final JPanel myErrorPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 5, true, false));
+ //private final JPanel myErrorPanel = new JPanel(new VerticalFlowLayout(VerticalFlowLayout.TOP, 10, 5, true, false));
+ private final JPanel myErrorPanel = new JPanel(new BorderLayout());
private final HyperlinkLabel myErrorLabel = new HyperlinkLabel();
+ private JTextArea myErrorStack;
private final Document myDocument;
private final ExternalChangeListener myChangeListener;
@@ -72,11 +76,19 @@ public class SceneBuilderEditor extends UserDataHolderBase implements FileEditor
}
});
- myErrorPanel.add(myErrorLabel);
+ myErrorStack = new JTextArea(50, 20);
+ myErrorStack.setEditable(false);
+
+ myErrorPanel.add(myErrorLabel, BorderLayout.NORTH);
+ myErrorPanel.add(ScrollPaneFactory.createScrollPane(myErrorStack), BorderLayout.CENTER);
myPanel.add(myErrorPanel);
}
private void showErrorPage(State state, Throwable e) {
+ if (e != null) {
+ LOG.info(e);
+ }
+
removeSceneBuilder();
if (e == null) {
@@ -93,12 +105,21 @@ public class SceneBuilderEditor extends UserDataHolderBase implements FileEditor
}
myErrorLabel.setIcon(Messages.getWarningIcon());
}
+
+ myErrorStack.setText(null);
+ myErrorStack.setVisible(false);
}
else {
- myErrorLabel.setHyperlinkText("Error: " + e.getMessage(), "", "");
+ String message = e.getMessage();
+ if (message == null) {
+ message = e.getClass().getName();
+ }
+
+ myErrorLabel.setHyperlinkText("Error: " + message, "", "");
myErrorLabel.setIcon(Messages.getErrorIcon());
- LOG.info(e);
+ myErrorStack.setText(ExceptionUtil.getThrowableText(e));
+ myErrorStack.setVisible(true);
}
myLayout.show(myPanel, ERROR_CARD);
}
@@ -139,8 +160,12 @@ public class SceneBuilderEditor extends UserDataHolderBase implements FileEditor
}
@Override
- public void handleError(Throwable e) {
- showErrorPage(null, e);
+ public void handleError(final Throwable e) {
+ UIUtil.invokeLaterIfNeeded(new Runnable() {
+ public void run() {
+ showErrorPage(null, e);
+ }
+ });
}
private void initSceneBuilder(boolean choosePathIfEmpty) {
From 3bf29c9c255def4cc985858665156fafb0007383 Mon Sep 17 00:00:00 2001
From: Dmitry Batrak
Date: Mon, 18 Aug 2014 16:00:12 +0400
Subject: [PATCH 03/27] EA-31437 - assert: DocumentFoldingInfo.writeExternal
---
.../PsiNamesElementSignatureProvider.java | 47 ++++++++++++++++---
1 file changed, 40 insertions(+), 7 deletions(-)
diff --git a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/PsiNamesElementSignatureProvider.java b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/PsiNamesElementSignatureProvider.java
index 17a85304d4a1..3409d3f93fc8 100644
--- a/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/PsiNamesElementSignatureProvider.java
+++ b/platform/lang-impl/src/com/intellij/codeInsight/folding/impl/PsiNamesElementSignatureProvider.java
@@ -89,11 +89,23 @@ public class PsiNamesElementSignatureProvider extends AbstractElementSignaturePr
return candidate instanceof PsiComment ? candidate : null;
}
else if (CODE_BLOCK_MARKER.equals(elementMarker)) {
+ int index = 0;
+ if (tokenizer.hasMoreTokens()) {
+ String indexStr = tokenizer.nextToken();
+ try {
+ index = Integer.parseInt(indexStr);
+ }
+ catch (NumberFormatException e) {
+ if (processingInfoStorage != null) {
+ processingInfoStorage.append("Invalid block index: ").append(indexStr).append("\n");
+ }
+ }
+ }
for (PsiElement child = parent.getFirstChild(); child != null; child = child.getNextSibling()) {
- PsiElement firstChild = child.getFirstChild();
- PsiElement lastChild = child.getLastChild();
- if (firstChild != null && lastChild != null && "{".equals(firstChild.getText()) && "}".equals(lastChild.getText())) {
- return child;
+ if (isBlockElement(child)) {
+ if (--index < 0) {
+ return child;
+ }
}
}
return null;
@@ -212,18 +224,39 @@ public class PsiNamesElementSignatureProvider extends AbstractElementSignaturePr
PsiElement parent = element.getParent();
if (parent instanceof PsiNamedElement && !(parent instanceof PsiFile)) {
- PsiElement firstChild = element.getFirstChild();
- PsiElement lastChild = element.getLastChild();
- if (firstChild != null && "{".equals(firstChild.getText()) && lastChild != null && "}".equals(lastChild.getText())) {
+ if (isBlockElement(element)) {
+ int index = getBlockElementIndex(element);
StringBuilder bufferToUse = buffer;
if (bufferToUse == null) {
bufferToUse = new StringBuilder();
}
bufferToUse.append(TYPE_MARKER).append(ELEMENT_TOKENS_SEPARATOR).append(CODE_BLOCK_MARKER);
+ if (index > 0) {
+ bufferToUse.append(ELEMENT_TOKENS_SEPARATOR).append(index);
+ }
return bufferToUse;
}
}
return null;
}
+
+ private static boolean isBlockElement(@NotNull PsiElement element) {
+ PsiElement firstChild = element.getFirstChild();
+ PsiElement lastChild = element.getLastChild();
+ return firstChild != null && "{".equals(firstChild.getText()) && lastChild != null && "}".equals(lastChild.getText());
+ }
+
+ private static int getBlockElementIndex(@NotNull PsiElement element) {
+ int i = 0;
+ for (PsiElement sibling : element.getParent().getChildren()) {
+ if (element.equals(sibling)) {
+ return i;
+ }
+ if (isBlockElement(sibling)) {
+ i++;
+ }
+ }
+ throw new RuntimeException("Malformed PSI");
+ }
}
From 4185e066b7c4a5851b9503b5b0c3e3b08873aec9 Mon Sep 17 00:00:00 2001
From: "Egor.Ushakov"
Date: Mon, 18 Aug 2014 16:04:04 +0400
Subject: [PATCH 04/27] EA-57323 - assert:
PositionManagerImpl.getSourcePosition
---
.../intellij/debugger/engine/JavaValue.java | 39 +++++++++++++------
1 file changed, 28 insertions(+), 11 deletions(-)
diff --git a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
index 1603ed928ded..9cfb2bfde84e 100644
--- a/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
+++ b/java/debugger/impl/src/com/intellij/debugger/engine/JavaValue.java
@@ -326,19 +326,36 @@ public class JavaValue extends XNamedValue implements NodeDescriptorProvider, XV
}
@Override
- public void computeSourcePosition(@NotNull XNavigatable navigatable) {
- if (myValueDescriptor instanceof FieldDescriptorImpl) {
- SourcePosition position = ((FieldDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
- if (position != null) {
- navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
+ public void computeSourcePosition(@NotNull final XNavigatable navigatable) {
+ if (myEvaluationContext.getSuspendContext().isResumed()) return;
+ myEvaluationContext.getDebugProcess().getManagerThread().schedule(new SuspendContextCommandImpl(myEvaluationContext.getSuspendContext()) {
+ @Override
+ public Priority getPriority() {
+ return Priority.NORMAL;
}
- }
- if (myValueDescriptor instanceof LocalVariableDescriptorImpl) {
- SourcePosition position = ((LocalVariableDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
- if (position != null) {
- navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
+
+ @Override
+ public void contextAction() throws Exception {
+ ApplicationManager.getApplication().runReadAction(new Runnable() {
+ @Override
+ public void run() {
+ if (myValueDescriptor instanceof FieldDescriptorImpl) {
+ SourcePosition position = ((FieldDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
+ if (position != null) {
+ navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
+ }
+ }
+ if (myValueDescriptor instanceof LocalVariableDescriptorImpl) {
+ SourcePosition position =
+ ((LocalVariableDescriptorImpl)myValueDescriptor).getSourcePosition(getProject(), getDebuggerContext());
+ if (position != null) {
+ navigatable.setSourcePosition(DebuggerUtilsEx.toXSourcePosition(position));
+ }
+ }
+ }
+ });
}
- }
+ });
}
private DebuggerContextImpl getDebuggerContext() {
From d4bc8b431058d4a2257e66b61cb2e53e47244e18 Mon Sep 17 00:00:00 2001
From: Vladimir Krivosheev
Date: Mon, 18 Aug 2014 14:47:26 +0200
Subject: [PATCH 05/27] =?UTF-8?q?js=20"Inspect=20in=20IDE"=20=E2=80=94=20a?=
=?UTF-8?q?dd=20rerun=20action=20(actually,=20"reload=20page",=20to=20be?=
=?UTF-8?q?=20discussed)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../src/com/intellij/xdebugger/XDebugSession.java | 2 ++
.../src/com/intellij/xdebugger/impl/XDebugSessionImpl.java | 2 ++
.../src/com/intellij/xdebugger/impl/frame/XDebugView.java | 5 ++---
.../src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java | 3 +--
4 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugSession.java b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugSession.java
index be71aac98d1e..33fa877064db 100644
--- a/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugSession.java
+++ b/platform/xdebugger-api/src/com/intellij/xdebugger/XDebugSession.java
@@ -21,6 +21,7 @@ import com.intellij.execution.ui.ConsoleView;
import com.intellij.execution.ui.RunContentDescriptor;
import com.intellij.execution.ui.RunnerLayoutUi;
import com.intellij.openapi.Disposable;
+import com.intellij.openapi.actionSystem.DataKey;
import com.intellij.openapi.project.Project;
import com.intellij.openapi.ui.MessageType;
import com.intellij.xdebugger.breakpoints.XBreakpoint;
@@ -45,6 +46,7 @@ import javax.swing.event.HyperlinkListener;
* @author nik
*/
public interface XDebugSession extends AbstractDebuggerSession {
+ DataKey DATA_KEY = DataKey.create("XDebugSessionTab.XDebugSession");
@NotNull
Project getProject();
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
index 6ff63601d06a..8ee2f1ee587a 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/XDebugSessionImpl.java
@@ -170,6 +170,7 @@ public class XDebugSessionImpl implements XDebugSession {
myPauseActionSupported = isSupported;
}
+ @NotNull
public List getRestartActions() {
return myRestartActions;
}
@@ -180,6 +181,7 @@ public class XDebugSessionImpl implements XDebugSession {
}
}
+ @NotNull
public List getExtraActions() {
return myExtraActions;
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java
index 3e0433b804af..d26258d39d2a 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java
@@ -22,7 +22,6 @@ import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.ui.content.ContentManager;
import com.intellij.util.Alarm;
import com.intellij.xdebugger.XDebugSession;
-import com.intellij.xdebugger.impl.ui.XDebugSessionTab;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -68,11 +67,11 @@ public abstract class XDebugView implements Disposable {
ViewContext viewContext = ViewContext.CONTEXT_KEY.getData(dataContext);
ContentManager contentManager = viewContext == null ? null : viewContext.getContentManager();
if (contentManager != null) {
- XDebugSession session = XDebugSessionTab.SESSION_KEY.getData(DataManager.getInstance().getDataContext(contentManager.getComponent()));
+ XDebugSession session = XDebugSession.DATA_KEY.getData(DataManager.getInstance().getDataContext(contentManager.getComponent()));
if (session != null) {
return session;
}
}
- return XDebugSessionTab.SESSION_KEY.getData(dataContext);
+ return XDebugSession.DATA_KEY.getData(dataContext);
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
index 7f46d0483e2c..d7e2354835fd 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
@@ -56,7 +56,6 @@ import java.util.List;
public class XDebugSessionTab extends DebuggerSessionTabBase {
private static final DataKey TAB_KEY = DataKey.create("XDebugSessionTab");
- public static final DataKey SESSION_KEY = DataKey.create("XDebugSessionTab.XDebugSession");
private XWatchesViewImpl myWatchesView;
private final List myViews = new ArrayList();
@@ -146,7 +145,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
}
if (mySession != null) {
- if (SESSION_KEY.is(dataId)) {
+ if (XDebugSession.DATA_KEY.is(dataId)) {
return mySession;
}
else if (LangDataKeys.CONSOLE_VIEW.is(dataId)) {
From d0567bf63e9d3871b2ea83b3797810f303c61323 Mon Sep 17 00:00:00 2001
From: Nadya Zabrodina
Date: Mon, 18 Aug 2014 17:09:19 +0400
Subject: [PATCH 06/27] IDEA-126632 wrong Mercurial commits number notification
* hg push successful message pattern extended;
* annotations added
---
.../src/org/zmlx/hg4idea/HgPusher.java | 48 +++----------------
1 file changed, 6 insertions(+), 42 deletions(-)
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java
index c8e6075649ce..18294df94a66 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java
@@ -20,12 +20,12 @@ import com.intellij.openapi.project.Project;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.openapi.vfs.VirtualFile;
+import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.zmlx.hg4idea.action.HgCommandResultNotifier;
import org.zmlx.hg4idea.command.HgPushCommand;
import org.zmlx.hg4idea.execution.HgCommandResult;
import org.zmlx.hg4idea.execution.HgCommandResultHandler;
-import org.zmlx.hg4idea.ui.HgPushDialog;
import java.util.List;
import java.util.regex.Matcher;
@@ -34,40 +34,13 @@ import java.util.regex.Pattern;
public class HgPusher {
private static final Logger LOG = Logger.getInstance(HgPusher.class);
- private static Pattern PUSH_COMMITS_PATTERN = Pattern.compile(".*added (\\d+) changesets.*");
+ private static final String ONE = "one";
+ private static Pattern PUSH_COMMITS_PATTERN = Pattern.compile(".*(?:added|pushed) (\\d+|" + ONE + ") changeset.*");
// hg push command has definite exit values for some cases:
// mercurial returns 0 if push was successful, 1 if nothing to push. see hg push --help
private static int PUSH_SUCCEEDED_EXIT_VALUE = 0;
private static int NOTHING_TO_PUSH_EXIT_VALUE = 1;
- private final Project myProject;
-
- public HgPusher(Project project) {
- myProject = project;
- }
-
- /* public void showDialogAndPush(@NotNull List extends Repository> selectedRepositories) {
-
- if (selectedRepositories.isEmpty()) {
- VcsBalloonProblemNotifier.showOverChangesView(myProject, "No Mercurial repositories in the project", MessageType.ERROR);
- return;
- }
- final AtomicReference pushCommand = new AtomicReference();
- final HgPushDialog dialog = new HgPushDialog(myProject, repositories, selectedRepo);
- dialog.show();
- if (d2.isOK()) {
- pushCommand.set(preparePushCommand(myProject, dialog));
- new Task.Backgroundable(myProject, "Pushing...", false) {
- @Override
- public void run(@NotNull ProgressIndicator indicator) {
- if (pushCommand.get() != null) {
- push(myProject, pushCommand.get());
- }
- }
- }.queue();
- }
- }*/
-
public static void push(final Project project, HgPushCommand command) {
final VirtualFile repo = command.getRepo();
command.execute(new HgCommandResultHandler() {
@@ -95,17 +68,7 @@ public class HgPusher {
});
}
- private static HgPushCommand preparePushCommand(Project project, HgPushDialog dialog) {
- final HgPushCommand command = new HgPushCommand(project, dialog.getRepository().getRoot(), dialog.getTarget());
- command.setRevision(dialog.getRevision());
- command.setForce(dialog.isForce());
- command.setBranchName(dialog.getBranch());
- command.setBookmarkName(dialog.getBookmarkName());
- command.setIsNewBranch(dialog.isNewBranch());
- return command;
- }
-
- private static int getNumberOfPushedCommits(HgCommandResult result) {
+ private static int getNumberOfPushedCommits(@NotNull HgCommandResult result) {
int numberOfCommitsInAllSubrepos = 0;
final List outputLines = result.getOutputLines();
for (String outputLine : outputLines) {
@@ -113,7 +76,8 @@ public class HgPusher {
final Matcher matcher = PUSH_COMMITS_PATTERN.matcher(outputLine);
if (matcher.matches()) {
try {
- numberOfCommitsInAllSubrepos += Integer.parseInt(matcher.group(1));
+ String numberOfCommits = matcher.group(1);
+ numberOfCommitsInAllSubrepos += ONE.equals(numberOfCommits) ? 1 : Integer.parseInt(numberOfCommits);
}
catch (NumberFormatException e) {
LOG.error("getNumberOfPushedCommits ", e);
From 00c2b0b12546bfe50e92c9ef4444677c41420ec4 Mon Sep 17 00:00:00 2001
From: Anna Kozlova
Date: Mon, 18 Aug 2014 17:16:39 +0400
Subject: [PATCH 07/27] typo
---
.../completion/JavaGenerateMemberCompletionContributor.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java
index 0deafb45cad9..351eca4857fd 100644
--- a/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java
+++ b/java/java-impl/src/com/intellij/codeInsight/completion/JavaGenerateMemberCompletionContributor.java
@@ -69,7 +69,7 @@ public class JavaGenerateMemberCompletionContributor {
for (PsiField field : parent.getFields()) {
if (!(field instanceof PsiEnumConstant)) {
Collections.addAll(prototypes, GetterSetterPrototypeProvider.generateGetterSetters(field, true));
- Collections.addAll(prototypes, GetterSetterPrototypeProvider.generateGetterSetters(field, true));
+ Collections.addAll(prototypes, GetterSetterPrototypeProvider.generateGetterSetters(field, false));
}
}
for (final PsiMethod prototype : prototypes) {
From b520ce6d71b7ac306d013bbb3de7f8bdf4bc6178 Mon Sep 17 00:00:00 2001
From: Kirill Likhodedov
Date: Sun, 17 Aug 2014 20:41:52 +0400
Subject: [PATCH 08/27] [git] formatting
---
.../git4idea/ui/branch/GitBranchPopup.java | 45 +++++++------------
1 file changed, 17 insertions(+), 28 deletions(-)
diff --git a/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopup.java b/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopup.java
index bd9c8fb3a1b3..1cb7cf6a66c9 100644
--- a/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopup.java
+++ b/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopup.java
@@ -45,14 +45,8 @@ import javax.swing.event.HyperlinkEvent;
import java.util.List;
/**
- *
* The popup which allows to quickly switch and control Git branches.
- *
- *
- * Use {@link #asListPopup()} to achieve the {@link ListPopup} itself.
- *
- *
- * @author Kirill Likhodedov
+ *
*/
class GitBranchPopup {
@@ -160,32 +154,28 @@ class GitBranchPopup {
}
private void notifyAboutSyncedBranches() {
- VcsNotifier.getInstance(myProject).notifyImportantInfo("Synchronous branch control enabled",
- "You have several Git roots in the project and they all are checked out at the same branch. " +
- "We've enabled synchronous branch control for the project. " +
- "If you wish to control branches in different roots separately, you may disable the setting.",
- new NotificationListener() {
- @Override
- public void hyperlinkUpdate(@NotNull Notification notification,
- @NotNull HyperlinkEvent event) {
- if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
- ShowSettingsUtil.getInstance().showSettingsDialog(myProject, myVcs
- .getConfigurable().getDisplayName());
- if (myVcsSettings.getSyncSetting() == GitBranchSyncSetting.DONT) {
- notification.expire();
- }
- }
- }
- }
- );
+ String description = "You have several Git roots in the project and they all are checked out at the same branch. " +
+ "We've enabled synchronous branch control for the project. " +
+ "If you wish to control branches in different roots separately, " +
+ "you may disable the setting.";
+ NotificationListener listener = new NotificationListener() {
+ @Override
+ public void hyperlinkUpdate(@NotNull Notification notification, @NotNull HyperlinkEvent event) {
+ if (event.getEventType() == HyperlinkEvent.EventType.ACTIVATED) {
+ ShowSettingsUtil.getInstance().showSettingsDialog(myProject, myVcs.getConfigurable().getDisplayName());
+ if (myVcsSettings.getSyncSetting() == GitBranchSyncSetting.DONT) {
+ notification.expire();
+ }
+ }
+ }
+ };
+ VcsNotifier.getInstance(myProject).notifyImportantInfo("Synchronous branch control enabled", description, listener);
}
private ActionGroup createActions() {
DefaultActionGroup popupGroup = new DefaultActionGroup(null, false);
-
GitRepositoryManager repositoryManager = myRepositoryManager;
if (repositoryManager.moreThanOneRoot()) {
-
if (userWantsSyncControl()) {
fillWithCommonRepositoryActions(popupGroup, repositoryManager);
}
@@ -196,7 +186,6 @@ class GitBranchPopup {
else {
fillPopupWithCurrentRepositoryActions(popupGroup, null);
}
-
popupGroup.addSeparator();
return popupGroup;
}
From b2741e77c71b2a1aaf37736d4278f13c93ad3d46 Mon Sep 17 00:00:00 2001
From: Kirill Likhodedov
Date: Mon, 18 Aug 2014 17:18:40 +0400
Subject: [PATCH 09/27] [git] cosmetics: remove dot in the end of action
description
---
.../dvcs-impl/src/com/intellij/dvcs/ui/NewBranchAction.java | 5 +----
.../src/git4idea/ui/branch/GitBranchPopupActions.java | 6 +-----
2 files changed, 2 insertions(+), 9 deletions(-)
diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/ui/NewBranchAction.java b/platform/dvcs-impl/src/com/intellij/dvcs/ui/NewBranchAction.java
index 29481e236c2a..92ba9515b5d6 100644
--- a/platform/dvcs-impl/src/com/intellij/dvcs/ui/NewBranchAction.java
+++ b/platform/dvcs-impl/src/com/intellij/dvcs/ui/NewBranchAction.java
@@ -25,9 +25,6 @@ import org.jetbrains.annotations.NotNull;
import java.util.List;
-/**
- * @author Nadya Zabrodina
- */
public abstract class NewBranchAction extends DumbAwareAction {
protected final List myRepositories;
protected Project myProject;
@@ -43,7 +40,7 @@ public abstract class NewBranchAction extends DumbAwareAct
public void update(AnActionEvent e) {
if (DvcsUtil.anyRepositoryIsFresh(myRepositories)) {
e.getPresentation().setEnabled(false);
- e.getPresentation().setDescription("Checkout of a new branch is not possible before the first commit.");
+ e.getPresentation().setDescription("Checkout of a new branch is not possible before the first commit");
}
}
diff --git a/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java b/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java
index dbd3f8c902e5..b3cba24540de 100644
--- a/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java
+++ b/plugins/git4idea/src/git4idea/ui/branch/GitBranchPopupActions.java
@@ -36,10 +36,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
-/**
- *
- * @author Kirill Likhodedov
- */
class GitBranchPopupActions {
private final Project myProject;
@@ -123,7 +119,7 @@ class GitBranchPopupActions {
public void update(AnActionEvent e) {
if (myRepository.isFresh()) {
e.getPresentation().setEnabled(false);
- e.getPresentation().setDescription("Checkout is not possible before the first commit.");
+ e.getPresentation().setDescription("Checkout is not possible before the first commit");
}
}
}
From d80afac72fac5a89b08d7efe70767aa3c1af65de Mon Sep 17 00:00:00 2001
From: Kirill Likhodedov
Date: Mon, 18 Aug 2014 17:19:26 +0400
Subject: [PATCH 10/27] [dvcs] branch popup: show disabled actions to avoid
confusion like in IDEA-128449
---
.../src/com/intellij/dvcs/ui/BranchActionGroupPopup.java | 5 +----
1 file changed, 1 insertion(+), 4 deletions(-)
diff --git a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java
index 3b935745a212..44b4c8c5c3f0 100644
--- a/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java
+++ b/platform/dvcs-impl/src/com/intellij/dvcs/ui/BranchActionGroupPopup.java
@@ -34,13 +34,10 @@ import org.jetbrains.annotations.Nullable;
import javax.swing.*;
import java.awt.*;
-/**
- * @author Nadya Zabrodina
- */
public class BranchActionGroupPopup extends PopupFactoryImpl.ActionGroupPopup {
public BranchActionGroupPopup(@NotNull String title, @NotNull Project project,
@NotNull Condition preselectActionCondition, @NotNull ActionGroup actions) {
- super(title, actions, SimpleDataContext.getProjectContext(project), false, false, false, false, null, -1,
+ super(title, actions, SimpleDataContext.getProjectContext(project), false, false, true, false, null, -1,
preselectActionCondition, null);
}
From a9dc0f131e9e380749fd3fee41498951b4101c45 Mon Sep 17 00:00:00 2001
From: Nadya Zabrodina
Date: Mon, 18 Aug 2014 17:27:58 +0400
Subject: [PATCH 11/27] refactoring: unnecessary old HgPusher removed
---
.../src/org/zmlx/hg4idea/HgPusher.java | 90 -------------------
.../src/org/zmlx/hg4idea/push/HgPusher.java | 67 +++++++++++++-
2 files changed, 66 insertions(+), 91 deletions(-)
delete mode 100644 plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java b/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java
deleted file mode 100644
index 18294df94a66..000000000000
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/HgPusher.java
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
- * Copyright 2000-2011 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 org.zmlx.hg4idea;
-
-import com.intellij.openapi.diagnostic.Logger;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.text.StringUtil;
-import com.intellij.openapi.vcs.VcsNotifier;
-import com.intellij.openapi.vfs.VirtualFile;
-import org.jetbrains.annotations.NotNull;
-import org.jetbrains.annotations.Nullable;
-import org.zmlx.hg4idea.action.HgCommandResultNotifier;
-import org.zmlx.hg4idea.command.HgPushCommand;
-import org.zmlx.hg4idea.execution.HgCommandResult;
-import org.zmlx.hg4idea.execution.HgCommandResultHandler;
-
-import java.util.List;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-public class HgPusher {
-
- private static final Logger LOG = Logger.getInstance(HgPusher.class);
- private static final String ONE = "one";
- private static Pattern PUSH_COMMITS_PATTERN = Pattern.compile(".*(?:added|pushed) (\\d+|" + ONE + ") changeset.*");
- // hg push command has definite exit values for some cases:
- // mercurial returns 0 if push was successful, 1 if nothing to push. see hg push --help
- private static int PUSH_SUCCEEDED_EXIT_VALUE = 0;
- private static int NOTHING_TO_PUSH_EXIT_VALUE = 1;
-
- public static void push(final Project project, HgPushCommand command) {
- final VirtualFile repo = command.getRepo();
- command.execute(new HgCommandResultHandler() {
- @Override
- public void process(@Nullable HgCommandResult result) {
- if (result == null) {
- return;
- }
-
- if (result.getExitValue() == PUSH_SUCCEEDED_EXIT_VALUE) {
- int commitsNum = getNumberOfPushedCommits(result);
- String successTitle = "Pushed successfully";
- String successDescription = String.format("Pushed %d %s [%s]", commitsNum, StringUtil.pluralize("commit", commitsNum),
- repo.getPresentableName());
- VcsNotifier.getInstance(project).notifySuccess(successTitle, successDescription);
- }
- else if (result.getExitValue() == NOTHING_TO_PUSH_EXIT_VALUE) {
- VcsNotifier.getInstance(project).notifySuccess("Nothing to push");
- }
- else {
- new HgCommandResultNotifier(project).notifyError(result, "Push failed",
- "Failed to push to [" + repo.getPresentableName() + "]");
- }
- }
- });
- }
-
- private static int getNumberOfPushedCommits(@NotNull HgCommandResult result) {
- int numberOfCommitsInAllSubrepos = 0;
- final List outputLines = result.getOutputLines();
- for (String outputLine : outputLines) {
- outputLine = outputLine.trim();
- final Matcher matcher = PUSH_COMMITS_PATTERN.matcher(outputLine);
- if (matcher.matches()) {
- try {
- String numberOfCommits = matcher.group(1);
- numberOfCommitsInAllSubrepos += ONE.equals(numberOfCommits) ? 1 : Integer.parseInt(numberOfCommits);
- }
- catch (NumberFormatException e) {
- LOG.error("getNumberOfPushedCommits ", e);
- return -1;
- }
- }
- }
- return numberOfCommitsInAllSubrepos;
- }
-}
diff --git a/plugins/hg4idea/src/org/zmlx/hg4idea/push/HgPusher.java b/plugins/hg4idea/src/org/zmlx/hg4idea/push/HgPusher.java
index dcbfa314d03e..e09a09d9d3f1 100644
--- a/plugins/hg4idea/src/org/zmlx/hg4idea/push/HgPusher.java
+++ b/plugins/hg4idea/src/org/zmlx/hg4idea/push/HgPusher.java
@@ -19,16 +19,34 @@ import com.intellij.dvcs.push.PushSpec;
import com.intellij.dvcs.push.Pusher;
import com.intellij.dvcs.push.VcsPushOptionValue;
import com.intellij.dvcs.repo.Repository;
+import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.project.Project;
+import com.intellij.openapi.util.text.StringUtil;
+import com.intellij.openapi.vcs.VcsNotifier;
+import com.intellij.openapi.vfs.VirtualFile;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.zmlx.hg4idea.action.HgCommandResultNotifier;
import org.zmlx.hg4idea.command.HgPushCommand;
+import org.zmlx.hg4idea.execution.HgCommandResult;
+import org.zmlx.hg4idea.execution.HgCommandResultHandler;
import org.zmlx.hg4idea.repo.HgRepository;
+import java.util.List;
import java.util.Map;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
public class HgPusher extends Pusher {
+ private static final Logger LOG = Logger.getInstance(HgPusher.class);
+ private static final String ONE = "one";
+ private static Pattern PUSH_COMMITS_PATTERN = Pattern.compile(".*(?:added|pushed) (\\d+|" + ONE + ") changeset.*");
+ // hg push command has definite exit values for some cases:
+ // mercurial returns 0 if push was successful, 1 if nothing to push. see hg push --help
+ private static int PUSH_SUCCEEDED_EXIT_VALUE = 0;
+ private static int NOTHING_TO_PUSH_EXIT_VALUE = 1;
+
@Override
public void push(@NotNull Map pushSpecs, @Nullable VcsPushOptionValue vcsPushOptionValue, boolean force) {
for (Map.Entry entry : pushSpecs.entrySet()) {
@@ -55,7 +73,54 @@ public class HgPusher extends Pusher {
else {
pushCommand.setBranchName(source.mySource);
}
- org.zmlx.hg4idea.HgPusher.push(project, pushCommand);
+ push(project, pushCommand);
}
}
+
+ public static void push(@NotNull final Project project, @NotNull HgPushCommand command) {
+ final VirtualFile repo = command.getRepo();
+ command.execute(new HgCommandResultHandler() {
+ @Override
+ public void process(@Nullable HgCommandResult result) {
+ if (result == null) {
+ return;
+ }
+
+ if (result.getExitValue() == PUSH_SUCCEEDED_EXIT_VALUE) {
+ int commitsNum = getNumberOfPushedCommits(result);
+ String successTitle = "Pushed successfully";
+ String successDescription = String.format("Pushed %d %s [%s]", commitsNum, StringUtil.pluralize("commit", commitsNum),
+ repo.getPresentableName());
+ VcsNotifier.getInstance(project).notifySuccess(successTitle, successDescription);
+ }
+ else if (result.getExitValue() == NOTHING_TO_PUSH_EXIT_VALUE) {
+ VcsNotifier.getInstance(project).notifySuccess("Nothing to push");
+ }
+ else {
+ new HgCommandResultNotifier(project).notifyError(result, "Push failed",
+ "Failed to push to [" + repo.getPresentableName() + "]");
+ }
+ }
+ });
+ }
+
+ private static int getNumberOfPushedCommits(@NotNull HgCommandResult result) {
+ int numberOfCommitsInAllSubrepos = 0;
+ final List outputLines = result.getOutputLines();
+ for (String outputLine : outputLines) {
+ outputLine = outputLine.trim();
+ final Matcher matcher = PUSH_COMMITS_PATTERN.matcher(outputLine);
+ if (matcher.matches()) {
+ try {
+ String numberOfCommits = matcher.group(1);
+ numberOfCommitsInAllSubrepos += ONE.equals(numberOfCommits) ? 1 : Integer.parseInt(numberOfCommits);
+ }
+ catch (NumberFormatException e) {
+ LOG.error("getNumberOfPushedCommits ", e);
+ return -1;
+ }
+ }
+ }
+ return numberOfCommitsInAllSubrepos;
+ }
}
From 0069c97b87b2e67332164ccaf50d1bcdfaacf55b Mon Sep 17 00:00:00 2001
From: Eugene Zhuravlev
Date: Mon, 18 Aug 2014 17:21:48 +0400
Subject: [PATCH 12/27] including module's configured roots in a configuration
fingerprint
---
.../src/org/jetbrains/jps/incremental/ModuleBuildTarget.java | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/jps/jps-builders/src/org/jetbrains/jps/incremental/ModuleBuildTarget.java b/jps/jps-builders/src/org/jetbrains/jps/incremental/ModuleBuildTarget.java
index a6ac897a1d2d..05c185862399 100644
--- a/jps/jps-builders/src/org/jetbrains/jps/incremental/ModuleBuildTarget.java
+++ b/jps/jps-builders/src/org/jetbrains/jps/incremental/ModuleBuildTarget.java
@@ -165,6 +165,10 @@ public final class ModuleBuildTarget extends JVMModuleBuildTarget
Date: Mon, 18 Aug 2014 17:57:29 +0400
Subject: [PATCH 13/27] reverted view update delay, BEFORE_RESUME can not be
delayed
---
.../xdebugger/impl/frame/XDebugView.java | 33 ++++++++++---------
.../impl/frame/XDebugViewSessionListener.java | 2 +-
.../xdebugger/impl/frame/XFramesView.java | 4 ++-
.../xdebugger/impl/frame/XVariablesView.java | 3 +-
.../impl/frame/XWatchesViewImpl.java | 3 +-
.../xdebugger/impl/ui/XDebugSessionTab.java | 2 +-
6 files changed, 27 insertions(+), 20 deletions(-)
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java
index d26258d39d2a..0007ec2f9997 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugView.java
@@ -20,7 +20,7 @@ import com.intellij.ide.DataManager;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.actionSystem.DataContext;
import com.intellij.ui.content.ContentManager;
-import com.intellij.util.Alarm;
+import com.intellij.util.SingleAlarm;
import com.intellij.xdebugger.XDebugSession;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
@@ -34,26 +34,29 @@ import java.util.EventObject;
public abstract class XDebugView implements Disposable {
public enum SessionEvent {PAUSED, BEFORE_RESUME, RESUMED, STOPPED, FRAME_CHANGED, SETTINGS_CHANGED}
- private final Alarm myUpdateAlarm;
- private static final int VIEW_UPDATE_DELAY = 100; //ms
+ private final SingleAlarm myClearAlarm;
+ private static final int VIEW_CLEAR_DELAY = 100; //ms
public XDebugView() {
- myUpdateAlarm = new Alarm(this);
+ myClearAlarm = new SingleAlarm(new Runnable() {
+ @Override
+ public void run() {
+ clear();
+ }
+ }, VIEW_CLEAR_DELAY, this);
+ }
+
+ protected final void requestClear() {
+ myClearAlarm.cancelAndRequest();
+ }
+
+ protected final void cancelClear() {
+ myClearAlarm.cancel();
}
protected abstract void clear();
- public void onSessionEvent(@NotNull final SessionEvent event) {
- myUpdateAlarm.cancelAllRequests();
- myUpdateAlarm.addRequest(new Runnable() {
- @Override
- public void run() {
- processSessionEvent(event);
- }
- }, VIEW_UPDATE_DELAY);
- }
-
- protected abstract void processSessionEvent(@NotNull SessionEvent event);
+ public abstract void processSessionEvent(@NotNull SessionEvent event);
@Nullable
protected static XDebugSession getSession(@NotNull EventObject e) {
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java
index 2e21ed0f2248..d790113b1816 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XDebugViewSessionListener.java
@@ -36,7 +36,7 @@ public class XDebugViewSessionListener extends XDebugSessionAdapter {
AppUIUtil.invokeLaterIfProjectAlive(session.getProject(), new Runnable() {
@Override
public void run() {
- myDebugView.onSessionEvent(event);
+ myDebugView.processSessionEvent(event);
}
});
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java
index 6ab8acd1152e..b98440b5d69f 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XFramesView.java
@@ -221,11 +221,13 @@ public class XFramesView extends XDebugView {
mySelectedStack = null;
XSuspendContext suspendContext = session == null ? null : session.getSuspendContext();
if (suspendContext == null) {
- clear();
+ requestClear();
return;
}
if (event == SessionEvent.PAUSED) {
+ // clear immediately
+ cancelClear();
clear();
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesView.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesView.java
index c1232b572433..df43b1147419 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesView.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XVariablesView.java
@@ -57,10 +57,11 @@ public class XVariablesView extends XVariablesViewBase {
tree.markNodesObsolete();
if (stackFrame != null) {
+ cancelClear();
buildTreeAndRestoreState(stackFrame);
}
else {
- clear();
+ requestClear();
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
index b8d088d79231..c510cd17c90a 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/frame/XWatchesViewImpl.java
@@ -275,6 +275,7 @@ public class XWatchesViewImpl extends XDebugView implements DnDNativeTarget, XWa
XDebugSession session = getSession(getMainPanel());
XStackFrame stackFrame = session == null ? null : session.getCurrentStackFrame();
if (stackFrame != null) {
+ cancelClear();
tree.setSourcePosition(stackFrame.getSourcePosition());
myRootNode.updateWatches(stackFrame.getEvaluator());
if (myTreeState != null) {
@@ -282,7 +283,7 @@ public class XWatchesViewImpl extends XDebugView implements DnDNativeTarget, XWa
}
}
else {
- clear();
+ requestClear();
}
}
diff --git a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
index d7e2354835fd..4c3766f23f5d 100644
--- a/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
+++ b/platform/xdebugger-impl/src/com/intellij/xdebugger/impl/ui/XDebugSessionTab.java
@@ -197,7 +197,7 @@ public class XDebugSessionTab extends DebuggerSessionTabBase {
@Override
public void run() {
for (XDebugView view : myViews) {
- view.onSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED);
+ view.processSessionEvent(XDebugView.SessionEvent.SETTINGS_CHANGED);
}
}
});
From 1d23281fe7697e3536c2ec83284c5793d2e85b2b Mon Sep 17 00:00:00 2001
From: Kirill Likhodedov
Date: Mon, 18 Aug 2014 18:24:11 +0400
Subject: [PATCH 14/27] [git] IDEA-87092 handle local changes overwritten error
on unstash
Unstashing is currently a modal process => show a dialog instead of
a notification.
---
.../src/git4idea/ui/GitUnstashDialog.java | 7 +++
.../LocalChangesWouldBeOverwrittenHelper.java | 45 ++++++++++++-------
2 files changed, 36 insertions(+), 16 deletions(-)
diff --git a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
index eccaa446b0ed..44e4f1fab4b9 100644
--- a/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
+++ b/plugins/git4idea/src/git4idea/ui/GitUnstashDialog.java
@@ -51,6 +51,7 @@ import git4idea.merge.GitConflictResolver;
import git4idea.repo.GitRepository;
import git4idea.stash.GitStashUtils;
import git4idea.util.GitUIUtil;
+import git4idea.util.LocalChangesWouldBeOverwrittenHelper;
import git4idea.util.UntrackedFilesNotifier;
import git4idea.validators.GitBranchNameValidator;
import org.jetbrains.annotations.NotNull;
@@ -68,6 +69,8 @@ import java.util.HashSet;
import java.util.List;
import java.util.concurrent.atomic.AtomicBoolean;
+import static git4idea.commands.GitLocalChangesWouldBeOverwrittenDetector.Operation.MERGE;
+
/**
* The unstash dialog
*/
@@ -349,7 +352,9 @@ public class GitUnstashDialog extends DialogWrapper {
}
});
GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector = new GitUntrackedFilesOverwrittenByOperationDetector(root);
+ GitLocalChangesWouldBeOverwrittenDetector localChangesDetector = new GitLocalChangesWouldBeOverwrittenDetector(root, MERGE);
h.addLineListener(untrackedFilesDetector);
+ h.addLineListener(localChangesDetector);
GitUtil.workingTreeChangeStarted(myProject);
try {
@@ -371,6 +376,8 @@ public class GitUnstashDialog extends DialogWrapper {
} else if (untrackedFilesDetector.wasMessageDetected()) {
UntrackedFilesNotifier.notifyUntrackedFilesOverwrittenBy(myProject, root, untrackedFilesDetector.getRelativeFilePaths(),
"unstash", null);
+ } else if (localChangesDetector.wasMessageDetected()) {
+ LocalChangesWouldBeOverwrittenHelper.showErrorDialog(myProject, root, "unstash", localChangesDetector.getRelativeFilePaths());
} else if (!res.success()) {
GitUIUtil.showOperationErrors(myProject, h.errors(), h.printableCommandLine());
}
diff --git a/plugins/git4idea/src/git4idea/util/LocalChangesWouldBeOverwrittenHelper.java b/plugins/git4idea/src/git4idea/util/LocalChangesWouldBeOverwrittenHelper.java
index 021ce824b9a7..7659c50e362a 100644
--- a/plugins/git4idea/src/git4idea/util/LocalChangesWouldBeOverwrittenHelper.java
+++ b/plugins/git4idea/src/git4idea/util/LocalChangesWouldBeOverwrittenHelper.java
@@ -35,12 +35,12 @@ import java.util.List;
public class LocalChangesWouldBeOverwrittenHelper {
@NotNull
- public static String getErrorNotificationDescription() {
+ private static String getErrorNotificationDescription() {
return getErrorDescription(true);
}
@NotNull
- public static String getErrorDialogDescription() {
+ private static String getErrorDialogDescription() {
return getErrorDescription(false);
}
@@ -56,7 +56,7 @@ public class LocalChangesWouldBeOverwrittenHelper {
}
}
- public static void showErrorNotification(@NotNull final Project project, @NotNull VirtualFile root, @NotNull final String operationName,
+ public static void showErrorNotification(@NotNull final Project project, @NotNull final VirtualFile root, @NotNull final String operationName,
@NotNull final Collection relativeFilePaths) {
final Collection absolutePaths = GitUtil.toAbsolute(root, relativeFilePaths);
final List changes = GitUtil.findLocalChangesForPaths(project, root, absolutePaths, false);
@@ -66,20 +66,33 @@ public class LocalChangesWouldBeOverwrittenHelper {
@Override
protected void hyperlinkActivated(@NotNull Notification notification,
@NotNull HyperlinkEvent e) {
- String title = "Local Changes Prevent from " + StringUtil.capitalize(operationName);
- String description = getErrorDialogDescription();
- if (changes.isEmpty()) {
- GitUtil.showPathsInDialog(project, absolutePaths, title, description);
- }
- else {
- DialogBuilder builder = new DialogBuilder(project);
- builder.setNorthPanel(new MultiLineLabel(description));
- builder.setCenterPanel(new ChangesBrowserWithRollback(project, changes));
- builder.addOkAction();
- builder.setTitle(title);
- builder.show();
- }
+ showErrorDialog(project, operationName, changes, absolutePaths);
}
});
}
+
+ public static void showErrorDialog(@NotNull Project project, @NotNull VirtualFile root, @NotNull String operationName,
+ @NotNull Collection relativeFilePaths) {
+ Collection absolutePaths = GitUtil.toAbsolute(root, relativeFilePaths);
+ List changes = GitUtil.findLocalChangesForPaths(project, root, absolutePaths, false);
+ showErrorDialog(project, operationName, changes, absolutePaths);
+ }
+
+ private static void showErrorDialog(@NotNull Project project, @NotNull String operationName, @NotNull List changes,
+ @NotNull Collection absolutePaths) {
+ String title = "Local Changes Prevent from " + StringUtil.capitalize(operationName);
+ String description = getErrorDialogDescription();
+ if (changes.isEmpty()) {
+ GitUtil.showPathsInDialog(project, absolutePaths, title, description);
+ }
+ else {
+ DialogBuilder builder = new DialogBuilder(project);
+ builder.setNorthPanel(new MultiLineLabel(description));
+ builder.setCenterPanel(new ChangesBrowserWithRollback(project, changes));
+ builder.addOkAction();
+ builder.setTitle(title);
+ builder.show();
+ }
+ }
+
}
From 7ee57a2fd1333107346925b8cecc88e319b7b7ef Mon Sep 17 00:00:00 2001
From: Kirill Likhodedov
Date: Mon, 18 Aug 2014 18:26:24 +0400
Subject: [PATCH 15/27] [git] remove some obsolete dialog
---
.../src/git4idea/i18n/GitBundle.properties | 14 --
.../src/git4idea/update/GitRebaseUpdater.java | 32 ---
.../GitUpdateLocallyModifiedDialog.form | 71 ------
.../GitUpdateLocallyModifiedDialog.java | 211 ------------------
4 files changed, 328 deletions(-)
delete mode 100644 plugins/git4idea/src/git4idea/update/GitUpdateLocallyModifiedDialog.form
delete mode 100644 plugins/git4idea/src/git4idea/update/GitUpdateLocallyModifiedDialog.java
diff --git a/plugins/git4idea/src/git4idea/i18n/GitBundle.properties b/plugins/git4idea/src/git4idea/i18n/GitBundle.properties
index 03803fbf985c..f89657535f8a 100644
--- a/plugins/git4idea/src/git4idea/i18n/GitBundle.properties
+++ b/plugins/git4idea/src/git4idea/i18n/GitBundle.properties
@@ -416,20 +416,6 @@ unstash.unstashing=Unstashing...
unstash.view.tooltip=View selected stash
unstash.view=&View
unstashing.title=UnStashing changes...
-update.locally.modified.files.tooltip=Locally modified files.
-update.locally.modified.files=&Files:
-update.locally.modified.git.root=Git Root:
-update.locally.modified.message=
The following files under this root are locally modified. \
- Possible reasons: uncommitted changes; a problem with crlf conversion; {0} configuration file auto-save.
\
-
\
-
Press Revert Files to discard these local changes and continue the update process.
\
-
Press Cancel to cancel the update process. Use Auto-Stash option to stash local changes before update and restore them after it.
\
-
\
-
-update.locally.modified.rescan.tooltip=Rescan the repository to check for locally modified files again. Use this button if you have resolved the problem manually.
-update.locally.modified.rescan=Re&scan
-update.locally.modified.revert=Revert Files
-update.locally.modified.title=Locally modified files are detected
update.options.display.name=Git Update Settings
update.options.no.commit=No &Commit
update.options.save.before.update=Clean working tree before update
diff --git a/plugins/git4idea/src/git4idea/update/GitRebaseUpdater.java b/plugins/git4idea/src/git4idea/update/GitRebaseUpdater.java
index 04ed3ac845ca..e22c15076170 100644
--- a/plugins/git4idea/src/git4idea/update/GitRebaseUpdater.java
+++ b/plugins/git4idea/src/git4idea/update/GitRebaseUpdater.java
@@ -18,12 +18,10 @@ package git4idea.update;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.progress.ProgressIndicator;
import com.intellij.openapi.project.Project;
-import com.intellij.openapi.util.Ref;
import com.intellij.openapi.vcs.VcsException;
import com.intellij.openapi.vcs.VcsNotifier;
import com.intellij.openapi.vcs.update.UpdatedFiles;
import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ui.UIUtil;
import git4idea.GitBranch;
import git4idea.GitUtil;
import git4idea.branch.GitBranchPair;
@@ -78,42 +76,12 @@ public class GitRebaseUpdater extends GitUpdater {
return dest.getName();
}
- // TODO
- //if (!checkLocallyModified(myRoot)) {
- // cancel();
- // updateSucceeded.set(false);
- //}
-
-
- // TODO: show at any case of update successfullibility, also don't show here but for all roots
- //if (mySkippedCommits.size() > 0) {
- // GitSkippedCommits.showSkipped(myProject, mySkippedCommits);
- //}
-
public void cancel() {
myRebaser.abortRebase(myRoot);
myProgressIndicator.setText2("Refreshing files for the root " + myRoot.getPath());
myRoot.refresh(false, true);
}
- /**
- * Check and process locally modified files
- *
- * @param root the project root
- * @param ex the exception holder
- */
- protected boolean checkLocallyModified(final VirtualFile root) throws VcsException {
- final Ref cancelled = new Ref(false);
- UIUtil.invokeAndWaitIfNeeded(new Runnable() {
- public void run() {
- if (!GitUpdateLocallyModifiedDialog.showIfNeeded(myProject, root)) {
- cancelled.set(true);
- }
- }
- });
- return !cancelled.get();
- }
-
@Override
public String toString() {
return "Rebase updater";
diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateLocallyModifiedDialog.form b/plugins/git4idea/src/git4idea/update/GitUpdateLocallyModifiedDialog.form
deleted file mode 100644
index a97507f24ec9..000000000000
--- a/plugins/git4idea/src/git4idea/update/GitUpdateLocallyModifiedDialog.form
+++ /dev/null
@@ -1,71 +0,0 @@
-
-
diff --git a/plugins/git4idea/src/git4idea/update/GitUpdateLocallyModifiedDialog.java b/plugins/git4idea/src/git4idea/update/GitUpdateLocallyModifiedDialog.java
deleted file mode 100644
index c3384cea20b0..000000000000
--- a/plugins/git4idea/src/git4idea/update/GitUpdateLocallyModifiedDialog.java
+++ /dev/null
@@ -1,211 +0,0 @@
-/*
- * Copyright 2000-2009 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 git4idea.update;
-
-import com.intellij.openapi.application.ApplicationNamesInfo;
-import com.intellij.openapi.project.Project;
-import com.intellij.openapi.ui.DialogWrapper;
-import com.intellij.openapi.vcs.FilePath;
-import com.intellij.openapi.vcs.VcsException;
-import com.intellij.openapi.vfs.VirtualFile;
-import com.intellij.util.ui.UIUtil;
-import com.intellij.vcsUtil.VcsUtil;
-import git4idea.GitUtil;
-import git4idea.commands.GitCommand;
-import git4idea.commands.GitSimpleHandler;
-import git4idea.util.StringScanner;
-import git4idea.i18n.GitBundle;
-import git4idea.rollback.GitRollbackEnvironment;
-import git4idea.util.GitUIUtil;
-
-import javax.swing.*;
-import java.awt.event.ActionEvent;
-import java.awt.event.ActionListener;
-import java.util.ArrayList;
-import java.util.List;
-import java.util.concurrent.atomic.AtomicBoolean;
-
-/**
- * The dialog that displays locally modified files during update process
- */
-public class GitUpdateLocallyModifiedDialog extends DialogWrapper {
- /**
- * The rescan button
- */
- private JButton myRescanButton;
- /**
- * The list of files to revert
- */
- private JList myFilesList;
-
- private JLabel myDescriptionLabel;
- /**
- * The git root label
- */
- private JLabel myGitRoot;
- /**
- * The root panel
- */
- private JPanel myRootPanel;
- /**
- * The collection with locally modified files
- */
- private final List myLocallyModifiedFiles;
-
- /**
- * The constructor
- *
- * @param project the current project
- * @param root the vcs root
- * @param locallyModifiedFiles the collection of locally modified files to use
- */
- protected GitUpdateLocallyModifiedDialog(final Project project, final VirtualFile root, List locallyModifiedFiles) {
- super(project, true);
- myLocallyModifiedFiles = locallyModifiedFiles;
- setTitle(GitBundle.getString("update.locally.modified.title"));
- myGitRoot.setText(root.getPresentableUrl());
- myFilesList.setModel(new DefaultListModel());
- setOKButtonText(GitBundle.getString("update.locally.modified.revert"));
- syncListModel();
- myRescanButton.addActionListener(new ActionListener() {
- public void actionPerformed(ActionEvent e) {
- myLocallyModifiedFiles.clear();
- try {
- scanFiles(project, root, myLocallyModifiedFiles);
- }
- catch (VcsException ex) {
- GitUIUtil.showOperationError(project, ex, "Checking for locally modified files");
- }
- }
- });
- myDescriptionLabel
- .setText(GitBundle.message("update.locally.modified.message", ApplicationNamesInfo.getInstance().getFullProductName()));
- init();
- }
-
- /**
- * Refresh list model according to the current content of the collection
- */
- private void syncListModel() {
- DefaultListModel listModel = (DefaultListModel)myFilesList.getModel();
- listModel.removeAllElements();
- for (String p : myLocallyModifiedFiles) {
- listModel.addElement(p);
- }
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected JComponent createCenterPanel() {
- return myRootPanel;
- }
-
- /**
- * {@inheritDoc}
- */
- @Override
- protected String getDimensionServiceKey() {
- return getClass().getName();
- }
-
- /**
- * Scan working tree and detect locally modified files
- *
- * @param project the project to scan
- * @param root the root to scan
- * @param files the collection with files
- * @throws VcsException if there problem with running git or working tree is dirty in unsupported way
- */
- private static void scanFiles(Project project, VirtualFile root, List files) throws VcsException {
- String rootPath = root.getPath();
- GitSimpleHandler h = new GitSimpleHandler(project, root, GitCommand.DIFF);
- h.addParameters("--name-status");
- h.setSilent(true);
- h.setStdoutSuppressed(true);
- StringScanner s = new StringScanner(h.run());
- while (s.hasMoreData()) {
- if (s.isEol()) {
- s.line();
- continue;
- }
- if (s.tryConsume("M\t")) {
- String path = rootPath + "/" + GitUtil.unescapePath(s.line());
- files.add(path);
- }
- else {
- throw new VcsException("Working tree is dirty in unsupported way: " + s.line());
- }
- }
- }
-
-
- /**
- * Show the dialog if needed
- *
- * @param project the project
- * @param root the vcs root
- * @return true if showing is not needed or operation completed successfully
- */
- public static boolean showIfNeeded(final Project project, final VirtualFile root) {
- final ArrayList files = new ArrayList();
- try {
- scanFiles(project, root, files);
- final AtomicBoolean rc = new AtomicBoolean(true);
- if (!files.isEmpty()) {
- UIUtil.invokeAndWaitIfNeeded(new Runnable() {
- public void run() {
- GitUpdateLocallyModifiedDialog d = new GitUpdateLocallyModifiedDialog(project, root, files);
- d.show();
- rc.set(d.isOK());
- }
- });
- if (rc.get()) {
- if (!files.isEmpty()) {
- revertFiles(project, root, files);
- }
- }
- }
- return rc.get();
- }
- catch (final VcsException e) {
- UIUtil.invokeAndWaitIfNeeded(new Runnable() {
- public void run() {
- GitUIUtil.showOperationError(project, e, "Checking for locally modified files");
- }
- });
- return false;
- }
- }
-
- /**
- * Revert files from the list
- *
- * @param project the project
- * @param root the vcs root
- * @param files the files to revert
- */
- private static void revertFiles(Project project, VirtualFile root, ArrayList files) throws VcsException {
- // TODO consider deleted files
- GitRollbackEnvironment rollback = GitRollbackEnvironment.getInstance(project);
- ArrayList list = new ArrayList(files.size());
- for (String p : files) {
- list.add(VcsUtil.getFilePath(p));
- }
- rollback.revert(root, list);
- }
-}
From 717bf0d971b31494c3d8248c901375d6a9fb1a0f Mon Sep 17 00:00:00 2001
From: Kirill Likhodedov
Date: Mon, 18 Aug 2014 18:30:49 +0400
Subject: [PATCH 16/27] [git] IDEA-128259 handle local changes would be
overwritten during rebase
Update Project procedure should normally detect local changes before
rebasing, but in case it didn't it should show them in a proper
notification.
---
.../src/git4idea/rebase/GitRebaser.java | 23 +++++++++++++++----
1 file changed, 18 insertions(+), 5 deletions(-)
diff --git a/plugins/git4idea/src/git4idea/rebase/GitRebaser.java b/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
index aabf913fbf61..d5a0470d1667 100644
--- a/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
+++ b/plugins/git4idea/src/git4idea/rebase/GitRebaser.java
@@ -30,6 +30,7 @@ import git4idea.commands.*;
import git4idea.merge.GitConflictResolver;
import git4idea.update.GitUpdateResult;
import git4idea.util.GitUIUtil;
+import git4idea.util.LocalChangesWouldBeOverwrittenHelper;
import git4idea.util.StringScanner;
import git4idea.util.UntrackedFilesNotifier;
import org.jetbrains.annotations.NotNull;
@@ -43,6 +44,8 @@ import java.util.*;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
+import static git4idea.commands.GitLocalChangesWouldBeOverwrittenDetector.Operation.CHECKOUT;
+
/**
* @author Kirill Likhodedov
*/
@@ -77,7 +80,9 @@ public class GitRebaser {
final GitRebaseProblemDetector rebaseConflictDetector = new GitRebaseProblemDetector();
rebaseHandler.addLineListener(rebaseConflictDetector);
GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector = new GitUntrackedFilesOverwrittenByOperationDetector(root);
+ GitLocalChangesWouldBeOverwrittenDetector localChangesDetector = new GitLocalChangesWouldBeOverwrittenDetector(root, CHECKOUT);
rebaseHandler.addLineListener(untrackedFilesDetector);
+ rebaseHandler.addLineListener(localChangesDetector);
String progressTitle = "Rebasing";
GitTask rebaseTask = new GitTask(myProject, rebaseHandler, progressTitle);
@@ -108,7 +113,7 @@ public class GitRebaser {
});
if (failure.get()) {
- updateResult.set(handleRebaseFailure(rebaseHandler, root, rebaseConflictDetector, untrackedFilesDetector));
+ updateResult.set(handleRebaseFailure(rebaseHandler, root, rebaseConflictDetector, untrackedFilesDetector, localChangesDetector));
}
}
finally {
@@ -333,19 +338,27 @@ public class GitRebaser {
}
@NotNull
- public GitUpdateResult handleRebaseFailure(@NotNull GitLineHandler handler, @NotNull VirtualFile root,
+ public GitUpdateResult handleRebaseFailure(@NotNull GitLineHandler handler,
+ @NotNull VirtualFile root,
@NotNull GitRebaseProblemDetector rebaseConflictDetector,
- @NotNull GitMessageWithFilesDetector untrackedWouldBeOverwrittenDetector) {
+ @NotNull GitMessageWithFilesDetector untrackedWouldBeOverwrittenDetector,
+ @NotNull GitLocalChangesWouldBeOverwrittenDetector localChangesDetector) {
if (rebaseConflictDetector.isMergeConflict()) {
LOG.info("handleRebaseFailure merge conflict");
final boolean allMerged = new GitRebaser.ConflictResolver(myProject, myGit, root, this).merge();
return allMerged ? GitUpdateResult.SUCCESS_WITH_RESOLVED_CONFLICTS : GitUpdateResult.INCOMPLETE;
- } else if (untrackedWouldBeOverwrittenDetector.wasMessageDetected()) {
+ }
+ else if (untrackedWouldBeOverwrittenDetector.wasMessageDetected()) {
LOG.info("handleRebaseFailure: untracked files would be overwritten by checkout");
UntrackedFilesNotifier.notifyUntrackedFilesOverwrittenBy(myProject, root,
untrackedWouldBeOverwrittenDetector.getRelativeFilePaths(), "rebase", null);
return GitUpdateResult.ERROR;
- } else {
+ }
+ else if (localChangesDetector.wasMessageDetected()) {
+ LocalChangesWouldBeOverwrittenHelper.showErrorNotification(myProject, root, "rebase", localChangesDetector.getRelativeFilePaths());
+ return GitUpdateResult.ERROR;
+ }
+ else {
LOG.info("handleRebaseFailure error " + handler.errors());
GitUIUtil.notifyImportantError(myProject, "Rebase error", GitUIUtil.stringifyErrors(handler.errors()));
return GitUpdateResult.ERROR;
From 51538a0ef218bb3893f4d15ab2552908fdd2ab20 Mon Sep 17 00:00:00 2001
From: Kirill Likhodedov
Date: Mon, 18 Aug 2014 18:32:25 +0400
Subject: [PATCH 17/27] [git] handle local changes overwritten error during
github rebase
---
.../org/jetbrains/plugins/github/GithubRebaseAction.java | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
index bfceb0ceec39..719f8b956432 100644
--- a/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
+++ b/plugins/github/src/org/jetbrains/plugins/github/GithubRebaseAction.java
@@ -48,6 +48,7 @@ import org.jetbrains.plugins.github.util.*;
import java.io.IOException;
import java.util.Collections;
+import static git4idea.commands.GitLocalChangesWouldBeOverwrittenDetector.Operation.CHECKOUT;
import static org.jetbrains.plugins.github.util.GithubUtil.setVisibleEnabled;
/**
@@ -256,7 +257,9 @@ public class GithubRebaseAction extends DumbAwareAction {
final GitUntrackedFilesOverwrittenByOperationDetector untrackedFilesDetector =
new GitUntrackedFilesOverwrittenByOperationDetector(root);
+ final GitLocalChangesWouldBeOverwrittenDetector localChangesDetector = new GitLocalChangesWouldBeOverwrittenDetector(root, CHECKOUT);
handler.addLineListener(untrackedFilesDetector);
+ handler.addLineListener(localChangesDetector);
GitTask pullTask = new GitTask(project, handler, "Rebasing from upstream/master");
pullTask.setProgressIndicator(indicator);
@@ -271,7 +274,8 @@ public class GithubRebaseAction extends DumbAwareAction {
@Override
protected void onFailure() {
- GitUpdateResult result = rebaser.handleRebaseFailure(handler, root, rebaseConflictDetector, untrackedFilesDetector);
+ GitUpdateResult result = rebaser.handleRebaseFailure(handler, root, rebaseConflictDetector,
+ untrackedFilesDetector, localChangesDetector);
repositoryManager.updateRepository(root);
if (result == GitUpdateResult.NOTHING_TO_UPDATE ||
result == GitUpdateResult.SUCCESS ||
From 1dbc09ac368aebfa1587dca61efaa80156b534f2 Mon Sep 17 00:00:00 2001
From: Dennis Ushakov
Date: Mon, 18 Aug 2014 17:45:46 +0400
Subject: [PATCH 18/27] update html5 schema builder with new repository
---
.../src/resources/patches/patch_build.patch | 53 ++++++-------------
.../src/resources/update_html5_schema.sh | 4 +-
2 files changed, 18 insertions(+), 39 deletions(-)
diff --git a/xml/relaxng/src/resources/patches/patch_build.patch b/xml/relaxng/src/resources/patches/patch_build.patch
index ba4c30769bd0..88e4148c2420 100644
--- a/xml/relaxng/src/resources/patches/patch_build.patch
+++ b/xml/relaxng/src/resources/patches/patch_build.patch
@@ -1,7 +1,8 @@
-diff -r dd84d714a0da build.py
---- a/build.py Fri Oct 25 13:00:39 2013 +0900
-+++ b/build.py Fri Jan 24 13:53:06 2014 +0400
-@@ -147,8 +147,8 @@
+diff --git a/build.py b/build.py
+index ac7ecb3..db7de9c 100755
+--- a/build.py
++++ b/build.py
+@@ -153,13 +153,13 @@ dependencyJars = runDependencyJars + buildOnlyDependencyJars
moduleNames = [
"syntax",
@@ -10,9 +11,18 @@ diff -r dd84d714a0da build.py
+ # "util",
+ # "xmlparser",
"validator",
+- "jing-trang",
+- "htmlparser",
+- "nu-validator-site",
+- "tests",
++ # "jing-trang",
++ # "htmlparser",
++ # "nu-validator-site",
++ # "tests",
]
-@@ -875,19 +875,19 @@
+ javaSafeNamePat = re.compile(r'[^a-zA-Z0-9]')
+@@ -926,19 +926,19 @@ def downloadDependencies():
downloadDependency(url, md5sum)
def buildAll():
@@ -42,36 +52,5 @@ diff -r dd84d714a0da build.py
+ # buildXmlParser()
+ # buildValidator()
- def hgCloneOrUpdate(mod, baseUrl):
+ def gitCloneOrUpdate(mod, baseUrl):
if os.path.exists(mod):
-@@ -925,18 +925,18 @@
- # XXX root dir
- for mod in moduleNames:
- hgCloneOrUpdate(mod, hgRoot)
-- gitCloneOrUpdate("nu-validator-site", gitRoot)
-- runCmd('"%s" co http://jing-trang.googlecode.com/svn/branches/validator-nu jing-trang' % (svnCmd))
-- hgCloneOrUpdate("htmlparser", parserHgRoot)
-- testsRemote = "https://github.com/validator/tests.git"
-- testsBranch = "master"
-- testsDir = "tests"
-- if os.path.exists(testsDir):
-- os.chdir(testsDir)
-- runCmd('"%s" pull %s %s' % (gitCmd, testsRemote, testsBranch))
-- os.chdir("..")
-- else:
-- runCmd('"%s" clone %s %s' % (gitCmd, testsRemote, testsDir))
-+ # gitCloneOrUpdate("nu-validator-site", gitRoot)
-+ # runCmd('"%s" co http://jing-trang.googlecode.com/svn/branches/validator-nu jing-trang' % (svnCmd))
-+ # hgCloneOrUpdate("htmlparser", parserHgRoot)
-+ # testsRemote = "https://github.com/validator/tests.git"
-+ # testsBranch = "master"
-+ # testsDir = "tests"
-+ # if os.path.exists(testsDir):
-+ # os.chdir(testsDir)
-+ # runCmd('"%s" pull %s %s' % (gitCmd, testsRemote, testsBranch))
-+ # os.chdir("..")
-+ # else:
-+ # runCmd('"%s" clone %s %s' % (gitCmd, testsRemote, testsDir))
-
- def selfUpdate():
- hgCloneOrUpdate("build", hgRoot)
diff --git a/xml/relaxng/src/resources/update_html5_schema.sh b/xml/relaxng/src/resources/update_html5_schema.sh
index 299129868253..20d28e53762e 100755
--- a/xml/relaxng/src/resources/update_html5_schema.sh
+++ b/xml/relaxng/src/resources/update_html5_schema.sh
@@ -11,9 +11,9 @@ mkdir temp
cd temp
echo ">>>>> Preparing validator build"
-hg clone https://bitbucket.org/validator/build build
+git clone https://github.com/validator/build build
cd build
-hg import "$PATCHES/patch_build.patch" --no-commit
+git apply "$PATCHES/patch_build.patch"
cd ..
echo
From e43aeff7e766cf77863bbc15ac4a3971bfb4c80a Mon Sep 17 00:00:00 2001
From: Dennis Ushakov
Date: Mon, 18 Aug 2014 17:46:06 +0400
Subject: [PATCH 19/27] update ping patch
---
xml/relaxng/src/resources/patches/0004_ping.patch | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/xml/relaxng/src/resources/patches/0004_ping.patch b/xml/relaxng/src/resources/patches/0004_ping.patch
index 6f825ac4a2e0..4e47a934c7d6 100644
--- a/xml/relaxng/src/resources/patches/0004_ping.patch
+++ b/xml/relaxng/src/resources/patches/0004_ping.patch
@@ -7,7 +7,7 @@
- shared-hyperlink.attrs.ping =
- attribute ping {
- common.data.uris
-- } & v5only & nonW3C
+- } & v5only
## Emphatic Stress:
From 98ad6480fa78996149b1509e45d00c65c286497e Mon Sep 17 00:00:00 2001
From: Dennis Ushakov
Date: Mon, 18 Aug 2014 17:55:27 +0400
Subject: [PATCH 20/27] update html5 schema
---
.../html5-schema/html5-svg-mathml.rnc | 2 -
.../html5-schema/html5/applications.rnc | 12 +++-
.../src/resources/html5-schema/html5/aria.rnc | 10 +--
.../resources/html5-schema/html5/block.rnc | 1 +
.../resources/html5-schema/html5/common.rnc | 15 ++--
.../html5-schema/html5/core-scripting.rnc | 2 +
.../resources/html5-schema/html5/embed.rnc | 71 ++++++++++++++++++-
.../resources/html5-schema/html5/legacy.rnc | 6 ++
.../resources/html5-schema/html5/media.rnc | 6 +-
.../src/resources/html5-schema/html5/meta.rnc | 1 +
.../html5-schema/html5/microdata.rnc | 3 +-
.../src/resources/html5-schema/html5/rdfa.rnc | 30 ++++----
.../resources/html5-schema/html5/tables.rnc | 33 +++------
.../resources/html5-schema/legacy/legacy.rnc | 6 ++
.../html5-schema/svg11/svg-basic-font.rnc | 4 +-
.../html5-schema/svg11/svg-conditional.rnc | 3 +-
.../html5-schema/svg11/svg-extensibility.rnc | 11 +++
17 files changed, 147 insertions(+), 69 deletions(-)
diff --git a/xml/relaxng/src/resources/html5-schema/html5-svg-mathml.rnc b/xml/relaxng/src/resources/html5-schema/html5-svg-mathml.rnc
index fadc971d2bb4..fe154b8f57bf 100644
--- a/xml/relaxng/src/resources/html5-schema/html5-svg-mathml.rnc
+++ b/xml/relaxng/src/resources/html5-schema/html5-svg-mathml.rnc
@@ -10,8 +10,6 @@ common.elem.phrasing |= math
SVG.foreignObject.content |=
( math
- | html.elem
- | body.elem
| common.inner.flow
)
diff --git a/xml/relaxng/src/resources/html5-schema/html5/applications.rnc b/xml/relaxng/src/resources/html5-schema/html5/applications.rnc
index ac07294db29c..2a592fbbd781 100755
--- a/xml/relaxng/src/resources/html5-schema/html5/applications.rnc
+++ b/xml/relaxng/src/resources/html5-schema/html5/applications.rnc
@@ -377,6 +377,7 @@ datatypes w = "http://whattf.org/datatype-draft"
| common.attrs.aria.role.combobox
| common.attrs.aria.role.dialog
| common.attrs.aria.role.directory
+ | common.attrs.aria.role.group
| common.attrs.aria.role.heading
| common.attrs.aria.role.img
| common.attrs.aria.role.link
@@ -425,7 +426,16 @@ datatypes w = "http://whattf.org/datatype-draft"
( common.attrs
& ( common.attrs.aria.role.presentation
| common.attrs.aria.role.menuitem
+ | common.attrs.aria.role.button
)?
)
summary.inner =
- ( common.inner.phrasing )
+ ( common.inner.phrasing
+ | h1.elem
+ | h2.elem
+ | h3.elem
+ | h4.elem
+ | h5.elem
+ | h6.elem
+ | hgroup.elem
+ )
diff --git a/xml/relaxng/src/resources/html5-schema/html5/aria.rnc b/xml/relaxng/src/resources/html5-schema/html5/aria.rnc
index b1035a0fa2a6..cf412e5f4ace 100755
--- a/xml/relaxng/src/resources/html5-schema/html5/aria.rnc
+++ b/xml/relaxng/src/resources/html5-schema/html5/aria.rnc
@@ -133,15 +133,7 @@ common.attrs.aria.implicit.toolbar |=
& aria.prop.activedescendant?
)
-common.attrs.aria.implicit.columnheader |=
- ( aria.prop.sort?
- & aria.prop.readonly?
- & aria.prop.required?
- & aria.state.selected?
- & aria.state.expanded?
- )
-
-common.attrs.aria.implicit.rowheader |=
+common.attrs.aria.implicit.column-or-row-header |=
( aria.prop.sort?
& aria.prop.readonly?
& aria.prop.required?
diff --git a/xml/relaxng/src/resources/html5-schema/html5/block.rnc b/xml/relaxng/src/resources/html5-schema/html5/block.rnc
index 2fd2d233c71b..de3b5a54ee2d 100755
--- a/xml/relaxng/src/resources/html5-schema/html5/block.rnc
+++ b/xml/relaxng/src/resources/html5-schema/html5/block.rnc
@@ -112,6 +112,7 @@ datatypes w = "http://whattf.org/datatype-draft"
& ol.attrs.reversed?
& ol.attrs.type?
& ( ( common.attrs.aria.role.directory
+ | common.attrs.aria.role.group
| common.attrs.aria.role.list
| common.attrs.aria.role.listbox
| common.attrs.aria.role.menu
diff --git a/xml/relaxng/src/resources/html5-schema/html5/common.rnc b/xml/relaxng/src/resources/html5-schema/html5/common.rnc
index 9f1e65673bd2..09afb1454233 100755
--- a/xml/relaxng/src/resources/html5-schema/html5/common.rnc
+++ b/xml/relaxng/src/resources/html5-schema/html5/common.rnc
@@ -113,9 +113,7 @@ common.attrs =
)
common.attrs.basic =
- ( ( common.attrs.id
- | common.attrs.xml-id
- )? # REVISIT assuming only either one is allowed
+ ( common.attrs.id?
& common.attrs.class?
& common.attrs.title?
& common.attrs.base?
@@ -125,10 +123,6 @@ common.attrs.basic =
attribute id {
common.data.id
}
- common.attrs.xml-id =
- attribute xml:id {
- xsd:NCName
- } & XMLonly
common.attrs.class =
attribute class {
common.data.tokens
@@ -387,6 +381,10 @@ common.attrs.other =
common.data.keylabellist =
w:keylabellist
+## List of Source Sizes
+ common.data.source.size.list =
+ w:source-size-list
+
## Microdata Properties
common.data.microdata-properties =
list { w:microdata-property+ }
@@ -466,7 +464,7 @@ common.attrs.aria.implicit.article = ( notAllowed )
common.attrs.aria.implicit.banner = ( notAllowed )
common.attrs.aria.implicit.button = ( notAllowed )
common.attrs.aria.implicit.checkbox = ( notAllowed )
-common.attrs.aria.implicit.columnheader = ( notAllowed )
+common.attrs.aria.implicit.column-or-row-header = ( notAllowed )
common.attrs.aria.implicit.combobox = ( notAllowed )
common.attrs.aria.implicit.complementary = ( notAllowed )
common.attrs.aria.implicit.contentinfo = ( notAllowed )
@@ -486,7 +484,6 @@ common.attrs.aria.implicit.option = ( notAllowed )
common.attrs.aria.implicit.progressbar = ( notAllowed )
common.attrs.aria.implicit.radio = ( notAllowed )
common.attrs.aria.implicit.region = ( notAllowed )
-common.attrs.aria.implicit.rowheader = ( notAllowed )
common.attrs.aria.implicit.section = ( notAllowed )
common.attrs.aria.implicit.select = ( notAllowed )
common.attrs.aria.implicit.slider = ( notAllowed )
diff --git a/xml/relaxng/src/resources/html5-schema/html5/core-scripting.rnc b/xml/relaxng/src/resources/html5-schema/html5/core-scripting.rnc
index bef6bf107423..eb08c2ed5bb7 100755
--- a/xml/relaxng/src/resources/html5-schema/html5/core-scripting.rnc
+++ b/xml/relaxng/src/resources/html5-schema/html5/core-scripting.rnc
@@ -15,6 +15,7 @@ datatypes w = "http://whattf.org/datatype-draft"
( common.attrs
& script.attrs.type?
& script.attrs.language? # restricted in Schematron
+ & embedded.content.attrs.crossorigin?
& ( common.attrs.aria.role.presentation
| common.attrs.aria.role.menuitem
)?
@@ -29,6 +30,7 @@ datatypes w = "http://whattf.org/datatype-draft"
& script.attrs.type?
& script.attrs.charset?
& script.attrs.language? # restricted in Schematron
+ & embedded.content.attrs.crossorigin?
& ( common.attrs.aria.role.presentation
| common.attrs.aria.role.menuitem
)?
diff --git a/xml/relaxng/src/resources/html5-schema/html5/embed.rnc b/xml/relaxng/src/resources/html5-schema/html5/embed.rnc
index 51a2f0acb7a6..be4204914fa8 100755
--- a/xml/relaxng/src/resources/html5-schema/html5/embed.rnc
+++ b/xml/relaxng/src/resources/html5-schema/html5/embed.rnc
@@ -15,12 +15,15 @@ namespace local = ""
img.attrs =
( common.attrs
& img.attrs.src
+ & img.attrs.srcset?
+ & img.attrs.sizes?
& img.attrs.alt? # ARIA: if alt empty, only allowed role value is "presentation"; check in assertions
& img.attrs.height?
& img.attrs.width?
& img.attrs.usemap?
& img.attrs.ismap?
& img.attrs.border? # obsolete
+ & embedded.content.attrs.crossorigin?
& ( common.attrs.aria.implicit.img
| common.attrs.aria
)?
@@ -29,6 +32,14 @@ namespace local = ""
attribute src {
common.data.uri.non-empty
}
+ img.attrs.srcset =
+ attribute srcset {
+ string
+ } & v5only
+ img.attrs.sizes =
+ attribute sizes {
+ common.data.source.size.list
+ } & v5only
img.attrs.alt =
attribute alt {
text
@@ -58,6 +69,54 @@ namespace local = ""
common.elem.phrasing |= img.elem
+## Image with multiple sources:
+
+ picture.elem =
+ element picture { picture.inner & picture.attrs }
+ & v5only
+ picture.attrs =
+ ( common.attrs )
+ picture.inner =
+ ( ( source.picture.elem*
+ & common.elem.script-supporting*
+ ),
+ ( img.elem
+ & common.elem.script-supporting*
+ )
+ )
+
+ common.elem.phrasing |= picture.elem
+
+## Picture source:
+
+ source.picture.elem =
+ element source { source.picture.inner & source.picture.attrs }
+ source.picture.attrs =
+ ( common.attrs
+ & source.picture.attrs.media?
+ & source.picture.attrs.srcset
+ & source.picture.attrs.sizes?
+ & source.picture.attrs.type?
+ )
+ source.picture.attrs.media =
+ attribute media {
+ common.data.mediaquery
+ }
+ source.picture.attrs.srcset =
+ attribute srcset {
+ string
+ }
+ source.picture.attrs.sizes =
+ attribute sizes {
+ common.data.source.size.list
+ }
+ source.picture.attrs.type =
+ attribute type {
+ common.data.mimetype
+ }
+ source.picture.inner =
+ ( empty )
+
## Plug-ins: