Download
Getting Started
Members
Projects
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
More
Community
Marketplace
Events
Planet Eclipse
Newsletter
Videos
Participate
Report a Bug
Forums
Mailing Lists
Wiki
IRC
How to Contribute
Working Groups
Automotive
Internet of Things
LocationTech
Long-Term Support
PolarSys
Science
OpenMDM
Toggle navigation
Bugzilla – Attachment 169796 Details for
Bug 313179
[Usability] Refactor CreateModelWizard
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Requests
|
Help
|
Log In
[x]
|
Terms of Use
|
Copyright Agent
Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read
this important communication.
[patch]
Javadoc added
313179 (text/plain), 6.45 KB, created by
Tatiana Fesenko
on 2010-05-25 06:00:46 EDT
(
hide
)
Description:
Javadoc added
Filename:
MIME Type:
Creator:
Tatiana Fesenko
Created:
2010-05-25 06:00:46 EDT
Size:
6.45 KB
patch
obsolete
>### Eclipse Workspace Patch 1.0 >#P org.eclipse.papyrus.diagram.common >Index: src/org/eclipse/papyrus/diagram/common/wizards/NewPapyrusProjectWizard.java >=================================================================== >--- src/org/eclipse/papyrus/diagram/common/wizards/NewPapyrusProjectWizard.java (revision 1708) >+++ src/org/eclipse/papyrus/diagram/common/wizards/NewPapyrusProjectWizard.java (working copy) >@@ -41,22 +41,35 @@ > import org.eclipse.uml2.uml.UMLPackage; > > /** >- * The Wizard creates a Papyrus Project and a Papyrus Model inside it >+ * The Wizard creates a Papyrus Project and a Papyrus Model inside it. > */ >- > public class NewPapyrusProjectWizard extends BasicNewProjectResourceWizard { > >+ /** The new project page. */ > private WizardNewProjectCreationPage myNewProjectPage; > >+ /** The diagram kind page. */ > private SelectDiagramKindPage myDiagramKindPage; > >+ /** The initial project name. */ > private String initialProjectName; > >+ /** >+ * @see org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard#init(org.eclipse.ui.IWorkbench, >+ * org.eclipse.jface.viewers.IStructuredSelection) >+ * >+ * @param workbench >+ * @param selection >+ */ > public void init(IWorkbench workbench, IStructuredSelection selection) { > super.init(workbench, selection); > setWindowTitle("New Papyrus Project"); > } > >+ /** >+ * @see org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard#addPages() >+ * >+ */ > public void addPages() { > super.addPages(); > myNewProjectPage = (WizardNewProjectCreationPage)getPage("basicNewProjectPage"); //$NON-NLS-1$ >@@ -67,6 +80,7 @@ > } > > myDiagramKindPage = new SelectDiagramKindPage("Select kind of diagram") { >+ > protected boolean validatePage() { > return true; > }; >@@ -74,23 +88,38 @@ > addPage(myDiagramKindPage); > } > >+ /** >+ * Creates the file. >+ * >+ * @return the file >+ */ > private IFile createFile() { > IPath newFilePath = myNewProjectPage.getProjectHandle().getFullPath().append(NewModelFilePage.DEFAULT_NAME + "." + NewModelFilePage.DIAGRAM_EXTENSION); > return ResourcesPlugin.getWorkspace().getRoot().getFile(newFilePath); > } > >+ /** >+ * @see org.eclipse.ui.wizards.newresource.BasicNewProjectResourceWizard#performFinish() >+ * >+ * @return >+ */ > public boolean performFinish() { > boolean created = super.performFinish(); >- if (!created) { >+ if(!created) { > return false; > } > // if the user wants to create a diagram >- if (myDiagramKindPage.getCreationCommand() != null) { >+ if(myDiagramKindPage.getCreationCommand() != null) { > return createPapyrusModel(); > } > return true; > } >- >+ >+ /** >+ * Creates the papyrus model. >+ * >+ * @return true, if successful >+ */ > private boolean createPapyrusModel() { > final DiResourceSet diResourceSet = new DiResourceSet(); > try { >@@ -147,25 +176,49 @@ > return true; > } > >+ /** >+ * Initialize model resource. >+ * >+ * @param resource >+ * the domain model resource >+ * @param rootElementName >+ * the root element name >+ */ > private void initializeModelResource(Resource resource, String rootElementName) { >-// // fjcano #293135 :: support model templates >-// if(!isInitializeFromTemplate()) { >- Model model = UMLFactory.eINSTANCE.createModel(); >- model.setName(rootElementName); >- resource.getContents().add(model); >-// } else { >-// super.initializeModelResource(resource, rootElementName); >-// } >+ // // fjcano #293135 :: support model templates >+ // if(!isInitializeFromTemplate()) { >+ Model model = UMLFactory.eINSTANCE.createModel(); >+ model.setName(rootElementName); >+ resource.getContents().add(model); >+ // } else { >+ // super.initializeModelResource(resource, rootElementName); >+ // } > } > >+ /** >+ * Sets the initial project name. >+ * >+ * @param initialProjectName >+ * the new initial project name >+ */ > public void setInitialProjectName(String initialProjectName) { > this.initialProjectName = initialProjectName; > } > >+ /** >+ * Gets the model content type. >+ * >+ * @return the model content type >+ */ > protected String getModelContentType() { > return UMLPackage.eCONTENT_TYPE; > } > >+ /** >+ * Gets the model file extension. >+ * >+ * @return the model file extension >+ */ > protected String getModelFileExtension() { > return "uml"; > } >#P org.eclipse.papyrus.wizards >Index: src/org/eclipse/papyrus/wizards/CreateModelWizard.java >=================================================================== >--- src/org/eclipse/papyrus/wizards/CreateModelWizard.java (revision 1693) >+++ src/org/eclipse/papyrus/wizards/CreateModelWizard.java (working copy) >@@ -245,11 +245,27 @@ > return true; > } > >+ /** >+ * Gets the model content type. >+ * >+ * @return the model content type >+ */ > protected abstract String getModelContentType(); > >+ /** >+ * Gets the model file extension. >+ * >+ * @return the model file extension >+ */ > protected abstract String getModelFileExtension(); > > // fjcano #293135 :: support model templates >+ /** >+ * Initialize model resource. >+ * >+ * @param resource the resource >+ * @param rootElementName the root element name >+ */ > private void initializeModelResource(Resource resource, String rootElementName) { > String templatePath = selectTemplateWizardPage.getTemplatePath(); > boolean initializeFromTemplate = templatePath != null; >@@ -260,6 +276,13 @@ > } > } > >+ /** >+ * Initialize from template. >+ * >+ * @param resource the resource >+ * @param rootElementName the root element name >+ * @param templatePath the template path >+ */ > protected void initializeFromTemplate(Resource resource, String rootElementName, String templatePath) { > Resource templateResource = loadTemplateResource(templatePath); > List<EObject> eObjectsToAdd = new ArrayList<EObject>(); >@@ -271,9 +294,21 @@ > } > } > >+ /** >+ * Initialize empty model. >+ * >+ * @param resource the resource >+ * @param rootElementName the root element name >+ */ > protected void initializeEmptyModel(Resource resource, String rootElementName) { > } > >+ /** >+ * Load template resource. >+ * >+ * @param templatePath the template path >+ * @return the resource >+ */ > private Resource loadTemplateResource(String templatePath) { > String templatePluginID = selectTemplateWizardPage.getTemplatePluginId(); > java.net.URL templateURL = Platform.getBundle(templatePluginID).getResource(templatePath);
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
sebastien.gerard
:
iplog+
Actions:
View
|
Diff
Attachments on
bug 313179
:
168758
|
169501
| 169796 |
169962
|
169963
|
170771