本文整理汇总了Java中com.intellij.plugins.haxe.util.UsefulPsiTreeUtil类的典型用法代码示例。如果您正苦于以下问题:Java UsefulPsiTreeUtil类的具体用法?Java UsefulPsiTreeUtil怎么用?Java UsefulPsiTreeUtil使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
UsefulPsiTreeUtil类属于com.intellij.plugins.haxe.util包,在下文中一共展示了UsefulPsiTreeUtil类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: HaxeParameterModel
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
public HaxeParameterModel(HaxeParameter parameter) {
super(parameter);
this.parameter = parameter;
this.optional = UsefulPsiTreeUtil.getToken(parameter, "?") != null;
final PsiMember parentPsi = PsiTreeUtil.getParentOfType(parameter, HaxeEnumValueDeclaration.class, HaxeMethod.class);
if (parentPsi instanceof HaxeMethod) {
memberModel = ((HaxeMethod)parentPsi).getModel();
}
else if (parentPsi instanceof HaxeEnumValueDeclaration) {
memberModel = new HaxeFieldModel((HaxePsiField)parentPsi);
}
else {
memberModel = null;
}
}
示例2: remove
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
public void remove() {
PsiElement psi = getBasePsi();
if (psi != null) {
PsiElement prePsi = UsefulPsiTreeUtil.getPrevSiblingSkipWhiteSpaces(psi, true);
PsiElement nextPsi = UsefulPsiTreeUtil.getNextSiblingNoSpaces(psi);
TextRange range = psi.getTextRange();
StripSpaces stripSpaces = StripSpaces.NONE;
if (prePsi != null && prePsi.getText().equals(",")) {
range = range.union(prePsi.getTextRange());
stripSpaces = StripSpaces.BEFORE;
}
else if (nextPsi != null && nextPsi.getText().equals(",")) {
range = range.union(nextPsi.getTextRange());
stripSpaces = StripSpaces.AFTER;
}
getDocument().replaceElementText(range, "", stripSpaces);
}
}
示例3: getMembersSelf
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
@NotNull
public List<HaxeMemberModel> getMembersSelf() {
LinkedList<HaxeMemberModel> members = new LinkedList<HaxeMemberModel>();
HaxeClassBody body = UsefulPsiTreeUtil.getChild(haxeClass, HaxeClassBody.class);
if (body != null) {
for (PsiElement element : body.getChildren()) {
if (element instanceof HaxeMethod || element instanceof HaxeVarDeclaration) {
HaxeMemberModel model = HaxeMemberModel.fromPsi(element);
if (model != null) {
members.add(model);
}
}
}
}
return members;
}
示例4: checkMethod
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
static private void checkMethod(PsiElement element, HaxeExpressionEvaluatorContext context) {
//final ResultHolder retval = context.getReturnType();
if (!(element instanceof HaxeMethod)) return;
final HaxeTypeTag typeTag = UsefulPsiTreeUtil.getChild(element, HaxeTypeTag.class);
ResultHolder expectedType = SpecificTypeReference.getDynamic(element).createHolder();
if (typeTag == null) {
final List<ReturnInfo> infos = context.getReturnInfos();
if (!infos.isEmpty()) {
expectedType = infos.get(0).type;
}
} else {
expectedType = getTypeFromTypeTag(typeTag, element);
}
if (expectedType == null) return;
for (ReturnInfo retinfo : context.getReturnInfos()) {
if (expectedType.canAssign(retinfo.type)) continue;
context.addError(
retinfo.element,
"Can't return " + retinfo.type + ", expected " + expectedType.toStringWithoutConstant()
);
}
}
示例5: hasPublicAccessor
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
private static boolean hasPublicAccessor(HaxePsiCompositeElement element) {
// do not change the order of these if-statements
if (UsefulPsiTreeUtil.getChildOfType(element, HaxeTokenTypes.KPRIVATE) != null) {
return false; // private
}
if (UsefulPsiTreeUtil.getChildOfType(element, HaxeTokenTypes.KPUBLIC) != null) {
return true; // public
}
final HaxeDeclarationAttribute[] declarationAttributeList = PsiTreeUtil.getChildrenOfType(element, HaxeDeclarationAttribute.class);
if (declarationAttributeList != null) {
final Set<IElementType> declarationTypes = HaxeResolveUtil.getDeclarationTypes((declarationAttributeList));
// do not change the order of these if-statements
if (declarationTypes.contains(HaxeTokenTypes.KPRIVATE)) {
return false; // private
}
if (declarationTypes.contains(HaxeTokenTypes.KPUBLIC)) {
return true; // public
}
}
return false; // <default>: private
}
示例6: updateModule
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
private void updateModule(Module module) {
if (module == null) {
return;
}
myComboRunnerClasses.removeAllItems();
ModuleRootManager rootManager = ModuleRootManager.getInstance(module);
List<VirtualFile> roots = rootManager.getSourceRoots(JavaSourceRootType.TEST_SOURCE);
List<HaxeClass> classList = new ArrayList<HaxeClass>();
for (VirtualFile testSourceRoot : roots) {
classList.addAll(UsefulPsiTreeUtil.getClassesInDirectory(module.getProject(), testSourceRoot));
}
classList.size();
for (HaxeClass haxeClass : classList) {
myComboRunnerClasses.addItem(haxeClass);
}
}
示例7: getExpressionIndexBeforeRightParen
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
private int getExpressionIndexBeforeRightParen(List<HaxeExpression> list) {
final int listSize = list.size();
final PsiElement commaExpression = (UsefulPsiTreeUtil.getNextSiblingSkippingCondition(list.get(listSize-1), new Condition<PsiElement>() {
@Override
public boolean value(PsiElement element) {
return !(element instanceof HaxePsiToken && element.getText().equals(HaxeTokenTypes.OCOMMA.toString()));
}
}, false));
if (commaExpression != null) {
return listSize;
}
else {
return listSize - 1;
}
}
示例8: getProperties
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
@Nullable
public List<String> getProperties(@NotNull String propertyName) {
if (propertyName.isEmpty()) {
return null;
}
List<String> found = null;
HXMLProperty[] properties = UsefulPsiTreeUtil.getChildrenOfType(psiFile, HXMLProperty.class, null);
if (null != properties) {
for (HXMLProperty foundProperty : properties) {
HXMLOption option = foundProperty.getOption();
if (null != option && propertyName.equals(option.getText())) {
HXMLValue val = foundProperty.getValue();
if (val != null) {
if (found == null) {
found = new ArrayList<String>();
}
found.add(val.getText());
}
}
}
}
return found;
}
示例9: getNamePsi
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
public HaxeComponentName getNamePsi() {
HaxeComponentName componentName = UsefulPsiTreeUtil.getChild(basePsi, HaxeComponentName.class);
if (componentName != null && componentName.getParent() instanceof HaxeNamedComponent) {
return componentName;
}
return null;
}
示例10: getAbstractToList
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
public List<HaxeType> getAbstractToList() {
if (!isAbstract()) return Collections.emptyList();
List<HaxeType> types = new LinkedList<HaxeType>();
for (HaxeIdentifier id : UsefulPsiTreeUtil.getChildren(haxeClass, HaxeIdentifier.class)) {
if (id.getText().equals("to")) {
PsiElement sibling = UsefulPsiTreeUtil.getNextSiblingNoSpaces(id);
if (sibling instanceof HaxeType) {
types.add((HaxeType)sibling);
}
}
}
return types;
}
示例11: getAbstractFromList
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
public List<HaxeType> getAbstractFromList() {
if (!isAbstract()) return Collections.emptyList();
List<HaxeType> types = new LinkedList<HaxeType>();
for (HaxeIdentifier id : UsefulPsiTreeUtil.getChildren(haxeClass, HaxeIdentifier.class)) {
if (id.getText().equals("from")) {
PsiElement sibling = UsefulPsiTreeUtil.getNextSiblingNoSpaces(id);
if (sibling instanceof HaxeType) {
types.add((HaxeType)sibling);
}
}
}
return types;
}
示例12: getParameters
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
public List<HaxeParameterModel> getParameters() {
List<HaxeParameterModel> _parameters = new ArrayList<HaxeParameterModel>();
HaxeParameterList parameterList = UsefulPsiTreeUtil.getChild(this.haxeMethod, HaxeParameterList.class);
if (parameterList != null) {
for (HaxeParameter parameter : parameterList.getParameterList()) {
_parameters.add(new HaxeParameterModel(parameter));
}
}
return _parameters;
}
示例13: isArrayAccessor
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
public boolean isArrayAccessor() {
// Would be nice if this worked, but it won't until the lexer and/or parser stops using MACRO_ID:
// return null != UsefulPsiTreeUtil.getChild(this.haxeMethod, HaxeArrayAccessMeta.class);
for (HaxeCustomMeta meta : UsefulPsiTreeUtil.getChildren(this.getMethodPsi(), HaxeCustomMeta.class)) {
if ("@:arrayAccess".equals(meta.getText())) {
return true;
}
}
return false;
}
示例14: getUseScope
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
@NotNull
@Override
public SearchScope getUseScope() {
final PsiElement localVar = UsefulPsiTreeUtil.getParentOfType(this, HaxeLocalVarDeclaration.class);
if(localVar != null) {
final PsiElement outerBlock = UsefulPsiTreeUtil.getParentOfType(localVar, HaxeBlockStatement.class);
if(outerBlock != null) {
return new LocalSearchScope(outerBlock);
}
}
return super.getUseScope();
}
示例15: getUseScope
import com.intellij.plugins.haxe.util.UsefulPsiTreeUtil; //导入依赖的package包/类
@NotNull
@Override
public SearchScope getUseScope() {
if(this instanceof HaxeLocalFunctionDeclaration) {
final PsiElement outerBlock = UsefulPsiTreeUtil.getParentOfType(this, HaxeBlockStatement.class);
if(outerBlock != null) {
return new LocalSearchScope(outerBlock);
}
}
return super.getUseScope();
}