Author: Grid.Qian
Date: 2008-10-24 03:19:54 -0400 (Fri, 24 Oct 2008)
New Revision: 11134
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/TranslateHelper.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/wizard/B2JExportWizard.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/util/BPMNToUtil.java
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/GeneratedFileLocationPage.java
Log:
JBIDE-2973:the checkbox for overwrite existing resources has not effort on the result
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/TranslateHelper.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/TranslateHelper.java 2008-10-24
07:17:20 UTC (rev 11133)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/translate/TranslateHelper.java 2008-10-24
07:19:54 UTC (rev 11134)
@@ -65,16 +65,16 @@
File jpdlFolder = BPMNToUtil.createFile(parentFolder,
B2JMessages.Jpdl_Suffix, null, isOverWrite);
File diagramFolder = BPMNToUtil.createFile(
- jpdlFolder.getAbsolutePath(), bpmnFileName, null, isOverWrite);
+ jpdlFolder.getAbsolutePath(), bpmnFileName, null, false);
File[] files = new File[strsForGenerate.length];
File processFolder = null;
int i = 0;
for (String str : strsForGenerate) {
processFolder = BPMNToUtil.createFile(diagramFolder
- .getAbsolutePath(), fileFolders[i], null, isOverWrite);
+ .getAbsolutePath(), fileFolders[i], null, false);
files[i] = BPMNToUtil.createFile(processFolder.getAbsolutePath(),
- fileName, str, isOverWrite);
+ fileName, str, false);
i++;
}
return files;
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/wizard/B2JExportWizard.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/wizard/B2JExportWizard.java 2008-10-24
07:17:20 UTC (rev 11133)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/b2j/wizard/B2JExportWizard.java 2008-10-24
07:19:54 UTC (rev 11134)
@@ -38,6 +38,9 @@
private List<String> generatedGpdFoldersList = new ArrayList<String>();
public void createGeneratedFile(boolean isOverWrite) {
+ if(!isOverWrite){
+ return;
+ }
String[] jpdlFolderNames = new String[this.generatedFoldersList.size()];
String location = super.getContainerPath((IContainer) super
@@ -81,7 +84,7 @@
}
try {
TranslateHelper.createFiles(location, bpmnFileName, strs,
- jpdlFolderNames, B2JMessages.Gpd_Definition_Name, isOverWrite);
+ jpdlFolderNames, B2JMessages.Gpd_Definition_Name, false);
} catch (Exception e) {
BpmnToPlugin.getDefault().logError(e.getMessage());
}
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/util/BPMNToUtil.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/util/BPMNToUtil.java 2008-10-24
07:17:20 UTC (rev 11133)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/util/BPMNToUtil.java 2008-10-24
07:19:54 UTC (rev 11134)
@@ -53,12 +53,15 @@
public static File createFile(String parentFolder, String fileName,
String inputStr, boolean isOverWrite) throws IOException {
File child = new File(parentFolder, fileName);
+ if(isOverWrite){
+ deleteAll(child);
+ }
if (inputStr == null) {
- if (!child.exists() || isOverWrite) {
+ if (!child.exists()) {
child.mkdir();
}
} else {
- if (!child.exists() || isOverWrite) {
+ if (!child.exists()) {
child.createNewFile();
}
FileWriter childWriter = new FileWriter(child);
@@ -71,6 +74,20 @@
return child;
}
+ public static void deleteAll(File path) {
+ if (!path.exists())
+ return;
+ if (path.isFile()) {
+ path.delete();
+ return;
+ }
+ File[] files = path.listFiles();
+ for (int i = 0; i < files.length; i++) {
+ deleteAll(files[i]);
+ }
+ path.delete();
+ }
+
/*
* get a sax input source
*/
Modified:
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/GeneratedFileLocationPage.java
===================================================================
---
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/GeneratedFileLocationPage.java 2008-10-24
07:17:20 UTC (rev 11133)
+++
trunk/jbpm/plugins/org.jboss.tools.jbpm.convert/src/org/jboss/tools/jbpm/convert/bpmnto/wizard/GeneratedFileLocationPage.java 2008-10-24
07:19:54 UTC (rev 11134)
@@ -50,7 +50,7 @@
private ISelection currentSelection;
private Button button;
private IWizard wizard;
- private boolean isOverWrite;
+ private boolean isOverWrite = true;
protected GeneratedFileLocationPage(String pageName, String title,