Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Sohn2019-09-11 16:21:03 -0400
committerMatthias Sohn2019-09-11 16:21:15 -0400
commitb8bc92e8d92286af2981b34ba6bfa861741f9fcf (patch)
treecb70d47f831ffa2cdc73701bb34e32fa8f3b0413 /org.eclipse.egit.ui
parent1536d0fab5f1e814b5a2fd5bc5dbdd46b009ad0b (diff)
parent016ff82539b7f7f9ff1a3b0e8512926ce435dff9 (diff)
downloadegit-b8bc92e8d92286af2981b34ba6bfa861741f9fcf.tar.gz
egit-b8bc92e8d92286af2981b34ba6bfa861741f9fcf.tar.xz
egit-b8bc92e8d92286af2981b34ba6bfa861741f9fcf.zip
Merge branch 'stable-5.5'
* stable-5.5: Prepare 5.5.1-SNAPSHOT builds EGit v5.5.0.201909110433-r Update documentation for 5.5.0 Fix saving in the merge editor Change-Id: I08fd5c203faec328191fb733c2222081cc44e5f0 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
Diffstat (limited to 'org.eclipse.egit.ui')
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/merge/GitMergeEditorInput.java49
1 files changed, 49 insertions, 0 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/merge/GitMergeEditorInput.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/merge/GitMergeEditorInput.java
index 887f52da4..e57e0cdc8 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/merge/GitMergeEditorInput.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/merge/GitMergeEditorInput.java
@@ -71,6 +71,8 @@ import org.eclipse.osgi.util.NLS;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import org.eclipse.team.core.history.IFileRevision;
+import org.eclipse.team.internal.ui.synchronize.EditableSharedDocumentAdapter.ISharedDocumentAdapterListener;
+import org.eclipse.team.internal.ui.synchronize.LocalResourceTypedElement;
import org.eclipse.team.ui.synchronize.SaveableCompareEditorInput;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;
@@ -79,6 +81,7 @@ import org.eclipse.ui.ide.IDE.SharedImages;
/**
* A Git-specific {@link CompareEditorInput}
*/
+@SuppressWarnings("restriction")
public class GitMergeEditorInput extends CompareEditorInput {
private static final String LABELPATTERN = "{0} - {1}"; //$NON-NLS-1$
@@ -374,6 +377,12 @@ public class GitMergeEditorInput extends CompareEditorInput {
left = new LocalNonWorkspaceTypedElement(repository,
location);
}
+ if (left instanceof LocalResourceTypedElement) {
+ ((LocalResourceTypedElement) left)
+ .setSharedDocumentListener(
+ new LocalResourceSaver(
+ (LocalResourceTypedElement) left));
+ }
} else {
rev = GitFileRevision.inIndex(repository, gitPath,
DirCacheEntry.STAGE_2);
@@ -488,4 +497,44 @@ public class GitMergeEditorInput extends CompareEditorInput {
public boolean canRunAsJob() {
return true;
}
+
+ private static class LocalResourceSaver
+ implements ISharedDocumentAdapterListener {
+
+ LocalResourceTypedElement element;
+
+ public LocalResourceSaver(LocalResourceTypedElement element) {
+ this.element = element;
+ }
+
+ @Override
+ public void handleDocumentConnected() {
+ // Nothing
+ }
+
+ @Override
+ public void handleDocumentDisconnected() {
+ // Nothing
+ }
+
+ @Override
+ public void handleDocumentFlushed() {
+ try {
+ element.saveDocument(true, null);
+ } catch (CoreException e) {
+ Activator.handleStatus(e.getStatus(), true);
+ }
+ }
+
+ @Override
+ public void handleDocumentDeleted() {
+ // Nothing
+ }
+
+ @Override
+ public void handleDocumentSaved() {
+ // Nothing
+ }
+
+ }
}

Back to the top