Package de.innovationgate.eclipse.utils.ui

Examples of de.innovationgate.eclipse.utils.ui.WidgetFactory


  protected void createFormContent(IManagedForm managedForm) {
    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    toolkit.decorateFormHeading(form.getForm());
   
    WidgetFactory factory = new WidgetFactory(toolkit);
   
    form.setText(PAGE_TITLE);

    ColumnLayout layout = new ColumnLayout();
    layout.maxNumColumns = 2;
    form.getBody().setLayout(layout);
   
   
    if (!_model.hasPluginConfig()) {
      GridLayout gridLayout = new GridLayout(1, false);
      form.getBody().setLayout(gridLayout);
      toolkit.createLabel(form.getBody(), "This design is currently not configured to be used as WGA Plugin.");
      _btnCreatePluginConfig = toolkit.createButton(form.getBody(), "Create WGA Plugin Configuration", SWT.PUSH);
      _btnCreatePluginConfig.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
        public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
          handleCreatePluginConfig();
        }
      });
    } else {         
      // registration section
      Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
      section.setText("Registration");
 
          Composite sectionClient = toolkit.createComposite(section);
          section.setClient(sectionClient);
          GridLayout sectionLayout = new GridLayout();
          GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
          fillHSpan.horizontalSpan = 4;
          GridData fillH = new GridData(GridData.FILL_HORIZONTAL);
         
          GridData prefSize = new GridData();
          prefSize.widthHint = 50;
         
          sectionLayout.numColumns = 5;
          sectionClient.setLayout(sectionLayout);                     
       
          _txtUniqueName = factory.createText(sectionClient, "Unique Name:", "pluginUniqueName");
          _txtUniqueName.setLayoutData(fillHSpan);
          registerField("pluginUniqueName", _txtUniqueName);
         
          _txtVersion = factory.createText(sectionClient, "Version:", "pluginVersion");
          _txtVersion.setLayoutData(prefSize);
          registerField("pluginVersion", _txtVersion);
         
          _txtBuild = factory.createText(sectionClient, "Build", "pluginBuild");
          _txtBuild.setLayoutData(prefSize);
          registerField("pluginBuild", _txtBuild);
          factory.addFiller(sectionClient);
         
          _txtMinWGAVersion = factory.createText(sectionClient, "Minimum WGA Version:", "pluginWGAVersion");
          _txtMinWGAVersion.setLayoutData(prefSize);
          registerField("pluginWGAVersion", _txtMinWGAVersion);
          factory.addFiller(sectionClient, 3);
         
          _txtMinJavaVersion = factory.createText(sectionClient, "Minimum Java Version:", "pluginJavaVersion");
          _txtMinJavaVersion.setLayoutData(prefSize);
          registerField("pluginJavaVersion", _txtMinJavaVersion);
          factory.addFiller(sectionClient, 3);
       
        // information section
        section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
      section.setText("Information and Functionality");
 
          sectionClient = toolkit.createComposite(section);
          section.setClient(sectionClient);
          sectionLayout = new GridLayout();       
          sectionLayout.numColumns = 2;
          sectionClient.setLayout(sectionLayout);
         
          _txtTitle = factory.createText(sectionClient, "Title:", "pluginTitle");
          _txtTitle.setLayoutData(fillH);
          registerField("pluginTitle", _txtTitle);
         
          _txtVendor = factory.createText(sectionClient, "Vendor:", "pluginVendor");
          _txtVendor.setLayoutData(fillH)
          registerField("pluginVendor", _txtVendor);
         
          _txtVendorHomepage = factory.createText(sectionClient, "Vendor Homepage:", "pluginVendorHomepage");
          _txtVendorHomepage.setLayoutData(fillH);
          registerField("pluginVendorHomepage", _txtVendorHomepage);
         
          _txtDescription = factory.createTextArea(sectionClient, "Description:", "pluginDescription");
           GridData textBox = new GridData(GridData.FILL_BOTH);
           textBox.minimumHeight = 100;
          _txtDescription.setLayoutData(textBox);
          registerField("pluginDescription", _txtDescription)
         
          _txtPluginHomepage = factory.createText(sectionClient, "Plugin Homepage:", "pluginHomepage");
          _txtPluginHomepage.setLayoutData(fillH);
          registerField("pluginHomepage", _txtPluginHomepage);
         
          _comboAuthenticationSource = factory.createCombo(sectionClient, "Authentication source:", "pluginAuthenticationSource");
          registerField("pluginAuthenticationSource", _comboAuthenticationSource);
         
          _comboPersMode = factory.createCombo(sectionClient, "Personalisation mode:", "pluginPersonalisationMode");
          registerField("pluginPersonalisationMode", _comboPersMode);
         
          toolkit.createLabel(sectionClient, "Usage:");
         
          _chkUsageDesignProvider = toolkit.createButton(sectionClient, "Design Provider", SWT.CHECK);
          _chkUsageDesignProvider.setData("pluginUsageAsDesignProvider");
          registerField("pluginUsageAsDesignProvider", _chkUsageDesignProvider);
       
         
          toolkit.createLabel(sectionClient, "")
          _chkUsageAuthSource = toolkit.createButton(sectionClient, "Authentication Source", SWT.CHECK);
        _chkUsageAuthSource.setData("pluginUsageAsAuthenticationSource");
        registerField("pluginUsageAsAuthenticationSource", _chkUsageAuthSource);
       
        toolkit.createLabel(sectionClient, "");
        _chkUsageContentStore = toolkit.createButton(sectionClient, "Published WGA Content Store", SWT.CHECK);
          _chkUsageContentStore.setData("pluginUsageAsContentStore");
          _chkUsageContentStore.setData(SWTBotIDs.WIDGET_KEY, ResourceIDs.BUTTON_IN_DESGINPLUGIN_EDITOR);
          registerField("pluginUsageAsContentStore", _chkUsageContentStore);
         
//          _chkAllowContentAuthoring = factory.createCheckBox(sectionClient, "Further options:", "Allow Content Authoring", "allowContentAuthoring");
//          registerField("allowContentAuthoring", _chkAllowContentAuthoring);
         
          _chkClearPluginDatabaseOnUpdate = factory.createCheckBox(sectionClient, "", "Clear plugin database on update", "pluginClearDatabaseOnUpdate");
          registerField("pluginClearDatabaseOnUpdate", _chkClearPluginDatabaseOnUpdate);
         
          _chkDisableInit = factory.createCheckBox(sectionClient, "", "Do not execute init/ connect functionalities on plugin itself", "pluginDisableInit");
          registerField("pluginDisableInit", _chkDisableInit);
         
          // dependencies section
      section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.COMPACT);
      section.setText("Dependencies");
View Full Code Here


    @Override
    protected void createFormContent(IManagedForm managedForm) {
        ScrolledForm form = managedForm.getForm();
        FormToolkit toolkit = managedForm.getToolkit();
        WidgetFactory factory = new WidgetFactory(toolkit);
       
        toolkit.decorateFormHeading(form.getForm());
        form.setText(PAGE_TITLE);

        GridLayout formLayout = new GridLayout(2, true);
        form.getBody().setLayout(formLayout);       
       
        // tree
        Section schemaSection = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
        schemaSection.setText("Schema Definition");
        schemaSection.setLayoutData(new GridData(GridData.FILL_BOTH));
        // register schemaSection as error catcher
        registerField(WGASchemaDefinitionModel.PROPERTY_HINT_SCHEMADEF, schemaSection);
       
        Tree tree = toolkit.createTree(schemaSection, SWT.NONE);
        tree.setLayoutData(new GridData(GridData.FILL_BOTH));
        schemaSection.setClient(tree);
       
        final Menu menu = new Menu(Display.getCurrent().getActiveShell(), SWT.POP_UP);
        MenuItem itemNewContentTypeDefinition = new MenuItem(menu, SWT.PUSH);
        itemNewContentTypeDefinition.setText("Content Type Definition");
        itemNewContentTypeDefinition.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                WGContentTypeDefinition cType = _model.createContentTypeDefinition();
                _treeViewer.expandToLevel(cType, 1);
                _treeViewer.setSelection(new SingleStructuredSelection(cType));               
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
        MenuItem itemNewAreaDefinition = new MenuItem(menu, SWT.PUSH);
        itemNewAreaDefinition.setText("Area Definition");
        itemNewAreaDefinition.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                WGAreaDefinition area = _model.createAreaDefinition();
                _treeViewer.expandToLevel(area, 1);
                _treeViewer.setSelection(new SingleStructuredSelection(area));               
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
        MenuItem itemNewLanguageDefinition = new MenuItem(menu, SWT.PUSH);
        itemNewLanguageDefinition.setText("Language Definition");
        itemNewLanguageDefinition.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                WGLanguageDefinition lang = _model.createLanguageDefinition();
                _treeViewer.expandToLevel(lang, 1);
                _treeViewer.setSelection(new SingleStructuredSelection(lang));               
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
            }
        });
       
       
        final ToolBar schemaSectionToolBar = new ToolBar(schemaSection, SWT.FLAT);
        final ToolItem schemaSectionItemNew = new ToolItem(schemaSectionToolBar, SWT.DROP_DOWN);
        schemaSectionItemNew.setText("new");
        schemaSectionItemNew.setImage(Plugin.getDefault().getImageRegistry().get(Plugin.IMAGE_SCHEMADEFINITION_ADD));
        schemaSectionItemNew.addListener(SWT.Selection, new Listener() {
            public void handleEvent(Event event) {

                  Rectangle rect = schemaSectionItemNew.getBounds();
                  Point pt = new Point(rect.x, rect.y + rect.height);
                  pt = schemaSectionToolBar.toDisplay(pt);
                  menu.setLocation(pt.x, pt.y);
                  menu.setVisible(true);

              }
           }
        );
        final ToolItem schemaSectionItemDelete = new ToolItem(schemaSectionToolBar, SWT.PUSH);
        schemaSectionItemDelete.setText("delete");
        schemaSectionItemDelete.setImage(Plugin.getDefault().getImageRegistry().get(Plugin.IMAGE_SCHEMADEFINITION_REMOVE));
        schemaSectionItemDelete.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                ISelection selection = _treeViewer.getSelection();
                if (selection instanceof TreeSelection) {
                    TreeSelection treeSelection = (TreeSelection) selection;
                    Object node = treeSelection.getFirstElement();
                    if (node instanceof WGSchemaDocumentDefinition) {
                        WGSchemaDocumentDefinition def = (WGSchemaDocumentDefinition)node;
                        String typeName = "Document Definition";
                        if (def instanceof WGContentTypeDefinition) {
                            typeName = "Content Type Definition";
                        } else if (def instanceof WGAreaDefinition) {
                            typeName = "Area Definition";
                        } else if (def instanceof WGLanguageDefinition) {
                            typeName = "Language Definition";
                        }
                        boolean result = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Delete " + typeName, "Delete " + typeName + " '" + def.getName() + "'?");
                        if (result) {
                            _model.removeSchemaDocumentDefintion(def);
                        }
                    } else if (node instanceof WGContentItemDefinition) {
                        WGContentItemDefinition def = (WGContentItemDefinition)node;
                        String typeName = "Item Definition";
                        boolean result = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Delete " + typeName, "Delete " + typeName + " '" + def.getName() + "'?");
                        if (result) {
                            _model.remove(def);
                        }
                    } else if (node instanceof WGMetaFieldDefinition) {
                        WGMetaFieldDefinition def = (WGMetaFieldDefinition)node;
                        String typeName = "Property";
                        boolean result = MessageDialog.openConfirm(Display.getCurrent().getActiveShell(), "Delete " + typeName, "Delete " + typeName + " '" + AddContentTypeMetaDefinitionDialog.METADATA_DEFINITION_LABELS.get(def.getName()) + "'?");
                        if (result) {
                            _model.remove(def);
                        }
                    }
                }
               
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {
                // TODO Auto-generated method stub
               
            }
        });
       
        schemaSection.setTextClient(schemaSectionToolBar);
       
       
       
        _treeViewer = new TreeViewer(tree);
        _treeViewer.setContentProvider(new WGASchemaDefinitionContentProvider());              
        _treeViewer.setLabelProvider(new WGASchemaDefinitionLabelProvider());       
        _treeViewer.setComparator(new ViewerComparator() {

            @Override
            public int compare(Viewer viewer, Object e1, Object e2) {
                if (e1 != null && e2 != null) {
                    if (e1 instanceof WGMetaFieldDefinition && e2 instanceof WGMetaFieldDefinition) {
                        WGMetaFieldDefinition def1 = (WGMetaFieldDefinition) e1;
                        WGMetaFieldDefinition def2 = (WGMetaFieldDefinition) e2;
                        return AddContentTypeMetaDefinitionDialog.METADATA_DEFINITION_LABELS.get(def1.getName()).compareTo(AddContentTypeMetaDefinitionDialog.METADATA_DEFINITION_LABELS.get(def2.getName()));
                    } else if (e1 instanceof String && e2 instanceof String) {
                        if (e1.equals(WGASchemaDefinitionContentProvider.CONTENTTYPE_DEFINITIONS_ROOT)) {
                            return -1;
                        } else if (e1.equals(WGASchemaDefinitionContentProvider.AREA_DEFINITIONS_ROOT) && e2.equals(WGASchemaDefinitionContentProvider.LANGUAGE_DEFINITIONS_ROOT)) {
                            return -1;
                        } else {
                            return 1;
                        }                                                
                    } else if (e1 instanceof WGMetaFieldDefinition && e2 instanceof WGContentItemDefinition) {
                        return -1;
                    } else if (e1 instanceof WGContentItemDefinition && e2 instanceof WGMetaFieldDefinition) {
                        return 1;
                    } else if (e1 instanceof WGContentItemDefinition && e2 instanceof WGContentItemDefinition) {
                        WGContentItemDefinition def1 = (WGContentItemDefinition) e1;
                        WGContentItemDefinition def2 = (WGContentItemDefinition) e2;
                        if (def1.getName().startsWith("<") && !def2.getName().startsWith("<")) {
                            return 1;
                        } else if (def2.getName().startsWith("<") && !def1.getName().startsWith("<")) {
                            return -1;
                        } else {
                            return def1.getName().compareTo(def2.getName());
                        }
                    } else if (e1 instanceof WGContentTypeDefinition && e2 instanceof WGContentTypeDefinition) {
                        WGContentTypeDefinition def1 = (WGContentTypeDefinition) e1;
                        WGContentTypeDefinition def2 = (WGContentTypeDefinition) e2;
                        if (def1.getName().startsWith("<") && !def2.getName().startsWith("<")) {
                            return 1;
                        } else if (def2.getName().startsWith("<") && !def1.getName().startsWith("<")) {
                            return -1;
                        } else {
                            return def1.getName().compareTo(def2.getName());
                        }
                    } else if (e1 instanceof WGAreaDefinition && e2 instanceof WGAreaDefinition) {
                        WGAreaDefinition def1 = (WGAreaDefinition) e1;
                        WGAreaDefinition def2 = (WGAreaDefinition) e2;
                        if (def1.getName().startsWith("<") && !def2.getName().startsWith("<")) {
                            return 1;
                        } else if (def2.getName().startsWith("<") && !def1.getName().startsWith("<")) {
                            return -1;
                        } else {
                            return def1.getName().compareTo(def2.getName());
                        }
                    }  else if (e1 instanceof WGLanguageDefinition && e2 instanceof WGLanguageDefinition) {
                        WGLanguageDefinition def1 = (WGLanguageDefinition) e1;
                        WGLanguageDefinition def2 = (WGLanguageDefinition) e2;
                        if (def1.getName().startsWith("<") && !def2.getName().startsWith("<")) {
                            return 1;
                        } else if (def2.getName().startsWith("<") && !def1.getName().startsWith("<")) {
                            return -1;
                        } else {
                            return def1.getName().compareTo(def2.getName());
                        }
                    }
                   
                }
                return super.compare(viewer, e1, e2);
            }
           
        });
        _treeViewer.setInput(_model);      
        _treeViewer.addSelectionChangedListener(this);
                      
        // details
        _detailSection = toolkit.createSection(form.getBody(), Section.DESCRIPTION | Section.TITLE_BAR | Section.TWISTIE | Section.EXPANDED);
        _detailSection.setText("Details");
        _detailSection.setLayoutData(new GridData(GridData.FILL_BOTH));     

        // content type subform
        Composite subform = toolkit.createComposite(_detailSection);          
        GridLayout subformLayout = new GridLayout();       
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);              
        Text txtName = factory.createText(subform, "Name:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        factory.createCheckBox(subform, "Auto creation:", "Enabled", "autoCreate");

        Label lblActions = new Label(subform, SWT.NONE);
        lblActions.setText("Actions:");
        HyperlinkGroup actionGroup = new HyperlinkGroup(Display.getCurrent());
        Hyperlink defineMetas = new Hyperlink(subform, SWT.NONE);
        defineMetas.setText("add properties...");
        defineMetas.addHyperlinkListener(new IHyperlinkListener() {           
            public void linkExited(HyperlinkEvent e) {
            }
           
            public void linkEntered(HyperlinkEvent e) {              
            }
           
            public void linkActivated(HyperlinkEvent e) {
                handleAddMetaDataDefinition();               
            }
        });
        actionGroup.add(defineMetas);
       
        Label lbl = new Label(subform, SWT.NONE);
        Hyperlink defineItems = new Hyperlink(subform, SWT.NONE);
        defineItems.setText("add item definition...");
        defineItems.addHyperlinkListener(new IHyperlinkListener() {
           
            public void linkExited(HyperlinkEvent e) {
            }
           
            public void linkEntered(HyperlinkEvent e) {
            }
           
            public void linkActivated(HyperlinkEvent e) {
                handleAddItemDefinition();               
            }
        });
        actionGroup.add(defineItems);
       
        WGContentTypeDefinitionModel contentTypeDefinitionModel = new WGContentTypeDefinitionModel();
        contentTypeDefinitionModel.addListener(new BeanChangedListener<WGContentTypeDefinition>() {
            public void changed(WGContentTypeDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });               
        _subforms.put(SUBFORM_CONTENT_TYPE_DEFINITION, subform);
        _subformModels.put(SUBFORM_CONTENT_TYPE_DEFINITION, contentTypeDefinitionModel);
       
        // area subform
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);             
        txtName = factory.createText(subform, "Name:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        factory.createCheckBox(subform, "Auto creation:", "Enabled", "autoCreate");

        WGAreaDefinitionModel areaDefintionModel = new WGAreaDefinitionModel();
        areaDefintionModel.addListener(new BeanChangedListener<WGAreaDefinition>() {
            public void changed(WGAreaDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }           
        });
        _subforms.put(SUBFORM_AREA_DEFINITION, subform);
        _subformModels.put(SUBFORM_AREA_DEFINITION, areaDefintionModel);
       
        // language subform
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);             
        txtName = factory.createText(subform, "Name:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        factory.createCheckBox(subform, "Auto creation:", "Enabled", "autoCreate");
       
        WGLanguageDefinitionModel languageDefinitionModel = new WGLanguageDefinitionModel();
        languageDefinitionModel.addListener(new BeanChangedListener<WGLanguageDefinition>() {
            public void changed(WGLanguageDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }           
        });
        _subforms.put(SUBFORM_LANGUAGE_DEFINITION, subform);
        _subformModels.put(SUBFORM_LANGUAGE_DEFINITION, languageDefinitionModel);

        // item subform
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);
       
        Group parentGroup = createParentInformationGroup(subform);
        GridData parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Itemname:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        Combo itemTypeCombo = factory.createCombo(subform, "Type:", "type");       
        _chkItemList = factory.createCheckBox(subform, "List:", "Enabled", "list");

        _lblInitialValues = new Label(subform, SWT.NONE);
        _lblInitialValues.setText("Initial values:");
        _lblInitialValues.setLayoutData(new GridData(SWT.NONE, SWT.BEGINNING, false, false));
       
        _initialValuesSection = toolkit.createSection(subform, Section.EXPANDED | Section.NO_TITLE);
       
        GridData initialValuesSectionLayoutData = new GridData(GridData.FILL_BOTH);
        _initialValuesSection.setLayoutData(initialValuesSectionLayoutData);

        // item subform - text values
        _initialTextValuesSectionClient = toolkit.createComposite(_initialValuesSection);
        _initialTextValuesSectionClient.setLayout(new FillLayout());
        _tblItemTextValues = new EditableTableControl<PrimitiveTypeBean<String>>(_initialTextValuesSectionClient, SWT.NONE);
        _itemTextValuesModel = new PrimitiveTypeBeanListTableModel<String>(true);
        _itemTextValuesModel.addListener(new BeanListTableModelListener() {
           
            public void update(Object bean) {
                _model.fireModelChanged();               
            }
           
            public void remove(Object bean) {
                _model.fireModelChanged();
            }
           
            public void refresh(List beans) {
            }
           
            public void add(Object bean) {
                _model.fireModelChanged();               
            }
        });
        _tblItemTextValues.init(new String[] {"#", "Value"}, _itemTextValuesModel);
        CellEditor[] cellEditors = new CellEditor[2];
        cellEditors[0] = null;
        cellEditors[1] = new TextCellEditor(_tblItemTextValues.getTable());
        _tblItemTextValues.getTableViewer().setCellEditors(cellEditors);
       
        _tblItemTextValues.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
                if (_itemTextValuesModel.getBeans().size() > 0) {                   
                    _chkItemList.setSelection(true);
                    model.setList(true);
                }
                handleAdd(_tblItemTextValues, "");
            }
        });

        _tblItemTextValues.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleRemove(_tblItemTextValues);
            }
        });
       
       
        // item subform - boolean values
        _initialBooleanValuesSectionClient = toolkit.createComposite(_initialValuesSection);
        _initialBooleanValuesSectionClient.setLayout(new FillLayout());
        _tblItemBooleanValues = new EditableTableControl<PrimitiveTypeBean<Boolean>>(_initialBooleanValuesSectionClient, SWT.NONE);
        _itemBooleanValuesModel = new PrimitiveTypeBeanListTableModel<Boolean>(true);
        _itemBooleanValuesModel.addListener(new BeanListTableModelListener() {
           
            public void update(Object bean) {
                _model.fireModelChanged();               
            }
           
            public void remove(Object bean) {
                _model.fireModelChanged();
            }
           
            public void refresh(List beans) {
            }
           
            public void add(Object bean) {
                _model.fireModelChanged();               
            }
        });
        _tblItemBooleanValues.init(new String[] {"#", "Value"}, _itemBooleanValuesModel);
        cellEditors = new CellEditor[2];
        cellEditors[0] = null;
        cellEditors[1] = new CheckboxCellEditor(_tblItemBooleanValues.getTable());
        _tblItemBooleanValues.getTableViewer().setCellEditors(cellEditors);       
       
        _tblItemBooleanValues.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
                if (_itemBooleanValuesModel.getBeans().size() > 0) {                   
                    _chkItemList.setSelection(true);
                    model.setList(true);
                }
                handleAdd(_tblItemBooleanValues, false);               
            }
        });

        _tblItemBooleanValues.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleRemove(_tblItemBooleanValues);
            }
        });
       
       
        // item subform - number values
        _initialNumberValuesSectionClient = toolkit.createComposite(_initialValuesSection);
        _initialNumberValuesSectionClient.setLayout(new FillLayout());
        _tblItemNumberValues = new EditableTableControl<PrimitiveTypeBean<Number>>(_initialNumberValuesSectionClient, SWT.NONE);        
        _itemNumberValuesModel = new PrimitiveTypeBeanListTableModel<Number>(true);
        _itemNumberValuesModel.addListener(new BeanListTableModelListener() {
           
            public void update(Object bean) {
                _model.fireModelChanged();               
            }
           
            public void remove(Object bean) {
                _model.fireModelChanged();
            }
           
            public void refresh(List beans) {
            }
           
            public void add(Object bean) {
                _model.fireModelChanged();               
            }
        });
        _tblItemNumberValues.init(new String[] {"#", "Value"}, _itemNumberValuesModel);
        cellEditors = new CellEditor[2];
        cellEditors[0] = null;
        cellEditors[1] = new DoubleValueCellEditor(_tblItemNumberValues.getTable());

        _tblItemNumberValues.getTableViewer().setCellEditors(cellEditors);
       
        _tblItemNumberValues.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
                if (_itemNumberValuesModel.getBeans().size() > 0) {                   
                    _chkItemList.setSelection(true);
                    model.setList(true);
                }
                handleAdd(_tblItemNumberValues, 0);               
            }
        });

        _tblItemNumberValues.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleRemove(_tblItemNumberValues);
            }
        });
       
       
       
        itemTypeCombo.addModifyListener(new ModifyListener() {
           
            public void modifyText(ModifyEvent e) {
                WGContentItemDefinitionModel model = (WGContentItemDefinitionModel)_subformModels.get(SUBFORM_CONTENT_ITEM_DEFINITION);
                WGContentItemDefinition.Type type = model.getType().getKey();
                if (type.equals(WGContentItemDefinition.Type.TEXT)) {
                    _initialValuesSection.setVisible(true);
                    _lblInitialValues.setVisible(true);
                    _itemTextValuesModel.bind(model.getInitialValues());
                    _initialTextValuesSectionClient.setVisible(true);
                    _initialBooleanValuesSectionClient.setVisible(false);
                    _initialNumberValuesSectionClient.setVisible(false);
                    _initialValuesSection.setClient(_initialTextValuesSectionClient);
                    _initialValuesSection.layout();
                } else if (type.equals(WGContentItemDefinition.Type.BOOLEAN)) {
                    _initialValuesSection.setVisible(true);
                    _lblInitialValues.setVisible(true);
                    _itemBooleanValuesModel.bind(model.getInitialValues());
                    _initialBooleanValuesSectionClient.setVisible(true);
                    _initialTextValuesSectionClient.setVisible(false);
                    _initialNumberValuesSectionClient.setVisible(false);
                    _initialValuesSection.setClient(_initialBooleanValuesSectionClient);
                    _initialValuesSection.layout();
                } else if (type.equals(WGContentItemDefinition.Type.NUMBER)) {
                    _initialValuesSection.setVisible(true);
                    _lblInitialValues.setVisible(true);
                    _itemNumberValuesModel.bind(model.getInitialValues());
                    _initialNumberValuesSectionClient.setVisible(true);
                    _initialBooleanValuesSectionClient.setVisible(false);
                    _initialTextValuesSectionClient.setVisible(false);     
                    _initialValuesSection.setClient(_initialNumberValuesSectionClient);
                    _initialValuesSection.layout();
                } else {
                    _initialValuesSection.setVisible(false);
                    _lblInitialValues.setVisible(false);
                }
               
            }
        });
       
        WGContentItemDefinitionModel contentItemDefinitionModel = new WGContentItemDefinitionModel(_model);       
        contentItemDefinitionModel.addListener(new BeanChangedListener<WGContentItemDefinition>() {
            public void changed(WGContentItemDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }           
        });

       
        _subforms.put(SUBFORM_CONTENT_ITEM_DEFINITION, subform);
        _subformModels.put(SUBFORM_CONTENT_ITEM_DEFINITION, contentItemDefinitionModel);

        // content type meta data subforms
        // subform for description
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);       

        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Property:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        txtName.setEditable(false);
        Text txtValue = factory.createTextArea(subform, "Description", "description");       
        GridData txtValueLayoutData = new GridData(GridData.FILL_BOTH);
        txtValueLayoutData.minimumHeight = 200;
        txtValue.setLayoutData(txtValueLayoutData)
       
        WGDescriptionMetaFieldDefinitionModel descriptionMetaFieldDefinitionModel = new WGDescriptionMetaFieldDefinitionModel(_model);
        descriptionMetaFieldDefinitionModel.addListener(new BeanChangedListener<WGMetaFieldDefinition>() {
            public void changed(WGMetaFieldDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });
       
        _subforms.put(SUBFORM_META_DESCRIPTION, subform);
        _subformModels.put(SUBFORM_META_DESCRIPTION, descriptionMetaFieldDefinitionModel);
       
        // subform for event scripts
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);       

        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Property:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        txtName.setEditable(false);
        txtValue = factory.createTextArea(subform, "Scriptcode:", "code");       
        txtValueLayoutData = new GridData(GridData.FILL_BOTH);
        txtValueLayoutData.minimumHeight = 200;
        txtValue.setLayoutData(txtValueLayoutData)
       
        WGEventScriptMetaFieldDefinitionModel eventScriptMetaFieldDefinitionModel = new WGEventScriptMetaFieldDefinitionModel(_model);
        eventScriptMetaFieldDefinitionModel.addListener(new BeanChangedListener<WGMetaFieldDefinition>() {
            public void changed(WGMetaFieldDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });

       
        _subforms.put(SUBFORM_META_EVENTSCRIPT, subform);
        _subformModels.put(SUBFORM_META_EVENTSCRIPT, eventScriptMetaFieldDefinitionModel);
       
        // subform for layouts
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 3;
        subform.setLayout(subformLayout);
               
        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 3;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Property:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        txtName.setEditable(false);
        factory.addFiller(subform);
        txtValue = factory.createText(subform, "Module:", "layout");              
        txtValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
       
        final Text fTxtLayout = txtValue;
        Button btnBrowseLayout = new Button(subform, SWT.PUSH);
        btnBrowseLayout.setText("browse ...");
        btnBrowseLayout.addSelectionListener(new SelectionListener() {
           
            public void widgetSelected(SelectionEvent e) {
                handleBrowserLayout(fTxtLayout)
            }
           
            public void widgetDefaultSelected(SelectionEvent e) {                            
            }
        });
        WGLayoutMetaFieldDefinitionModel layoutMetaFieldDefinitionModel = new WGLayoutMetaFieldDefinitionModel(_model);
        layoutMetaFieldDefinitionModel.addListener(new BeanChangedListener<WGMetaFieldDefinition>() {
            public void changed(WGMetaFieldDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });

       
        _subforms.put(SUBFORM_META_LAYOUT, subform);
        _subformModels.put(SUBFORM_META_LAYOUT, layoutMetaFieldDefinitionModel);
       
        // subform for allowed positions
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);
               
        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Property:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        txtName.setEditable(false);
        Combo comboPositioning = factory.createCombo(subform, "Positions:", "positioning");              
        comboPositioning.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
       
        factory.addFiller(subform);
        _tblAllowedPositions = new EditableTableControl<PrimitiveTypeBean<String>>(subform, SWT.NONE);
        _allowedPositionsModel = new PrimitiveTypeBeanListTableModel<String>();
        _allowedPositionsModel.addListener(new BeanListTableModelListener() {
           
            public void update(Object bean) {
                _model.fireModelChanged();               
            }
           
            public void remove(Object bean) {
                _model.fireModelChanged();
            }
           
            public void refresh(List beans) {
            }
           
            public void add(Object bean) {
                _model.fireModelChanged();               
            }
        });
        _tblAllowedPositions.init(new String[] {"Name"}, _allowedPositionsModel);
        GridData tblLayoutData = new GridData(GridData.FILL_BOTH);
        tblLayoutData.minimumHeight = 200;
        _tblAllowedPositions.setLayoutData(tblLayoutData);
        cellEditors = new CellEditor[1];
        cellEditors[0] = new TextCellEditor(_tblAllowedPositions.getTable());
        _tblAllowedPositions.getTableViewer().setCellEditors(cellEditors);
       
        comboPositioning.addModifyListener(new ModifyListener() {
           
            public void modifyText(ModifyEvent e) {
                WGPositioningMetaFieldDefinitionModel model = (WGPositioningMetaFieldDefinitionModel)_subformModels.get(SUBFORM_META_POSITIONING);
                if (model.getPositioning().getKey().equals(WGContentType.POSITIONING_FIXEDPARENTS) || model.getPositioning().getKey().equals(WGContentType.POSITIONING_FIXEDPARENTTYPES)) {
                    _tblAllowedPositions.setVisible(true);
                    WGContentTypeDefinition cTypeDefinition = _model.findContentTypeDefinition(model.getBean());                   
                    ((PrimitiveTypeBeanListTableModel<String>)_tblAllowedPositions.getModel()).bind(model.getAllowedPositions(cTypeDefinition));
                } else {
                    _tblAllowedPositions.setVisible(false);
                }
            }
        });

        _tblAllowedPositions.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleAdd(_tblAllowedPositions, "<value>");
            }
        });

        _tblAllowedPositions.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
            public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
                handleRemove(_tblAllowedPositions);
            }
        });
       
           
        WGPositioningMetaFieldDefinitionModel positioningMetaFieldDefinitionModel = new WGPositioningMetaFieldDefinitionModel(_model);
        positioningMetaFieldDefinitionModel.addListener(new BeanChangedListener<WGMetaFieldDefinition>() {
            public void changed(WGMetaFieldDefinition bean) {
                _treeViewer.refresh(bean, true);
                _model.fireModelChanged();
            }
        });

       
        _subforms.put(SUBFORM_META_POSITIONING, subform);
        _subformModels.put(SUBFORM_META_POSITIONING, positioningMetaFieldDefinitionModel);
       
       
        // subform for editors
        subform = toolkit.createComposite(_detailSection);
        subformLayout = new GridLayout();  
        subformLayout.numColumns = 2;
        subform.setLayout(subformLayout);
               
        parentGroup = createParentInformationGroup(subform);
        parentInfoLayoutData = new GridData(GridData.FILL_HORIZONTAL);       
        parentInfoLayoutData.horizontalSpan = 2;
        parentGroup.setLayoutData(parentInfoLayoutData);
       
        txtName = factory.createText(subform, "Property:", "name");
        txtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
        txtName.setEditable(false);
        Label label = new Label(subform, SWT.NONE);
        label.setText("Editors:");
        label.setLayoutData(new GridData(SWT.NONE, SWT.BEGINNING, false, false));
View Full Code Here

  protected void createFormContent(IManagedForm managedForm) {
    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    toolkit.decorateFormHeading(form.getForm());
   
    WidgetFactory factory = new WidgetFactory(toolkit);
   
    form.setText(PAGE_TITLE);

    ColumnLayout layout = new ColumnLayout();
    layout.maxNumColumns = 2;
View Full Code Here

  protected void createFormContent(IManagedForm managedForm) {
    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    toolkit.decorateFormHeading(form.getForm());
   
    WidgetFactory factory = new WidgetFactory(toolkit);
   
    form.setText(PAGE_TITLE);

    ColumnLayout layout = new ColumnLayout();
    layout.maxNumColumns = 2;
    form.getBody().setLayout(layout);
   
    // general section
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("General");

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 2;
        GridData fillH = new GridData(GridData.FILL_HORIZONTAL);
       
        sectionLayout.numColumns = 3;
        sectionClient.setLayout(sectionLayout);
       
       
        _lblDirectory = factory.createLabel(sectionClient, "Directory", "designDirectory");       
        _lblDirectory.setLayoutData(fillHSpan);
       
//      _lblDesignKey = factory.createLabel(sectionClient, "Design key:", "designKey");
//      _lblDesignKey.setLayoutData(fillHSpan);
     
      _txtInitScript= factory.createText(sectionClient, "Initialisation script:", "initScript");
      _txtInitScript.setLayoutData(fillH);
      registerField("initScript", _txtInitScript);
     
      _btnBrowseInitScript = toolkit.createButton(sectionClient, "...", SWT.PUSH);
      _btnBrowseInitScript.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleBrowseInitScript();
      }
    });
     
      _txtConnectionScript= factory.createText(sectionClient, "Connection script:", "connectionScript");
      _txtConnectionScript.setLayoutData(fillH);
      registerField("connectionScript", _txtConnectionScript);
     
      _btnBrowseConnectionScript = toolkit.createButton(sectionClient, "...", SWT.PUSH);
      _btnBrowseConnectionScript.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleBrowseConnectionScript();
      }
    });
     
      _txtDisconnectionScript= factory.createText(sectionClient, "Disconnection script:", "disconnectionScript");
      _txtDisconnectionScript.setLayoutData(fillH);
      registerField("disconnectionScript", _txtDisconnectionScript);
           
      _btnBrowseDisconnectionScript = toolkit.createButton(sectionClient, "...", SWT.PUSH);
      _btnBrowseDisconnectionScript.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleBrowseDisconnectionScript();
      }
    });     
      _txtDisconnectionScript.addPaintListener(new PaintListener() {

      public void paintControl(PaintEvent e) {
        _btnBrowseDisconnectionScript.setEnabled(_txtDisconnectionScript.isEnabled());       
      }
       
      });

     
      _comboDefaultAccessLevel = factory.createCombo(sectionClient, "Default access level:", "defaultAccessLevel");
      factory.addFiller(sectionClient);
      registerField("defaultAccessLevel", _comboDefaultAccessLevel);
         
      _comboAnonymousAccessLevel = factory.createCombo(sectionClient, "Anonymous access level:", "anonymousAccessLevel");
      factory.addFiller(sectionClient);
      registerField("anonymousAccessLevel", _comboAnonymousAccessLevel);
     
      _comboVersionCompliance = factory.createCombo(sectionClient, "Developed for WGA version:", "versionCompliance");
      factory.addFiller(sectionClient)
      registerField("versionCompliance", _comboVersionCompliance);     
     
      // libraries section
      section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.COMPACT);
    section.setText("Libraries");

        sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        sectionLayout = new GridLayout();       
        sectionLayout.numColumns = 3;
        sectionClient.setLayout(sectionLayout);
     
        _chkStaticClasspath = factory.createCheckBox(sectionClient, "Prevent reloading of java libraries", "Enabled", "staticClasspath");
      registerField("staticClasspath", _chkStaticClasspath);
       
        GridData fillBoth = new GridData(GridData.FILL_BOTH);
        fillBoth.minimumHeight = 100;
        fillBoth.verticalSpan = 2;
        fillBoth.horizontalSpan = 2;
        _lstLibraries = new List(sectionClient, SWT.BORDER|SWT.MULTI);
        _lstLibraries.setLayoutData(fillBoth);
        _lstLibraries.setItems(_model.getLibraryNames());
       
        _btnAddLibrary = toolkit.createButton(sectionClient, "add...", SWT.PUSH);
        _btnAddLibrary.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleAddLibrary();
      }
    });
       
        GridData btnLayout = new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_FILL, false, false);
        _btnAddLibrary.setLayoutData(btnLayout);
       
        //factory.addFiller(sectionClient);
       
        _btnRemoveLibrary = toolkit.createButton(sectionClient, "remove...", SWT.PUSH);
       
        _btnRemoveLibrary.setLayoutData(btnLayout);       
        _btnRemoveLibrary.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleRemoveLibrary();
      }
    });
       

       
       
        // publishing section
      section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("Publishing");

        sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        sectionLayout = new GridLayout();       
        sectionLayout.numColumns = 2;
        sectionClient.setLayout(sectionLayout);
       
      _txtHomePage= factory.createText(sectionClient, "Home Page:", "homePage");
      _txtHomePage.setLayoutData(fillH);
      registerField("homePage", _txtHomePage);
     
      _loginPage= factory.createText(sectionClient, "Login Page:", "loginPage");
      _loginPage.setLayoutData(fillH)
      registerField("loginPage", _loginPage);
     
//      _defaultMediaKey= factory.createText(sectionClient, "Default Media Key:", "defaultMediaKey");
//      _defaultMediaKey.setLayoutData(fillH);
//      registerField("defaultMediaKey", _defaultMediaKey);
     
      _comboDefaultTMLOutputEncoding = factory.createCombo(sectionClient, "Default WebTML Output Encoding:", "defaultItemEncoding");
      registerField("defaultItemEncoding", _comboDefaultTMLOutputEncoding);
     
      _comboDesignEncoding = factory.createCombo(sectionClient, "Design encoding:", "designEncoding");
      registerField("designEncoding", _comboDesignEncoding);
     
      HyperlinkGroup group = new HyperlinkGroup(sectionClient.getDisplay());     
      factory.addFiller(sectionClient);
      ImageHyperlink linkEnforceEncoding = new ImageHyperlink(sectionClient, SWT.None);
      linkEnforceEncoding.setText("Enforce design encoding");
      final Shell fShell = getSite().getShell();
      linkEnforceEncoding.addHyperlinkListener(new HyperlinkAdapter() {
      public void linkActivated(HyperlinkEvent e) {
        if (_editor.isDirty()) {
          MessageDialog.openInformation(fShell, "Save changes", "Please save your changes on this design first.");
          return;
        }
        boolean result = MessageDialog.openQuestion(fShell, "Enforce design encoding", "Enforcing design encoding will change encoding resource settings and perform a revalidation of the design. Continue?");
        if (result) {
          try {
            new WGADesignStructureHelper(_model.getDesignContainer()).enforceDesignEncoding();
            RunValidation.call(_model.getDesignContainer(), fShell);
          } catch (CoreException e1) {
            WorkbenchUtils.showErrorDialog(Plugin.getDefault(), fShell, "Error", "Enforce design encoding failed.", e1);
          }         
        }
      }
    });   
      group.add(linkEnforceEncoding);
     
//      _comboDefaultExpressionLanguage = factory.createCombo(sectionClient, "Default Expression Language:", "expressionDefault");
//      registerField("expressionDefault", _comboDefaultExpressionLanguage);
     
      _chkMultiLanguageContent = factory.createCheckBox(sectionClient, "Multi Language Content", "Enabled", "multiLanguageContent");
      registerField("multiLanguageContent", _chkMultiLanguageContent);
     
//      _chkDirectAccessDefault = factory.createCheckBox(sectionClient, "WebTML Direct Access by default", "Allowed", "directAccessDefault");
//      registerField("directAccessDefault", _chkDirectAccessDefault);
     
      _chkUsesHDB = factory.createCheckBox(sectionClient, "Uses HDB interface", "Enabled", "usesHDB");
      registerField("usesHDB", _chkUsesHDB);
     
        _chkAdminApp = factory.createCheckBox(sectionClient, "Only accessible with administrative login", "Enabled", "adminApp");
        registerField("adminApp", _chkAdminApp);
       
        _comboBrowsingSecurity = factory.createCombo(sectionClient, "Browsing security", "browsingSecurity");
        registerField("browsingSecurity", _comboBrowsingSecurity);
     
      //WGADesignExportSection.create(form, toolkit, _editor, "menu:" + WGADesignEditor.ID + ".exportDesign");
     
      ((WGADesignEditor)_editor).createPageToolbar(form.getForm());
View Full Code Here

   
    ScrolledForm form = managedForm.getForm();
    FormToolkit toolkit = managedForm.getToolkit();
    toolkit.decorateFormHeading(form.getForm());
   
    WidgetFactory factory = new WidgetFactory(toolkit);
   
    form.setText(PAGE_TITLE);

    ColumnLayout layout = new ColumnLayout();
    layout.maxNumColumns = 2;
    form.getBody().setLayout(layout);
   
    // general section
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("General");

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 2;
        GridData comboLayout = new GridData(GridData.GRAB_HORIZONTAL);
        comboLayout.minimumWidth = 150;
       
        sectionLayout.numColumns = 3;
        sectionClient.setLayout(sectionLayout);
       
        _comboWGADistribution = factory.createCombo(sectionClient, "WGA Distribution:", "wgaDeployment");
        _comboWGADistribution.setLayoutData(comboLayout);
       
//      _btnConfigureWGAInstallations = new Button(sectionClient, SWT.NONE);
//      _btnConfigureWGAInstallations.setText("Configure distributions ...");
//      _btnConfigureWGAInstallations.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
//      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
//        handleConfigureWGADistributions();
//      }
//    });
     
    HyperlinkGroup group = new HyperlinkGroup(sectionClient.getDisplay());     
      ImageHyperlink linkConfigureDistributions = new ImageHyperlink(sectionClient, SWT.None);
      linkConfigureDistributions.setText("Configure distributions ...");
      linkConfigureDistributions.addHyperlinkListener(new HyperlinkAdapter() {
      public void linkActivated(HyperlinkEvent e) {
        handleConfigureWGADistributions();
      }
    });   
      group.add(linkConfigureDistributions);
     
      //factory.createCheckBox(sectionClient, "Output TML-Warnings on server console:", "enabled", "outputTMLWarningsOnConsole");
      //factory.addFiller(sectionClient);
//      factory.createCheckBox(sectionClient, "TML-Script debugger:", "enabled", "tmlScriptDebuggerEnabled");
//      factory.addFiller(sectionClient);
//     
//      factory.createCheckBox(sectionClient, "Java debugging:", "enabled", "javaDebuggerEnabled");
//      factory.addFiller(sectionClient);
     
    group = new HyperlinkGroup(sectionClient.getDisplay());     
      ImageHyperlink linkConfigureGlobalRuntimePreferences = new ImageHyperlink(sectionClient, SWT.None);
      linkConfigureGlobalRuntimePreferences.setText("Configure global runtime settings ...");
      linkConfigureGlobalRuntimePreferences.addHyperlinkListener(new HyperlinkAdapter() {
      public void linkActivated(HyperlinkEvent e) {
        openGeneralPreferencesPage();
      }
    });   
      group.add(linkConfigureGlobalRuntimePreferences);
     
     
      // libraries section
      section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.COMPACT);
    section.setText("Tomcat libraries");

        sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        sectionLayout = new GridLayout();       
        sectionLayout.numColumns = 2;
        sectionClient.setLayout(sectionLayout);
     
        GridData fillBoth = new GridData(GridData.FILL_BOTH);
        fillBoth.minimumHeight = 100;
        fillBoth.verticalSpan = 2;
        _lstTomcatLibraries = new List(sectionClient, SWT.BORDER|SWT.MULTI);
        _lstTomcatLibraries.setLayoutData(fillBoth);
        _lstTomcatLibraries.setItems(_model.getTomcatLibraryNames());
       
        _btnAddTomcatLibrary = toolkit.createButton(sectionClient, "add...", SWT.PUSH);
        _btnAddTomcatLibrary.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleAddTomcatLibrary();
      }
    });
       
        GridData btnLayout = new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_FILL, false, false);
        _btnAddTomcatLibrary.setLayoutData(btnLayout);
     
      _btnRemoveTomcatLibrary = toolkit.createButton(sectionClient, "remove...", SWT.PUSH);
     
      _btnRemoveTomcatLibrary.setLayoutData(btnLayout);       
      _btnRemoveTomcatLibrary.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleRemoveTomcatLibrary();
      }
    });
     
      // java section
      section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("Java");

        sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        sectionLayout = new GridLayout();       
        sectionLayout.numColumns = 2;
        sectionClient.setLayout(sectionLayout);
     
        _comboJVM = factory.createCombo(sectionClient, "Execution Environment:", "executionEnvironment");
        _comboJVM.setLayoutData(comboLayout);

//      _txtMinHeap = factory.createText(sectionClient, "Minimum java heap size (in MB):", "minHeapSize");
//      _txtMinHeap.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
//      //factory.addFiller(sectionClient);
View Full Code Here

TOP

Related Classes of de.innovationgate.eclipse.utils.ui.WidgetFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.