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:org.bbaw.pdr.ae.view.control.dialogs.SelectObjectDialog.java

License:Open Source License

/**
 * meth creates the TabItem for selecting a person.
 * @param mainTabFolder main tabFolder//from w  w  w  .ja  v a  2  s. com
 */
private void createPersonTabItem(final TabFolder mainTabFolder) {
    _markupProvider = Platform.getPreferencesService().getString(CommonActivator.PLUGIN_ID,
            "PRIMARY_TAGGING_PROVIDER", AEConstants.CLASSIFICATION_AUTHORITY, null).toUpperCase(); //$NON-NLS-1$
    _relationProvider = Platform.getPreferencesService().getString(CommonActivator.PLUGIN_ID,
            "PRIMARY_RELATION_PROVIDER", AEConstants.RELATION_CLASSIFICATION_PROVIDER, null).toUpperCase();
    _personTabItem = new TabItem(mainTabFolder, SWT.NONE);
    _personTabItem.setText(NLMessages.getString("Dialog_persons")); //$NON-NLS-1$
    _personTabItem.setImage(_imageReg.get(IconsInternal.PERSONS));
    _personComposite = new Composite(mainTabFolder, SWT.NONE);
    _personComposite.setLayout(new GridLayout());
    _personComposite.setLayoutData(new GridData());
    ((GridData) _personComposite.getLayoutData()).verticalAlignment = SWT.FILL;

    _personTabItem.setControl(_personComposite);

    _personMainSForm = new SashForm(_personComposite, SWT.HORIZONTAL);
    _personMainSForm.setLayoutData(new GridData(GridData.FILL_BOTH));
    ((GridData) _personMainSForm.getLayoutData()).minimumHeight = 500;
    ((GridData) _personMainSForm.getLayoutData()).minimumWidth = 700;

    _personSearchSForm = new SashForm(_personMainSForm, SWT.VERTICAL);
    _personSearchSForm.setLayoutData(new GridData(GridData.FILL_BOTH));
    _personSearchGroup = new Group(_personSearchSForm, SWT.SHADOW_IN);
    _personSearchGroup.setText(NLMessages.getString("Dialog_personSearch")); //$NON-NLS-1$
    _personSearchGroup.setLayoutData(new GridData());
    ((GridData) _personSearchGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _personSearchGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _personSearchGroup.getLayoutData()).minimumHeight = 90;
    ((GridData) _personSearchGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    _personSearchGroup.setLayout(new GridLayout());
    ((GridLayout) _personSearchGroup.getLayout()).makeColumnsEqualWidth = false;
    ((GridLayout) _personSearchGroup.getLayout()).numColumns = 1;
    buildPersonSearch();
    _searchP = new Button(_personSearchGroup, SWT.PUSH);
    _searchP.setText(NLMessages.getString("Dialog_search")); //$NON-NLS-1$
    _searchP.setImage(_imageReg.get(IconsInternal.SEARCH));
    _searchP.setFont(JFaceResources.getDialogFont());
    _searchP.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            //               System.out.println("suchen"); //$NON-NLS-1$
            searchPersons();

        }

    });
    // personSearchGroup
    _personSearchGroup.pack();
    _personResultGroup = new Group(_personSearchSForm, SWT.SHADOW_IN);
    _personResultGroup.setText(NLMessages.getString("Dialog_result")); //$NON-NLS-1$
    _personResultGroup.setLayoutData(new GridData());
    ((GridData) _personResultGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _personResultGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _personResultGroup.getLayoutData()).minimumHeight = 90;
    ((GridData) _personResultGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) _personResultGroup.getLayoutData()).grabExcessVerticalSpace = true;
    _personResultGroup.setLayout(_gridLayout2);
    _personTableViewer = new TableViewer(_personResultGroup, SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);
    String[] titles = { NLMessages.getString("Dialog_displayName"), NLMessages.getString("Dialog_id") };
    int[] bounds = { 300, 180 };
    for (int i = 0; i < titles.length; i++) {
        TableViewerColumn column = new TableViewerColumn(_personTableViewer, SWT.NONE);
        column.getColumn().setText(titles[i]);
        column.getColumn().setWidth(bounds[i]);
        column.getColumn().setResizable(true);
        column.getColumn().setMoveable(true);
        column.getColumn().addSelectionListener(getSelectionAdapter(_personTableViewer, column.getColumn(), i));

    }
    _personTableViewer.setComparator(new PdrObjectViewComparator());
    Table table = _personTableViewer.getTable();
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    table.setLayoutData(new GridData());
    ((GridData) table.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) table.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) table.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) table.getLayoutData()).grabExcessVerticalSpace = true;
    _personTableViewer.addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(final DoubleClickEvent event) {
            ISelection selection = _personTableViewer.getSelection();
            Object obj = ((IStructuredSelection) selection).getFirstElement();
            _selectedP = (Person) obj;
            _selectedPersonText.setText(_selectedP.getDisplayName());
        }
    });
    Label selectLabel = new Label(_personResultGroup, SWT.None);
    selectLabel.setText(NLMessages.getString("Dialog_selection"));
    _selectedPersonText = new Text(_personResultGroup, SWT.SHADOW_IN | SWT.WRAP | SWT.READ_ONLY);
    _selectedPersonText.setLayoutData(new GridData());
    ((GridData) _selectedPersonText.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _selectedPersonText.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _selectedPersonText.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) _selectedPersonText.getLayoutData()).minimumHeight = 30;
    _selectedPersonText.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    // }// personResultGroup
    _personSearchSForm.setWeights(new int[] { 4, 2 });
    Group lastPersonsGroup = new Group(_personMainSForm, SWT.SHADOW_IN);
    lastPersonsGroup.setText(NLMessages.getString("Dialog_lastPersons")); //$NON-NLS-1$
    lastPersonsGroup.setLayoutData(new GridData());
    ((GridData) lastPersonsGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) lastPersonsGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) lastPersonsGroup.getLayoutData()).minimumHeight = 120;
    ((GridData) lastPersonsGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    lastPersonsGroup.setLayout(_gridLayout2);
    _lastPersonList = new List(lastPersonsGroup, SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    _lastPersonList.setLayoutData(new GridData());
    ((GridData) _lastPersonList.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _lastPersonList.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) _lastPersonList.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _lastPersonList.getLayoutData()).grabExcessVerticalSpace = true;
    _personListViewer = new ListViewer(_lastPersonList);
    _personListViewer.setContentProvider(new PersonVectorContentProvider());
    _personListViewer.setLabelProvider(new ListLabelProvider());
    try {
        if (_facade.getLastPersons() != null && !_facade.getLastPersons().isEmpty()
                && _facade.getLastPersons().size() > 2) {

            _personListViewer.setInput(_facade.getLastPersons());
            _personListViewer.addSelectionChangedListener(new ISelectionChangedListener() {

                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection selection = _personListViewer.getSelection();
                    Object obj = ((IStructuredSelection) selection).getFirstElement();
                    _selectedP = (Person) obj;
                    _selectedPersonText.setText(_selectedP.getDisplayNameWithID());
                    _lastAspectList.deselectAll();
                    _lastReferenceList.deselectAll();

                }
            });
        }

    } finally {
    }
    // _personListViewer.addSelectionListener(new
    // SelectionListener() {
    // public void widgetSelected(final SelectionEvent event) {
    // int si = lastPersons.size() -
    // lastPersonList.getSelectionIndex() - 1;
    //                   System.out.println("lastpersonlist selection " + lastPersonList.getSelectionIndex()); //$NON-NLS-1$
    // // Person p =
    // lastPersonList.getItem(lastPersonList.getSelectionIndex());
    //                    String selected = NLMessages.getString("Dialog_person"); //$NON-NLS-1$
    // Person p = lastPersons.get(si);
    // //
    // selected = p.getDisplayName();
    //                    selected = selected + "" //$NON-NLS-1$
    // + p.getPdrId().toString();
    //
    // setMessage(selected);
    // selectedP = lastPersons.get(si);
    // _selectedPersonText.setText(selectedP.getDisplayName());
    //
    // // deleted possible aspect selection
    //
    //
    //
    // }
    _personMainSForm.setWeights(new int[] { 3, 1 });
}

From source file:org.bbaw.pdr.ae.view.control.dialogs.SelectObjectDialog.java

License:Open Source License

/**
 * meth creates the TabItem for selecting a source.
 * @param mainTabFolder main tab folder.
 *///ww w. j  a  v a  2s.  co m
private void createSourceTabItem(final TabFolder mainTabFolder) {
    _sourceTabItem = new TabItem(mainTabFolder, SWT.NONE);
    _sourceTabItem.setText(NLMessages.getString("Dialog_Sources")); //$NON-NLS-1$
    _sourceTabItem.setImage(_imageReg.get(IconsInternal.REFERENCES));
    _sourceComposite = new Composite(mainTabFolder, SWT.NONE);
    _sourceComposite.setLayout(new GridLayout());
    _sourceComposite.setLayoutData(new GridData());
    ((GridData) _sourceComposite.getLayoutData()).verticalAlignment = SWT.FILL;

    _sourceTabItem.setControl(_sourceComposite);

    _sourceMainSForm = new SashForm(_sourceComposite, SWT.HORIZONTAL);
    _sourceMainSForm.setLayoutData(new GridData(GridData.FILL_BOTH));
    ((GridData) _sourceMainSForm.getLayoutData()).minimumHeight = 500;
    ((GridData) _sourceMainSForm.getLayoutData()).minimumWidth = 700;

    _sourceSearchSForm = new SashForm(_sourceMainSForm, SWT.VERTICAL);
    _sourceSearchSForm.setLayoutData(new GridData(GridData.FILL_BOTH));
    _refSearchGroup = new Group(_sourceSearchSForm, SWT.SHADOW_IN);
    _refSearchGroup.setText(NLMessages.getString("Dialog_sourceSearch")); //$NON-NLS-1$
    _refSearchGroup.setLayoutData(new GridData());
    ((GridData) _refSearchGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _refSearchGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _refSearchGroup.getLayoutData()).minimumHeight = 90;
    ((GridData) _refSearchGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    _refSearchGroup.setLayout(_gridLayout2);
    buildReferenceSearch();
    _searchR = new Button(_refSearchGroup, SWT.PUSH);
    _searchR.setText(NLMessages.getString("Dialog_search")); //$NON-NLS-1$
    _searchR.setImage(_imageReg.get(IconsInternal.SEARCH));
    _searchR.setFont(JFaceResources.getDialogFont());
    _searchR.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            searchReferences();
        }

    });
    // aspectSearchGroup
    _refSearchGroup.pack();
    Group sourceResultGroup = new Group(_sourceSearchSForm, SWT.SHADOW_IN);
    sourceResultGroup.setText(NLMessages.getString("Dialog_result")); //$NON-NLS-1$
    sourceResultGroup.setLayoutData(new GridData());
    ((GridData) sourceResultGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) sourceResultGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) sourceResultGroup.getLayoutData()).minimumHeight = 90;
    ((GridData) sourceResultGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    sourceResultGroup.setLayout(_gridLayout2);
    {
        _referenceTableViewer = new TableViewer(sourceResultGroup,
                SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION);

        String[] titles = { NLMessages.getString("Dialog_displayName"), NLMessages.getString("Dialog_title"),
                NLMessages.getString("Dialog_id") }; //$NON-NLS-1$ //$NON-NLS-2$
        int[] bounds = { 300, 180, 180 };

        for (int i = 0; i < titles.length; i++) {
            TableViewerColumn column = new TableViewerColumn(_referenceTableViewer, SWT.NONE);
            column.getColumn().setText(titles[i]);
            column.getColumn().setWidth(bounds[i]);
            column.getColumn().setResizable(true);
            column.getColumn().setMoveable(true);
            column.getColumn()
                    .addSelectionListener(getSelectionAdapter(_referenceTableViewer, column.getColumn(), i));
        }
        Table table = _referenceTableViewer.getTable();
        table.setHeaderVisible(true);
        table.setLinesVisible(true);
        table.setLayoutData(new GridData());
        ((GridData) table.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) table.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) table.getLayoutData()).verticalAlignment = SWT.FILL;
        ((GridData) table.getLayoutData()).grabExcessVerticalSpace = true;

        _referenceTableViewer.addDoubleClickListener(new IDoubleClickListener() {
            @Override
            public void doubleClick(final DoubleClickEvent event) {
                ISelection selection = _referenceTableViewer.getSelection();
                Object obj = ((IStructuredSelection) selection).getFirstElement();
                _selectedR = (ReferenceMods) obj;
                _selectedRefText.setText(_selectedR.getDisplayNameLong());
            }
        });

        // aspectResultGroup
        Label selectLabel = new Label(sourceResultGroup, SWT.None);
        selectLabel.setText(NLMessages.getString("Dialog_selection"));

        _selectedRefText = new Text(sourceResultGroup, SWT.SHADOW_IN | SWT.WRAP | SWT.READ_ONLY);
        _selectedRefText.setLayoutData(new GridData());
        ((GridData) _selectedRefText.getLayoutData()).horizontalAlignment = SWT.FILL;
        ((GridData) _selectedRefText.getLayoutData()).verticalAlignment = SWT.FILL;
        ((GridData) _selectedRefText.getLayoutData()).grabExcessHorizontalSpace = true;
        ((GridData) _selectedRefText.getLayoutData()).minimumHeight = 30;

        _selectedRefText.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));

    } // sourceResultGroup
    _sourceSearchSForm.setWeights(new int[] { 2, 2 });
    Group lastSourcesGroup = new Group(_sourceMainSForm, SWT.SHADOW_IN);
    lastSourcesGroup.setText(NLMessages.getString("Dialog_lastSources")); //$NON-NLS-1$
    lastSourcesGroup.setLayoutData(new GridData());
    ((GridData) lastSourcesGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) lastSourcesGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) lastSourcesGroup.getLayoutData()).minimumHeight = 120;
    ((GridData) lastSourcesGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    lastSourcesGroup.setLayout(_gridLayout2);
    _lastReferenceList = new List(lastSourcesGroup, SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
    _lastReferenceList.setLayoutData(new GridData());
    ((GridData) _lastReferenceList.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _lastReferenceList.getLayoutData()).grabExcessHorizontalSpace = true;
    ((GridData) _lastReferenceList.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _lastReferenceList.getLayoutData()).grabExcessVerticalSpace = true;
    final Vector<ReferenceMods> lastRefs = _facade.getLastReferences();
    if (_facade.getLastReferences() != null && !_facade.getLastReferences().isEmpty()) {
        for (int i = lastRefs.size() - 1; i > -1; i--) {
            _lastReferenceList.add(lastRefs.get(i).getDisplayNameWithID());
        }
    }
    _lastReferenceList.addSelectionListener(new SelectionListener() {
        @Override
        public void widgetDefaultSelected(final SelectionEvent e) {

        }

        @Override
        public void widgetSelected(final SelectionEvent event) {
            int si = lastRefs.size() - _lastReferenceList.getSelectionIndex() - 1;
            String selected = NLMessages.getString("Dialog_selectedRef");
            ReferenceMods r = lastRefs.get(si);
            //
            selected = r.getDisplayName();
            selected = selected + " ID: " //$NON-NLS-1$
                    + r.getPdrId().toString();

            setMessage(selected);
            _selectedR = lastRefs.get(si);
            _selectedRefText.setText(_selectedR.getDisplayNameLong());

            // deleted possible aspect selection
            _lastAspectList.deselectAll();
            _lastPersonList.deselectAll();

        }

    });
    _sourceMainSForm.setWeights(new int[] { 3, 1 });
}

From source file:org.bbaw.pdr.ae.view.editorlite.view.PersonAspectEditor.java

License:Open Source License

/**
 * creates OKButton.//from  w  w w .  j  a v  a2  s .  c  o m
 * @param parent parent composite
 * @param id id
 * @param label label of button
 * @param defaultButton is default
 * @return okButton
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    _saveButton = new Button(parent, SWT.PUSH);
    _saveButton.setText(label);
    _saveButton.setFont(JFaceResources.getDialogFont());
    _saveButton.setData(new Integer(id));
    _saveButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (isValidInput()) {
                okPressed();
                close();

            }
        }

    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(_saveButton);
        }
    }
    setButtonLayoutData(_saveButton);
    return _saveButton;
}

From source file:org.bbaw.pdr.ae.view.identifiers.dialogs.BrowserDialog.java

License:Open Source License

/**
 * creates OKButton./*w ww  .  j  a v a 2s  .  c  o  m*/
 * @param parent parent composite
 * @param id id
 * @param label label of button
 * @param defaultButton is default.
 * @return button.
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {

            if (isValidInput()) {
                okPressed();
            }
            close();
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

From source file:org.bbaw.pdr.ae.view.main.dialogs.AdvancedSearchDialog.java

License:Open Source License

/**
 * Builds the person search./*w ww.j a v  a 2 s.c  om*/
 * @param type the type
 * @param crit the crit
 */
private void buildPersonSearch(final int type, final Integer crit) {

    _markupProvider = Platform.getPreferencesService().getString(CommonActivator.PLUGIN_ID,
            "PRIMARY_TAGGING_PROVIDER", AEConstants.CLASSIFICATION_AUTHORITY, null).toUpperCase(); //$NON-NLS-1$
    _relationProvider = Platform.getPreferencesService().getString(CommonActivator.PLUGIN_ID,
            "PRIMARY_RELATION_PROVIDER", AEConstants.RELATION_CLASSIFICATION_PROVIDER, null).toUpperCase();
    DataType dtAll = new DataType();
    dtAll.setValue("ALL"); //$NON-NLS-1$
    dtAll.setLabel("ALL"); //$NON-NLS-1$

    boolean tag1 = true;
    boolean rel1 = true;
    boolean date1 = true;
    for (int i = 0; i < _personQuery.getCriterias().size(); i++) {
        //         System.out.println("for i = " + i); //$NON-NLS-1$
        final Criteria c = _personQuery.getCriterias().get(i);

        if (c.getType().equals("tagging")) //$NON-NLS-1$
        {
            if (tag1) {
                tag1 = false;
                _searchPTagComp = new Composite(_personSearchGroup, SWT.NONE);
                _searchPTagComp.setLayout(new GridLayout());
                ((GridLayout) _searchPTagComp.getLayout()).makeColumnsEqualWidth = true;
                ((GridLayout) _searchPTagComp.getLayout()).numColumns = 14;
                _searchPTagComp.setLayoutData(new GridData());
                ((GridData) _searchPTagComp.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) _searchPTagComp.getLayoutData()).grabExcessHorizontalSpace = true;
                // ((GridData) searchPTagComp.getLayoutData()).heightHint =
                // 200;
                ((GridData) _searchPTagComp.getLayoutData()).grabExcessVerticalSpace = false;
                ((GridData) _searchPTagComp.getLayoutData()).horizontalSpan = 1;

                Label op = new Label(_searchPTagComp, SWT.NONE);
                op.setText(NLMessages.getString("Dialog_operand")); //$NON-NLS-1$
                op.setLayoutData(new GridData());
                ((GridData) op.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) op.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) op.getLayoutData()).horizontalSpan = 1;

                Label sem = new Label(_searchPTagComp, SWT.NONE);
                sem.setText(NLMessages.getString("Dialog_semantic")); //$NON-NLS-1$
                sem.setLayoutData(new GridData());
                ((GridData) sem.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) sem.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) sem.getLayoutData()).horizontalSpan = 2;

                Label tagName = new Label(_searchPTagComp, SWT.NONE);
                tagName.setText(NLMessages.getString("Dialog_markup")); //$NON-NLS-1$
                tagName.setLayoutData(new GridData());
                ((GridData) tagName.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagName.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagName.getLayoutData()).horizontalSpan = 2;

                Label tagType = new Label(_searchPTagComp, SWT.NONE);
                tagType.setText(NLMessages.getString("Dialog_type")); //$NON-NLS-1$
                tagType.setLayoutData(new GridData());
                ((GridData) tagType.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagType.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagType.getLayoutData()).horizontalSpan = 2;

                Label tagSubtype = new Label(_searchPTagComp, SWT.NONE);
                tagSubtype.setText(NLMessages.getString("Dialog_subtype")); //$NON-NLS-1$
                tagSubtype.setLayoutData(new GridData());
                ((GridData) tagSubtype.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagSubtype.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagSubtype.getLayoutData()).horizontalSpan = 2;

                Label searchTextLabel = new Label(_searchPTagComp, SWT.NONE);
                searchTextLabel.setText(NLMessages.getString("Dialog_searchText")); //$NON-NLS-1$
                searchTextLabel.setLayoutData(new GridData());
                ((GridData) searchTextLabel.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) searchTextLabel.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) searchTextLabel.getLayoutData()).horizontalSpan = 3;

                Label fuzzy = new Label(_searchPTagComp, SWT.NONE);
                fuzzy.setText(NLMessages.getString("Dialog_fuzzy")); //$NON-NLS-1$
                fuzzy.setLayoutData(new GridData());
                ((GridData) fuzzy.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) fuzzy.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) fuzzy.getLayoutData()).horizontalSpan = 1;

                Label include = new Label(_searchPTagComp, SWT.NONE);
                include.setText(NLMessages.getString("Dialog_include")); //$NON-NLS-1$
                include.setToolTipText(NLMessages.getString("Dialog_includeConcurrences")); //$NON-NLS-1$
                include.setLayoutData(new GridData());
                ((GridData) include.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) include.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) include.getLayoutData()).horizontalSpan = 1;

            }

            if (i == 0) {
                Label l = new Label(_searchPTagComp, SWT.NONE);
                l.setText(NLMessages.getString("Dialog_markup")); //$NON-NLS-1$
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 1;
            } else {
                final Combo opCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
                opCombo.setLayoutData(new GridData());
                opCombo.add(Operator.AND.toString());
                opCombo.add(Operator.OR.toString());
                opCombo.add(Operator.NOT.toString());
                opCombo.setLayoutData(new GridData());
                ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) opCombo.getLayoutData()).horizontalSpan = 1;
                if (c.getOperator() != null) {
                    opCombo.select(opCombo.indexOf(c.getOperator()));
                } else {
                    opCombo.select(0);
                    c.setOperator(opCombo.getItem(0));

                }
                opCombo.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent se) {
                        c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                    }
                });
                opCombo.pack();
            }

            final Combo semCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            semCombo.setLayoutData(new GridData());
            ComboViewer comboSemanticViewer = new ComboViewer(semCombo);
            comboSemanticViewer.setContentProvider(new AEConfigPresentableContentProvider());
            comboSemanticViewer.setLabelProvider(new AEConfigPresentableLabelProvider());
            ((AEConfigPresentableContentProvider) comboSemanticViewer.getContentProvider()).setAddALL(true);

            if (_facade.getAllSemantics() != null && !_facade.getAllSemantics().isEmpty()) {
                comboSemanticViewer.setInput(_facade.getAllSemantics());
                if (c.getCrit0() != null) {
                    setComboViewerByString(comboSemanticViewer, c.getCrit0());
                } else {
                    semCombo.select(0);
                    c.setCrit0(semCombo.getItem(0));
                }
            }
            semCombo.setLayoutData(new GridData());
            ((GridData) semCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) semCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) semCombo.getLayoutData()).horizontalSpan = 2;

            comboSemanticViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    IAEPresentable cp = (IAEPresentable) obj;
                    if (cp != null) {
                        c.setCrit0(cp.getValue());
                    }
                }
            });
            semCombo.pack();

            final Combo tagCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            tagCombo.setLayoutData(new GridData());
            tagCombo.setLayoutData(new GridData());
            ((GridData) tagCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) tagCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) tagCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer tagComboViewer = new ComboViewer(tagCombo);
            tagComboViewer.setContentProvider(new MarkupContentProvider(true));
            tagComboViewer.setLabelProvider(new MarkupLabelProvider());
            tagComboViewer.setComparator(new ConfigDataComparator());
            if (_facade.getConfigs().containsKey(_markupProvider)) {
                HashMap<String, ConfigData> input = _facade.getConfigs().get(_markupProvider).getChildren();
                tagComboViewer.setInput(input);
            }
            if (c.getCrit1() != null) {
                setComboViewerByString(tagComboViewer, c.getCrit1());
            } else {
                Object obj = tagComboViewer.getElementAt(0);
                if (obj != null) {
                    tagComboViewer.setSelection(new StructuredSelection(obj));
                    ConfigData cd = (ConfigData) tagComboViewer.getElementAt(0);
                    if (cd.getValue().startsWith("aodl:")) //$NON-NLS-1$
                    {
                        c.setCrit1(cd.getValue().substring(5));
                    } else {
                        c.setCrit1(cd.getValue());
                    }
                }
            }
            final Combo typeCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            typeCombo.setLayoutData(new GridData());
            typeCombo.setLayoutData(new GridData());
            ((GridData) typeCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) typeCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) typeCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer typeComboViewer = new ComboViewer(typeCombo);
            typeComboViewer.setContentProvider(new MarkupContentProvider(false));
            typeComboViewer.setLabelProvider(new MarkupLabelProvider());
            typeComboViewer.setComparator(new ConfigDataComparator());

            tagComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    String selection;
                    if (cd.getValue().startsWith("aodl:")) //$NON-NLS-1$
                    {
                        selection = cd.getValue().substring(5);
                    } else {
                        selection = cd.getValue();
                    }
                    c.setCrit1(selection);
                    setComboViewerInput(typeComboViewer, "tagging_values", c.getCrit1(), null, null); //$NON-NLS-1$
                }
            });

            if (c.getCrit2() != null) {
                setComboViewerByString(typeComboViewer, c.getCrit2());
            }

            final Combo subtypeCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            final ComboViewer subtypeComboViewer = new ComboViewer(subtypeCombo);
            subtypeComboViewer.setContentProvider(new MarkupContentProvider());
            subtypeComboViewer.setLabelProvider(new MarkupLabelProvider());
            subtypeComboViewer.setComparator(new ConfigDataComparator());

            typeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    subtypeComboViewer.setInput(null);
                    if (cd != null) {
                        c.setCrit2(cd.getValue());
                    }
                    setComboViewerInput(subtypeComboViewer, "tagging_values", c.getCrit1(), c.getCrit2(), null); //$NON-NLS-1$
                }
            });

            subtypeCombo.setLayoutData(new GridData());
            subtypeCombo.setLayoutData(new GridData());
            ((GridData) subtypeCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) subtypeCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) subtypeCombo.getLayoutData()).horizontalSpan = 2;
            if (c.getCrit3() != null) {
                setComboViewerByString(subtypeComboViewer, c.getCrit3());
            }

            subtypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    if (cd != null) {
                        c.setCrit3(cd.getValue());
                    }
                }
            });

            final Text searchText = new Text(_searchPTagComp, SWT.BORDER);
            searchText.setLayoutData(new GridData());
            searchText.setLayoutData(new GridData());
            ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) searchText.getLayoutData()).horizontalSpan = 3;
            if (c.getSearchText() != null) {
                searchText.setText(c.getSearchText());
            }
            searchText.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(final FocusEvent e) {
                    c.setSearchText(searchText.getText());
                }
            });
            searchText.addKeyListener(new KeyListener() {
                @Override
                public void keyPressed(final KeyEvent e) {
                    if (e.keyCode == SWT.CR) {
                        c.setSearchText(searchText.getText());
                        okPressed();
                    }
                }

                @Override
                public void keyReleased(final KeyEvent e) {
                }
            });

            final Button fuzzyB = new Button(_searchPTagComp, SWT.CHECK);
            fuzzyB.setLayoutData(new GridData());
            fuzzyB.setSelection(c.isFuzzy());
            fuzzyB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setFuzzy(!c.isFuzzy());
                }
            });

            final Button includeB = new Button(_searchPTagComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

        } // if tagging

        if (c.getType().equals("relation")) //$NON-NLS-1$
        {
            if (rel1) {
                rel1 = false;
                _searchPRelComp = new Composite(_personSearchGroup, SWT.NONE);
                _searchPRelComp.setLayout(new GridLayout());
                ((GridLayout) _searchPRelComp.getLayout()).makeColumnsEqualWidth = true;
                ((GridLayout) _searchPRelComp.getLayout()).numColumns = 14;
                _searchPRelComp.setLayoutData(new GridData());
                ((GridData) _searchPRelComp.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) _searchPRelComp.getLayoutData()).grabExcessHorizontalSpace = true;
                // ((GridData) searchPRelComp.getLayoutData()).heightHint =
                // 200;
                ((GridData) _searchPRelComp.getLayoutData()).grabExcessVerticalSpace = false;
                ((GridData) _searchPRelComp.getLayoutData()).horizontalSpan = 1;

                Label l = new Label(_searchPRelComp, SWT.NONE);
                l.setText(NLMessages.getString("Dialog_relation")); //$NON-NLS-1$
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 1;

                Label context = new Label(_searchPRelComp, SWT.NONE);
                context.setText(NLMessages.getString("Dialog_context")); //$NON-NLS-1$
                context.setLayoutData(new GridData());
                ((GridData) context.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) context.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) context.getLayoutData()).horizontalSpan = 2;

                Label classL = new Label(_searchPRelComp, SWT.NONE);
                classL.setText(NLMessages.getString("Dialog_class")); //$NON-NLS-1$
                classL.setLayoutData(new GridData());
                ((GridData) classL.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) classL.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) classL.getLayoutData()).horizontalSpan = 2;

                Label relObj = new Label(_searchPRelComp, SWT.NONE);
                relObj.setText(NLMessages.getString("Dialog_relObject")); //$NON-NLS-1$
                relObj.setLayoutData(new GridData());
                ((GridData) relObj.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) relObj.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) relObj.getLayoutData()).horizontalSpan = 4;

                Label searchTextLabel = new Label(_searchPRelComp, SWT.NONE);
                searchTextLabel.setText(NLMessages.getString("Dialog_searchText")); //$NON-NLS-1$
                searchTextLabel.setLayoutData(new GridData());
                ((GridData) searchTextLabel.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) searchTextLabel.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) searchTextLabel.getLayoutData()).horizontalSpan = 3;

                Label fuzzy = new Label(_searchPRelComp, SWT.NONE);
                fuzzy.setText(""); //$NON-NLS-1$
                fuzzy.setLayoutData(new GridData());
                ((GridData) fuzzy.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) fuzzy.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) fuzzy.getLayoutData()).horizontalSpan = 1;

                Label include = new Label(_searchPRelComp, SWT.NONE);
                include.setText(""); //$NON-NLS-1$
                include.setToolTipText(NLMessages.getString("Dialog_includeConcurrences")); //$NON-NLS-1$
                include.setLayoutData(new GridData());
                ((GridData) include.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) include.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) include.getLayoutData()).horizontalSpan = 1;

            }

            if (i == 0) {
                Label l = new Label(_searchPRelComp, SWT.NONE);
                l.setLayoutData(new GridData());
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 1;
            } else {
                final Combo opCombo = new Combo(_searchPRelComp, SWT.READ_ONLY);
                opCombo.setLayoutData(new GridData());
                opCombo.add(Operator.AND.toString());
                opCombo.add(Operator.OR.toString());
                opCombo.add(Operator.NOT.toString());
                opCombo.setLayoutData(new GridData());
                ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) opCombo.getLayoutData()).horizontalSpan = 1;
                if (c.getOperator() != null) {
                    opCombo.select(opCombo.indexOf(c.getOperator()));
                } else {
                    opCombo.select(0);
                    c.setOperator(opCombo.getItem(0));

                }
                opCombo.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent se) {
                        c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                    }
                });
            }

            final Combo contextCombo = new Combo(_searchPRelComp, SWT.READ_ONLY);
            contextCombo.setLayoutData(new GridData());
            contextCombo.setLayoutData(new GridData());
            ((GridData) contextCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) contextCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) contextCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer contextComboViewer = new ComboViewer(contextCombo);
            contextComboViewer.setContentProvider(new MarkupContentProvider());
            contextComboViewer.setLabelProvider(new MarkupLabelProvider());
            contextComboViewer.setComparator(new ConfigDataComparator());

            final Combo classCombo = new Combo(_searchPRelComp, SWT.READ_ONLY);
            classCombo.setLayoutData(new GridData());
            classCombo.setLayoutData(new GridData());
            ((GridData) classCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) classCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) classCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer classComboViewer = new ComboViewer(classCombo);
            classComboViewer.setContentProvider(new MarkupContentProvider());
            classComboViewer.setLabelProvider(new MarkupLabelProvider());
            classComboViewer.setComparator(new ConfigDataComparator());
            setComboViewerInput(contextComboViewer, "relation", null, null, null); //$NON-NLS-1$
            if (c.getRelationContext() != null) {
                setComboViewerByString(contextComboViewer, c.getRelationContext());
                setComboViewerInput(classComboViewer, "relation", c.getRelationContext(), null, null); //$NON-NLS-1$

            } else {
                contextComboViewer.setSelection(new StructuredSelection(contextComboViewer.getElementAt(0)));
                ConfigData cd = (ConfigData) contextComboViewer.getElementAt(0);
                c.setRelationContext(cd.getValue());

            }
            contextComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    c.setRelationContext(cd.getValue());
                    setComboViewerInput(classComboViewer, "relation", c.getRelationContext(), null, null); //$NON-NLS-1$
                }
            });

            if (c.getRelationClass() != null) {
                setComboViewerByString(classComboViewer, c.getRelationClass());
            }

            classComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    c.setRelationClass(cd.getValue());
                }
            });

            final Text relObjText = new Text(_searchPRelComp, SWT.BORDER);
            relObjText.setLayoutData(new GridData());
            relObjText.setLayoutData(new GridData());
            ((GridData) relObjText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) relObjText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) relObjText.getLayoutData()).horizontalSpan = 3;
            if (c.getRelatedId() != null) {
                relObjText.setText(c.getRelatedId().toString());
            }
            relObjText.setEnabled(false);

            final Button setObj = new Button(_searchPRelComp, SWT.PUSH);
            setObj.setEnabled(false);
            setObj.setText(NLMessages.getString("Dialog_set_key")); //$NON-NLS-1$
            setObj.setFont(JFaceResources.getDialogFont());
            setObj.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                }
            });

            final Text searchText = new Text(_searchPRelComp, SWT.BORDER);
            searchText.setLayoutData(new GridData());
            searchText.setLayoutData(new GridData());
            ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) searchText.getLayoutData()).horizontalSpan = 3;
            if (c.getSearchText() != null) {
                searchText.setText(c.getSearchText());
            }
            searchText.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(final FocusEvent e) {
                    c.setSearchText(searchText.getText());
                }
            });
            searchText.addKeyListener(new KeyListener() {
                @Override
                public void keyPressed(final KeyEvent e) {
                    if (e.keyCode == SWT.CR) {
                        c.setSearchText(searchText.getText());
                        okPressed();
                    }
                }

                @Override
                public void keyReleased(final KeyEvent e) {
                }
            });
            final Button fuzzyB = new Button(_searchPRelComp, SWT.CHECK);
            fuzzyB.setLayoutData(new GridData());
            fuzzyB.setSelection(c.isFuzzy());
            fuzzyB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setFuzzy(!c.isFuzzy());
                }
            });

            final Button includeB = new Button(_searchPRelComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

        } // if relation
        if (c.getType().equals("date")) //$NON-NLS-1$
        {
            if (date1) {
                date1 = false;
                _searchPDateComp = new Composite(_personSearchGroup, SWT.NONE);
                _searchPDateComp.setLayout(new GridLayout());
                ((GridLayout) _searchPDateComp.getLayout()).makeColumnsEqualWidth = true;
                ((GridLayout) _searchPDateComp.getLayout()).numColumns = 14;
                _searchPDateComp.setLayoutData(new GridData());
                ((GridData) _searchPDateComp.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) _searchPDateComp.getLayoutData()).grabExcessHorizontalSpace = true;
                // ((GridData) searchPDateComp.getLayoutData()).heightHint =
                // 200;
                ((GridData) _searchPDateComp.getLayoutData()).grabExcessVerticalSpace = false;
                ((GridData) _searchPDateComp.getLayoutData()).horizontalSpan = 1;

                Label l2 = new Label(_searchPDateComp, SWT.NONE);
                l2.setText(NLMessages.getString("Dialog_date")); //$NON-NLS-1$
                l2.setLayoutData(new GridData());
                ((GridData) l2.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l2.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l2.getLayoutData()).horizontalSpan = 1;

                Label typeDate = new Label(_searchPDateComp, SWT.NONE);
                typeDate.setText(NLMessages.getString("Dialog_type")); //$NON-NLS-1$
                typeDate.setLayoutData(new GridData());
                ((GridData) typeDate.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) typeDate.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) typeDate.getLayoutData()).horizontalSpan = 2;

                //
                Label notBefore = new Label(_searchPDateComp, SWT.NONE);
                notBefore.setText(NLMessages.getString("Dialog_day")); //$NON-NLS-1$
                notBefore.setLayoutData(new GridData());
                ((GridData) notBefore.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) notBefore.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) notBefore.getLayoutData()).horizontalSpan = 1;

                Label month = new Label(_searchPDateComp, SWT.NONE);
                month.setText(NLMessages.getString("Dialog_month")); //$NON-NLS-1$
                month.setLayoutData(new GridData());
                ((GridData) month.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) month.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) month.getLayoutData()).horizontalSpan = 1;
                Label bl = new Label(_searchPDateComp, SWT.NONE);
                bl.setText(""); //$NON-NLS-1$
                Label year = new Label(_searchPDateComp, SWT.NONE);
                year.setText(NLMessages.getString("Dialog_year")); //$NON-NLS-1$
                year.setLayoutData(new GridData());
                ((GridData) year.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) year.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) year.getLayoutData()).horizontalSpan = 2;

                // Label bl2 = new Label (searchPDateComp, SWT.NONE);
                //               bl2.setText(""); //$NON-NLS-1$

                Label notAfter = new Label(_searchPDateComp, SWT.NONE);
                notAfter.setText(NLMessages.getString("Dialog_day")); //$NON-NLS-1$
                notAfter.setLayoutData(new GridData());
                ((GridData) notAfter.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) notAfter.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) notAfter.getLayoutData()).horizontalSpan = 1;

                Label month2 = new Label(_searchPDateComp, SWT.NONE);
                month2.setText(NLMessages.getString("Dialog_month")); //$NON-NLS-1$
                month2.setLayoutData(new GridData());
                ((GridData) month2.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) month2.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) month2.getLayoutData()).horizontalSpan = 1;
                Label bl2 = new Label(_searchPDateComp, SWT.NONE);
                bl2.setText(""); //$NON-NLS-1$
                Label year2 = new Label(_searchPDateComp, SWT.NONE);
                year2.setText(NLMessages.getString("Dialog_year")); //$NON-NLS-1$
                year2.setLayoutData(new GridData());
                ((GridData) year2.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) year2.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) year2.getLayoutData()).horizontalSpan = 2;

                Label include = new Label(_searchPDateComp, SWT.NONE);
                include.setText(""); //$NON-NLS-1$
                include.setToolTipText(NLMessages.getString("Dialog_includeConcurrences")); //$NON-NLS-1$
                include.setLayoutData(new GridData());
                ((GridData) include.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) include.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) include.getLayoutData()).horizontalSpan = 1;

            }

            if (i == 0) {
                Label l = new Label(_searchPDateComp, SWT.NONE);
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 1;
            } else {
                final Combo opCombo = new Combo(_searchPDateComp, SWT.READ_ONLY);
                opCombo.setLayoutData(new GridData());
                opCombo.add(Operator.AND.toString());
                opCombo.add(Operator.OR.toString());
                opCombo.add(Operator.NOT.toString());
                opCombo.setLayoutData(new GridData());
                ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) opCombo.getLayoutData()).horizontalSpan = 1;
                if (c.getOperator() != null) {
                    opCombo.setText(c.getOperator());
                } else {
                    opCombo.select(0);
                    c.setOperator(opCombo.getItem(0));

                }
                opCombo.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent se) {
                        c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                    }
                });
            }

            final Combo typeDCombo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            typeDCombo.setLayoutData(new GridData());
            ComboViewer timeTypeComboViewer = new ComboViewer(typeDCombo);
            timeTypeComboViewer.setContentProvider(ArrayContentProvider.getInstance());
            timeTypeComboViewer.setLabelProvider(new LabelProvider() {

                @Override
                public String getText(final Object element) {
                    String str = (String) element;
                    if (NLMessages.getString("Editor_time_" + str) != null) //$NON-NLS-1$
                    {
                        return NLMessages.getString("Editor_time_" + str); //$NON-NLS-1$
                    }
                    return str;
                }

            });
            timeTypeComboViewer.setInput(AEConstants.TIME_TYPES);
            timeTypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection selection = event.getSelection();
                    Object obj = ((IStructuredSelection) selection).getFirstElement();
                    String s = (String) obj;
                    //                    System.out.println("datetype selected " + s); //$NON-NLS-1$
                    c.setDateType(s);
                }

            });
            if (c.getDateType() != null) {
                StructuredSelection selection = new StructuredSelection(c.getDateType());
                timeTypeComboViewer.setSelection(selection);
            } else {
                StructuredSelection selection = new StructuredSelection(AEConstants.TIME_TYPES[0]);
                timeTypeComboViewer.setSelection(selection);
                c.setDateType(AEConstants.TIME_TYPES[0]);
            }

            Label from = new Label(_searchPDateComp, SWT.NONE);
            from.setText(NLMessages.getString("Dialog_from")); //$NON-NLS-1$
            from.setLayoutData(new GridData());
            ((GridData) from.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) from.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) from.getLayoutData()).horizontalSpan = 1;

            final Combo day1Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            day1Combo.setLayoutData(new GridData());
            day1Combo.setItems(AEConstants.DAYS);
            day1Combo.setLayoutData(new GridData());
            ((GridData) day1Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) day1Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) day1Combo.getLayoutData()).horizontalSpan = 1;

            if (c.getDateFrom() == null) {
                PdrDate dateFrom = new PdrDate("0000-00-00"); //$NON-NLS-1$
                // dateFrom.setDay(0);
                // dateFrom.setMonth(0);
                // dateFrom.setYear(0);
                c.setDateFrom(dateFrom);
                day1Combo.select(c.getDateFrom().getDay());
            }
            //            System.out.println("test: dateFrom " + c.getDateFrom().toString()); //$NON-NLS-1$
            // else
            // {
            //
            // day1Combo.select(0);
            // c.getDateFrom().setDay(0);
            //
            // }

            day1Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateFrom().setDay(day1Combo.getSelectionIndex());
                }
            });

            final Combo month1Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            month1Combo.setLayoutData(new GridData());
            month1Combo.setItems(AEConstants.MONTHS);
            month1Combo.setLayoutData(new GridData());
            ((GridData) month1Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) month1Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) month1Combo.getLayoutData()).horizontalSpan = 1;
            if (c.getDateFrom() != null) {
                month1Combo.select(c.getDateFrom().getMonth());
            } else {

                month1Combo.select(0);
                c.getDateFrom().setMonth(0);

            }

            month1Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateFrom().setMonth(month1Combo.getSelectionIndex());
                }
            });

            final YearSpinner year1Spinner = new YearSpinner(_searchPDateComp, SWT.NULL);
            if (c.getDateFrom() != null) {
                year1Spinner.setSelection(c.getDateFrom().getYear());
            } else {

                year1Spinner.setSelection(_preselection);
                c.getDateFrom().setYear(_preselection);

            }

            year1Spinner.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetDefaultSelected(final SelectionEvent e) {
                    c.getDateFrom().setYear(year1Spinner.getSelection());

                }

                @Override
                public void widgetSelected(final SelectionEvent e) {
                    c.getDateFrom().setYear(year1Spinner.getSelection());
                }

            });

            Label to = new Label(_searchPDateComp, SWT.NONE);
            to.setText(NLMessages.getString("Dialog_to")); //$NON-NLS-1$
            to.setLayoutData(new GridData());
            ((GridData) to.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) to.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) to.getLayoutData()).horizontalSpan = 1;

            final Combo day2Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            day2Combo.setLayoutData(new GridData());
            day2Combo.setItems(AEConstants.DAYS);
            day2Combo.setLayoutData(new GridData());
            ((GridData) day2Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) day2Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) day2Combo.getLayoutData()).horizontalSpan = 1;
            if (c.getDateTo() == null) {
                PdrDate dateTo = new PdrDate("0000-00-00"); //$NON-NLS-1$
                c.setDateTo(dateTo);
                day2Combo.select(c.getDateTo().getDay());
            }

            day2Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateTo().setDay(day2Combo.getSelectionIndex());
                }
            });

            final Combo month2Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            month2Combo.setLayoutData(new GridData());
            month2Combo.setItems(AEConstants.MONTHS);
            month2Combo.setLayoutData(new GridData());
            ((GridData) month2Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) month2Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) month2Combo.getLayoutData()).horizontalSpan = 1;
            if (c.getDateTo() != null) {
                month2Combo.select(c.getDateTo().getMonth());
            } else {

                month2Combo.select(0);
                c.getDateTo().setMonth(0);

            }

            month2Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateTo().setMonth(month2Combo.getSelectionIndex());
                }
            });

            final YearSpinner year2Spinner = new YearSpinner(_searchPDateComp, SWT.NULL);
            if (c.getDateTo() != null) {
                year2Spinner.setSelection(c.getDateTo().getYear());
            } else {
                year2Spinner.setSelection(_preselection);
                c.getDateTo().setYear(_preselection);
            }

            year2Spinner.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetDefaultSelected(final SelectionEvent e) {
                    c.getDateTo().setYear(year2Spinner.getSelection());

                }

                @Override
                public void widgetSelected(final SelectionEvent e) {
                    c.getDateTo().setYear(year2Spinner.getSelection());
                }

            });

            final Button includeB = new Button(_searchPDateComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

        } // if date

        if (c.getType().equals("reference")) //$NON-NLS-1$
        {
            _searchPRefComp = new Composite(_personSearchGroup, SWT.NONE);
            _searchPRefComp.setLayout(new GridLayout());
            ((GridLayout) _searchPRefComp.getLayout()).makeColumnsEqualWidth = true;
            ((GridLayout) _searchPRefComp.getLayout()).numColumns = 14;
            _searchPRefComp.setLayoutData(new GridData());
            ((GridData) _searchPRefComp.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) _searchPRefComp.getLayoutData()).grabExcessHorizontalSpace = true;
            // ((GridData) searchPTagComp.getLayoutData()).heightHint = 200;
            ((GridData) _searchPRefComp.getLayoutData()).grabExcessVerticalSpace = false;
            ((GridData) _searchPRefComp.getLayoutData()).horizontalSpan = 1;

            final Combo opCombo = new Combo(_searchPRefComp, SWT.READ_ONLY);
            opCombo.setLayoutData(new GridData());
            opCombo.add(Operator.AND.toString());
            opCombo.add(Operator.OR.toString());
            opCombo.add(Operator.NOT.toString());
            opCombo.setLayoutData(new GridData());
            ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) opCombo.getLayoutData()).horizontalSpan = 1;
            if (c.getOperator() != null) {
                opCombo.setText(c.getOperator());
            } else {
                opCombo.select(0);
                c.setOperator(opCombo.getItem(0));

            }
            opCombo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                }
            });

            Label sem = new Label(_searchPRefComp, SWT.NONE);
            sem.setText(NLMessages.getString("Dialog_reference")); //$NON-NLS-1$
            sem.setLayoutData(new GridData());
            ((GridData) sem.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) sem.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) sem.getLayoutData()).horizontalSpan = 2;

            Label tagName = new Label(_searchPRefComp, SWT.NONE);
            tagName.setText(NLMessages.getString("Dialog_genre")); //$NON-NLS-1$
            tagName.setLayoutData(new GridData());
            ((GridData) tagName.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) tagName.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) tagName.getLayoutData()).horizontalSpan = 2;

            final Combo genreCombo = new Combo(_searchPRefComp, SWT.READ_ONLY);
            genreCombo.setLayoutData(new GridData());
            ComboViewer genreComboViewer = new ComboViewer(genreCombo);
            genreComboViewer.setContentProvider(new RefTemplateContentProvider(false));
            genreComboViewer.setLabelProvider(new LabelProvider() {

                @Override
                public String getText(final Object element) {
                    ReferenceModsTemplate template = (ReferenceModsTemplate) element;
                    return template.getLabel();
                }

            });

            genreComboViewer.setInput(_facade.getAllGenres());
            genreComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection selection = event.getSelection();
                    Object obj = ((IStructuredSelection) selection).getFirstElement();
                    ReferenceModsTemplate template = (ReferenceModsTemplate) obj;
                    if (template != null) {
                        c.setCrit0(template.getValue());
                    }
                }

            });
            genreCombo.add("ALL", 0); //$NON-NLS-1$

            genreCombo.setLayoutData(new GridData());
            ((GridData) genreCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) genreCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) genreCombo.getLayoutData()).horizontalSpan = 2;
            if (c.getCrit0() != null) {
                StructuredSelection selection = new StructuredSelection(c.getCrit0());
                genreComboViewer.setSelection(selection);
            } else {
                genreCombo.select(0);
                c.setCrit0(genreCombo.getItem(0));

            }

            Label tagType = new Label(_searchPRefComp, SWT.NONE);
            tagType.setText(NLMessages.getString("Dialog_searchText")); //$NON-NLS-1$
            tagType.setLayoutData(new GridData());
            ((GridData) tagType.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) tagType.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) tagType.getLayoutData()).horizontalSpan = 2;

            final Text searchText = new Text(_searchPRefComp, SWT.BORDER);
            searchText.setLayoutData(new GridData());
            searchText.setLayoutData(new GridData());
            ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) searchText.getLayoutData()).horizontalSpan = 3;
            if (c.getSearchText() != null) {
                searchText.setText(c.getSearchText());
            }
            searchText.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(final FocusEvent e) {
                    c.setSearchText(searchText.getText());
                }
            });

            searchText.addKeyListener(new KeyListener() {
                @Override
                public void keyPressed(final KeyEvent e) {
                    if (e.keyCode == SWT.CR) {
                        c.setSearchText(searchText.getText());
                        okPressed();
                    }
                }

                @Override
                public void keyReleased(final KeyEvent e) {
                }
            });

            final Button fuzzyB = new Button(_searchPRefComp, SWT.CHECK);
            fuzzyB.setLayoutData(new GridData());
            fuzzyB.setSelection(c.isFuzzy());
            fuzzyB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setFuzzy(!c.isFuzzy());
                }
            });

            final Button includeB = new Button(_searchPRefComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

        } // if reference
    }

    // contentCompSearch.layout();
    // scrollCompSearch.setContent(contentCompSearch);
    // scrollCompSearch.setMinSize(contentCompSearch.computeSize(SWT.DEFAULT,
    // SWT.DEFAULT, true));
    // scrollCompSearch.layout();
    _personSearchGroup.redraw();
    _personSearchGroup.layout();
    _personSearchGroup.pack();
    _personSearchGroup.layout();
    // personSearchGroup.pack();

}

From source file:org.bbaw.pdr.ae.view.main.dialogs.AdvancedSearchDialog.java

License:Open Source License

/**
 * meth creates the OK button.//  w  w w. ja v  a2s.c om
 * @param parent parent composite
 * @param id id
 * @param label label of button
 * @param defaultButton is default
 * @return button.
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    Button button = new Button(parent, SWT.PUSH);
    button.setText(label);
    button.setImage(_imageReg.get(IconsInternal.SEARCH));
    button.setFont(JFaceResources.getDialogFont());
    button.setData(new Integer(id));
    button.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            //            System.out.println("OK pressed"); //$NON-NLS-1$
            if (isValidInput()) {
                okPressed();
            }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(button);
        }
    }
    setButtonLayoutData(button);
    return button;
}

From source file:org.bbaw.pdr.ae.view.main.dialogs.ExpertSearchDialog.java

License:Open Source License

/**
 * Builds the person search./*from w  w  w. jav a 2  s.c  o m*/
 * @param type the type
 * @param crit the crit
 */
private void buildPersonSearch(final int type, final Integer crit) {
    DataType dtAll = new DataType();
    dtAll.setValue("ALL"); //$NON-NLS-1$
    dtAll.setLabel("ALL"); //$NON-NLS-1$
    if (_scrollCompSearch != null) {
        _scrollCompSearch.dispose();
    }
    if (_searchPTagComp != null) {
        _searchPTagComp.dispose();
    }
    // if (placeGroup != null) placeGroup.dispose();
    _scrollCompSearch = new ScrolledComposite(_personSearchGroup, SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL);
    _scrollCompSearch.setExpandHorizontal(true);
    _scrollCompSearch.setExpandVertical(true);
    _scrollCompSearch.setMinHeight(1);
    _scrollCompSearch.setMinWidth(1);

    _scrollCompSearch.setLayout(new GridLayout());
    _scrollCompSearch.setLayoutData(new GridData());
    ((GridData) _scrollCompSearch.getLayoutData()).heightHint = 400;
    ((GridData) _scrollCompSearch.getLayoutData()).horizontalSpan = 4;
    ((GridData) _scrollCompSearch.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _scrollCompSearch.getLayoutData()).grabExcessHorizontalSpace = true;
    _scrollCompSearch.pack();

    Composite contentCompSearch = new Composite(_scrollCompSearch, SWT.NONE);
    contentCompSearch.setLayout(new GridLayout());

    _scrollCompSearch.setContent(contentCompSearch);

    boolean tag1 = true;
    boolean rel1 = true;
    boolean date1 = true;
    switch (type) {
    case 0:
        // pdrQuery = new PdrQuery();
        // criteria = new Criteria();
        // pdrQuery.getCriterias().add(criteria);

        break; // normales laden
    case 1: // neues criteria einfgen
        _criteria = new Criteria();
        _pdrQuery.getCriterias().add(_criteria);
        _criteria.setType("tagging"); //$NON-NLS-1$
        //         System.out.println("in case 1"); //$NON-NLS-1$
        //         System.out.println("anzahl crit " + pdrQuery.getCriterias().size()); //$NON-NLS-1$
        break;
    case 2: // criteria lschen
        _pdrQuery.getCriterias().removeElementAt(crit);
        break;
    case 3: // neue relation einfgen
        _criteria = new Criteria();
        _pdrQuery.getCriterias().add(_criteria);
        _criteria.setType("relation"); //$NON-NLS-1$
        break;
    case 4: // relation lschen
        _pdrQuery.getCriterias().removeElementAt(crit);
        break;
    case 5: // date criteria einfgen
        _criteria = new Criteria();
        _pdrQuery.getCriterias().add(_criteria);
        _criteria.setType("date"); //$NON-NLS-1$
        break;
    case 6:
        _pdrQuery.getCriterias().removeElementAt(crit);
        break;
    case 7: // reference criteria einfgen
        _criteria = new Criteria();
        _pdrQuery.getCriterias().add(_criteria);
        _criteria.setType("reference"); //$NON-NLS-1$
        break;
    case 8:
        _pdrQuery.getCriterias().removeElementAt(crit);
        break;
    default:
        break;
    }

    Collections.sort(_pdrQuery.getCriterias());

    // load last search.
    if (_facade.getLastExpertSearch() != null) {
        _pdrQuery = _facade.getLastExpertSearch();
    }

    for (int i = 0; i < _pdrQuery.getCriterias().size(); i++) {
        //         System.out.println("for i = " + i); //$NON-NLS-1$
        final Criteria c = _pdrQuery.getCriterias().get(i);

        if (c.getType().equals("tagging")) //$NON-NLS-1$
        {
            if (tag1) {
                tag1 = false;
                _searchPTagComp = new Composite(contentCompSearch, SWT.NONE);
                _searchPTagComp.setLayout(new GridLayout());
                ((GridLayout) _searchPTagComp.getLayout()).makeColumnsEqualWidth = true;
                ((GridLayout) _searchPTagComp.getLayout()).numColumns = 21;
                _searchPTagComp.setLayoutData(new GridData());
                ((GridData) _searchPTagComp.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) _searchPTagComp.getLayoutData()).grabExcessHorizontalSpace = true;
                // ((GridData) searchPTagComp.getLayoutData()).heightHint =
                // 200;
                ((GridData) _searchPTagComp.getLayoutData()).grabExcessVerticalSpace = false;
                ((GridData) _searchPTagComp.getLayoutData()).horizontalSpan = 1;

                Label op = new Label(_searchPTagComp, SWT.NONE);
                op.setText(NLMessages.getString("Dialog_operand")); //$NON-NLS-1$
                op.setLayoutData(new GridData());
                ((GridData) op.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) op.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) op.getLayoutData()).horizontalSpan = 2;

                Label sem = new Label(_searchPTagComp, SWT.NONE);
                sem.setText(NLMessages.getString("Dialog_semantic")); //$NON-NLS-1$
                sem.setLayoutData(new GridData());
                ((GridData) sem.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) sem.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) sem.getLayoutData()).horizontalSpan = 2;

                Label tagName = new Label(_searchPTagComp, SWT.NONE);
                tagName.setText(NLMessages.getString("Dialog_tagging")); //$NON-NLS-1$
                tagName.setLayoutData(new GridData());
                ((GridData) tagName.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagName.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagName.getLayoutData()).horizontalSpan = 2;

                Label tagType = new Label(_searchPTagComp, SWT.NONE);
                tagType.setText(NLMessages.getString("Dialog_type")); //$NON-NLS-1$
                tagType.setLayoutData(new GridData());
                ((GridData) tagType.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagType.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagType.getLayoutData()).horizontalSpan = 2;

                Label tagSubtype = new Label(_searchPTagComp, SWT.NONE);
                tagSubtype.setText(NLMessages.getString("Dialog_subtype")); //$NON-NLS-1$
                tagSubtype.setLayoutData(new GridData());
                ((GridData) tagSubtype.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagSubtype.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagSubtype.getLayoutData()).horizontalSpan = 2;

                Label tagRole = new Label(_searchPTagComp, SWT.NONE);
                tagRole.setText(NLMessages.getString("Dialog_role")); //$NON-NLS-1$
                tagRole.setLayoutData(new GridData());
                ((GridData) tagRole.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagRole.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagRole.getLayoutData()).horizontalSpan = 2;

                Label tagKey = new Label(_searchPTagComp, SWT.NONE);
                tagKey.setText(NLMessages.getString("Dialog_key")); //$NON-NLS-1$
                tagKey.setLayoutData(new GridData());
                ((GridData) tagKey.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) tagKey.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) tagKey.getLayoutData()).horizontalSpan = 3;

                Label searchTextLabel = new Label(_searchPTagComp, SWT.NONE);
                searchTextLabel.setText(NLMessages.getString("Dialog_searchText")); //$NON-NLS-1$
                searchTextLabel.setLayoutData(new GridData());
                ((GridData) searchTextLabel.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) searchTextLabel.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) searchTextLabel.getLayoutData()).horizontalSpan = 3;

                Label fuzzy = new Label(_searchPTagComp, SWT.NONE);
                fuzzy.setText(NLMessages.getString("Dialog_fuzzy")); //$NON-NLS-1$
                fuzzy.setLayoutData(new GridData());
                ((GridData) fuzzy.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) fuzzy.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) fuzzy.getLayoutData()).horizontalSpan = 1;

                Label include = new Label(_searchPTagComp, SWT.NONE);
                include.setText(NLMessages.getString("Dialog_include")); //$NON-NLS-1$
                include.setToolTipText(NLMessages.getString("Dialog_includeConcurrences")); //$NON-NLS-1$
                include.setLayoutData(new GridData());
                ((GridData) include.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) include.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) include.getLayoutData()).horizontalSpan = 1;

                Label del = new Label(_searchPTagComp, SWT.NONE);
                del.setText(NLMessages.getString("Dialog_del")); //$NON-NLS-1$
                del.setLayoutData(new GridData());
                ((GridData) del.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) del.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) del.getLayoutData()).horizontalSpan = 1;
            }

            if (i == 0) {
                Label l = new Label(_searchPTagComp, SWT.NONE);
                l.setLayoutData(new GridData());
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 2;
            } else {
                final Combo opCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
                opCombo.setLayoutData(new GridData());
                opCombo.add(Operator.AND.toString());
                opCombo.add(Operator.OR.toString());
                opCombo.add(Operator.NOT.toString());
                opCombo.setLayoutData(new GridData());
                ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) opCombo.getLayoutData()).horizontalSpan = 2;
                if (c.getOperator() != null) {
                    opCombo.setText(c.getOperator());
                } else {
                    opCombo.select(0);
                    c.setOperator(opCombo.getItem(0));

                }
                opCombo.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent se) {
                        c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                    }
                });
            }

            final Combo semCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            semCombo.setLayoutData(new GridData());
            ComboViewer comboSemanticViewer = new ComboViewer(semCombo);
            comboSemanticViewer.setContentProvider(new AEConfigPresentableContentProvider());
            comboSemanticViewer.setLabelProvider(new AEConfigPresentableLabelProvider());
            ((AEConfigPresentableContentProvider) comboSemanticViewer.getContentProvider()).setAddALL(true);

            if (_facade.getAllSemantics() != null && !_facade.getAllSemantics().isEmpty()) {
                comboSemanticViewer.setInput(_facade.getAllSemantics());
                if (c.getCrit0() != null) {
                    setComboViewerByString(comboSemanticViewer, c.getCrit0());
                } else {
                    semCombo.select(0);
                    c.setCrit0(semCombo.getItem(0));
                }
            }
            semCombo.setLayoutData(new GridData());
            ((GridData) semCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) semCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) semCombo.getLayoutData()).horizontalSpan = 2;

            comboSemanticViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    IAEPresentable cp = (IAEPresentable) obj;
                    if (cp != null) {
                        c.setCrit0(cp.getValue());
                    }
                }
            });
            semCombo.pack();
            final Combo tagCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            tagCombo.setLayoutData(new GridData());
            tagCombo.setLayoutData(new GridData());
            ((GridData) tagCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) tagCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) tagCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer tagComboViewer = new ComboViewer(tagCombo);
            tagComboViewer.setContentProvider(new MarkupContentProvider(true));
            tagComboViewer.setLabelProvider(new MarkupLabelProvider());
            tagComboViewer.setComparator(new ConfigDataComparator());
            if (_facade.getConfigs().containsKey(_markupProvider)) {
                HashMap<String, ConfigData> input = _facade.getConfigs().get(_markupProvider).getChildren();
                tagComboViewer.setInput(input);
            }
            if (c.getCrit1() != null) {
                setComboViewerByString(tagComboViewer, c.getCrit1());
            } else {
                Object obj = tagComboViewer.getElementAt(0);
                if (obj != null) {
                    tagComboViewer.setSelection(new StructuredSelection(obj));
                    ConfigData cd = (ConfigData) tagComboViewer.getElementAt(0);
                    if (cd.getValue().startsWith("aodl:")) //$NON-NLS-1$
                    {
                        c.setCrit1(cd.getValue().substring(5));
                    } else {
                        c.setCrit1(cd.getValue());
                    }
                }
            }
            final Combo typeCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            typeCombo.setLayoutData(new GridData());
            typeCombo.setLayoutData(new GridData());
            ((GridData) typeCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) typeCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) typeCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer typeComboViewer = new ComboViewer(typeCombo);
            typeComboViewer.setContentProvider(new MarkupContentProvider());
            typeComboViewer.setLabelProvider(new MarkupLabelProvider());
            typeComboViewer.setComparator(new ConfigDataComparator());

            tagComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    String selection;
                    if (cd.getValue().startsWith("aodl:")) {
                        selection = cd.getValue().substring(5); //$NON-NLS-1$
                    } else {
                        selection = cd.getValue();
                    }
                    c.setCrit1(selection);
                    setComboViewerInput(typeComboViewer, "tagging_values", c.getCrit1(), null, null); //$NON-NLS-1$
                }
            });

            if (c.getCrit2() != null) {
                setComboViewerByString(typeComboViewer, c.getCrit2());
            }

            final Combo subtypeCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            final ComboViewer subtypeComboViewer = new ComboViewer(subtypeCombo);
            subtypeComboViewer.setContentProvider(new MarkupContentProvider());
            subtypeComboViewer.setLabelProvider(new MarkupLabelProvider());
            subtypeComboViewer.setComparator(new ConfigDataComparator());

            typeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    subtypeComboViewer.setInput(null);
                    if (cd != null) {
                        c.setCrit2(cd.getValue());
                    }
                    setComboViewerInput(subtypeComboViewer, "tagging_values", c.getCrit1(), c.getCrit2(), null); //$NON-NLS-1$
                }
            });

            subtypeCombo.setLayoutData(new GridData());
            subtypeCombo.setLayoutData(new GridData());
            ((GridData) subtypeCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) subtypeCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) subtypeCombo.getLayoutData()).horizontalSpan = 2;
            if (c.getCrit3() != null) {
                setComboViewerByString(subtypeComboViewer, c.getCrit3());
            }

            final Combo roleCombo = new Combo(_searchPTagComp, SWT.READ_ONLY);
            final ComboViewer roleComboViewer = new ComboViewer(roleCombo);
            roleComboViewer.setContentProvider(new MarkupContentProvider());
            roleComboViewer.setLabelProvider(new MarkupLabelProvider());
            roleComboViewer.setComparator(new ConfigDataComparator());

            subtypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    if (cd != null) {
                        c.setCrit3(cd.getValue());
                    }
                    setComboViewerInput(roleComboViewer, "tagging_values", c.getCrit1(), c.getCrit2(), //$NON-NLS-1$
                            c.getCrit3());
                }
            });

            roleCombo.setLayoutData(new GridData());
            roleCombo.setLayoutData(new GridData());
            ((GridData) roleCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) roleCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) roleCombo.getLayoutData()).horizontalSpan = 2;
            if (c.getCrit4() != null) {
                setComboViewerByString(roleComboViewer, c.getCrit4());
            }
            roleComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    if (cd != null) {
                        c.setCrit4(cd.getValue());
                    }
                }
            });

            final Text keyText = new Text(_searchPTagComp, SWT.BORDER);
            keyText.setLayoutData(new GridData());
            keyText.setLayoutData(new GridData());
            ((GridData) keyText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) keyText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) keyText.getLayoutData()).horizontalSpan = 2;
            if (c.getCrit5() != null) {
                keyText.setText(c.getCrit5());
            }
            keyText.setEnabled(false);

            final Button keySet = new Button(_searchPTagComp, SWT.PUSH);
            keySet.setEnabled(false);
            keySet.setText(NLMessages.getString("Dialog_set_key")); //$NON-NLS-1$
            keySet.setFont(JFaceResources.getDialogFont());
            keySet.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                }
            });

            final Text searchText = new Text(_searchPTagComp, SWT.BORDER);
            searchText.setLayoutData(new GridData());
            searchText.setLayoutData(new GridData());
            ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) searchText.getLayoutData()).horizontalSpan = 3;
            if (c.getSearchText() != null) {
                searchText.setText(c.getSearchText());
            }
            searchText.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(final FocusEvent e) {
                    c.setSearchText(searchText.getText());
                }
            });

            final Button fuzzyB = new Button(_searchPTagComp, SWT.CHECK);
            fuzzyB.setLayoutData(new GridData());
            fuzzyB.setSelection(c.isFuzzy());
            fuzzyB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setFuzzy(!c.isFuzzy());
                }
            });

            final Button includeB = new Button(_searchPTagComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

            final Button delTagCriteria = new Button(_searchPTagComp, SWT.PUSH);
            delTagCriteria.setLayoutData(new GridData());
            delTagCriteria.setText("-"); //$NON-NLS-1$
            delTagCriteria.setData("tag", i); //$NON-NLS-1$

            delTagCriteria.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    buildPersonSearch(2, ((Integer) delTagCriteria.getData("tag"))); //$NON-NLS-1$
                }
            });

        } // if tagging

        if (c.getType().equals("relation")) //$NON-NLS-1$
        {
            if (rel1) {
                rel1 = false;
                _searchPRelComp = new Composite(contentCompSearch, SWT.NONE);
                _searchPRelComp.setLayout(new GridLayout());
                ((GridLayout) _searchPRelComp.getLayout()).makeColumnsEqualWidth = true;
                ((GridLayout) _searchPRelComp.getLayout()).numColumns = 15;
                _searchPRelComp.setLayoutData(new GridData());
                ((GridData) _searchPRelComp.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) _searchPRelComp.getLayoutData()).grabExcessHorizontalSpace = true;
                // ((GridData) searchPRelComp.getLayoutData()).heightHint =
                // 200;
                ((GridData) _searchPRelComp.getLayoutData()).grabExcessVerticalSpace = false;
                ((GridData) _searchPRelComp.getLayoutData()).horizontalSpan = 1;

                Label l = new Label(_searchPRelComp, SWT.NONE);
                l.setText(NLMessages.getString("Dialog_relation")); //$NON-NLS-1$
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 2;

                Label context = new Label(_searchPRelComp, SWT.NONE);
                context.setText(NLMessages.getString("Dialog_context")); //$NON-NLS-1$
                context.setLayoutData(new GridData());
                ((GridData) context.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) context.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) context.getLayoutData()).horizontalSpan = 2;

                Label classL = new Label(_searchPRelComp, SWT.NONE);
                classL.setText(NLMessages.getString("Dialog_class")); //$NON-NLS-1$
                classL.setLayoutData(new GridData());
                ((GridData) classL.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) classL.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) classL.getLayoutData()).horizontalSpan = 2;

                Label relObj = new Label(_searchPRelComp, SWT.NONE);
                relObj.setText(NLMessages.getString("Dialog_relObject")); //$NON-NLS-1$
                relObj.setLayoutData(new GridData());
                ((GridData) relObj.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) relObj.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) relObj.getLayoutData()).horizontalSpan = 4;

                Label searchTextLabel = new Label(_searchPRelComp, SWT.NONE);
                searchTextLabel.setText(NLMessages.getString("Dialog_searchText")); //$NON-NLS-1$
                searchTextLabel.setLayoutData(new GridData());
                ((GridData) searchTextLabel.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) searchTextLabel.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) searchTextLabel.getLayoutData()).horizontalSpan = 3;

                Label fuzzy = new Label(_searchPRelComp, SWT.NONE);
                fuzzy.setText(""); //$NON-NLS-1$
                fuzzy.setLayoutData(new GridData());
                ((GridData) fuzzy.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) fuzzy.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) fuzzy.getLayoutData()).horizontalSpan = 1;

                Label include = new Label(_searchPRelComp, SWT.NONE);
                include.setText(""); //$NON-NLS-1$
                include.setToolTipText(NLMessages.getString("Dialog_includeConcurrences")); //$NON-NLS-1$
                include.setLayoutData(new GridData());
                ((GridData) include.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) include.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) include.getLayoutData()).horizontalSpan = 1;

            }

            if (i == 0) {
                Label l = new Label(_searchPRelComp, SWT.NONE);
                l.setLayoutData(new GridData());
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 2;
            } else {
                final Combo opCombo = new Combo(_searchPRelComp, SWT.READ_ONLY);
                opCombo.setLayoutData(new GridData());
                opCombo.add(Operator.AND.toString());
                opCombo.add(Operator.OR.toString());
                opCombo.add(Operator.NOT.toString());
                opCombo.setLayoutData(new GridData());
                ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) opCombo.getLayoutData()).horizontalSpan = 2;
                if (c.getOperator() != null) {
                    opCombo.setText(c.getOperator());
                } else {
                    opCombo.select(0);
                    c.setOperator(opCombo.getItem(0));

                }
                opCombo.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent se) {
                        c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                    }
                });
            }
            // final Combo contextCombo = new Combo(searchPRelComp,
            // SWT.READ_ONLY);
            // contextCombo.setLayoutData(new GridData());
            // contextCombo.setLayoutData(new GridData());
            // ((GridData) contextCombo.getLayoutData()).horizontalAlignment
            // = SWT.FILL;
            // ((GridData)
            // contextCombo.getLayoutData()).grabExcessHorizontalSpace =
            // true ;
            // ((GridData) contextCombo.getLayoutData()).horizontalSpan = 2;
            //
            //
            // final Combo classCombo = new Combo(searchPRelComp,
            // SWT.READ_ONLY);
            // classCombo.setLayoutData(new GridData());
            // classCombo.setLayoutData(new GridData());
            // ((GridData) classCombo.getLayoutData()).horizontalAlignment =
            // SWT.FILL;
            // ((GridData)
            // classCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            // ((GridData) classCombo.getLayoutData()).horizontalSpan = 2;
            //
            //
            // if (c.getRelationContext() != null)
            // {
            // contextCombo.select(contextCombo.indexOf(c.getRelationContext()));
            // }
            // else
            // {
            // try {
            //                  contextCombo.setItems(mainSearcher.getFacets("relation", null, null, null, null)); //$NON-NLS-1$ //$NON-NLS-2$
            // } catch (XQException e1) {
            // e1.printStackTrace();
            // }
            //               contextCombo.add("ALL", 0); //$NON-NLS-1$
            // contextCombo.select(0);
            // c.setRelationContext(contextCombo.getItem(0));
            //
            // }
            // contextCombo.addSelectionListener(new SelectionAdapter(){
            // public void widgetSelected(SelectionEvent se){
            // String selection =
            // contextCombo.getItem(contextCombo.getSelectionIndex());
            // c.setRelationContext(selection);
            // try {
            // classCombo.setItems(mainSearcher
            //            .getFacets("relation", null, selection, null, null)); //$NON-NLS-1$ //$NON-NLS-2$
            // } catch (XQException e1) {
            // e1.printStackTrace();
            // }
            //                  classCombo.add("ALL", 0); //$NON-NLS-1$
            // classCombo.select(0);
            // c.setRelationContext(classCombo.getItem(0));
            //
            // }
            // });
            //
            // if (c.getRelationClass() != null)
            // {
            // classCombo.setText(c.getRelationClass());
            // }
            // else
            // {
            //
            //               classCombo.add("ALL", 0); //$NON-NLS-1$
            // classCombo.select(0);
            // c.setRelationClass(classCombo.getItem(0));
            // }
            //
            //
            // classCombo.addSelectionListener(new SelectionAdapter(){
            // public void widgetSelected(SelectionEvent se){
            // String selection =
            // classCombo.getItem(classCombo.getSelectionIndex());
            // c.setRelationContext(selection);
            //
            // }
            // });
            //
            final Combo contextCombo = new Combo(_searchPRelComp, SWT.READ_ONLY);
            contextCombo.setLayoutData(new GridData());
            contextCombo.setLayoutData(new GridData());
            ((GridData) contextCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) contextCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) contextCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer contextComboViewer = new ComboViewer(contextCombo);
            contextComboViewer.setContentProvider(new MarkupContentProvider());
            contextComboViewer.setLabelProvider(new MarkupLabelProvider());
            contextComboViewer.setComparator(new ConfigDataComparator());

            final Combo classCombo = new Combo(_searchPRelComp, SWT.READ_ONLY);
            classCombo.setLayoutData(new GridData());
            classCombo.setLayoutData(new GridData());
            ((GridData) classCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) classCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) classCombo.getLayoutData()).horizontalSpan = 2;
            final ComboViewer classComboViewer = new ComboViewer(classCombo);
            classComboViewer.setContentProvider(new MarkupContentProvider());
            classComboViewer.setLabelProvider(new MarkupLabelProvider());
            classComboViewer.setComparator(new ConfigDataComparator());
            setComboViewerInput(contextComboViewer, "relation", null, null, null); //$NON-NLS-1$
            if (c.getRelationContext() != null) {
                setComboViewerByString(contextComboViewer, c.getRelationContext());
                setComboViewerInput(classComboViewer, "relation", c.getRelationContext(), null, null); //$NON-NLS-1$

            } else {
                contextComboViewer.setSelection(new StructuredSelection(contextComboViewer.getElementAt(0)));
                ConfigData cd = (ConfigData) contextComboViewer.getElementAt(0);
                c.setRelationContext(cd.getValue());

            }
            contextComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    c.setRelationContext(cd.getValue());
                    setComboViewerInput(classComboViewer, "relation", c.getRelationContext(), null, null); //$NON-NLS-1$
                }
            });

            if (c.getRelationClass() != null) {
                setComboViewerByString(classComboViewer, c.getRelationClass());
            }

            classComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {
                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection iSelection = event.getSelection();
                    Object obj = ((IStructuredSelection) iSelection).getFirstElement();
                    ConfigData cd = (ConfigData) obj;
                    c.setRelationClass(cd.getValue());
                }
            });

            final Text relObjText = new Text(_searchPRelComp, SWT.BORDER);
            relObjText.setLayoutData(new GridData());
            relObjText.setLayoutData(new GridData());
            ((GridData) relObjText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) relObjText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) relObjText.getLayoutData()).horizontalSpan = 3;
            if (c.getRelatedId() != null) {
                relObjText.setText(c.getRelatedId().toString());
            }
            relObjText.setEnabled(false);

            final Button setObj = new Button(_searchPRelComp, SWT.PUSH);
            setObj.setEnabled(false);
            setObj.setText(NLMessages.getString("Dialog_set_key")); //$NON-NLS-1$
            setObj.setFont(JFaceResources.getDialogFont());
            setObj.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                }
            });

            final Text searchText = new Text(_searchPRelComp, SWT.BORDER);
            searchText.setLayoutData(new GridData());
            searchText.setLayoutData(new GridData());
            ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) searchText.getLayoutData()).horizontalSpan = 3;
            if (c.getSearchText() != null) {
                searchText.setText(c.getSearchText());
            }
            searchText.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(final FocusEvent e) {
                    c.setSearchText(searchText.getText());
                }
            });

            final Button fuzzyB = new Button(_searchPRelComp, SWT.CHECK);
            fuzzyB.setLayoutData(new GridData());
            fuzzyB.setSelection(c.isFuzzy());
            fuzzyB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setFuzzy(!c.isFuzzy());
                }
            });

            final Button includeB = new Button(_searchPRelComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

        } // if relation
        if (c.getType().equals("date")) //$NON-NLS-1$
        {
            if (date1) {
                date1 = false;
                _searchPDateComp = new Composite(contentCompSearch, SWT.NONE);
                _searchPDateComp.setLayout(new GridLayout());
                ((GridLayout) _searchPDateComp.getLayout()).makeColumnsEqualWidth = true;
                ((GridLayout) _searchPDateComp.getLayout()).numColumns = 21;
                _searchPDateComp.setLayoutData(new GridData());
                ((GridData) _searchPDateComp.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) _searchPDateComp.getLayoutData()).grabExcessHorizontalSpace = true;
                // ((GridData) searchPDateComp.getLayoutData()).heightHint =
                // 200;
                ((GridData) _searchPDateComp.getLayoutData()).grabExcessVerticalSpace = false;
                ((GridData) _searchPDateComp.getLayoutData()).horizontalSpan = 1;

                if (i != 0) {
                    Label l2 = new Label(_searchPDateComp, SWT.NONE);
                    l2.setLayoutData(new GridData());
                    l2.setLayoutData(new GridData());
                    ((GridData) l2.getLayoutData()).horizontalAlignment = SWT.FILL;
                    ((GridData) l2.getLayoutData()).grabExcessHorizontalSpace = true;
                    ((GridData) l2.getLayoutData()).horizontalSpan = 2;
                } else {
                    Label op = new Label(_searchPDateComp, SWT.NONE);
                    op.setText(NLMessages.getString("Dialog_operand")); //$NON-NLS-1$
                    op.setLayoutData(new GridData());
                    ((GridData) op.getLayoutData()).horizontalAlignment = SWT.FILL;
                    ((GridData) op.getLayoutData()).grabExcessHorizontalSpace = true;
                    ((GridData) op.getLayoutData()).horizontalSpan = 2;
                }

                Label typeDate = new Label(_searchPDateComp, SWT.NONE);
                typeDate.setText(NLMessages.getString("Dialog_type")); //$NON-NLS-1$
                typeDate.setLayoutData(new GridData());
                ((GridData) typeDate.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) typeDate.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) typeDate.getLayoutData()).horizontalSpan = 3;

                Label bl = new Label(_searchPDateComp, SWT.NONE);
                bl.setText(""); //$NON-NLS-1$
                bl.setLayoutData(new GridData());
                ((GridData) bl.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) bl.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) bl.getLayoutData()).horizontalSpan = 2;

                Label notBefore = new Label(_searchPDateComp, SWT.NONE);
                notBefore.setText(NLMessages.getString("Dialog_day")); //$NON-NLS-1$
                notBefore.setLayoutData(new GridData());
                ((GridData) notBefore.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) notBefore.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) notBefore.getLayoutData()).horizontalSpan = 1;

                Label month = new Label(_searchPDateComp, SWT.NONE);
                month.setText(NLMessages.getString("Dialog_month")); //$NON-NLS-1$
                month.setLayoutData(new GridData());
                ((GridData) month.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) month.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) month.getLayoutData()).horizontalSpan = 1;

                Label year = new Label(_searchPDateComp, SWT.NONE);
                year.setText(NLMessages.getString("Dialog_year")); //$NON-NLS-1$
                year.setLayoutData(new GridData());
                ((GridData) year.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) year.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) year.getLayoutData()).horizontalSpan = 3;

                Label bl2 = new Label(_searchPDateComp, SWT.NONE);
                bl2.setText(""); //$NON-NLS-1$
                bl2.setLayoutData(new GridData());

                ((GridData) bl2.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) bl2.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) bl2.getLayoutData()).horizontalSpan = 2;

                Label notAfter = new Label(_searchPDateComp, SWT.NONE);
                notAfter.setText(NLMessages.getString("Dialog_day")); //$NON-NLS-1$
                notAfter.setLayoutData(new GridData());
                ((GridData) notAfter.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) notAfter.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) notAfter.getLayoutData()).horizontalSpan = 1;

                Label month2 = new Label(_searchPDateComp, SWT.NONE);
                month2.setText(NLMessages.getString("Dialog_month")); //$NON-NLS-1$
                month2.setLayoutData(new GridData());
                ((GridData) month2.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) month2.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) month2.getLayoutData()).horizontalSpan = 1;

                Label year2 = new Label(_searchPDateComp, SWT.NONE);
                year2.setText(NLMessages.getString("Dialog_year")); //$NON-NLS-1$
                year2.setLayoutData(new GridData());
                ((GridData) year2.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) year2.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) year2.getLayoutData()).horizontalSpan = 3;

                if (i != 0) {
                    Label l2 = new Label(_searchPDateComp, SWT.NONE);
                    l2.setLayoutData(new GridData());
                    l2.setLayoutData(new GridData());
                    ((GridData) l2.getLayoutData()).horizontalAlignment = SWT.FILL;
                    ((GridData) l2.getLayoutData()).grabExcessHorizontalSpace = true;
                    ((GridData) l2.getLayoutData()).horizontalSpan = 2;
                } else {
                    Label include = new Label(_searchPDateComp, SWT.NONE);
                    include.setText(NLMessages.getString("Dialog_include")); //$NON-NLS-1$
                    include.setToolTipText(NLMessages.getString("Dialog_includeConcurrences")); //$NON-NLS-1$
                    include.setLayoutData(new GridData());
                    ((GridData) include.getLayoutData()).horizontalAlignment = SWT.FILL;
                    ((GridData) include.getLayoutData()).grabExcessHorizontalSpace = true;
                    ((GridData) include.getLayoutData()).horizontalSpan = 1;

                    Label del = new Label(_searchPDateComp, SWT.NONE);
                    del.setText(NLMessages.getString("Dialog_del")); //$NON-NLS-1$
                    del.setLayoutData(new GridData());
                    ((GridData) del.getLayoutData()).horizontalAlignment = SWT.FILL;
                    ((GridData) del.getLayoutData()).grabExcessHorizontalSpace = true;
                    ((GridData) del.getLayoutData()).horizontalSpan = 1;
                }

            }

            if (i == 0) {
                Label l = new Label(_searchPDateComp, SWT.NONE);
                l.setLayoutData(new GridData());
                ((GridData) l.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) l.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) l.getLayoutData()).horizontalSpan = 2;
            } else {
                final Combo opCombo = new Combo(_searchPDateComp, SWT.READ_ONLY);
                opCombo.setLayoutData(new GridData());
                opCombo.add(Operator.AND.toString());
                opCombo.add(Operator.OR.toString());
                opCombo.add(Operator.NOT.toString());
                opCombo.setLayoutData(new GridData());
                ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
                ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
                ((GridData) opCombo.getLayoutData()).horizontalSpan = 2;
                if (c.getOperator() != null) {
                    opCombo.setText(c.getOperator());
                } else {
                    opCombo.select(0);
                    c.setOperator(opCombo.getItem(0));

                }
                opCombo.addSelectionListener(new SelectionAdapter() {
                    @Override
                    public void widgetSelected(final SelectionEvent se) {
                        c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                    }
                });
            }

            final Combo typeDCombo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            typeDCombo.setLayoutData(new GridData());
            ComboViewer timeTypeComboViewer = new ComboViewer(typeDCombo);
            timeTypeComboViewer.setContentProvider(ArrayContentProvider.getInstance());
            timeTypeComboViewer.setLabelProvider(new LabelProvider() {

                @Override
                public String getText(final Object element) {
                    String str = (String) element;
                    if (NLMessages.getString("Editor_time_" + str) != null) //$NON-NLS-1$
                    {
                        return NLMessages.getString("Editor_time_" + str); //$NON-NLS-1$
                    }
                    return str;
                }

            });
            timeTypeComboViewer.setInput(AEConstants.TIME_TYPES);
            timeTypeComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection selection = event.getSelection();
                    Object obj = ((IStructuredSelection) selection).getFirstElement();
                    String s = (String) obj;
                    c.setDateType(s);
                }

            });
            if (c.getDateType() != null) {
                StructuredSelection selection = new StructuredSelection(c.getDateType());
                timeTypeComboViewer.setSelection(selection);
            } else {
                StructuredSelection selection = new StructuredSelection(AEConstants.TIME_TYPES[0]);
                timeTypeComboViewer.setSelection(selection);
                c.setDateType(AEConstants.TIME_TYPES[0]);
            }
            typeDCombo.pack();
            typeDCombo.setLayoutData(new GridData());
            ((GridData) typeDCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) typeDCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) typeDCombo.getLayoutData()).horizontalSpan = 2;

            Label from = new Label(_searchPDateComp, SWT.NONE);
            from.setText(NLMessages.getString("Dialog_from")); //$NON-NLS-1$
            from.setLayoutData(new GridData());
            ((GridData) from.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) from.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) from.getLayoutData()).horizontalSpan = 2;

            final Combo day1Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            day1Combo.setLayoutData(new GridData());
            day1Combo.setItems(AEConstants.DAYS);
            day1Combo.setLayoutData(new GridData());
            ((GridData) day1Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) day1Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) day1Combo.getLayoutData()).horizontalSpan = 1;

            if (c.getDateFrom() == null) {
                PdrDate dateFrom = new PdrDate("0000-00-00"); //$NON-NLS-1$
                // dateFrom.setDay(0);
                // dateFrom.setMonth(0);
                // dateFrom.setYear(0);
                c.setDateFrom(dateFrom);
                day1Combo.select(c.getDateFrom().getDay());
            }
            //            System.out.println("test: dateFrom " + c.getDateFrom().toString()); //$NON-NLS-1$
            // else
            // {
            //
            // day1Combo.select(0);
            // c.getDateFrom().setDay(0);
            //
            // }

            day1Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateFrom().setDay(day1Combo.getSelectionIndex());
                }
            });

            final Combo month1Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            month1Combo.setLayoutData(new GridData());
            month1Combo.setItems(AEConstants.MONTHS);
            month1Combo.setLayoutData(new GridData());
            ((GridData) month1Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) month1Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) month1Combo.getLayoutData()).horizontalSpan = 1;
            if (c.getDateFrom() != null) {
                month1Combo.select(c.getDateFrom().getMonth());
            } else {

                month1Combo.select(0);
                c.getDateFrom().setMonth(0);

            }

            month1Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateFrom().setMonth(month1Combo.getSelectionIndex());
                }
            });

            final YearSpinner year1Spinner = new YearSpinner(_searchPDateComp, SWT.NULL);
            if (c.getDateFrom() != null) {
                year1Spinner.setSelection(c.getDateFrom().getYear());
            } else {

                year1Spinner.setSelection(_preselection);
                c.getDateFrom().setYear(_preselection);

            }

            year1Spinner.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetDefaultSelected(final SelectionEvent e) {
                    c.getDateFrom().setYear(year1Spinner.getSelection());

                }

                @Override
                public void widgetSelected(final SelectionEvent e) {
                    c.getDateFrom().setYear(year1Spinner.getSelection());
                }

            });

            Label to = new Label(_searchPDateComp, SWT.NONE);
            to.setText(NLMessages.getString("Dialog_to")); //$NON-NLS-1$
            to.setLayoutData(new GridData());
            ((GridData) to.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) to.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) to.getLayoutData()).horizontalSpan = 2;

            final Combo day2Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            day2Combo.setLayoutData(new GridData());
            day2Combo.setItems(AEConstants.DAYS);
            day2Combo.setLayoutData(new GridData());
            ((GridData) day2Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) day2Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) day2Combo.getLayoutData()).horizontalSpan = 1;
            if (c.getDateTo() == null) {
                PdrDate dateTo = new PdrDate("0000-00-00"); //$NON-NLS-1$
                c.setDateTo(dateTo);
                day2Combo.select(c.getDateTo().getDay());
            }

            day2Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateTo().setDay(day2Combo.getSelectionIndex());
                }
            });

            final Combo month2Combo = new Combo(_searchPDateComp, SWT.READ_ONLY);
            month2Combo.setLayoutData(new GridData());
            month2Combo.setItems(AEConstants.MONTHS);
            month2Combo.setLayoutData(new GridData());
            ((GridData) month2Combo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) month2Combo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) month2Combo.getLayoutData()).horizontalSpan = 1;
            if (c.getDateTo() != null) {
                month2Combo.select(c.getDateTo().getMonth());
            } else {

                month2Combo.select(0);
                c.getDateTo().setMonth(0);

            }

            month2Combo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.getDateTo().setMonth(month2Combo.getSelectionIndex());
                }
            });

            final YearSpinner year2Spinner = new YearSpinner(_searchPDateComp, SWT.NULL);
            if (c.getDateTo() != null) {
                year2Spinner.setSelection(c.getDateTo().getYear());
            } else {
                year2Spinner.setSelection(_preselection);
                c.getDateTo().setYear(_preselection);
            }

            year2Spinner.addSelectionListener(new SelectionListener() {

                @Override
                public void widgetDefaultSelected(final SelectionEvent e) {
                    c.getDateTo().setYear(year2Spinner.getSelection());

                }

                @Override
                public void widgetSelected(final SelectionEvent e) {
                    c.getDateTo().setYear(year2Spinner.getSelection());
                }

            });

            final Button includeB = new Button(_searchPDateComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

            final Button delTagCriteria = new Button(_searchPDateComp, SWT.PUSH);
            delTagCriteria.setLayoutData(new GridData());
            delTagCriteria.setText("-"); //$NON-NLS-1$
            delTagCriteria.setData("tag", i); //$NON-NLS-1$

            delTagCriteria.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    buildPersonSearch(2, ((Integer) delTagCriteria.getData("tag"))); //$NON-NLS-1$
                }
            });
        } // if date
        if (c.getType().equals("reference")) //$NON-NLS-1$
        {
            _searchPRefComp = new Composite(contentCompSearch, SWT.NONE);
            _searchPRefComp.setLayout(new GridLayout());
            ((GridLayout) _searchPRefComp.getLayout()).makeColumnsEqualWidth = true;
            ((GridLayout) _searchPRefComp.getLayout()).numColumns = 15;
            _searchPRefComp.setLayoutData(new GridData());
            ((GridData) _searchPRefComp.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) _searchPRefComp.getLayoutData()).grabExcessHorizontalSpace = true;
            // ((GridData) searchPTagComp.getLayoutData()).heightHint = 200;
            ((GridData) _searchPRefComp.getLayoutData()).grabExcessVerticalSpace = false;
            ((GridData) _searchPRefComp.getLayoutData()).horizontalSpan = 1;

            final Combo opCombo = new Combo(_searchPRefComp, SWT.READ_ONLY);
            opCombo.setLayoutData(new GridData());
            opCombo.add(Operator.AND.toString());
            opCombo.add(Operator.OR.toString());
            opCombo.add(Operator.NOT.toString());
            opCombo.setLayoutData(new GridData());
            ((GridData) opCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) opCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) opCombo.getLayoutData()).horizontalSpan = 2;
            if (c.getOperator() != null) {
                opCombo.setText(c.getOperator());
            } else {
                opCombo.select(0);
                c.setOperator(opCombo.getItem(0));

            }
            opCombo.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent se) {
                    c.setOperator(opCombo.getItem(opCombo.getSelectionIndex()));
                }
            });

            Label sem = new Label(_searchPRefComp, SWT.NONE);
            sem.setText(NLMessages.getString("Dialog_reference")); //$NON-NLS-1$
            sem.setLayoutData(new GridData());
            ((GridData) sem.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) sem.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) sem.getLayoutData()).horizontalSpan = 2;

            Label tagName = new Label(_searchPRefComp, SWT.NONE);
            tagName.setText(NLMessages.getString("Dialog_genre")); //$NON-NLS-1$
            tagName.setLayoutData(new GridData());
            ((GridData) tagName.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) tagName.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) tagName.getLayoutData()).horizontalSpan = 2;

            final Combo genreCombo = new Combo(_searchPRefComp, SWT.READ_ONLY);
            genreCombo.setLayoutData(new GridData());
            ComboViewer genreComboViewer = new ComboViewer(genreCombo);
            genreComboViewer.setContentProvider(new RefTemplateContentProvider(false));
            genreComboViewer.setLabelProvider(new LabelProvider() {

                @Override
                public String getText(final Object element) {
                    ReferenceModsTemplate template = (ReferenceModsTemplate) element;
                    return template.getLabel();
                }

            });

            genreComboViewer.setInput(_facade.getAllGenres());
            genreComboViewer.addSelectionChangedListener(new ISelectionChangedListener() {

                @Override
                public void selectionChanged(final SelectionChangedEvent event) {
                    ISelection selection = event.getSelection();
                    Object obj = ((IStructuredSelection) selection).getFirstElement();
                    ReferenceModsTemplate template = (ReferenceModsTemplate) obj;
                    if (template != null) {
                        c.setCrit0(template.getValue());
                    }
                }

            });
            genreCombo.add("ALL", 0); //$NON-NLS-1$

            genreCombo.setLayoutData(new GridData());
            ((GridData) genreCombo.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) genreCombo.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) genreCombo.getLayoutData()).horizontalSpan = 2;
            if (c.getCrit0() != null) {
                StructuredSelection selection = new StructuredSelection(c.getCrit0());
                genreComboViewer.setSelection(selection);
            } else {
                genreCombo.select(0);
                c.setCrit0(genreCombo.getItem(0));

            }

            Label tagType = new Label(_searchPRefComp, SWT.NONE);
            tagType.setText(NLMessages.getString("Dialog_searchText")); //$NON-NLS-1$
            tagType.setLayoutData(new GridData());
            ((GridData) tagType.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) tagType.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) tagType.getLayoutData()).horizontalSpan = 2;

            final Text searchText = new Text(_searchPRefComp, SWT.BORDER);
            searchText.setLayoutData(new GridData());
            searchText.setLayoutData(new GridData());
            ((GridData) searchText.getLayoutData()).horizontalAlignment = SWT.FILL;
            ((GridData) searchText.getLayoutData()).grabExcessHorizontalSpace = true;
            ((GridData) searchText.getLayoutData()).horizontalSpan = 3;
            if (c.getSearchText() != null) {
                searchText.setText(c.getSearchText());
            }
            searchText.addFocusListener(new FocusAdapter() {
                @Override
                public void focusLost(final FocusEvent e) {
                    c.setSearchText(searchText.getText());
                }
            });

            final Button fuzzyB = new Button(_searchPRefComp, SWT.CHECK);
            fuzzyB.setLayoutData(new GridData());
            fuzzyB.setSelection(c.isFuzzy());
            fuzzyB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setFuzzy(!c.isFuzzy());
                }
            });

            final Button includeB = new Button(_searchPRefComp, SWT.CHECK);
            includeB.setLayoutData(new GridData());
            includeB.setSelection(c.isIncludeConcurrences());
            includeB.addSelectionListener(new SelectionAdapter() {
                @Override
                public void widgetSelected(final SelectionEvent event) {
                    c.setIncludeConcurrences(!c.isIncludeConcurrences());
                }
            });

        } // if reference
    }
    contentCompSearch.layout();
    _scrollCompSearch.setContent(contentCompSearch);
    _scrollCompSearch.setMinSize(contentCompSearch.computeSize(SWT.DEFAULT, SWT.DEFAULT, true));
    _scrollCompSearch.layout();
    _personSearchGroup.redraw();
    _personSearchGroup.layout();
    _personSearchGroup.pack();
    _personSearchGroup.layout();
    // personSearchGroup.pack();

}

From source file:org.bbaw.pdr.ae.view.main.dialogs.ExpertSearchDialog.java

License:Open Source License

/**
 * meth creates the TabItem for selecting a person.
 * @param mainTabFolder main tabFolder//from  w  w w.  j a va2  s  . c  o  m
 */
private void createPersonTabItem(final TabFolder mainTabFolder) {
    _markupProvider = Platform.getPreferencesService().getString(CommonActivator.PLUGIN_ID,
            "PRIMARY_TAGGING_PROVIDER", AEConstants.CLASSIFICATION_AUTHORITY, null).toUpperCase(); //$NON-NLS-1$
    _relationProvider = Platform.getPreferencesService().getString(CommonActivator.PLUGIN_ID,
            "PRIMARY_RELATION_PROVIDER", AEConstants.RELATION_CLASSIFICATION_PROVIDER, null).toUpperCase();

    _personTabItem = new TabItem(mainTabFolder, SWT.NONE);
    _personTabItem.setText(NLMessages.getString("Dialog_persons_search")); //$NON-NLS-1$
    _personTabItem.setImage(_imageReg.get(IconsInternal.PERSONS));
    _personComposite = new Composite(mainTabFolder, SWT.NONE);
    _personComposite.setLayout(new GridLayout());
    _personComposite.setLayoutData(new GridData());
    ((GridData) _personComposite.getLayoutData()).verticalAlignment = SWT.FILL;

    _personTabItem.setControl(_personComposite);

    _personSearchGroup = new Group(_personComposite, SWT.SHADOW_IN);
    _personSearchGroup.setText(""); //$NON-NLS-1$

    _personSearchGroup.setLayoutData(new GridData());
    ((GridData) _personSearchGroup.getLayoutData()).horizontalAlignment = SWT.FILL;
    ((GridData) _personSearchGroup.getLayoutData()).verticalAlignment = SWT.FILL;
    ((GridData) _personSearchGroup.getLayoutData()).minimumHeight = 90;
    ((GridData) _personSearchGroup.getLayoutData()).grabExcessHorizontalSpace = true;
    _personSearchGroup.setLayout(new GridLayout());
    ((GridLayout) _personSearchGroup.getLayout()).makeColumnsEqualWidth = true;
    ((GridLayout) _personSearchGroup.getLayout()).numColumns = 4;

    Button addMarkupC = new Button(_personSearchGroup, SWT.PUSH);
    addMarkupC.setText(NLMessages.getString("Dialog_add_markup_crit")); //$NON-NLS-1$
    addMarkupC.setImage(_imageReg.get(IconsInternal.MARKUP));
    addMarkupC.setFont(JFaceResources.getDialogFont());
    addMarkupC.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            buildPersonSearch(1, null);
        }
    });

    Button addRelC = new Button(_personSearchGroup, SWT.PUSH);
    addRelC.setText(NLMessages.getString("Dialog_add_rel_crit")); //$NON-NLS-1$
    addRelC.setImage(_imageReg.get(IconsInternal.RELATION));
    addRelC.setFont(JFaceResources.getDialogFont());
    addRelC.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            buildPersonSearch(3, null);
        }
    });

    Button addDateC = new Button(_personSearchGroup, SWT.PUSH);
    addDateC.setText(NLMessages.getString("Dialog_add_date_crit")); //$NON-NLS-1$
    addDateC.setImage(_imageReg.get(IconsInternal.TIME));
    addDateC.setFont(JFaceResources.getDialogFont());
    addDateC.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            buildPersonSearch(5, null);
        }
    });

    Button addRefC = new Button(_personSearchGroup, SWT.PUSH);
    addRefC.setText(NLMessages.getString("Dialog_add_ref_crit")); //$NON-NLS-1$
    addRefC.setImage(_imageReg.get(IconsInternal.REFERENCE));
    addRefC.setFont(JFaceResources.getDialogFont());
    addRefC.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            buildPersonSearch(7, null);
        }
    });

    buildPersonSearch(0, null);

    // _searchPTagComp
    // personSearchGroup
    _personSearchGroup.layout();

}

From source file:org.bbaw.pdr.ae.view.main.dialogs.LoginDialog.java

License:Open Source License

/**
 * creates OKButton.//from w  w  w  .  j  a  v  a 2  s  . c  o m
 * @param parent parent composite
 * @param id id
 * @param label label of button
 * @param defaultButton is default
 * @return okButton
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    _OKButton = new Button(parent, SWT.PUSH);
    _OKButton.setText(label);
    _OKButton.setFont(JFaceResources.getDialogFont());
    _OKButton.setData(new Integer(id));
    _OKButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {
            if (isValidInput()) {
                okPressed();
                close();

            }
        }
    });
    if (defaultButton) {
        Shell shell = parent.getShell();
        if (shell != null) {
            shell.setDefaultButton(_OKButton);
        }
    }
    setButtonLayoutData(_OKButton);
    return _OKButton;
}

From source file:org.bbaw.pdr.ae.view.main.editors.AspectEditorDialog.java

License:Open Source License

/**
 * Creates the ok button./*from  ww  w. j  a v  a 2s .c  om*/
 * @param parent the parent
 * @param id the id
 * @param label the label
 * @param defaultButton the default button
 * @return the button
 */
protected final Button createOkButton(final Composite parent, final int id, final String label,
        final boolean defaultButton) {
    // increment the number of columns in the button bar
    ((GridLayout) parent.getLayout()).numColumns++;
    _saveButton = new Button(parent, SWT.PUSH);
    _saveButton.setText(label);
    _saveButton.setFont(JFaceResources.getDialogFont());
    _saveButton.setData(new Integer(id));
    _saveButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent event) {

            if (isValidInput()) // XXX simply returns true
            {
                try {
                    System.out.println("Aspect Editor quit via SAVE button with current aspect looking like: "
                            + new XMLProcessor().writeToXML(_currentAspect));
                } catch (XMLStreamException e) {
                    System.out.println("Aspect Editor: aspect not serializable!");
                    e.printStackTrace();
                }
                okPressed();
            }
        }
    });
    // if (defaultButton) {
    // Shell shell = parent.getShell();
    // if (shell != null) {
    // shell.setDefaultButton(_saveButton);
    // }
    // }
    _saveButton.setEnabled(_currentAspect.isValid() && _mayWrite);

    setButtonLayoutData(_saveButton);
    return _saveButton;
}