本文整理汇总了Java中com.intellij.util.xml.tree.DomFileElementNode类的典型用法代码示例。如果您正苦于以下问题:Java DomFileElementNode类的具体用法?Java DomFileElementNode怎么用?Java DomFileElementNode使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
DomFileElementNode类属于com.intellij.util.xml.tree包,在下文中一共展示了DomFileElementNode类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: actionPerformed
import com.intellij.util.xml.tree.DomFileElementNode; //导入依赖的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();
}
}
}
示例2: actionPerformed
import com.intellij.util.xml.tree.DomFileElementNode; //导入依赖的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();
}
}
}
示例3: update
import com.intellij.util.xml.tree.DomFileElementNode; //导入依赖的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: update
import com.intellij.util.xml.tree.DomFileElementNode; //导入依赖的package包/类
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));
}
else {
e.getPresentation().setText(ApplicationBundle.message("action.remove"));
}
e.getPresentation().setIcon(AllIcons.General.Remove);
}