Example usage for org.eclipse.jface.wizard ProgressMonitorPart ProgressMonitorPart

List of usage examples for org.eclipse.jface.wizard ProgressMonitorPart ProgressMonitorPart

Introduction

In this page you can find the example usage for org.eclipse.jface.wizard ProgressMonitorPart ProgressMonitorPart.

Prototype

public ProgressMonitorPart(Composite parent, Layout layout, boolean createStopButton) 

Source Link

Document

Creates a ProgressMonitorPart.

Usage

From source file:com.atlassian.connector.eclipse.ui.dialogs.ProgressDialog.java

License:Open Source License

/**
 * Create the progress monitor part in the receiver.
 * //  w w w .  j av  a2 s.c  om
 * @param composite
 * @param pmlayout
 * @return ProgressMonitorPart
 */
protected ProgressMonitorPart createProgressMonitorPart(Composite composite, GridLayout pmlayout) {
    return new ProgressMonitorPart(composite, pmlayout, SWT.DEFAULT) {
        private String currentTask = null;

        @Override
        public void setBlocked(IStatus reason) {
            super.setBlocked(reason);
            if (!lockedUI) {
                getBlockedHandler().showBlocked(getShell(), this, reason, currentTask);
            }
        }

        @Override
        public void clearBlocked() {
            super.clearBlocked();
            if (!lockedUI) {
                getBlockedHandler().clearBlocked();
            }
        }

        @Override
        public void beginTask(String name, int totalWork) {
            super.beginTask(name, totalWork);
            currentTask = name;
        }

        @Override
        public void setTaskName(String name) {
            super.setTaskName(name);
            currentTask = name;
        }

        @Override
        public void subTask(String name) {
            super.subTask(name);
            if (currentTask == null) {
                currentTask = name;
            }
        }
    };
}

From source file:com.codesourcery.internal.installer.ui.WizardDialog.java

License:Open Source License

/**
 * Hook method for subclasses to create a custom progress monitor part.
 * <p>//from  w  ww . j  a  v a 2  s . c om
 * The default implementation creates a progress monitor with a stop button will be created.
 * </p>
 * 
 * @param composite the parent composite
 * @param pmlayout the layout
 * @return ProgressMonitorPart the progress monitor part
 */
protected ProgressMonitorPart createProgressMonitorPart(Composite composite, GridLayout pmlayout) {
    useCustomProgressMonitorPart = false;
    return new ProgressMonitorPart(composite, pmlayout, true) {
        String currentTask = null;

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#setBlocked(org.eclipse.core.runtime.IStatus)
         */
        public void setBlocked(IStatus reason) {
            super.setBlocked(reason);
            if (!lockedUI) {
                getBlockedHandler().showBlocked(getShell(), this, reason, currentTask);
            }
        }

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#clearBlocked()
         */
        public void clearBlocked() {
            super.clearBlocked();
            if (!lockedUI) {
                getBlockedHandler().clearBlocked();
            }
        }

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#beginTask(java.lang.String,
         *      int)
         */
        public void beginTask(String name, int totalWork) {
            super.beginTask(name, totalWork);
            currentTask = name;
        }

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#setTaskName(java.lang.String)
         */
        public void setTaskName(String name) {
            super.setTaskName(name);
            currentTask = name;
        }

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#subTask(java.lang.String)
         */
        public void subTask(String name) {
            super.subTask(name);
            // If we haven't got anything yet use this value for more
            // context
            if (currentTask == null) {
                currentTask = name;
            }
        }
    };
}

From source file:com.google.dart.tools.search.internal.ui.util.ExtendedDialogWindow.java

License:Open Source License

/**
 * Creates the layout of the extended dialog window.
 * //from w  w  w  .jav a  2 s.co m
 * @param parent The parent composite
 * @return The created control
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite result = (Composite) super.createDialogArea(parent);

    fContents = createPageArea(result);
    fContents.setLayoutData(new GridData(GridData.FILL_BOTH));

    if (fUseEmbeddedProgressMonitorPart) {
        // Insert a progress monitor
        fProgressMonitorPart = new ProgressMonitorPart(result, new GridLayout(), SWT.DEFAULT);
        fProgressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        fProgressMonitorPart.setVisible(false);
        applyDialogFont(fProgressMonitorPart);
    }

    Label separator = new Label(result, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    return result;
}

From source file:com.google.dart.tools.ui.feedback.FeedbackDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    Composite composite = new Composite(container, SWT.NONE);
    GridLayout gl_composite = new GridLayout(2, false);
    gl_composite.marginHeight = 0;/*  www . ja v  a 2s . com*/
    composite.setLayout(gl_composite);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

    Label imageLabel = new Label(composite, SWT.NONE);
    GridData data = new GridData(SWT.CENTER, SWT.TOP, false, false, 1, 1);
    data.verticalSpan = 2;
    imageLabel.setLayoutData(data);
    ImageDescriptor imageDescriptor = DartToolsPlugin.getImageDescriptor("icons/insert_comment.png"); //$NON-NLS-1$
    feedbackImage = imageDescriptor.createImage();
    imageLabel.setImage(feedbackImage);

    Label inviteText = new Label(composite, SWT.NONE);
    inviteText.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, true, false, 1, 1));
    inviteText.setText(FeedbackMessages.FeedbackDialog_Description_Text);

    feedbackText = new Text(composite, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.MULTI);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd.minimumWidth = 420;
    gd.minimumHeight = 160;
    feedbackText.setLayoutData(gd);

    //spacer
    new Label(composite, SWT.NONE);

    Composite logOptinComposite = new Composite(composite, SWT.NONE);
    logOptinComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout gl_logOptinComposite = new GridLayout(2, false);
    gl_logOptinComposite.marginWidth = 0;
    gl_logOptinComposite.horizontalSpacing = 0;
    gl_logOptinComposite.verticalSpacing = 0;
    gl_logOptinComposite.marginHeight = 0;
    logOptinComposite.setLayout(gl_logOptinComposite);

    sendAdditionalDataButton = new Button(logOptinComposite, SWT.CHECK);
    sendAdditionalDataButton.setText(FeedbackMessages.FeedbackDialog_send_additional_data_optin_Text);

    previewDataLink = new Link(logOptinComposite, SWT.NONE);
    GridData gd_1 = new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1);
    gd_1.verticalIndent = 2;
    previewDataLink.setLayoutData(gd_1);
    previewDataLink.setText(FeedbackMessages.FeedbackDialog_link_text);

    //spacer
    new Label(composite, SWT.NONE);

    Composite monitorComposite = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    monitorComposite.setLayout(layout);
    monitorComposite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    GridLayout pmLayout = new GridLayout();
    progressMonitorPart = new ProgressMonitorPart(monitorComposite, pmLayout, false);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    progressMonitorPart.setLayoutData(gd);
    monitorComposite.setVisible(false);
    new Label(monitorComposite, SWT.NONE);

    restoreSettings();
    hookupListeners();

    return container;
}

From source file:com.google.dart.tools.ui.feedback.FeedbackDialog2.java

License:Open Source License

/**
 * Create contents of the dialog.//from w  w  w .  j ava2 s.  c  o  m
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite container = (Composite) super.createDialogArea(parent);
    GridLayout gl_container = new GridLayout(2, true);
    gl_container.marginBottom = 10;
    gl_container.marginRight = 10;
    gl_container.marginLeft = 10;
    gl_container.marginTop = 10;
    container.setLayout(gl_container);

    Label feedbackLabel = new Label(container, SWT.NONE);
    feedbackLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1));
    feedbackLabel.setText("Please help improve Dart by telling us what you think. Thanks!");

    feedbackText = new Text(container, SWT.BORDER);
    feedbackText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            updateEnablement();
        }
    });
    GridData gd_feedbackText = new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1);
    gd_feedbackText.minimumHeight = 50;
    feedbackText.setLayoutData(gd_feedbackText);

    includeScreenshotCheckbox = new Button(container, SWT.CHECK);
    GridData gd_includeScreenshot = new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1);
    gd_includeScreenshot.verticalIndent = 10;
    includeScreenshotCheckbox.setLayoutData(gd_includeScreenshot);
    includeScreenshotCheckbox.setText("Include screenshot");

    Link screenshotLink = new Link(container, SWT.NONE);
    screenshotLink.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            showScreenshot();
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            showScreenshot();
        }
    });
    screenshotLink.setText("<a>show screenshot</a>");

    includeDataCheckbox = new Button(container, SWT.CHECK);
    includeDataCheckbox.setSelection(true);
    GridData gd_includeDataCheckbox = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1);
    gd_includeDataCheckbox.verticalIndent = 10;
    includeDataCheckbox.setLayoutData(gd_includeDataCheckbox);
    includeDataCheckbox.setText("Include additional editor data");
    includeDataCheckbox.setSelection(getDialogSettings().get(INCLUDE_DATA_KEY) == null
            || getDialogSettings().getBoolean(INCLUDE_DATA_KEY));

    Link dataLink = new Link(container, SWT.NONE);
    dataLink.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetDefaultSelected(SelectionEvent e) {
            showData();
        }

        @Override
        public void widgetSelected(SelectionEvent e) {
            showData();
        }
    });
    dataLink.setText("<a>show data that will be sent</a>");

    dartbugComposite = new Composite(container, SWT.NONE);
    GridLayout gl_dartbugComposite = new GridLayout(2, false);
    gl_dartbugComposite.verticalSpacing = 0;
    gl_dartbugComposite.horizontalSpacing = 0;
    gl_dartbugComposite.marginWidth = 0;
    gl_dartbugComposite.marginHeight = 0;
    dartbugComposite.setLayout(gl_dartbugComposite);
    GridData gd_dartbugComposite = new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1);
    gd_dartbugComposite.verticalIndent = 10;
    dartbugComposite.setLayoutData(gd_dartbugComposite);

    dartbugCheckbox = new Button(dartbugComposite, SWT.CHECK);
    dartbugCheckbox.setText("Yes, you may post this information on");
    dartbugCheckbox.setSelection(getDialogSettings().getBoolean(PUBLIC_KEY));

    Link dartbugLink = new Link(dartbugComposite, SWT.NONE);
    dartbugLink.setText("<a>dartbug.com</a>");

    Label dartbugLabel = new Label(dartbugComposite, SWT.NONE);
    GridData gd_dartbugLabel = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_dartbugLabel.horizontalIndent = 20;
    dartbugLabel.setLayoutData(gd_dartbugLabel);
    dartbugLabel.setText("This is an open source project; we publicly track our bugs at dartbug.com");

    emailComposite = new Composite(container, SWT.NONE);
    GridLayout gl_emailComposite = new GridLayout(2, false);
    gl_emailComposite.verticalSpacing = 0;
    gl_emailComposite.marginWidth = 0;
    gl_emailComposite.marginHeight = 0;
    gl_emailComposite.horizontalSpacing = 0;
    emailComposite.setLayout(gl_emailComposite);
    GridData gd_emailComposite = new GridData(SWT.FILL, SWT.FILL, false, false, 2, 1);
    gd_emailComposite.verticalIndent = 10;
    emailComposite.setLayoutData(gd_emailComposite);

    emailLabel1 = new Label(emailComposite, SWT.NONE);
    emailLabel1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
    emailLabel1.setText("CC:");

    emailText = new Text(emailComposite, SWT.BORDER);
    emailText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    String userEmail = getDialogSettings().get(USER_EMAIL_KEY);
    if (userEmail != null) {
        emailText.setText(userEmail);
    }

    emailLabel2 = new Label(emailComposite, SWT.NONE);
    GridData gd_emailLabel2 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_emailLabel2.horizontalIndent = 20;
    emailLabel2.setLayoutData(gd_emailLabel2);
    emailLabel2.setText(
            "You may optionally add an email address. If you do and we post a bug, we will CC you on it.");

    emailLabel3 = new Label(emailComposite, SWT.NONE);
    GridData gd_emailLabel3 = new GridData(SWT.LEFT, SWT.CENTER, false, false, 2, 1);
    gd_emailLabel3.horizontalIndent = 20;
    emailLabel3.setLayoutData(gd_emailLabel3);
    emailLabel3.setText(
            "We apologize, but we cant respond directly to all reports, but we read each and every one.");

    progressBar = new ProgressMonitorPart(container, null, 10);
    GridData gd_progressBar = new GridData(SWT.FILL, SWT.CENTER, true, false, 2, 1);
    gd_progressBar.verticalIndent = 10;
    progressBar.setLayoutData(gd_progressBar);

    return container;
}

From source file:com.nokia.carbide.search.system.internal.ui.util.ExtendedDialogWindow.java

License:Open Source License

/**
 * Creates the layout of the extended dialog window.
 *    @param parent The parent composite
 * @return The created control//from  www . j a va 2s . c  om
 */
protected Control createDialogArea(Composite parent) {
    Composite result = (Composite) super.createDialogArea(parent);

    fContents = createPageArea(result);
    fContents.setLayoutData(new GridData(GridData.FILL_BOTH));

    if (fUseEmbeddedProgressMonitorPart) {
        // Insert a progress monitor
        fProgressMonitorPart = new ProgressMonitorPart(result, new GridLayout(), SWT.DEFAULT);
        fProgressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        fProgressMonitorPart.setVisible(false);
        applyDialogFont(fProgressMonitorPart);
    }

    Label separator = new Label(result, SWT.SEPARATOR | SWT.HORIZONTAL);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    return result;
}

From source file:de.bmw.yamaica.ea.ui.EAElementSelectionDialog.java

License:Mozilla Public License

@Override
protected Control createDialogArea(Composite parent) {
    getShell().setText(EA_ELEMENT_SELECTION);

    Composite area = (Composite) super.createDialogArea(parent);

    label = new Label(area, SWT.WRAP);
    label.setText(RESOURCE_SELECTION_MESSAGE);

    eaPathText = new Text(area, SWT.SINGLE | SWT.BORDER);
    GridData textGridData = new GridData(GridData.FILL_HORIZONTAL);
    textGridData.widthHint = 320;/*from  ww  w .  j ava 2s .com*/
    eaPathText.setLayoutData(textGridData);
    eaPathText.addModifyListener(this);

    EAContentProvider contentProvider = new EAContentProvider();
    EALabelProvider labelProvider = new EALabelProvider();
    EAComparer comparer = new EAComparer();

    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);
    gridData.widthHint = 320;
    gridData.heightHint = 300;

    ViewerToolBar viewerToolBar = new ViewerToolBar(area, SWT.BORDER,
            ViewerToolBar.DRILL_DOWN | ViewerToolBar.REFRESH);
    viewerToolBar.setLayoutData(gridData);

    treeViewer = new TreeViewer(viewerToolBar, SWT.NONE);
    treeViewer.setContentProvider(contentProvider);
    treeViewer.setLabelProvider(labelProvider);
    treeViewer.setComparator(comparer);
    treeViewer.setUseHashlookup(true);
    treeViewer.addSelectionChangedListener(this);
    treeViewer.addDoubleClickListener(this);

    viewerToolBar.setViewer(treeViewer);

    progressMonitorPart = new ProgressMonitorPart(parent, new GridLayout(), true);
    progressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    progressMonitorPart.attachToCancelComponent(getButton(IDialogConstants.CANCEL_ID));

    Label separator = new Label(parent, SWT.HORIZONTAL | SWT.SEPARATOR);
    separator.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    setWidgetEnablements(false);

    applyDialogFont(progressMonitorPart);

    getShell().getDisplay().asyncExec(this);

    return dialogArea;
}

From source file:gov.redhawk.ide.sdr.ui.internal.handlers.LaunchDomainManagerWithOptionsDialog.java

License:Open Source License

/**
 * Hook method for subclasses to create a custom progress monitor part.
 * <p>/*w w  w . j a va 2 s .  com*/
 * The default implementation creates a progress monitor with a stop button will be created.
 * </p>
 * 
 * @param composite the parent composite
 * @param pmlayout the layout
 * @return ProgressMonitorPart the progress monitor part
 */
protected ProgressMonitorPart createProgressMonitorPart(final Composite composite, final GridLayout pmlayout) {
    this.useCustomProgressMonitorPart = false;
    return new ProgressMonitorPart(composite, pmlayout, true) {
        String currentTask = null;

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#setBlocked(org.eclipse.core.runtime.IStatus)
         */
        @Override
        public void setBlocked(final IStatus reason) {
            super.setBlocked(reason);
            if (!LaunchDomainManagerWithOptionsDialog.this.lockedUI) {
                Dialog.getBlockedHandler().showBlocked(getShell(), this, reason, this.currentTask);
            }
        }

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#clearBlocked()
         */
        @Override
        public void clearBlocked() {
            super.clearBlocked();
            if (!LaunchDomainManagerWithOptionsDialog.this.lockedUI) {
                Dialog.getBlockedHandler().clearBlocked();
            }
        }

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#beginTask(java.lang.String,
         *      int)
         */
        @Override
        public void beginTask(final String name, final int totalWork) {
            super.beginTask(name, totalWork);
            this.currentTask = name;
        }

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#setTaskName(java.lang.String)
         */
        @Override
        public void setTaskName(final String name) {
            super.setTaskName(name);
            this.currentTask = name;
        }

        /*
         * (non-Javadoc)
         * 
         * @see org.eclipse.jface.wizard.ProgressMonitorPart#subTask(java.lang.String)
         */
        @Override
        public void subTask(final String name) {
            super.subTask(name);
            // If we haven't got anything yet use this value for more
            // context
            if (this.currentTask == null) {
                this.currentTask = name;
            }
        }
    };
}

From source file:net.refractions.udig.issues.internal.IssuesPreferencePage.java

License:Open Source License

public void runWithProgress(boolean mayBlock, final IRunnableWithProgress runnable)
        throws InvocationTargetException, InterruptedException {
    if (Display.getCurrent() == null)
        throw new SWTException(SWT.ERROR_THREAD_INVALID_ACCESS);
    final ProgressMonitorPart part = new ProgressMonitorPart(progressArea, new GridLayout(1, true), 10);
    try {/*www.  j a  v a  2s .c o m*/
        progressArea.layout();
        PlatformGIS.runBlockingOperation(runnable, part);
    } finally {
        part.dispose();
        progressArea.layout();
    }

}

From source file:org.eclipse.debug.internal.ui.launchConfigurations.LaunchConfigurationsDialog.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Font font = parent.getFont();
    Composite composite = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;/*www  . jav a  2  s  . com*/
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setFont(font);
    // create help control if needed
    if (isHelpAvailable()) {
        createHelpControl(composite);
    }
    Composite monitorComposite = new Composite(composite, SWT.NULL);
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    layout.numColumns = 2;
    monitorComposite.setLayout(layout);
    monitorComposite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    GridLayout pmLayout = new GridLayout();
    fProgressMonitorPart = new ProgressMonitorPart(monitorComposite, pmLayout, true);
    fProgressMonitorPart.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    fProgressMonitorPart.setFont(font);
    monitorComposite.setVisible(false);

    /*
     * Create the rest of the button bar, but tell it not to
     * create a help button (we've already created it).
     */
    boolean helpAvailable = isHelpAvailable();
    setHelpAvailable(false);
    fButtonComp = (Composite) super.createButtonBar(composite);
    setHelpAvailable(helpAvailable);
    return composite;
}