| author | Bob Brodt | 2011-08-16 14:55:21 (EDT) |
|---|---|---|
| committer | Bob Brodt | 2011-08-16 14:55:21 (EDT) |
| commit | 279bc0702aeeae6973349159052ad860f19b81e7 (patch) (side-by-side diff) | |
| tree | 4a85fd7bb4627e212276741c1d694d3f4cae1496 | |
| parent | d19107aaee0622d5057be1171447d44cc76851c2 (diff) | |
| download | org.eclipse.bpmn2-modeler-drilldown.zip org.eclipse.bpmn2-modeler-drilldown.tar.gz org.eclipse.bpmn2-modeler-drilldown.tar.bz2 | |
fix for JBPM-3296 - also generate unique file namesdrilldown
| -rw-r--r-- | org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramWizardPage.java | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramWizardPage.java b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramWizardPage.java index a27b963..446e012 100644 --- a/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramWizardPage.java +++ b/org.eclipse.bpmn2.modeler.ui/src/org/eclipse/bpmn2/modeler/ui/wizards/BPMN2DiagramWizardPage.java @@ -15,6 +15,7 @@ package org.eclipse.bpmn2.modeler.ui.wizards; import org.eclipse.core.resources.IContainer; import org.eclipse.core.resources.IResource; import org.eclipse.core.resources.ResourcesPlugin; +import org.eclipse.core.runtime.IAdaptable; import org.eclipse.core.runtime.Path; import org.eclipse.jface.dialogs.IDialogPage; import org.eclipse.jface.viewers.ISelection; @@ -108,12 +109,18 @@ public class BPMN2DiagramWizardPage extends WizardPage { */ private void initialize() { + String filename = "process.bpmn"; if (selection != null && selection.isEmpty() == false && selection instanceof IStructuredSelection) { IStructuredSelection ssel = (IStructuredSelection) selection; if (ssel.size() > 1) { return; } Object obj = ssel.getFirstElement(); + if (obj instanceof IAdaptable) { + Object res = ((IAdaptable)obj).getAdapter(IResource.class); + if (res!=null) + obj = res; + } if (obj instanceof IResource) { IContainer container; if (obj instanceof IContainer) { @@ -122,9 +129,16 @@ public class BPMN2DiagramWizardPage extends WizardPage { container = ((IResource) obj).getParent(); } containerText.setText(container.getFullPath().toString()); + for (int i=1; ; ++i) { + filename = "process_" + i + ".bpmn"; + IResource file = container.findMember(filename); + if (file==null) { + break; + } + } } } - fileText.setText("new_file.bpmn"); + fileText.setText(filename); } /** |

