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

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

Introduction

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

Prototype

int VERTICAL_MARGIN

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

Click Source Link

Document

Vertical margin in dialog units (value 7).

Usage

From source file:ac.soton.multisim.ui.dialogs.SimulationSettingsDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    FormLayout layout = new FormLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    composite.setLayout(layout);//  w  ww .  j a v  a 2s.c  o  m
    composite.setLayoutData(new GridData(GridData.FILL_BOTH));

    // start time
    Label label = new Label(composite, SWT.NONE);
    label.setText("Start time:");
    startTimeText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    startTimeText.setLayoutData(getAttachedData(label, true));
    startTimeText.setText(Integer.toString(startTime));
    startTimeText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateStartTime();
        }
    });

    // stop time
    label = new Label(composite, SWT.NONE);
    label.setText("Stop time:");
    label.setLayoutData(getAttachedData(startTimeText, false));
    stopTimeText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    stopTimeText.setLayoutData(getAttachedData(label, true));
    stopTimeText.setText(Integer.toString(stopTime));
    stopTimeText.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateStopTime();
        }
    });

    // ProB arguments
    label = new Label(composite, SWT.NONE);
    label.setText("ProB arguments:");
    label.setLayoutData(getAttachedData(stopTimeText, false));
    FormData layoutData = getAttachedData(label, true);
    argsText = new Text(composite, SWT.MULTI | SWT.BORDER | SWT.V_SCROLL | SWT.WRAP);
    GC gc = new GC(argsText);
    layoutData.height = gc.getFontMetrics().getHeight() * 3;
    gc.dispose();
    argsText.setLayoutData(layoutData);
    argsText.setToolTipText(ARGS_TOOLTIP);
    argsText.setText(args);

    // record checkbox
    recordOutputs = new Button(composite, SWT.CHECK);
    recordOutputs.setLayoutData(getAttachedData(argsText, false));
    recordOutputs.setText("Record outputs");
    recordOutputs.setSelection(record);

    // validators
    addValidators();
    validateTime();

    return composite;
}

From source file:ag.ion.noa4e.ui.wizards.application.LocalApplicationWizardDefinePage.java

License:LGPL

/**
 * Creates the top level control for this dialog
 * page under the given parent composite.
 *
 * @param parent the parent composite//from  w w w.  j a va2s  .  c o  m
 * 
 * @author Andreas Brker
 */
public void createControl(Composite parent) {
    System.out.println("LOAWDP: createControl");
    FormToolkit formToolkit = NOAUIPlugin.getFormToolkit();
    ScrolledForm scrolledForm = formToolkit.createScrolledForm(parent);
    GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true);

    GridLayout gridLayout = new GridLayout();
    gridLayout.marginHeight = IDialogConstants.VERTICAL_MARGIN;
    scrolledForm.getBody().setLayout(gridLayout);
    scrolledForm.getBody().setLayoutData(gridData);
    scrolledForm.getBody().setBackground(parent.getBackground());

    constructHomeSection(formToolkit, scrolledForm);
    constructApplicationsSection(formToolkit, scrolledForm);

    setControl(scrolledForm);

    if (applicationInfos != null) {
        fillTable(tableApplicationInfos);
        if (selectedHomePath == null)
            init(applicationInfos);
    }

    if (selectedHomePath != null) {
        textHome.setText(selectedHomePath);
    }

    checkPageState();
}

From source file:au.com.cybersearch2.controls.DialogPixels.java

License:Open Source License

public DialogPixels(FontMetrics fontMetrics) {
    marginWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_MARGIN);
    marginHeight = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_MARGIN);
    horizontalSpacing = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.HORIZONTAL_SPACING);
    verticalSpacing = Dialog.convertVerticalDLUsToPixels(fontMetrics, IDialogConstants.VERTICAL_SPACING);
    buttonWidth = Dialog.convertHorizontalDLUsToPixels(fontMetrics, IDialogConstants.BUTTON_WIDTH);
}

From source file:au.gov.ga.earthsci.discovery.ui.preferences.DiscoveryServicesPreferencePage.java

License:Apache License

@Override
protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
    composite.setLayoutData(gd);//from  ww  w  . ja va 2s .co  m

    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);

    table = new Table(composite,
            SWT.CHECK | SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    data.widthHint = convertWidthInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_WIDTH);
    data.heightHint = convertHeightInCharsToPixels(ILayoutConstants.DEFAULT_TABLE_HEIGHT);
    table.setLayoutData(data);

    viewer = new CheckboxTableViewer(table);

    // Key listener for delete
    table.addKeyListener(new KeyAdapter() {
        @Override
        public void keyPressed(KeyEvent e) {
            if (e.keyCode == SWT.DEL) {
                removeSelected();
            }
        }
    });
    setTableColumns();

    viewer.setComparator(comparator);
    viewer.setContentProvider(new ArrayContentProvider());
    viewer.setLabelProvider(new DiscoveryServiceLabelProvider());

    stagingSet.clear();
    stagingSet.addAll(DiscoveryServiceManager.getServices());
    viewer.setInput(stagingSet);

    viewer.setCellModifier(new ICellModifier() {
        @Override
        public boolean canModify(Object element, String property) {
            return element instanceof IDiscoveryService;
        }

        @Override
        public Object getValue(Object element, String property) {
            String name = ((IDiscoveryService) element).getName();
            return name != null ? name : ""; //$NON-NLS-1$
        }

        @Override
        public void modify(Object element, String prop, Object value) {
            if (value != null && value.toString().length() >= 0) {
                IDiscoveryService service;
                if (element instanceof Item) {
                    service = (IDiscoveryService) ((Item) element).getData();
                } else if (element instanceof IDiscoveryService) {
                    service = (IDiscoveryService) element;
                } else {
                    return;
                }
                if (!value.toString().equals(service.getName())) {
                    Map<IDiscoveryServiceProperty<?>, Object> propertyValues = new HashMap<IDiscoveryServiceProperty<?>, Object>();
                    IDiscoveryServiceProperty<?>[] properties = service.getProvider().getProperties();
                    if (properties != null) {
                        for (IDiscoveryServiceProperty<?> property : properties) {
                            propertyValues.put(property, property.getValue(service));
                        }
                    }

                    IDiscoveryService replacement = service.getProvider().createService(value.toString(),
                            service.getServiceURL(), propertyValues);
                    replacement.setEnabled(service.isEnabled());
                    stagingSet.remove(service);
                    stagingSet.add(replacement);
                    viewer.refresh();
                }
            }
        }
    });
    viewer.setColumnProperties(new String[] { "name" }); //$NON-NLS-1$
    viewer.setCellEditors(new CellEditor[] { new TextCellEditor(table) });

    viewer.setCheckStateProvider(new ICheckStateProvider() {
        @Override
        public boolean isChecked(Object element) {
            return ((IDiscoveryService) element).isEnabled();
        }

        @Override
        public boolean isGrayed(Object element) {
            return false;
        }
    });

    viewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            IDiscoveryService service = (IDiscoveryService) event.getElement();
            if (!originalEnablement.containsKey(service)) {
                originalEnablement.put(service, service.isEnabled());
            }
            service.setEnabled(event.getChecked());
            viewer.refresh();
            validateButtons();
        }
    });

    viewer.addSelectionChangedListener(new ISelectionChangedListener() {
        @Override
        public void selectionChanged(SelectionChangedEvent event) {
            validateButtons();
        }
    });

    Composite verticalButtonBar = createVerticalButtonBar(composite);
    data = new GridData(SWT.FILL, SWT.FILL, false, false);
    data.verticalAlignment = SWT.TOP;
    data.verticalIndent = 0;
    verticalButtonBar.setLayoutData(data);
    validateButtons();

    return composite;
}

From source file:au.gov.ga.earthsci.eclipse.extras.ide.ChooseWorkspaceDialog.java

License:Open Source License

/**
 * The main area of the dialog is just a row with the current selection
 * information and a drop-down of the most recently used workspaces.
 *//*from  w w w  . j  av a 2  s  .c o m*/
private void createWorkspaceBrowseRow(Composite parent) {
    Composite panel = new Composite(parent, SWT.NONE);

    GridLayout layout = new GridLayout(3, 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);
    panel.setLayout(layout);
    panel.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    panel.setFont(parent.getFont());

    Label label = new Label(panel, SWT.NONE);
    label.setText(IDEWorkbenchMessages.ChooseWorkspaceDialog_workspaceEntryLabel);

    text = new Combo(panel, SWT.BORDER | SWT.LEAD | SWT.DROP_DOWN);
    text.setFocus();
    text.setLayoutData(new GridData(400, SWT.DEFAULT));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            Button okButton = getButton(Window.OK);
            if (okButton != null && !okButton.isDisposed()) {
                boolean nonWhitespaceFound = false;
                String characters = getWorkspaceLocation();
                for (int i = 0; !nonWhitespaceFound && i < characters.length(); i++) {
                    if (!Character.isWhitespace(characters.charAt(i))) {
                        nonWhitespaceFound = true;
                    }
                }
                okButton.setEnabled(nonWhitespaceFound);
            }
        }
    });
    setInitialTextValues(text);

    Button browseButton = new Button(panel, SWT.PUSH);
    browseButton.setText(IDEWorkbenchMessages.ChooseWorkspaceDialog_browseLabel);
    setButtonLayoutData(browseButton);
    GridData data = (GridData) browseButton.getLayoutData();
    data.horizontalAlignment = GridData.HORIZONTAL_ALIGN_END;
    browseButton.setLayoutData(data);
    browseButton.addSelectionListener(new SelectionAdapter() {
        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog dialog = new DirectoryDialog(getShell(), SWT.SHEET);
            dialog.setText(IDEWorkbenchMessages.ChooseWorkspaceDialog_directoryBrowserTitle);
            dialog.setMessage(IDEWorkbenchMessages.ChooseWorkspaceDialog_directoryBrowserMessage);
            dialog.setFilterPath(getInitialBrowsePath());
            String dir = dialog.open();
            if (dir != null) {
                text.setText(TextProcessor.process(dir));
            }
        }
    });
}

From source file:aurora.ide.helpers.StatusDialog.java

License:Open Source License

/**
 * This implementation of the <code>Dialog</code> framework method creates
 * and lays out a composite. Subclasses that require a different dialog area
 * may either override this method, or call the <code>super</code>
 * implementation and add controls to the created composite.
 * /*w  ww .  ja  v  a 2  s  .c om*/
 * Note: Since 3.4, the created composite no longer grabs excess vertical
 * space. See https://bugs.eclipse.org/bugs/show_bug.cgi?id=72489. If the
 * old behavior is desired by subclasses, get the returned composite's
 * layout data and set grabExcessVerticalSpace to true.
 */
protected Control createDialogArea(Composite parent) {
    // Create a composite with standard margins and spacing
    // Add the messageArea to this composite so that as subclasses add
    // widgets to the messageArea
    // and dialogArea, the number of children of parent remains fixed and
    // with consistent layout.
    // Fixes bug #240135
    Composite composite = new Composite(parent, SWT.NONE);
    createMessageArea(composite);
    createSupportArea(parent);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    composite.setLayout(layout);
    GridData childData = new GridData(GridData.FILL_BOTH);
    childData.horizontalSpan = 2;
    childData.grabExcessVerticalSpace = false;
    composite.setLayoutData(childData);
    composite.setFont(parent.getFont());

    return composite;
}

From source file:ch.hilbri.assist.application.parts.AboutDialog.java

License:Open Source License

@Override
protected Control createButtonBar(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    // create a layout with spacing and margins appropriate for the font
    // size.//from   ww w.jav  a 2s .  c om
    GridLayout layout = new GridLayout();
    layout.numColumns = 0; // this is incremented by createButton
    layout.makeColumnsEqualWidth = true;
    layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    composite.setLayout(layout);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_END | GridData.VERTICAL_ALIGN_CENTER);
    composite.setLayoutData(data);
    composite.setFont(parent.getFont());

    createButton(composite, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true);

    return composite;
}

From source file:com.aliyun.odps.eclipse.create.wizard.NewOdpsProjectWizardPage.java

License:Apache License

@Override
public void createControl(Composite parent) {
    super.createControl(parent);

    setTitle(PAGE_TITLE_TXT);/*from   ww  w  . jav  a  2  s.c o m*/
    setDescription(PAGE_DESCRIPTION_TXT);

    Group group = new Group((Composite) getControl(), SWT.NONE);
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setText(CONSOLE_LOCATION_TXT);
    GridLayout layout = new GridLayout(2, true);
    layout.marginLeft = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginRight = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    layout.marginTop = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginBottom = convertHorizontalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.makeColumnsEqualWidth = false;
    group.setLayout(layout);
    new Label(group, SWT.NONE);
    new Label(group, SWT.NONE);

    radioDefaultConsoleLocation = new Button(group, SWT.RADIO);
    GridData d = new GridData(GridData.BEGINNING, GridData.BEGINNING, false, false);
    radioDefaultConsoleLocation.setLayoutData(d);
    radioDefaultConsoleLocation.setSelection(true);

    updateHadoopDirLabelFromPreferences();

    linkConfigDefaultConsoleLocation = new Link(group, SWT.NONE);
    linkConfigDefaultConsoleLocation.setText(CONFIG_CONSOLE_LOCATION_LINK_TXT);
    linkConfigDefaultConsoleLocation
            .setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
    linkConfigDefaultConsoleLocation.addSelectionListener(this);

    radioNewConsoleLocation = new Button(group, SWT.RADIO);
    GridData gd_radioNewConsoleLocation = new GridData(GridData.BEGINNING, GridData.CENTER, false, false);
    gd_radioNewConsoleLocation.horizontalSpan = 2;
    radioNewConsoleLocation.setLayoutData(gd_radioNewConsoleLocation);
    radioNewConsoleLocation.setText(SPECIFY_CONSOLE_LOCATION_TXT);

    txtNewConsoleLocation = new Text(group, SWT.SINGLE | SWT.BORDER);
    txtNewConsoleLocation.setText("");
    // d = new GridData(SWT.LEFT, GridData.BEGINNING, true, false);
    d = new GridData(GridData.FILL_HORIZONTAL | GridData.BEGINNING | SWT.LEFT);
    d.horizontalSpan = 1;
    d.widthHint = 360;
    txtNewConsoleLocation.setLayoutData(d);
    txtNewConsoleLocation.setEnabled(false);

    btnNewConsoleLocation = new Button(group, SWT.NONE);
    btnNewConsoleLocation.setText("Browse...");
    btnNewConsoleLocation.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
    btnNewConsoleLocation.setEnabled(false);
    btnNewConsoleLocation.addSelectionListener(this);

    radioNewConsoleLocation.addSelectionListener(this);
    radioDefaultConsoleLocation.addSelectionListener(this);

    curConsoleVersionLabel = new Label(group, SWT.NONE);
    new Label(group, SWT.NONE);

    versionWarningLabel = new Label(group, SWT.NONE);
    new Label(group, SWT.NONE);

    // generateDriver = new Button((Composite) getControl(), SWT.CHECK);
    // generateDriver.setText("Generate a MapReduce driver");
    // generateDriver.addListener(SWT.Selection, new Listener()
    // {
    // public void handleEvent(Event event) {
    // getContainer().updateButtons(); }
    // });
}

From source file:com.amalto.workbench.dialogs.DOMViewDialog.java

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    try {/*from   w w w.  j av a  2 s  .  c  o  m*/
        // Should not really be here but well,....
        if (editable) {
            parent.getShell().setText(Messages.DOMViewDialog_EditorViewer);
        } else {
            parent.getShell().setText(Messages.DOMViewDialog_Viewer);
        }

        Composite composite = new Composite(parent, SWT.NULL);
        GridLayout layout = new GridLayout();
        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);
        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
        applyDialogFont(composite);

        if (desc != null && desc.length() > 0) {
            new Label(composite, SWT.NONE).setText(desc);
        }

        tabFolder = new TabFolder(composite, SWT.TOP | SWT.H_SCROLL | SWT.V_SCROLL);
        tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        ((GridData) tabFolder.getLayoutData()).heightHint = 600;
        ((GridData) tabFolder.getLayoutData()).widthHint = 600;

        tabFolder.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {
            }

            public void widgetSelected(SelectionEvent e) {
                if (tabFolder.getSelectionIndex() == 0) {
                    if (node == null) {
                        try {

                            if (sourceViewer == null || sourceViewer.getDocument() == null) {
                                return;
                            }
                            node = Util.parse(sourceViewer.getText());

                        } catch (Exception ex) {

                            log.error(ex.getMessage(), ex);
                            tabFolder.setSelection(1);
                            MessageDialog.openError(DOMViewDialog.this.getShell(),
                                    Messages.DOMViewDialog_XMLInvalid, Messages.bind(
                                            Messages.DOMViewDialog_XMLInvalidInfo, ex.getLocalizedMessage()));
                            return;
                        }
                        domViewer.setInput(node);
                        domViewer.expandAll();
                    }
                } else if (tabFolder.getSelectionIndex() == 1) {
                    try {
                        sourceViewer.setText(Util.nodeToString(node));
                        node = null; // this should be better implemented in a change listener on the text
                    } catch (Exception ex) {
                        MessageDialog.openError(DOMViewDialog.this.getShell(),
                                Messages.DOMViewDialog_ErrorTitle,
                                Messages.bind(Messages.DOMViewDialog_ErrorMsg, ex.getLocalizedMessage()));
                        sourceViewer.setText(""); //$NON-NLS-1$
                    }
                }
            }// widget Selected
        });

        TabItem tiDOM = new TabItem(tabFolder, SWT.NULL);
        tiDOM.setText(Messages.DOMViewDialog_Tree);
        tiDOM.setToolTipText(Messages.DOMViewDialog_DisplayAsDomTree);

        domViewer = new TreeViewer(tabFolder, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
        domViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        // ((GridData)domViewer.getControl().getLayoutData()).heightHint=300;
        // ((GridData)domViewer.getControl().getLayoutData()).widthHint=300;
        domViewer.setSorter(null);
        domViewer.setLabelProvider(new DOMTreeLabelProvider());
        domViewer.setContentProvider(new DOMTreeContentProvider());
        domViewer.setInput(node);
        domViewer.expandAll();
        domViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

        tiDOM.setControl(domViewer.getControl());

        TabItem tiSource = new TabItem(tabFolder, SWT.NULL);
        tiSource.setText(Messages.DOMViewDialog_TiSourceText);
        tiSource.setToolTipText(Messages.DOMViewDialog_TiSourceTip);

        XMLSourceViewerHelper sourceViewerHelper = XMLSourceViewerHelper.getInstance();
        sourceViewer = new XMLSourceViewer(tabFolder, sourceViewerHelper.createVerticalRuler(),
                sourceViewerHelper.createOverviewRuler(), true, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
        XMLConfiguration sourceViewerConfiguration = new XMLConfiguration(this);
        sourceViewer.configure(sourceViewerConfiguration);
        sourceViewer.initilize();
        sourceViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        sourceViewer.setText(Util.nodeToString(node));
        sourceViewer.setEditable(this.editable);
        /*
         * sourceViewer.addTextListener( new ITextListener() { public void
         * textChanged(org.eclipse.jface.text.TextEvent event) { if ((event.getText()==null) ||
         * ("".equals(event.getText()))) return; node = null; elementChanged = true; } } );
         */
        tiSource.setControl(sourceViewer.getControl());

        tabFolder.setSelection(firstTab);
        if (firstTab == SOURCE_VIEWER) {
            node = null; // force refresh of tree
        }

        return composite;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getShell(), Messages._Error,
                Messages.bind(Messages.DOMViewDialog_ErrorMsg1, e.getLocalizedMessage()));
        return null;
    }

}

From source file:com.amalto.workbench.dialogs.PluginDetailsDialog.java

License:Open Source License

protected Control createDialogArea(Composite parent) {

    try {/*from  w  w  w  .j av a 2 s .c o m*/
        // Should not really be here but well,....
        parent.getShell().setText(Messages.PluginDetailsDialog_PluginDetails);

        Composite composite = new Composite(parent, SWT.NULL);
        GridLayout layout = new GridLayout();
        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);
        composite.setLayoutData(new GridData(GridData.FILL_BOTH));
        applyDialogFont(composite);

        tabFolder = new TabFolder(composite, SWT.TOP);
        tabFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        tabFolder.setLayout(new GridLayout(1, true));
        ((GridData) tabFolder.getLayoutData()).heightHint = 600;
        ((GridData) tabFolder.getLayoutData()).widthHint = 600;

        TabItem descriptionTI = new TabItem(tabFolder, SWT.NULL);
        descriptionTI.setText(Messages.PluginDetailsDialog_Description);
        descriptionTI.setToolTipText(Messages.PluginDetailsDialog_DescriptionTip);

        Composite descriptionC = new Composite(tabFolder, SWT.NULL);
        descriptionC.setLayout(new GridLayout(1, true));
        descriptionC.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));

        /*
         * Label descriptionLabel = new Label(descriptionC, SWT.LEFT); descriptionLabel.setLayoutData( new
         * GridData(SWT.LEFT,SWT.CENTER,false,false,1,1) ); FontData fd =
         * descriptionLabel.getFont().getFontData()[0]; fd.setStyle(SWT.BOLD); descriptionLabel.setFont(new
         * Font(Display.getDefault(),fd)); descriptionLabel.setText("Description");
         */

        Label descValue = new Label(descriptionC, SWT.WRAP);
        descValue.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
        descValue.setText(description + "\n");//$NON-NLS-1$

        Label documentationLabel = new Label(descriptionC, SWT.LEFT);
        documentationLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, false, false, 1, 1));
        documentationLabel.setFont(FontUtils.getBoldFont(documentationLabel.getFont()));
        documentationLabel.setText(templetName);

        Text docValue = new Text(descriptionC, SWT.WRAP | SWT.READ_ONLY | SWT.V_SCROLL);
        docValue.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
        docValue.setBackground(documentationLabel.getBackground());
        docValue.setText(documentation);

        descriptionTI.setControl(descriptionC);

        /*
         * TabItem parametersTI = new TabItem(tabFolder,SWT.NULL); parametersTI.setText("Parameters");
         * parametersTI.setToolTipText("Display the plugin description and documentation");
         * 
         * Composite parametersC = new Composite(tabFolder,SWT.NULL); parametersC.setLayout(new GridLayout(1,true));
         * 
         * Label paramsValue = new Label(parametersC, SWT.WRAP); paramsValue.setLayoutData( new
         * GridData(SWT.FILL,SWT.CENTER,true,false,1,1) ); paramsValue.setText(parametersSchema);
         * 
         * parametersTI.setControl(parametersC);
         */

        tabFolder.setSelection(0);

        return composite;
    } catch (Exception e) {
        log.error(e.getMessage(), e);
        MessageDialog.openError(this.getShell(), Messages._Error,
                Messages.bind(Messages.PluginDetailsDialog_ErrorMsg, e.getLocalizedMessage()));
        return null;
    }

}