org.openide.nodes.NodeTransfer.node()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(5.5k)|赞(0)|评价(0)|浏览(78)

本文整理了Java中org.openide.nodes.NodeTransfer.node()方法的一些代码示例,展示了NodeTransfer.node()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。NodeTransfer.node()方法的具体详情如下:
包路径:org.openide.nodes.NodeTransfer
类名称:NodeTransfer
方法名:node

NodeTransfer.node介绍

[英]Obtain a node from a transferable. Probes the transferable in case it includes a flavor corresponding to a node operation (which you must specify a mask for).
[中]从可转移节点获取节点。在包含与节点操作(必须为其指定掩码)相对应的味道的情况下,探测可转移。

代码示例

代码示例来源:origin: org.netbeans.api/org-openide-nodes

/** Obtain a cookie instance from the copied node in a transferable.
* <P>
* First of all it checks whether the given transferable contains
* a node and then asks for the cookie.
* <p>If you wish to specially support multiple-node transfers, please use {@link #nodes}
* and manually check for the desired combination of cookies.
*
* @param t transferable to check in
* @param cookie cookie representation class to look for
* @param action the action which was used to store the node
*
* @return cookie or <code>null</code> if it does not exist
*/
public static <T extends Node.Cookie> T cookie(Transferable t, int action, Class<T> cookie) {
  Node n = node(t, action);
  return (n == null) ? null : n.getCookie(cookie);
}

代码示例来源:origin: org.netbeans.api/org-openide-nodes

Node n = node(mto.getTransferableAt(i), action);
Node n = node(t, action);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

/** Obtain a cookie instance from the copied node in a transferable.
* <P>
* First of all it checks whether the given transferable contains
* a node and then asks for the cookie.
* <p>If you wish to specially support multiple-node transfers, please use {@link #nodes}
* and manually check for the desired combination of cookies.
*
* @param t transferable to check in
* @param cookie cookie representation class to look for
* @param action the action which was used to store the node 
*
* @return cookie or <code>null</code> if it does not exist
*/
public static Node.Cookie cookie (Transferable t, int action, Class cookie) {
  Node n = node (t, action);
  return n == null ? null : n.getCookie (cookie);
}

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

/** Obtain a cookie instance from the copied node in a transferable.
* <P>
* First of all it checks whether the given transferable contains
* a node and then asks for the cookie.
* <p>If you wish to specially support multiple-node transfers, please use {@link #nodes}
* and manually check for the desired combination of cookies.
*
* @param t transferable to check in
* @param cookie cookie representation class to look for
* @param action the action which was used to store the node 
*
* @return cookie or <code>null</code> if it does not exist
*/
public static Node.Cookie cookie (Transferable t, int action, Class cookie) {
  Node n = node (t, action);
  return n == null ? null : n.getCookie (cookie);
}

代码示例来源:origin: org.gephi/desktop-filters

@Override
public PasteType getDropType(final Transferable t, int action, int index) {
  if (category == null || !category.equals(FiltersExplorer.QUERIES)) {
    return null;
  }
  final Node dropNode = NodeTransfer.node(t, DnDConstants.ACTION_COPY_OR_MOVE);
  if (dropNode != null && dropNode instanceof QueryNode) {
    return new PasteType() {
      @Override
      public Transferable paste() throws IOException {
        QueryNode queryNode = (QueryNode) dropNode;
        FilterController filterController = Lookup.getDefault().lookup(FilterController.class);
        FilterLibrary library = filterController.getModel().getLibrary();
        library.saveQuery(queryNode.getQuery());
        return null;
      }
    };
  }
  return null;
}

代码示例来源:origin: org.netbeans.api/org-netbeans-modules-vmd-midp

protected FileObject getNodeFileObject(Transferable transferable) {
  Node node = NodeTransfer.node(transferable, NodeTransfer.DND_COPY_OR_MOVE);
  if (node == null)
    return null;
  DataObject dataObject = (DataObject) node.getLookup().lookup(DataObject.class);
  if (dataObject == null)
    return null;
  FileObject file = dataObject.getPrimaryFile();
  return file;
}

代码示例来源:origin: org.gephi/desktop-filters

@Override
public PasteType getDropType(final Transferable t, int action, int index) {
  final Node dropNode = NodeTransfer.node(t, DnDConstants.ACTION_COPY_OR_MOVE);
  if (dropNode != null && dropNode instanceof QueryNode) {
    Query q = ((QueryNode) dropNode).getQuery();

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide-loaders

protected void handleCreatePasteTypes (Transferable t, java.util.List s) {
    // These should only accept single-node transfers, since they require dialogs.
    Node node = NodeTransfer.node (t, NodeTransfer.CLIPBOARD_COPY);
    // lastly try special cookies
    if (node != null) {
      try {
        InstanceCookie cookie = (InstanceCookie)node.getCookie (InstanceCookie.class);
        if (cookie != null && java.io.Serializable.class.isAssignableFrom (cookie.instanceClass ())) {
          s.add (new DataTransferSupport.SerializePaste (DataFolder.this, cookie));
          s.add (new DataTransferSupport.InstantiatePaste (DataFolder.this, cookie));
        }
      } catch (IOException e) {
      } catch (ClassNotFoundException e) {
      }
    }
  }
}

代码示例来源:origin: org.gephi/desktop-filters

@Override
public PasteType getDropType(Transferable t, int action, int index) {
  final Node dropNode = NodeTransfer.node(t, DnDConstants.ACTION_COPY_OR_MOVE);

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

boolean ok = true;
for (int i = 0; i < count; i++) {
  Node n = node (mto.getTransferableAt (i), action);
  if (n == null) {
    ok = false;
Node n = node (t, action);
if (n != null) return new Node[] { n };

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

boolean ok = true;
for (int i = 0; i < count; i++) {
  Node n = node (mto.getTransferableAt (i), action);
  if (n == null) {
    ok = false;
Node n = node (t, action);
if (n != null) return new Node[] { n };

代码示例来源:origin: nl.cloudfarming.client/geoviewer-data

final Node dropNode = NodeTransfer.node(t,
    DnDConstants.ACTION_COPY_OR_MOVE + NodeTransfer.CLIPBOARD_CUT);

代码示例来源:origin: nl.cloudfarming.client/field-project

@Override
public PasteType getDropType(final Transferable t, int action, int index) {
  final Node node = NodeTransfer.node(t, NodeTransfer.DND_COPY);
  if (node == null){
    return null;

相关文章