Bug 475266 - [Papyrus] Exception when right click on a "one filed"
papyrus model
Change-Id: Ia3353c2d00ba6de582fa94769ef52a994a73c4bc
Signed-off-by: Charlotte Rambaud <charlotte.rambaud@atos.net>
diff --git a/plugins/org.eclipse.gendoc.wizard/plugin.xml b/plugins/org.eclipse.gendoc.wizard/plugin.xml
index 6cb76e9..8409d41 100644
--- a/plugins/org.eclipse.gendoc.wizard/plugin.xml
+++ b/plugins/org.eclipse.gendoc.wizard/plugin.xml
@@ -27,6 +27,10 @@
<iterate
ifEmpty="false">
<or>
+ <test
+ forcePluginActivation="true"
+ property="org.eclipse.gendoc.wizard.isEnabled">
+ </test>
<adapt
type="org.eclipse.core.resources.IFile">
<test
diff --git a/plugins/org.eclipse.gendoc.wizard/src/org/eclipse/gendoc/wizard/GendocWizardPage.java b/plugins/org.eclipse.gendoc.wizard/src/org/eclipse/gendoc/wizard/GendocWizardPage.java
index 108460e..7f139f0 100644
--- a/plugins/org.eclipse.gendoc.wizard/src/org/eclipse/gendoc/wizard/GendocWizardPage.java
+++ b/plugins/org.eclipse.gendoc.wizard/src/org/eclipse/gendoc/wizard/GendocWizardPage.java
@@ -168,8 +168,13 @@
IFile[] files = getGWizard().getInputFiles();
IGendocRunner selectedRunner = null;
if (getGWizard().getRunners().size() == 1) {
- fileForTemplate = files[0];
selectedRunner = getGWizard().getRunners().get(0);
+ for (IFile f : files) {
+ if (selectedRunner.getPattern().matcher(f.getName())
+ .matches()) {
+ fileForTemplate = f;
+ }
+ }
} else {
if (comboViewer_1 != null
&& comboViewer_1.getSelection() instanceof StructuredSelection) {
diff --git a/plugins/org.eclipse.gendoc.wizard/src/org/eclipse/gendoc/wizard/Utils.java b/plugins/org.eclipse.gendoc.wizard/src/org/eclipse/gendoc/wizard/Utils.java
index 84fb7a9..5a08fab 100644
--- a/plugins/org.eclipse.gendoc.wizard/src/org/eclipse/gendoc/wizard/Utils.java
+++ b/plugins/org.eclipse.gendoc.wizard/src/org/eclipse/gendoc/wizard/Utils.java
@@ -41,10 +41,11 @@
}
else
{
+ Collection<IFile> files = new LinkedList<IFile>();
IFile f = (IFile) Platform.getAdapterManager().getAdapter(o, IFile.class);
if (f != null)
{
- return new IFile[] {f} ;
+ files.add(f) ;
}
Collection<?> collec = (Collection<?>) Platform.getAdapterManager().getAdapter(o, Collection.class);
if (collec != null)
@@ -60,11 +61,11 @@
}
if (ok)
{
- return collec.toArray(new IFile[]{});
+ files.addAll((Collection<? extends IFile>) collec);
}
}
+ return files.toArray(new IFile[]{});
}
- return null ;
}
/**