org.eclipse.swt.dnd.Clipboard.getAvailableTypes()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(8.5k)|赞(0)|评价(0)|浏览(138)

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

Clipboard.getAvailableTypes介绍

[英]Returns an array of the data types currently available on the system clipboard. Use with Transfer.isSupportedType.
[中]返回系统剪贴板上当前可用的数据类型数组。与传输一起使用。isSupportedType。

代码示例

代码示例来源:origin: org.eclipse.swt.cocoa.macosx/x86_64

/**
 * Returns an array of the data types currently available on the system 
 * clipboard. Use with Transfer.isSupportedType.
 *
 * @return array of data types currently available on the system clipboard
 * 
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Transfer#isSupportedType
 * 
 * @since 3.0
 */
public TransferData[] getAvailableTypes() {
  return getAvailableTypes(DND.CLIPBOARD);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

/**
 * Returns an array of the data types currently available on the system
 * clipboard. Use with Transfer.isSupportedType.
 *
 * @return array of data types currently available on the system clipboard
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Transfer#isSupportedType
 *
 * @since 3.0
 */
public TransferData[] getAvailableTypes() {
  return getAvailableTypes(DND.CLIPBOARD);
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

/**
 * Returns an array of the data types currently available on the system
 * clipboard. Use with Transfer.isSupportedType.
 *
 * @return array of data types currently available on the system clipboard
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Transfer#isSupportedType
 *
 * @since 3.0
 */
public TransferData[] getAvailableTypes() {
  return getAvailableTypes(DND.CLIPBOARD);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

/**
 * Returns an array of the data types currently available on the system
 * clipboard. Use with Transfer.isSupportedType.
 *
 * @return array of data types currently available on the system clipboard
 *
 * @exception SWTException <ul>
 *    <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
 *    <li>ERROR_THREAD_INVALID_ACCESS - if not called from the thread that created the receiver</li>
 * </ul>
 *
 * @see Transfer#isSupportedType
 *
 * @since 3.0
 */
public TransferData[] getAvailableTypes() {
  return getAvailableTypes(DND.CLIPBOARD);
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public boolean canPaste(Clipboard clipboard) {
  TransferData[] types = clipboard.getAvailableTypes();
  Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
  for (TransferData type : types) {
    for (Transfer transfer : transfers) {
      if (transfer.isSupportedType(type))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public boolean canPaste(Clipboard clipboard) {
  TransferData[] types = clipboard.getAvailableTypes();
  Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
  for (TransferData type : types) {
    for (Transfer transfer : transfers) {
      if (transfer.isSupportedType(type))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public boolean canPaste(Clipboard clipboard) {
  TransferData[] types = clipboard.getAvailableTypes();
  Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
  for (TransferData type : types) {
    for (Transfer transfer : transfers) {
      if (transfer.isSupportedType(type))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public boolean canPaste(Clipboard clipboard) {
  TransferData[] types = clipboard.getAvailableTypes();
  Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
  for (TransferData type : types) {
    for (Transfer transfer : transfers) {
      if (transfer.isSupportedType(type))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public boolean canPaste(Clipboard clipboard) {
  TransferData[] types = clipboard.getAvailableTypes();
  Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
  for (TransferData type : types) {
    for (Transfer transfer : transfers) {
      if (transfer.isSupportedType(type))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public boolean canPaste(Clipboard clipboard) {
  TransferData[] types = clipboard.getAvailableTypes();
  Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
  for (TransferData type : types) {
    for (Transfer transfer : transfers) {
      if (transfer.isSupportedType(type))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
  public boolean canPaste(Clipboard clipboard) {
    TransferData[] types = clipboard.getAvailableTypes();
    Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
    for (TransferData type : types) {
      for (Transfer transfer : transfers) {
        if (transfer.isSupportedType(type))
          return true;
      }
    }
    return false;
  }
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public boolean canPaste(Clipboard clipboard) {
  TransferData[] types = clipboard.getAvailableTypes();
  Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
  for (TransferData type : types) {
    for (Transfer transfer : transfers) {
      if (transfer.isSupportedType(type))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public boolean canPaste(Clipboard clipboard) {
  TransferData[] types = clipboard.getAvailableTypes();
  Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
  for (TransferData type : types) {
    for (Transfer transfer : transfers) {
      if (transfer.isSupportedType(type))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
public boolean canPaste(Clipboard clipboard) {
  TransferData[] types = clipboard.getAvailableTypes();
  Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
  for (TransferData type : types) {
    for (Transfer transfer : transfers) {
      if (transfer.isSupportedType(type))
        return true;
    }
  }
  return false;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.team.ui

private String getClipboardText() {
  Transfer transfer = TextTransfer.getInstance();
  if (isAvailable(transfer, fClipboard.getAvailableTypes())) {
    return (String) getContents(fClipboard, transfer, fShell);
  }
  return null;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

@Override
  public boolean canPaste(Clipboard clipboard) {
    TransferData[] types = clipboard.getAvailableTypes();
    Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
    for (TransferData type : types) {
      for (Transfer transfer : transfers) {
        if (transfer.isSupportedType(type))
          return true;
      }
    }
    return false;
  }
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

protected boolean hasKnownTypes() {
  try {
    TransferData[] types = getClipboard().getAvailableTypes();
    Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
    for (TransferData type : types) {
      for (Transfer transfer : transfers) {
        if (transfer.isSupportedType(type))
          return true;
      }
    }
  } catch (SWTError e) {
  }
  return false;
}

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

protected boolean hasKnownTypes() {
  try {
    TransferData[] types = getClipboard().getAvailableTypes();
    Transfer[] transfers = new Transfer[] {TextTransfer.getInstance(), RTFTransfer.getInstance()};
    for (TransferData type : types) {
      for (Transfer transfer : transfers) {
        if (transfer.isSupportedType(type))
          return true;
      }
    }
  } catch (SWTError e) {
  }
  return false;
}

代码示例来源:origin: org.eclipse/org.eclipse.datatools.sqltools.sqleditor

private boolean canEnable(IStructuredSelection selection)
{
  if (selection.size() != 1 || !(selection.getFirstElement() instanceof Node))
  {
    return false;
  }
  TransferData[] availableDataTypes = _fClipboard.getAvailableTypes();
  for (int i = 0; i < availableDataTypes.length; i++)
  {
    if (TextTransfer.getInstance().isSupportedType(availableDataTypes[i]))
    {
      return true;
    }
  }
  return false;
}

代码示例来源:origin: net.sf.okapi.lib/okapi-lib-verification-ui

private void pasteFromClipboard () {
  Clipboard clipboard = new Clipboard(edit.getDisplay());
  try {
    TransferData[] transferDatas = clipboard.getAvailableTypes();
    for ( TransferData transData : transferDatas ) {
      if ( FragmentDataTransfer.getInstance().isSupportedType(transData) ) {
        FragmentData data = (FragmentData)clipboard.getContents(FragmentDataTransfer.getInstance());
        setFragmentData(data, 2);
        break;
      }
    }
  }
  finally {
    if ( clipboard != null ) {
      clipboard.dispose();
    }
  }
}

相关文章