Example usage for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN

List of usage examples for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN

Introduction

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

Prototype

int HORIZONTAL_MARGIN

To view the source code for org.eclipse.jface.dialogs IDialogConstants HORIZONTAL_MARGIN.

Click Source Link

Document

Horizontal margin in dialog units (value 7).

Usage

From source file:com.nginious.http.plugin.ProjectPropertyPage.java

License:Apache License

protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);/*from   ww w  .j av  a 2  s.  c  om*/

    IAdaptable element = this.getElement();

    if (element instanceof IJavaProject) {
        IJavaProject javaProject = (IJavaProject) element;
        this.project = javaProject.getProject();
    } else {
        this.project = (IProject) element;
    }

    final Composite composite = new Composite(parent, SWT.NULL);
    composite.setFont(parent.getFont());
    composite.setLayout(initGridLayout(new GridLayout(1, false), true));
    composite.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));

    int horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    int verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    int marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    int marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    this.block = new PropertiesBlock(this.project, horizontalSpacing, verticalSpacing, marginWidth,
            marginHeight);
    block.createControls(composite);

    return composite;
}

From source file:com.nokia.carbide.remoteconnections.internal.ui.ClientServiceSiteUI2.java

License:Open Source License

public void createComposite(Composite parent) {
    initializeDialogUnits(parent);//w  ww . j  a  va2 s .c o m
    Group group = new Group(parent, SWT.NONE);
    group.setText(Messages.getString("ClientServiceSiteUI2.UseConnectionGroupLabel")); //$NON-NLS-1$
    group.setLayout(new GridLayout());
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    group.setData(UID, "useConnectionGroup"); //$NON-NLS-1$

    viewer = new ComboViewer(group, SWT.READ_ONLY);
    viewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            Check.checkContract(element instanceof String);
            String id = (String) element;
            return connectionNames.get(id);
        }
    });
    viewer.setContentProvider(new ArrayContentProvider());
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    viewer.getCombo().setLayoutData(gd);
    viewer.getControl().setData(UID, "viewer"); //$NON-NLS-1$
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            String connection = (String) selection.getFirstElement();
            if (connection != null && !connection.equals(ClientServiceSiteUI2.this.connection)) {
                ClientServiceSiteUI2.this.connection = connection;
                fireConnectionSelected();
            }
        }
    });

    final Composite composite = new Composite(group, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(gd);
    composite.setFont(parent.getFont());

    newButton = new Button(composite, SWT.PUSH);
    newButton.setText(Messages.getString("ClientServiceSiteUI2.NewButtonLabel")); //$NON-NLS-1$
    newButton.setFont(JFaceResources.getDialogFont());
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH);
    Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    gd.widthHint = Math.max(widthHint, minSize.x);
    newButton.setLayoutData(gd);
    newButton.setData(UID, "newButton"); //$NON-NLS-1$
    newButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            SettingsWizard wizard = new SettingsWizard(null, service);
            wizard.open(composite.getShell());
            IConnection connection = wizard.getConnectionToEdit();
            // note: refresh ASAP so the selection will be valid; but endure a listener event
            // which will redo this
            refreshUI();
            setViewerInput(connection);
        }
    });

    editButton = new Button(composite, SWT.PUSH);
    editButton.setText(Messages.getString("ClientServiceSiteUI2.EditButtonLabel")); //$NON-NLS-1$
    editButton.setFont(JFaceResources.getDialogFont());
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH);
    minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    gd.widthHint = Math.max(widthHint, minSize.x);
    editButton.setLayoutData(gd);
    editButton.setData(UID, "editButton"); //$NON-NLS-1$
    editButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            Object value = selection.getFirstElement();
            if (value instanceof String) {
                IConnection editConnection = getActualConnection((String) value);
                SettingsWizard wizard = new SettingsWizard(editConnection, service);
                wizard.open(composite.getShell());

                // leave the viewer the same, callback will refresh anything needed
            }
        }
    });

    // attach listeners
    RemoteConnectionsActivator.getConnectionsManager().addConnectionListener(this);
    RemoteConnectionsActivator.getConnectionsManager().addConnectionStoreChangedListener(this);

    // remove listeners on dispose
    group.addDisposeListener(new DisposeListener() {

        public void widgetDisposed(DisposeEvent e) {
            RemoteConnectionsActivator.getConnectionsManager()
                    .removeConnectionListener(ClientServiceSiteUI2.this);
            RemoteConnectionsActivator.getConnectionsManager()
                    .removeConnectionStoreChangedListener(ClientServiceSiteUI2.this);
        }
    });

    setViewerInput(null);
}

From source file:com.nokia.carbide.remoteconnections.ui.ClientServiceSiteUI.java

License:Open Source License

public void createComposite(Composite parent) {
    initializeDialogUnits(parent);//from www  .j av  a2 s . c o m
    Group group = new Group(parent, SWT.NONE);
    group.setText(Messages.getString("ClientServiceSiteUI.UseConnectionGroupLabel")); //$NON-NLS-1$
    group.setLayout(new GridLayout());
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
    group.setData(UID, "useConnectionGroup"); //$NON-NLS-1$

    viewer = new ComboViewer(group, SWT.READ_ONLY);
    viewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            Check.checkContract(element instanceof IConnection);
            return ((IConnection) element).getDisplayName();
        }
    });
    viewer.setContentProvider(new ArrayContentProvider());
    GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false);
    viewer.getCombo().setLayoutData(gd);
    viewer.getControl().setData(UID, "viewer"); //$NON-NLS-1$
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            IStructuredSelection selection = (IStructuredSelection) event.getSelection();
            IConnection connection = (IConnection) selection.getFirstElement();
            if (!connection.equals(ClientServiceSiteUI.this.connection)) {
                ClientServiceSiteUI.this.connection = connection;
                fireConnectionSelected();
            }
        }
    });

    final Composite composite = new Composite(group, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    gd = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(gd);
    composite.setFont(parent.getFont());

    newButton = new Button(composite, SWT.PUSH);
    newButton.setText(Messages.getString("ClientServiceSiteUI.NewButtonLabel")); //$NON-NLS-1$
    newButton.setFont(JFaceResources.getDialogFont());
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH);
    Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    gd.widthHint = Math.max(widthHint, minSize.x);
    newButton.setLayoutData(gd);
    newButton.setData(UID, "newButton"); //$NON-NLS-1$
    newButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            SettingsWizard wizard = new SettingsWizard(null, service);
            wizard.open(composite.getShell());
            setViewerInput(wizard.getConnectionToEdit());
        }
    });

    editButton = new Button(composite, SWT.PUSH);
    editButton.setText(Messages.getString("ClientServiceSiteUI.EditButtonLabel")); //$NON-NLS-1$
    editButton.setFont(JFaceResources.getDialogFont());
    gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH);
    minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    gd.widthHint = Math.max(widthHint, minSize.x);
    editButton.setLayoutData(gd);
    editButton.setData(UID, "editButton"); //$NON-NLS-1$
    editButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IStructuredSelection selection = (IStructuredSelection) viewer.getSelection();
            Object value = selection.getFirstElement();
            if (value instanceof IConnection) {
                SettingsWizard wizard = new SettingsWizard((IConnection) value, service);
                wizard.open(composite.getShell());
                setViewerInput(wizard.getConnectionToEdit());
            }
        }
    });

    setViewerInput(null);
}

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

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // create 
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    composite.setLayout(layout);/*from w ww .  j  av  a2  s  .  com*/
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // create help control if needed
    if (isHelpAvailable()) {
        createHelpControl(composite);
    }
    fCustomizeButton = createButton(composite, CUSTOMIZE_ID, SearchMessages.SearchDialog_customize, true);

    Label filler = new Label(composite, SWT.NONE);
    filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    layout.numColumns++;

    fReplaceButton = createActionButton(composite, REPLACE_ID, SearchMessages.SearchDialog_replaceAction, true);
    fReplaceButton.setVisible(fCurrentPage instanceof IReplacePage);
    Button searchButton = createActionButton(composite, SEARCH_ID, SearchMessages.SearchDialog_searchAction,
            true);
    searchButton.setEnabled(fDescriptors.size() > 0);
    super.createButtonsForButtonBar(composite); // cancel button

    return composite;
}

From source file:com.nokia.carbide.search.system.internal.ui.text.ReplaceDialog2.java

License:Open Source License

protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // createActionButton increments 
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);

    composite.setLayout(layout);// w ww.j a va 2  s .c om
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    fReplaceButton = createActionButton(composite, REPLACE, SearchMessages.ReplaceDialog_replace, true);
    fReplaceAllInFileButton = createActionButton(composite, REPLACE_ALL_IN_FILE,
            SearchMessages.ReplaceDialog_replaceAllInFile, false);

    Label filler = new Label(composite, SWT.NONE);
    filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    fReplaceAllButton = createActionButton(composite, REPLACE_ALL, SearchMessages.ReplaceDialog_replaceAll,
            false);
    fSkipButton = createActionButton(composite, SKIP, SearchMessages.ReplaceDialog_skip, false);
    fSkipFileButton = createActionButton(composite, SKIP_FILE, SearchMessages.ReplaceDialog_skipFile, false);

    filler = new Label(composite, SWT.NONE);
    filler.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    super.createButtonsForButtonBar(composite); // cancel button

    layout.numColumns = 4; // createActionButton increments 

    return composite;
}

From source file:com.nokia.cdt.internal.debug.launch.newwizard.ConnectToDeviceDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    initializeDialogUnits(parent);//from www .  j  a v  a2 s. co m
    final Composite composite = initDialogArea(parent, Messages.getString("ConnectToDeviceDialog.Title"), //$NON-NLS-1$
            LaunchWizardHelpIds.WIZARD_DIALOG_CHANGE_CONNECTION);

    Group viewerGroup = new Group(composite, SWT.NONE);
    viewerGroup.setText(Messages.getString("ConnectToDeviceDialog.GroupLabel")); //$NON-NLS-1$
    GridDataFactory.fillDefaults().applyTo(viewerGroup);
    GridLayoutFactory.swtDefaults().applyTo(viewerGroup);

    viewer = new ComboViewer(viewerGroup, SWT.READ_ONLY);
    viewer.setLabelProvider(new LabelProvider() {
        @Override
        public String getText(Object element) {
            if (element instanceof IConnection)
                return ((IConnection) element).getDisplayName();

            return Messages.getString("ConnectToDeviceDialog.NoCurrentItem"); //$NON-NLS-1$
        }
    });
    viewer.setContentProvider(new ArrayContentProvider());
    Combo combo = viewer.getCombo();
    GridDataFactory.defaultsFor(combo).grab(true, false).applyTo(combo);
    viewer.getControl().setData(UID, "combo_viewer"); //$NON-NLS-1$
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent event) {
            if (getDialogArea() != null)
                connectionSelected(getConnectionFromSelection(event.getSelection()));
        }
    });
    manager.addConnectionListener(this);

    parent.addDisposeListener(new DisposeListener() {
        public void widgetDisposed(DisposeEvent e) {
            manager.removeConnectionListener(ConnectToDeviceDialog.this);

            if (currentServiceListener != null)
                currentServiceListener.removeStatusChangedListener(ConnectToDeviceDialog.this);
        }
    });

    final Composite buttonGroup = new Composite(viewerGroup, SWT.NONE);
    int w = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_MARGIN);
    int h = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_MARGIN);
    int hs = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.HORIZONTAL_SPACING);
    int vs = Dialog.convertVerticalDLUsToPixels(fm, IDialogConstants.VERTICAL_SPACING);
    GridLayoutFactory.swtDefaults().numColumns(2).equalWidth(true).margins(w, h).spacing(hs, vs)
            .applyTo(buttonGroup);
    GridDataFactory.swtDefaults().align(SWT.END, SWT.CENTER).applyTo(buttonGroup);
    buttonGroup.setFont(parent.getFont());

    newButton = new Button(buttonGroup, SWT.PUSH);
    newButton.setText(Messages.getString("ConnectToDeviceDialog.NewLabel")); //$NON-NLS-1$
    newButton.setFont(JFaceResources.getDialogFont());
    int widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH);
    Point minSize = newButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    widthHint = Math.max(widthHint, minSize.x);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.TOP).hint(widthHint, SWT.DEFAULT).applyTo(newButton);
    newButton.setData(UID, "newButton"); //$NON-NLS-1$
    newButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            SettingsWizard wizard = new SettingsWizard(null, connectionData.getService());
            wizard.open(composite.getShell());
            IConnection connection = wizard.getConnectionToEdit();
            setViewerInput(connection);
        }
    });

    editButton = new Button(buttonGroup, SWT.PUSH);
    editButton.setText(Messages.getString("ConnectToDeviceDialog.EditLabel")); //$NON-NLS-1$
    editButton.setFont(JFaceResources.getDialogFont());
    widthHint = Dialog.convertHorizontalDLUsToPixels(fm, IDialogConstants.BUTTON_WIDTH);
    minSize = editButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
    widthHint = Math.max(widthHint, minSize.x);
    GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).hint(widthHint, SWT.DEFAULT).applyTo(editButton);
    editButton.setData(UID, "editButton"); //$NON-NLS-1$
    editButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            IConnection connection = getConnectionFromSelection(viewer.getSelection());
            if (connection != null) {
                SettingsWizard wizard = new SettingsWizard(connection, connectionData.getService());
                wizard.open(composite.getShell());
            }
        }
    });

    descriptionLabel = new Label(composite, SWT.WRAP);
    GridDataFactory.defaultsFor(descriptionLabel).grab(false, true).applyTo(descriptionLabel);
    composite.addControlListener(new ControlAdapter() {
        @Override
        public void controlResized(ControlEvent e) {
            descriptionLabel.pack();
        }
    });

    setViewerInput(connectionData.getConnection());

    return composite;
}

From source file:com.nokia.s60tools.analyzetool.ui.CustomMessageDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginWidth = 0;/*  w w  w . j  ava 2s.  c  o m*/
    layout.marginHeight = 0;
    layout.horizontalSpacing = 0;
    composite.setLayout(layout);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false));
    composite.setFont(parent.getFont());

    Control helpControl = Util.createHelpControl(composite);
    ((GridData) helpControl.getLayoutData()).horizontalIndent = convertHorizontalDLUsToPixels(
            IDialogConstants.HORIZONTAL_MARGIN);

    Control buttonSection = super.createButtonBar(composite);
    ((GridData) buttonSection.getLayoutData()).grabExcessHorizontalSpace = true;
    return composite;
}

From source file:com.nokia.tools.variant.common.ui.dialogs.OptionalMessageDialog.java

License:Open Source License

protected Control createCustomArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);/*  ww w.  j av  a2 s  . c o m*/
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    hideDialogCheckBox = new Button(composite, SWT.CHECK | SWT.LEFT);
    hideDialogCheckBox.setText(checkBoxText);
    hideDialogCheckBox.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            setDialogEnabled(id, !((Button) e.widget).getSelection());
        }
    });
    applyDialogFont(hideDialogCheckBox);
    return hideDialogCheckBox;
}

From source file:com.nokia.tools.variant.compare.ui.wizards.ImportDataWizardPageOne.java

License:Open Source License

private GridLayout initGridLayout(GridLayout layout, boolean margins) {
    layout.horizontalSpacing = pixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = pixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    if (margins) {
        layout.marginWidth = pixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.marginHeight = pixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    } else {//  ww  w .  j a  v a  2  s .  c  o  m
        layout.marginWidth = 0;
        layout.marginHeight = 0;
    }
    return layout;
}

From source file:com.nokia.tools.variant.resourcelibrary.handlers.commands.ResourcePickDialog.java

License:Open Source License

private Control createRenameBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);//  ww  w .j  a  va  2  s  .c o  m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));
    if (resource.size() == 1) {

        dialogField = new StringDialogField();
        String filename = "";
        if ((resource != null) && (resource.size() > 0)) {
            filename = resource.get(0).getName();
        }
        dialogField.setLabelText("File/Folder name: ");
        dialogField.setText(filename);
        dialogField.setDialogFieldListener(this);
        dialogField.doFillIntoGrid(composite, 2);
        LayoutUtil.setHorizontalGrabbing(dialogField.getTextControl(composite));
    }

    return composite;
}