本文整理汇总了Java中com.intellij.lang.properties.parsing.PropertiesTokenTypes类的典型用法代码示例。如果您正苦于以下问题:Java PropertiesTokenTypes类的具体用法?Java PropertiesTokenTypes怎么用?Java PropertiesTokenTypes使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropertiesTokenTypes类属于com.intellij.lang.properties.parsing包,在下文中一共展示了PropertiesTokenTypes类的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createLeaf
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
@Override
@Nullable
public LeafElement createLeaf(@NotNull final IElementType type, @NotNull CharSequence text) {
if (type == PropertiesTokenTypes.KEY_CHARACTERS) {
return new PropertyKeyImpl(type, text);
}
if (type == PropertiesTokenTypes.VALUE_CHARACTERS) {
return new PropertyValueImpl(type, text);
}
if (type == PropertiesTokenTypes.END_OF_LINE_COMMENT) {
return new PsiCommentImpl(type, text);
}
return new LeafPsiElement(type, text);
}
示例2: getKeyValueDelimiter
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
@Nullable
public Character getKeyValueDelimiter() {
final PsiElement delimiter = findChildByType(PropertiesTokenTypes.KEY_VALUE_SEPARATOR);
if (delimiter == null) {
return null;
}
String separatorText = delimiter.getText();
if (separatorText.isEmpty()) {
return null;
}
separatorText = separatorText.trim();
if (separatorText.isEmpty()) {
separatorText = " ";
}
LOG.assertTrue(separatorText.length() == 1, "\"" + separatorText + "\"");
return separatorText.charAt(0);
}
示例3: advance
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
public void advance() {
final IElementType tokenType = getDelegate().getTokenType();
if (tokenType == PropertiesTokenTypes.KEY_CHARACTERS) {
scanWordsInToken(UsageSearchContext.IN_CODE | UsageSearchContext.IN_FOREIGN_LANGUAGES | UsageSearchContext.IN_PLAIN_TEXT, false, false);
}
else if (PropertiesTokenTypes.COMMENTS.contains(tokenType)) {
scanWordsInToken(UsageSearchContext.IN_COMMENTS | UsageSearchContext.IN_PLAIN_TEXT, false, false);
advanceTodoItemCountsInToken();
}
else {
scanWordsInToken(UsageSearchContext.IN_CODE | UsageSearchContext.IN_FOREIGN_LANGUAGES | UsageSearchContext.IN_PLAIN_TEXT, false, false);
}
getDelegate().advance();
}
示例4: handleEnterInPropertiesFile
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
private static void handleEnterInPropertiesFile(final Editor editor,
final Document document,
final PsiElement psiAtOffset,
int caretOffset) {
String text = document.getText();
String line = text.substring(0, caretOffset);
int i = line.lastIndexOf('\n');
if (i > 0) {
line = line.substring(i);
}
final String toInsert;
if (PropertiesUtil.isUnescapedBackSlashAtTheEnd(line)) {
toInsert = "\n ";
}
else {
final IElementType elementType = psiAtOffset == null ? null : psiAtOffset.getNode().getElementType();
if (elementType == PropertiesTokenTypes.VALUE_CHARACTERS) {
toInsert = "\\\n ";
}
else if (elementType == PropertiesTokenTypes.END_OF_LINE_COMMENT && "#!".indexOf(document.getText().charAt(caretOffset)) == -1) {
toInsert = "\n#";
}
else {
toInsert = "\n";
}
}
document.insertString(caretOffset, toInsert);
caretOffset+=toInsert.length();
editor.getCaretModel().moveToOffset(caretOffset);
editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
editor.getSelectionModel().removeSelection();
}
示例5: replaceKeyValueDelimiterWithDefault
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
public void replaceKeyValueDelimiterWithDefault() {
PropertyImpl property = (PropertyImpl)PropertiesElementFactory.createProperty(getProject(), "yyy", "xxx");
final ASTNode oldDelimiter = getNode().findChildByType(PropertiesTokenTypes.KEY_VALUE_SEPARATOR);
LOG.assertTrue(oldDelimiter != null);
final ASTNode newDelimiter = property.getNode().findChildByType(PropertiesTokenTypes.KEY_VALUE_SEPARATOR);
LOG.assertTrue(newDelimiter != null);
getNode().replaceChild(oldDelimiter, newDelimiter);
}
示例6: PropertiesHighlightingLexer
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
public PropertiesHighlightingLexer() {
super(new PropertiesLexer());
registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR, PropertiesTokenTypes.VALUE_CHARACTERS, true, "#!=:"),
new IElementType[]{PropertiesTokenTypes.VALUE_CHARACTERS},
IElementType.EMPTY_ARRAY);
registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR, PropertiesTokenTypes.KEY_CHARACTERS, true, "#!=: "),
new IElementType[]{PropertiesTokenTypes.KEY_CHARACTERS},
IElementType.EMPTY_ARRAY);
}
示例7: registerReferenceProviders
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(PlatformPatterns.psiElement(PropertiesTokenTypes.VALUE_CHARACTERS), new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
if (!DGMUtil.isInDGMFile(element)) return PsiReference.EMPTY_ARRAY;
IProperty parent = (IProperty)element.getParent();
if (!"extensionClasses".equals(parent.getName())) {
return PsiReference.EMPTY_ARRAY;
}
ArrayList<PsiReference> result = new ArrayList<PsiReference>();
String text = element.getText();
int i = 0;
while ((i = skipWhiteSpace(i, text)) < text.length()) {
int end = findWhiteSpaceOrComma(i, text);
if (end <= text.length()) {
JavaClassReferenceSet set = new JavaClassReferenceSet(text.substring(i, end), element, i, true, myProvider);
ContainerUtil.addAll(result, set.getAllReferences());
}
i = end;
i = skipWhiteSpace(i, text);
if (i == text.length()) break;
if (text.charAt(i) == ',') i++;
i = skipWhiteSpace(i, text);
}
return result.toArray(new PsiReference[result.size()]);
}
});
}
示例8: registerReferenceProviders
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
@Override
public void registerReferenceProviders(@NotNull PsiReferenceRegistrar registrar) {
CndReferenceProvider cndReferenceProvider = new CndReferenceProvider();
registrar.registerReferenceProvider(PlatformPatterns.psiElement(PsiLiteralExpression.class), cndReferenceProvider); //Java
registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.SUPER_TYPE), cndReferenceProvider); //Cnd super types
registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.EXTENSION), cndReferenceProvider); //Cnd extends types
registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.SUB_NODE_TYPE), cndReferenceProvider); //Cnd subnode types
registrar.registerReferenceProvider(PlatformPatterns.psiElement(CndTypes.SUB_NODE_DEFAULT_TYPE), cndReferenceProvider); //Cnd subnode default type
registrar.registerReferenceProvider(PlatformPatterns.psiElement(XmlElementType.XML_ATTRIBUTE_VALUE), cndReferenceProvider); //XML
registrar.registerReferenceProvider(PlatformPatterns.psiElement(PropertiesTokenTypes.KEY_CHARACTERS), cndReferenceProvider); //Properties
}
示例9: createLeaf
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
@Nullable
public LeafElement createLeaf(final IElementType type, CharSequence text) {
if (type == PropertiesTokenTypes.VALUE_CHARACTERS) {
return new PropertyValueImpl(type, text);
}
if (type == PropertiesTokenTypes.END_OF_LINE_COMMENT) {
return new PsiCommentImpl(type, text);
}
return new LeafPsiElement(type, text);
}
示例10: registerReferenceProviders
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
@Override
public void registerReferenceProviders(PsiReferenceRegistrar registrar) {
registrar.registerReferenceProvider(PlatformPatterns.psiElement(PropertiesTokenTypes.VALUE_CHARACTERS), new PsiReferenceProvider() {
@NotNull
@Override
public PsiReference[] getReferencesByElement(@NotNull PsiElement element, @NotNull ProcessingContext context) {
if (!DGMUtil.isInDGMFile(element)) return PsiReference.EMPTY_ARRAY;
IProperty parent = (IProperty)element.getParent();
if (!"extensionClasses".equals(parent.getName())) {
return PsiReference.EMPTY_ARRAY;
}
ArrayList<PsiReference> result = new ArrayList<PsiReference>();
String text = element.getText();
int i = 0;
while ((i = skipWhiteSpace(i, text)) < text.length()) {
int end = findWhiteSpaceOrComma(i, text);
if (end <= text.length()) {
JavaClassReferenceSet set = new JavaClassReferenceSet(text.substring(i, end), element, i, true, myProvider);
ContainerUtil.addAll(result, set.getAllReferences());
}
i = end;
i = skipWhiteSpace(i, text);
if (i == text.length()) break;
if (text.charAt(i) == ',') i++;
i = skipWhiteSpace(i, text);
}
return result.toArray(new PsiReference[result.size()]);
}
});
}
示例11: getKeyNode
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
@Nullable
public ASTNode getKeyNode() {
return getNode().findChildByType(PropertiesTokenTypes.KEY_CHARACTERS);
}
示例12: getValueNode
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
@Nullable
public ASTNode getValueNode() {
return getNode().findChildByType(PropertiesTokenTypes.VALUE_CHARACTERS);
}
示例13: PropertiesValueHighlightingLexer
import com.intellij.lang.properties.parsing.PropertiesTokenTypes; //导入依赖的package包/类
public PropertiesValueHighlightingLexer() {
super(new DummyLexer(PropertiesTokenTypes.VALUE_CHARACTERS));
registerSelfStoppingLayer(new StringLiteralLexer(StringLiteralLexer.NO_QUOTE_CHAR, PropertiesTokenTypes.VALUE_CHARACTERS, true, "#!=:"),
new IElementType[]{PropertiesTokenTypes.VALUE_CHARACTERS}, IElementType.EMPTY_ARRAY);
}