当前位置: 首页>>代码示例>>Java>>正文


Java CompositePackagingElementNode类代码示例

本文整理汇总了Java中com.intellij.openapi.roots.ui.configuration.artifacts.nodes.CompositePackagingElementNode的典型用法代码示例。如果您正苦于以下问题:Java CompositePackagingElementNode类的具体用法?Java CompositePackagingElementNode怎么用?Java CompositePackagingElementNode使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


CompositePackagingElementNode类属于com.intellij.openapi.roots.ui.configuration.artifacts.nodes包,在下文中一共展示了CompositePackagingElementNode类的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: isEnabled

import com.intellij.openapi.roots.ui.configuration.artifacts.nodes.CompositePackagingElementNode; //导入依赖的package包/类
private boolean isEnabled() {
  if (myLayoutTreeComponent.isSortElements()) {
    return false;
  }
  final PackagingElementNode<?> node = myLayoutTreeComponent.getSelection().getNodeIfSingle();
  if (node == null) {
    return false;
  }
  final CompositePackagingElementNode parent = node.getParentNode();
  if (parent == null) return false;

  final PackagingElement<?> element = node.getElementIfSingle();
  final CompositePackagingElement<?> parentElement = parent.getElementIfSingle();
  if (parentElement == null || element == null) return false;
  final List<PackagingElement<?>> children = parentElement.getChildren();
  final int index = children.indexOf(element);
  return index != -1 && 0 <= index + myDirection && index + myDirection < children.size();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:MovePackagingElementAction.java

示例2: actionPerformed

import com.intellij.openapi.roots.ui.configuration.artifacts.nodes.CompositePackagingElementNode; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final PackagingElementNode<?> node = myLayoutTreeComponent.getSelection().getNodeIfSingle();
  if (node == null) return;
  final CompositePackagingElementNode parent = node.getParentNode();
  if (parent == null) return;

  final PackagingElement<?> element = node.getElementIfSingle();
  final CompositePackagingElement<?> parentElement = parent.getElementIfSingle();
  if (parentElement == null || element == null) return;


  if (!myLayoutTreeComponent.checkCanModifyChildren(parentElement, parent, Arrays.asList(node))) return;

  final List<PackagingElement<?>> toSelect = new ArrayList<PackagingElement<?>>();
  myLayoutTreeComponent.editLayout(new Runnable() {
    @Override
    public void run() {
      final int index = parentElement.getChildren().indexOf(element);
      final PackagingElement<?> moved = parentElement.moveChild(index, myDirection);
      if (moved != null) {
        toSelect.add(moved);
      }
    }
  });
  if (!toSelect.isEmpty()) {
    myLayoutTreeComponent.updateAndSelect(parent, toSelect);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:MovePackagingElementAction.java

示例3: actionPerformed

import com.intellij.openapi.roots.ui.configuration.artifacts.nodes.CompositePackagingElementNode; //导入依赖的package包/类
@Override
public void actionPerformed(AnActionEvent e) {
  final LayoutTreeComponent treeComponent = myEditor.getLayoutTreeComponent();
  final LayoutTreeSelection selection = treeComponent.getSelection();
  final PackagingElement<?> element = selection.getElementIfSingle();
  final PackagingElementNode<?> node = selection.getNodeIfSingle();
  if (node == null || !(element instanceof ArtifactPackagingElement)) return;

  final CompositePackagingElement<?> parent = node.getParentElement(element);
  final CompositePackagingElementNode parentNode = node.getParentNode();
  if (parent == null || parentNode == null) {
    return;
  }
  if (!treeComponent.checkCanModifyChildren(parent, parentNode, Collections.singletonList(node))) return;

  treeComponent.editLayout(new Runnable() {
    @Override
    public void run() {
      parent.removeChild(element);
      final ArtifactEditorContext context = myEditor.getContext();
      final Artifact artifact = ((ArtifactPackagingElement)element).findArtifact(context);
      if (artifact != null) {
        final CompositePackagingElement<?> rootElement = artifact.getRootElement();
        if (rootElement instanceof ArtifactRootElement<?>) {
          for (PackagingElement<?> child : rootElement.getChildren()) {
            parent.addOrFindChild(ArtifactUtil.copyWithChildren(child, context.getProject()));
          }
        }
        else {
          parent.addOrFindChild(ArtifactUtil.copyWithChildren(rootElement, context.getProject()));
        }
      }
    }
  });
  treeComponent.rebuildTree();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:37,代码来源:InlineArtifactAction.java


注:本文中的com.intellij.openapi.roots.ui.configuration.artifacts.nodes.CompositePackagingElementNode类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。