本文整理汇总了Java中com.intellij.util.xml.DomElement.isValid方法的典型用法代码示例。如果您正苦于以下问题:Java DomElement.isValid方法的具体用法?Java DomElement.isValid怎么用?Java DomElement.isValid使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.xml.DomElement
的用法示例。
在下文中一共展示了DomElement.isValid方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getProblemHolder
import com.intellij.util.xml.DomElement; //导入方法依赖的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;
}
}
示例2: navigate
import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
public void navigate(final DomElement element) {
if (element != null && element.isValid()) {
final DomElement copy = element.createStableCopy();
final Project project = element.getManager().getProject();
final DomElementNavigationProvider navigateProvider = getNavigationProviderName(project);
if (navigateProvider != null && navigateProvider.canNavigate(copy)) {
ApplicationManager.getApplication().invokeLater(new Runnable() {
@Override
public void run() {
if (!project.isDisposed()) {
doNavigate(navigateProvider, copy);
}
}
});
}
}
}
示例3: update
import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
@Override
public void update(AnActionEvent e, DomModelTreeView treeView) {
final SimpleNode selectedNode = treeView.getTree().getSelectedNode();
if (selectedNode instanceof DomFileElementNode) {
e.getPresentation().setVisible(false);
return;
}
boolean enabled = false;
if (selectedNode instanceof BaseDomElementNode) {
final DomElement domElement = ((BaseDomElementNode)selectedNode).getDomElement();
if (domElement.isValid() && DomUtil.hasXml(domElement) && !(domElement.getParent() instanceof DomFileElement)) {
enabled = true;
}
}
e.getPresentation().setEnabled(enabled);
if (enabled) {
e.getPresentation().setText(getPresentationText(selectedNode, ApplicationBundle.message("action.remove")));
}
else {
e.getPresentation().setText(ApplicationBundle.message("action.remove"));
}
e.getPresentation().setIcon(AllIcons.General.Remove);
}
示例4: getProblems
import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
@Override
public List<DomElementProblemDescriptor> getProblems(final DomElement domElement,
final boolean includeXmlProblems,
final boolean withChildren) {
if (!withChildren || domElement == null || !domElement.isValid()) {
return getProblems(domElement);
}
return ContainerUtil.concat(getProblemsMap(domElement).values());
}
示例5: createDomHighlighter
import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
@Override
public BackgroundEditorHighlighter createDomHighlighter(final Project project, final PerspectiveFileEditor editor, final DomElement element) {
return new BackgroundEditorHighlighter() {
@Override
@NotNull
public HighlightingPass[] createPassesForEditor() {
if (!element.isValid()) return HighlightingPass.EMPTY_ARRAY;
final XmlFile psiFile = DomUtil.getFile(element);
final PsiDocumentManager psiDocumentManager = PsiDocumentManager.getInstance(project);
final Document document = psiDocumentManager.getDocument(psiFile);
if (document == null) return HighlightingPass.EMPTY_ARRAY;
editor.commit();
psiDocumentManager.commitAllDocuments();
GeneralHighlightingPass ghp = new GeneralHighlightingPass(project, psiFile, document, 0, document.getTextLength(),
true, new ProperTextRange(0, document.getTextLength()), null, new DefaultHighlightInfoProcessor());
LocalInspectionsPass lip = new LocalInspectionsPass(psiFile, document, 0,
document.getTextLength(), LocalInspectionsPass.EMPTY_PRIORITY_RANGE, true,
new DefaultHighlightInfoProcessor());
return new HighlightingPass[]{ghp, lip};
}
@Override
@NotNull
public HighlightingPass[] createPassesForVisibleArea() {
return createPassesForEditor();
}
};
}
示例6: setSelectionInTextEditor
import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
public void setSelectionInTextEditor(final TextEditor textEditor, final DomElement element) {
if (element != null && element.isValid()) {
final XmlTag tag = element.getXmlTag();
if (tag == null) return;
final PsiFile file = tag.getContainingFile();
if (file == null) return;
final Document document = getDocumentManager().getDocument(file);
if (document == null || !document.equals(textEditor.getEditor().getDocument())) return;
textEditor.getEditor().getCaretModel().moveToOffset(tag.getTextOffset());
textEditor.getEditor().getScrollingModel().scrollToCaret(ScrollType.CENTER);
}
}
示例7: wrapValueSetting
import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
@Override
protected void wrapValueSetting(@NotNull final DomElement domElement, final Runnable valueSetter) {
if (domElement.isValid()) {
new WriteCommandAction(getProject(), DomUtil.getFile(domElement)) {
@Override
protected void run(@NotNull final Result result) throws Throwable {
valueSetter.run();
}
}.execute();
fireChanged();
}
}
示例8: areValid
import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
private boolean areValid() {
for (final DomElement domElement : myDomElements) {
if (!domElement.isValid()) return false;
}
return true;
}
示例9: getValue
import com.intellij.util.xml.DomElement; //导入方法依赖的package包/类
@Override
public T getValue() throws IllegalAccessException, InvocationTargetException {
final DomElement element = getWrappedElement();
return element.isValid() ? (T)DomUIFactory.GET_VALUE_METHOD.invoke(element) : null;
}