Examples of EmbeddedLink


Examples of org.emftrace.ui.controls.EmbeddedLink

      nameComposite.setLayout( new RowLayout(SWT.HORIZONTAL));
      Label nameLabel = new Label(nameComposite, SWT.NONE);
      nameLabel.setText("name:");  
      nameLabel.setLayoutData( new RowData(labelWidth, labelHeight));
      for (Element element : elementsToCompare){
        EmbeddedLink link = new EmbeddedLink(nameComposite, SWT.NONE, false);
        String attributeValue = accessLayer.getAttributeValue(element, "name");
        link.setText(attributeValue!=null? attributeValue : "");
        link.setLayoutData( new RowData(linkWidth, linkHeight));
        link.setTarget(element);
      }

     
      //attributes
      for (EAttribute eAttribute : attributesToCompare ){
View Full Code Here

Examples of org.emftrace.ui.controls.EmbeddedLink

    Composite composite = new Composite(baseComposite, SWT.NONE);
    composite.setLayout(new RowLayout(SWT.HORIZONTAL));
    composite.setBackground(Display.getDefault().getSystemColor(
        SWT.COLOR_WIDGET_LIGHT_SHADOW));
    composite.setLayoutData(new RowData(690, 30));
    final EmbeddedLink link = new EmbeddedLink(composite, SWT.NONE, false);
    // add link
    link.setTarget(property);
    if (property.getName() != null)
      link.setText(property.getName());
    else
      link.setText("");

    link.setLayoutData(new RowData(650, 25));

    property.addModelElementChangeListener(new ModelElementChangeListener() {

      @Override
      public void onChange(final Notification notification) {
        if (notification.getEventType() == Notification.SET)
          if (notification.getFeature().getClass().getName() == "name") {
            Display.getDefault().asyncExec(new Runnable() {

              @Override
              public void run() {
                link.setText(notification.getNewStringValue());
              }
            });
          } else if (notification.getFeature().getClass().getName() == "description") {
            Display.getDefault().asyncExec(new Runnable() {

              @Override
              public void run() {
                link.setTargetDescription(notification
                    .getNewStringValue());
              }
            });
          }
View Full Code Here

Examples of org.emftrace.ui.controls.EmbeddedLink

    gridData.grabExcessHorizontalSpace = true;
    gridData.verticalAlignment = SWT.FILL;
    gridData.grabExcessVerticalSpace = true;
    resultItemViewText.setLayoutData(gridData);

    openLink = new EmbeddedLink(filteredLinksComposite, SWT.NONE);
    openLink.setText("open...");
    gridData = new GridData();
    gridData.horizontalSpan = 5;
    gridData.horizontalAlignment = SWT.FILL;
    openLink.setLayoutData(gridData);
View Full Code Here

Examples of org.emftrace.ui.controls.EmbeddedLink

   * @param newCharCount
   *            the count of new chars
   */
  private int calculateNewOffsetUpdate(int offset, int start,
      int replaceCharCount, int newCharCount) {
    EmbeddedLink link = offsetLinkMap.get(offset);
    if (debug == true)
      System.out.println("Updating offset for link: " + link.getText());
    if (debug == true)
      System.out.println("old offset: " + offset);

    int oldTextLength = getText().length();
    if (debug == true)
View Full Code Here

Examples of org.emftrace.ui.controls.EmbeddedLink

      if (termContent.length() > 0) {
        Term term = EMFfitModelFactory.eINSTANCE.createTerm();
        term.setVisibleContent(termContent);
        newHypertext.getContent().add(term);
      }
      EmbeddedLink embededLink = offsetLinkMap.get(pos);
      Link link = EMFfitModelFactory.eINSTANCE.createLink();
      link.setVisibleContent(embededLink.getText());
      link.setTarget(embededLink.getTarget());
      newHypertext.getContent().add(link);
      startPos = pos + 1;
      pos = text.indexOf("\uFFFC", startPos);
    }
    // create terms for rest
View Full Code Here

Examples of org.emftrace.ui.controls.EmbeddedLink

        StyleRange style = event.style;
        int start = style.start;
        for (Integer offset : offsets) {
          if (start == offset) {
            try {
              EmbeddedLink link = offsetLinkMap.get(offset);
              Point pt = link.getSize();
              int x = event.x + MARGIN;
              int y = event.y - 2 + event.ascent - 2 * pt.y / 3;

              link.setLocation(x, y);
            } catch (Exception e) {
              // catch link is disposed
            }
            break;
          }
View Full Code Here

Examples of org.emftrace.ui.controls.EmbeddedLink

   */
  private void doUnlinkWord(int offset) throws Exception {
    if (!offsetLinkMap.containsKey(offset))
      throw new Exception("offset contains no link!");

    EmbeddedLink linkToRemove = offsetLinkMap.get(offset);
    int oldCaretOffset = this.getCaretOffset();

    unlinkWordAtModel(this.hypertext, offset, linkToRemove.getText());

    String linkCaption = linkToRemove.getText();
    int linkCaptionLength = linkCaption.length();

    removeOffset(offset);

    String textBeforeLink = getText().substring(0, offset);

    String textBehindLink = getText().substring(offset + 1,
        getText().length());

    setText(textBeforeLink + linkCaption + textBehindLink);
    updateOffsets(offset, linkCaptionLength - 1);
    drawLinks();

    linkToRemove.dispose();

    this.setCaretOffset(Math.max(oldCaretOffset, getText().length() - 1));
  }
View Full Code Here

Examples of org.emftrace.ui.controls.EmbeddedLink

          + length + " text=" + linkText);
    try {
      beforeUpdate();
      updateHypertext();
      linkWordAtModel(this.hypertext, offset, length, linkText, target);
      EmbeddedLink newEmbeddedLink = new EmbeddedLink(this, SWT.None);

      String textBeforeLink = getText().substring(0, offset);
      String textBehindLink = getText().substring(offset + length,
          getText().length());
      setText("");
      setText(textBeforeLink + "\uFFFC" + textBehindLink);

      if (debug == true)
        System.out.println("linkWord: textBeforeLink=" + textBeforeLink
            + " textBehindLink=" + textBehindLink);

      if (debug == true)
        System.out.println("offsets=" + offsets);
      if (debug == true)
        System.out.println("offsetLinkMap=" + offsetLinkMap);
      updateOffsets(offset, 1 - length);
      if (debug == true)
        System.out.println("offsets=" + offsets);
      if (debug == true)
        System.out.println("offsetLinkMap=" + offsetLinkMap);

      offsets.add(offset);
      offsetLinkMap.put(offset, newEmbeddedLink);

      newEmbeddedLink.setText(linkText);
      newEmbeddedLink.setTarget(target);

      drawLinks();
      afterUpdate();
    } catch (Exception e) {
      afterUpdate();
View Full Code Here

Examples of org.emftrace.ui.controls.EmbeddedLink

   *
   * @param offset
   *            of the link
   */
  private void removeLinkAt(int offset) {
    final EmbeddedLink linkToRemove = offsetLinkMap.get(offset);
    removeOffset(offset);
    offsetLinkMap.remove(offset);

    Display.getDefault().syncExec(new Runnable() {

      @Override
      public void run() {
        linkToRemove.dispose();

      }
    });

    deleteTextElementFromModel(hypertext, offset);
View Full Code Here

Examples of org.emftrace.ui.controls.EmbeddedLink

   *            the new text for the link
   */
  public void renameLink(int offset, String newCaption) {
    try {
      beforeUpdate();
      EmbeddedLink embeddedLink = offsetLinkMap.get(offset);
      embeddedLink.setText(newCaption);
      addLink(embeddedLink, offset);

      setLinkCaptionAtModel(offset, newCaption);
      afterUpdate();
    } catch (Exception e) {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.