本文整理汇总了Java中com.intellij.util.xml.DomUtil类的典型用法代码示例。如果您正苦于以下问题:Java DomUtil类的具体用法?Java DomUtil怎么用?Java DomUtil使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
DomUtil类属于com.intellij.util.xml包,在下文中一共展示了DomUtil类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: DomElementsToggleAction
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
public DomElementsToggleAction(final DomModelTreeView treeView, final Class aClass) {
myTreeView = treeView;
myClass = aClass;
Icon myIcon = ElementPresentationManager.getIcon(myClass);
if (myIcon == null) {
myIcon = AllIcons.Nodes.Pointcut;
}
this.myIcon = myIcon;
myText = TypePresentationService.getService().getTypePresentableName(myClass);
if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(AbstractDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap<Class, Boolean>());
if(getHiders().get(myClass) == null) getHiders().put(myClass, true);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:DomElementsToggleAction.java
示例2: createAddingAction
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@Override
protected AnAction createAddingAction(final AnActionEvent e,
final String name,
final Icon icon,
final Type type,
final DomCollectionChildDescription description) {
final DomElement parentDomElement = getParentDomElement(e);
if (parentDomElement instanceof MergedObject) {
final List<DomElement> implementations = (List<DomElement>)((MergedObject)parentDomElement).getImplementations();
final DefaultActionGroup actionGroup = new DefaultActionGroup(name, true);
for (DomElement implementation : implementations) {
final XmlFile xmlFile = DomUtil.getFile(implementation);
actionGroup.add(new MyDefaultAddAction(implementation, xmlFile.getName(), xmlFile.getIcon(0), e, type, description));
}
return actionGroup;
}
return new MyDefaultAddAction(parentDomElement, name, icon, e, type, description);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AddElementInCollectionAction.java
示例3: actionPerformed
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
final SimpleNode selectedNode = treeView.getTree().getSelectedNode();
if (selectedNode instanceof BaseDomElementNode) {
if (selectedNode instanceof DomFileElementNode) {
e.getPresentation().setVisible(false);
return;
}
final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();
final int ret = Messages.showOkCancelDialog(getPresentationText(selectedNode, "Remove") + "?", "Remove",
Messages.getQuestionIcon());
if (ret == Messages.OK) {
new WriteCommandAction(domElement.getManager().getProject(), DomUtil.getFile(domElement)) {
@Override
protected void run(@NotNull final Result result) throws Throwable {
domElement.undefine();
}
}.execute();
}
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:DeleteDomElement.java
示例4: getProblemHolder
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@Override
@NotNull
public DomElementsProblemsHolder getProblemHolder(DomElement element) {
if (element == null || !element.isValid()) return EMPTY_PROBLEMS_HOLDER;
final DomFileElement<DomElement> fileElement = DomUtil.getFileElement(element);
synchronized (LOCK) {
final XmlTag tag = fileElement.getRootElement().getXmlTag();
if (tag != null) {
final DomElementsProblemsHolder readyHolder = tag.getUserData(DOM_PROBLEM_HOLDER_KEY);
if (readyHolder != null) {
return readyHolder;
}
}
return EMPTY_PROBLEMS_HOLDER;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:DomElementAnnotationsManagerImpl.java
示例5: getHighlightStatus
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@NotNull
public DomHighlightStatus getHighlightStatus(final DomElement element) {
synchronized (LOCK) {
final DomFileElement<DomElement> root = DomUtil.getFileElement(element);
if (!isHolderOutdated(root.getFile())) {
final DomElementsProblemsHolder holder = getProblemHolder(element);
if (holder instanceof DomElementsProblemsHolderImpl) {
DomElementsProblemsHolderImpl holderImpl = (DomElementsProblemsHolderImpl)holder;
final List<DomElementsInspection> suitableInspections = getSuitableDomInspections(root, true);
final DomElementsInspection mockInspection = getMockInspection(root);
final boolean annotatorsFinished = mockInspection == null || holderImpl.isInspectionCompleted(mockInspection);
final boolean inspectionsFinished = areInspectionsFinished(holderImpl, suitableInspections);
if (annotatorsFinished) {
if (suitableInspections.isEmpty() || inspectionsFinished) return DomHighlightStatus.INSPECTIONS_FINISHED;
return DomHighlightStatus.ANNOTATORS_FINISHED;
}
}
}
return DomHighlightStatus.NONE;
}
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:DomElementAnnotationsManagerImpl.java
示例6: shouldBeShown
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
protected boolean shouldBeShown(final Type type) {
final Map<Class, Boolean> hiders = DomUtil.getFile(getDomElement()).getUserData(TREE_NODES_HIDERS_KEY);
if (type == null || hiders == null || hiders.size() == 0) return true;
final Class aClass = ReflectionUtil.getRawType(type);
List<Class> allParents = new ArrayList<Class>();
for (Map.Entry<Class, Boolean> entry : hiders.entrySet()) {
if (entry.getKey().isAssignableFrom(aClass)) {
allParents.add(entry.getKey());
}
}
if (allParents.size() == 0) return false;
Collections.sort(allParents, INHERITORS_COMPARATOR);
return hiders.get(allParents.get(0)).booleanValue();
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:AbstractDomElementNode.java
示例7: process
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@Nullable
public T process(@NotNull MavenDomProjectModel projectDom) {
MavenDomParent parent = projectDom.getMavenParent();
MavenParentDesc parentDesc = null;
if (DomUtil.hasXml(parent)) {
String parentGroupId = parent.getGroupId().getStringValue();
String parentArtifactId = parent.getArtifactId().getStringValue();
String parentVersion = parent.getVersion().getStringValue();
String parentRelativePath = parent.getRelativePath().getStringValue();
if (StringUtil.isEmptyOrSpaces(parentRelativePath)) parentRelativePath = "../pom.xml";
MavenId parentId = new MavenId(parentGroupId, parentArtifactId, parentVersion);
parentDesc = new MavenParentDesc(parentId, parentRelativePath);
}
return process(myManager.getGeneralSettings(), MavenDomUtil.getVirtualFile(projectDom), parentDesc);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:MavenDomProjectProcessorUtils.java
示例8: changeLanguageLevel
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@Override
public Promise<Void> changeLanguageLevel(@NotNull Module module, @NotNull final LanguageLevel level) {
if (!myProjectsManager.isMavenizedModule(module)) return null;
MavenProject mavenProject = myProjectsManager.findProject(module);
if (mavenProject == null) return null;
final MavenDomProjectModel model = MavenDomUtil.getMavenDomProjectModel(myProject, mavenProject.getFile());
if (model == null) return null;
new WriteCommandAction(myProject, "Add Maven Dependency", DomUtil.getFile(model)) {
@Override
protected void run(@NotNull Result result) throws Throwable {
MavenDomConfiguration configuration = getCompilerPlugin(model).getConfiguration();
XmlTag tag = configuration.ensureTagExists();
setChildTagValue(tag, "source", level.getCompilerComplianceDefaultOption());
setChildTagValue(tag, "target", level.getCompilerComplianceDefaultOption());
Document document = PsiDocumentManager.getInstance(myProject).getDocument(DomUtil.getFile(model));
if (document != null) {
FileDocumentManager.getInstance().saveDocument(document);
}
}
}.execute();
return myProjectsManager.forceUpdateProjects(Collections.singleton(mavenProject));
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:MavenProjectModelModifier.java
示例9: resolve
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
public PsiElement resolve(@NotNull PsiReference psiReference, boolean incompleteCode) {
final PsiElement element = psiReference.getElement();
if (element == null) {
return null;
}
final DomElement domElement = DomUtil.getDomElement(element);
if (domElement == null) {
return null;
}
final AntDomMacroDef macrodef = domElement.getParentOfType(AntDomMacroDef.class, false);
if (macrodef == null) {
return null;
}
final String name = AntStringResolver.computeString(domElement, psiReference.getCanonicalText());
for (AntDomMacrodefAttribute attribute : macrodef.getMacroAttributes()) {
if (name.equals(attribute.getName().getStringValue())) {
final DomTarget target = DomTarget.getTarget(attribute);
return target != null? PomService.convertToPsi(target) : null;
}
}
return null;
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AntDomMacrodefAttributeReference.java
示例10: createLookupElement
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@Nullable
@Override
public LookupElement createLookupElement(ActionOrGroup actionOrGroup) {
if (actionOrGroup instanceof Action) {
Action action = (Action)actionOrGroup;
final PsiElement element = getPsiElement(actionOrGroup);
if (element == null) {
throw new IllegalStateException(action.getId().getStringValue() + " in " + DomUtil.getFile(action) + " " + action.isValid() + " ");
}
LookupElementBuilder builder =
LookupElementBuilder.create(ObjectUtils.assertNotNull(element),
ObjectUtils.assertNotNull(getName(action)));
final String text = action.getText().getStringValue();
if (StringUtil.isNotEmpty(text)) {
String withoutMnemonic = StringUtil.replace(text, "_", "");
builder = builder.withTailText(" \"" + withoutMnemonic + "\"", true);
}
return builder;
}
return super.createLookupElement(actionOrGroup);
}
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:ActionOrGroupResolveConverter.java
示例11: checkIncludes
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
private boolean checkIncludes(PsiFile layoutFile, PsiElement idElement) {
AndroidFacet facet = AndroidFacet.getInstance(idElement);
PsiFile containingFile = idElement.getContainingFile();
DomFileElement<AndroidDomElement> fileElement = DomManager.getDomManager(layoutFile.getProject()).getFileElement((XmlFile) layoutFile, AndroidDomElement.class);
boolean found = false;
if (fileElement != null) {
AndroidDomElement rootElement = fileElement.getRootElement();
List<Include> includes = DomUtil.getChildrenOfType(rootElement, Include.class);
for (Include include : includes) {
ResourceValue value = include.getLayout().getValue();
if (value != null) {
if (facet != null) {
if (value.getResourceType() != null && value.getResourceName() != null) {
List<PsiFile> resourceFiles = facet.getLocalResourceManager().findResourceFiles(value.getResourceType(), value.getResourceName());
if (!resourceFiles.isEmpty()) {
found = isInAllIncludes(idElement, found, resourceFiles);
}
}
}
}
}
}
return found;
}
开发者ID:erikzielke,项目名称:butterknife_inspections,代码行数:27,代码来源:ButterKnifeNoViewWithIdInspection.java
示例12: DomElementsToggleAction
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
public DomElementsToggleAction(final DomModelTreeView treeView, final Class aClass) {
myTreeView = treeView;
myClass = aClass;
Icon myIcon = ElementPresentationManager.getIcon(myClass);
if (myIcon == null) {
myIcon = AllIcons.Nodes.Pointcut;
}
this.myIcon = myIcon;
myText = TypePresentationService.getService().getTypePresentableName(myClass);
if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap<Class, Boolean>());
if(getHiders().get(myClass) == null) getHiders().put(myClass, true);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:17,代码来源:DomElementsToggleAction.java
示例13: createAddingAction
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
protected AnAction createAddingAction(final AnActionEvent e,
final String name,
final Icon icon,
final Type type,
final DomCollectionChildDescription description) {
final DomElement parentDomElement = getParentDomElement(e);
if (parentDomElement instanceof MergedObject) {
final List<DomElement> implementations = (List<DomElement>)((MergedObject)parentDomElement).getImplementations();
final DefaultActionGroup actionGroup = new DefaultActionGroup(name, true);
for (DomElement implementation : implementations) {
final XmlFile xmlFile = DomUtil.getFile(implementation);
actionGroup.add(new MyDefaultAddAction(implementation, xmlFile.getName(), xmlFile.getIcon(0), e, type, description));
}
return actionGroup;
}
return new MyDefaultAddAction(parentDomElement, name, icon, e, type, description);
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:AddElementInCollectionAction.java
示例14: actionPerformed
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
public void actionPerformed(AnActionEvent e, DomModelTreeView treeView) {
final SimpleNode selectedNode = treeView.getTree().getSelectedNode();
if (selectedNode instanceof BaseDomElementNode) {
if (selectedNode instanceof DomFileElementNode) {
e.getPresentation().setVisible(false);
return;
}
final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();
final int ret = Messages.showOkCancelDialog(getPresentationText(selectedNode) + "?", ApplicationBundle.message("action.remove"),
Messages.getQuestionIcon());
if (ret == 0) {
new WriteCommandAction(domElement.getManager().getProject(), DomUtil.getFile(domElement)) {
protected void run(final Result result) throws Throwable {
domElement.undefine();
}
}.execute();
}
}
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:DeleteDomElement.java
示例15: getProblemsMap
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@NotNull
private Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> getProblemsMap(final DomElement domElement) {
final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> map = myCachedChildrenErrors.get(domElement);
if (map != null) {
return map;
}
final Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> problems = new THashMap<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>>();
if (domElement == myElement) {
for (Map<Class<? extends DomElementsInspection>, List<DomElementProblemDescriptor>> listMap : myCachedErrors.values()) {
mergeMaps(problems, listMap);
}
} else {
mergeMaps(problems, myCachedErrors.get(domElement));
if (DomUtil.hasXml(domElement)) {
domElement.acceptChildren(new DomElementVisitor() {
public void visitDomElement(DomElement element) {
mergeMaps(problems, getProblemsMap(element));
}
});
}
}
myCachedChildrenErrors.put(domElement, problems);
return problems;
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:27,代码来源:DomElementsProblemsHolderImpl.java
示例16: invoke
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
public void invoke(@NotNull final Project project, Editor editor, final PsiFile file) throws IncorrectOperationException {
if (!myRef.isValid()) return;
MavenProject mavenProject = MavenDomUtil.findContainingProject(file);
if (mavenProject == null) return;
final List<MavenId> ids = MavenArtifactSearchDialog.searchForClass(project, getReferenceText());
if (ids.isEmpty()) return;
final MavenDomProjectModel model = MavenDomUtil.getMavenDomProjectModel(project, mavenProject.getFile());
if (model == null) return;
new WriteCommandAction(project, "Add Maven Dependency", DomUtil.getFile(model)) {
@Override
protected void run(Result result) throws Throwable {
for (MavenId each : ids) {
MavenDomUtil.createDomDependency(model, null, each);
}
}
}.execute();
}
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:22,代码来源:AddMavenDependencyQuickFix.java
示例17: getPsiType
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@NotNull
protected PsiType getPsiType(final ConvertContext context) {
final Resource resource;
final EjbReference ejbReference;
final ServiceRef serviceReference;
final PsiClass aClass;
if ((resource = DomUtil.getParentOfType(context.getInvocationElement(), Resource.class, false)) != null) {
aClass = resource.getType().getValue();
}
else if ((ejbReference = DomUtil.getParentOfType(context.getInvocationElement(), EjbReference.class, false)) != null) {
aClass = ejbReference.getBeanInterface().getValue();
}
else if ((serviceReference = DomUtil.getParentOfType(context.getInvocationElement(), ServiceRef.class, false)) != null) {
aClass = serviceReference.getServiceInterface().getValue();
}
else {
aClass = null;
}
return aClass == null? super.getPsiType(context) : JavaPsiFacade.getInstance(aClass.getProject()).getElementFactory().createType(aClass);
}
开发者ID:consulo,项目名称:consulo-javaee,代码行数:21,代码来源:EjbInjectionTargetConverter.java
示例18: is23
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
private static boolean is23(final ConvertContext context) {
final DomElement element = DomUtil.getFileElement(context.getInvocationElement()).getRootElement();
final XmlTag tag = element.getXmlTag();
if (tag != null && "web-app".equals(element.getXmlElementName()) && tag.getAttribute("version") == null) {
XmlDocument document = (XmlDocument)tag.getParent();
final XmlProlog prolog = document.getProlog();
if (prolog != null) {
final XmlDoctype doctype = prolog.getDoctype();
if (doctype != null) {
final String uri = doctype.getDtdUri();
if (uri != null && uri.contains("2_3")) return true;
}
}
return false;
}
return true;
}
开发者ID:consulo,项目名称:consulo-javaee,代码行数:18,代码来源:ResAuthConverter.java
示例19: getModule
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
@Nullable
public Module getModule() {
if (!isValid()) {
return null;
}
if (getManager().isMockElement(this)) {
return DomUtil.getFile(this).getUserData(DomManager.MOCK_ELEMENT_MODULE);
}
final DomElement root = DomUtil.getRoot(this);
if (equals(root)) {
final PsiElement element = getIdentifyingPsiElement();
return element == null ? null : ModuleUtil.findModuleForPsiElement(element);
}
else {
return root.getModule();
}
}
开发者ID:consulo,项目名称:consulo-javaee,代码行数:18,代码来源:BaseImpl.java
示例20: DomElementsToggleAction
import com.intellij.util.xml.DomUtil; //导入依赖的package包/类
public DomElementsToggleAction(final DomModelTreeView treeView, final Class aClass) {
myTreeView = treeView;
myClass = aClass;
Icon myIcon = ElementPresentationManager.getIcon(myClass);
if (myIcon == null) {
myIcon = AllIcons.Nodes.Pointcut;
}
this.myIcon = myIcon;
myText = TypePresentationService.getInstance().getTypePresentableName(myClass);
if(getHiders() == null) DomUtil.getFile(myTreeView.getRootElement()).putUserData(BaseDomElementNode.TREE_NODES_HIDERS_KEY, new HashMap<Class, Boolean>());
if(getHiders().get(myClass) == null) getHiders().put(myClass, true);
}
开发者ID:consulo,项目名称:consulo-xml,代码行数:17,代码来源:DomElementsToggleAction.java
注:本文中的com.intellij.util.xml.DomUtil类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论