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; }
public void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData data = new GridData(GridData.FILL_HORIZONTAL); section.setLayoutData(data); section.setText(PDEUIMessages.IntroSection_sectionText); section.setDescription(PDEUIMessages.IntroSection_sectionDescription); boolean canCreateNew = TargetPlatformHelper.getTargetVersion() >= NEW_INTRO_SUPPORT_VERSION; Composite client = toolkit.createComposite(section); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, canCreateNew ? 3 : 2)); client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label = toolkit.createLabel(client, PDEUIMessages.IntroSection_introLabel, SWT.WRAP); GridData td = new GridData(); td.horizontalSpan = canCreateNew ? 3 : 2; label.setLayoutData(td); Label introLabel = toolkit.createLabel(client, PDEUIMessages.IntroSection_introInput); introLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fIntroCombo = new ComboPart(); fIntroCombo.createControl(client, toolkit, SWT.READ_ONLY); td = new GridData(GridData.FILL_HORIZONTAL); fIntroCombo.getControl().setLayoutData(td); loadManifestAndIntroIds(false); if (fAvailableIntroIds != null) fIntroCombo.setItems(fAvailableIntroIds); fIntroCombo.add(""); // $NON-NLS-1$ fIntroCombo.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleSelection(); } }); if (canCreateNew) { Button button = toolkit.createButton(client, PDEUIMessages.IntroSection_new, SWT.PUSH); button.setEnabled(isEditable()); button.setLayoutData(new GridData(GridData.FILL)); button.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleNewIntro(); } }); } fIntroCombo.getControl().setEnabled(isEditable()); toolkit.paintBordersFor(client); section.setClient(client); // Register to be notified when the model changes getModel().addModelChangedListener(this); }
private void createProgressBarConfig(Composite parent) { fAddBarButton = createButton(parent, fToolkit, PDEUIMessages.SplashSection_progressBar); fAddBarButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enable = fAddBarButton.getSelection(); getSplashInfo().addProgressBar(enable, false); updateFieldEnablement(); } }); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.verticalIndent = 5; data.horizontalSpan = F_NUM_COLUMNS; fAddBarButton.setLayoutData(data); fAddBarButton.setEnabled(isEditable()); Color foreground = fToolkit.getColors().getColor(IFormColors.TITLE); fBarControls[0] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressX); fBarControls[1] = fBarSpinners[0] = createSpinner(parent, fToolkit); fBarControls[2] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressY); fBarControls[3] = fBarSpinners[1] = createSpinner(parent, fToolkit); fBarControls[4] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressWidth); fBarControls[5] = fBarSpinners[2] = createSpinner(parent, fToolkit); fBarControls[6] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_progressHeight); fBarControls[7] = fBarSpinners[3] = createSpinner(parent, fToolkit); // Add tooltips to coordinate controls addOffsetTooltips(fBarControls); for (Spinner spinner : fBarSpinners) { spinner.setEnabled(isEditable()); spinner.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { applySpinners(true); } }); } Composite filler = fToolkit.createComposite(parent); filler.setLayout(new GridLayout()); GridData gd = new GridData(); gd.horizontalSpan = 2; filler.setLayoutData(gd); }
@Override public final void createContents(Composite parent) { // This is a hacked fix to ensure that the label columns on every details // page have the same width. SchemaDetails_translatable plus 11 pixels // represents the longest label on any field on any details page. This // occurs on SchemaStringAttributeDetails and 11 is the size of the // horizontal indent that contributes to the label's width. GC gc = new GC(parent); minLabelWeight = gc.textExtent(PDEUIMessages.SchemaDetails_translatable).x + 11; gc.dispose(); gc = null; parent.setLayout(FormLayoutFactory.createDetailsGridLayout(false, 1)); FormToolkit toolkit = getManagedForm().getToolkit(); fSection = toolkit.createSection(parent, Section.DESCRIPTION | ExpandableComposite.TITLE_BAR); fSection.clientVerticalSpacing = FormLayoutFactory.SECTION_HEADER_VERTICAL_SPACING; fSection.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData gd; if (fShowDescription) gd = new GridData(GridData.FILL_BOTH); else gd = new GridData(GridData.FILL_HORIZONTAL); fSection.setLayoutData(gd); // Align the master and details section headers (misalignment caused // by section toolbar icons) getPage().alignSectionHeaders(fElementSection.getSection(), fSection); Composite client = toolkit.createComposite(fSection); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 3)); createDetails(client); if (fShowDescription) createDescription(client, toolkit); // If the DTD Approximation section was requested, instantiate it and create it's contents // on the same parent Composite if (fShowDTD) { fDtdSection = new SchemaDtdDetailsSection(); fDtdSection.initialize(getManagedForm()); fDtdSection.createContents(parent); } toolkit.paintBordersFor(client); fSection.setClient(client); markDetailsPart(fSection); if (fShowDescription) fDescriptionViewer.createUIListeners(); hookListeners(); }
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; }
protected Button[] createTrueFalseButtons(Composite parent, FormToolkit toolkit, int colSpan) { Composite comp = toolkit.createComposite(parent, SWT.NONE); GridLayout gl = new GridLayout(2, false); gl.marginHeight = gl.marginWidth = 0; comp.setLayout(gl); GridData gd = new GridData(GridData.FILL_HORIZONTAL); gd.horizontalSpan = colSpan; gd.horizontalIndent = FormLayoutFactory.CONTROL_HORIZONTAL_INDENT; comp.setLayoutData(gd); Button tButton = toolkit.createButton(comp, BOOLS[0], SWT.RADIO); Button fButton = toolkit.createButton(comp, BOOLS[1], SWT.RADIO); gd = new GridData(); gd.horizontalIndent = 20; fButton.setLayoutData(gd); return new Button[] {tButton, fButton}; }
/* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit) */ protected void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData sectionData = new GridData(GridData.FILL_BOTH); sectionData.verticalSpan = 2; section.setLayoutData(sectionData); Composite container = createClientContainer(section, 2, toolkit); createViewerPartControl(container, SWT.MULTI, 2, toolkit); container.setLayoutData(new GridData(GridData.FILL_BOTH)); createOptionalDependenciesButton(container); TablePart tablePart = getTablePart(); fPluginTable = tablePart.getTableViewer(); fPluginTable.setContentProvider(new ContentProvider()); fPluginTable.setLabelProvider(PDEPlugin.getDefault().getLabelProvider()); fPluginTable.setComparator( new ViewerComparator() { public int compare(Viewer viewer, Object e1, Object e2) { IProductPlugin p1 = (IProductPlugin) e1; IProductPlugin p2 = (IProductPlugin) e2; return super.compare(viewer, p1.getId(), p2.getId()); } }); GridData data = (GridData) tablePart.getControl().getLayoutData(); data.minimumWidth = 200; fPluginTable.setInput(getProduct()); tablePart.setButtonEnabled(0, isEditable()); tablePart.setButtonEnabled(1, isEditable()); tablePart.setButtonEnabled(2, isEditable()); // remove buttons will be updated on refresh tablePart.setButtonEnabled(5, isEditable()); toolkit.paintBordersFor(container); section.setClient(container); section.setText(PDEUIMessages.Product_PluginSection_title); section.setDescription(PDEUIMessages.Product_PluginSection_desc); getModel().addModelChangedListener(this); createSectionToolbar(section, toolkit); }
/* (non-Javadoc) * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit) */ protected void createClient(Section section, FormToolkit toolkit) { section.setText(PDEUIMessages.GeneralInfoSection_title); section.setDescription(PDEUIMessages.GeneralInfoSection_desc); section.setLayout(FormLayoutFactory.createClearTableWrapLayout(false, 1)); TableWrapData data = new TableWrapData(TableWrapData.FILL_GRAB); data.colspan = 2; section.setLayoutData(data); Composite client = toolkit.createComposite(section); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, NUM_COLUMNS)); IActionBars actionBars = getPage().getPDEEditor().getEditorSite().getActionBars(); // general section createIdEntry(client, toolkit, actionBars); createVersionEntry(client, toolkit, actionBars); createNameEntry(client, toolkit, actionBars); createLaunchersOption(client, toolkit); toolkit.paintBordersFor(client); section.setClient(client); getModel().addModelChangedListener(this); }
private Composite createUISectionContainer(Composite parent) { Composite client = fToolkit.createComposite(fSection); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, F_NUM_COLUMNS)); client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); return client; }
@Override protected void createClient(Section section, FormToolkit toolkit) { section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData data = new GridData(GridData.FILL_BOTH); section.setLayoutData(data); section.setText(PDEUIMessages.ArgumentsSection_title); section.setDescription(PDEUIMessages.ArgumentsSection_desc); Composite client = toolkit.createComposite(section); client.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 1)); client.setLayoutData(new GridData(GridData.FILL_BOTH)); fTabFolder = new CTabFolder(client, SWT.FLAT | SWT.TOP); toolkit.adapt(fTabFolder, true, true); GridData gd = new GridData(GridData.HORIZONTAL_ALIGN_FILL); fTabFolder.setLayoutData(gd); gd.heightHint = 2; toolkit.getColors().initializeSectionToolBarColors(); Color selectedColor = toolkit.getColors().getColor(IFormColors.TB_BG); fTabFolder.setSelectionBackground( new Color[] {selectedColor, toolkit.getColors().getBackground()}, new int[] {100}, true); fTabFolder.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { if (fProgramArgs.isDirty()) fProgramArgs.commit(); if (fVMArgs.isDirty()) fVMArgs.commit(); refresh(); fArchCombo.select(fLastArch[fLastTab]); } }); createTabs(); Composite archParent = toolkit.createComposite(client); archParent.setLayout(FormLayoutFactory.createSectionClientGridLayout(false, 2)); archParent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); toolkit.createLabel(archParent, PDEUIMessages.ArgumentsSection_architecture); fArchCombo = new ComboViewerPart(); fArchCombo.createControl(archParent, toolkit, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY); fArchCombo.getControl().setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false)); fArchCombo.setItems(TAB_ARCHLABELS); Control archComboControl = fArchCombo.getControl(); if (archComboControl instanceof Combo) ((Combo) archComboControl).select(fLastArch[fLastTab]); else ((CCombo) archComboControl).select(fLastArch[fLastTab]); fArchCombo.addSelectionChangedListener( new ISelectionChangedListener() { @Override public void selectionChanged(SelectionChangedEvent event) { if (fProgramArgs.isDirty()) fProgramArgs.commit(); if (fVMArgs.isDirty()) fVMArgs.commit(); // remember the change in combo for currently selected platform Control fArchComboControl = fArchCombo.getControl(); if (fArchComboControl instanceof Combo) fLastArch[fLastTab] = ((Combo) fArchComboControl).getSelectionIndex(); else fLastArch[fLastTab] = ((CCombo) fArchComboControl).getSelectionIndex(); refresh(); } }); IActionBars actionBars = getPage().getPDEEditor().getEditorSite().getActionBars(); fProgramArgs = new FormEntry( client, toolkit, PDEUIMessages.ArgumentsSection_program, SWT.MULTI | SWT.WRAP); fProgramArgs.getText().setLayoutData(new GridData(GridData.FILL_BOTH)); fProgramArgs.setFormEntryListener( new FormEntryAdapter(this, actionBars) { @Override public void textValueChanged(FormEntry entry) { IArgumentsInfo info = getLauncherArguments(); info.setProgramArguments(entry.getValue().trim(), fLastTab, fLastArch[fLastTab]); updateArgumentPreview(info); } }); fProgramArgs.setEditable(isEditable()); fVMArgs = new FormEntry(client, toolkit, PDEUIMessages.ArgumentsSection_vm, SWT.MULTI | SWT.WRAP); fVMArgs.getText().setLayoutData(new GridData(GridData.FILL_BOTH)); fVMArgs.setFormEntryListener( new FormEntryAdapter(this, actionBars) { @Override public void textValueChanged(FormEntry entry) { IArgumentsInfo info = getLauncherArguments(); info.setVMArguments(entry.getValue().trim(), fLastTab, fLastArch[fLastTab]); updateArgumentPreview(info); } }); fVMArgs.setEditable(isEditable()); fPreviewArgs = new FormEntry( client, toolkit, PDEUIMessages.ArgumentsSection_preview, SWT.MULTI | SWT.WRAP); fPreviewArgs.getText().setLayoutData(new GridData(GridData.FILL_BOTH)); fPreviewArgs.setEditable(false); toolkit.paintBordersFor(client); section.setClient(client); // Register to be notified when the model changes getModel().addModelChangedListener(this); }