Author: DartPeng
Date: 2008-10-06 23:26:52 -0400 (Mon, 06 Oct 2008)
New Revision: 10700
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java
Log:
For fixing JBIDE-2831 ( .graph file out of synch with Eclipse workspace )
make the file to refresh after saving complete
Modified:
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java
===================================================================
---
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java 2008-10-06
22:53:41 UTC (rev 10699)
+++
trunk/smooks/plugins/org.jboss.tools.smooks.ui/src/org/jboss/tools/smooks/graphical/util/GraphicalInformationSaver.java 2008-10-07
03:26:52 UTC (rev 10700)
@@ -18,6 +18,7 @@
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.Path;
@@ -41,6 +42,8 @@
private IEditorInput input;
protected Resource graphicalFileResource;
+
+ private IFile file = null;
/**
* Create the instance during init step
@@ -66,6 +69,7 @@
e.printStackTrace();
}
}
+ setFile(gfile);
String osString = gfile.getLocation().toOSString();
graphicalFileResource = new XMLResourceFactoryImpl()
.createResource(URI.createFileURI(osString));
@@ -89,6 +93,7 @@
e.printStackTrace();
}
}
+ setFile(gfile);
String osString = gfile.getLocation().toOSString();
graphicalFileResource = new XMLResourceFactoryImpl()
.createResource(URI.createFileURI(osString));
@@ -108,7 +113,7 @@
}
public void doSave(IProgressMonitor monitor, String sourceid,
- String targetid) throws IOException {
+ String targetid) throws IOException, CoreException {
GraphInformations graph = null;
if (graphicalFileResource != null) {
if (graphicalFileResource.getContents().isEmpty()) {
@@ -122,6 +127,7 @@
initMappingTypes(graph, sourceid, targetid);
}
graphicalFileResource.save(Collections.EMPTY_MAP);
+ if(this.file != null) file.refreshLocal(IResource.DEPTH_ONE, monitor);
}
}
@@ -146,6 +152,7 @@
initParams(params, context);
}
graphicalFileResource.save(Collections.EMPTY_MAP);
+ if(this.file != null) file.refreshLocal(IResource.DEPTH_ONE, monitor);
}
}
@@ -175,4 +182,12 @@
mapping.setTargetTypeID(targetID);
}
+ public IFile getFile() {
+ return file;
+ }
+
+ public void setFile(IFile file) {
+ this.file = file;
+ }
+
}
Show replies by date