Example usage for org.eclipse.jface.viewers ComboBoxCellEditor ComboBoxCellEditor

List of usage examples for org.eclipse.jface.viewers ComboBoxCellEditor ComboBoxCellEditor

Introduction

In this page you can find the example usage for org.eclipse.jface.viewers ComboBoxCellEditor ComboBoxCellEditor.

Prototype

public ComboBoxCellEditor(Composite parent, String[] items, int style) 

Source Link

Document

Creates a new cell editor with a combo containing the given list of choices and parented under the given control.

Usage

From source file:aspectminingtool.views.FanInSeeds.ViewPartFanInSeeds.java

License:Open Source License

private void createCallsTableViewer() {

    tableViewerRight = new TableViewer(tableRight);
    tableViewerRight.setUseHashlookup(true);

    tableViewerRight.setColumnProperties(columnNamesCallsTable);

    // Set the sorter
    //      ViewerSorter sorter = new SorterMethodDescriptionView();
    //      callsTableViewer.setSorter(sorter);

    // Create the cell editors
    CellEditor[] editors = new CellEditor[columnNamesCallsTable.length];
    // Column 0 : Imagen
    String[] s = new String[2];
    s[0] = "yes";
    s[1] = "no";//from  w w  w. j av  a2 s . co m
    editors[0] = new ComboBoxCellEditor(tableRight, s, SWT.READ_ONLY);
    // Column 1 : Call
    editors[1] = null;
    // Column 2 : Description (Free text)
    TextCellEditor textEditor = new TextCellEditor(tableRight);
    editors[2] = textEditor;

    // Assign the cell editors to the viewer
    tableViewerRight.setCellEditors(editors);
    // Set the cell modifier for the viewer
    tableViewerRight.setCellModifier(new CellModifierCallsDescription(this));

}

From source file:aspectminingtool.views.RedirectorFinderSeeds.ViewPartClassesSeeds.java

License:Open Source License

private void createCallsTableViewerRight() {

    tableViewerRight = new TableViewer(tableRight);
    tableViewerRight.setUseHashlookup(true);

    tableViewerRight.setColumnProperties(columnNamesCallsTable);

    // Set the sorter
    ViewerSorter sorter = new SorterRelatedCallCountedDescription();
    tableViewerRight.setSorter(sorter);/*from  ww  w. ja v a 2  s.  co  m*/

    // Create the cell editors
    CellEditor[] editors = new CellEditor[columnNamesCallsTable.length];
    // Column 0 : Imagen
    String[] s = new String[2];
    s[0] = "yes";
    s[1] = "no";
    editors[0] = new ComboBoxCellEditor(tableRight, s, SWT.READ_ONLY);
    // Column 1 : Call
    editors[1] = null;
    // Column 2 : Description (Free text)
    TextCellEditor textEditor = new TextCellEditor(tableRight);
    editors[2] = textEditor;

    // Assign the cell editors to the viewer
    tableViewerRight.setCellEditors(editors);
    // Set the cell modifier for the viewer
    tableViewerRight.setCellModifier(new CellModifierRelatedCallCounted(this));

    tableViewerRight.setContentProvider(new ContentProviderRelatedMethodsSeeds());
    tableViewerRight.setLabelProvider(new LabelProviderRelatedCallCounted());

    tableViewerRight.addDoubleClickListener(new OpenClassListener(this));

}

From source file:aspectminingtool.views.SeedsGeneral.ViewPartSeeds.java

License:Open Source License

private void createCallsTableViewerRight() {

    tableViewerRight = new TableViewer(tableRight);
    tableViewerRight.setUseHashlookup(true);

    tableViewerRight.setColumnProperties(columnNamesCallsTable);

    // Set the sorter
    ViewerSorter sorter = new SorterRelatedMethodsDescription();
    tableViewerRight.setSorter(sorter);/*from   w w w  .  java  2 s.c  o m*/

    // Create the cell editors
    CellEditor[] editors = new CellEditor[columnNamesCallsTable.length];
    // Column 0 : Imagen
    String[] s = new String[2];
    s[0] = "yes";
    s[1] = "no";
    editors[0] = new ComboBoxCellEditor(tableRight, s, SWT.READ_ONLY);
    // Column 1 : Call
    editors[1] = null;
    // Column 2 : Description (Free text)
    TextCellEditor textEditor = new TextCellEditor(tableRight);
    editors[2] = textEditor;

    // Assign the cell editors to the viewer
    tableViewerRight.setCellEditors(editors);
    // Set the cell modifier for the viewer
    tableViewerRight.setCellModifier(new CellModifierRelatedMethods(this));

    tableViewerRight.setContentProvider(new ContentProviderRelatedMethodsSeeds());
    tableViewerRight.setLabelProvider(new LabelProviderRelatedMethodsSeeds());

    tableViewerRight.addDoubleClickListener(new OpenClassListener(this));

}

From source file:at.spardat.xma.gui.mapper.WidgetCreationWizPProps.java

License:Open Source License

/**
 * @see org.eclipse.jface.dialogs.IDialogPage#createControl(org.eclipse.swt.widgets.Composite)
 *///from w ww .  j a  v a 2 s  . co m
public void createControl(Composite cmp) {
    Composite myComposite = new Composite(cmp, SWT.NULL);
    myComposite.setLayoutData(new GridData(GridData.FILL_BOTH));
    myComposite.setLayout(new FormLayout());

    wiz_ = (WidgetCreationWiz) getWizard();
    attrs_ = wiz_.getAttributes();

    Table table_ = new Table(myComposite,
            SWT.SINGLE | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION | SWT.HIDE_SELECTION);
    table_.setLinesVisible(true);
    table_.setHeaderVisible(true);

    FormData fd = new FormData();
    fd.top = new FormAttachment(0, 0);
    fd.left = new FormAttachment(0, 0);
    fd.right = new FormAttachment(100, 0);
    fd.bottom = new FormAttachment(100, 0);
    table_.setLayoutData(fd);

    tableViewer_ = new TableViewer(table_);

    TableProvider tP = new TableProvider(tableViewer_);
    tP.add(new Column("Instance Name", 100, true, SWT.LEFT) {
        public CellEditor getEditor() {
            return new TextCellEditor(getTable());
        }

        public Object getValue(Object row) {
            return ((MdlAttribute.WidgetInitData) row).getInstanceName();
        }

        public void setValue(Object row, Object cell) {
            MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
            if (wi.isValidInstanceName((String) cell))
                wi.setInstanceName((String) cell);
        }

        public Image getImage(Object row) {
            return MapperPlugin.getImage("method.gif");
        }
    });

    tP.add(new Column("Type", 70, false, SWT.LEFT) {
        public CellEditor getEditor() {
            return new TextCellEditor(getTable());
        }

        public Object getValue(Object row) {
            MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
            return wi.getAttribute().getTypeName();
        }
    });

    if (!createTableCols_) {
        // widget type may be selected if we do not create table columns
        tP.add(new Column("Widget Type", 100, true, SWT.LEFT) {
            public CellEditor getEditor() {
                return new ComboBoxCellEditor(getTable(), MdlAttribute.widgetNames, SWT.READ_ONLY);
            }

            public Object getValue(Object row) {
                MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
                return new Integer(wi.getWType());
            }

            public void setValue(Object row, Object cell) {
                MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
                int val = ((Integer) cell).intValue();
                if (wi.isValidWType(val))
                    wi.setWType(val);
            }

            public String getText(Object row) {
                MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
                return MdlAttribute.widgetNames[wi.getWType()];
            }

            public Image getImage(Object row) {
                MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
                String imageName = "unknownWidget.gif";
                switch (wi.getWType()) {
                case MdlAttribute.WIDG_CHECK:
                    imageName = "check.gif";
                    break;
                case MdlAttribute.WIDG_COMBO:
                    imageName = "combo.gif";
                    break;
                case MdlAttribute.WIDG_TEXT:
                    imageName = "text.gif";
                    break;
                case MdlAttribute.WIDG_PICKER:
                    imageName = "DatePicker.gif";
                    break;
                }
                return MapperPlugin.getImage(imageName);
            }

        });
    }

    tP.add(new Column(createTableCols_ ? "Column Header" : "Label", 100, true, SWT.LEFT) {
        public CellEditor getEditor() {
            return new TextCellEditor(getTable());
        }

        public Object getValue(Object row) {
            MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
            return wi.getLabel();
        }

        public void setValue(Object row, Object cell) {
            MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
            wi.setLabel((String) cell);
        }
    });

    tP.add(new Column("Alignment", 70, true, SWT.LEFT) {
        public CellEditor getEditor() {
            return new ComboBoxCellEditor(getTable(), MdlAttribute.alignmentNames, SWT.READ_ONLY);
        }

        public Object getValue(Object row) {
            MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
            return new Integer(wi.getAlignment());
        }

        public String getText(Object row) {
            MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
            return MdlAttribute.alignmentNames[wi.getAlignment()];
        }

        public void setValue(Object row, Object cell) {
            MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
            int val = ((Integer) cell).intValue();
            wi.setAlignment(val);
        }

        public boolean canModify(Object row) {
            MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
            return wi.getWType() != MdlAttribute.WIDG_COMBO;
        }
    });

    if (createTableCols_) {
        // width of column only if we are creating table columns
        tP.add(new Column("Width", 60, true, SWT.RIGHT) {
            public CellEditor getEditor() {
                return new TextCellEditor(getTable());
            }

            public Object getValue(Object row) {
                MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
                return String.valueOf(wi.getWidth());
            }

            public void setValue(Object row, Object cell) {
                MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
                try {
                    wi.setWidth(Integer.parseInt((String) cell));
                } catch (Exception ex) {
                }
            }
        });
    }

    if (!createTableCols_) {
        //            // not supported yet since this would require to add a validator to the model
        //            // Mandatory property with Texts and Combos
        //            tP.add(new BooleanColumn ("Mandatory", 70, true, SWT.CENTER) {
        //                public boolean getBooleanValue (Object row) {
        //                    MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData)row;
        //                    return wi.isMandatory();
        //                }
        //                public boolean canModify (Object row) {
        //                    MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData)row;
        //                    return wi.getWType() == MdlAttribute.WIDG_TEXT || wi.getWType() == MdlAttribute.WIDG_COMBO;
        //                }
        //                public void setBooleanValue (Object row, boolean value) {
        //                    MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData)row;
        //                    wi.setMandatory(value);
        //                }
        //            });

        // Readonly property with Texts
        tP.add(new BooleanColumn("Editable", 70, true, SWT.CENTER) {
            public boolean getBooleanValue(Object row) {
                MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
                return wi.isEditable();
            }

            public boolean canModify(Object row) {
                MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
                //return wi.getWType() == MdlAttribute.WIDG_TEXT;
                return true;
            }

            public void setBooleanValue(Object row, boolean value) {
                MdlAttribute.WidgetInitData wi = (MdlAttribute.WidgetInitData) row;
                wi.setEditable(value);
            }
        });

    }

    tP.createSWTColumns();
    tP.setCellEditors();
    tableViewer_.setUseHashlookup(true);
    tableViewer_.setColumnProperties(tP.getColumnNames());
    tableViewer_.setCellModifier(tP);
    tableViewer_.setLabelProvider(tP);
    tableViewer_.setContentProvider(new IStructuredContentProvider() {
        public Object[] getElements(Object inputElement) {
            MdlAttribute.WidgetInitData[] data = new MdlAttribute.WidgetInitData[attrs_.length];
            for (int i = 0; i < data.length; i++) {
                data[i] = attrs_[i].getWidgetInitData(createTableCols_);
            }
            return data;
        }

        public void dispose() {
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }
    });
    tableViewer_.setInput(tP); // does not really matter

    setControl(myComposite);

}

From source file:bndtools.release.ProjectListControl.java

License:Open Source License

private void createTableViewer() {

    tableViewer = new TableViewer(projects);
    tableViewer.setUseHashlookup(true);/*from   w  w  w .  j ava 2 s.c  o  m*/

    tableViewer.setColumnProperties(columnNames);

    // Create the cell editors
    CellEditor[] editors = new CellEditor[columnNames.length];

    // Column 1 : Project
    TextCellEditor textEditor = new TextCellEditor(projects);
    ((Text) textEditor.getControl()).setEditable(false);
    editors[0] = textEditor;

    // Column 2 : Repository (Combo Box)
    editors[1] = new ComboBoxCellEditor(projects, releaseRepos, SWT.READ_ONLY);

    // Column 3 : Number of bundles
    textEditor = new TextCellEditor(projects);
    ((Text) textEditor.getControl()).setEditable(false);
    editors[2] = textEditor;

    // Assign the cell editors to the viewer
    tableViewer.setCellEditors(editors);
    tableViewer.setCellModifier(new TableCellModifier());
    tableViewer.setContentProvider(new ContentProvider());
    tableViewer.setLabelProvider(new TableLabelProvider());
}

From source file:ch.elexis.core.ui.contacts.preferences.BezugsKontaktSettings.java

License:Open Source License

@Override
protected Control createContents(Composite parent) {
    updateExistingEntriesIds.clear();/*from  w  w  w  .j a v  a 2  s. c om*/
    Composite container = new Composite(parent, SWT.NULL);
    container.setLayout(new GridLayout(1, false));

    Group group = new Group(container, SWT.NONE);
    group.setLayout(new GridLayout(1, false));
    group.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
    group.setText(Messages.Bezugskontakt_Definition);

    Composite composite = new Composite(group, SWT.NONE);
    GridData gd_composite = new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1);
    gd_composite.heightHint = 300;
    composite.setLayoutData(gd_composite);
    TableColumnLayout tcl_composite = new TableColumnLayout();
    composite.setLayout(tcl_composite);

    tableViewer = new TableViewer(composite, SWT.BORDER | SWT.FULL_SELECTION);
    tableViewer.setContentProvider(ArrayContentProvider.getInstance());

    tableBezugsKontaktRelations = tableViewer.getTable();
    tableBezugsKontaktRelations.setHeaderVisible(true);
    tableBezugsKontaktRelations.setLinesVisible(true);

    if (allowEditing) {
        Menu menu = new Menu(tableBezugsKontaktRelations);
        tableBezugsKontaktRelations.setMenu(menu);

        MenuItem mntmAddBezugsKontaktRelation = new MenuItem(menu, SWT.NONE);
        mntmAddBezugsKontaktRelation.setText(Messages.Bezugskontakt_Add);
        mntmAddBezugsKontaktRelation.setImage(Images.IMG_NEW.getImage());
        mntmAddBezugsKontaktRelation.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                BezugsKontaktRelation bezugsKontaktRelation = new BezugsKontaktRelation("",
                        RelationshipType.AGENERIC, RelationshipType.AGENERIC);
                tableViewer.add(bezugsKontaktRelation);
                tableViewer.setSelection(new StructuredSelection(bezugsKontaktRelation));
            }
        });

        MenuItem mntmRemoveBezugsKontaktRelation = new MenuItem(menu, SWT.NONE);
        mntmRemoveBezugsKontaktRelation.setText(Messages.Bezugskontakt_Delete);
        mntmRemoveBezugsKontaktRelation.addSelectionListener(new SelectionAdapter() {
            @Override
            public void widgetSelected(SelectionEvent e) {
                int selectionsIdx = tableViewer.getTable().getSelectionIndex();
                if (selectionsIdx != -1) {
                    boolean ret = MessageDialog.openQuestion(UiDesk.getTopShell(),
                            Messages.Bezugskontakt_ConfirmDelete, Messages.Bezugskontakt_ConfirmDeleteText);
                    if (ret) {
                        tableViewer.getTable().remove(selectionsIdx);
                    }
                }
            }
        });
    }

    TableViewerColumn viewCol = new TableViewerColumn(tableViewer, SWT.NONE);
    TableColumn col = viewCol.getColumn();
    tcl_composite.setColumnData(col, new ColumnWeightData(1, 140));
    col.setText(Messages.BezugsKonktat_Reference);
    col.setToolTipText(Messages.Bezugskontakt_ReferenceTooltip);
    viewCol.setLabelProvider(new CellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            BezugsKontaktRelation s = (BezugsKontaktRelation) cell.getElement();
            if (s == null)
                return;
            cell.setText(s.getName());
        }
    });
    viewCol.setEditingSupport(new EditingSupport(tableViewer) {

        @Override
        protected void setValue(Object element, Object value) {
            if (element instanceof BezugsKontaktRelation) {
                String newName = String.valueOf(value);
                BezugsKontaktRelation tableData = null;
                for (TableItem tableItem : tableViewer.getTable().getItems()) {
                    tableData = (BezugsKontaktRelation) tableItem.getData();
                    if (tableData != null && !tableData.equals(element) && !tableData.getName().isEmpty()
                            && newName.equalsIgnoreCase(tableData.getName())) {
                        MessageDialog.openError(UiDesk.getTopShell(), "",
                                Messages.Bezugskontakt_NameMustBeUnique);
                        return;
                    }
                }
                BezugsKontaktRelation bezugsKontaktRelation = (BezugsKontaktRelation) element;
                if (!bezugsKontaktRelation.getName().equals(newName)) {
                    bezugsKontaktRelation.setName(newName);
                    getViewer().update(bezugsKontaktRelation, null);
                    openConfirmUpdateExistingData(bezugsKontaktRelation);
                }
            }

        }

        @Override
        protected Object getValue(Object element) {
            if (element instanceof BezugsKontaktRelation) {
                return ((BezugsKontaktRelation) element).getName();
            }
            return null;
        }

        @Override
        protected CellEditor getCellEditor(Object element) {
            return new TextCellEditor(tableViewer.getTable());
        }

        @Override
        protected boolean canEdit(Object element) {
            return allowEditing;
        }
    });

    viewCol = new TableViewerColumn(tableViewer, SWT.NONE);
    col = viewCol.getColumn();
    tcl_composite.setColumnData(col, new ColumnWeightData(0, 140));
    col.setText(Messages.Bezugskontakt_RelationFrom);
    viewCol.setLabelProvider(new CellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            BezugsKontaktRelation s = (BezugsKontaktRelation) cell.getElement();
            if (s == null)
                return;
            cell.setText(LocalizeUtil.getLocaleText(s.getDestRelationType()));
        }
    });
    viewCol.setEditingSupport(new EditingSupport(tableViewer) {

        @Override
        protected void setValue(Object element, Object value) {
            if (element instanceof BezugsKontaktRelation && value instanceof Integer) {
                BezugsKontaktRelation bezugsKontaktRelation = (BezugsKontaktRelation) element;
                RelationshipType[] allRelationshipTypes = RelationshipType.values();
                if ((int) value != -1 && !bezugsKontaktRelation.getDestRelationType()
                        .equals(allRelationshipTypes[(int) value])) {
                    bezugsKontaktRelation.setDestRelationType(allRelationshipTypes[(int) value]);
                    getViewer().update(bezugsKontaktRelation, null);
                    openConfirmUpdateExistingData(bezugsKontaktRelation);
                }
            }

        }

        @Override
        protected Object getValue(Object element) {
            if (element instanceof BezugsKontaktRelation) {
                BezugsKontaktRelation bezugsKontaktRelation = (BezugsKontaktRelation) element;
                RelationshipType relationshipType = bezugsKontaktRelation.getDestRelationType();
                if (relationshipType != null) {
                    return relationshipType.getValue();
                }
            }

            return 0;
        }

        @Override
        protected CellEditor getCellEditor(Object element) {
            return new ComboBoxCellEditor(tableViewer.getTable(), BezugsKontaktAuswahl.getBezugKontaktTypes(),
                    SWT.NONE);
        }

        @Override
        protected boolean canEdit(Object element) {
            return allowEditing;
        }
    });

    viewCol = new TableViewerColumn(tableViewer, SWT.NONE);
    col = viewCol.getColumn();
    tcl_composite.setColumnData(col, new ColumnWeightData(0, 140));
    col.setText(Messages.Bezugskontakt_RelationTo);

    viewCol.setLabelProvider(new CellLabelProvider() {

        @Override
        public void update(ViewerCell cell) {
            BezugsKontaktRelation s = (BezugsKontaktRelation) cell.getElement();
            if (s == null)
                return;
            cell.setText(LocalizeUtil.getLocaleText(s.getSrcRelationType()));
        }
    });
    viewCol.setEditingSupport(new EditingSupport(tableViewer) {

        @Override
        protected void setValue(Object element, Object value) {
            if (element instanceof BezugsKontaktRelation && value instanceof Integer) {
                BezugsKontaktRelation bezugsKontaktRelation = (BezugsKontaktRelation) element;
                RelationshipType[] allRelationshipTypes = RelationshipType.values();
                if ((int) value != -1 && !bezugsKontaktRelation.getSrcRelationType()
                        .equals(allRelationshipTypes[(int) value])) {
                    bezugsKontaktRelation.setSrcRelationType(allRelationshipTypes[(int) value]);
                    getViewer().update(bezugsKontaktRelation, null);
                    openConfirmUpdateExistingData(bezugsKontaktRelation);
                }
            }
        }

        @Override
        protected Object getValue(Object element) {
            if (element instanceof BezugsKontaktRelation) {
                BezugsKontaktRelation bezugsKontaktRelation = (BezugsKontaktRelation) element;
                RelationshipType relationshipType = bezugsKontaktRelation.getSrcRelationType();
                if (relationshipType != null) {
                    return relationshipType.getValue();
                }
            }

            return 0;
        }

        @Override
        protected CellEditor getCellEditor(Object element) {
            return new ComboBoxCellEditor(tableViewer.getTable(), BezugsKontaktAuswahl.getBezugKontaktTypes(),
                    SWT.NONE);
        }

        @Override
        protected boolean canEdit(Object element) {
            return allowEditing;
        }
    });
    ;
    tableViewer
            .setInput(loadBezugKonkaktTypes(CoreHub.globalCfg.get(Patientenblatt2.CFG_BEZUGSKONTAKTTYPEN, "")));
    return container;
}

From source file:com.amalto.workbench.detailtabs.sections.composites.ForeignKeyFilterComposite.java

License:Open Source License

@Override
protected CellEditor[] getCellEditors() {
    return new CellEditor[] { new XPathCellEditor(tvInfos.getTree(), dataModelHolder),
            new ComboBoxCellEditor(tvInfos.getTree(), IConstants.VIEW_CONDITION_OPERATORS, SWT.READ_ONLY),
            new TextCellEditor(tvInfos.getTree()),
            new ComboBoxCellEditor(tvInfos.getTree(), IConstants.PREDICATES, SWT.READ_ONLY) };
}

From source file:com.amalto.workbench.detailtabs.sections.model.simpletype.propsource.SimpleTypeFacetArrayStrPropertySource.java

License:Open Source License

@Override
public CellEditor getCellEditor() {
    return new ComboBoxCellEditor(cellEditorParent, candidates, SWT.READ_ONLY);
}

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

License:Open Source License

protected Control createDialogArea(Composite parent) {

    // Should not really be here but well,....
    parent.getShell().setText(this.title);

    Composite composite = (Composite) super.createDialogArea(parent);

    GridLayout layout = (GridLayout) composite.getLayout();
    layout.numColumns = 3;//from  w w w  .ja  v  a  2  s.c  om
    // layout.verticalSpacing = 10;

    languagesCombo = new Combo(composite, SWT.READ_ONLY | SWT.DROP_DOWN | SWT.SINGLE);
    languagesCombo.setLayoutData(new GridData(SWT.BEGINNING, SWT.NONE, false, false, 1, 1));
    Set<String> languages = Util.lang2iso.keySet();
    for (Iterator iter = languages.iterator(); iter.hasNext();) {
        String language = (String) iter.next();
        languagesCombo.add(language);
    }
    languagesCombo.addModifyListener(new ModifyListener() {

        public void modifyText(ModifyEvent e) {
        }
    });
    languagesCombo.select(0);

    labelText = new Text(composite, SWT.BORDER | SWT.SINGLE);
    labelText.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    ((GridData) labelText.getLayoutData()).minimumWidth = 150;
    labelText.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
        }

        public void keyReleased(KeyEvent e) {
            if ((e.stateMask == 0) && (e.character == SWT.CR)) {
                String isoCode = Util.lang2iso.get(languagesCombo.getText());
                descriptionsMap.put(isoCode, labelText.getText());
                descriptionsViewer.refresh();
            }
        }
    });

    Button addLabelButton = new Button(composite, SWT.PUSH);
    addLabelButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    addLabelButton.setImage(ImageCache.getCreatedImage(EImage.ADD_OBJ.getPath()));
    addLabelButton.setToolTipText(Messages.AnnotationLanguageLabelsDialog_Add);
    addLabelButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        };

        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            String code = Util.lang2iso.get(languagesCombo.getText());
            descriptionsMap.put(code, labelText.getText());
            descriptionsViewer.refresh();
        };
    });

    final String LANGUAGE = Messages.AnnotationLanguageLabelsDialog_Language;
    final String LABEL = Messages.AnnotationLanguageLabelsDialog_Label;

    descriptionsViewer = new TableViewer(composite,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    descriptionsViewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    ((GridData) descriptionsViewer.getControl().getLayoutData()).heightHint = 100;
    // Set up the underlying table
    Table table = descriptionsViewer.getTable();
    // table.setLayoutData(new GridData(GridData.FILL_BOTH));

    new TableColumn(table, SWT.LEFT).setText(LANGUAGE);
    new TableColumn(table, SWT.CENTER).setText(LABEL);
    table.getColumn(0).setWidth(150);
    table.getColumn(1).setWidth(150);
    for (int i = 2, n = table.getColumnCount(); i < n; i++) {
        table.getColumn(i).pack();
    }

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

    Button delLabelButton = new Button(composite, SWT.PUSH);
    delLabelButton.setLayoutData(new GridData(SWT.NONE, SWT.NONE, false, false, 1, 1));
    delLabelButton.setImage(ImageCache.getCreatedImage(EImage.DELETE_OBJ.getPath()));
    delLabelButton.setToolTipText(Messages.AnnotationLanguageLabelsDialog_Del);
    delLabelButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        };

        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            deleteItem();
        };
    });
    // Create the cell editors --> We actually discard those later: not natural for an user
    CellEditor[] editors = new CellEditor[2];
    editors[0] = new ComboBoxCellEditor(table, Util.lang2iso.keySet().toArray(new String[] {}), SWT.READ_ONLY);
    editors[1] = new TextCellEditor(table);
    descriptionsViewer.setCellEditors(editors);

    // set the content provider
    descriptionsViewer.setContentProvider(new IStructuredContentProvider() {

        public void dispose() {
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }

        public Object[] getElements(Object inputElement) {
            // System.out.println("getElements() ");
            LinkedHashMap<String, String> descs = (LinkedHashMap<String, String>) inputElement;
            Set<String> languages = descs.keySet();
            ArrayList<DescriptionLine> lines = new ArrayList<DescriptionLine>();
            for (Iterator iter = languages.iterator(); iter.hasNext();) {
                String language = ((String) iter.next());
                DescriptionLine line = new DescriptionLine(Util.iso2lang.get(language), descs.get(language));
                lines.add(line);
            }
            // we return an instance line made of a Sring and a boolean
            return lines.toArray(new DescriptionLine[lines.size()]);
        }
    });

    // set the label provider
    descriptionsViewer.setLabelProvider(new ITableLabelProvider() {

        public boolean isLabelProperty(Object element, String property) {
            return false;
        }

        public void dispose() {
        }

        public void addListener(ILabelProviderListener listener) {
        }

        public void removeListener(ILabelProviderListener listener) {
        }

        public String getColumnText(Object element, int columnIndex) {
            // System.out.println("getColumnText() "+columnIndex);
            DescriptionLine line = (DescriptionLine) element;
            switch (columnIndex) {
            case 0:
                return line.getLanguage();
            case 1:
                return line.getLabel();
            }
            return "";//$NON-NLS-1$
        }

        public Image getColumnImage(Object element, int columnIndex) {
            return null;
        }
    });

    // Set the column properties
    descriptionsViewer.setColumnProperties(new String[] { LANGUAGE, LABEL });

    // set the Cell Modifier
    descriptionsViewer.setCellModifier(new ICellModifier() {

        public boolean canModify(Object element, String property) {
            // if (INSTANCE_ACCESS.equals(property)) return true; Deactivated
            return true;
        }

        public void modify(Object element, String property, Object value) {
            TableItem item = (TableItem) element;
            int columnIndex = Arrays.asList(descriptionsViewer.getColumnProperties()).indexOf(property);
            DescriptionLine line = (DescriptionLine) item.getData();
            if (columnIndex == 0) {
                String[] attrs = Util.lang2iso.keySet().toArray(new String[] {});
                int orgIndx = Arrays.asList(attrs).indexOf(line.getLanguage());
                if (orgIndx != Integer.parseInt(value.toString())) {
                    String newLang = attrs[Integer.parseInt(value.toString())];
                    if (descriptionsMap.containsKey(Util.lang2iso.get(newLang))) {
                        MessageDialog.openInformation(null, Messages.Warnning,
                                Messages.AnnotationLanguageLabelsDialog_InforContent);
                        return;
                    }
                    descriptionsMap.remove(Util.lang2iso.get(line.getLanguage()));
                    line.setLanguage(newLang);
                    descriptionsMap.put(Util.lang2iso.get(newLang), line.getLabel());
                }
            } else // column label
            {
                line.setLabel(value.toString());
                descriptionsMap.put(Util.lang2iso.get(line.getLanguage()), line.getLabel());
            }

            descriptionsViewer.update(line, null);
        }

        public Object getValue(Object element, String property) {
            int columnIndex = Arrays.asList(descriptionsViewer.getColumnProperties()).indexOf(property);
            DescriptionLine line = (DescriptionLine) element;
            if (columnIndex == 0) {
                String[] attrs = Util.lang2iso.keySet().toArray(new String[] {});
                return Arrays.asList(attrs).indexOf(line.getLanguage());
            } else {
                if (LANGUAGE.equals(property)) {
                    return line.getLanguage();
                }
                if (LABEL.equals(property)) {
                    return line.getLabel();
                }
            }

            return null;
        }
    });

    // Listen for changes in the selection of the viewer to display additional parameters
    descriptionsViewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
        }
    });

    // display for Delete Key events to delete an instance
    descriptionsViewer.getTable().addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
        }

        public void keyReleased(KeyEvent e) {
            // System.out.println("Table keyReleased() ");
            if ((e.stateMask == 0) && (e.character == SWT.DEL) && (descriptionsViewer.getSelection() != null)) {
                deleteItem();
            }
        }
    });

    descriptionsViewer.setInput(descriptionsMap);
    descriptionsViewer.refresh();

    labelText.setFocus();

    return composite;
}

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

License:Open Source License

@Override
protected Control createDialogArea(Composite parent) {

    // Should not really be here but well,....

    parent.getShell().setText(this.title);

    Composite composite = (Composite) super.createDialogArea(parent);

    GridLayout layout = (GridLayout) composite.getLayout();
    layout.numColumns = 3;/*from   ww w  . jav a  2 s .c  o m*/
    layout.makeColumnsEqualWidth = false;
    // layout.verticalSpacing = 10;

    if (actionType == AnnotationWrite_ActionType || actionType == AnnotationHidden_ActionType) {
        textControl = new CCombo(composite, SWT.BORDER | SWT.READ_ONLY);

        // roles=Util.getCachedXObjectsNameSet(this.xObject, TreeObject.ROLE);
        roles = getAllRolesStr();
        ((CCombo) textControl).setItems(roles.toArray(new String[roles.size()]));

    } else if (actionType == AnnotationLookupField_ActionType
            || actionType == AnnotationPrimaKeyInfo_ActionType) {
        textControl = new CCombo(composite, SWT.BORDER | SWT.READ_ONLY);

        // roles=Util.getCachedXObjectsNameSet(this.xObject, TreeObject.ROLE);
        roles = getConceptElements();
        ((CCombo) textControl).setItems(roles.toArray(new String[roles.size()]));

    } else {
        if (actionType == AnnotationOrderedListsDialog.AnnotationSchematron_ActionType) {
            textControl = new Text(composite, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL);
        } else {
            textControl = new Text(composite, SWT.BORDER | SWT.SINGLE);
        }
    }

    if (actionType == AnnotationOrderedListsDialog.AnnotationForeignKeyInfo_ActionType) {
        textControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
    } else {
        if (actionType == AnnotationOrderedListsDialog.AnnotationSchematron_ActionType) {
            textControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 7));
        } else {
            textControl.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
        }
    }

    ((GridData) textControl.getLayoutData()).minimumWidth = 400;

    textControl.addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
        }

        public void keyReleased(KeyEvent e) {
            if ((e.stateMask == 0) && (e.character == SWT.CR)) {
                xPaths.add(AnnotationOrderedListsDialog.getControlText(textControl));
                viewer.refresh();
                fireXPathsChanges();
            }
        }
    });

    if (actionType == AnnotationOrderedListsDialog.AnnotationForeignKeyInfo_ActionType) {
        Button xpathButton = new Button(composite, SWT.PUSH | SWT.CENTER);
        xpathButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
        xpathButton.setText("...");//$NON-NLS-1$
        xpathButton.setToolTipText(Messages.AnnotationOrderedListsDialog_SelectXpath);
        xpathButton.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(SelectionEvent e) {

            }

            public void widgetSelected(SelectionEvent e) {
                XpathSelectDialog dlg = getNewXpathSelectDialog(parentPage, dataModelName);

                dlg.setLock(lock);

                dlg.setBlockOnOpen(true);

                dlg.open();

                if (dlg.getReturnCode() == Window.OK) {
                    ((Text) textControl).setText(dlg.getXpath());
                    dlg.close();
                }

            }

        });

    }

    Button addLabelButton = new Button(composite, SWT.PUSH);
    addLabelButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, false, 1, 1));
    // addLabelButton.setText("Set");
    addLabelButton.setImage(ImageCache.getCreatedImage(EImage.ADD_OBJ.getPath()));
    addLabelButton.setToolTipText(Messages.AnnotationOrderedListsDialog_Add);
    addLabelButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        };

        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            boolean exist = false;
            for (String string : xPaths) {
                if (string.equals(getControlText(textControl))) {
                    exist = true;
                }
            }
            if (!exist && getControlText(textControl) != null && getControlText(textControl) != "") {
                xPaths.add(getControlText(textControl));
            }
            viewer.refresh();
            fireXPathsChanges();
        };
    });

    final String COLUMN = columnName;

    viewer = new TableViewer(composite,
            SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER | SWT.FULL_SELECTION);
    viewer.getControl().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 2, 1));
    ((GridData) viewer.getControl().getLayoutData()).heightHint = 100;
    // Set up the underlying table
    Table table = viewer.getTable();
    // table.setLayoutData(new GridData(GridData.FILL_BOTH));

    new TableColumn(table, SWT.CENTER).setText(COLUMN);
    table.getColumn(0).setWidth(500);
    for (int i = 1, n = table.getColumnCount(); i < n; i++) {
        table.getColumn(i).pack();
    }

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

    // Create the cell editors --> We actually discard those later: not natural for an user
    CellEditor[] editors = new CellEditor[1];
    if (actionType == AnnotationOrderedListsDialog.AnnotationWrite_ActionType
            || actionType == AnnotationOrderedListsDialog.AnnotationHidden_ActionType
            || actionType == AnnotationLookupField_ActionType
            || actionType == AnnotationPrimaKeyInfo_ActionType) {
        editors[0] = new ComboBoxCellEditor(table, roles.toArray(new String[] {}), SWT.READ_ONLY);
    } else {
        editors[0] = new TextCellEditor(table);
    }

    viewer.setCellEditors(editors);

    // set the content provider
    viewer.setContentProvider(new IStructuredContentProvider() {

        public void dispose() {
        }

        public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {
        }

        public Object[] getElements(Object inputElement) {
            @SuppressWarnings("unchecked")
            ArrayList<String> xPaths = (ArrayList<String>) inputElement;
            ArrayList<DescriptionLine> lines = new ArrayList<DescriptionLine>();
            for (String xPath : xPaths) {
                DescriptionLine line = new DescriptionLine(xPath);
                lines.add(line);
            }
            // we return an instance line made of a Sring and a boolean
            return lines.toArray(new DescriptionLine[lines.size()]);
        }
    });

    // set the label provider
    viewer.setLabelProvider(new ITableLabelProvider() {

        public boolean isLabelProperty(Object element, String property) {
            return false;
        }

        public void dispose() {
        }

        public void addListener(ILabelProviderListener listener) {
        }

        public void removeListener(ILabelProviderListener listener) {
        }

        public String getColumnText(Object element, int columnIndex) {
            // System.out.println("getColumnText() "+columnIndex);
            DescriptionLine line = (DescriptionLine) element;
            switch (columnIndex) {
            case 0:
                return line.getLabel();
            }
            return "";//$NON-NLS-1$
        }

        public Image getColumnImage(Object element, int columnIndex) {
            return null;
        }
    });

    // Set the column properties
    viewer.setColumnProperties(new String[] { COLUMN });

    // set the Cell Modifier
    viewer.setCellModifier(new ICellModifier() {

        public boolean canModify(Object element, String property) {
            // if (INSTANCE_ACCESS.equals(property)) return true; Deactivated
            return true;
            // return false;
        }

        public void modify(Object element, String property, Object value) {

            TableItem item = (TableItem) element;
            DescriptionLine line = (DescriptionLine) item.getData();
            String orgValue = line.getLabel();
            if (actionType != AnnotationWrite_ActionType && actionType != AnnotationHidden_ActionType
                    && actionType != AnnotationLookupField_ActionType
                    && actionType != AnnotationPrimaKeyInfo_ActionType) {
                int targetPos = xPaths.indexOf(value.toString());
                if (targetPos < 0) {
                    line.setLabel(value.toString());
                    int index = xPaths.indexOf(orgValue);
                    xPaths.remove(index);
                    xPaths.add(index, value.toString());
                    viewer.update(line, null);
                } else if (targetPos >= 0 && !value.toString().equals(orgValue)) {
                    MessageDialog.openInformation(null, Messages.Warning,
                            Messages.AnnotationOrderedListsDialog_ValueAlreadyExists);
                }
            } else {

                String[] attrs = roles.toArray(new String[] {});
                int index = Integer.parseInt(value.toString());
                if (index == -1) {
                    return;
                }
                value = attrs[index];
                int pos = xPaths.indexOf(value.toString());
                if (pos >= 0 && !(orgValue.equals(value))) {
                    MessageDialog.openInformation(null, Messages.Warning,
                            Messages.AnnotationOrderedListsDialog_);
                    return;
                } else if (pos < 0) {
                    line.setLabel(value.toString());
                    xPaths.set(index, value.toString());
                    viewer.update(line, null);
                }
            }

            fireXPathsChanges();
        }

        public Object getValue(Object element, String property) {
            DescriptionLine line = (DescriptionLine) element;
            String value = line.getLabel();

            if (actionType == AnnotationWrite_ActionType || actionType == AnnotationHidden_ActionType
                    || actionType == AnnotationLookupField_ActionType
                    || actionType == AnnotationPrimaKeyInfo_ActionType) {
                String[] attrs = roles.toArray(new String[] {});
                return Arrays.asList(attrs).indexOf(value);
            } else {
                return value;
            }

        }
    });

    // Listen for changes in the selection of the viewer to display additional parameters
    viewer.addSelectionChangedListener(new ISelectionChangedListener() {

        public void selectionChanged(SelectionChangedEvent event) {
            DescriptionLine line = (DescriptionLine) ((IStructuredSelection) viewer.getSelection())
                    .getFirstElement();
            if (line != null) {
                if (textControl instanceof CCombo) {
                    ((CCombo) textControl).setText(line.getLabel());
                }
                if (textControl instanceof Text) {
                    ((Text) textControl).setText(line.getLabel());
                }
            }
        }
    });

    // display for Delete Key events to delete an instance
    viewer.getTable().addKeyListener(new KeyListener() {

        public void keyPressed(KeyEvent e) {
        }

        public void keyReleased(KeyEvent e) {
            // System.out.println("Table keyReleased() ");
            if ((e.stateMask == 0) && (e.character == SWT.DEL) && (viewer.getSelection() != null)) {
                DescriptionLine line = (DescriptionLine) ((IStructuredSelection) viewer.getSelection())
                        .getFirstElement();
                @SuppressWarnings("unchecked")
                ArrayList<String> xPaths = (ArrayList<String>) viewer.getInput();
                xPaths.remove(line.getLabel());
                viewer.refresh();
            }
        }
    });

    viewer.setInput(xPaths);
    viewer.refresh();

    Composite rightButtonsComposite = new Composite(composite, SWT.NULL);
    rightButtonsComposite.setLayout(new GridLayout(1, true));
    rightButtonsComposite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));

    Button upButton = new Button(rightButtonsComposite, SWT.PUSH | SWT.CENTER);
    upButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    upButton.setImage(ImageCache.getCreatedImage(EImage.PREV_NAV.getPath()));
    upButton.setToolTipText(Messages.AnnotationOrderedListsDialog_MoveUpTheItem);
    upButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        };

        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            DescriptionLine line = (DescriptionLine) ((IStructuredSelection) viewer.getSelection())
                    .getFirstElement();
            if (line == null) {
                return;
            }
            int i = 0;
            for (String xPath : xPaths) {
                if (xPath.equals(line.getLabel())) {
                    if (i > 0) {
                        xPaths.remove(i);
                        xPaths.add(i - 1, xPath);
                        viewer.refresh();
                        viewer.getTable().setSelection(i - 1);
                        viewer.getTable().showSelection();
                        fireXPathsChanges();
                    }
                    return;
                }
                i++;
            }
        };
    });
    Button downButton = new Button(rightButtonsComposite, SWT.PUSH | SWT.CENTER);
    downButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    downButton.setImage(ImageCache.getCreatedImage(EImage.NEXT_NAV.getPath()));
    downButton.setToolTipText(Messages.AnnotationOrderedListsDialog_MoveDownTheItem);
    downButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        };

        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            DescriptionLine line = (DescriptionLine) ((IStructuredSelection) viewer.getSelection())
                    .getFirstElement();
            if (line == null) {
                return;
            }
            int i = 0;
            for (String xPath : xPaths) {
                if (xPath.equals(line.getLabel())) {
                    if (i < xPaths.size() - 1) {
                        xPaths.remove(i);
                        xPaths.add(i + 1, xPath);
                        viewer.refresh();
                        viewer.getTable().setSelection(i + 1);
                        viewer.getTable().showSelection();
                        fireXPathsChanges();
                    }
                    return;
                }
                i++;
            }
        };
    });
    Button delButton = new Button(rightButtonsComposite, SWT.PUSH | SWT.CENTER);
    delButton.setLayoutData(new GridData(SWT.FILL, SWT.FILL, false, true, 1, 1));
    delButton.setImage(ImageCache.getCreatedImage(EImage.DELETE_OBJ.getPath()));
    delButton.setToolTipText(Messages.AnnotationOrderedListsDialog_DelTheItem);

    delButton.addSelectionListener(new SelectionListener() {

        public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
        };

        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
            DescriptionLine line = (DescriptionLine) ((IStructuredSelection) viewer.getSelection())
                    .getFirstElement();
            if (line != null) {
                @SuppressWarnings("unchecked")
                ArrayList<String> xPaths = (ArrayList<String>) viewer.getInput();
                xPaths.remove(line.getLabel());
                viewer.refresh();
                fireXPathsChanges();
            }
        };
    });

    textControl.setFocus();
    if (actionType != AnnotationOrderedListsDialog.AnnotationForeignKeyInfo_ActionType
            && actionType != AnnotationOrderedListsDialog.AnnotationTargetSystems_ActionType
            && actionType != AnnotationOrderedListsDialog.AnnotationSchematron_ActionType
            && actionType != AnnotationOrderedListsDialog.AnnotationLookupField_ActionType
            && actionType != AnnotationOrderedListsDialog.AnnotationPrimaKeyInfo_ActionType) {
        checkBox = new Button(composite, SWT.CHECK);
        checkBox.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true, 2, 1));
        checkBox.addSelectionListener(new SelectionListener() {

            public void widgetDefaultSelected(org.eclipse.swt.events.SelectionEvent e) {
            };

            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                recursive = checkBox.getSelection();
            };
        });
        checkBox.setSelection(recursive);
        checkBox.setText(Messages.AnnotationOrderedListsDialog_SetRoleRecursively);
        // Label label = new Label(composite, SWT.LEFT);
        // label.setText("set role recursively");
        // label.setLayoutData(new GridData(SWT.LEFT, SWT.FILL, false, true,
        // 1, 1));
    }

    if (actionType == AnnotationForeignKeyInfo_ActionType) {
        createFKInfoFormatComp(composite);
        addDoubleClickListener();
    }

    return composite;
}