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:org.eclipse.dltk.ui.preferences.NewScriptProjectPreferencePage.java

License:Open Source License

protected Control createContents(Composite parent) {
    initializeDialogUnits(parent);/*  w ww.  j ava2  s.co m*/

    Composite result = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = 0;
    layout.verticalSpacing = convertVerticalDLUsToPixels(10);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.numColumns = 2;
    result.setLayout(layout);

    GridData gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = 2;

    Group sourceFolderGroup = new Group(result, SWT.NONE);
    layout = new GridLayout();
    layout.numColumns = 2;
    sourceFolderGroup.setLayout(layout);
    sourceFolderGroup.setLayoutData(gd);
    sourceFolderGroup.setText(PreferencesMessages.NewScriptProjectPreferencePage_sourcefolder_label);

    int indent = 0;

    fProjectAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewScriptProjectPreferencePage_sourcefolder_project, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.FALSE, indent);
    fProjectAsSourceFolder.addSelectionListener(fSelectionListener);

    fFoldersAsSourceFolder = addRadioButton(sourceFolderGroup,
            PreferencesMessages.NewScriptProjectPreferencePage_sourcefolder_folder, SRCBIN_FOLDERS_IN_NEWPROJ,
            IPreferenceStore.TRUE, indent);
    fFoldersAsSourceFolder.addSelectionListener(fSelectionListener);

    indent = convertWidthInCharsToPixels(4);

    fSrcFolderNameLabel = new Label(sourceFolderGroup, SWT.NONE);
    fSrcFolderNameLabel.setText(PreferencesMessages.NewScriptProjectPreferencePage_folders_src);
    fSrcFolderNameText = addTextControl(sourceFolderGroup, fSrcFolderNameLabel, SRC_SRCNAME, indent);
    fSrcFolderNameText.addModifyListener(fModifyListener);

    // String[] InterpreterEnvironmentNames=
    // getInterpreterEnvironmentNames();
    // if (InterpreterEnvironmentNames.length > 0) {
    // Label InterpreterEnvironmentSelectionLabel= new Label(result,
    // SWT.NONE);
    // InterpreterEnvironmentSelectionLabel.setText(PreferencesMessages.NewScriptProjectPreferencePage_InterpreterEnvironmentlibrary_label);
    // InterpreterEnvironmentSelectionLabel.setLayoutData(new GridData());
    //      
    // int index=
    // getPreferenceStore().getInt(CLASSPATH_InterpreterEnvironmentLIBRARY_INDEX);
    // fInterpreterEnvironmentCombo= new Combo(result, SWT.READ_ONLY);
    // fInterpreterEnvironmentCombo.setItems(InterpreterEnvironmentNames);
    // fInterpreterEnvironmentCombo.select(index);
    // fInterpreterEnvironmentCombo.setLayoutData(new
    // GridData(GridData.HORIZONTAL_ALIGN_FILL));
    // }

    validateFolders();

    Dialog.applyDialogFont(result);
    return result;
}

From source file:org.eclipse.dltk.ui.text.completion.ContentAssistProcessor.java

License:Open Source License

/**
 * Informs the user about the fact that there are no enabled categories in
 * the default content assist set and shows a link to the preferences.
 *//*from w ww. j  a  v  a 2s. c  o  m*/
private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = DLTKUIPlugin.getActiveWorkbenchShell();
        String title = ScriptTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = ScriptTextMessages.ContentAssistProcessor_all_disabled_message;
        // see PreferencePage#createControl for the 'defaults' label
        final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$
        final String linkMessage = Messages.format(
                ScriptTextMessages.ContentAssistProcessor_all_disabled_preference_link,
                LegacyActionTools.removeMnemonics(restoreButtonLabel));
        final int restoreId = IDialogConstants.CLIENT_ID + 10;
        final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY,
                shell, title, null /* default image */, message, MessageDialog.WARNING,
                new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) {
            /*
             * @see
             * org.eclipse.dltk.internal.ui.dialogs.OptionalMessageDialog
             * #createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            protected Control createCustomArea(Composite composite) {
                // wrap link and checkbox in one composite without space
                Composite parent = new Composite(composite, SWT.NONE);
                GridLayout layout = new GridLayout();
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                layout.verticalSpacing = 0;
                parent.setLayout(layout);

                Composite linkComposite = new Composite(parent, SWT.NONE);
                layout = new GridLayout();
                layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
                layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
                layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
                linkComposite.setLayout(layout);

                Link link = new Link(linkComposite, SWT.NONE);
                link.setText(linkMessage);
                link.addSelectionListener(new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent e) {
                        close();
                        PreferencesUtil.createPreferenceDialogOn(shell,
                                "org.eclipse.dltk.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                                .open();
                    }
                });
                GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
                gridData.widthHint = this.getMinimumMessageWidth();
                link.setLayoutData(gridData);

                // create checkbox and "don't show this message" prompt
                super.createCustomArea(parent);

                return parent;
            }

            protected void createButtonsForButtonBar(Composite parent) {
                Button[] buttons = new Button[2];
                buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false);
                buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
                        true);
                setButtons(buttons);
            }
        };
        if (restoreId == dialog.open()) {
            /*
             * FIXME Restore default settings in DLTKUIPlugin preferences,
             * since at the moment this is the only IPreferenceStore these
             * preferences are read from.
             */
            IPreferenceStore store = DLTKUIPlugin.getDefault().getPreferenceStore();
            store.setToDefault(PreferenceConstants.CODEASSIST_CATEGORY_ORDER);
            store.setToDefault(PreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            CompletionProposalComputerRegistry registry = CompletionProposalComputerRegistry.getDefault();
            registry.reload();
            return true;
        }
    }
    return false;
}

From source file:org.eclipse.eatop.workspace.ui.wizards.pages.EastADLProjectWizardFirstPage.java

License:Open Source License

private Layout initGridLayout(GridLayout gridLayout, boolean margins) {

    gridLayout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    gridLayout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    if (margins) {
        gridLayout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        gridLayout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    } else {/*from w  w  w  .  j  a  va 2s.  c  o  m*/
        gridLayout.marginWidth = 0;
        gridLayout.marginHeight = 0;
    }
    return gridLayout;
}

From source file:org.eclipse.edt.ide.ui.internal.contentassist.EGLContentAssistProcessor.java

License:Open Source License

private boolean informUserAboutEmptyDefaultCategory() {
    if (OptionalMessageDialog.isDialogEnabled(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY)) {
        final Shell shell = EDTUIPlugin.getActiveWorkbenchShell();
        String title = EGLTextMessages.ContentAssistProcessor_all_disabled_title;
        String message = EGLTextMessages.ContentAssistProcessor_all_disabled_message;
        // see PreferencePage#createControl for the 'defaults' label
        final String restoreButtonLabel = JFaceResources.getString("defaults"); //$NON-NLS-1$
        final String linkMessage = Messages.format(
                EGLTextMessages.ContentAssistProcessor_all_disabled_preference_link,
                LegacyActionTools.removeMnemonics(restoreButtonLabel));
        final int restoreId = IDialogConstants.CLIENT_ID + 10;
        final int settingsId = IDialogConstants.CLIENT_ID + 11;
        final OptionalMessageDialog dialog = new OptionalMessageDialog(PREF_WARN_ABOUT_EMPTY_ASSIST_CATEGORY,
                shell, title, null /* default image */, message, MessageDialog.WARNING,
                new String[] { restoreButtonLabel, IDialogConstants.CLOSE_LABEL }, 1) {
            /*/*from  ww w .  j  a  v a2 s. c om*/
             * @see org.eclipse.jdt.internal.ui.dialogs.OptionalMessageDialog#createCustomArea(org.eclipse.swt.widgets.Composite)
             */
            protected Control createCustomArea(Composite composite) {
                // wrap link and checkbox in one composite without space
                Composite parent = new Composite(composite, SWT.NONE);
                GridLayout layout = new GridLayout();
                layout.marginHeight = 0;
                layout.marginWidth = 0;
                layout.verticalSpacing = 0;
                parent.setLayout(layout);

                Composite linkComposite = new Composite(parent, SWT.NONE);
                layout = new GridLayout();
                layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
                layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
                layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
                linkComposite.setLayout(layout);

                Link link = new Link(linkComposite, SWT.NONE);
                link.setText(linkMessage);
                link.addSelectionListener(new SelectionAdapter() {
                    public void widgetSelected(SelectionEvent e) {
                        setReturnCode(settingsId);
                        close();
                    }
                });
                GridData gridData = new GridData(SWT.FILL, SWT.BEGINNING, true, false);
                gridData.widthHint = this.getMinimumMessageWidth();
                link.setLayoutData(gridData);

                super.createCustomArea(parent);

                return parent;
            }

            protected void createButtonsForButtonBar(Composite parent) {
                Button[] buttons = new Button[2];
                buttons[0] = createButton(parent, restoreId, restoreButtonLabel, false);
                buttons[1] = createButton(parent, IDialogConstants.CLOSE_ID, IDialogConstants.CLOSE_LABEL,
                        true);
                setButtons(buttons);
            }
        };
        int returnValue = dialog.open();
        if (restoreId == returnValue || settingsId == returnValue) {
            if (restoreId == returnValue) {
                IPreferenceStore store = EDTUIPlugin.getDefault().getPreferenceStore();
                store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_CATEGORY_ORDER);
                store.setToDefault(EDTUIPreferenceConstants.CODEASSIST_EXCLUDED_CATEGORIES);
            }
            if (settingsId == returnValue)
                PreferencesUtil
                        .createPreferenceDialogOn(shell,
                                "org.eclipse.edt.ide.ui.preferences.CodeAssistPreferenceAdvanced", null, null) //$NON-NLS-1$
                        .open();
            fComputerRegistry.reload();
            return true;
        }
    }
    return false;
}

From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.CreateProfileDialog.java

License:Open Source License

public Control createDialogArea(Composite parent) {

    final int numColumns = 2;

    GridData gd;//from  w  w w  . j a  va2  s.  c o  m

    final GridLayout layout = new GridLayout(numColumns, 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);

    final Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(layout);

    // Create "Profile name:" label
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    gd.widthHint = convertWidthInCharsToPixels(60);
    final Label nameLabel = new Label(composite, SWT.WRAP);
    nameLabel.setText(NewWizardMessages.ProfileName);
    nameLabel.setLayoutData(gd);

    // Create text field to enter name
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    fNameText.setLayoutData(gd);
    fNameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doValidation();
        }
    });

    // Create "Initialize settings ..." label
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    Label profileLabel = new Label(composite, SWT.WRAP);
    profileLabel.setText(NewWizardMessages.InitProfileSetting);
    profileLabel.setLayoutData(gd);

    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fProfileCombo = new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
    fProfileCombo.setLayoutData(gd);

    // "Open the edit dialog now" checkbox
    gd = new GridData();
    gd.horizontalSpan = numColumns;
    fEditCheckbox = new Button(composite, SWT.CHECK);
    fEditCheckbox.setText(NewWizardMessages.OpenEditDlg);
    fEditCheckbox.addSelectionListener(new SelectionListener() {
        public void widgetSelected(SelectionEvent e) {
            fOpenEditDialog = ((Button) e.widget).getSelection();
        }

        public void widgetDefaultSelected(SelectionEvent e) {
        }
    });

    final IDialogSettings dialogSettings = EDTUIPlugin.getDefault().getDialogSettings();//.get(PREF_OPEN_EDIT_DIALOG);
    if (dialogSettings.get(PREF_OPEN_EDIT_DIALOG) != null) {
        fOpenEditDialog = dialogSettings.getBoolean(PREF_OPEN_EDIT_DIALOG);
    } else {
        fOpenEditDialog = true;
    }
    fEditCheckbox.setSelection(fOpenEditDialog);

    fProfileCombo.setItems(fSortedNames);
    fProfileCombo.setText(fSortedNames[0]);
    updateStatus(fEmpty);

    applyDialogFont(composite);

    fNameText.setFocus();

    return composite;
}

From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.ModifyDialogTabPage.java

License:Open Source License

/**
 * Create the contents of this tab page. Subclasses cannot override this, 
 * instead they must implement <code>doCreatePreferences</code>. <code>doCreatePreview</code> may also
 * be overridden as necessary./* ww  w. ja v  a2s  .c  om*/
 * @param parent The parent composite
 * @return Created content control
 */
public final Composite createContents(Composite parent) {
    final int numColumns = 4;

    if (fPixelConverter == null) {
        fPixelConverter = new PixelConverter(parent);
    }

    final SashForm fSashForm = new SashForm(parent, SWT.HORIZONTAL);
    fSashForm.setFont(parent.getFont());

    final Composite settingsPane = new Composite(fSashForm, SWT.NONE);
    settingsPane.setFont(fSashForm.getFont());

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = (int) (1.5
            * fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING));
    layout.horizontalSpacing = fPixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
    layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    settingsPane.setLayout(layout);
    doCreatePreferences(settingsPane, numColumns);

    final Composite previewPane = new Composite(fSashForm, SWT.NONE);
    previewPane.setLayout(createGridLayout(numColumns, true));
    previewPane.setFont(fSashForm.getFont());
    doCreatePreviewPane(previewPane, numColumns);

    initializePage();

    fSashForm.setWeights(new int[] { 3, 3 });
    return fSashForm;
}

From source file:org.eclipse.edt.ide.ui.internal.formatting.ui.RenameProfileDialog.java

License:Open Source License

public Control createDialogArea(Composite parent) {

    final int numColumns = 2;

    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 = numColumns;//from   w  w  w.  j  av a  2s.  c  o m

    final Composite composite = new Composite(parent, SWT.NULL);
    composite.setLayout(layout);

    // Create "Please enter a new name:" label
    GridData gd = new GridData();
    gd.horizontalSpan = numColumns;
    gd.widthHint = convertWidthInCharsToPixels(60);
    fNameLabel = new Label(composite, SWT.NONE);
    fNameLabel.setText(NewWizardMessages.EnterNewName);
    fNameLabel.setLayoutData(gd);

    // Create text field to enter name
    gd = new GridData(GridData.FILL_HORIZONTAL);
    gd.horizontalSpan = numColumns;
    fNameText = new Text(composite, SWT.SINGLE | SWT.BORDER);
    String profileDisplayName = fProfileManager.getProfileDisplayName(fProfileOrDefaultProfile);
    fNameText.setText(profileDisplayName);
    fNameText.setSelection(0, profileDisplayName.length());
    fNameText.setLayoutData(gd);
    fNameText.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            doValidation();
        }
    });
    fNameText.setText(profileDisplayName);
    fNameText.selectAll();

    applyDialogFont(composite);

    return composite;
}

From source file:org.eclipse.edt.ide.ui.preferences.CompilerAndGeneratorControls.java

License:Open Source License

protected GridLayout createGridLayout(int numColumns, boolean margins) {
    GridLayout layout = new GridLayout(numColumns, false);
    layout.verticalSpacing = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = fPixelConverter
            .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    if (margins) {
        layout.marginHeight = fPixelConverter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
        layout.marginWidth = fPixelConverter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
    } else {//  www  . j  ava  2  s .  co  m
        layout.marginHeight = 0;
        layout.marginWidth = 0;
    }
    return layout;
}

From source file:org.eclipse.egit.ui.internal.SWTUtils.java

License:Open Source License

/**
 * Creates a grid layout with the specified number of columns and the
 * standard spacings./*from  w  w  w. ja  v  a 2 s  .  c  o  m*/
 *
 * @param numColumns
 *            the number of columns
 * @param converter
 *            the pixel converter
 * @param margins
 *            one of <code>MARGINS_DEFAULT</code>, <code>MARGINS_NONE</code>
 *            or <code>MARGINS_DIALOG</code>.
 *
 * @return the created grid layout
 */
public static GridLayout createGridLayout(int numColumns, PixelConverter converter, int margins) {
    Assert.isTrue(margins == MARGINS_DEFAULT || margins == MARGINS_NONE || margins == MARGINS_DIALOG);

    final GridLayout layout = new GridLayout(numColumns, false);
    layout.horizontalSpacing = converter.convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    layout.verticalSpacing = converter.convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);

    switch (margins) {
    case MARGINS_NONE:
        layout.marginLeft = layout.marginRight = 0;
        layout.marginTop = layout.marginBottom = 0;
        break;
    case MARGINS_DIALOG:
        layout.marginLeft = layout.marginRight = converter
                .convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
        layout.marginTop = layout.marginBottom = converter
                .convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
        break;
    case MARGINS_DEFAULT:
        layout.marginLeft = layout.marginRight = layout.marginWidth;
        layout.marginTop = layout.marginBottom = layout.marginHeight;
    }
    layout.marginWidth = layout.marginHeight = 0;
    return layout;
}

From source file:org.eclipse.emf.eef.runtime.ui.widgets.ElementSelectionDialog.java

License:Open Source License

/**
 * Used to display a page/* w w  w . j ava  2 s  .  co  m*/
 * 
 * @param parent
 *            composite which contains the tree
 * @return the composite of this page
 */
public Control fillModelpage(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.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
    layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
    composite.setLayout(layout);

    // use pattern filter
    PatternFilter patternFilter = new TreeSelectionPatternFilter();
    patternFilter.setIncludeLeadingWildcard(true);

    FilteredTree filteredTree = new FilteredTree(composite, SWT.SINGLE | SWT.BORDER | SWT.V_SCROLL | SWT.RESIZE,
            patternFilter, true);
    // use of EMF facilities
    final TreeViewer treeViewer = filteredTree.getViewer();
    treeViewer.setFilters(new ViewerFilter[0]);
    treeViewer.setUseHashlookup(true);
    if (input instanceof EEFEditorSettings)
        treeViewer.setContentProvider(
                new HideResourcesContentProvider(new AdvancedEEFEditorContentProvider(adapterFactory)));
    else
        treeViewer.setContentProvider(
                new HideResourcesContentProvider(new AdapterFactoryContentProvider(adapterFactory)));

    ArrayList<ViewerFilter> filters = new ArrayList<ViewerFilter>();
    if (viewerFilters != null && !viewerFilters.isEmpty()) {
        for (ViewerFilter filter : viewerFilters) {
            filters.add(filter);
        }
    }
    // for now, add the businessRuleFilters to the 'normal' filters
    if (brFilters != null && !brFilters.isEmpty()) {
        for (ViewerFilter filter : brFilters) {
            filters.add(filter);
        }
    }
    filters.add(patternFilter);
    ViewerFilter[] v = filters.toArray(new ViewerFilter[filters.size()]);
    treeViewer.setFilters(v);
    treeViewer.setLabelProvider(new EEFLabelProvider() {

        @Override
        public Color getForeground(Object element) {
            if (input instanceof ReferencesTableSettings && element instanceof EObject
                    && ((ReferencesTableSettings) input).contains((EObject) element)) {
                return getShell().getDisplay().getSystemColor(SWT.COLOR_WIDGET_NORMAL_SHADOW);
            }

            return super.getForeground(element);
        }

    });

    filteredTree.setLayoutData(new GridData(550, 300));
    // handle selection change
    if (input instanceof EEFEditorSettings) {
        treeViewer.addSelectionChangedListener(new ISelectionChangedListener() {
            public void selectionChanged(SelectionChangedEvent event) {
                if (event.getSelection() instanceof IStructuredSelection) {
                    // Check selection
                    IStructuredSelection structuredSelection = (IStructuredSelection) event.getSelection();
                    if (structuredSelection != null && !structuredSelection.isEmpty()) {
                        Object o = structuredSelection.getFirstElement();
                        // Check type matching
                        Button okButton = getButton(IDialogConstants.OK_ID);
                        if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory))
                                .contains(o)) {
                            if (input instanceof ReferencesTableSettings) {
                                if (o instanceof EObject
                                        && !((ReferencesTableSettings) input).contains((EObject) o)) {
                                    selection = structuredSelection;
                                    if (okButton != null) {
                                        okButton.setEnabled(true);
                                    }
                                } else {
                                    // Reject selection
                                    if (okButton != null) {
                                        okButton.setEnabled(false);
                                    }
                                }
                            } else {
                                selection = structuredSelection;
                                if (okButton != null) {
                                    okButton.setEnabled(true);
                                }
                            }
                        } else {
                            // Reject selection
                            if (okButton != null) {
                                okButton.setEnabled(false);
                            }
                        }
                    }

                }
            }
        });

        // handle double click to validate
        treeViewer.addDoubleClickListener(new IDoubleClickListener() {
            public void doubleClick(DoubleClickEvent event) {
                if (selection != null && !selection.isEmpty()) {
                    Object o = selection.getFirstElement();
                    if (((List<?>) ((EEFEditorSettings) input).choiceOfValues(adapterFactory)).contains(o)
                            && input instanceof ReferencesTableSettings && o instanceof EObject
                            && !((ReferencesTableSettings) input).contains((EObject) o)) {
                        okPressed();
                    }
                }
            }
        });
    }
    treeViewer.setInput(input);

    // Init selected element
    if (selection != null) {
        treeViewer.setSelection(selection);
    }

    return composite;

}