Example usage for org.eclipse.jface.dialogs Dialog applyDialogFont

List of usage examples for org.eclipse.jface.dialogs Dialog applyDialogFont

Introduction

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

Prototype

public static void applyDialogFont(Control control) 

Source Link

Document

Applies the dialog font to all controls that currently have the default font.

Usage

From source file:net.sf.eclipsefp.haskell.style.stylishhaskell.ui.SHConfigurationPP.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout();
    layout.numColumns = 1;/*from  w ww  .  j a  v a  2s .  com*/
    container.setLayout(layout);

    bProject = new Button(container, SWT.CHECK);
    bProject.setText(StyleText.sh_project);

    final Group g = new Group(parent, SWT.NONE);
    //g.setText(StyleText.sh_title);
    g.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_VERTICAL));
    g.setLayout(new GridLayout(1, true));

    IProject project = (IProject) getElement();
    confComp = new SHConfigurationComposite(g, SWT.NONE);
    confComp.setLayoutData(new GridData(GridData.VERTICAL_ALIGN_BEGINNING | GridData.GRAB_VERTICAL));
    confComp.setConfiguration(StylishHaskell.getProjectConfiguration(project));

    bProject.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            confComp.setEnabled(bProject.getSelection());
            g.setEnabled(bProject.getSelection());
        }
    });

    boolean hasConfig = StylishHaskell.hasProjectConfiguration(project);
    bProject.setSelection(hasConfig);
    confComp.setEnabled(hasConfig);
    g.setEnabled(bProject.getSelection());

    Label space = new Label(parent, SWT.NONE);
    space.setLayoutData(new GridData(GridData.FILL_VERTICAL));

    Dialog.applyDialogFont(parent);
    return container;
}

From source file:net.sf.eclipsefp.haskell.ui.properties.ExtraCabalParamsPP.java

License:Open Source License

@Override
protected Control createContents(final Composite parent) {
    Composite container = new Composite(parent, SWT.NULL);
    GridLayout layout = new GridLayout(1, true);

    container.setLayout(layout);// w ww  . j av a2 s.co  m
    container.setLayoutData(
            new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL));

    Label lExtraLibDirs = new Label(container, SWT.NONE);
    lExtraLibDirs.setText(UITexts.properties_extra_libdirs);

    extraLibDirs = new DirectoryListComposite(container, SWT.NONE);
    extraLibDirs.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));

    Label lExtraIncDirs = new Label(container, SWT.NONE);
    lExtraIncDirs.setText(UITexts.properties_extra_incdirs);

    extraIncDirs = new DirectoryListComposite(container, SWT.NONE);
    extraIncDirs.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    Label lExtraFree = new Label(container, SWT.NONE);
    lExtraFree.setText(UITexts.properties_extra_free);

    extraFrees = new StringListComposite(container, SWT.NONE);
    extraFrees.setAddMessage(UITexts.properties_extra_free_message);
    extraFrees.setAddTitle(UITexts.properties_extra_free_title);
    extraFrees.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.GRAB_HORIZONTAL));
    List<String> extraLibs = new ArrayList<>();
    List<String> extraIncs = new ArrayList<>();
    List<String> extraFrees = new ArrayList<>();

    IProject project = (IProject) getElement();
    try {
        String currentProp = project.getPersistentProperty(BuildWrapperPlugin.EXTRAOPTS_PROPERTY);
        JSONArray arr = new JSONArray();
        if (currentProp != null && currentProp.length() > 0) {
            arr = new JSONArray(currentProp);
        }
        for (int a = 0; a < arr.length(); a++) {
            String s = arr.optString(a);
            if (s != null && s.length() > 0) {
                if (s.startsWith("--" + CabalSyntax.FIELD_EXTRA_LIB_DIRS.getCabalName())) {
                    int ix = s.indexOf('=', CabalSyntax.FIELD_EXTRA_LIB_DIRS.getCabalName().length() + 2);
                    if (ix > -1) {
                        String s1 = s.substring(ix + 1).trim();
                        extraLibs.add(s1);
                    }
                } else if (s.startsWith("--extra-include-dirs")) {
                    int ix = s.indexOf('=', "--extra-include-dirs".length());
                    if (ix > -1) {
                        String s1 = s.substring(ix + 1).trim();
                        extraIncs.add(s1);
                    }
                } else {
                    extraFrees.add(s);
                }
            }
        }

        this.extraLibDirs.setPaths(extraLibs);
        this.extraIncDirs.setPaths(extraIncs);
        this.extraFrees.setPaths(extraFrees);
    } catch (CoreException ce) {
        HaskellUIPlugin.log(ce);
        Label l = new Label(container, SWT.MULTI);
        l.setText(ce.getLocalizedMessage());
    } catch (JSONException ce) {
        HaskellUIPlugin.log(ce);
        Label l = new Label(container, SWT.MULTI);
        l.setText(ce.getLocalizedMessage());
    }
    Dialog.applyDialogFont(parent);
    return container;
}

From source file:net.sf.eclipsefp.haskell.ui.wizards.cabal.CabalHaddockOptionsPage.java

License:Open Source License

@Override
public void createControl(final Composite parent) {
    initializeDialogUnits(parent);/* w ww. j av a  2 s.  co m*/
    Composite composite = new Composite(parent, SWT.NONE);
    GridData gd = new GridData(GridData.FILL_BOTH | GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL);
    composite.setLayoutData(gd);

    GridLayout layout = new GridLayout(3, false);
    composite.setLayout(layout);

    dFolder = new DistFolder(projects, composite, UITexts.exportSource_options_folder,
            UITexts.exportSource_options_folder_choose, UITexts.exportSource_options_folder_choose);

    Composite optionsComposite = new Composite(composite, SWT.NONE);
    GridData gdOptions = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gdOptions.horizontalSpan = 3;
    optionsComposite.setLayoutData(gdOptions);
    optionsComposite.setLayout(new GridLayout(1, false));

    final Button bHoogle = new Button(optionsComposite, SWT.CHECK);
    bHoogle.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    bHoogle.setText(UITexts.exportDoc_options_hoogle);
    bHoogle.setSelection(doHoogle);
    bHoogle.addSelectionListener(new SelectionAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(final SelectionEvent e) {
            doHoogle = bHoogle.getSelection();
        }
    });

    final Button bExecutables = new Button(optionsComposite, SWT.CHECK);
    bExecutables.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    bExecutables.setText(UITexts.exportDoc_options_executables);
    bExecutables.setSelection(doExecutables);
    bExecutables.addSelectionListener(new SelectionAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(final SelectionEvent e) {
            doExecutables = bExecutables.getSelection();
        }
    });

    final Button bInternal = new Button(optionsComposite, SWT.CHECK);
    bInternal.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    bInternal.setText(UITexts.exportDoc_options_internal);
    bInternal.setSelection(doInternal);
    bInternal.addSelectionListener(new SelectionAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(final SelectionEvent e) {
            doInternal = bInternal.getSelection();
        }
    });

    final Button bHTML = new Button(optionsComposite, SWT.CHECK);
    bHTML.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    bHTML.setText(UITexts.exportDoc_options_html);
    bHTML.setSelection(doHtml);

    final Text tHTML = new Text(optionsComposite, SWT.BORDER);
    GridData gdHTML = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
    gdHTML.horizontalIndent = 20;
    tHTML.setLayoutData(gdHTML);
    tHTML.setText(html);
    tHTML.setEnabled(doHtml);

    bHTML.addSelectionListener(new SelectionAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(final SelectionEvent e) {
            doHtml = bHTML.getSelection();
            tHTML.setEnabled(doHtml);
        }
    });

    final Button bCSS = new Button(optionsComposite, SWT.CHECK);
    bCSS.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    bCSS.setText(UITexts.exportDoc_options_css);
    bCSS.setSelection(doCss);

    final Composite cCSS = new Composite(optionsComposite, SWT.NONE);
    GridData gdCSS = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    gdCSS.horizontalIndent = 20;
    cCSS.setLayoutData(gdCSS);
    cCSS.setLayout(new GridLayout(2, false));

    final Text tCSS = new Text(cCSS, SWT.BORDER);
    tCSS.setText(css);
    tCSS.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));
    tCSS.setEnabled(doCss);

    final Button bfCSS = new Button(cCSS, SWT.PUSH);
    bfCSS.setText("...");
    bfCSS.setEnabled(doCss);

    bCSS.addSelectionListener(new SelectionAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(final SelectionEvent e) {
            doCss = bCSS.getSelection();
            tCSS.setEnabled(doCss);
            bfCSS.setEnabled(doCss);
        }
    });
    bfCSS.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
            fd.setFilterExtensions(new String[] { "*.css", "*.*" });
            fd.setFilterNames(new String[] { UITexts.exportDoc_options_filter_css,
                    UITexts.exportDoc_options_filter_all });
            if (css.length() > 0) {
                fd.setFileName(css);
            }
            String f = fd.open();
            if (f != null) {
                css = f;
                tCSS.setText(css);
            }
        }
    });

    final Button bColour = new Button(optionsComposite, SWT.CHECK);
    bColour.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    bColour.setText(UITexts.exportDoc_options_hscolour);
    bColour.setSelection(doColourSrc);

    final Button bColourCSS = new Button(optionsComposite, SWT.CHECK);
    bColourCSS.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
    bColourCSS.setText(UITexts.exportDoc_options_hscolour_css);
    bColourCSS.setEnabled(doColourSrc);
    bColourCSS.setSelection(doColourSrcCss);

    final Composite cColourCSS = new Composite(optionsComposite, SWT.NONE);
    GridData gdColourCSS = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    gdColourCSS.horizontalIndent = 20;
    cColourCSS.setLayoutData(gdColourCSS);
    cColourCSS.setLayout(new GridLayout(2, false));

    final Text tColourCSS = new Text(cColourCSS, SWT.BORDER);
    tColourCSS.setText(colourSrcCss);
    tColourCSS.setEnabled(doColourSrc && doColourSrcCss);
    tColourCSS.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));

    final Button bfColourCSS = new Button(cColourCSS, SWT.PUSH);
    bfColourCSS.setText("...");
    bfColourCSS.setEnabled(doColourSrc && doColourSrcCss);

    bColourCSS.addSelectionListener(new SelectionAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(final SelectionEvent e) {
            doColourSrcCss = bColourCSS.getSelection();
            tColourCSS.setEnabled(doColourSrcCss);
            bfColourCSS.setEnabled(doColourSrcCss);
        }
    });
    bfColourCSS.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            FileDialog fd = new FileDialog(getShell(), SWT.OPEN);
            fd.setFilterExtensions(new String[] { "*.css", "*.*" });
            fd.setFilterNames(new String[] { UITexts.exportDoc_options_filter_css,
                    UITexts.exportDoc_options_filter_all });

            if (colourSrcCss.length() > 0) {
                fd.setFileName(colourSrcCss);
            }
            String f = fd.open();
            if (f != null) {
                colourSrcCss = f;
                tColourCSS.setText(colourSrcCss);
            }
        }
    });

    bColour.addSelectionListener(new SelectionAdapter() {
        /* (non-Javadoc)
         * @see org.eclipse.swt.events.SelectionAdapter#widgetSelected(org.eclipse.swt.events.SelectionEvent)
         */
        @Override
        public void widgetSelected(final SelectionEvent e) {
            doColourSrc = bColour.getSelection();
            if (!doColourSrc) {
                bColourCSS.setSelection(false);
            }
            bColourCSS.setEnabled(doColourSrc);
            tColourCSS.setEnabled(doColourSrc && doColourSrcCss);
            bfColourCSS.setEnabled(doColourSrc && doColourSrcCss);
        }
    });

    setControl(composite);
    Dialog.applyDialogFont(composite);
}

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite parent2 = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    layout.marginWidth = 0;//from   w  w  w  .jav a  2  s  .  c o m
    layout.marginHeight = 0;
    parent2.setLayout(layout);

    Link link = new Link(parent2, SWT.NONE);
    link.setText(EclipseNSISPlugin.getResourceString("editor.preferences.note")); //$NON-NLS-1$
    link.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            PreferencesUtil.createPreferenceDialogOn(getShell(),
                    "org.eclipse.ui.preferencePages.GeneralTextEditor", null, null); //$NON-NLS-1$
        }
    });

    Group group = new Group(parent2, SWT.SHADOW_ETCHED_IN);
    group.setText(EclipseNSISPlugin.getResourceString("appearances.group.label")); //$NON-NLS-1$
    layout = new GridLayout(1, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    group.setLayout(layout);
    group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    Composite c = createAppearanceGroup(group);
    c.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    group = new Group(parent2, SWT.SHADOW_ETCHED_IN);
    group.setText(EclipseNSISPlugin.getResourceString("syntax.group.label")); //$NON-NLS-1$
    layout = new GridLayout(1, false);
    layout.marginWidth = 0;
    layout.marginHeight = 0;
    group.setLayout(layout);
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    c = createSyntaxGroup(group);
    c.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    group = new Group(parent2, SWT.SHADOW_ETCHED_IN);
    group.setText(EclipseNSISPlugin.getResourceString("other.group.label")); //$NON-NLS-1$
    group.setLayout(new GridLayout(1, false));
    group.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    c = createOtherGroup(group);
    c.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    initialize();
    Dialog.applyDialogFont(parent2);
    return parent2;
}

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

License:Open Source License

@Override
protected Control createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;/*from   w  ww  .  j  av  a 2s. c o m*/
    layout.marginWidth = 0;
    composite.setLayout(layout);

    mNameText = createText(composite, EclipseNSISPlugin.getResourceString("symbols.name.text"), //$NON-NLS-1$
            EclipseNSISPlugin.getResourceString("symbols.name.tooltip"), mName); //$NON-NLS-1$

    mNameText.addVerifyListener(new VerifyListener() {
        public void verifyText(VerifyEvent e) {
            char[] chars = e.text.toCharArray();
            for (int i = 0; i < chars.length; i++) {
                if (Character.isWhitespace(chars[i]) || chars[i] == '=') {
                    e.display.beep();
                    e.doit = false;
                    return;
                }
            }
            e.text = e.text.toUpperCase();
        }
    });

    mNameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validate();
        }
    });
    mNameText.setTextLimit(INSISConstants.DIALOG_TEXT_LIMIT);

    mValueText = createText(composite, EclipseNSISPlugin.getResourceString("symbols.value.text"), //$NON-NLS-1$
            EclipseNSISPlugin.getResourceString("symbols.value.tooltip"), mValue); //$NON-NLS-1$
    int textLimit;
    try {
        textLimit = Integer.parseInt(
                NSISPreferences.getInstance().getNSISHome().getNSISExe().getDefinedSymbol("NSIS_MAX_STRLEN")); //$NON-NLS-1$
    } catch (Exception ex) {
        textLimit = INSISConstants.DEFAULT_NSIS_TEXT_LIMIT;
    }
    mValueText.setTextLimit(textLimit);
    Dialog.applyDialogFont(composite);
    return composite;
}

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

License:Open Source License

@Override
protected Control createControl(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    GridLayout gridLayout = new GridLayout(2, false);
    gridLayout.marginHeight = 0;/*from   ww  w  . j  a v  a  2s .c  o  m*/
    gridLayout.marginWidth = 0;
    composite.setLayout(gridLayout);

    Label label = new Label(composite, SWT.LEFT);
    label.setText(EclipseNSISPlugin.getResourceString("task.tag.label")); //$NON-NLS-1$
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    final Text text = new Text(composite, SWT.SINGLE | SWT.BORDER);
    GridData data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.widthHint = convertWidthInCharsToPixels(50);
    text.setLayoutData(data);
    text.setText(mTaskTag.getTag());

    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            mTaskTag.setTag(text.getText());
            validate();
        }
    });

    label = new Label(composite, SWT.LEFT);
    label.setText(EclipseNSISPlugin.getResourceString("task.tag.priority.label")); //$NON-NLS-1$
    label.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    final Combo combo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    if (!Common.isEmptyArray(NSISTaskTag.PRIORITY_LABELS)) {
        combo.setItems(NSISTaskTag.PRIORITY_LABELS);
    }
    int priority = mTaskTag.getPriority();
    if (priority >= 0 && combo.getItemCount() > priority) {
        combo.select(priority);
    }
    combo.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent e) {
            mTaskTag.setPriority(combo.getSelectionIndex());
        }
    });

    Dialog.applyDialogFont(composite);
    return composite;
}

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

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    GridLayout layout = new GridLayout(2, false);
    layout.marginHeight = 0;//from   w  w w  . j  a  va  2 s . c o  m
    layout.marginWidth = 0;
    composite.setLayout(layout);
    Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.MULTI | SWT.FULL_SELECTION | SWT.V_SCROLL);
    GridData data = new GridData(SWT.FILL, SWT.FILL, true, true);
    data.widthHint = convertWidthInCharsToPixels(65);
    data.heightHint = convertHeightInCharsToPixels(10);
    table.setLayoutData(data);

    table.setHeaderVisible(true);
    table.setLinesVisible(true);

    TableColumn[] columns = new TableColumn[2];
    columns[0] = new TableColumn(table, SWT.NONE);
    columns[0].setText(EclipseNSISPlugin.getResourceString("task.tag.label")); //$NON-NLS-1$

    columns[1] = new TableColumn(table, SWT.NONE);
    columns[1].setText(EclipseNSISPlugin.getResourceString("task.tag.priority.label")); //$NON-NLS-1$
    mTableViewer = new CheckboxTableViewer(table);
    mTableViewer.setLabelProvider(new TaskTagLabelProvider());
    mTableViewer.setContentProvider(new CollectionContentProvider());

    Collator collator = Collator.getInstance();
    collator.setStrength(Collator.PRIMARY);
    mTableViewer.setSorter(new ViewerSorter(collator));

    mTableViewer.addDoubleClickListener(new IDoubleClickListener() {
        public void doubleClick(DoubleClickEvent e) {
            edit();
        }
    });

    mTableViewer.addCheckStateListener(new ICheckStateListener() {
        @SuppressWarnings("unchecked")
        public void checkStateChanged(CheckStateChangedEvent event) {
            NSISTaskTag taskTag = (NSISTaskTag) event.getElement();
            boolean checked = event.getChecked();
            if (checked) {
                Collection<NSISTaskTag> taskTags = (Collection<NSISTaskTag>) mTableViewer.getInput();
                for (Iterator<NSISTaskTag> iter = taskTags.iterator(); iter.hasNext();) {
                    NSISTaskTag t = iter.next();
                    if (!t.equals(taskTag) && t.isDefault()) {
                        t.setDefault(false);
                        mTableViewer.setChecked(t, false);
                        mTableViewer.refresh(t, true);
                        break;
                    }
                }
            }
            taskTag.setDefault(checked);
            mTableViewer.setChecked(taskTag, checked);
            mTableViewer.refresh(taskTag, true);
            updateButtons();
        }
    });

    mTableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
        public void selectionChanged(SelectionChangedEvent e) {
            updateButtons();
        }
    });

    Composite buttons = new Composite(composite, SWT.NONE);
    buttons.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, false, false));
    layout = new GridLayout();
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    buttons.setLayout(layout);

    Button addButton = new Button(buttons, SWT.PUSH);
    addButton.setImage(CommonImages.ADD_ICON);
    addButton.setToolTipText(EclipseNSISPlugin.getResourceString("new.tooltip")); //$NON-NLS-1$
    addButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    addButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event e) {
            add();
        }
    });

    mEditButton = new Button(buttons, SWT.PUSH);
    mEditButton.setImage(CommonImages.EDIT_ICON);
    mEditButton.setToolTipText(EclipseNSISPlugin.getResourceString("edit.tooltip")); //$NON-NLS-1$
    mEditButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    mEditButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event e) {
            edit();
        }
    });

    mRemoveButton = new Button(buttons, SWT.PUSH);
    mRemoveButton.setImage(CommonImages.DELETE_ICON);
    mRemoveButton.setToolTipText(EclipseNSISPlugin.getResourceString("remove.tooltip")); //$NON-NLS-1$
    mRemoveButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    mRemoveButton.addListener(SWT.Selection, new Listener() {
        public void handleEvent(Event e) {
            remove();
        }
    });

    mCaseSensitiveButton = new Button(composite, SWT.CHECK);
    mCaseSensitiveButton.setText(EclipseNSISPlugin.getResourceString("task.tags.case.sensitive.label")); //$NON-NLS-1$
    mCaseSensitiveButton.setSelection(NSISPreferences.getInstance().isCaseSensitiveTaskTags());
    data = new GridData(SWT.FILL, SWT.CENTER, true, false);
    data.horizontalSpan = 2;

    Dialog.applyDialogFont(composite);
    FontData[] fd = table.getFont().getFontData();
    for (int i = 0; i < fd.length; i++) {
        fd[i].setStyle(fd[i].getStyle() | SWT.BOLD);
    }
    mBoldFont = new Font(getShell().getDisplay(), fd);

    mOriginalTags = NSISPreferences.getInstance().getTaskTags();
    Collection<NSISTaskTag> taskTags = NSISPreferences.getInstance().getTaskTags();
    mTableViewer.setInput(NSISPreferences.getInstance().getTaskTags());
    mTableViewer.setAllChecked(false);
    for (Iterator<NSISTaskTag> iter = taskTags.iterator(); iter.hasNext();) {
        NSISTaskTag t = iter.next();
        if (t.isDefault()) {
            mTableViewer.setChecked(t, true);
            break;
        }
    }

    updateButtons();
    table.addControlListener(new TableResizer());

    return composite;
}

From source file:net.sf.eclipsensis.installoptions.dialogs.InstallOptionsPreferencePage.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    loadPreferences();/*  w w  w .j ava2s  .c o  m*/
    loadDialogSizes();
    Composite parent2 = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout(1, false);
    layout.marginHeight = 0;
    layout.marginWidth = 0;
    parent2.setLayout(layout);

    mFolder = new TabFolder(parent2, SWT.NONE);
    mFolder.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    Dialog.applyDialogFont(mFolder);
    TabItem item = new TabItem(mFolder, SWT.NONE);
    item.setText(InstallOptionsPlugin.getResourceString("design.editor.tab.name")); //$NON-NLS-1$
    item.setControl(createDesignEditorTab(mFolder));
    item.setData(InstallOptionsDesignEditor.class);
    item = new TabItem(mFolder, SWT.NONE);
    item.setText(InstallOptionsPlugin.getResourceString("source.editor.tab.name")); //$NON-NLS-1$
    item.setControl(createSourceEditorTab(mFolder));
    item.setData(InstallOptionsSourceEditor.class);
    activateTab();

    mFileAssociation = new Button(parent2, SWT.CHECK);
    mFileAssociation.setText(InstallOptionsPlugin.getResourceString("check.default.editor.label")); //$NON-NLS-1$
    mFileAssociation.setSelection(FileAssociationChecker.getFileAssociationChecking(FILE_ASSOCIATION_ID));
    mFileAssociation.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    mAutosaveBeforePreview = new Button(parent2, SWT.CHECK);
    mAutosaveBeforePreview.setText(InstallOptionsPlugin.getResourceString("autosave.before.preview.label")); //$NON-NLS-1$
    mAutosaveBeforePreview.setSelection(getPreferenceStore().getBoolean(PREFERENCE_AUTOSAVE_BEFORE_PREVIEW));
    mAutosaveBeforePreview.setLayoutData(new GridData(SWT.BEGINNING, SWT.CENTER, false, false));

    return parent2;
}

From source file:net.sf.eclipsensis.installoptions.wizard.InstallOptionsWizardPage.java

License:Open Source License

/** (non-Javadoc)
 * Method declared on IDialogPage./*  w ww  .j  a  va2s . com*/
 */
public void createControl(Composite parent) {
    final Composite composite = new Composite(parent, SWT.NONE);
    setControl(composite);
    PlatformUI.getWorkbench().getHelpSystem().setHelp(getControl(),
            IInstallOptionsConstants.PLUGIN_CONTEXT_PREFIX + "installoptions_wizard_context"); //$NON-NLS-1$

    final GridLayout layout = new GridLayout(1, false);
    composite.setLayout(layout);
    final Label l = NSISWizardDialogUtil.createLabel(composite,
            InstallOptionsPlugin.getResourceString("wizard.page.header"), true, null, false); //$NON-NLS-1$
    l.setFont(JFaceResources.getBannerFont());
    l.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

    final Label l2 = NSISWizardDialogUtil.createLabel(composite,
            InstallOptionsPlugin.getResourceString("wizard.page.text"), true, null, false); //$NON-NLS-1$
    final GridData gridData = (GridData) l2.getLayoutData();
    Dialog.applyDialogFont(l2);
    gridData.widthHint = Common.calculateControlSize(l2, 80, 0).x;

    createTemplatesGroup(composite);

    createScriptSaveSettingsGroup(composite);

    composite.addListener(SWT.Resize, new Listener() {
        boolean init = false;

        public void handleEvent(Event e) {
            if (init) {
                Point size = composite.getSize();
                gridData.widthHint = size.x - 2 * layout.marginWidth;
                composite.layout();
            } else {
                init = true;
            }
        }
    });

    NSISWizardDialogUtil.createRequiredFieldsLabel(composite);
    setPageComplete(validatePage());
}