private List<OpenTag> findValue(Collection<OpenTag> nodes, String tagName, List<OpenTag> foundNodes) { if (nodes == null) { return foundNodes; } for (OpenTag ot : nodes) { if(LexerUtils.equals(tagName, ot.name(), true, false)) { foundNodes.add(ot); } else { foundNodes = findValue(ot.children(OpenTag.class), tagName, foundNodes); } } return foundNodes; }
try { CharSequence modelSource = sourceModel.getModelSource(); int line = LexerUtils.getLineOffset(modelSource, offset); int lineStartOffset = LexerUtils.getLineBeginningOffset(modelSource, line); int column = offset-lineStartOffset; String sourceMapText = sourceMapFob.asText();
@Override public void implement() throws Exception { final StringBuilder insertText = new StringBuilder(); insertText.append(' '); //NOI18N Iterator<Attribute> i = attrs.iterator(); while(i.hasNext()) { Attribute a = i.next(); insertText.append(a.getName()); insertText.append("=\"\""); //NOI18N if(i.hasNext()) { insertText.append(' '); //NOI18N } } final BaseDocument document = (BaseDocument)snapshot.getSource().getDocument(true); document.runAtomicAsUser(new Runnable() { @Override public void run() { try { int insertOffset = openTag.from() + "<".length() + openTag.name().length(); int documentInsertOffset = snapshot.getOriginalOffset(insertOffset); document.insertString(documentInsertOffset, insertText.toString(), null); } catch (BadLocationException ex) { Exceptions.printStackTrace(ex); } } }); LexerUtils.rebuildTokenHierarchy(document); }
/** * Checks whether the attribute name fits to one of the AJS conventions. * @param attributeName * @return the convention or null */ public static DirectiveConvention getConvention(CharSequence attributeName) { for(DirectiveConvention dc : values()) { //data-ng:bind if(LexerUtils.startsWith(attributeName, dc.fullPrefix, true, false)) { if(attributeName.length() > dc.fullPrefix.length()) { char delimiterChar = attributeName.charAt(dc.fullPrefix.length()); if(dc.delimiter == delimiterChar) { return dc; } } } } return null; }
int line = LexerUtils.getLineOffset(sourceModel.getModelSource(), offset); if (line == sourceLine) { value += 1;
if (line != -1) { try { startOffset = LexerUtils.getLineBeginningOffset(sourceModel.getModelSource(), line); startOffset += range.getStartColumn(); } catch (BadLocationException blex) { try { styleSheetText = styleSheetText.replaceAll("\r", ""); // NOI18N start = LexerUtils.getLineBeginningOffset(sourceModel.getModelSource(), startLine); start += range.getStartColumn(); end = LexerUtils.getLineBeginningOffset(sourceModel.getModelSource(), range.getEndLine()); end += range.getEndColumn(); } catch (BadLocationException blex) {
if (LexerUtils.followsToken(ts, CssTokenId.SASS_INCLUDE, true, true, CssTokenId.WS) != null) { } else if (LexerUtils.followsToken(ts, CssTokenId.DOT, true, true, CssTokenId.WS) != null) {
@Override public Pair<OffsetRange, FutureParamTask<DeclarationLocation, EditorFeatureContext>> getDeclaration(Document document, int caretOffset) { TokenSequence<CssTokenId> ts = LexerUtils.getJoinedTokenSequence(document, caretOffset, CssTokenId.language()); if (ts == null) { return null;
CharSequence insertPrefix = itr.next().getInsertPrefix(); if(insertPrefix != null) { if (!LexerUtils.startsWith(insertPrefix, context.getPrefix(), true, false)) { itr.remove();
@Override public boolean visit(Node node) { switch (node.type()) { case cp_mixin_name: case cp_variable: if (LexerUtils.equals(elementName, node.image(), false, false)) { OffsetRange range = new OffsetRange(node.from(), node.to()); getResult().add(range); break; } } return false; } };
@Override public void implement() throws Exception { Configuration conf = Configuration.get(snapshot.getSource().getFileObject()); conf.add(new Tag(elementName)); conf.store(); LexerUtils.rebuildTokenHierarchy(snapshot.getSource().getDocument(true)); }
if (!stack.isEmpty()) { StackItem top = stack.pop(); while (!stack.isEmpty() && !LexerUtils.equals(top.tag, tokenText, false, false)) { if (!top.finishText.isEmpty()) { embeddings.add(snapshot.create(top.finishText, Constants.JAVASCRIPT_MIMETYPE));
@Override public void implement() throws Exception { Configuration conf = Configuration.get(snapshot.getSource().getFileObject()); Tag tag = conf.getTag(elementName); if(tag != null) { conf.remove(tag); conf.store(); LexerUtils.rebuildTokenHierarchy(snapshot.getSource().getDocument(true)); } }
for (CPElement var : model.getVariables()) { if (var.getType().isOfTypes(CPElementType.VARIABLE_GLOBAL_DECLARATION, CPElementType.VARIABLE_LOCAL_DECLARATION, CPElementType.VARIABLE_DECLARATION_IN_BLOCK_CONTROL)) { if (LexerUtils.equals(varName, var.getName(), false, false)) { locations.add( Pair.of(
@Override public void implement() throws Exception { Configuration conf = Configuration.get(snapshot.getSource().getFileObject()); if(elementContextName != null) { //attr in context Tag tag = conf.getTag(elementContextName); if(tag == null) { //no custom element found => may be html element => just create attribute as global + specify context //contextfree attribute for(String aName : attributeNames) { Attribute attribute = new Attribute(aName); attribute.addContext(elementContextName); conf.add(attribute); } } else { //in custom element for(String aName : attributeNames) { tag.add( new Attribute(aName)); } } } else { //contextfree attribute for(String aName : attributeNames) { conf.add(new Attribute(aName)); } } conf.store(); LexerUtils.rebuildTokenHierarchy(snapshot.getSource().getDocument(true)); }
for (CPElement mixin : model.getMixins()) { if (mixin.getType() == CPElementType.MIXIN_DECLARATION) { if (LexerUtils.equals(searchedMixinName, mixin.getName(), false, false)) { locations.add( Pair.of(new CPCslElementHandle(