Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMichael Valenta2006-10-16 14:47:31 +0000
committerMichael Valenta2006-10-16 14:47:31 +0000
commitc14f49eb290a4597b7237c4ad32b543731b76a8b (patch)
treead037bbaf92887e719bf71fd66c6d0c128d32583 /bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
parent5c127cb185e9b42015c4696c902b3863c1f329a4 (diff)
downloadeclipse.platform.team-c14f49eb290a4597b7237c4ad32b543731b76a8b.tar.gz
eclipse.platform.team-c14f49eb290a4597b7237c4ad32b543731b76a8b.tar.xz
eclipse.platform.team-c14f49eb290a4597b7237c4ad32b543731b76a8b.zip
Bug 39425 [Sync View] Compare editor should be closed on commit/update
Diffstat (limited to 'bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java')
-rw-r--r--bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java59
1 files changed, 45 insertions, 14 deletions
diff --git a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
index 6648513f8..97400f160 100644
--- a/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
+++ b/bundles/org.eclipse.compare/plugins/org.eclipse.compare/compare/org/eclipse/compare/CompareEditorInput.java
@@ -31,8 +31,7 @@ import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.*;
import org.eclipse.ui.*;
@@ -322,6 +321,26 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
public void run(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
fInput= prepareInput(monitor);
}
+
+ /**
+ * Re-run the compare operation and feed the new result into the editor input.
+ * This method can only be invoked after the compare editor containing the input
+ * has been totally initialized (e.g. after {@link #contentsCreated()} has been called.
+ * @param monitor a progress monitor
+ * @throws InterruptedException
+ * @throws InvocationTargetException
+ * @since 3.3
+ */
+ protected void refresh(IProgressMonitor monitor) throws InterruptedException, InvocationTargetException {
+ run(monitor);
+ if (!fComposite.isDisposed())
+ fComposite.getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ if (!fComposite.isDisposed())
+ feedInput();
+ }
+ });
+ }
/**
* Runs the compare operation and returns the compare result.
@@ -398,12 +417,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
fComposite.layout();
- if (fStructureInputPane != null && fInput instanceof ICompareInput) {
- fStructureInputPane.setInput(fInput);
- ISelection sel= fStructureInputPane.getSelection();
- if (sel == null || sel.isEmpty())
- feed1(sel); // we only feed downstream viewers if the top left pane is empty
- }
+ feedInput();
fComposite.setData(NAV_DATA,
new CompareViewerSwitchingPane[] {
@@ -419,6 +433,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
handleDispose();
}
});
+ contentsCreated();
return fComposite;
}
@@ -434,6 +449,18 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
protected void handleDispose() {
// Default is to do nothing
}
+
+ /**
+ * Callback that occurs after the control for the input has
+ * been created. If this method gets invoked then {@link #handleDispose()}
+ * will be invoked when the control is disposed. Subclasses may extend this
+ * method to register any listeners that need to be de-registered when the
+ * input is disposed.
+ * @since 3.3
+ */
+ protected void contentsCreated() {
+ // Default is to do nothing
+ }
/**
* @param parent the parent control under which the control must be created
@@ -518,12 +545,7 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
);
if (fUseOutlineView) {
- if (fInput instanceof ICompareInput) {
- fStructureInputPane.setInput(fInput);
- ISelection sel= fStructureInputPane.getSelection();
- if (sel == null || sel.isEmpty())
- feed1(sel); // we only feed downstream viewers if the top left pane is empty
- }
+ feedInput();
fComposite.setData(NAV_DATA,
new CompareViewerSwitchingPane[] {
@@ -538,6 +560,15 @@ public abstract class CompareEditorInput implements IEditorInput, IPropertyChang
return h;
}
+ private void feedInput() {
+ if (fStructureInputPane != null && fInput instanceof ICompareInput) {
+ fStructureInputPane.setInput(fInput);
+ ISelection sel= fStructureInputPane.getSelection();
+ if (sel == null || sel.isEmpty())
+ feed1(sel); // we only feed downstream viewers if the top left pane is empty
+ }
+ }
+
private void feed1(final ISelection selection) {
BusyIndicator.showWhile(fComposite.getDisplay(),
new Runnable() {

Back to the top