Example usage for org.eclipse.jface.resource JFaceResources getDialogFont

List of usage examples for org.eclipse.jface.resource JFaceResources getDialogFont

Introduction

In this page you can find the example usage for org.eclipse.jface.resource JFaceResources getDialogFont.

Prototype

public static Font getDialogFont() 

Source Link

Document

Returns the JFace's dialog font.

Usage

From source file:ts.eclipse.ide.ui.preferences.OptionsConfigurationBlock.java

License:Open Source License

protected Combo newComboControl(Composite composite, Key key, String[] values, String[] valueLabels,
        boolean readOnly) {
    Combo comboBox = new Combo(composite, readOnly ? SWT.READ_ONLY : SWT.NONE);
    comboBox.setItems(valueLabels);/*from  w  w w  .j  a v  a2 s .c  om*/
    comboBox.setFont(JFaceResources.getDialogFont());

    makeScrollableCompositeAware(comboBox);

    String currValue = getValue(key);
    if (readOnly) {
        ControlData data = new ControlData(key, values);
        comboBox.setData(data);
        comboBox.addSelectionListener(getSelectionListener());
        comboBox.select(data.getSelection(currValue));
    } else {
        comboBox.setData(key);
        if (currValue != null) {
            comboBox.setText(currValue);
        }
        comboBox.addModifyListener(getTextModifyListener());
    }

    fComboBoxes.add(comboBox);
    return comboBox;
}

From source file:ts.eclipse.ide.ui.wizards.AbstractWizardNewTypeScriptProjectCreationPage.java

License:Open Source License

/** Creates the field for the embedded Node.js. */
private void createEmbeddedNodejsField(Composite parent, IEmbeddedNodejs[] installs) {
    useEmbeddedNodeJsButton = new Button(parent, SWT.RADIO);
    useEmbeddedNodeJsButton.setText(//ww  w. j  a v a2s.  c o m
            TypeScriptUIMessages.AbstractWizardNewTypeScriptProjectCreationPage_useEmbeddedNodeJs_label);
    useEmbeddedNodeJsButton.addListener(SWT.Selection, this);

    embeddedNodeJs = new Combo(parent, SWT.READ_ONLY);
    embeddedNodeJs.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // Create combo of embedded node.js
    String[] values = new String[installs.length];
    String[] valueLabels = new String[installs.length];
    int i = 0;
    for (IEmbeddedNodejs install : installs) {
        values[i] = install.getId();
        valueLabels[i] = install.getName();
        i++;
    }
    embeddedNodeJs.setItems(valueLabels);
    embeddedNodeJs.setFont(JFaceResources.getDialogFont());
    embeddedNodeJs.addListener(SWT.Modify, this);
    embeddedNodeJs.addModifyListener(new ModifyListener() {

        @Override
        public void modifyText(ModifyEvent e) {
            embeddedNodeJsId = embeddedNodeJs.getText();
        }
    });
}

From source file:zigen.plugin.db.ui.dialogs.WizardPage1.java

License:Open Source License

private void addDriverSection(Composite group) {

    Composite tableComposite = new Composite(group, SWT.NONE);
    GridData data = new GridData(GridData.FILL_BOTH);
    data.widthHint = 200;/*from   w  w w. j a  v a2  s  .c  om*/
    data.heightHint = 120;
    // data.heightHint = convertHeightInCharsToPixels(10);
    tableComposite.setLayoutData(data);
    ColumnLayout columnLayout = new ColumnLayout();
    tableComposite.setLayout(columnLayout);

    table = new Table(tableComposite, SWT.BORDER | SWT.SINGLE | SWT.H_SCROLL | SWT.V_SCROLL);
    tableViewer = new TableViewer(table);
    // tableViewer = new TableViewer(tableComposite, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.SINGLE);

    table = tableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(false);
    tableViewer.setContentProvider(new TableContentProvider());
    tableViewer.setLabelProvider(new TableLabelProvider());
    tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            ISelection select = event.getSelection();
            if (select != null) {
                removeBtn.setEnabled(true);
            } else {
                removeBtn.setEnabled(false);
            }
        }

    });

    // GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    GridData gd = new GridData(GridData.FILL_BOTH);
    // gd.heightHint = 50;
    tableViewer.getControl().setLayoutData(gd);

    // setHeaderColumn(table, new String[] {""}); //$NON-NLS-1$

    GC gc = new GC(getShell());
    gc.setFont(JFaceResources.getDialogFont());

    TableColumn column1 = new TableColumn(table, SWT.NONE);
    String DISPLAY_TXT = "PATH"; //$NON-NLS-1$
    column1.setText(DISPLAY_TXT);
    int minWidth = computeMinimumColumnWidth(gc, DISPLAY_TXT);
    columnLayout.addColumnData(new ColumnWeightData(1, minWidth, true));
    gc.dispose();

    // initializeDialogUnits(table);

    if (getOldConfig() != null) {
        classpathList = new ArrayList();
        String[] list = getOldConfig().getClassPaths();
        for (int i = 0; i < list.length; i++) {
            classpathList.add(list[i]);
        }
    } else {
        classpathList = new ArrayList();
    }
    tableViewer.setInput(classpathList);

    Composite buttonComp = new Composite(group, SWT.NONE);
    buttonComp.setLayout(new GridLayout(4, false));
    buttonComp.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    addBtn = WidgetUtil.createButton(buttonComp, SWT.PUSH, Messages.getString("WizardPage1.11"), BUTTON_WIDTH, //$NON-NLS-1$
            new GridData());
    addBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            FileDialog openDialog = new FileDialog(table.getShell(), SWT.OPEN);
            String openFile = openDialog.open();
            if (openFile != null) {
                if (!classpathList.contains(openFile)) {
                    classpathList.add(openFile);
                    tableViewer.setInput(classpathList);
                    columnsPack(table);
                }

            }
        }
    });
    addBtn2 = WidgetUtil.createButton(buttonComp, SWT.PUSH, Messages.getString("WizardPage1.12"), BUTTON_WIDTH, //$NON-NLS-1$
            new GridData());
    addBtn2.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DirectoryDialog openDialog = new DirectoryDialog(table.getShell(), SWT.OPEN);
            String openFile = openDialog.open();
            if (openFile != null) {
                if (!classpathList.contains(openFile)) {
                    classpathList.add(openFile);
                    tableViewer.setInput(classpathList);
                    columnsPack(table);
                }
            }
        }
    });
    removeBtn = WidgetUtil.createButton(buttonComp, SWT.PUSH, Messages.getString("WizardPage1.13"), //$NON-NLS-1$
            BUTTON_WIDTH, new GridData());
    removeBtn.setEnabled(false);
    removeBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            int selectionIndex = table.getSelectionIndex();
            if (selectionIndex >= 0) {
                table.remove(selectionIndex);
                classpathList.remove(selectionIndex);
                tableViewer.setInput(classpathList);
                // columnsPack(table);
            }
        }
    });

    final Button registedBtn = WidgetUtil.createButton(buttonComp, SWT.PUSH,
            Messages.getString("WizardPage1.14"), BUTTON_WIDTH, new GridData()); //$NON-NLS-1$
    registedBtn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            DriverSelectDialog dialog = new DriverSelectDialog(registedBtn.getShell());
            if (dialog.open() == DriverSelectDialog.OK) {
                classpathList.addAll(dialog.getTargetNames());
                tableViewer.setInput(classpathList);
                columnsPack(table);

            }
        }
    });

}

From source file:zigen.plugin.db.ui.dialogs.WizardPage3.java

License:Open Source License

private void addSchemaFilterSection(Composite group) {

    Composite innerPanel1 = new Composite(group, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;//from   www  .j  a  v a  2s  .  c  o  m
    gridLayout.marginWidth = 0;
    innerPanel1.setLayout(gridLayout);
    innerPanel1.setLayoutData(new GridData(GridData.FILL_BOTH));

    visibleCheck = new Button(innerPanel1, SWT.CHECK);
    visibleCheck.setText(Messages.getString("WizardPage3.21")); //$NON-NLS-1$
    visibleCheck.setSelection(false);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    visibleCheck.setLayoutData(data);
    visibleCheck.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            checkFilterPattern = visibleCheck.getSelection();
            if (checkFilterPattern) {
                filter(filterText.getText());
            } else {
                filter(""); //$NON-NLS-1$
            }
            setEnabled(checkFilterPattern);
        }
    });

    // Label label = new Label(innerPanel1, SWT.NONE);
    // label.setText(Messages.getString("WizardPage3.13")); //$NON-NLS-1$
    filterText = new Text(innerPanel1, SWT.SINGLE | SWT.BORDER);
    filterText.setEnabled(false);
    filterText.addFocusListener(new TextSelectionListener());
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    filterText.setLayoutData(data);

    final Label label = new Label(innerPanel1, SWT.NONE);
    label.setText(Messages.getString("WizardPage3.23")); //$NON-NLS-1$
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;
    label.setLayoutData(data);

    Composite innerPanel3 = new Composite(group, SWT.NONE);
    gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    innerPanel3.setLayout(gridLayout);
    data = new GridData();
    data.horizontalSpan = 2;
    data.horizontalAlignment = GridData.END;
    innerPanel3.setLayoutData(data);

    regularExpressions = new Button(innerPanel3, SWT.CHECK);
    regularExpressions.setEnabled(false);
    regularExpressions.setText(Messages.getString("WizardPage3.14")); //$NON-NLS-1$
    regularExpressions.setSelection(false);
    data = new GridData();
    // data.horizontalSpan = 2;
    data.horizontalAlignment = GridData.END;
    regularExpressions.setLayoutData(data);
    regularExpressions.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            label.setVisible(!regularExpressions.getSelection());
        }

    });

    caseSensitive = new Button(innerPanel3, SWT.CHECK);
    caseSensitive.setEnabled(false);
    caseSensitive.setText(Messages.getString("WizardPage3.15")); //$NON-NLS-1$
    caseSensitive.setSelection(false);
    data = new GridData();
    // data.horizontalSpan = 2;
    data.horizontalAlignment = GridData.END;
    caseSensitive.setLayoutData(data);

    Composite innerPanel2 = new Composite(group, SWT.NONE);
    gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    innerPanel2.setLayout(gridLayout);
    innerPanel2.setLayoutData(new GridData(GridData.FILL_BOTH));

    Composite tableComposite = new Composite(innerPanel2, SWT.NONE);
    data = new GridData(GridData.FILL_BOTH);
    data.widthHint = 200;
    data.heightHint = 120;
    // data.heightHint = convertHeightInCharsToPixels(10);
    tableComposite.setLayoutData(data);
    ColumnLayout columnLayout = new ColumnLayout();
    tableComposite.setLayout(columnLayout);
    // Table table = new Table(tableComposite, SWT.CHECK | SWT.BORDER |
    // SWT.MULTI | SWT.FULL_SELECTION | SWT.H_SCROLL | SWT.V_SCROLL);
    Table table = new Table(tableComposite, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    GC gc = new GC(getShell());
    gc.setFont(JFaceResources.getDialogFont());

    TableColumn column1 = new TableColumn(table, SWT.NONE);
    column1.setText(DISPLAY_TXT);
    int minWidth = computeMinimumColumnWidth(gc, DISPLAY_TXT);
    columnLayout.addColumnData(new ColumnWeightData(1, minWidth, true));
    // columnLayout.addColumnData(new ColumnPixelData(minWidth, false,
    // false));
    gc.dispose();

    fTableViewer = new CheckboxTableViewer(table);
    fTableViewer.setLabelProvider(new SchemaLabelProvider());
    fTableViewer.setContentProvider(new SchemaContentProvider());

    fTableViewer.setInput(filterSchemas);

    if (filterSchemas != null) {
        for (int i = 0; i < filterSchemas.length; i++) {
            SchemaInfo info = filterSchemas[i];
            fTableViewer.setChecked(info, info.isChecked());
        }
    }

    Composite buttonComposite = new Composite(tableComposite, SWT.NONE);
    buttonComposite.setLayout(new GridLayout(1, true));
    data = new GridData(GridData.FILL_HORIZONTAL);
    data.minimumHeight = 0;
    data.minimumWidth = 0;
    data.horizontalIndent = 0;
    data.verticalIndent = 0;

    buttonComposite.setLayoutData(data);

    Composite buttons = new Composite(innerPanel2, SWT.NONE);
    buttons.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING));
    gridLayout = new GridLayout();
    gridLayout.marginHeight = 0;
    gridLayout.marginWidth = 0;
    buttons.setLayout(gridLayout);

    selectedCheckOn = WidgetUtil.createButton(buttons, SWT.PUSH, Messages.getString("WizardPage3.16"), //$NON-NLS-1$
            BUTTON_WIDTH2, new GridData());
    selectedCheckOn.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            for (int i = 0; i < fTableViewer.getTable().getItemCount(); i++) {
                SchemaInfo schema = (SchemaInfo) fTableViewer.getElementAt(i);
                schema.setChecked(true);
                fTableViewer.setChecked(schema, true);

            }
        }
    });

    selectedCheckOff = WidgetUtil.createButton(buttons, SWT.PUSH, Messages.getString("WizardPage3.17"), //$NON-NLS-1$
            BUTTON_WIDTH2, new GridData());
    selectedCheckOff.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            for (int i = 0; i < fTableViewer.getTable().getItemCount(); i++) {
                SchemaInfo schema = (SchemaInfo) fTableViewer.getElementAt(i);
                schema.setChecked(false);
                fTableViewer.setChecked(schema, false);
            }
        }
    });

    Button onlyDefaultSchema = WidgetUtil.createButton(buttons, SWT.PUSH, Messages.getString("WizardPage3.18"), //$NON-NLS-1$
            BUTTON_WIDTH2, new GridData());
    onlyDefaultSchema.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            config = ((DBConfigWizard) getWizard()).createNewConfig();
            // schemas = getSchemas();
            for (int i = 0; i < filterSchemas.length; i++) {
                SchemaInfo info = filterSchemas[i];
                if (info.getName().equalsIgnoreCase(config.getSchema())) {
                    info.setChecked(true);
                } else {
                    info.setChecked(false);
                }
                fTableViewer.setChecked(info, info.isChecked());
            }
            fTableViewer.setInput(filterSchemas);
            // filter(filterText.getText());
        }
    });

    Button reload = WidgetUtil.createButton(buttons, SWT.PUSH, Messages.getString("WizardPage3.19"), //$NON-NLS-1$
            BUTTON_WIDTH2, new GridData());
    reload.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            config = ((DBConfigWizard) getWizard()).createNewConfig();
            filterSchemas = loadSchemas();
            ;
            fTableViewer.setInput(filterSchemas);
            // filter(filterText.getText());
        }
    });

    // filterText.addKeyListener(new KeyAdapter() {
    // public void keyReleased(KeyEvent e) {
    // filter(filterText.getText());
    // }
    //
    // });
    filterText.addKeyListener(new FilterListener());

    regularExpressions.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            // filter(filterText.getText());
        }
    });
    caseSensitive.addSelectionListener(new SelectionAdapter() {

        public void widgetSelected(SelectionEvent e) {
            // filter(filterText.getText());
        }
    });

    fTableViewer.addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            SchemaInfo schema = (SchemaInfo) event.getElement();
            schema.setChecked(event.getChecked());
            // test(filterSchemas);
        }
    });

    filterText.setText(filterPattern);
    visibleCheck.setSelection(checkFilterPattern);
    setEnabled(checkFilterPattern);

}

From source file:zigen.plugin.db.ui.views.internal.ElementFilterDialog.java

License:Open Source License

protected void createFolderArea(Composite composite) {
    Group group = new Group(composite, SWT.NONE);
    group.setText(Messages.getString("ElementFilterDialog.1")); //$NON-NLS-1$
    group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    group.setLayout(new GridLayout(1, false));

    final Label labe2 = new Label(group, SWT.NONE);
    labe2.setText(Messages.getString("ElementFilterDialog.2")); //$NON-NLS-1$
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.horizontalSpan = 2;/*from w w w .  j a  va2s .  co m*/
    labe2.setLayoutData(data);
    Composite tableComposite = new Composite(group, SWT.NONE);
    data = new GridData(GridData.FILL_BOTH);
    data.widthHint = 200;
    data.heightHint = 120;
    tableComposite.setLayoutData(data);
    ColumnLayout columnLayout = new ColumnLayout();
    tableComposite.setLayout(columnLayout);
    Table table = new Table(tableComposite, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
    table.setHeaderVisible(false);
    table.setLinesVisible(false);
    GC gc = new GC(getShell());
    gc.setFont(JFaceResources.getDialogFont());
    TableColumn column1 = new TableColumn(table, SWT.NONE);
    column1.setText(""); //$NON-NLS-1$
    int minWidth = computeMinimumColumnWidth(gc, ""); //$NON-NLS-1$
    columnLayout.addColumnData(new ColumnWeightData(1, minWidth, true));
    gc.dispose();
    fTableViewer = new CheckboxTableViewer(table);
    fTableViewer.setLabelProvider(new FolderLabelProvider());
    fTableViewer.setContentProvider(new FolderContentProvider());
    filterFolders = loadFolders();
    fTableViewer.setInput(filterFolders);

    if (filterFolders != null) {
        for (int i = 0; i < filterFolders.length; i++) {
            FolderInfo info = filterFolders[i];
            fTableViewer.setChecked(info, info.isChecked());
        }
    }

    fTableViewer.addCheckStateListener(new ICheckStateListener() {

        public void checkStateChanged(CheckStateChangedEvent event) {
            FolderInfo info = (FolderInfo) event.getElement();
            info.setChecked(event.getChecked());
        }
    });
}