diff --git a/src/main/java/org/modelio/module/attacktreedesigner/command/wizard/AttackTreeDiagramWizard.java b/src/main/java/org/modelio/module/attacktreedesigner/command/wizard/AttackTreeDiagramWizard.java index 2532134..d319ec8 100644 --- a/src/main/java/org/modelio/module/attacktreedesigner/command/wizard/AttackTreeDiagramWizard.java +++ b/src/main/java/org/modelio/module/attacktreedesigner/command/wizard/AttackTreeDiagramWizard.java @@ -12,7 +12,6 @@ import org.modelio.api.module.context.IModuleContext; import org.modelio.api.module.contributor.AbstractWizardContributor; import org.modelio.api.module.contributor.ElementDescriptor; -import org.modelio.api.module.contributor.diagramcreation.IDiagramWizardContributor; import org.modelio.metamodel.diagrams.AbstractDiagram; import org.modelio.metamodel.diagrams.StaticDiagram; import org.modelio.metamodel.mmextensions.infrastructure.ExtensionNotFoundException; @@ -32,37 +31,37 @@ /** * @author ebrosse */ -public class AttackTreeDiagramWizard extends AbstractWizardContributor implements IDiagramWizardContributor { +public class AttackTreeDiagramWizard extends AbstractWizardContributor { @Override public AbstractDiagram actionPerformed(ModelElement owner, String diagramName, String description) { IModuleContext moduleContext = AttackTreeDesignerModule.getInstance().getModuleContext(); IModelingSession session = moduleContext.getModelingSession(); String name = Messages.getString ("Ui.Command.AttackTreeDiagramExplorerCommand.Label"); StaticDiagram diagram = null; - + try( ITransaction transaction = session.createTransaction(Messages.getString ("Info.Session.Create", "AttackTree Diagram"))){ - + diagram = session.getModel().createStaticDiagram(name, owner, IAttackTreeDesignerPeerModule.MODULE_NAME, AttackTreeStereotypes.ATTACK_TREE_DIAGRAM); - + if (diagram != null) { IDiagramService ds = moduleContext.getModelioServices().getDiagramService(); try( IDiagramHandle handler = ds.getDiagramHandle(diagram);){ IDiagramDG dg = handler.getDiagramNode(); - + for (IStyleHandle style : ds.listStyles()){ if (style.getName().equals("sysml")){ dg.setStyle(style); break; } } - + handler.save(); handler.close(); } - + moduleContext.getModelioServices().getEditionService().openEditor(diagram); } - + transaction.commit (); } catch (ExtensionNotFoundException e) { moduleContext.getLogService().error(e); diff --git a/target/classes/org/modelio/module/attacktreedesigner/i18n/messages.properties b/target/classes/org/modelio/module/attacktreedesigner/i18n/messages.properties new file mode 100644 index 0000000..6bfda0e --- /dev/null +++ b/target/classes/org/modelio/module/attacktreedesigner/i18n/messages.properties @@ -0,0 +1,37 @@ + +AttackTreePaletteGroup.AttackTree = Attack Tree +AttackTreePaletteGroup.Freedrawing = Free Drawing +AttackTreePaletteGroup.NotesAndConstraints = Notes and Constraints + +Info.Session.Create = Create {0} +Info.Session.UpdateModel = Update Model +Info.Session.Delete = Delete {0} + +Ui.Command.AttackTreeDiagramExplorerCommand.Label = Attack Tree Diagram +Ui.Command.AttackTreeDiagramExplorerCommand.Name = Attack Tree Diagram +Ui.Property.Name.Name = Name +Ui.Property.Reference.Name = Reference +Ui.Property.TypeCondition.Name = Type + + +Ui.Dialog.SelectXMLFileImport.Label = Select an XML file to import +Ui.Dialog.SelectDirectoryImport.Label = Select a directory to import +Ui.Dialog.SelectDirectoryExport.Label = Select a directory to export +Ui.Dialog.NoSelectedElement.Label = No selected element! +Ui.Dialog.NoSelectedElementAdd.Message = No element has been selected to add custom tag +Ui.Dialog.EmptyName.Label = Empty name field! +Ui.Dialog.EmptyName.Message = The property name field is empty +Ui.Dialog.EmptyValue.Label = Empty value field! +Ui.Dialog.EmptyValue.Message = The property value field is empty +Ui.Dialog.AddCustomTag.Label = Add a new Custom Tag property +Ui.Dialog.CustomTagName.Label = Provide the name and the value of your property +Ui.Field.CustomTagName.Label = Property name: +Ui.Field.CustomTagValue.Label = Property value: +Ui.Button.Cancel.Label = Cancel +Ui.Button.OK.Label = OK +Ui.Dialog.existingName.Label = Already existing name! +Ui.Dialog.existingName.Message = This property name is already existing +Ui.Dialog.noSelectedElement.Message = No element has been selected to remove custom tag +Ui.Dialog.NoSelectedTagRemove.Message = No element has been selected to remove from custom properties list +Ui.Dialog.NoDiagramFound.Label = No Diagram Found! +Ui.Dialog.NoDiagramFound.Message = Sorry! We could not find the diagram of the referenced tree diff --git a/target/classes/org/modelio/module/attacktreedesigner/i18n/messages_fr.properties b/target/classes/org/modelio/module/attacktreedesigner/i18n/messages_fr.properties new file mode 100644 index 0000000..6bfda0e --- /dev/null +++ b/target/classes/org/modelio/module/attacktreedesigner/i18n/messages_fr.properties @@ -0,0 +1,37 @@ + +AttackTreePaletteGroup.AttackTree = Attack Tree +AttackTreePaletteGroup.Freedrawing = Free Drawing +AttackTreePaletteGroup.NotesAndConstraints = Notes and Constraints + +Info.Session.Create = Create {0} +Info.Session.UpdateModel = Update Model +Info.Session.Delete = Delete {0} + +Ui.Command.AttackTreeDiagramExplorerCommand.Label = Attack Tree Diagram +Ui.Command.AttackTreeDiagramExplorerCommand.Name = Attack Tree Diagram +Ui.Property.Name.Name = Name +Ui.Property.Reference.Name = Reference +Ui.Property.TypeCondition.Name = Type + + +Ui.Dialog.SelectXMLFileImport.Label = Select an XML file to import +Ui.Dialog.SelectDirectoryImport.Label = Select a directory to import +Ui.Dialog.SelectDirectoryExport.Label = Select a directory to export +Ui.Dialog.NoSelectedElement.Label = No selected element! +Ui.Dialog.NoSelectedElementAdd.Message = No element has been selected to add custom tag +Ui.Dialog.EmptyName.Label = Empty name field! +Ui.Dialog.EmptyName.Message = The property name field is empty +Ui.Dialog.EmptyValue.Label = Empty value field! +Ui.Dialog.EmptyValue.Message = The property value field is empty +Ui.Dialog.AddCustomTag.Label = Add a new Custom Tag property +Ui.Dialog.CustomTagName.Label = Provide the name and the value of your property +Ui.Field.CustomTagName.Label = Property name: +Ui.Field.CustomTagValue.Label = Property value: +Ui.Button.Cancel.Label = Cancel +Ui.Button.OK.Label = OK +Ui.Dialog.existingName.Label = Already existing name! +Ui.Dialog.existingName.Message = This property name is already existing +Ui.Dialog.noSelectedElement.Message = No element has been selected to remove custom tag +Ui.Dialog.NoSelectedTagRemove.Message = No element has been selected to remove from custom properties list +Ui.Dialog.NoDiagramFound.Label = No Diagram Found! +Ui.Dialog.NoDiagramFound.Message = Sorry! We could not find the diagram of the referenced tree