本文整理汇总了Java中org.eclipse.graphiti.features.context.IUpdateContext类的典型用法代码示例。如果您正苦于以下问题:Java IUpdateContext类的具体用法?Java IUpdateContext怎么用?Java IUpdateContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IUpdateContext类属于org.eclipse.graphiti.features.context包,在下文中一共展示了IUpdateContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
@Override
public boolean update(IUpdateContext context) {
final PictogramElement pe = context.getPictogramElement();
if (PropertiesUtils.isExpectedPc(pe, Medium.class)) {
final Text text = (Text) PropertiesUtils.findPcFromIdentifier(pe, LABEL_ID);
if (text == null) {
return false;
}
final Medium medium = (Medium) getBusinessObjectForPictogramElement(pe);
if (!medium.getName().equals(text.getValue())) {
text.setValue(medium.getName());
// Do not force refinement update in case of simply renaming
return true;
}
return true;
}
return super.update(context);
}
示例2: update
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
@Override
public boolean update(IUpdateContext context) {
final PictogramElement pe = context.getPictogramElement();
if (PropertiesUtils.isExpectedPc(pe, type)) {
final Text text = (Text) PropertiesUtils.findPcFromIdentifier(pe, LABEL_ID);
if (text == null) {
return false;
}
final ProcessingUnit obj = (ProcessingUnit) getBusinessObjectForPictogramElement(pe);
if (!obj.getName().equals(text.getValue())) {
text.setValue(obj.getName());
// Do not force refinement update in case of simply renaming
return true;
}
return true;
}
return super.update(context);
}
示例3: update
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
@Override
public boolean update(IUpdateContext context) {
boolean result = false;
PictogramElement pe = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pe);
if ((pe instanceof ContainerShape) && (bo instanceof Director)) {
ContainerShape cs = (ContainerShape) pe;
Director director = (Director) bo;
for (Shape shape : cs.getChildren()) {
BoCategory boCategory = BoCategory.retrieveFrom(shape);
if (BoCategory.Director.equals(boCategory)) {
Text text = (Text) shape.getGraphicsAlgorithm();
text.setValue(director.getName());
result = true;
Graphiti.getPeService().setPropertyValue(shape, FeatureConstants.BO_NAME, director.getName());
}
}
}
return result;
}
示例4: updateNeeded
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
@Override
public IReason updateNeeded(IUpdateContext context) {
PictogramElement pictogramElement = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pictogramElement);
Port p = null;
if (bo instanceof Port && pictogramElement instanceof Anchor) {
p = (Port) bo;
Anchor anchor = (Anchor) pictogramElement;
PortCategory anchorCategory = PortCategory.retrieveFrom(anchor);
PortCategory portCategory = PortCategory.retrieveFrom(p);
boolean portDirectionChange = portCategory != anchorCategory;
// a bit more complex : check port colour and compare it to multiport property
GraphicsAlgorithm portGA = anchor.getGraphicsAlgorithm();
IColorConstant expectedPortBackgroundColor = p.isMultiPort() ? PORT_BACKGROUND_MULTIPORT : PORT_BACKGROUND_SINGLEPORT;
boolean portMultiPortChange = !portGA.getBackground().equals(manageColor(expectedPortBackgroundColor));
if (portDirectionChange || portMultiPortChange) {
context.putProperty(PORT_CHANGED, p.getName());
context.putProperty(PORT_CHANGED_IO, Boolean.toString(portDirectionChange));
context.putProperty(PORT_CHANGED_MULTI, Boolean.toString(portMultiPortChange));
return Reason.createTrueReason("Port change");
}
}
return Reason.createFalseReason();
}
示例5: update
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的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;
}
示例6: update
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
@Override
public boolean update(IUpdateContext context) {
boolean result = false;
PictogramElement pictogramElement = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pictogramElement);
if (bo instanceof Annotation && pictogramElement instanceof Shape) {
Annotation annotation = (Annotation) bo;
Shape shape = (Shape) pictogramElement;
BoCategory boCategory = BoCategory.retrieveFrom(shape);
if (BoCategory.Annotation.equals(boCategory)) {
MultiText text = EditorUtils.getGraphicsAlgorithmOfShape(shape, MultiText.class);
if (text != null) {
text.setValue(annotation.getText());
Color newColor = EditorUtils.buildColorFromString(getDiagram(), annotation.getColor());
text.setForeground(manageColor(newColor.getRed(), newColor.getGreen(), newColor.getBlue()));
text.setFont(Graphiti.getGaService().manageFont(getDiagram(), annotation.getFontFamily(), annotation.getTextSize(), annotation.isItalic(),
annotation.isBold()));
result = true;
} else {
// TODO report an error here?
}
}
}
return result;
}
示例7: getUpdateFeature
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
@Override
public IUpdateFeature getUpdateFeature(IUpdateContext context) {
PictogramElement pictogramElement = context.getPictogramElement();
Object bo = getBusinessObjectForPictogramElement(pictogramElement);
if (bo instanceof Parameter) {
return new ParameterUpdateFeature(this);
} else if (bo instanceof Port) {
return new PortUpdateFeature(this);
} else if (bo instanceof Annotation) {
return new AnnotationUpdateFeature(this);
} else if (bo instanceof Director) {
return new DirectorUpdateFeature(this);
} else if ((bo instanceof Actor) || (bo instanceof CompositeActor && !(pictogramElement instanceof Diagram))) {
return new ActorUpdateFeature(this);
}
return super.getUpdateFeature(context);
}
示例8: update
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
@Override
public boolean update(final IUpdateContext context) {
PictogramElement _pictogramElement = context.getPictogramElement();
final ContainerShape containerShape = ((ContainerShape) _pictogramElement);
String businessName = null;
final Object bo = this.getBusinessObjectForPictogramElement(containerShape);
if ((bo instanceof State)) {
String _name = ((State)bo).getName();
businessName = _name;
}
EList<Shape> _children = containerShape.getChildren();
final Function1<Shape, GraphicsAlgorithm> _function = new Function1<Shape, GraphicsAlgorithm>() {
@Override
public GraphicsAlgorithm apply(final Shape it) {
return it.getGraphicsAlgorithm();
}
};
List<GraphicsAlgorithm> _map = ListExtensions.<Shape, GraphicsAlgorithm>map(_children, _function);
Iterable<Text> _filter = Iterables.<Text>filter(_map, Text.class);
Text _head = IterableExtensions.<Text>head(_filter);
if (_head!=null) {
_head.setValue(businessName);
}
return false;
}
示例9: getUpdateFeature
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
@Override
public IUpdateFeature getUpdateFeature(final IUpdateContext context) {
IUpdateFeature _xblockexpression = null;
{
final PictogramElement pictogramElement = context.getPictogramElement();
boolean _and = false;
if (!(pictogramElement instanceof ContainerShape)) {
_and = false;
} else {
Object _businessObjectForPictogramElement = this.getBusinessObjectForPictogramElement(pictogramElement);
_and = (_businessObjectForPictogramElement instanceof State);
}
if (_and) {
return new UpdateStateFeature(this);
}
_xblockexpression = super.getUpdateFeature(context);
}
return _xblockexpression;
}
示例10: updateNeeded
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
public IReason updateNeeded(IUpdateContext context) {
final PictogramElement pictogramElement = context.getPictogramElement();
final Object bo = getBusinessObjectForPictogramElement(pictogramElement);
this.syncObjects = new SyncObjects(context);
//TODO: reinstate this block, but only for updateable connectors to automatically update if needed so the user is not required to do this manually
// possibly, #update() should be expanded to detect duplicate updates if the user still forces it and updating is no longer required. This depends on the lifecycle of this
//instance and would entail creating a force override of the #isOutOfSync() method's result to reflect having been manually updated.
// if (bo instanceof SequenceFlow && isOutOfSync(context)) {
// // manually force an update
// // FIXME: need transaction that's writable
// TransactionalEditingDomain editingDomain = getDiagramEditor().getEditingDomain();
// CommandExec.getSingleton().executeFeatureWithContext(this, context);
// }
//FIXME: this is far from perfect, but limits red dashed connectors to updateable connectors only
if (isOutOfSync(context)) {
return Reason.createTrueReason("This sequence flow requires updating because the source and \ndestination nodes have changed since the diagram was last saved. \n\nUse right-click > Update to update the sequence flow");
}
return Reason.createFalseReason();
}
示例11: updateNeeded
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
public IReason updateNeeded(IUpdateContext context) {
if (updateNeededCloudEnvironments(context))
{
return Reason.createTrueReason("CloudEnvironments out of sync.");
}
if (updateNeededProxies(context))
{
return Reason.createTrueReason("Proxies out of sync.");
}
if (updateNeededConnections(context))
{
return Reason.createTrueReason("Connections out of sync.");
}
return Reason.createFalseReason();
}
示例12: updateNeededCloudEnvironments
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
private boolean updateNeededCloudEnvironments (IUpdateContext context)
{
List<CloudEnvironment> cloudEnvironments = getCloudEnvironments(context);
Map<CloudEnvironment, Shape> ceMap = getCloudEnvironmentsDiagram(context);
Set<CloudEnvironment> cloudEnvironmentsDiagram = ceMap.keySet();
// Easy check
if (cloudEnvironments.size() != cloudEnvironmentsDiagram.size())
return true;
cloudEnvironments.removeAll(cloudEnvironmentsDiagram);
if (!cloudEnvironments.isEmpty())
return true;
return false;
}
示例13: updateNeededProxies
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
private boolean updateNeededProxies (IUpdateContext context)
{
List<Proxy> proxies = getProxies(context);
Map<Proxy, Shape> proxyMap = getProxiesDiagram(context);
Set<Proxy> proxiesDiagram = proxyMap.keySet();
// Easy check
if (proxies.size() != proxiesDiagram.size())
return true;
proxies.removeAll(proxiesDiagram);
if (!proxies.isEmpty())
return true;
return false;
}
示例14: updateNeededConnections
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
private boolean updateNeededConnections (IUpdateContext context)
{
List<Connection> connections = getConnections(context);
Map<Connection, org.eclipse.graphiti.mm.pictograms.Connection> connectionsMap = getConnectionsDiagram(context);
Set<Connection> connectionsDiagram = connectionsMap.keySet();
// Easy check
if (connections.size() != connectionsDiagram.size())
return true;
connections.removeAll(connectionsDiagram);
if (!connections.isEmpty())
return true;
return false;
}
示例15: addCloudEnvironment
import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
private void addCloudEnvironment (IUpdateContext context, CloudEnvironment ce)
{
AddContext ac = new AddContext();
ac.setLocation(30, 30);
ac.setSize(100, 100);
ac.setNewObject(ce);
ac.setTargetContainer(getDiagram());
IAddFeature addFeature = getFeatureProvider().getAddFeature(ac);
if (addFeature.canExecute(ac))
addFeature.execute(ac);
PictogramElement pe = Graphiti.getLinkService().getPictogramElements(getDiagram(), ce).get(0);
// Force update - if not user needs to click on update action to trigger update
// If not updates, service pictograms does not exist and connections cannot be made
UpdateContext uc = new UpdateContext(pe);
IUpdateFeature updateFeature = getFeatureProvider().getUpdateFeature(uc);
if (updateFeature.canExecute(uc))
updateFeature.execute(uc);
}