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 8609061
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T03:46:52+00:00 2026-06-12T03:46:52+00:00

When I have a operation running in the back ground, I am setting my

  • 0

When I have a operation running in the back ground, I am setting my cursor to busy until the process completes. Is there a way to also grey out and disable the current Display/Dialog/Shell until the process completes. I want to visually let the user know that something is working and they have to wait.

EDIT

plotButton.addListener(SWT.Selection, new Listener() {
      public void handleEvent(Event arg0) {
         getShell().setEnabled(!getShell().getEnabled());
         getShell().setCursor(new Cursor(Display.getCurrent(), SWT.CURSOR_WAIT));    
         recursiveSetEnabled(getShell(), getShell().getEnabled());
         startPrinterListOperation(); <== This is method that runs operation
      }
  });

Method that runs a printer operation.

private void startPrinterListOperation() {
  listOp = new AplotPrinterListOperation(appReg.getString("aplot.message.GETPRINTERLIST"), session);
  listOp.addOperationListener(new MyOperationListener(this) {
     public void endOperationImpl() {
        try {
           printers.clear();
           printers.addAll((ArrayList<PrinterProfile>) listOp.getPrinters());
           Display.getDefault().asyncExec(new Runnable() {
              public void run() {
                showAplotPlotterDialog(); <== When operation returns - opens selection dialog
              }
           });
        }
        finally {

           listOp.removeOperationListener(this);
           listOp = null;
        }
     }
  });
  session.queueOperation(listOp);
} // end startPrinterListOperation()

showAplotPlotterDialog() (Seperate Class) opens a dialog with network printers, then with a button push sends a job to the selected printer. When that operation finishes the Plotter Dialog closes – This is the end of that method – baseDialog is the MAIN GUI

finally {
           plotOp.removeOperationListener(this);
           plotOp = null;
           Display.getDefault().asyncExec(new Runnable() {
              public void run() {
                baseDialog.removeAllTableRows();
                baseDialog.plotRequestCompleted = true;
                baseDialog.setResultsButtonVisibility();
                getShell().close();

              }
           });
        }
  • 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-12T03:46:53+00:00Added an answer on June 12, 2026 at 3:46 am

    The following should do what you want. It will recursively disable and grey out all the Controls in your Shell. The Shell itself does not have a setGrayed method, but this will work:

    public static void main(String[] args) {
        final Display display = new Display();
        final Shell shell = new Shell(display);
        shell.setLayout(new FillLayout());
    
        Button button = new Button(shell, SWT.PUSH);
        button.setText("Button");
    
        button.addListener(SWT.Selection, new Listener() {
    
            @Override
            public void handleEvent(Event arg0) {
                shell.setEnabled(!shell.getEnabled());
                shell.setCursor(new Cursor(display, SWT.CURSOR_WAIT));      
                recursiveSetEnabled(shell, shell.getEnabled());
            }
        });
    
        new Text(shell, SWT.NONE).setText("TEXT");
    
        shell.setSize(400, 400);
        shell.open();
    
        while (!shell.isDisposed()) {
            if (!display.readAndDispatch()) {
                display.sleep();
            }
        }
        display.dispose();
    }
    
    private static void recursiveSetEnabled(Control control, boolean enabled) {
        if (control instanceof Composite)
        {
            Composite comp = (Composite) control;
    
            for (Control c : comp.getChildren())
                recursiveSetEnabled(c, enabled);
        }
        else
        {
            control.setEnabled(enabled);
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there a good way of performing a long-running operation in javascript? For example,
I have a long-running cleanup operation that I need to perform in onDestroy() of
I have a Parallel.ForEach loop running an intensive operation inside the body. The operation
I have a long running operation which I am putting on a background thread
All, I have a long running process that I run on a background thread
I have a long operation running in the background, like uploading stuff, converting images,
I have a long-running operation which I perform in a background thread. As it
I have a timely operation that runs on a background thread. While running, I
Is it possible to have 32 bit operating system running on 64 bit processor
I have an operation that will be performed MANY times and so I need

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.