Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Adjust New Diagram Wizard
Adjust New Diagram Wizard [message #485063] Thu, 10 September 2009 12:33 Go to next message
Peter Thijs is currently offline Peter ThijsFriend
Messages: 17
Registered: July 2009
Junior Member
Hello,

I would like to adjust the New Diagram Wizard in my RCP Application, but
I don't know how to do that.

On this moment the New Diagram Wizard consists out of 2 screens, one for
defining the diagram model file and one for the domain model file.

For my application I would like to change this wizard into 1 screen
where you only define the diagram model file. Then the application
should create a domain model file with the same name on the same location.

How can I achieve this behavior?

Regards,

Peter Thijs
Re: Adjust New Diagram Wizard [message #485148 is a reply to message #485063] Thu, 10 September 2009 15:42 Go to previous messageGo to next message
Peter Lang is currently offline Peter LangFriend
Messages: 153
Registered: July 2009
Senior Member
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) {
[...]

Re: Adjust New Diagram Wizard [message #485824 is a reply to message #485148] Tue, 15 September 2009 08:28 Go to previous message
Peter Thijs is currently offline Peter ThijsFriend
Messages: 17
Registered: July 2009
Junior Member
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_DomainModelFilePag eTitle);
> domainModelFilePage
>
> .setDescription(Messages.WorkflowCreationWizard_DomainModelF ilePageDescription);
>
> 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) {
> [...]
>
>
Previous Topic:Length of a ConnectionNodeEditPart
Next Topic:To highlight an element on editor
Goto Forum:
  


Current Time: Sat Apr 27 04:48:47 GMT 2024

Powered by FUDForum. Page generated in 0.03563 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top