Package org.eclipse.swt.dnd

Examples of org.eclipse.swt.dnd.Clipboard.dispose()


    final String[] value = { null };
    Display.getDefault().syncExec(new Runnable() {
      public void run() {
        Clipboard clp = new Clipboard(Display.getCurrent());
        value[0] = (String) clp.getContents(TextTransfer.getInstance());
        clp.dispose();
      }
    });
    assertEquals(expected, value[0]);
  }
}
View Full Code Here


      TextTransfer textTransfer = TextTransfer.getInstance();
      Transfer[] transfers = new Transfer[] { textTransfer };
      Object[] data = new Object[] { path };
      clipboard.setContents(data, transfers);
    } finally {
      clipboard.dispose();
    }

    return null;
  }
}
View Full Code Here

      return null;
    } finally {
      if (clip != null)
        // we must dispose ourselves
        clip.dispose();
      if (errorMessage != null)
        Activator.handleError(errorMessage, null, true);
    }
  }
View Full Code Here

            return;
        Clipboard clipboard = new Clipboard(getDisplay());
        Object[] o = new Object[] { getSelectionText() };
        Transfer[] t = new Transfer[] { TextTransfer.getInstance() };
        clipboard.setContents(o, t);
        clipboard.dispose();
    }

    /**
     * Returns the reference of the hyperlink that currently has keyboard focus,
     * or <code>null</code> if there are no hyperlinks in the receiver or no
View Full Code Here

           */
          return;
        }

      } finally {
        clipboard.dispose();
      }
    }

    if (delete) {
      try {
View Full Code Here

            processor.doReplace(selection, toInsert);
          } catch (BadLocationException x) {
            if (TRACE_ERRORS)
              System.out.println(JFaceTextMessages.getString("TextViewer.error.bad_location.paste")); //$NON-NLS-1$
          } finally {
            clipboard.dispose();
          }
        }
      });
    }
    Point selection= fTextWidget.getSelectionRange();
View Full Code Here

      } else if (selection.length > 1) {
        copyTree(selection, clipboard);
      }
    } finally {
      if (clipboard != null)
        clipboard.dispose();
    }
  }

  private void copyTree(TreeItem[] selection, Clipboard clipboard) {
    HashMap elementToTreeObj= new HashMap();
View Full Code Here

  private String loadInitialLinkFromClipboard(Display display) {
    Clipboard cb = new Clipboard(display);
    TextTransfer transfer = TextTransfer.getInstance();
    String data = (String) cb.getContents(transfer);
    data = (data != null) ? data.trim() : null;
    cb.dispose();

    if (URIUtils.looksLikeLink(data, false))
      return URIUtils.ensureProtocol(data);

    return null;
View Full Code Here

    Clipboard cb = new Clipboard(getShell().getDisplay());
    TextTransfer transfer = TextTransfer.getInstance();
    String data = (String) cb.getContents(transfer);
    data = (data != null) ? data.trim() : null;
    cb.dispose();

    if (URIUtils.looksLikeLink(data))
      initial = URIUtils.ensureProtocol(data);

    return initial;
View Full Code Here

          }
        }
        final Clipboard clipboard = new Clipboard(Display.getCurrent());
        clipboard.setContents(data, new Transfer[] { FileTransfer.getInstance(), TextTransfer.getInstance(),
            (Transfer) ImageTransferWrapper.getInstance() });
        clipboard.dispose();
      }
    });
    manager.add(new Separator());
    final Action action = new Action("Zoom In", IAction.AS_PUSH_BUTTON) {
      public void run() {
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.