/** * Returns whether this element has an associated $NON-NLS-*$ tag. * * @return <code>true</code> if the NLS element has an associated $NON-NLS-*$ tag */ public boolean hasTag() { return fTagPosition != null && fTagPosition.getLength() > 0; }
/** * Returns <code>true</code> if the NLS element has an asscociated $NON-NLS-*$ tag. * Otherwise <code>false</code> is returned. */ public boolean hasTag() { return fTagPosition != null && fTagPosition.getLength() > 0; }
/** * Returns whether this element has an associated $NON-NLS-*$ tag. * * @return <code>true</code> if the NLS element has an associated $NON-NLS-*$ tag */ public boolean hasTag() { return fTagPosition != null && fTagPosition.getLength() > 0; }
private boolean isAffected(ASTNode node) { if (fSubRange == null) { return true; } int nodeStart= node.getStartPosition(); int offset= fSubRange.getOffset(); return nodeStart + node.getLength() > offset && offset + fSubRange.getLength() > nodeStart; }
private static boolean isPositionInElement(NLSElement element, int position) { Region elementPosition= element.getPosition(); return (elementPosition.getOffset() <= position && position <= elementPosition.getOffset() + elementPosition.getLength()); }
private boolean isAffected(ASTNode node) { if (fSubRange == null) { return true; } int nodeStart= node.getStartPosition(); int offset= fSubRange.getOffset(); return nodeStart + node.getLength() > offset && (offset + fSubRange.getLength()) > nodeStart; }
private void updateSourceView(IStructuredSelection selection) { NLSSubstitution first= (NLSSubstitution) selection.getFirstElement(); if (first != null) { Region region= first.getNLSElement().getPosition(); fSourceViewer.setSelectedRange(region.getOffset(), region.getLength()); fSourceViewer.revealRange(region.getOffset(), region.getLength()); } }
private void updateSourceView(IStructuredSelection selection) { NLSSubstitution first= (NLSSubstitution) selection.getFirstElement(); if (first != null) { Region region= first.getNLSElement().getPosition(); fSourceViewer.setSelectedRange(region.getOffset(), region.getLength()); fSourceViewer.revealRange(region.getOffset(), region.getLength()); } }
private void updateSourceView(IStructuredSelection selection) { NLSSubstitution first= (NLSSubstitution) selection.getFirstElement(); if (first != null) { Region region= first.getNLSElement().getPosition(); fSourceViewer.setSelectedRange(region.getOffset(), region.getLength()); fSourceViewer.revealRange(region.getOffset(), region.getLength()); } }
/** * Sets the caret where hyperlinking got initiated. * * @since 3.5 */ private void setCaret() { Point selectedRange= fTextViewer.getSelectedRange(); if (fCursorOffset != -1 && !(fSubjectRegion.getOffset() <= selectedRange.x && selectedRange.x + selectedRange.y <= fSubjectRegion.getOffset() + fSubjectRegion.getLength())) fTextViewer.setSelectedRange(fCursorOffset, 0); }
private void deleteTag(NLSSubstitution substitution, TextChange change) { Region textRegion= substitution.getNLSElement().getTagPosition(); TextChangeCompatibility.addTextEdit(change, NLSMessages.NLSSourceModifier_remove_tag, new DeleteEdit(textRegion.getOffset(), textRegion.getLength())); }
private void replaceKey(NLSSubstitution substitution, TextChange change) { Region region= substitution.getNLSElement().getPosition(); String[] args= {substitution.getInitialKey(), BasicElementLabels.getJavaElementName(substitution.getKey())}; ReplaceEdit replaceEdit; if (fIsEclipseNLS) replaceEdit= new ReplaceEdit(region.getOffset(), region.getLength(), substitution.getKey()); else replaceEdit= new ReplaceEdit(region.getOffset(), region.getLength(), '\"' + unwindEscapeChars(substitution.getKey()) + '\"'); // TextChangeCompatibility.addTextEdit(change, Messages.format(NLSMessages.NLSSourceModifier_replace_key, args), replaceEdit); }
private void replaceKey(NLSSubstitution substitution, TextChange change) { Region region= substitution.getNLSElement().getPosition(); String[] args= {substitution.getInitialKey(), BasicElementLabels.getJavaElementName(substitution.getKey())}; ReplaceEdit replaceEdit; if (fIsEclipseNLS) replaceEdit= new ReplaceEdit(region.getOffset(), region.getLength(), substitution.getKey()); else replaceEdit= new ReplaceEdit(region.getOffset(), region.getLength(), '\"' + unwindEscapeChars(substitution.getKey()) + '\"'); // TextChangeCompatibility.addTextEdit(change, Messages.format(NLSMessages.NLSSourceModifier_replace_key, args), replaceEdit); }
private static int computeInsertOffset(NLSElement[] elements, int index, int defaultValue) { NLSElement previousTagged= findPreviousTagged(index, elements); if (previousTagged != null) { return previousTagged.getTagPosition().getOffset() + previousTagged.getTagPosition().getLength(); } NLSElement nextTagged= findNextTagged(index, elements); if (nextTagged != null) { return nextTagged.getTagPosition().getOffset(); } return defaultValue; }
private static int computeInsertOffset(NLSElement[] elements, int index, int defaultValue) { NLSElement previousTagged= findPreviousTagged(index, elements); if (previousTagged != null) return previousTagged.getTagPosition().getOffset() + previousTagged.getTagPosition().getLength(); NLSElement nextTagged= findNextTagged(index, elements); if (nextTagged != null) return nextTagged.getTagPosition().getOffset(); return defaultValue; }
protected ConfigurableCompletionProposal doCreateProposal(String proposal, StyledString displayString, Image image, int priority, ContentAssistContext context) { int replacementOffset = context.getReplaceRegion().getOffset(); int replacementLength = context.getReplaceRegion().getLength(); ConfigurableCompletionProposal result = doCreateProposal(proposal, displayString, image, replacementOffset, replacementLength); result.setPriority(priority); result.setMatcher(context.getMatcher()); result.setReplaceContextLength(context.getReplaceContextLength()); return result; }
private void replaceValue(NLSSubstitution substitution, TextChange change) { Region region= substitution.getNLSElement().getPosition(); String[] args= {substitution.getInitialValue(), substitution.getValueNonEmpty()}; TextChangeCompatibility.addTextEdit(change, Messages.format(NLSMessages.NLSSourceModifier_replace_value, args), new ReplaceEdit(region.getOffset(), region.getLength(), '\"' + unwindEscapeChars(substitution.getValueNonEmpty()) + '\"')); // }
private static int computeInsertOffset(NLSElement[] elements, int index, ICompilationUnit cu) throws CoreException { NLSElement previousTagged= findPreviousTagged(index, elements); if (previousTagged != null) return previousTagged.getTagPosition().getOffset() + previousTagged.getTagPosition().getLength(); NLSElement nextTagged= findNextTagged(index, elements); if (nextTagged != null) return nextTagged.getTagPosition().getOffset(); return findLineEnd(cu, elements[index].getPosition().getOffset()); }
private void replaceValue(NLSSubstitution substitution, TextChange change) { Region region= substitution.getNLSElement().getPosition(); String[] args= {substitution.getInitialValue(), substitution.getValueNonEmpty()}; TextChangeCompatibility.addTextEdit(change, Messages.format(NLSMessages.NLSSourceModifier_replace_value, args), new ReplaceEdit(region.getOffset(), region.getLength(), '\"' + unwindEscapeChars(substitution.getValueNonEmpty()) + '\"')); // }
private static int computeInsertOffset(NLSElement[] elements, int index, ICompilationUnit cu) throws CoreException { NLSElement previousTagged= findPreviousTagged(index, elements); if (previousTagged != null) { return previousTagged.getTagPosition().getOffset() + previousTagged.getTagPosition().getLength(); } NLSElement nextTagged= findNextTagged(index, elements); if (nextTagged != null) { return nextTagged.getTagPosition().getOffset(); } return findLineEnd(cu, elements[index].getPosition().getOffset()); }