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


Java PaletteEntry.getParent方法代码示例

本文整理汇总了Java中org.eclipse.gef.palette.PaletteEntry.getParent方法的典型用法代码示例。如果您正苦于以下问题:Java PaletteEntry.getParent方法的具体用法?Java PaletteEntry.getParent怎么用?Java PaletteEntry.getParent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.eclipse.gef.palette.PaletteEntry的用法示例。


在下文中一共展示了PaletteEntry.getParent方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: run

import org.eclipse.gef.palette.PaletteEntry; //导入方法依赖的package包/类
@Override
public void run() {
  PaletteEntry entry = (PaletteEntry) selectedNode.getModel();
  String modelName = entry.getLabel();
  String modelClass = entry.getDescription();
  String elementType = "CompositeActor";

  Map<String, String> properties = new HashMap<>();
  properties.put("displayName", modelName);
  properties.put("class", modelClass);
  properties.put("type", elementType);
  String parentTreePath = selectedNode.getParentTreePath('.');
  properties.put("libraryName", parentTreePath);

  Event event = new Event(LibraryManager.DELETE_EVENT_TOPIC, properties);
  try {
    // Sending events is nice to decouple UI handling from the underlying library management,
    // but we don't get any indication about success/failure.
    // So we may need to replace this by direct method calls.
    TriqEditorPlugin.getDefault().getEventAdminService().sendEvent(event);
    // The palette's model consists of 2 layers : palette entry editparts that have palette entries as model.
    // And way down there's still the Ptolemy UserLibrary as well.
    // Getting all models synchronized via listeners would be the cleanest, but couldn't get it to work.
    // (org.eclipse.gef.editparts.AbstractEditPart.refreshChildren() always caused errors in reorderChild()
    // because of a null parent somewhere. Too complex for me to understand...)
    // So we do all the deletes ourselves in here...
    ((PaletteTreeNodeEditPart) selectedNode.getParent()).removeChild(selectedNode);
    PaletteContainer container = entry.getParent();
    if (container != null) {
      container.remove(entry);
    }
    getTreeViewer().refresh(selectedNode.getParent());
  } catch (NullPointerException e) {
    StatusManager.getManager().handle(
        new Status(IStatus.ERROR, TriqEditorPlugin.getID(), "Event bus not available, impossible to trigger a delete event for the user library."),
        StatusManager.BLOCK);
  }
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:39,代码来源:PaletteTreeViewer.java

示例2: isMember

import org.eclipse.gef.palette.PaletteEntry; //导入方法依赖的package包/类
/**
 * checks if the given entry is a PaletteEntry and is a (deep) child of this user library node.
 * 
 * @param entry
 * @return true if the given entry is in this user library subtree
 */
public boolean isMember(Object entry) {
  if (!(entry instanceof PaletteEntry)) {
    return false;
  } else {
    PaletteEntry pe = (PaletteEntry) entry;
    boolean result = false;
    PaletteContainer parent = pe.getParent();
    while (!result && parent != null) {
      result = (this == parent);
      parent = parent.getParent();
    }
    return result;
  }
}
 
开发者ID:eclipse,项目名称:triquetrum,代码行数:21,代码来源:UserLibraryTreeNode.java

示例3: canCreate

import org.eclipse.gef.palette.PaletteEntry; //导入方法依赖的package包/类
/**
 * @see org.eclipse.gef.ui.palette.customize.PaletteEntryFactory#canCreate(org.eclipse.gef.palette.PaletteEntry)
 */
public boolean canCreate(PaletteEntry selected) {
	if (!(selected instanceof ToolEntry)
			|| selected.getParent() instanceof PaletteStack)
		return false;
	return super.canCreate(selected);
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:10,代码来源:PaletteStackFactory.java

示例4: determineContainerForNewEntry

import org.eclipse.gef.palette.PaletteEntry; //导入方法依赖的package包/类
/**
 * @see PaletteEntryFactory#determineContainerForNewEntry(PaletteEntry)
 */
protected PaletteContainer determineContainerForNewEntry(
		PaletteEntry selected) {
	if (selected instanceof PaletteRoot)
		return (PaletteContainer) selected;
	PaletteContainer current = selected.getParent();
	while (!(current instanceof PaletteRoot))
		current = current.getParent();
	return current;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:13,代码来源:PaletteContainerFactory.java

示例5: determineIndexForNewEntry

import org.eclipse.gef.palette.PaletteEntry; //导入方法依赖的package包/类
/**
 * @see PaletteEntryFactory#determineIndexForNewEntry(PaletteContainer,
 *      PaletteEntry)
 */
protected int determineIndexForNewEntry(PaletteContainer parent,
		PaletteEntry selected) {
	if (parent == selected) {
		return 0;
	}

	List children = parent.getChildren();
	PaletteEntry current = selected;
	while (!children.contains(current)) {
		current = current.getParent();
	}
	return children.indexOf(current) + 1;
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:18,代码来源:PaletteContainerFactory.java

示例6: determineContainerForNewEntry

import org.eclipse.gef.palette.PaletteEntry; //导入方法依赖的package包/类
/**
 * Given the current selection, this method determines the parent for the
 * new entry to be created.
 * 
 * <p>
 * Sub-classes may override this method.
 * </p>
 * 
 * @param selected
 *            The selected entry
 * @return The parent of the new entry to be created
 */
protected PaletteContainer determineContainerForNewEntry(
		PaletteEntry selected) {
	if (selected instanceof PaletteContainer)
		return (PaletteContainer) selected;
	return selected.getParent();
}
 
开发者ID:ghillairet,项目名称:gef-gwt,代码行数:19,代码来源:PaletteEntryFactory.java


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