当前位置: 首页>>代码示例>>Java>>正文


Java IHighlightedPositionAcceptor类代码示例

本文整理汇总了Java中org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor的典型用法代码示例。如果您正苦于以下问题:Java IHighlightedPositionAcceptor类的具体用法?Java IHighlightedPositionAcceptor怎么用?Java IHighlightedPositionAcceptor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


IHighlightedPositionAcceptor类属于org.eclipse.xtext.ui.editor.syntaxcoloring包,在下文中一共展示了IHighlightedPositionAcceptor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: highlightSpecialIdentifiers

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
@Override
protected void highlightSpecialIdentifiers(final IHighlightedPositionAcceptor acceptor, final ICompositeNode root) {
  TerminalRule idRule = grammarAccess.getIDRule();

  for (ILeafNode leaf : root.getLeafNodes()) {
    if (commentProvider.isJavaDocComment(leaf)) {
      // not really a special identifier, but we don't want to iterate over the leaf nodes twice, do we?
      acceptor.addPosition(leaf.getOffset(), leaf.getLength(), CheckHighlightingConfiguration.JAVADOC_ID);
    } else if (!leaf.isHidden()) {
      if (leaf.getGrammarElement() instanceof Keyword) {
        // Check if it is a keyword used as an identifier.
        ParserRule rule = GrammarUtil.containingParserRule(leaf.getGrammarElement());
        if (FEATURE_CALL_ID_RULE_NAME.equals(rule.getName())) {
          acceptor.addPosition(leaf.getOffset(), leaf.getLength(), DefaultHighlightingConfiguration.DEFAULT_ID);
        }
      } else {
        highlightSpecialIdentifiers(leaf, acceptor, idRule);
      }
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:22,代码来源:CheckHighlightingCalculator.java

示例2: provideHighlightingFor

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
public void provideHighlightingFor(XtextResource resource, IHighlightedPositionAcceptor acceptor) {
	if (resource == null)
		return;
	IParseResult parseResult = resource.getParseResult();
	if (parseResult == null)
		return;
	INode root = parseResult.getRootNode();
	Iterator<ILeafNode> leafNodesIt = root.getLeafNodes().iterator();

	while (leafNodesIt.hasNext()) {
		ILeafNode nextLeaf = leafNodesIt.next();
		EObject semanticElement = nextLeaf.getSemanticElement();
		if (semanticElement instanceof POperand) {
			acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), SqlHighlightingConfiguration.PARAM_TOKEN);
		} else if (semanticElement instanceof ExpOperand) {
			acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), SqlHighlightingConfiguration.PARAM_TOKEN);
		} else if (semanticElement instanceof XExpr) {
			acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), SqlHighlightingConfiguration.XEXPRESSION_TOKEN);
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:22,代码来源:SqlHighlightingCalculator.java

示例3: setStyles

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
private void setStyles( IHighlightedPositionAcceptor acceptor, BidiIterator<INode> it, String...styles )
{
	for( String s : styles )
	{
		if( !it.hasNext() ) return;
		INode n = skipWhiteSpace( acceptor, it );
		if( n != null && s != null ) acceptor.addPosition( n.getOffset(), n.getLength(), s );
	}
}
 
开发者ID:jason-lang,项目名称:jason-eclipse-plugin,代码行数:10,代码来源:AslHighlightingCalculator.java

示例4: skipWhiteSpace

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
private INode skipWhiteSpace( IHighlightedPositionAcceptor acceptor, BidiIterator<INode> it )
{
	INode n = null;
	
	while ( it.hasNext() && ( n = it.next() ).getClass() == HiddenLeafNode.class )
		processHiddenNode( acceptor, (HiddenLeafNode)n );
	return n;
}
 
开发者ID:jason-lang,项目名称:jason-eclipse-plugin,代码行数:9,代码来源:AslHighlightingCalculator.java

示例5: processHiddenNode

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
private void processHiddenNode( IHighlightedPositionAcceptor acceptor, HiddenLeafNode node )
{
	if( node.getGrammarElement() instanceof TerminalRule )
	{
		TerminalRule ge = (TerminalRule) node.getGrammarElement();
		
		if (ge.getName().equalsIgnoreCase("SL_COMMENT"))
			setStyle(acceptor, node, COMMENT_SINGLE);
			
		if (ge.getName().equalsIgnoreCase("ML_COMMENT"))
			setStyle(acceptor, node, COMMENT_MULTI);
	}
}
 
开发者ID:jason-lang,项目名称:jason-eclipse-plugin,代码行数:14,代码来源:AslHighlightingCalculator.java

示例6: provideHighlightingFor

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
/** {@inheritDoc} */
public void provideHighlightingFor(final XtextResource resource, final IHighlightedPositionAcceptor acceptor) {
  if (resource == null) {
    return;
  }
  Iterator<EObject> iter = EcoreUtil.getAllContents(resource, true);
  while (iter.hasNext()) {
    EObject current = iter.next();

    if (current instanceof ConfiguredCheck && ((ConfiguredCheck) current).getSeverity().equals(SeverityKind.IGNORE)) {
      INode node = getFirstParseTreeNode(current, CheckcfgPackage.Literals.CONFIGURED_CHECK__CHECK);
      highlightNode(node, SemanticHighlightingConfiguration.DISABLED_VALUE_ID, acceptor);
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:16,代码来源:SemanticHighlightingCalculator.java

示例7: highlightNode

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
/**
 * Highlights a given parse tree node.
 * 
 * @param node
 *          the node from the parse tree
 * @param id
 *          the id of the configuration
 * @param acceptor
 *          the acceptor
 */
private void highlightNode(final INode node, final String id, final IHighlightedPositionAcceptor acceptor) {
  if (node == null) {
    return;
  }
  if (node instanceof ILeafNode) {
    acceptor.addPosition(node.getOffset(), node.getLength(), id);
  } else {
    for (ILeafNode leaf : node.getLeafNodes()) {
      if (!leaf.isHidden()) {
        acceptor.addPosition(leaf.getOffset(), leaf.getLength(), id);
      }
    }
  }
}
 
开发者ID:dsldevkit,项目名称:dsl-devkit,代码行数:25,代码来源:SemanticHighlightingCalculator.java

示例8: provideHighlightingFor

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
@Override
public void provideHighlightingFor(XtextResource resource,
		IHighlightedPositionAcceptor acceptor) {
	
	INode root = resource.getParseResult().getRootNode();
       BidiTreeIterator<INode> it = root.getAsTreeIterable().iterator();
       while( it.hasNext() )
       {
       	INode node = it.next();
   		String nodeType="";
   		EObject semanticElement = node.getSemanticElement();
       	if( node instanceof CompositeNodeWithSemanticElement)
       	{
       		if(semanticElement instanceof Spec )
       			nodeType=SpecHighlightingConfiguration.SPEC;
       		else if( semanticElement instanceof Scenario )
       			nodeType=SpecHighlightingConfiguration.SCENARIO;
       		else if( semanticElement instanceof Tags)
       			nodeType=SpecHighlightingConfiguration.TAGS;
       		else if( semanticElement instanceof StaticParam )
       			nodeType=SpecHighlightingConfiguration.STATIC_PARAM;
       		else if( semanticElement instanceof DynamicParam)
       			nodeType=SpecHighlightingConfiguration.DYNAMIC_PARAM;
       		else if( semanticElement instanceof Step )
       			nodeType=SpecHighlightingConfiguration.STEP;
       		else
       			nodeType=SpecHighlightingConfiguration.DEFAULT;
       	}
		acceptor.addPosition(node.getOffset(), node.getLength(), nodeType);
       }
}
 
开发者ID:getgauge-contrib,项目名称:Gauge-Eclipse,代码行数:32,代码来源:SpecHighlightingCalculator.java

示例9: provideStringPatternHighlight

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
/**
 * Provide the highlighting of the referred variables. This includes the determination of all
 * strings that match the regular expressions "\\$\\s*\\{\\s*.*?\\s*\\}" or "\\$\\s*.*?/".
 * By default, referred variables will be highlighted in bold. This highlighting may be customized
 * by the user using the VIL/VTL preference page in Eclipse
 *  
 * @param rootNode the root node of the parse tree which holds the text of the entire VIL-file.
 * @param acceptor the acceptor for adding the positions that should be highlighted individually.
 */
private void provideStringPatternHighlight(INode rootNode, IHighlightedPositionAcceptor acceptor) {
    String fullText = rootNode.getText();
    Matcher matcher = Pattern.compile(COMPLEX_HIGHLIGHT_REGEX).matcher(fullText);
    while (matcher.find()) {
        acceptor.addPosition(matcher.start(),  matcher.end() - matcher.start(), VilHighlightingConfiguration.REFERRED_VARIABLES);
    }
    matcher = Pattern.compile(SIMPLE_HIGHLIGHT_REGEX).matcher(fullText);
    while (matcher.find()) {
        acceptor.addPosition(matcher.start(),  matcher.end() - matcher.start() - 1, VilHighlightingConfiguration.REFERRED_VARIABLES);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:21,代码来源:VilHighlightingCalculator.java

示例10: provideHighlightingFor

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
public void provideHighlightingFor(XtextResource resource, IHighlightedPositionAcceptor acceptor ) {
		if(resource == null || resource.getParseResult()==null) return;
		
//		INode root = resource.getParseResult().getRootNode();
//		BidiTreeIterator<INode> it = root.getAsTreeIterable().iterator();
		
//		while(it.hasNext()) {
//			INode node = it.next();
//			if(node instanceof CompositeNodeWithSemanticElement && node.getSemanticElement() instanceof OperateurBinaire) {
//				OperateurBinaire bin = (OperateurBinaire) node.getSemanticElement();
//				acceptor.addPosition(0, 1, ExpHighlightingConfiguration.EXP_ELT);
//				provideHighlightingFor()
//			}
//		}
	}
 
开发者ID:diverse-project,项目名称:k3,代码行数:16,代码来源:ExpHighlightingCalculator.java

示例11: provideHighlightingFor

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
public void provideHighlightingFor( XtextResource resource, IHighlightedPositionAcceptor acceptor )
{
	if ( resource == null || resource.getParseResult() == null ) return;

	INode root = resource.getParseResult().getRootNode();
	BidiTreeIterator<INode> it = root.getAsTreeIterable().iterator();
	while (it.hasNext()) {
		INode node = it.next();
		if (node == null) continue;
		
		if (node instanceof HiddenLeafNode && node.getGrammarElement() instanceof TerminalRuleImpl) {
			TerminalRuleImpl ge = (TerminalRuleImpl) node.getGrammarElement();
			
			if (ge.getName().equalsIgnoreCase("SL_COMMENT"))
				setStyle(acceptor, node, COMMENT_SINGLE);
				
			if (ge.getName().equalsIgnoreCase("ML_COMMENT"))
				setStyle(acceptor, node, COMMENT_MULTI);
		} else if (node.getGrammarElement() != null && node.getGrammarElement() instanceof Keyword) {
			Keyword k = (Keyword) node.getGrammarElement();
			if (ALL_KEYWORDS.contains(k.getValue())) {
				setStyle( acceptor, node, KEYWORD);
			} else if (ALL_SYMBOLS.contains(k.getValue())) {
				setStyle( acceptor, node, SYMBOL);
			} else if (ALL_RESERVED_WORDS.contains(k.getValue())) {
				setStyle( acceptor, node, RESERVED_WORD);
			}
		} else if (node instanceof LeafNode && node.getSemanticElement() != null) {
			if (node.getSemanticElement() instanceof ClsDef) {
				ClsDef cls = (ClsDef) node.getSemanticElement();
				if (cls.getInfrastructure() != null && ALL_PREDEFINED_PARAMS.contains(cls.getInfrastructure())) {
					setStyle( acceptor, node, PREDEFINED_PARAM);
				}
			} else if (node.getGrammarElement() != null) {
				if (node.getGrammarElement() instanceof RuleCall) {
					RuleCall rc = (RuleCall) node.getGrammarElement();
					
					if (rc.getRule().getName().equals("STRING")) {
						setStyle( acceptor, node, STRING);
					} else if (rc.getRule().getName().equals("INT_LITERAL")) {
						setStyle( acceptor, node, NUMBER);
					} else {
						//System.out.println("" + node.getOffset() + " " + node.getLength() + node.toString() + " ## " + node.getGrammarElement().toString() + " ## " + node.getSemanticElement().toString() + " // " + rc.getRule().getName());
					}
				}
			}
		} else if (node.getGrammarElement() != null && node.getSemanticElement() != null) {
			//System.out.println("" + node.getOffset() + " " + node.getLength() + node.toString() + " ## " + node.getGrammarElement().toString() + " ## " + node.getSemanticElement().toString());
		}
	}
}
 
开发者ID:jason-lang,项目名称:jason-eclipse-plugin,代码行数:52,代码来源:Mas2jHighlightingCalculator.java

示例12: setStyle

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
private void setStyle(IHighlightedPositionAcceptor acceptor, INode n, String style) {
	if (n != null) {
		acceptor.addPosition( n.getOffset(), n.getLength(), style );
	}
}
 
开发者ID:jason-lang,项目名称:jason-eclipse-plugin,代码行数:6,代码来源:Mas2jHighlightingCalculator.java

示例13: provideHighlightingFor

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
public void provideHighlightingFor(XtextResource resource,
			IHighlightedPositionAcceptor acceptor) {
		for (Iterator<EObject> contents = resource.getAllContents(); contents
				.hasNext();) {
			EObject element = contents.next();
			if (element instanceof Word) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.WORD__WCHAR, acceptor);
			} else if (element instanceof Sentence) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.SENTENCE__ITEMS, acceptor);
//			} else if (element instanceof Marker) {
//				highlightAsDataType(element,
//						EgyDslPackage.Literals.MARKER__NAME, acceptor);
			} else if (element instanceof Case) {
				highlightAsDataType(element, EgyDslPackage.Literals.CASE__NAME,
						acceptor);
			} else if (element instanceof Ambivalence) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.AMBIVALENCE__CASES, acceptor);
			}
			//
			else if (element instanceof Expanded) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.EXPANDED__WCHAR, acceptor);
			} else if (element instanceof Emendation) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.EMENDATION__WCHAR, acceptor);
			} else if (element instanceof DisputableReading) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.DISPUTABLE_READING__WCHAR,
						acceptor);
			} else if (element instanceof Lacuna) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.LACUNA__WCHAR, acceptor);
			} else if (element instanceof Deletion) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.DELETION__WCHAR, acceptor);
			} else if (element instanceof ExpandedColumn) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.EXPANDED_COLUMN__WCHAR, acceptor);
			} else if (element instanceof Rasur) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.RASUR__WCHAR, acceptor);
			} else if (element instanceof AncientExpanded) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.ANCIENT_EXPANDED__WCHAR,
						acceptor);
			} else if (element instanceof RestorationOverRasur) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.RESTORATION_OVER_RASUR__WCHAR,
						acceptor);
			} else if (element instanceof PartialDestruction) {
				highlightAsDataType(element,
						EgyDslPackage.Literals.PARTIAL_DESTRUCTION__WCHAR,
						acceptor);
			} 
//			else if (element instanceof Destruction) {
//				highlightAsDataType(element,
//						EgyDslPackage.Literals.DESTRUCTION__COMMENT, acceptor);
//			}
		}
	}
 
开发者ID:cplutte,项目名称:bts,代码行数:64,代码来源:BTSSemanticHighlightingCalculator.java

示例14: provideHighlightingFor

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
public void provideHighlightingFor(XtextResource resource,
		IHighlightedPositionAcceptor acceptor) {
	if (resource == null)
		return;
	IParseResult parseResult = resource.getParseResult();
	if(parseResult==null)
		return;
	INode root = parseResult.getRootNode();
	Iterator<ILeafNode> leafNodesIt = root.getLeafNodes().iterator();
		
	while (leafNodesIt.hasNext()){
		ILeafNode nextLeaf = leafNodesIt.next();
		EObject semanticElement = nextLeaf.getSemanticElement();
		EObject grammarElement = nextLeaf.getGrammarElement();
		if(!isHiddenToken(grammarElement)) {
			if(semanticElement instanceof StringLiteral){
				acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), JavaJRExpressionHighlightingConfiguration.STRING_ID);
			}
			else if(semanticElement instanceof JRParameterObj){
				acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), JavaJRExpressionHighlightingConfiguration.PARAM_TOKEN);
			}
			else if(semanticElement instanceof JRVariableObj){
				System.out.println(nextLeaf.getGrammarElement());
				acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), JavaJRExpressionHighlightingConfiguration.VARIABLE_TOKEN);
			}
			else if(semanticElement instanceof JRFieldObj){
				acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), JavaJRExpressionHighlightingConfiguration.FIELD_TOKEN);
			}
			else if(semanticElement instanceof JRResourceBundleKeyObj) {
				acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), JavaJRExpressionHighlightingConfiguration.RESOURCE_BUNDLE_KEY);
			}
			else if(semanticElement instanceof FullMethodName){
				if(JRExpressionsModelUtil.isFunctionLibrary((FullMethodName)semanticElement)){
					acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), JavaJRExpressionHighlightingConfiguration.FUNCTION_METHOD);
				}
			}
			else if(isNumberElement(semanticElement)){
				acceptor.addPosition(nextLeaf.getOffset(), nextLeaf.getLength(), DefaultHighlightingConfiguration.NUMBER_ID);
			}
		}
	}
}
 
开发者ID:OpenSoftwareSolutions,项目名称:PDFReporter-Studio,代码行数:43,代码来源:JavaJRExpressionHighlightingCalculator.java

示例15: provideHighlightingFor

import org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor; //导入依赖的package包/类
@Override
public void provideHighlightingFor(XtextResource resource, IHighlightedPositionAcceptor acceptor) {
    if (hasRootNode(resource)) {
        provideStringPatternHighlight(resource.getParseResult().getRootNode(), acceptor);
    }
}
 
开发者ID:SSEHUB,项目名称:EASyProducer,代码行数:7,代码来源:VilHighlightingCalculator.java


注:本文中的org.eclipse.xtext.ui.editor.syntaxcoloring.IHighlightedPositionAcceptor类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。