本文整理汇总了Java中org.eclipse.graphiti.mm.pictograms.Anchor.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java Anchor.getParent方法的具体用法?Java Anchor.getParent怎么用?Java Anchor.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.graphiti.mm.pictograms.Anchor
的用法示例。
在下文中一共展示了Anchor.getParent方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: deepContains
import org.eclipse.graphiti.mm.pictograms.Anchor; //导入方法依赖的package包/类
private static boolean deepContains(ContainerShape cs, Anchor a) {
boolean result = cs.getAnchors().contains(a);
if(!result) {
AnchorContainer aContainer = a.getParent();
while (!result) {
if(aContainer==null) {
break;
}
result = cs.getChildren().contains(aContainer);
if(!result && (aContainer instanceof Shape)) {
aContainer = ((Shape)aContainer).getContainer();
}
}
}
return result;
}
示例2: update
import org.eclipse.graphiti.mm.pictograms.Anchor; //导入方法依赖的package包/类
@Override
public boolean update(IUpdateContext context) {
boolean result = false;
PictogramElement pictogramElement = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pictogramElement);
if (bo instanceof Port && pictogramElement instanceof Anchor) {
Port p = (Port) bo;
Anchor anchor = (Anchor) pictogramElement;
GraphicsAlgorithm portGA = anchor.getGraphicsAlgorithm();
boolean portInputOutputChange = Boolean.valueOf((String)context.getProperty(PORT_CHANGED_IO));
if (portInputOutputChange) {
// TODO reposition port on the correct side of the actor
// this also impacts positioning of the other ports, so we'd better do this as an ActorUpdate...
PictogramElement actorPE = anchor.getParent();
getFeatureProvider().updateIfPossibleAndNeeded(new UpdateContext(actorPE));
}
boolean portMultiPortChange = Boolean.valueOf((String)context.getProperty(PORT_CHANGED_MULTI));
if (portMultiPortChange) {
IColorConstant portColour = p.isMultiPort() ? PORT_BACKGROUND_MULTIPORT : PORT_BACKGROUND_SINGLEPORT;
portGA.setBackground(manageColor(portColour));
}
}
return result;
}
示例3: create
import org.eclipse.graphiti.mm.pictograms.Anchor; //导入方法依赖的package包/类
@Override
public Connection create(final ICreateConnectionContext context) {
Anchor _sourceAnchor = context.getSourceAnchor();
AnchorContainer _parent = _sourceAnchor.getParent();
Object _businessObjectForPictogramElement = this.getBusinessObjectForPictogramElement(_parent);
final State source = ((State) _businessObjectForPictogramElement);
Anchor _targetAnchor = context.getTargetAnchor();
AnchorContainer _parent_1 = _targetAnchor.getParent();
Object _businessObjectForPictogramElement_1 = this.getBusinessObjectForPictogramElement(_parent_1);
final State target = ((State) _businessObjectForPictogramElement_1);
final Transition transition = StatemachineFactory.eINSTANCE.createTransition();
transition.setSourceState(source);
transition.setTargetState(target);
EObject _eContainer = source.eContainer();
final Statemachine statemachine = ((Statemachine) _eContainer);
EList<Transition> _transitions = statemachine.getTransitions();
_transitions.add(transition);
Anchor _sourceAnchor_1 = context.getSourceAnchor();
Anchor _targetAnchor_1 = context.getTargetAnchor();
final AddConnectionContext addContext = new AddConnectionContext(_sourceAnchor_1, _targetAnchor_1);
addContext.setNewObject(transition);
IFeatureProvider _featureProvider = this.getFeatureProvider();
PictogramElement _addIfPossible = _featureProvider.addIfPossible(addContext);
return ((Connection) _addIfPossible);
}
示例4: canCreate
import org.eclipse.graphiti.mm.pictograms.Anchor; //导入方法依赖的package包/类
@Override
public boolean canCreate(final ICreateConnectionContext context) {
boolean _and = false;
Anchor _sourceAnchor = context.getSourceAnchor();
AnchorContainer _parent = null;
if (_sourceAnchor!=null) {
_parent=_sourceAnchor.getParent();
}
Object _businessObjectForPictogramElement = null;
if (_parent!=null) {
_businessObjectForPictogramElement=this.getBusinessObjectForPictogramElement(_parent);
}
if (!(_businessObjectForPictogramElement instanceof State)) {
_and = false;
} else {
Anchor _targetAnchor = context.getTargetAnchor();
AnchorContainer _parent_1 = null;
if (_targetAnchor!=null) {
_parent_1=_targetAnchor.getParent();
}
Object _businessObjectForPictogramElement_1 = null;
if (_parent_1!=null) {
_businessObjectForPictogramElement_1=this.getBusinessObjectForPictogramElement(_parent_1);
}
_and = (_businessObjectForPictogramElement_1 instanceof State);
}
return _and;
}
示例5: canStartConnection
import org.eclipse.graphiti.mm.pictograms.Anchor; //导入方法依赖的package包/类
@Override
public boolean canStartConnection(final ICreateConnectionContext context) {
Anchor _sourceAnchor = context.getSourceAnchor();
AnchorContainer _parent = null;
if (_sourceAnchor!=null) {
_parent=_sourceAnchor.getParent();
}
Object _businessObjectForPictogramElement = null;
if (_parent!=null) {
_businessObjectForPictogramElement=this.getBusinessObjectForPictogramElement(_parent);
}
return (_businessObjectForPictogramElement instanceof State);
}