Question about disallowing certain changes based on gmfmap file [message #93200] |
Tue, 16 January 2007 07:26  |
Eclipse User |
|
|
|
Originally posted by: awm_abu.yahoo.com
Hello all,
I am creating a diagram which has a grid like layout
I have a number of containers which are layed out in this grid format
Each container can contain one block
Blocks come in many different guises but all have a type, either input,
logic or output.
Input blocks can only go in containers in row 1
Output blocks can only go in containers in the last row
Logic blocks can only go in containers in the rows in between
The containers are layed out to reflect this.
In my gmfmap file the logicblockcontainer has a child reference of
logicblock
In my LogicBlockContainerItemSemanticEditPolicy the getCreateCommand method
has a check like the one shown at the end of this message. This is generated
for me to disallow the creation of blocks in the wrong place.
This works fine. However I am allowed to drag and drop a logicblock to an
Input or Output container.
And also strangely it won't allow me to drop to a different
logicblockcontainer.
The getMoveCommand method on my BaseItemSemanticEditPolicy could be
overriden to check
that the editpart being moved matched with the correct targetcontainer
(found in the move request).
However as I am not allowed move a logicblock to a different
logiclblockcontainer I still have a problem.
I will in effect not be able to move the block at all.
When I try to drop in another logicblockcontainer I get the not allowed icon
(circle with line through it)
(This is also the case for the other containers and blocks - so at least its
consistent)
Anybody any idea where I could look for the code that is stopping me moving
a logicblock from
one logiccontainer to another because I can't find it ?
Any help greatly appreciated.
Thanks.
protected Command getCreateCommand(CreateElementRequest req)
{
if (PasmultiElementTypes.LogicBlock_2001 == req.getElementType())
{
LogicBlockContainer container = (LogicBlockContainer) (req.getContainer()
instanceof View ? ((View) req
..getContainer()).getElement()
: req.getContainer());
if (container.getBlock() != null)
{
return super.getCreateCommand(req);
}
if (req.getContainmentFeature() == null)
{
req.setContainmentFeature(PasmultiPackage.eINSTANCE.getConta iner_Block());
}
return getMSLWrapper(new CreateLogicBlock_2001Command(req));
}
return super.getCreateCommand(req);
}
|
|
|
|
Powered by
FUDForum. Page generated in 0.02590 seconds