Package org.eclipse.rmf.reqif10

Examples of org.eclipse.rmf.reqif10.SpecRelationType


   * The external element (to be traced from/to) must be persisted.  For simplicity, we use
   * a ReqIF model.
   */
  private EObject buildTestExternal() throws IOException {
    ReqIF reqif  = ReqIF10Factory.eINSTANCE.createReqIF();
    ReqIFHeader header= ReqIF10Factory.eINSTANCE.createReqIFHeader();
    header.setTitle("HeaderTitle");
    reqif.setTheHeader(header);
    external = header;
   
    File file = File.createTempFile("tracing-test-", ".reqif");
    file.deleteOnExit();
View Full Code Here


   */
  @Test
  public void testFindProxyElementSucceeds() {
    CreateTraceCommand cmd = createCommand();
    editingDomain.getCommandStack().execute(cmd);
    SpecObject proxy = cmd.findProxyFor(external);
    assertNotNull(proxy);
   
    // Ensure that the URLs match
    String expectedUri = EcoreUtil.getURI(external).toString();
    String value = ((AttributeValueString)proxy.getValues().get(0)).getTheValue();
    StringTokenizer st = new StringTokenizer(value, "\n");
    String actualUri = st.nextToken();
    assertEquals(expectedUri, actualUri);
  }
View Full Code Here

 
  @Test
  public void testUpdateProxyIfNecessaryNoUpdate() throws Exception {
    CreateTraceCommand cmd = createCommand();
    editingDomain.getCommandStack().execute(cmd);
    SpecObject proxy = cmd.findProxyFor(external);
    TracingConfigurationItemProvider ip = (TracingConfigurationItemProvider) ProrUtil
        .getItemProvider(adapterFactory, config);

   
    AttributeValueString value = ((AttributeValueString)proxy.getValues().get(0));
    ip.updateProxyIfNecessary(value, external, editingDomain);
    // No Cmd should be triggered from this
    assertEquals(cmd, editingDomain.getCommandStack().getMostRecentCommand());
  }
View Full Code Here

 
  @Test
  public void testUpdateProxyIfNecessaryValueChanged() throws Exception {
    CreateTraceCommand cmd = createCommand();
    editingDomain.getCommandStack().execute(cmd);
    SpecObject proxy = cmd.findProxyFor(external);
   
    TracingConfigurationItemProvider ip = (TracingConfigurationItemProvider) ProrUtil
        .getItemProvider(adapterFactory, config);
    AttributeValueString value = ((AttributeValueString)proxy.getValues().get(0));
    value.setTheValue(value.getTheValue() + "x");
    ip.updateProxyIfNecessary(value, external, editingDomain);
   
    // Ensure the values match
    assertEquals(value.getTheValue(), ip.buildProxyContent(external));
View Full Code Here

  @Test
  public void testUpdateProxyIfNecessaryExternalChanged() throws Exception {
    CreateTraceCommand cmd = createCommand();
    editingDomain.getCommandStack().execute(cmd);
    SpecObject proxy = cmd.findProxyFor(external);
   
    TracingConfigurationItemProvider ip = (TracingConfigurationItemProvider) ProrUtil
        .getItemProvider(adapterFactory, config);
    ((ReqIFHeader)external).setComment("A comment");
    AttributeValueString value = (AttributeValueString) proxy.getValues().get(0);
    ip.updateProxyIfNecessary(value, external, editingDomain);
   
    // Ensure the values match
    assertEquals(value.getTheValue(), ip.buildProxyContent(external));
  }
View Full Code Here

   * Adds to the provided compound command to create a link from a proxy for
   * element to the drop target. If a proxy already exists, it is reused. If a
   * link of the correct type already exists, it is reused as well.
   */
  void createCreateLinkCommand(CompoundCommand cmd, EObject element) {
    SpecObject proxy = getProxy(element, cmd);
    SpecRelation specRelation = getLink(proxy, cmd);
    TracingUtil.notifyProxyListeners(target, specRelation, element);
  }
View Full Code Here

  /**
   * Returns the proxy for the given element.  If the proxy does not exist yet,
   * it is created, thereby appending to cmd.
   */
  private SpecObject getProxy(EObject element, CompoundCommand cmd) {
    SpecObject proxy = findProxyFor(element);
    if (proxy == null)
      proxy = createProxy(cmd, element);
    return proxy;
  }
View Full Code Here

   * Attempts to find a SpecRelation that: (1) connects proxy and
   * target in the right direction; and (2) has the correct type.
   */
  private SpecRelation findLinkFor(SpecObject proxy) {
    TracingConfiguration config = getTracingConfig();
    SpecObject linkSource = config.isLinkFromTarget() ? target : proxy;
    SpecObject linkTarget = config.isLinkFromTarget() ? proxy : target;
    SpecRelationType type = config.getLinkType();
   
    for (SpecRelation relation : ReqIF10Util.getReqIF(config)
        .getCoreContent().getSpecRelations()) {
      //  It's okay to compare null and references.
View Full Code Here

    }
    return null;
  }

  private SpecObject createProxy(CompoundCommand cmd, EObject element) {
    SpecObject proxy;
    proxy = ReqIF10Factory.eINSTANCE.createSpecObject();
    TracingConfiguration config = getTracingConfig();
    AttributeValueString value = ReqIF10Factory.eINSTANCE.createAttributeValueString();
    value.setDefinition(config.getProxyAttribute());
    value.setTheValue(itemProvider.buildProxyContent(element));
    proxy.getValues().add(value);
    cmd.append(ProrUtil.createAddTypedElementCommand(
        ReqIF10Util.getReqIF(config).getCoreContent(),
        ReqIF10Package.Literals.REQ_IF_CONTENT__SPEC_OBJECTS,
        proxy, ReqIF10Package.Literals.SPEC_OBJECT__TYPE,
        config.getProxyType(), 0, 0, domain, itemProvider.getAdapterFactory()));
View Full Code Here

   */
  public Command handleDragAndDrop(Collection<?> source, Object target,
      EditingDomain editingDomain, int operation) {

    // Only support SpecHierarchies and SpecObjects as targets.
    SpecObject targetSpecObject = null;
    if (target instanceof SpecObject) {
      targetSpecObject = (SpecObject) target;
    } else if (target instanceof SpecHierarchy) {
      targetSpecObject = ((SpecHierarchy) target).getObject();
    }
View Full Code Here

TOP

Related Classes of org.eclipse.rmf.reqif10.SpecRelationType

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.