Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8268247
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:48:51+00:00 2026-06-08T05:48:51+00:00

In our project I am developing a simple function, which shall possible copying data

  • 0

In our project I am developing a simple function, which shall possible copying data to clipboard and later using it anywhere else.
It’s rather simple. A modal window pops up and shows in a SWT.List a list of all files exported by the function. This window has two more buttons: “OK” & “Copy To Clipboard”. OK Button closes windows by means of shell.dispose() (i have even tried Shell.close()).
Clipboard functionality looks this like:

Clipboard clipboard = new Clipboard(Display.getDefault());
TextTransfer transfer = TextTransfer.getInstance();
String lines = "";
for (String line : list.getItems())
{
    lines += line;
    lines +="\n";
}
clipboard.setContents(new Object[] { lines }, new TextTransfer[] { transfer });

When file export is finished, buttons are activated. Copying to Clipboard and using data is working, but only if I click this button and first paste this data anywhere. If I now click “OK” and close window, the data is still in clipboard.
But if I click “Copy” button and then directly “OK” without pasting this data anywhere, it’s lost from clipboard.

Is there any way to keep data in clipboard anyway?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T05:48:54+00:00Added an answer on June 8, 2026 at 5:48 am

    Maybe you need to dispose of the clipboard, directly after setting the contents? That is, when you don’t need to use the Clipboard instance anymore, dispose it, as is documented in the Clipboard class javadoc. Not sure it helps, but you could try… See also http://www.vogella.com/blog/2009/09/04/swt-clipboard/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm working on a project which requires us developing our own intermediate SMTP relay
We're using cakephp 1.2 version for one of our newly developing project, so would
Our team is developing a rather big ASP.NET web project which initially started in
We are developing a large project using Oracle 11g R2. Our database is consist
I had been developing a console application, until our project needed a fancy UI
In our project we use Zend Framework Model generator, which produces something like this
In our project we have UI and logic (which may be represented as a
My current project for work involves developing a SharePoint 2007 WebPart which will be
We've just started using Sencha's ExtJS 4 in our project and have been following
I'm currently on the project where we are developing a designer that our developers

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.