private Position[] getSegments() { if (fCachedSegments == null) { try { fCachedSegments= fSlaveDocument.getPositions(fSegmentsCategory); } catch (BadPositionCategoryException e) { return new Position[0]; } } return fCachedSegments; }
private Position[] getSegments() { if (fCachedSegments == null) { try { fCachedSegments= fSlaveDocument.getPositions(fSegmentsCategory); } catch (BadPositionCategoryException e) { return new Position[0]; } } return fCachedSegments; }
private Position[] getFragments() { if (fCachedFragments == null) { try { fCachedFragments= fMasterDocument.getPositions(fFragmentsCategory); } catch (BadPositionCategoryException e) { return new Position[0]; } } return fCachedFragments; }
private Position[] getFragments() { if (fCachedFragments == null) { try { fCachedFragments= fMasterDocument.getPositions(fFragmentsCategory); } catch (BadPositionCategoryException e) { return new Position[0]; } } return fCachedFragments; }
/** * Returns the fragments of the master documents. * * @return the fragment of the master document */ protected final Position[] getFragments() { try { return fMasterDocument.getPositions(fFragmentsCategory); } catch (BadPositionCategoryException e) { internalError(); } // unreachable return null; }
/** * Returns the fragments of the master documents. * * @return the fragment of the master document */ protected final Position[] getFragments() { try { return fMasterDocument.getPositions(fFragmentsCategory); } catch (BadPositionCategoryException e) { internalError(); } // unreachable return null; }
/** * Returns all hyperlinks in this console. * * @return all hyperlinks in this console */ public IHyperlink[] getHyperlinks() { try { Position[] positions = getDocument().getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY); IHyperlink[] hyperlinks = new IHyperlink[positions.length]; for (int i = 0; i < positions.length; i++) { ConsoleHyperlinkPosition position = (ConsoleHyperlinkPosition) positions[i]; hyperlinks[i] = position.getHyperLink(); } return hyperlinks; } catch (BadPositionCategoryException e) { return new IHyperlink[0]; } }
/** * Returns all hyperlinks in this console. * * @return all hyperlinks in this console */ public IHyperlink[] getHyperlinks() { try { Position[] positions = getDocument().getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY); IHyperlink[] hyperlinks = new IHyperlink[positions.length]; for (int i = 0; i < positions.length; i++) { ConsoleHyperlinkPosition position = (ConsoleHyperlinkPosition) positions[i]; hyperlinks[i] = position.getHyperLink(); } return hyperlinks; } catch (BadPositionCategoryException e) { return new IHyperlink[0]; } }
public FileLink getFileLink(int offset) { try { IDocument document = getDocument(); if (document != null) { Position[] positions = document.getPositions(ERROR_MARKER_CATEGORY); Position position = findPosition(offset, positions); if (position instanceof MarkerPosition) { return ((MarkerPosition) position).getFileLink(); } } } catch (BadPositionCategoryException e) { } return null; }
/** * Returns the hyperlink at the given offset of <code>null</code> if none. * * @param offset offset for which a hyperlink is requested * @return the hyperlink at the given offset of <code>null</code> if none */ public IHyperlink getHyperlink(int offset) { try { IDocument document = getDocument(); if (document != null) { Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY); Position position = findPosition(offset, positions); if (position instanceof ConsoleHyperlinkPosition) { return ((ConsoleHyperlinkPosition) position).getHyperLink(); } } } catch (BadPositionCategoryException e) { } return null; }
public void update(DocumentEvent event) { try { IDocument document = getDocument(); if (document != null) { Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY); for (int i = 0; i < positions.length; i++) { Position position = positions[i]; if (position.offset == event.fOffset && position.length<=event.fLength) { position.delete(); } if (position.isDeleted) { document.removePosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, position); } } } } catch (BadPositionCategoryException e) { } } };
/** * Uninstalls the given position from the given document. * * @param document the document * @param position the position * @return <code>true</code> if the position could be uninstalled */ private boolean uninstallFromDocument(IDocument document, Position position) { if (document != null && position != null) { try { document.removePosition(CATEGORY, position); Position[] category= document.getPositions(CATEGORY); if (category == null || category.length == 0) { document.removePositionCategory(CATEGORY); document.removePositionUpdater(fgPositionUpdater); } return true; } catch (BadPositionCategoryException e) { } } return false; }
public void clearFileLink() { try { Position[] positions = getDocument().getPositions(CppStyleMessageConsole.ERROR_MARKER_CATEGORY); for (Position position : positions) { getDocument().removePosition(CppStyleMessageConsole.ERROR_MARKER_CATEGORY, position); } } catch (BadPositionCategoryException e) { CppStyle.log(e); } } }
/** * Returns the hyperlink at the given offset of <code>null</code> if none. * * @param offset offset for which a hyperlink is requested * @return the hyperlink at the given offset of <code>null</code> if none */ public IHyperlink getHyperlink(int offset) { try { IDocument document = getDocument(); if (document != null) { Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY); Position position = findPosition(offset, positions); if (position instanceof ConsoleHyperlinkPosition) { return ((ConsoleHyperlinkPosition) position).getHyperLink(); } } } catch (BadPositionCategoryException e) { } return null; }
@Override public void update(DocumentEvent event) { try { IDocument document = getDocument(); if (document != null) { Position[] positions = document.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY); for (int i = 0; i < positions.length; i++) { Position position = positions[i]; if (position.offset == event.fOffset && position.length<=event.fLength) { position.delete(); } if (position.isDeleted) { document.removePosition(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY, position); } } } } catch (BadPositionCategoryException e) { } } };
/** * Uninstalls the given position from the given document. * * @param document the document * @param position the position * @return <code>true</code> if the position could be uninstalled */ private boolean uninstallFromDocument(IDocument document, Position position) { if (document != null && position != null) { try { document.removePosition(CATEGORY, position); Position[] category= document.getPositions(CATEGORY); if (category == null || category.length == 0) { document.removePositionCategory(CATEGORY); document.removePositionUpdater(fgPositionUpdater); } return true; } catch (BadPositionCategoryException e) { } } return false; }
/** * Returns the region associated with the given hyperlink. * * @param link hyperlink * @return the region associated with the hyperlink or null if the hyperlink is not found. */ public IRegion getRegion(IHyperlink link) { try { IDocument doc = getDocument(); if (doc != null) { Position[] positions = doc.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY); for (int i = 0; i < positions.length; i++) { ConsoleHyperlinkPosition position = (ConsoleHyperlinkPosition)positions[i]; if (position.getHyperLink().equals(link)) { return new Region(position.getOffset(), position.getLength()); } } } } catch (BadPositionCategoryException e) { } return null; }
/** * Returns the region associated with the given hyperlink. * * @param link hyperlink * @return the region associated with the hyperlink or null if the hyperlink is not found. */ public IRegion getRegion(IHyperlink link) { try { IDocument doc = getDocument(); if (doc != null) { Position[] positions = doc.getPositions(ConsoleHyperlinkPosition.HYPER_LINK_CATEGORY); for (int i = 0; i < positions.length; i++) { ConsoleHyperlinkPosition position = (ConsoleHyperlinkPosition)positions[i]; if (position.getHyperLink().equals(link)) { return new Region(position.getOffset(), position.getLength()); } } } } catch (BadPositionCategoryException e) { } return null; }
@Override public void update(DocumentEvent event) { try { Position[] category= event.getDocument().getPositions(getCategory()); fOffset= event.getOffset(); fLength= event.getLength(); fReplaceLength= (event.getText() == null ? 0 : event.getText().length()); fDocument= event.getDocument(); for (int i= 0; i < category.length; i++) { fPosition= category[i]; fIsLast= (i == category.length -1); fOriginalPosition.offset= fPosition.offset; fOriginalPosition.length= fPosition.length; if (notDeleted()) adaptToReplace(); } } catch (BadPositionCategoryException x) { // do nothing } }
@Override public void update(DocumentEvent event) { try { Position[] category= event.getDocument().getPositions(getCategory()); fOffset= event.getOffset(); fLength= event.getLength(); fReplaceLength= (event.getText() == null ? 0 : event.getText().length()); fDocument= event.getDocument(); for (int i= 0; i < category.length; i++) { fPosition= category[i]; fIsLast= (i == category.length -1); fOriginalPosition.offset= fPosition.offset; fOriginalPosition.length= fPosition.length; if (notDeleted()) adaptToReplace(); } } catch (BadPositionCategoryException x) { // do nothing } }