Package org.eclipse.jface.text.link

Examples of org.eclipse.jface.text.link.LinkedPosition


          int nodeOffset = elementImpl.getStartEndOffset() - 1;

          LinkedPositionGroup group = new LinkedPositionGroup();

          try {
            group.addPosition(new LinkedPosition(document, nodeOffset, 0));
            linkModel.addGroup(group);
            hasPositions = true;
          }
          catch (BadLocationException e) {
            StatusHandler.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
View Full Code Here


    this.project = project;
  }

  @Override
  public void applyQuickFix(final IDocument document) {
    final LinkedPosition position = new LinkedPosition(document, getOffset(), getLength());
    LinkedPositionGroup group = new LinkedPositionGroup();

    LinkedModeModel model = new LinkedModeModel();
    try {
      group.addPosition(position);
      model.addGroup(group);
      model.forceInstall();

      ITextViewer viewer = getViewer(document);
      if (viewer == null) {
        return;
      }

      Point originalSelection = viewer.getSelectedRange();
      LinkedModeUI ui = new LinkedModeUI(model, viewer);
      ui.setExitPosition(viewer, getOffset(), 0, Integer.MAX_VALUE);

      model.addLinkingListener(new ILinkedModeListener() {

        public void left(LinkedModeModel model, int flags) {
          if ((flags & ILinkedModeListener.UPDATE_CARET) > 0) {
            try {
              String newName = position.getContent();
              Shell shell = PlatformUI.getWorkbench().getDisplay().getActiveShell();
              doRename(newName, shell);
            }
            catch (BadLocationException e) {
            }
View Full Code Here

      LinkedModeModel linkModel = new LinkedModeModel();
      LinkedPositionGroup group = new LinkedPositionGroup();
      attrNode = ((AttrImpl) beanNode.getAttributes().getNamedItem(BeansSchemaConstants.ATTR_FACTORY_METHOD));

      try {
        group.addPosition(new LinkedPosition(document, attrNode.getValueRegionStartOffset() + 1, 0));
        linkModel.addGroup(group);

      }
      catch (BadLocationException e) {
        StatusHandler.log(new Status(IStatus.ERROR, Activator.PLUGIN_ID,
View Full Code Here

        LinkedPositionGroup group= new LinkedPositionGroup();

        int[] offsets= variable.getOffsets();
        int length= variable.getLength();

        LinkedPosition first;
        {
          String[] values= variable.getValues();
          ICompletionProposal[] proposals= new ICompletionProposal[values.length];
          for (int j= 0; j < values.length; j++) {
            ensurePositionCategoryInstalled(document, model);
            Position pos= new Position(offsets[0] + start, length);
            document.addPosition(getCategory(), pos);
            proposals[j]= new PositionBasedCompletionProposal(values[j], pos, length);
          }

          if (proposals.length > 1)
            first= new ProposalPosition(document, offsets[0] + start, length, proposals);
          else
            first= new LinkedPosition(document, offsets[0] + start, length);
        }

        for (int j= 0; j != offsets.length; j++)
          if (j == 0)
            group.addPosition(first);
          else
            group.addPosition(new LinkedPosition(document, offsets[j] + start, length));

        model.addGroup(group);
        hasPositions= true;
      }
View Full Code Here

TOP

Related Classes of org.eclipse.jface.text.link.LinkedPosition

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.