Java 类org.eclipse.jface.text.BadPositionCategoryException 实例源码

项目:tlaplus    文件:TLAFastPartitioner.java   
/**
 * Returns the partitioner's positions.   Apparently, this is an array of TypedPosition objects
 * that partitions the document, ordered from start to end.  These TypedPosition objects mark
 * all the non-TLA+ portions of the document--that is, comments, strings, and PlusCal tokens.
 *
 * @return the partitioner's positions
 * @throws BadPositionCategoryException if getting the positions from the
 *         document fails
 */
protected final Position[] getPositions() throws BadPositionCategoryException {
    if (fCachedPositions == null) {
        fCachedPositions= fDocument.getPositions(fPositionCategory);
    } else if (CHECK_CACHE_CONSISTENCY) {
        Position[] positions= fDocument.getPositions(fPositionCategory);
        int len= Math.min(positions.length, fCachedPositions.length);
        for (int i= 0; i < len; i++) {
            if (!positions[i].equals(fCachedPositions[i]))
                System.err.println("FastPartitioner.getPositions(): cached position is not up to date: from document: " + toString(positions[i]) + " in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ //$NON-NLS-2$
        }
        for (int i= len; i < positions.length; i++)
            System.err.println("FastPartitioner.getPositions(): new position in document: " + toString(positions[i])); //$NON-NLS-1$
        for (int i= len; i < fCachedPositions.length; i++)
            System.err.println("FastPartitioner.getPositions(): stale position in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$
    }
    return fCachedPositions;
}
项目:bts    文件:DocumentPartitioner.java   
/**
 * Returns the partitioners positions.
 * 
 * @return the partitioners positions
 * @throws BadPositionCategoryException
 *             if getting the positions from the document fails
 * @since 2.2
 */
protected final Position[] getPositions() throws BadPositionCategoryException {
    if (fCachedPositions == null) {
        fCachedPositions = fDocument.getPositions(fPositionCategory);
    } else if (CHECK_CACHE_CONSISTENCY) {
        Position[] positions = fDocument.getPositions(fPositionCategory);
        int len = Math.min(positions.length, fCachedPositions.length);
        for (int i = 0; i < len; i++) {
            if (!positions[i].equals(fCachedPositions[i]))
                System.err
                        .println("FastPartitioner.getPositions(): cached position is not up to date: from document: " + toString(positions[i]) + " in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$ //$NON-NLS-2$
        }
        for (int i = len; i < positions.length; i++)
            System.err
                    .println("FastPartitioner.getPositions(): new position in document: " + toString(positions[i])); //$NON-NLS-1$
        for (int i = len; i < fCachedPositions.length; i++)
            System.err
                    .println("FastPartitioner.getPositions(): stale position in cache: " + toString(fCachedPositions[i])); //$NON-NLS-1$
    }
    return fCachedPositions;
}
项目:che    文件:FastPartitioner.java   
/**
 * Returns the partitioners positions.
 *
 * @return the partitioners positions
 * @throws BadPositionCategoryException if getting the positions from the document fails
 */
protected final Position[] getPositions() throws BadPositionCategoryException {
  if (fCachedPositions == null) {
    fCachedPositions = fDocument.getPositions(fPositionCategory);
  } else if (CHECK_CACHE_CONSISTENCY) {
    Position[] positions = fDocument.getPositions(fPositionCategory);
    int len = Math.min(positions.length, fCachedPositions.length);
    for (int i = 0; i < len; i++) {
      if (!positions[i].equals(fCachedPositions[i]))
        System.err.println(
            "FastPartitioner.getPositions(): cached position is not up to date: from document: "
                + toString(positions[i])
                + " in cache: "
                + toString(fCachedPositions[i])); // $NON-NLS-1$ //$NON-NLS-2$
    }
    for (int i = len; i < positions.length; i++)
      System.err.println(
          "FastPartitioner.getPositions(): new position in document: "
              + toString(positions[i])); // $NON-NLS-1$
    for (int i = len; i < fCachedPositions.length; i++)
      System.err.println(
          "FastPartitioner.getPositions(): stale position in cache: "
              + toString(fCachedPositions[i])); // $NON-NLS-1$
  }
  return fCachedPositions;
}
项目:Eclipse-Postfix-Code-Completion    文件:BlockCommentAction.java   
/**
 * Creates a new edition on the document of this factory.
 *
 * @param offset the offset of the edition at the point when is created.
 * @param length the length of the edition (not updated via the position update mechanism)
 * @param text the text to be replaced on the document
 * @return an <code>Edit</code> reflecting the edition on the document
 */
public Edit createEdit(int offset, int length, String text) throws BadLocationException {

    if (!fDocument.containsPositionCategory(fCategory)) {
        fDocument.addPositionCategory(fCategory);
        fUpdater= new DefaultPositionUpdater(fCategory);
        fDocument.addPositionUpdater(fUpdater);
    }

    Position position= new Position(offset);
    try {
        fDocument.addPosition(fCategory, position);
    } catch (BadPositionCategoryException e) {
        Assert.isTrue(false);
    }
    return new Edit(fDocument, length, text, position);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:BlockCommentAction.java   
/**
 * Creates a new edition on the document of this factory.
 *
 * @param offset the offset of the edition at the point when is created.
 * @param length the length of the edition (not updated via the position update mechanism)
 * @param text the text to be replaced on the document
 * @return an <code>Edit</code> reflecting the edition on the document
 */
public Edit createEdit(int offset, int length, String text) throws BadLocationException {

    if (!fDocument.containsPositionCategory(fCategory)) {
        fDocument.addPositionCategory(fCategory);
        fUpdater= new DefaultPositionUpdater(fCategory);
        fDocument.addPositionUpdater(fUpdater);
    }

    Position position= new Position(offset);
    try {
        fDocument.addPosition(fCategory, position);
    } catch (BadPositionCategoryException e) {
        Assert.isTrue(false);
    }
    return new Edit(fDocument, length, text, position);
}
项目:e4macs    文件:EmacsPlusUtils.java   
/**
 * Get all positions of the given position category
 * In sexp's these positions are typically skipped
 * 
 * @param doc
 * @param pos_names
 * @return the positions to exclude
 */
public static List<Position> getExclusions(IDocument doc, String[] pos_names) {
    List<Position> excludePositions = new LinkedList<Position>();
    String cat = getTypeCategory(doc);
    if (cat != null) {
        try {
            Position[] xpos = doc.getPositions(cat);
            for (int j = 0; j < xpos.length; j++) {
                if (xpos[j] instanceof TypedPosition) {

                    for (int jj = 0; jj < pos_names.length; jj++) {
                        if (((TypedPosition) xpos[j]).getType().contains(pos_names[jj])) {
                            excludePositions.add(xpos[j]);
                        }
                    }
                }
            }
        } catch (BadPositionCategoryException e) {}
    }
    return excludePositions;
}
项目:e4macs    文件:TecoRegister.java   
public void partClosed(IWorkbenchPartReference partRef) {

    if (partRef instanceof IEditorReference) {
        IEditorPart epart = ((IEditorReference) partRef).getEditor(false);
        ITextEditor editor = (location != null ? location.getEditor() : null);
        if (editor == EmacsPlusUtils.getTextEditor(epart, false)) {
            RegisterLocation loc = location;
            // we're out of here
            removeListener(this);
            IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());
            // remove position category, if still present
            if (document.containsPositionCategory(MarkRing.MARK_CATEGORY)) {
                try {
                    document.removePositionUpdater(MarkRing.updater);
                    document.removePositionCategory(MarkRing.MARK_CATEGORY);
                } catch (BadPositionCategoryException e) {
                }
            }
            // convert to path
            loc.setPath(convertToPath(editor));
        }
    }
}
项目:Pydev    文件:PartitionCodeReader.java   
public void configureForwardReaderKeepingPositions(int offset, int end) throws IOException,
        BadPositionCategoryException {
    if (!fSupportKeepPositions) {
        throw new AssertionError("configureForwardReader must be called with supportKeepPositions=true.");
    }
    fOffset = offset;
    fStartForwardOffset = offset;
    fForward = true;
    fEnd = Math.min(fDocument.getLength(), end);
    fcurrentPositionI = 0;
    if (fPositions.length > 0) {
        fCurrentPosition = fPositions[0];
    } else {
        fCurrentPosition = null;
    }
}
项目:Pydev    文件:PartitionCodeReader.java   
public void configureForwardReader(IDocument document, int offset, int end, boolean supportKeepPositions)
        throws IOException,
        BadPositionCategoryException {
    fSupportKeepPositions = supportKeepPositions;
    fDocument = document;
    fOffset = offset;
    fStartForwardOffset = offset;
    fForward = true;
    fEnd = Math.min(fDocument.getLength(), end);
    fcurrentPositionI = 0;
    fPositions = createPositions(document);
    if (fPositions.length > 0) {
        fCurrentPosition = fPositions[0];
    } else {
        fCurrentPosition = null;
    }
}
项目:Pydev    文件:PartitionCodeReader.java   
private Position[] createPositions(IDocument document) throws BadPositionCategoryException {
    Position[] positions = getDocumentTypedPositions(document, contentType);
    List<TypedPosition> typedPositions = PartitionMerger.sortAndMergePositions(positions, document.getLength());
    int size = typedPositions.size();
    List<Position> list = new ArrayList<Position>(size);
    for (int i = 0; i < size; i++) {
        Position position = typedPositions.get(i);
        if (isPositionValid(position, contentType)) {
            list.add(position);
        }
    }

    if (!fForward) {
        Collections.reverse(list);
    }
    Position[] ret = list.toArray(new Position[list.size()]);
    return ret;
}
项目:Pydev    文件:DocCopy.java   
public DocCopy(IDocument document) {
    this.contents = document.get();
    this.document = document;
    categoryToPos = new HashMap<>();
    String[] positionCategories = document.getPositionCategories();
    for (String string : positionCategories) {
        try {
            categoryToPos.put(string, document.getPositions(string));
        } catch (BadPositionCategoryException e) {
            Log.log(e);
        }
    }

    IDocumentExtension4 doc4 = (IDocumentExtension4) document;
    modificationStamp = doc4.getModificationStamp();
}
项目:Pydev    文件:PyOpenLastConsoleHyperlink.java   
@SuppressWarnings("restriction")
private void processIOConsole(IOConsole ioConsole) {
    IDocument document = ioConsole.getDocument();
    try {
        Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY);
        Arrays.sort(positions, new Comparator<Position>() {

            @Override
            public int compare(Position o1, Position o2) {
                return Integer.compare(o1.getOffset(), o2.getOffset());
            }
        });
        if (positions.length > 0) {
            Position p = positions[positions.length - 1];
            if (p instanceof ConsoleHyperlinkPosition) {
                ConsoleHyperlinkPosition consoleHyperlinkPosition = (ConsoleHyperlinkPosition) p;
                IHyperlink hyperLink = consoleHyperlinkPosition.getHyperLink();
                hyperLink.linkActivated();
            }
        }
    } catch (BadPositionCategoryException e) {
        Log.log(e);
    }
}
项目:ec4e    文件:EditorConfigCompletionProposal.java   
private void ensurePositionCategoryRemoved(IDocument document) {
    if (document.containsPositionCategory(getCategory())) {
        try {
            document.removePositionCategory(getCategory());
        } catch (BadPositionCategoryException e) {
            // ignore
        }
        document.removePositionUpdater(fUpdater);
    }
}
项目:DarwinSPL    文件:DwprofilePositionHelper.java   
/**
 * <p>
 * Returns the first position of a specific category of the given document.
 * </p>
 * 
 * @param document the document to get the positions from
 * @param category the category of the position
 * 
 * @return a position. If there is none return <code>null</code>.
 */
public Position getFirstPosition(IDocument document, String category) {
    try {
        Position[] positions = document.getPositions(category);
        if (positions.length > 0) {
            return positions[0];
        }
    } catch (BadPositionCategoryException e) {
    }
    return null;
}
项目:DarwinSPL    文件:HyexpressionPositionHelper.java   
/**
 * <p>
 * Returns the first position of a specific category of the given document.
 * </p>
 * 
 * @param document the document to get the positions from
 * @param category the category of the position
 * 
 * @return a position. If there is none return <code>null</code>.
 */
public Position getFirstPosition(IDocument document, String category) {
    try {
        Position[] positions = document.getPositions(category);
        if (positions.length > 0) {
            return positions[0];
        }
    } catch (BadPositionCategoryException e) {
    }
    return null;
}
项目:DarwinSPL    文件:HyvalidityformulaPositionHelper.java   
/**
 * <p>
 * Returns the first position of a specific category of the given document.
 * </p>
 * 
 * @param document the document to get the positions from
 * @param category the category of the position
 * 
 * @return a position. If there is none return <code>null</code>.
 */
public Position getFirstPosition(IDocument document, String category) {
    try {
        Position[] positions = document.getPositions(category);
        if (positions.length > 0) {
            return positions[0];
        }
    } catch (BadPositionCategoryException e) {
    }
    return null;
}
项目:DarwinSPL    文件:HydatavaluePositionHelper.java   
/**
 * <p>
 * Returns the first position of a specific category of the given document.
 * </p>
 * 
 * @param document the document to get the positions from
 * @param category the category of the position
 * 
 * @return a position. If there is none return <code>null</code>.
 */
public Position getFirstPosition(IDocument document, String category) {
    try {
        Position[] positions = document.getPositions(category);
        if (positions.length > 0) {
            return positions[0];
        }
    } catch (BadPositionCategoryException e) {
    }
    return null;
}
项目:DarwinSPL    文件:HymappingPositionHelper.java   
/**
 * <p>
 * Returns the first position of a specific category of the given document.
 * </p>
 * 
 * @param document the document to get the positions from
 * @param category the category of the position
 * 
 * @return a position. If there is none return <code>null</code>.
 */
public Position getFirstPosition(IDocument document, String category) {
    try {
        Position[] positions = document.getPositions(category);
        if (positions.length > 0) {
            return positions[0];
        }
    } catch (BadPositionCategoryException e) {
    }
    return null;
}
项目:DarwinSPL    文件:HyconstraintsPositionHelper.java   
/**
 * <p>
 * Returns the first position of a specific category of the given document.
 * </p>
 * 
 * @param document the document to get the positions from
 * @param category the category of the position
 * 
 * @return a position. If there is none return <code>null</code>.
 */
public Position getFirstPosition(IDocument document, String category) {
    try {
        Position[] positions = document.getPositions(category);
        if (positions.length > 0) {
            return positions[0];
        }
    } catch (BadPositionCategoryException e) {
    }
    return null;
}
项目:DarwinSPL    文件:HymanifestPositionHelper.java   
/**
 * <p>
 * Returns the first position of a specific category of the given document.
 * </p>
 * 
 * @param document the document to get the positions from
 * @param category the category of the position
 * 
 * @return a position. If there is none return <code>null</code>.
 */
public Position getFirstPosition(IDocument document, String category) {
    try {
        Position[] positions = document.getPositions(category);
        if (positions.length > 0) {
            return positions[0];
        }
    } catch (BadPositionCategoryException e) {
    }
    return null;
}
项目:ftc    文件:TweakedTemplateProposal.java   
private void ensurePositionCategoryRemoved(IDocument document) {
    if (document.containsPositionCategory(getCategory())) {
        try {
            document.removePositionCategory(getCategory());
        } catch (BadPositionCategoryException e) {
            // ignore
        }
        document.removePositionUpdater(fUpdater);
    }
}
项目:texlipse    文件:TexDocumentModel.java   
/**
 * Traverses the OutlineNode tree and adds a Position for each
 * node to Document.
 * 
 * Also adds the nodes to type lists of the OutlineInput and 
 * calculates the tree depth.
 * 
 * Old Positions are removed before adding new ones.
 * 
 * @param rootNodes
 * @param monitor monitor for the job calling this method
 */
private void updateDocumentPositions(List<OutlineNode> rootNodes, IProgressMonitor monitor) {
    TexOutlineInput newOutlineInput = new TexOutlineInput(rootNodes);

    IDocument document = editor.getDocumentProvider().getDocument(editor.getEditorInput());

    // remove previous positions
    try {
        document.removePositionCategory("__outline");
    } catch (BadPositionCategoryException bpce) {
        // do nothing, the category will be added again next, it does not exists the first time
    }

    document.addPositionCategory("__outline");
    pollCancel(monitor);

    // add new positions for nodes and their children
    int maxDepth = 0;
    for (Iterator<OutlineNode> iter = rootNodes.iterator(); iter.hasNext(); ) {
        OutlineNode node = iter.next();
        int localDepth = addNodePosition(node, document, 0, newOutlineInput); 

        if (localDepth > maxDepth) {
            maxDepth = localDepth;
        }
        pollCancel(monitor);
    }
    pollCancel(monitor);

    // set the new outline input
    newOutlineInput.setTreeDepth(maxDepth);
    this.outlineInput = newOutlineInput;
}
项目:tlaplus    文件:TLAFastPartitioner.java   
/**
 * {@inheritDoc}
 * <p>
 * May be extended by subclasses.
 * </p>
 */
public void disconnect() {

    Assert.isTrue(fDocument.containsPositionCategory(fPositionCategory));

    try {
        fDocument.removePositionCategory(fPositionCategory);
    } catch (BadPositionCategoryException x) {
        // can not happen because of Assert
    }
}
项目:tlaplus    文件:TLAFastPartitioner.java   
/**
 * Flushes the active rewrite session.
 */
protected final void flushRewriteSession() {
    fActiveRewriteSession= null;

    // remove all position belonging to the partitioner position category
    try {
        fDocument.removePositionCategory(fPositionCategory);
    } catch (BadPositionCategoryException x) {
    }
    fDocument.addPositionCategory(fPositionCategory);

    fIsInitialized= false;
}
项目:tlaplus    文件:TLAFastPartitioner.java   
/**
 * For printing out debugging information
 *   (TypedPosition)
 * @param msg
 */
public void debugPrint(String msg) {
    System.out.println("Debug print " + msg);
    System.out.println("Start comment offset: " + pcalStartCommentOffset
            + ";  Start: (" + pcalStartOffset + ", " + pcalStartLength + 
            ");  End comment: (" + pcalEndCommentOffset + ", "
            + pcalEndCommentLength + ")") ;
    Position[] positions = null;
    try {
        positions = fDocument.getPositions(fPositionCategory);
    } catch (BadPositionCategoryException e1) {
        System.out.println("Can't get positions") ;
        e1.printStackTrace();
        return ;
    }
    for (int i = 0; i < positions.length; i++) {
       try {
          TypedPosition position = (TypedPosition) positions[i] ;
          System.out.println("Position " + i + ": (" + position.getOffset()
                  + ", " + position.getLength() + ")  type: "
                  + position.getType() + (position.isDeleted?" DELETED":""));
          System.out.println("  `" + 
                  fDocument.get(position.getOffset(), position.getLength()) + "'") ;

       } catch (Exception e) {
            System.out.println("Item " + i + " Exception: " + e.getMessage()) ;
         }
    }
    IRegion result = createRegion();
    if (result == null) {
        System.out.println("Returned null");
    } else {
        System.out.println("Returned (" + result.getOffset() + ", " 
            + result.getLength() + ")") ;
    }
}
项目:typescript.java    文件:TypeScriptCompletionProposal.java   
private void ensurePositionCategoryRemoved(IDocument document) {
    if (document.containsPositionCategory(getCategory())) {
        try {
            document.removePositionCategory(getCategory());
        } catch (BadPositionCategoryException e) {
            // ignore
        }
        document.removePositionUpdater(fUpdater);
    }
}
项目:bts    文件:XtextDocument.java   
@Override
public Position[] getPositions(String category, int offset, int length, boolean canStartBefore, boolean canEndAfter)
        throws BadPositionCategoryException {
    positionsReadLock.lock();
    try {
        return super.getPositions(category, offset, length, canStartBefore, canEndAfter);
    } finally {
        positionsReadLock.unlock();
    }
}
项目:bts    文件:XtextDocument.java   
@Override
public Position[] getPositions(String category) throws BadPositionCategoryException {
    positionsReadLock.lock();
    try {
        return super.getPositions(category);
    } finally {
        positionsReadLock.unlock();
    }
}
项目:bts    文件:XtextDocument.java   
@Override
public void addPosition(String category, Position position) throws BadLocationException,
        BadPositionCategoryException {
    positionsWriteLock.lock();
    try {
        super.addPosition(category, position);
    } finally {
        positionsWriteLock.unlock();
    }
}
项目:bts    文件:XtextDocument.java   
@Override
public void removePosition(String category, Position position) throws BadPositionCategoryException {
    positionsWriteLock.lock();
    try {
        super.removePosition(category, position);
    } finally {
        positionsWriteLock.unlock();
    }
}
项目:bts    文件:DocumentPartitioner.java   
/**
 * {@inheritDoc}
 * <p>
 * May be extended by subclasses.
 * </p>
 * 
 * @since 2.2
 */
public void disconnect() {

    Assert.isTrue(fDocument.containsPositionCategory(fPositionCategory));

    try {
        fDocument.removePositionCategory(fPositionCategory);
    } catch (BadPositionCategoryException x) {
        // can not happen because of Assert
    }
}
项目:bts    文件:DocumentPartitioner.java   
/**
 * Flushes the active rewrite session.
 * 
 * @since 2.2
 */
protected final void flushRewriteSession() {
    fActiveRewriteSession = null;

    // remove all position belonging to the partitioner position category
    try {
        fDocument.removePositionCategory(fPositionCategory);
    } catch (BadPositionCategoryException x) {
    }
    fDocument.addPositionCategory(fPositionCategory);

    fIsInitialized = false;
}
项目:bts    文件:HighlightingPresenter.java   
/**
 * Stop managing the given document.
 * 
 * @param document
 *            The document
 */
private void releaseDocument(IDocument document) {
    if (document != null) {
        document.removeDocumentListener(this);
        document.removePositionUpdater(fPositionUpdater);
        try {
            document.removePositionCategory(getPositionCategory());
        } catch (BadPositionCategoryException e) {
            // Should not happen
            log.debug(e.getMessage(), e);
        }
    }
}
项目:che    文件:FastPartitioner.java   
/**
 * {@inheritDoc}
 *
 * <p>May be extended by subclasses.
 */
public void disconnect() {

  Assert.isTrue(fDocument.containsPositionCategory(fPositionCategory));

  try {
    fDocument.removePositionCategory(fPositionCategory);
  } catch (BadPositionCategoryException x) {
    // can not happen because of Assert
  }
}
项目:che    文件:FastPartitioner.java   
/** Flushes the active rewrite session. */
protected final void flushRewriteSession() {
  fActiveRewriteSession = null;

  // remove all position belonging to the partitioner position category
  try {
    fDocument.removePositionCategory(fPositionCategory);
  } catch (BadPositionCategoryException x) {
  }
  fDocument.addPositionCategory(fPositionCategory);

  fIsInitialized = false;
}
项目:che    文件:JavaFormatter.java   
/**
 * Restores any decorated regions and updates the buffer's variable offsets.
 *
 * @return the buffer.
 * @throws MalformedTreeException
 * @throws BadLocationException
 */
public TemplateBuffer updateBuffer() throws MalformedTreeException, BadLocationException {
  checkState();
  TemplateVariable[] variables = fBuffer.getVariables();
  try {
    removeRangeMarkers(fPositions, fDocument, variables);
  } catch (BadPositionCategoryException x) {
    Assert.isTrue(false);
  }
  fBuffer.setContent(fDocument.get(), variables);
  fDocument = null;

  return fBuffer;
}
项目:che    文件:ParameterGuessingProposal.java   
private void ensurePositionCategoryRemoved(IDocument document) {
  if (document.containsPositionCategory(getCategory())) {
    try {
      document.removePositionCategory(getCategory());
    } catch (BadPositionCategoryException e) {
      // ignore
    }
    document.removePositionUpdater(fUpdater);
  }
}
项目:che    文件:AbstractJavaCompletionProposal.java   
/**
 * Called before document changes occur. It must be followed by a call to postReplace().
 *
 * @param document the document on which to track the reference position.
 * @param offset the offset
 * @throws org.eclipse.jface.text.BadLocationException if the offset describes an invalid range
 *     in this document
 */
public void preReplace(IDocument document, int offset) throws BadLocationException {
  fPosition.setOffset(offset);
  try {
    document.addPositionCategory(CATEGORY);
    document.addPositionUpdater(fPositionUpdater);
    document.addPosition(CATEGORY, fPosition);

  } catch (BadPositionCategoryException e) {
    // should not happen
    JavaPlugin.log(e);
  }
}
项目:che    文件:AbstractJavaCompletionProposal.java   
/**
 * Called after the document changed occurred. It must be preceded by a call to preReplace().
 *
 * @param document the document on which to track the reference position.
 * @return offset after the replace
 */
public int postReplace(IDocument document) {
  try {
    document.removePosition(CATEGORY, fPosition);
    document.removePositionUpdater(fPositionUpdater);
    document.removePositionCategory(CATEGORY);

  } catch (BadPositionCategoryException e) {
    // should not happen
    JavaPlugin.log(e);
  }
  return fPosition.getOffset();
}
项目:che    文件:TemplateProposal.java   
private void ensurePositionCategoryRemoved(IDocument document) {
  if (document.containsPositionCategory(getCategory())) {
    try {
      document.removePositionCategory(getCategory());
    } catch (BadPositionCategoryException e) {
      // ignore
    }
    document.removePositionUpdater(fUpdater);
  }
}