当前位置: 首页>>代码示例>>Java>>正文


Java IUpdateContext类代码示例

本文整理汇总了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);
}
 
开发者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


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