Package org.eclipse.xtext.ui.editor.contentassist

Examples of org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal


      proposalText = proposalText + value;
    }
    ICompletionProposal proposal = createCompletionProposal(proposalText, displayString, imageForOption(), context);
    if (value == EMPTY_STRING && proposal instanceof ConfigurableCompletionProposal) {
      // set cursor between the proposal's quotes
      ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
      configurable.setCursorPosition(proposalText.length() - 1);
    }
    acceptor.accept(proposal);
  }
View Full Code Here


  private void createAndAccept(CompoundElement display, int cursorPosition, ContentAssistContext context,
      ICompletionProposalAcceptor acceptor) {
    ICompletionProposal proposal = createCompletionProposal(display, context);
    if (proposal instanceof ConfigurableCompletionProposal) {
      ConfigurableCompletionProposal configurable = (ConfigurableCompletionProposal) proposal;
      configurable.setCursorPosition(cursorPosition);
    }
    acceptor.accept(proposal);
  }
View Full Code Here

    public ColonAddingAcceptor(ICompletionProposalAcceptor delegate) {
      this.delegate=delegate;
    }
    public void accept(ICompletionProposal proposal) {
      if(proposal instanceof ConfigurableCompletionProposal){
        ConfigurableCompletionProposal newProposal = (ConfigurableCompletionProposal) proposal;
        newProposal.setReplacementString(newProposal.getReplacementString()+":");
        newProposal.setReplaceContextLength(newProposal.getReplaceContextLength()+1);
        newProposal.setCursorPosition(newProposal.getCursorPosition()+1);
      }
      delegate.accept(proposal);
    }
View Full Code Here

          // since $ is in icon, not needed in description (just makes it more difficult to read).
          StyledString styledDescription = new StyledString(b.substring(bracedInput
              ? 0
              : 1));
          styledDescription.append(typeSuffix(d));
          ConfigurableCompletionProposal proposal = doCreateProposal(
            b.toString(), styledDescription, image, getPriorityHelper().getDefaultPriority(), context);
          proposal.setReplacementOffset(replacementOffset);
          proposal.setReplacementLength(replacementLength);
          acceptor.accept(proposal);
        }

      }
    }
View Full Code Here

      s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
      p = createCompletionProposal(prop.getName() + " : []", s, IconKeys.getIcon(IconKeys.LIST_KEY), getPropertiesProposalsProposals(), context.getPrefix(), context);
    }

    if (p instanceof ConfigurableCompletionProposal) {
      ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
      cp.setAdditionalProposalInfo(model);
      cp.setHover(new HoverImpl(prop.getJavaElement()));

      if (!prop.isSetable()) {
        cp.setCursorPosition(cp.getCursorPosition() - 1);
      }
    }

    acceptor.accept(p);
  }
View Full Code Here

    StyledString s = new StyledString(prop.getName() + " : {}");
    s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
    ICompletionProposal p = createCompletionProposal(prop.getName() + " : ", s, IconKeys.getIcon(IconKeys.MAP_KEY), getPropertiesProposalsProposals(), context.getPrefix(), context);

    if (p instanceof ConfigurableCompletionProposal) {
      ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
      cp.setAdditionalProposalInfo(model);
      cp.setHover(new HoverImpl(prop.getJavaElement()));
    }

    acceptor.accept(p);
  }
View Full Code Here

      context = context.copy().setMatcher(new StaticPrefixMatcher(context.getMatcher())).toContext();
     
      ICompletionProposal p = createCompletionProposal("static " + prop.getName() + " : ", s, IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals()-10, context.getPrefix(), context);
     
      if (p instanceof ConfigurableCompletionProposal) {
        ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
        cp.setAdditionalProposalInfo(model);
        cp.setHover(new HoverImpl(prop.getJavaElement()));
      }
     
      acceptor.accept(p);
    } else {
      StyledString s = new StyledString(prop.getName() + " : " + prop.getEnumTypeAsString(false));
      s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
      ICompletionProposal p = createCompletionProposal(prop.getName() + " : ", s, IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals(), context.getPrefix(), context);

      if (p instanceof ConfigurableCompletionProposal) {
        ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
        cp.setAdditionalProposalInfo(model);
        cp.setHover(new HoverImpl(prop.getJavaElement()));
      }

      acceptor.accept(p);     
    }
  }
View Full Code Here

    StyledString s = new StyledString(prop.getName() + " : " + prop.getEventTypeAsString(false));
    s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
    ICompletionProposal p = createCompletionProposal(prop.getName() + " : ", s, IconKeys.getIcon(IconKeys.EVENT_KEY), getPropertiesProposalsProposals(), context.getPrefix(), context);

    if (p instanceof ConfigurableCompletionProposal) {
      ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
      cp.setAdditionalProposalInfo(model);
      cp.setHover(new HoverImpl(prop.getJavaElement()));
    }

    acceptor.accept(p);
  }
View Full Code Here

      context = context.copy().setMatcher(new StaticPrefixMatcher(context.getMatcher())).toContext();
     
      ICompletionProposal p = createCompletionProposal("static " + prop.getName() + " : ", s, IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals()-10, context.getPrefix(), context);
     
      if (p instanceof ConfigurableCompletionProposal) {
        ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
        cp.setAdditionalProposalInfo(model);
        cp.setHover(new HoverImpl(prop.getJavaElement()));
      }

      acceptor.accept(p);
    } else {
      StyledString s = new StyledString(prop.getName() + " : " + prop.getElementTypeAsString(false));
      s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
      ICompletionProposal p = createCompletionProposal(prop.getName() + " : ", s, IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals(), context.getPrefix(), context);

      if (p instanceof ConfigurableCompletionProposal) {
        ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
        cp.setAdditionalProposalInfo(model);
        cp.setHover(new HoverImpl(prop.getJavaElement()));
      }

      acceptor.accept(p)
    }
  }
View Full Code Here

      context = context.copy().setMatcher(new StaticPrefixMatcher(context.getMatcher())).toContext();
     
      ICompletionProposal p = createCompletionProposal(proposalValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals()-10, context.getPrefix(), context);
     
      if (p instanceof ConfigurableCompletionProposal) {
        ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
        cp.setAdditionalProposalInfo(model);
        cp.setHover(new HoverImpl(prop.getJavaElement()));
      }

      acceptor.accept(p);
    } else {
      StyledString s = new StyledString(prop.getName() + " : " + typeName);
      s.append(" - " + prop.getFXClass().getSimpleName(), StyledString.QUALIFIER_STYLER);
     
      if( proposalValue.equals("id : \"\"") ) {
        proposalValue = "^" + proposalValue;
      }
     
      context = context.copy().setMatcher(new EscapePrefixMatcher(context.getMatcher())).toContext();
      ICompletionProposal p = createCompletionProposal(proposalValue, s, IconKeys.getIcon(IconKeys.FIELD_KEY), getPropertiesProposalsProposals(), context.getPrefix(), context);
     
      if (p instanceof ConfigurableCompletionProposal) {
        ConfigurableCompletionProposal cp = (ConfigurableCompletionProposal) p;
        cp.setAdditionalProposalInfo(model);
        cp.setHover(new HoverImpl(prop.getJavaElement()));
        if (prop.getType() == Type.STRING) {
          cp.setCursorPosition(cp.getCursorPosition() - 1);
        }
      }

      acceptor.accept(p);
    }
View Full Code Here

TOP

Related Classes of org.eclipse.xtext.ui.editor.contentassist.ConfigurableCompletionProposal

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.