Package org.eclipse.ui.forms.widgets

Examples of org.eclipse.ui.forms.widgets.Section


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

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 4;
       
        GridData prefSize = new GridData();
View Full Code Here


          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");
 
          sectionClient = toolkit.createComposite(section);
          section.setClient(sectionClient);
          sectionLayout = new GridLayout();                                     
          sectionLayout.numColumns = 2;
          sectionClient.setLayout(sectionLayout);
         
View Full Code Here

        ColumnLayout layout = new ColumnLayout();
        layout.maxNumColumns = 2;
        form.getBody().setLayout(layout);

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

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 4;

        GridData prefSize = new GridData();
        prefSize.widthHint = 500;

        sectionLayout.numColumns = 1;
        sectionClient.setLayout(sectionLayout);

        ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT);
        ToolBar toolbar = toolBarManager.createControl(section);

        Action action1 = new Action("refresh", Plugin.getDefault().getImageRegistry().getDescriptor(Plugin.IMAGE_REFRESH)) {
            public void run() {
                try {
                    refresh();
                }
                catch (IOException e) {
                    // TODO Auto-generated catch block
                    e.printStackTrace();
                }
            }

        };
        toolBarManager.add(action1);

        toolBarManager.update(true);
        section.setTextClient(toolbar);

        _directAccessibleFilesModel = new DirectAccessibleTMLModulModel(getDirectAccessibleFiles());

        _tableControl = new EditableTableControl<IFile>(sectionClient, SWT.NONE) {
View Full Code Here

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

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 4;
       
        GridData prefSize = new GridData();
View Full Code Here

      tblLayoutData.minimumHeight = 200;
       
      GridData btnLayout = new GridData(GridData.HORIZONTAL_ALIGN_FILL, GridData.VERTICAL_ALIGN_FILL, true, false);
     
        // mediakeys section
    Section section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("Media Keys");

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);     
        sectionClient.setLayout(sectionLayout);   
       
        // create Table media keys
        _tblMediaKeys = toolkit.createTable(sectionClient, SWT.BORDER|SWT.FULL_SELECTION);
        _tblMediaKeys.setHeaderVisible(true);         
        _tblMediaKeys.setLayoutData(GridDataFactory.copyData(tblLayoutData));  
        registerField("mediaKeys", _tblMediaKeys);
               
        _mediaKeyColumn = new TableColumn(_tblMediaKeys, SWT.NONE);               
        _mediaKeyColumn.setText("Key");
        _mediaKeyColumn.setWidth((int)(tableWidth * 0.25));
       
        _mediaMimeTypeColumn = new TableColumn(_tblMediaKeys, SWT.NONE)
        _mediaMimeTypeColumn.setText("Mime type");
        _mediaMimeTypeColumn.setWidth((int)(tableWidth * 0.25));
       
        _mediaBinaryColumn = new TableColumn(_tblMediaKeys, SWT.NONE)
        _mediaBinaryColumn.setText("Binary output");
        _mediaBinaryColumn.setWidth((int)(tableWidth * 0.25));

       
        _mediaHTTPLoginColumn = new TableColumn(_tblMediaKeys, SWT.NONE)
        _mediaHTTPLoginColumn.setText("Use HTTP login");
        _mediaHTTPLoginColumn.setWidth((int)(tableWidth * 0.25));

        _mediaKeysModel = new MediaKeysModel(_model.getMediaKeys());
        _mediaKeysModel.addListener(new BeanListTableModelListener() {

      public void add(Object bean) {
        _model.fireModelChanged();         
      }

      public void remove(Object bean) {
        _model.fireModelChanged();       
      }

      public void update(Object bean) {
        _model.fireModelChanged();         
      }
     
      @SuppressWarnings("unchecked")
      public void refresh(List beans) {
        _model.fireModelChanged();       
      }
         
        });
       
        _tblViewerMediaKeys = new TableViewer(_tblMediaKeys);
       
        CellEditor[] editors = new CellEditor[4];
        editors[0] = new TextCellEditor(_tblMediaKeys);
        editors[1] = new TextCellEditor(_tblMediaKeys);
        editors[2] = new CheckboxCellEditor(_tblMediaKeys, SWT.CENTER);       
        editors[3] = new CheckboxCellEditor(_tblMediaKeys, SWT.CENTER);
        _tblViewerMediaKeys.setCellEditors(editors);
       
        BeanListTableModelCellModifier modifier = new BeanListTableModelCellModifier(_tblViewerMediaKeys, _mediaKeysModel);
        modifier.setEditMode(2, BeanListTableModelCellModifier.EDIT_MODE_ON_SINGLE_CLICK);
        modifier.setEditMode(3, BeanListTableModelCellModifier.EDIT_MODE_ON_SINGLE_CLICK);
        _tblViewerMediaKeys.setCellModifier(modifier);
       
        _tblViewerMediaKeys.setContentProvider(new BeanListTableModelContentProvider());
        _tblViewerMediaKeys.setLabelProvider(new BeanListTableModelLabelProvider(_mediaKeysModel));
        _tblViewerMediaKeys.setInput(_mediaKeysModel)
       

        _btnAddMediaKey = toolkit.createButton(sectionClient, "add", SWT.PUSH);
        _btnAddMediaKey.setLayoutData(btnLayout);
        _btnAddMediaKey.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleAddMediaKey();
      }

    });
       
        _btnRemoveMediaKey = toolkit.createButton(sectionClient, "remove", SWT.PUSH);
        _btnRemoveMediaKey.setLayoutData(btnLayout);
        _btnRemoveMediaKey.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleRemoveMediaKey();
      }
    });
       
    // encoder section
    section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.COMPACT);
    section.setText("Encoder Mappings");

        sectionClient = toolkit.createComposite(section);
        sectionClient.setLayout(sectionLayout);
        section.setClient(sectionClient);
       
        // create Table encoder mappings
        _tblEncoderMappings = toolkit.createTable(sectionClient, SWT.BORDER|SWT.FULL_SELECTION);
        _tblEncoderMappings.setHeaderVisible(true);                 
        _tblEncoderMappings.setLayoutData(GridDataFactory.copyData(tblLayoutData));   
        registerField("encoderMappings", _tblEncoderMappings);
         
        _encoderNameColumn = new TableColumn(_tblEncoderMappings, SWT.NONE)
        _encoderNameColumn.setText("Encoder name");
        _encoderNameColumn.setWidth((int)(tableWidth * 0.5));
       
        _encoderImplClassColumn = new TableColumn(_tblEncoderMappings, SWT.NONE);
        _encoderImplClassColumn.setText("Implementation class");
        _encoderImplClassColumn.setWidth((int)(tableWidth * 0.5));         

        _encoderMappingsModel = new EncoderMappingsModel(_model.getEncoderMappings());
        _encoderMappingsModel.addListener(new BeanListTableModelListener() {

      public void add(Object bean) {
        _model.fireModelChanged();         
      }

      public void remove(Object bean) {
        _model.fireModelChanged();       
      }

      public void update(Object bean) {
        _model.fireModelChanged();         
      }     

      @SuppressWarnings("unchecked")
      public void refresh(List beans) {
        _model.fireModelChanged();       
      }
         
        });
       
        _tblViewerEncoderMappings = new TableViewer(_tblEncoderMappings);
       
        // text editors for both columns
        editors = new CellEditor[2];
        editors[0] = new TextCellEditor(_tblEncoderMappings);
        editors[1] = new TextCellEditor(_tblEncoderMappings);         
        _tblViewerEncoderMappings.setCellEditors(editors);
       
        _tblViewerEncoderMappings.setCellModifier(new BeanListTableModelCellModifier(_tblViewerEncoderMappings, _encoderMappingsModel));                                       
        _tblViewerEncoderMappings.setContentProvider(new BeanListTableModelContentProvider());
        _tblViewerEncoderMappings.setLabelProvider(new BeanListTableModelLabelProvider(_encoderMappingsModel));
        _tblViewerEncoderMappings.setInput(_encoderMappingsModel)
       
        _btnAddEncoderMapping = toolkit.createButton(sectionClient, "add", SWT.PUSH);
        _btnAddEncoderMapping.setLayoutData(btnLayout);
        _btnAddEncoderMapping.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleAddEncoderMapping();
      }

    });
       
        _btnRemoveEncoderMapping = toolkit.createButton(sectionClient, "remove", SWT.PUSH);
        _btnRemoveEncoderMapping.setLayoutData(btnLayout);
      _btnRemoveEncoderMapping.addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleRemoveEncoderMapping();
      }
    });

     
      // element section
    section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.COMPACT);
    section.setText("Element Mappings");

        sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);     
        sectionLayout.numColumns = 2;
        sectionClient.setLayout(sectionLayout);   
       
        // create Table element mappings
        _tblElementMappings = toolkit.createTable(sectionClient, SWT.BORDER|SWT.FULL_SELECTION);
View Full Code Here

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

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 4;

        sectionLayout.numColumns = 1;
        sectionClient.setLayout(sectionLayout);   
       
        _tablePublisherOptions = new EditableTableControl<PublisherOption>(sectionClient,SWT.NONE, SWT.FULL_SELECTION|SWT.BORDER);
        GridData tablePublisherOptionsLayoutData = new GridData(GridData.FILL_BOTH);
        tablePublisherOptionsLayoutData.minimumHeight = 200;
        _tablePublisherOptions.setLayoutData(tablePublisherOptionsLayoutData);
       
    // create columns
    String[] columnNames = new String[] { "Name", "Value" };
   
    // create model
    _publisherOptionsModel = new PublisherOptionsModel(_model.getPublisherOptions());
   
    _publisherOptionsModel.addListener(new BeanListTableModelListener() {

      public void add(Object bean) {
        _model.fireModelChanged();         
      }

      public void remove(Object bean) {
        _model.fireModelChanged();       
      }

      public void update(Object bean) {
        _model.fireModelChanged();         
      }     

      @SuppressWarnings("unchecked")
      public void refresh(List beans) {
        //_model.fireModelChanged();       
      }
         
        });
   
    _tablePublisherOptions.init(columnNames, _publisherOptionsModel);

   
    CellEditor[] editors = new CellEditor[2];
        editors[0] = new TextCellEditor(_tablePublisherOptions.getTable());
        editors[1] = new TextCellEditor(_tablePublisherOptions.getTable());
    _tablePublisherOptions.getTableViewer().setCellEditors(editors);
   
    toolkit.adapt(_tablePublisherOptions.getButton(EditableTableControl.BUTTON_ADD), true, true);
    toolkit.adapt(_tablePublisherOptions.getButton(EditableTableControl.BUTTON_REMOVE), true, true);
   
    _tablePublisherOptions.getButton(EditableTableControl.BUTTON_ADD).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleAddPublisherOption();
      }
    });

    _tablePublisherOptions.getButton(EditableTableControl.BUTTON_REMOVE).addSelectionListener(new org.eclipse.swt.events.SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        handleRemovePublisherOption();
      }
    });
   
    _tablePublisherOptions.getTable().addSelectionListener(new SelectionAdapter() {
      public void widgetSelected(org.eclipse.swt.events.SelectionEvent e) {
        if (_tablePublisherOptions.getTable().getSelectionCount() > 0) {
          PublisherOption option = (PublisherOption) _tablePublisherOptions.getTable().getSelection()[0].getData();
          if (_publisherOptionsModel.isBeanEditable(option)) {
            _tablePublisherOptions.getButton(EditableTableControl.BUTTON_REMOVE).setEnabled(true);
          } else {
            _tablePublisherOptions.getButton(EditableTableControl.BUTTON_REMOVE).setEnabled(false);
          }
        }
      }
    });
       
       
    // remote actions section
    section = toolkit.createSection(form.getBody(), Section.DESCRIPTION|Section.TITLE_BAR|Section.TWISTIE|Section.EXPANDED);
    section.setText("Remote Actions");

        sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        sectionLayout = new GridLayout();
        fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 4;
       
        GridData prefSize = new GridData();
View Full Code Here

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

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 4;
       
        GridData prefSize = new GridData();
View Full Code Here

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

        Composite sectionClient = toolkit.createComposite(section);
        section.setClient(sectionClient);
        GridLayout sectionLayout = new GridLayout();
        GridData fillHSpan = new GridData(GridData.FILL_HORIZONTAL);
        fillHSpan.horizontalSpan = 4;
       
        GridData prefSize = new GridData();
View Full Code Here

        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());              
View Full Code Here

    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");
View Full Code Here

TOP

Related Classes of org.eclipse.ui.forms.widgets.Section

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.