[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Newsgroup Home]
[news.eclipse.modeling.gmf] Re: Adjust New Diagram Wizard

Hi Peter,

Thank you for your solution. This is exactly what I was looking for.

Peter Lang wrote:
Hi Peter,

I did almost the some, only the other way round (define model file, diagram is created automatically).

You should be able to adapt my solution (I tried to change as little as possible, so I use both pages but only display one).

You need to edit your generated part/XxxCreationWizard.java
Unfortunately there is no constant for the file-extensions, so I had to hardcode them.



/**
* @generated NOT
* do not use diagramModelFilePage since we use the same filename for model and diagram (different file extension)
*/
public void addPages() {
domainModelFilePage = new WorkflowCreationWizardPage(
"DomainModelFile", getSelection(), "xxx"); //$NON-NLS-1$ //$NON-NLS-2$
domainModelFilePage
.setTitle(Messages.WorkflowCreationWizard_DomainModelFilePageTitle);
domainModelFilePage
.setDescription(Messages.WorkflowCreationWizard_DomainModelFilePageDescription);


   addPage(domainModelFilePage);
}

/**
* @generated NOT
*/
public boolean performFinish() {
   IRunnableWithProgress op = new WorkspaceModifyOperation(null) {

protected void execute(IProgressMonitor monitor)
throws CoreException, InterruptedException {
// CUSTOM: do not use diagramModelFilePage since we use the
// same filename for model and diagram (different file extension)
URI domainModelFilePageURI = domainModelFilePage.getURI();
URI diagramModelFilePageURI = domainModelFilePageURI
.trimFileExtension().appendFileExtension("xxx_diagram");
diagram = WorkflowDiagramEditorUtil.createDiagram(
diagramModelFilePageURI, domainModelFilePageURI, monitor);
// end CUSTOM
if (isOpenNewlyCreatedDiagramEditor() && diagram != null) {
[...]