diff options
| author | Florian Barbin | 2017-08-29 16:11:40 +0000 |
|---|---|---|
| committer | Pierre-Charles David | 2017-09-14 07:29:15 +0000 |
| commit | 68bae39b5cb91760a9c7025140556cbb5dbe80ec (patch) | |
| tree | bb6fa5da986edeac861a79b348bc7f0e572089b2 | |
| parent | 8e2c398fdcba2308e50f6dd87ddea97096309fc1 (diff) | |
| download | org.eclipse.sirius-68bae39b5cb91760a9c7025140556cbb5dbe80ec.tar.gz org.eclipse.sirius-68bae39b5cb91760a9c7025140556cbb5dbe80ec.tar.xz org.eclipse.sirius-68bae39b5cb91760a9c7025140556cbb5dbe80ec.zip | |
[518686] Makes CreateEMFModelWizard API
Bug: 518686
Change-Id: If35904cd6ad122384334aee30fc55091f71633c3
Signed-off-by: Florian Barbin <florian.barbin@obeo.fr>
Signed-off-by: Pierre-Charles David <pierre-charles.david@obeo.fr>
9 files changed, 50 insertions, 29 deletions
diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html index a7a6fbb6a0..3037961bed 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.html @@ -183,24 +183,6 @@ <a href="#replazyloading">representation lazy loading</a> as it may, in the future, not need to load all not yet loaded representations. For now, the use of this API will load all not loaded representations. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui.editor.api.pages">Changes in - <code>org.eclipse.sirius.ui.editor.api.pages</code> - </h4> - <ul> - <li><span class="label label-success">Added</span> New classes have been added in package - <code>org.eclipse.sirius.ui.editor.api.pages</code>. They are the following: - <code>AbstractSessionEditorPage</code>, - <code>PageProvider</code>, - <code>PageUpdateCOmmand</code>, - <code>PositioningKind</code>, - <code>PageUpdateCommandFactory</code>. These classes allow to provide custom pages to session editor instances. - </li> - </ul> - <ul> - <li><span class="label label-success">Added</span> An extension point - <code>org.eclipse.sirius.ui.editor.sessionEditorPageProvider</code> has been added to allow custom page providing for session editor instances. - </li> - </ul> <h4 id="Migrations">Migrations</h4> <ul> <li><span class="label label-success">Added</span> A migration has been added to fix diagram with edge labels corrupted (see @@ -316,6 +298,11 @@ </h4> <ul> <li><span class="label label-success">Added</span> + <code>org.eclipse.sirius.ui.tools.api.wizards.CreateEMFModelWizard</code> is a new wizard that can be invoked to create instances of any metamodel. It will ask the end-user for a metamodel ( + <code>EPackage</code>), a concrete type to instanciate as root element, and finally the local path of the file to create. See the class Javadoc for sample usage. Note that the first two pages of the wizard (EPackage and root type selection) can be customized through the + <code>org.eclipse.sirius.common.package_meta_data</code> extension point to provide user-oriented name and documentation for an EPackage, and to suggest specific EClasses as good root candidates. + </li> + <li><span class="label label-success">Added</span> <code>org.eclipse.sirius.ui.tools.api.command.AbstractSWTCallback.shouldDeleteRepresentation(Set<DRepresentationDescriptor>)</code> default implementation has been added to prompt the confirm dialog. </li> <li><span class="label label-success">Added</span> @@ -325,6 +312,22 @@ <code>DRepresentationDescriptor.getRepresentation()</code> method instead of performing a direct load. </li> </ul> + <h4 id="Changesinorg.eclipse.sirius.ui.editor">Changes in + <code>org.eclipse.sirius.ui.editor</code> + </h4> + <ul> + <li><span class="label label-success">Added</span> New classes have been added in package + <code>org.eclipse.sirius.ui.editor.api.pages</code>. They are the following: + <code>AbstractSessionEditorPage</code>, + <code>PageProvider</code>, + <code>PageUpdateCOmmand</code>, + <code>PositioningKind</code>, + <code>PageUpdateCommandFactory</code>. These classes allow to provide custom pages to session editor instances. + </li> + <li><span class="label label-success">Added</span> An extension point + <code>org.eclipse.sirius.ui.editor.sessionEditorPageProvider</code> has been added to allow custom page providing for session editor instances. + </li> + </ul> <h2 id="sirius5.0.1">Changes in Sirius 5.0.1</h2> <p>Sirius 5.0.1 is a maintenance release with only bugfixes and small tweaks to the UI of <a href="user/general/Aird_Editor.html">the aird editor</a>. @@ -804,7 +807,7 @@ <code>SiriusTreeUiPreferencesKeys.PREF_ALWAYS_USE_STANDARD_FONT_SIZE</code>. This enum value is the preference when true allowing to use runtime font height when displaying Sirius tree editor’s items instead of the one specified in the VSM. </li> </ul> - <h4 id="Changesinorg.eclipse.sirius.ui.editor">Changes in + <h4 id="Changesinorg.eclipse.sirius.ui.editor2">Changes in <code>org.eclipse.sirius.ui.editor</code> </h4> <p>This plugin is new in Sirius 5.0. It provides a session editor showing loaded models, representations and viewpoint activation status of the session. It has functionalities allowing to change the viewpoint activation status, to create/remove representations or to load unload external models. The graphical block showing loaded models is integrated with CNF. You can provide content extension to its viewer by using an id matching the pattern diff --git a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile index b6d2aae95a..27cedf7319 100644 --- a/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile +++ b/plugins/org.eclipse.sirius.doc/doc/Release_Notes.textile @@ -39,13 +39,6 @@ h4. Changes in @org.eclipse.sirius.business.api@ * <span class="label label-success">Added</span> (experimental) The new API @org.eclipse.sirius.business.api.query.SiriusReferenceFinder@ and @org.eclipse.sirius.business.api.query.EObjectQuery.getSiriusReferenceFinder()@ method to get it have been added. This API allows getting the DRepresentations or DRepresentationElements that reference the provided semantic object. It also allows getting the DRepresentationDescriptor which associated DRepresentation is or contains elements that reference the provided semantic object. This API will be useful for "representation lazy loading":#replazyloading as it may, in the future, not need to load all not yet loaded representations. For now, the use of this API will load all not loaded representations. -h4. Changes in @org.eclipse.sirius.ui.editor.api.pages@ - -* <span class="label label-success">Added</span> New classes have been added in package @org.eclipse.sirius.ui.editor.api.pages@. They are the following: @AbstractSessionEditorPage@, @PageProvider@, @PageUpdateCOmmand@, @PositioningKind@, @PageUpdateCommandFactory@. These classes allow to provide custom pages to session editor instances. - -* <span class="label label-success">Added</span> An extension point @org.eclipse.sirius.ui.editor.sessionEditorPageProvider@ has been added to allow custom page providing for session editor instances. - - h4. Migrations * <span class="label label-success">Added</span> A migration has been added to fix diagram with edge labels corrupted (see "bugzilla #518870":https://bugs.eclipse.org/bugs/show_bug.cgi?id=518870 for more details). The corresponding version, stored in attribute version of viewpoint:DAnalysis of the aird file, is _12.1.0.201706291600_. @@ -82,9 +75,16 @@ h4. Changes in @org.eclipse.sirius.common@ h4. Changes in @org.eclipse.sirius.ui@ +* <span class="label label-success">Added</span> @org.eclipse.sirius.ui.tools.api.wizards.CreateEMFModelWizard@ is a new wizard that can be invoked to create instances of any metamodel. It will ask the end-user for a metamodel (@EPackage@), a concrete type to instanciate as root element, and finally the local path of the file to create. See the class Javadoc for sample usage. Note that the first two pages of the wizard (EPackage and root type selection) can be customized through the @org.eclipse.sirius.common.package_meta_data@ extension point to provide user-oriented name and documentation for an EPackage, and to suggest specific EClasses as good root candidates. * <span class="label label-success">Added</span> @org.eclipse.sirius.ui.tools.api.command.AbstractSWTCallback.shouldDeleteRepresentation(Set<DRepresentationDescriptor>)@ default implementation has been added to prompt the confirm dialog. * <span class="label label-success">Added</span> @org.eclipse.sirius.ui.business.api.session.SessionEditorInput.SessionEditorInput(URI, URI, String, Session)@ has been added to provide the @DRepresentationDescriptor@ URI to retrieve the @DRepresentation@ from the @DRepresentationDescriptor.getRepresentation()@ method instead of performing a direct load. +h4. Changes in @org.eclipse.sirius.ui.editor@ + +* <span class="label label-success">Added</span> New classes have been added in package @org.eclipse.sirius.ui.editor.api.pages@. They are the following: @AbstractSessionEditorPage@, @PageProvider@, @PageUpdateCOmmand@, @PositioningKind@, @PageUpdateCommandFactory@. These classes allow to provide custom pages to session editor instances. +* <span class="label label-success">Added</span> An extension point @org.eclipse.sirius.ui.editor.sessionEditorPageProvider@ has been added to allow custom page providing for session editor instances. + + h2(#sirius5.0.1). Changes in Sirius 5.0.1 Sirius 5.0.1 is a maintenance release with only bugfixes and small tweaks to the UI of "the aird editor":user/general/Aird_Editor.html. diff --git a/plugins/org.eclipse.sirius.ui.editor/src/org/eclipse/sirius/ui/editor/internal/graphicalcomponents/GraphicalSemanticModelsHandler.java b/plugins/org.eclipse.sirius.ui.editor/src/org/eclipse/sirius/ui/editor/internal/graphicalcomponents/GraphicalSemanticModelsHandler.java index e3ba55d876..7a7dacae2f 100644 --- a/plugins/org.eclipse.sirius.ui.editor/src/org/eclipse/sirius/ui/editor/internal/graphicalcomponents/GraphicalSemanticModelsHandler.java +++ b/plugins/org.eclipse.sirius.ui.editor/src/org/eclipse/sirius/ui/editor/internal/graphicalcomponents/GraphicalSemanticModelsHandler.java @@ -70,6 +70,7 @@ import org.eclipse.sirius.business.api.session.SessionManagerListener; import org.eclipse.sirius.ui.editor.Messages; import org.eclipse.sirius.ui.editor.SessionEditorPlugin; import org.eclipse.sirius.ui.tools.api.views.common.item.ProjectDependenciesItem; +import org.eclipse.sirius.ui.tools.api.wizards.CreateEMFModelWizard; import org.eclipse.sirius.ui.tools.internal.actions.analysis.AddModelDependencyAction; import org.eclipse.sirius.ui.tools.internal.actions.analysis.RemoveSemanticResourceAction; import org.eclipse.sirius.ui.tools.internal.views.common.item.NoDynamicProjectDependencies; @@ -80,7 +81,6 @@ import org.eclipse.sirius.ui.tools.internal.views.common.navigator.filter.Filter import org.eclipse.sirius.ui.tools.internal.views.common.navigator.sorter.RepresentationInSemanticSorter; import org.eclipse.sirius.ui.tools.internal.views.modelexplorer.DeleteActionHandler; import org.eclipse.sirius.ui.tools.internal.views.modelexplorer.RenameActionHandler; -import org.eclipse.sirius.ui.tools.internal.wizards.newmodel.CreateEMFModelWizard; import org.eclipse.sirius.viewpoint.DAnalysis; import org.eclipse.sirius.viewpoint.DRepresentationDescriptor; import org.eclipse.sirius.viewpoint.description.Viewpoint; diff --git a/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF index 8d6fe3689c..7a9c7a0b85 100644 --- a/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF +++ b/plugins/org.eclipse.sirius.ui/META-INF/MANIFEST.MF @@ -52,6 +52,7 @@ Export-Package: org.eclipse.sirius.description.contribution.provider;version="2. org.eclipse.sirius.ui.tools.api.views.modelexplorerview;version="2.0.4", org.eclipse.sirius.ui.tools.api.views.modelexplorerview.resourcelistener;version="2.0.4", org.eclipse.sirius.ui.tools.api.wizards.page;version="2.0.4", + org.eclipse.sirius.ui.tools.api.wizards;version="5.1.0", org.eclipse.sirius.ui.tools.internal.actions.analysis;version="2.0.4";x-internal:=true, org.eclipse.sirius.ui.tools.internal.actions.control;version="2.0.4";x-internal:=true, org.eclipse.sirius.ui.tools.internal.actions.copy;version="2.0.4";x-internal:=true, diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/CreateEMFModelWizard.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/wizards/CreateEMFModelWizard.java index 2b4087818f..ab4ad5045e 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/CreateEMFModelWizard.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/api/wizards/CreateEMFModelWizard.java @@ -8,7 +8,7 @@ * Contributors: * Obeo - initial API and implementation */ -package org.eclipse.sirius.ui.tools.internal.wizards.newmodel; +package org.eclipse.sirius.ui.tools.api.wizards; import java.io.IOException; import java.lang.reflect.InvocationTargetException; @@ -31,6 +31,10 @@ import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.jface.wizard.IWizardPage; import org.eclipse.jface.wizard.Wizard; +import org.eclipse.sirius.ui.tools.internal.wizards.newmodel.CreateEMFModelWizardDataModel; +import org.eclipse.sirius.ui.tools.internal.wizards.newmodel.NameAndLocationWizardPage; +import org.eclipse.sirius.ui.tools.internal.wizards.newmodel.SelectEMFMetamodelWizardPage; +import org.eclipse.sirius.ui.tools.internal.wizards.newmodel.SelectRootElementWizardPage; import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.sirius.viewpoint.provider.SiriusEditPlugin; import org.eclipse.ui.IWorkbenchPage; @@ -43,6 +47,15 @@ import org.eclipse.ui.part.ISetSelectionTarget; /** * A wizard allowing to create a new EMF model. The model will be an instance of a metamodel available through the given * {@link Registry}. + * <p> + * Sample usage: + * <pre><code> + * CreateEMFModelWizard wizard = new CreateEMFModelWizard(EPackage.Registry.INSTANCE, new StructuredSelection(context)); + * if (new WizardDialog(window.getShell(), wizard).open() == Window.OK) { + * IFile newModel = wizard.getResult(); + * // do something with the new file + * } + * </code></pre> * * @see #CreateEMFModelWizard(Registry, IStructuredSelection) * diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/CreateEMFModelWizardDataModel.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/CreateEMFModelWizardDataModel.java index 9017ec834e..034a6d5dbc 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/CreateEMFModelWizardDataModel.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/CreateEMFModelWizardDataModel.java @@ -15,6 +15,7 @@ import java.beans.PropertyChangeSupport; import org.eclipse.emf.ecore.EClass; import org.eclipse.emf.ecore.EPackage; +import org.eclipse.sirius.ui.tools.api.wizards.CreateEMFModelWizard; /** * A data model that works along with {@link CreateEMFModelWizard}. diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/NameAndLocationWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/NameAndLocationWizardPage.java index 5f09b686b3..4454c595c2 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/NameAndLocationWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/NameAndLocationWizardPage.java @@ -18,6 +18,7 @@ import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.Path; import org.eclipse.emf.ecore.EPackage; import org.eclipse.jface.viewers.IStructuredSelection; +import org.eclipse.sirius.ui.tools.api.wizards.CreateEMFModelWizard; import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.ui.dialogs.WizardNewFileCreationPage; @@ -68,7 +69,7 @@ public class NameAndLocationWizardPage extends WizardNewFileCreationPage impleme } @Override - protected boolean validatePage() { + public boolean validatePage() { boolean isValid = false; if (super.validatePage()) { String extension = new Path(getFileName()).getFileExtension(); diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectEMFMetamodelWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectEMFMetamodelWizardPage.java index 327cb603ba..f894cdc3a3 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectEMFMetamodelWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectEMFMetamodelWizardPage.java @@ -19,6 +19,7 @@ import org.eclipse.jface.viewers.LabelProvider; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.sirius.common.tools.DslCommonPlugin; import org.eclipse.sirius.common.tools.api.ecore.EPackageMetaData; +import org.eclipse.sirius.ui.tools.api.wizards.CreateEMFModelWizard; import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.SWTError; diff --git a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectRootElementWizardPage.java b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectRootElementWizardPage.java index 25ab4fc3b6..0f295f7d69 100644 --- a/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectRootElementWizardPage.java +++ b/plugins/org.eclipse.sirius.ui/src/org/eclipse/sirius/ui/tools/internal/wizards/newmodel/SelectRootElementWizardPage.java @@ -27,6 +27,7 @@ import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerFilter; import org.eclipse.jface.wizard.WizardPage; import org.eclipse.sirius.common.tools.internal.ecore.EPackageHelper; +import org.eclipse.sirius.ui.tools.api.wizards.CreateEMFModelWizard; import org.eclipse.sirius.viewpoint.provider.Messages; import org.eclipse.swt.SWT; import org.eclipse.swt.custom.CLabel; |
