| Restrain features in the Diagram View Example [message #1097269] |
Thu, 29 August 2013 09:20  |
|
Hi there,
I'm looking at the Diagram View Example and I wonder if it may be
possible to divide up features that may be executed in the diagram
opened in the editor from features that may only be executed in the
diagram opened in a view.
Is it possible ?
Yours,
--
Nicolas H
|
|
|
| Re: Restrain features in the Diagram View Example [message #1097389 is a reply to message #1097269] |
Thu, 29 August 2013 12:45   |
|
Hi again,
Le 29/08/13 15:25, Nicolas H a écrit :> Hi there,
>
> I'm looking at the Diagram View Example and I wonder if it may be
> possible to divide up features that may be executed in the diagram
> opened in the editor from features that may only be executed in the
> diagram opened in a view.
>
> Is it possible ?
>
> Yours,
>
I found a way to do that.
In my class extending AbstractDiagramTypeProvider, I override the init
method like this :
@Override
public void init(Diagram diagram, IDiagramBehavior diagramBehavior) {
super.init(diagram, diagramBehavior);
if (this.getDiagramBehavior().getDiagramContainer() instanceof
DiagramComposite) { // Inside a View
setFeatureProvider(new MyRestrainedFeatureProvider(this));
}
else { // Inside the editor
setFeatureProvider(new MyFeatureProvider(this));
}
}
MyRestrainedFeatureProvider extends MyFeatureProvider and disables some
features.
Do you think it's a good solution ?
Yours,
--
Nicolas H
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01691 seconds