protected Composite createMaxOccurComp(Composite parent, FormToolkit toolkit) { fMaxLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_maxOccurLabel); fMaxLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); Composite comp = toolkit.createComposite(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; GridLayout layout = new GridLayout(3, false); layout.marginHeight = layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(gd); fMaxOccurSpinner = new Spinner(comp, SWT.BORDER); fMaxOccurSpinner.setMinimum(1); fMaxOccurSpinner.setMaximum(999); fMaxOccurSpinner.setIncrement(1); fUnboundSelect = toolkit.createButton(comp, PDEUIMessages.AbstractSchemaDetails_unboundedButton, SWT.CHECK); gd = new GridData(); gd.horizontalIndent = 10; fUnboundSelect.setLayoutData(gd); fUnboundSelect.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (blockListeners()) return; fMaxOccurSpinner.setEnabled(!fUnboundSelect.getSelection() && isEditableElement()); } }); return comp; }
protected Composite createMinOccurComp(Composite parent, FormToolkit toolkit) { fMinLabel = toolkit.createLabel(parent, PDEUIMessages.AbstractSchemaDetails_minOccurLabel); fMinLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); Composite comp = toolkit.createComposite(parent); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = 2; GridLayout layout = new GridLayout(); layout.marginHeight = layout.marginWidth = 0; comp.setLayout(layout); comp.setLayoutData(gd); fMinOccurSpinner = new Spinner(comp, SWT.BORDER); fMinOccurSpinner.setMinimum(0); fMinOccurSpinner.setMaximum(999); return comp; }
private void createDescription(Composite container, FormToolkit toolkit) { Label label = toolkit.createLabel(container, PDEUIMessages.AbstractSchemaDetails_descriptionLabel); GridData gd = new GridData(GridData.VERTICAL_ALIGN_BEGINNING); gd.horizontalSpan = 3; label.setLayoutData(gd); label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fDescriptionViewer = new PDESourceViewer(getPage()); gd = new GridData(GridData.FILL_BOTH); gd.heightHint = 75; gd.widthHint = 60; gd.horizontalSpan = 3; gd.horizontalIndent = 1; /* * Needed to align vertically with form entry field and allow space * for a possible field decoration * commented out for now since fields are already grossly misaligned (see bug 196879) * commenting out temporarily makes the alignment better on Element details and Attribute details * but worse on RootElement details */ // gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT; fDescriptionViewer.createUI(container, gd); fDescriptionViewer .getDocument() .addDocumentListener( new IDocumentListener() { @Override public void documentChanged(DocumentEvent event) { if (blockListeners()) return; if (fSchemaObject != null) { // Get the text from the event IDocument document = event.getDocument(); if (document == null) { return; } // Get the text from the event String text = document.get().trim(); updateObjectDescription(text); } } @Override public void documentAboutToBeChanged(DocumentEvent event) {} }); }