• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java IUpdateContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.eclipse.graphiti.features.context.IUpdateContext的典型用法代码示例。如果您正苦于以下问题:Java IUpdateContext类的具体用法?Java IUpdateContext怎么用?Java IUpdateContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IUpdateContext类属于org.eclipse.graphiti.features.context包,在下文中一共展示了IUpdateContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
}
 
开发者ID:turnus,项目名称:turnus,代码行数:23,代码来源:MediumPattern.java


示例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);
}
 
开发者ID:turnus,项目名称:turnus,代码行数:23,代码来源:AbstractProcessingUnitPattern.java


示例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;
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:22,代码来源:DirectorUpdateFeature.java


示例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();
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:27,代码来源:PortUpdateFeature.java


示例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;
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:25,代码来源:PortUpdateFeature.java


示例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;
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:26,代码来源:AnnotationUpdateFeature.java


示例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);
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:18,代码来源:TriqFeatureProvider.java


示例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;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:26,代码来源:UpdateStateFeature.java


示例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;
}
 
开发者ID:spoenemann,项目名称:xtext-gef,代码行数:20,代码来源:StatemachineFeatureProvider.java


示例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();
	}
 
开发者ID:logicalhacking,项目名称:SecureBPMN,代码行数:24,代码来源:UpdateConnectionFlowElementFeature.java


示例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();
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:19,代码来源:UpdateDiagramFeature.java


示例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;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:17,代码来源:UpdateDiagramFeature.java


示例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;
	
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:18,代码来源:UpdateDiagramFeature.java


示例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;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:17,代码来源:UpdateDiagramFeature.java


示例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);
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:22,代码来源:UpdateDiagramFeature.java


示例16: getProxiesDiagram

import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
public Map<Proxy, Shape> getProxiesDiagram (IUpdateContext context)
{
	HashMap<Proxy, Shape> mapProxies = new HashMap<Proxy, Shape>();
	ContainerShape cs = (ContainerShape)context.getPictogramElement();

	for (Shape shape : cs.getChildren())
	{
		if (shape.getLink() != null)
		{
			if (!shape.getLink().getBusinessObjects().isEmpty());
			{
				EObject eObject = shape.getLink().getBusinessObjects().get(0);
				if (eObject instanceof Proxy)
				{
					mapProxies.put((Proxy) eObject, shape);
				}
			}
		}
	}
	
	return mapProxies;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:23,代码来源:UpdateDiagramFeature.java


示例17: getCloudEnvironmentsDiagram

import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
public Map<CloudEnvironment, Shape> getCloudEnvironmentsDiagram (IUpdateContext context)
{
	ContainerShape cs = (ContainerShape) context.getPictogramElement();
	HashMap<CloudEnvironment, Shape> mapEnvironments = new HashMap<CloudEnvironment, Shape>();

	for (Shape shape : cs.getChildren())
	{
		if (shape.getLink() != null)
		{
			if (!shape.getLink().getBusinessObjects().isEmpty());
			{
				EObject eObject = shape.getLink().getBusinessObjects().get(0);
				if (eObject instanceof CloudEnvironment)
				{
					mapEnvironments.put((CloudEnvironment) eObject, shape);
				}
			}
		}
		
	}
	
	return mapEnvironments;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:24,代码来源:UpdateDiagramFeature.java


示例18: getConnectionsDiagram

import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
public Map<Connection, org.eclipse.graphiti.mm.pictograms.Connection> getConnectionsDiagram (IUpdateContext context)
{
	HashMap<Connection,org.eclipse.graphiti.mm.pictograms.Connection> mapConnections = new HashMap<Connection, org.eclipse.graphiti.mm.pictograms.Connection>();

	for (org.eclipse.graphiti.mm.pictograms.Connection connectionDiagram : getDiagram().getConnections())
	{
			if (connectionDiagram.getLink() != null)
			{
				if (!connectionDiagram.getLink().getBusinessObjects().isEmpty())
				{
					EObject o = connectionDiagram.getLink().getBusinessObjects().get(0);
					if (o instanceof Connection)
						mapConnections.put((Connection) o, connectionDiagram);
				}
			}
		
	}
	return mapConnections;
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:20,代码来源:UpdateDiagramFeature.java


示例19: removeUnlinkedElements

import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
@SuppressWarnings("unused")
private void removeUnlinkedElements (IUpdateContext context)
{
	for (org.eclipse.graphiti.mm.pictograms.Connection connectionDiagram : getDiagram().getConnections())
	{
			if (connectionDiagram.getLink() == null ||
				connectionDiagram.getLink().getBusinessObjects().isEmpty() //||
				)
			{
				if (!connectionDiagram.getLink().getBusinessObjects().isEmpty())
				{
					EObject o = connectionDiagram.getLink().getBusinessObjects().get(0);
				}
			}
		
	}
	
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:19,代码来源:UpdateDiagramFeature.java


示例20: updateServices

import org.eclipse.graphiti.features.context.IUpdateContext; //导入依赖的package包/类
private void updateServices (IUpdateContext context)
{
	// Remove deleted platform services
	Map<Service, Shape> psMap = getServiceContainers(context);

	List<Service> services = getServices(context);
	Set<Service> servicesDiagram = psMap.keySet();
	
	for (Service ps : servicesDiagram)
	{
		if (!services.contains(ps))
		{
			// delete pictogram
		}
	}
	
	for (Service s : services)
	{
		if (!servicesDiagram.contains(s))
		{
			addService(context, s);
		}
	}
}
 
开发者ID:CloudScale-Project,项目名称:Environment,代码行数:25,代码来源:UpdateEnvironmentFeature.java



注:本文中的org.eclipse.graphiti.features.context.IUpdateContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java StepSequence类代码示例发布时间:2022-05-22
下一篇:
Java Check类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap