Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow nodes to be visible in multiple diagrams #1470

Closed
joswarmer opened this issue Aug 11, 2016 · 12 comments
Closed

Allow nodes to be visible in multiple diagrams #1470

joswarmer opened this issue Aug 11, 2016 · 12 comments
Assignees

Comments

@joswarmer
Copy link
Contributor

A node is often visible in multiple diagrams. E.g. when inherited nodes are shown somewhere in an extends hierarchy. Currently you cannot use the nodesQuery to get nodes into more than one diagram, as the nodesQuery used the same ID for one node to store diagram information.

The current workaround is to use a generix box query instead of a nodesQuery because the generic box query allows you to specify the ID yourself, so you can make a unique ID.

However, the generic box query is much more limited, and forces you to specify many details that are done more or less automatically in case of a nodesQuery. One specific example is e.g. that a generic box query forces you to specify one node type only for the result of the query. And then you have to specify properties like the shape, the editor, etc. explicitly. The nodesQuery allows you to just return a set of randon nodes and it will automatically find the editor and shape available.

For a nodesQuery that results in many different node types, I now have to filter the query by type, and use a generic box query for each of these types. This blows up the code of the editor a lot.

Therefore it should be allowed to have a node visible in multiple diagrams without having to use the generic box query.

@slisson
Copy link
Contributor

slisson commented Aug 11, 2016

The generic box query is not a workaround, it's the only possible way. This is because of limitations in MPS.

@slisson slisson closed this as completed Aug 11, 2016
@joswarmer
Copy link
Contributor Author

:-(

@slisson
Copy link
Contributor

slisson commented Aug 11, 2016

I can try to make it more extensible.

@slisson slisson reopened this Aug 11, 2016
@joswarmer
Copy link
Contributor Author

Alternatively, would is be possible to make the generic box query more flexible to solve some of the problems?

@slisson slisson mentioned this issue Aug 11, 2016
19 tasks
@joswarmer
Copy link
Contributor Author

Just thinking aloud: would it e.g. be possible to let the generic box query refer to the diagram box editor for the parameter node type? This could result in a lot less duplicated editor specification code, because all of the properties are defined in that editor as well.

@slisson
Copy link
Contributor

slisson commented Aug 11, 2016

I can try to invoke the cell factory for the concept directly, but I don't know how well that will work and what the side effects are.

@joswarmer
Copy link
Contributor Author

Can you allow a reference to the nodes diagram editor from the generic box query, and then copy that, such that it essentially becomes a short way to specify the same as we have today ?

@slisson
Copy link
Contributor

slisson commented Aug 11, 2016

This would require to reference all editors for all possible subconcepts and break extensibility.

@joswarmer
Copy link
Contributor Author

You are right that this isn't extensible. But, in the current generic box query we need to specify everything explicitly for the specified node type, which cannot be overridden by possible subconcepts. Doesn't this mean that this is non-extensible either? Or am I missing some extensibility option here?

@slisson
Copy link
Contributor

slisson commented Aug 11, 2016

Yes, both options would break extensibility. That's why I'm trying to find a solution that does not require generic queries.

@slisson
Copy link
Contributor

slisson commented Aug 12, 2016

Changes related to this issue:
d168540
82c2513

@joswarmer
Copy link
Contributor Author

Changing the layout only in the second diagram changes the actual model. In
move-box-pre
Composite A defines a model, with connections from 'str' to 'amplifier'. In Composite C I see 'amplifier' because it is inherited from 'composite A'. When I move any element in diagram C, or use the Fit Size of All Boxes' option, not only diagram C changes, but the connections in diagram A are deleted from the model:
move-box-post
I am using the untested "duplicates safe" option in the definition of the diagram.

slisson added a commit that referenced this issue Aug 29, 2016
The delete action now directly deletes the elements from the MPS model
and in the diagram they are removed on the next read sync.
This conforms more to the principle of a projectional editor.
In some cases elements where accidentally deleted from the model (most
of the time caused by an error in the editor definition). This change is
supposed to fix that, because elements can now only be removed by an
explicit user action.

See also #1470
@slisson slisson closed this as completed Aug 30, 2016
joswarmer pushed a commit that referenced this issue Sep 1, 2016
The delete action now directly deletes the elements from the MPS model
and in the diagram they are removed on the next read sync.
This conforms more to the principle of a projectional editor.
In some cases elements where accidentally deleted from the model (most
of the time caused by an error in the editor definition). This change is
supposed to fix that, because elements can now only be removed by an
explicit user action.

See also #1470
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants