Example usage for org.eclipse.jface.dialogs ProgressIndicator ProgressIndicator

List of usage examples for org.eclipse.jface.dialogs ProgressIndicator ProgressIndicator

Introduction

In this page you can find the example usage for org.eclipse.jface.dialogs ProgressIndicator ProgressIndicator.

Prototype

public ProgressIndicator(Composite parent) 

Source Link

Document

Create a ProgressIndicator as a child under the given parent.

Usage

From source file:com.eclipsesource.ui.partblockmonitor.internal.TransparentUIBlocker.java

License:Open Source License

private IProgressMonitor buildMonitor() {
    Composite parent = new Composite(shell, SWT.NONE);
    parent.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, true, true));
    shell.setLayout(new GridLayout(1, false));
    parent.setBackground(shell.getBackground());

    Label label = new Label(parent, SWT.BORDER);
    label.setText("");
    label.setBackground(parent.getBackground());
    label.setForeground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
    ProgressIndicator progressBar = new ProgressIndicator(parent);
    Button cancel = new Button(parent, SWT.FLAT);
    cancel.setBackground(label.getBackground());
    cancel.setForeground(label.getForeground());
    cancel.setText("Cancel");
    cancel.setVisible(cancellable);/* w ww .  j  ava 2 s.  c  o m*/

    parent.setLayout(new GridLayout(1, false));
    label.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    progressBar.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    cancel.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false, false));
    shell.layout();
    final ProgressMonitor monitor = new ProgressMonitor(progressBar, label);
    cancel.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            monitor.setCanceled(true);
        }
    });
    return monitor;
}

From source file:com.ibm.etools.mft.samples.scribble.ScribbleConnectionDialog.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.Dialog
 *//* ww w. j  a v a2  s . c  o m*/

protected Control createDialogArea(Composite parent) {
    Composite c = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    GridData data;

    (this.shell = getShell()).setText(getString("title.connect"));

    c.setLayoutData(new GridData(GridData.FILL_BOTH));
    c.setLayout(layout);
    layout.numColumns = 2;
    layout.marginWidth *= 2;

    // Only present the connection information entry fields if we have no 
    // existing connection info (i.e. we are not doing autoconnect).

    if (connectionInfo == null) {
        Label label;
        Combo combo;
        Button checkbox;

        label = new Label(c, SWT.NONE);
        label.setText(getString("connect.type"));
        label.setLayoutData(
                data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));
        labelWidthHint = label.computeSize(SWT.DEFAULT, SWT.DEFAULT).x;

        combo = new Combo(c, SWT.READ_ONLY);
        combo.setLayoutData(data = new GridData(
                GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));

        stackComposite = new Composite(c, SWT.NONE);
        stackComposite.setLayout(stackLayout = new StackLayout());
        stackComposite.setLayoutData(data = new GridData(GridData.FILL_BOTH));
        data.horizontalSpan = layout.numColumns;

        checkbox = new Button(c, SWT.CHECK);
        checkbox.setLayoutData(
                data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));
        data.horizontalSpan = layout.numColumns;
        checkbox.setText(getString("connect.autoconnect"));
        checkbox.setSelection(autoconnect);
        checkbox.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                autoconnect = ((Button) event.getSource()).getSelection();
            }
        });

        label = new Label(c, SWT.SEPARATOR | SWT.HORIZONTAL);
        label.setLayoutData(
                data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));
        data.horizontalSpan = layout.numColumns;
        label.setVisible(false);

        connectionPanels = new ConnectionPanel[] { new RemoteConnectionPanel(this, stackComposite, SWT.NONE) };

        for (int i = 0; i < connectionPanels.length; i++) {
            combo.add(connectionPanels[i].getTitle());
        }

        combo.addSelectionListener(new SelectionAdapter() {
            public void widgetSelected(SelectionEvent event) {
                setConnectionPanel(((Combo) event.getSource()).getSelectionIndex());
            }
        });

        combo.select(0);
        setConnectionPanel(0);
        parent.setFocus();

        shell.addShellListener(new ShellAdapter() {
            public void shellActivated(ShellEvent event) {
                current.validate();
            }
        });
    }

    // The progess bar and its label are always present.

    progressLabel = new Label(c, SWT.NONE);
    progressLabel.setLayoutData(
            data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));
    data.horizontalSpan = layout.numColumns;

    progressIndicator = new ProgressIndicator(c);
    progressIndicator.setLayoutData(
            data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER));
    data.horizontalSpan = layout.numColumns;

    // If we are doing autoconnect, start the progress bar and the connection 
    // operation.

    if (connectionInfo != null) {
        data.grabExcessHorizontalSpace = true;
        progressLabel.setText(getString("status.connecting") + connectionInfo);
        progressIndicator.beginAnimatedTask();
        (operation = new ConnectionOperation(connectionInfo)).start();
    }

    return c;
}

From source file:com.microsoft.tfs.client.common.ui.controls.generic.ProgressMonitorControl.java

License:Open Source License

public ProgressMonitorControl(final Composite parent, final int style) {
    super(parent, style);

    final GridLayout layout = new GridLayout(1, true);
    layout.marginWidth = 0;/*from ww  w .j  ava 2 s  .  c  o  m*/
    layout.marginHeight = 0;
    layout.horizontalSpacing = getHorizontalSpacing();
    layout.verticalSpacing = getVerticalSpacing() / 2;
    setLayout(layout);

    statusLabel = new Label(this, SWT.NONE);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(statusLabel);

    progressIndicator = new ProgressIndicator(this);
    GridDataBuilder.newInstance().hGrab().hFill().applyTo(progressIndicator);
}

From source file:com.runwaysdk.manager.widgets.ProgressMonitorDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = (Composite) super.createDialogArea(parent);
    composite.setLayout(new GridLayout());

    taskLabel = new Label(composite, SWT.WRAP);
    taskLabel.setText(DEFAULT_TASKNAME);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.BEGINNING).grab(true, false)
            .hint(convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH), SWT.DEFAULT)
            .applyTo(taskLabel);//w w  w .ja  v  a  2s .  c  o  m

    // progress indicator
    GridData gd = new GridData();
    gd.heightHint = convertVerticalDLUsToPixels(BAR_DLUS);
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;

    progressIndicator = new ProgressIndicator(composite);
    progressIndicator.setLayoutData(gd);

    // label showing current task
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = convertVerticalDLUsToPixels(LABEL_DLUS);
    gd.horizontalSpan = 2;

    subTaskLabel = new Label(composite, SWT.LEFT | SWT.WRAP);
    subTaskLabel.setLayoutData(gd);
    subTaskLabel.setFont(parent.getFont());

    composite.layout(true);

    return composite;
}

From source file:net.sf.eclipsensis.dialogs.MinimalProgressMonitorDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    // task label
    message = ""; //$NON-NLS-1$
    createMessageArea(parent);//from   ww  w  .  j  a  va2  s. co m

    // progress indicator
    progressIndicator = new ProgressIndicator(parent);
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.heightHint = convertVerticalDLUsToPixels(BAR_DLUS);
    gd.horizontalSpan = 2;
    progressIndicator.setLayoutData(gd);

    // label showing sub task
    subTaskLabel = new Label(parent, SWT.LEFT);
    gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    gd.minimumWidth = mMinimumWidth / 2;
    subTaskLabel.setLayoutData(gd);
    subTaskLabel.setFont(parent.getFont());

    Label label = new Label(parent, SWT.RIGHT);
    label.moveBelow(subTaskLabel);
    gd = new GridData(SWT.RIGHT);
    label.setLayoutData(gd);
    label.setFont(parent.getFont());
    label.setText(mCaption);

    if (mBGImage != null) {
        subTaskLabel.addPaintListener(mLabelPaintListener);
        label.addPaintListener(mLabelPaintListener);
    }
    return parent;
}

From source file:org.eclipse.rcptt.ui.controls.StatusBarComposite.java

License:Open Source License

public void createControl(Composite parent) {
    shell = parent.getShell();//from  ww  w.j  a  va 2 s. co m
    this.parent = parent;
    composite = new Composite(parent, SWT.NONE);
    messageLabel = new Label(composite, SWT.NONE);
    progressIndicator = new ProgressIndicator(composite);
    composite.addControlListener(new ControlListener() {
        public void controlMoved(ControlEvent e) {
        }

        public void controlResized(ControlEvent e) {
            if (messageLabel != null && messageLabel.isVisible() && message != null) {
                messageLabel.setText(Dialog.shortenText(message, messageLabel));
            }
        }
    });
    setMessageLayout();
    hide();
}

From source file:org.eclipse.zest.custom.sequence.internal.DelayedProgressMonitorDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    setMessage("", false);
    createMessageArea(parent);/*from w w w.  j a  v  a2  s  .  co  m*/
    // Only set for backwards compatibility
    // progress indicator
    progressIndicator = new ProgressIndicator(parent);
    GridData gd = new GridData();
    gd.heightHint = convertVerticalDLUsToPixels(BAR_DLUS);
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.horizontalSpan = 2;
    progressIndicator.setLayoutData(gd);
    // label showing current task
    subTaskLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.heightHint = convertVerticalDLUsToPixels(LABEL_DLUS);
    gd.horizontalSpan = 2;
    subTaskLabel.setLayoutData(gd);
    subTaskLabel.setFont(parent.getFont());
    return parent;
}

From source file:org.jboss.tools.forge.ui.internal.ext.dialog.ForgeProgressMonitorPart.java

License:Open Source License

/**
 * Creates the progress monitor's UI parts and layouts them according to the
 * given layout. If the layout is <code>null</code> the part's default
 * layout is used./*from  w  w w .  j  av  a2 s  .c  o  m*/
 * 
 * @param layout
 *            The layout for the receiver.
 * @param progressIndicatorHeight
 *            The suggested height of the indicator
 */
@Override
protected void initialize(Layout layout, int progressIndicatorHeight) {
    if (layout == null) {
        GridLayout l = new GridLayout();
        l.marginWidth = 0;
        l.marginHeight = 0;
        layout = l;
    }
    int numColumns = 2;
    setLayout(layout);

    if (layout instanceof GridLayout)
        ((GridLayout) layout).numColumns = numColumns;

    fLabel = new Label(this, SWT.LEFT);
    fLabel.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false, numColumns, 1));

    if (progressIndicatorHeight == SWT.DEFAULT) {
        GC gc = new GC(fLabel);
        FontMetrics fm = gc.getFontMetrics();
        gc.dispose();
        progressIndicatorHeight = fm.getHeight();
    }

    fProgressIndicator = new ProgressIndicator(this);
    GridData gd = new GridData();
    gd.horizontalAlignment = GridData.FILL;
    gd.grabExcessHorizontalSpace = true;
    gd.grabExcessVerticalSpace = false;
    gd.verticalAlignment = GridData.CENTER;
    gd.heightHint = progressIndicatorHeight;
    fProgressIndicator.setLayoutData(gd);

    fToolBar = new ToolBar(this, SWT.FLAT);

    gd = new GridData();
    gd.grabExcessHorizontalSpace = false;
    gd.grabExcessVerticalSpace = false;
    gd.verticalAlignment = GridData.CENTER;
    fToolBar.setLayoutData(gd);
    fStopButton = new ToolItem(fToolBar, SWT.PUSH);
    // It would have been nice to use the fCancelListener, but that
    // listener operates on the fCancelComponent which must be a control.
    fStopButton.addListener(SWT.Selection, new CancelListener());
    final Image stopImage = ImageDescriptor.createFromFile(ForgeProgressMonitorPart.class, "images/stop.gif") //$NON-NLS-1$
            .createImage(getDisplay());
    final Cursor arrowCursor = new Cursor(this.getDisplay(), SWT.CURSOR_ARROW);
    fToolBar.setCursor(arrowCursor);
    fStopButton.setImage(stopImage);
    fStopButton.addDisposeListener(new DisposeListener() {
        @Override
        public void widgetDisposed(DisposeEvent e) {
            stopImage.dispose();
            arrowCursor.dispose();
        }
    });
    fStopButton.setEnabled(false);
    fStopButton.setToolTipText(JFaceResources.getString("ProgressMonitorPart.cancelToolTip")); //$NON-NLS-1$
}

From source file:org.jboss.tools.runtime.ui.dialogs.SearchRuntimePathDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    getShell().setText("Searching for runtimes...");

    Composite composite = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.horizontalSpan = 2;/*  w  w w .jav  a 2  s .com*/
    //gd.heightHint = convertVerticalDLUsToPixels(15);
    gd.minimumHeight = convertVerticalDLUsToPixels(heightHint);
    composite.setLayoutData(gd);
    composite.setLayout(new GridLayout(1, false));

    foundRuntimesLabel = new Label(composite, SWT.NONE);
    gd = new GridData(GridData.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    foundRuntimesLabel.setLayoutData(gd);
    foundRuntimesLabel.setFont(parent.getFont());
    foundRuntimesLabel.setText("");

    setMessage("Searching...", false);
    createMessageArea(composite);
    // Only set for backwards compatibility
    taskLabel = messageLabel;

    treeViewer = RuntimeUIActivator.createRuntimeViewer(runtimePaths, composite, heightHint);
    treeViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            RuntimeDefinition definition = (RuntimeDefinition) event.getElement();
            definition.setEnabled(!definition.isEnabled());
            getButton(IDialogConstants.OK_ID).setEnabled(anyDefinitionsChecked());
        }
    });

    ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(treeViewer) {
        protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
            return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
                    || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
                    || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
        }
    };

    TreeViewerEditor.create(treeViewer, actSupport,
            ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
                    | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);

    // label showing current task
    subTaskLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
    gd = new GridData(GridData.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    gd.heightHint = 0;
    subTaskLabel.setLayoutData(gd);
    subTaskLabel.setFont(parent.getFont());
    // progress indicator
    progressIndicator = new ProgressIndicator(parent);
    gd = new GridData(GridData.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    gd.heightHint = 0;
    progressIndicator.setLayoutData(gd);

    hideCreatedRuntimes = new Button(parent, SWT.CHECK);
    gd = new GridData(GridData.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    hideCreatedRuntimes.setLayoutData(gd);
    hideCreatedRuntimes.setText("Hide already created runtimes");
    hideCreatedRuntimes.setSelection(true);

    hideCreatedRuntimes.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refresh(null);
        }

    });

    return parent;
}

From source file:org.jboss.tools.runtime.ui.internal.dialogs.SearchRuntimePathDialog.java

License:Open Source License

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

    Composite composite = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    gd.horizontalSpan = 2;/*from w  w w .j a  va 2s . c om*/
    //gd.heightHint = convertVerticalDLUsToPixels(15);
    gd.minimumHeight = convertVerticalDLUsToPixels(heightHint);
    composite.setLayoutData(gd);
    composite.setLayout(new GridLayout(1, false));

    foundRuntimesLabel = new Label(composite, SWT.NONE);
    gd = new GridData(GridData.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    foundRuntimesLabel.setLayoutData(gd);
    foundRuntimesLabel.setFont(parent.getFont());
    foundRuntimesLabel.setText(""); //$NON-NLS-1$

    setMessage(Messages.SearchRuntimePathDialog_Searching, false);
    createMessageArea(composite);
    // Only set for backwards compatibility
    taskLabel = messageLabel;

    treeViewer = createRuntimeViewer(runtimePaths, composite, heightHint);
    treeViewer.addCheckStateListener(new ICheckStateListener() {

        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            RuntimeDefinition definition = (RuntimeDefinition) event.getElement();
            definition.setEnabled(!definition.isEnabled());
            getButton(IDialogConstants.OK_ID).setEnabled(anyDefinitionsChecked());
        }
    });

    ColumnViewerEditorActivationStrategy actSupport = new ColumnViewerEditorActivationStrategy(treeViewer) {
        protected boolean isEditorActivationEvent(ColumnViewerEditorActivationEvent event) {
            return event.eventType == ColumnViewerEditorActivationEvent.TRAVERSAL
                    || event.eventType == ColumnViewerEditorActivationEvent.MOUSE_DOUBLE_CLICK_SELECTION
                    || event.eventType == ColumnViewerEditorActivationEvent.PROGRAMMATIC;
        }
    };

    TreeViewerEditor.create(treeViewer, actSupport,
            ColumnViewerEditor.TABBING_HORIZONTAL | ColumnViewerEditor.TABBING_MOVE_TO_ROW_NEIGHBOR
                    | ColumnViewerEditor.TABBING_VERTICAL | ColumnViewerEditor.KEYBOARD_ACTIVATION);

    // label showing current task
    subTaskLabel = new Label(parent, SWT.LEFT | SWT.WRAP);
    gd = new GridData(GridData.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    gd.heightHint = 0;
    subTaskLabel.setLayoutData(gd);
    subTaskLabel.setFont(parent.getFont());
    // progress indicator
    progressIndicator = new ProgressIndicator(parent);
    gd = new GridData(GridData.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    gd.heightHint = 0;
    progressIndicator.setLayoutData(gd);

    hideCreatedRuntimes = new Button(parent, SWT.CHECK);
    gd = new GridData(GridData.FILL, SWT.FILL, true, false);
    gd.horizontalSpan = 2;
    hideCreatedRuntimes.setLayoutData(gd);
    hideCreatedRuntimes.setText(Messages.SearchRuntimePathDialog_Hide_already_created_runtimes);
    hideCreatedRuntimes.setSelection(true);

    hideCreatedRuntimes.addSelectionListener(new SelectionAdapter() {

        @Override
        public void widgetSelected(SelectionEvent e) {
            refresh(null);
        }

    });

    return parent;
}