Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAxel Richard2013-10-30 06:31:30 -0400
committerGerrit Code Review @ Eclipse.org2013-11-12 05:47:46 -0500
commit11ba097d1698f06d6ff056323dee80697c89d6fa (patch)
treeffb5438397162114569e2121883a8daffb24c121 /plugins/org.eclipse.emf.compare.ide.ui/src
parentc999d66096b7d4915452365fef6cff349da8ba77 (diff)
downloadorg.eclipse.emf.compare-11ba097d1698f06d6ff056323dee80697c89d6fa.tar.gz
org.eclipse.emf.compare-11ba097d1698f06d6ff056323dee80697c89d6fa.tar.xz
org.eclipse.emf.compare-11ba097d1698f06d6ff056323dee80697c89d6fa.zip
[401816] Refresh the workspace after saving the comparison model2.2.0M3
Diffstat (limited to 'plugins/org.eclipse.emf.compare.ide.ui/src')
-rw-r--r--plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java
index 100a33ea8..04889c388 100644
--- a/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java
+++ b/plugins/org.eclipse.emf.compare.ide.ui/src/org/eclipse/emf/compare/ide/ui/internal/structuremergeviewer/actions/SaveComparisonModelAction.java
@@ -18,7 +18,13 @@ import java.io.File;
import java.io.IOException;
import java.io.NotSerializableException;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.compare.Comparison;
@@ -87,9 +93,11 @@ public class SaveComparisonModelAction extends Action {
int open = messageDialog.open();
if (open == DIALOG_BUTTON_LABELS.indexOf("Replace")) {
saveComparison(file);
+ refreshLocation(filePath);
} // else do nothing
} else {
saveComparison(file);
+ refreshLocation(filePath);
}
}
@@ -134,4 +142,22 @@ public class SaveComparisonModelAction extends Action {
EMFCompareIDEUIPlugin.getDefault().log(e);
}
}
+
+ /**
+ * Refresh the folder containing the given path.
+ *
+ * @param path
+ * the given path.
+ */
+ private void refreshLocation(String path) {
+ try {
+ IFile fileForLocation = ResourcesPlugin.getWorkspace().getRoot().getFileForLocation(
+ new Path(path));
+ if (fileForLocation != null) {
+ fileForLocation.getParent().refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ }
+ } catch (CoreException e) {
+ EMFCompareIDEUIPlugin.getDefault().log(e);
+ }
+ }
}

Back to the top