Search in sources :

Example 1 with CheckboxTreeAndListGroup

use of org.eclipse.linuxtools.internal.docker.ui.CheckboxTreeAndListGroup in project linuxtools by eclipse.

the class ContainerCopyFromPage method createControl.

@Override
public void createControl(Composite parent) {
    // page group
    Composite composite = new Composite(parent, SWT.NULL);
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1).grab(true, false).applyTo(composite);
    GridLayoutFactory.fillDefaults().numColumns(COLUMNS).margins(6, 6).applyTo(composite);
    Label targetLabel = new Label(composite, SWT.NULL);
    targetLabel.setText(WizardMessages.getString(TARGET_LABEL));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(false, false).applyTo(targetLabel);
    targetText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    targetText.addModifyListener(Listener);
    targetText.setToolTipText(WizardMessages.getString(TARGET_TOOLTIP));
    GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1).grab(true, false).applyTo(targetText);
    browseButton = new Button(composite, SWT.NONE);
    browseButton.setText(WizardMessages.getString(BROWSE_LABEL));
    browseButton.addSelectionListener(onBrowseSelect());
    GridDataFactory.fillDefaults().align(SWT.END, SWT.FILL).span(1, 1).grab(false, false).applyTo(browseButton);
    // Create a fake parent of the root to be the dialog input element.
    // Use an empty label so that display of the element's full name
    // doesn't include a confusing label
    // $NON-NLS-1$
    FileSystemElement input = new FileSystemElement("", null, true);
    input.addChild(root);
    root.setParent(input);
    Composite selectionComposite = null;
    if (canBrowseContainer) {
        selectionComposite = new Composite(composite, SWT.NULL);
        GridLayout selectionLayout = new GridLayout();
        selectionComposite.setLayout(selectionLayout);
        selectionGroup = new CheckboxTreeAndListGroup(selectionComposite, input, getFolderProvider(), getDynamicFolderProvider(), new WorkbenchLabelProvider(), getFileProvider(), new WorkbenchLabelProvider(), SWT.NONE, // since this page has no
        SIZING_SELECTION_WIDGET_WIDTH, // other significantly-sized
        SIZING_SELECTION_WIDGET_HEIGHT);
        // hardcode the combined
        // widget's
        // size, otherwise it will open too small
        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(3, 1).grab(true, false).applyTo(selectionComposite);
    } else {
        Label sourceLabel = new Label(composite, SWT.NONE);
        sourceLabel.setText(WizardMessages.getString(SOURCE_LABEL));
        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).span(1, 1).grab(false, false).applyTo(sourceLabel);
        sourceText = new Text(composite, SWT.BORDER | SWT.SINGLE);
        sourceText.addModifyListener(Listener);
        sourceText.setToolTipText(WizardMessages.getString(SOURCE_TOOLTIP));
        GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).span(1, 1).grab(true, false).applyTo(sourceText);
    }
    if (canBrowseContainer) {
        WorkbenchViewerComparator comparator = new WorkbenchViewerComparator();
        selectionGroup.setTreeComparator(comparator);
        selectionGroup.setListComparator(comparator);
        selectionGroup.addCheckStateListener(CheckListener);
    }
    setControl(composite);
    validate();
    setPageComplete(false);
    if (canBrowseContainer) {
        selectionGroup.aboutToOpen();
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) WorkbenchLabelProvider(org.eclipse.ui.model.WorkbenchLabelProvider) Composite(org.eclipse.swt.widgets.Composite) Button(org.eclipse.swt.widgets.Button) Label(org.eclipse.swt.widgets.Label) MinimizedFileSystemElement(org.eclipse.linuxtools.internal.docker.ui.MinimizedFileSystemElement) FileSystemElement(org.eclipse.ui.dialogs.FileSystemElement) Text(org.eclipse.swt.widgets.Text) WorkbenchViewerComparator(org.eclipse.ui.model.WorkbenchViewerComparator) CheckboxTreeAndListGroup(org.eclipse.linuxtools.internal.docker.ui.CheckboxTreeAndListGroup)

Aggregations

CheckboxTreeAndListGroup (org.eclipse.linuxtools.internal.docker.ui.CheckboxTreeAndListGroup)1 MinimizedFileSystemElement (org.eclipse.linuxtools.internal.docker.ui.MinimizedFileSystemElement)1 GridLayout (org.eclipse.swt.layout.GridLayout)1 Button (org.eclipse.swt.widgets.Button)1 Composite (org.eclipse.swt.widgets.Composite)1 Label (org.eclipse.swt.widgets.Label)1 Text (org.eclipse.swt.widgets.Text)1 FileSystemElement (org.eclipse.ui.dialogs.FileSystemElement)1 WorkbenchLabelProvider (org.eclipse.ui.model.WorkbenchLabelProvider)1 WorkbenchViewerComparator (org.eclipse.ui.model.WorkbenchViewerComparator)1