private void createSearchSection(Composite editorComposite, FormToolkit toolkit) { Section section = toolkit.createSection( editorComposite, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); section.setText("Search"); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); section.addExpansionListener( new IExpansionListener() { public void expansionStateChanging(ExpansionEvent e) { m_sform.reflow(true); } public void expansionStateChanged(ExpansionEvent e) { m_sform.reflow(true); } }); Composite sectionClient = toolkit.createComposite(section); section.setClient(sectionClient); GridLayout layout = new GridLayout(); layout.numColumns = 2; sectionClient.setLayout(layout); sectionClient.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Label label_freeSearch = toolkit.createLabel(sectionClient, "Query", SWT.NONE); label_freeSearch.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_text_freeSearch = toolkit.createText(sectionClient, new String(), SWT.BORDER); m_text_freeSearch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); m_text_freeSearch.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { firePropertyChange(IEditorPart.PROP_DIRTY); } }); Label label_state = toolkit.createLabel(sectionClient, "State"); label_state.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_news_state = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_news_state.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); try { m_combo_news_state.setItems(FieldDataHelper.getStates()); } catch (Exception e1) { m_combo_news_state.setEnabled(false); label_state.setEnabled(false); } }
public void createControl(Composite parent) { toolkit = new FormToolkit(parent.getDisplay()); int borderStyle = toolkit.getBorderStyle() == SWT.BORDER ? SWT.NULL : SWT.BORDER; container = new Composite(parent, borderStyle); FillLayout flayout = new FillLayout(); flayout.marginWidth = 1; flayout.marginHeight = 1; container.setLayout(flayout); formText = new ScrolledFormText(container, SWT.V_SCROLL | SWT.H_SCROLL, false); if (borderStyle == SWT.NULL) { formText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER); toolkit.paintBordersFor(container); } FormText ftext = toolkit.createFormText(formText, false); formText.setFormText(ftext); formText.setExpandHorizontal(true); formText.setExpandVertical(true); formText.setBackground(toolkit.getColors().getBackground()); formText.setForeground(toolkit.getColors().getForeground()); ftext.marginWidth = 2; ftext.marginHeight = 2; ftext.setHyperlinkSettings(toolkit.getHyperlinkGroup()); formText.addDisposeListener( new DisposeListener() { public void widgetDisposed(DisposeEvent e) { if (toolkit != null) { toolkit.dispose(); toolkit = null; } } }); if (text != null) formText.setText(text); }
private void createSubSection( final ChangeDetail changeDetail, final PatchSetDetail patchSetDetail, final PatchSetPublishDetail publishDetail, Section section) { int style = ExpandableComposite.TWISTIE | ExpandableComposite.CLIENT_INDENT | ExpandableComposite.LEFT_TEXT_CLIENT_ALIGNMENT; if (changeDetail.isCurrentPatchSet(patchSetDetail)) { style |= ExpandableComposite.EXPANDED; } final Section subSection = toolkit.createSection(composite, style); GridDataFactory.fillDefaults().grab(true, false).applyTo(subSection); subSection.setText(NLS.bind("Patch Set {0}", patchSetDetail.getPatchSet().getId().get())); subSection.setTitleBarForeground(toolkit.getColors().getColor(IFormColors.TITLE)); addTextClient(toolkit, subSection, "", false); // $NON-NLS-1$ updateTextClient(subSection, patchSetDetail, false); if (subSection.isExpanded()) { createSubSectionContents(changeDetail, patchSetDetail, publishDetail, subSection); } subSection.addExpansionListener( new ExpansionAdapter() { @Override public void expansionStateChanged(ExpansionEvent e) { if (subSection.getClient() == null) { createSubSectionContents(changeDetail, patchSetDetail, publishDetail, subSection); } } }); }
private void createUI22SmoothGradient(final Composite parent) { /* * image: gradient */ _iconGradient = new CLabel(parent, SWT.NONE); GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconGradient); _iconGradient.setBackground(_tk.getColors().getBackground()); _iconGradient.setImage(_imageGradient); /* * label: smooth gradient */ final Label label = _tk.createLabel(parent, Messages.TourChart_Smoothing_Label_GradientSmoothing, SWT.CHECK); GridDataFactory.fillDefaults() // .align(SWT.FILL, SWT.CENTER) .applyTo(label); label.setToolTipText(Messages.TourChart_Smoothing_Label_GradientSmoothing_Tooltip); /* * spinner: gradient tau */ _spinnerGradientTau = new Spinner(parent, SWT.BORDER); GridDataFactory.fillDefaults() // .align(SWT.BEGINNING, SWT.FILL) .applyTo(_spinnerGradientTau); _spinnerGradientTau.setDigits(1); _spinnerGradientTau.setMinimum(1); _spinnerGradientTau.setMaximum(MAX_TAU); _spinnerGradientTau.addSelectionListener(_selectionListener); _spinnerGradientTau.addMouseWheelListener(_spinnerMouseWheelListener); }
private void createUI24SmoothPulse(final Composite parent) { /* * image: pulse */ _iconPulse = new CLabel(parent, SWT.NONE); GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconPulse); _iconPulse.setBackground(_tk.getColors().getBackground()); _iconPulse.setImage(_imagePulse); /* * checkbox: smooth speed */ _chkIsPulseSmoothing = _tk.createButton(parent, Messages.TourChart_Smoothing_Checkbox_IsPulseSmoothing, SWT.CHECK); GridDataFactory.fillDefaults() // .align(SWT.FILL, SWT.CENTER) .applyTo(_chkIsPulseSmoothing); _chkIsPulseSmoothing.addSelectionListener(_selectionListener); _chkIsPulseSmoothing.setToolTipText( Messages.TourChart_Smoothing_Checkbox_IsPulseSmoothing_Tooltip); /* * spinner: speed tau */ _spinnerPulseTau = new Spinner(parent, SWT.BORDER); GridDataFactory.fillDefaults() // .align(SWT.BEGINNING, SWT.FILL) .applyTo(_spinnerPulseTau); _spinnerPulseTau.setDigits(1); _spinnerPulseTau.setMinimum(1); _spinnerPulseTau.setMaximum(MAX_TAU); _spinnerPulseTau.addSelectionListener(_selectionListener); _spinnerPulseTau.addMouseWheelListener(_spinnerMouseWheelListener); }
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; }
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); composite.setLayout(new FillLayout()); toolkit = new FormToolkit(composite.getDisplay()); form = toolkit.createScrolledForm(composite); FormColors colors = toolkit.getColors(); colors.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); toolkit.getHyperlinkGroup().setHyperlinkUnderlineMode(HyperlinkSettings.UNDERLINE_HOVER); // // toolkit.getHyperlinkGroup().setActiveForeground(Display.getCurrent().getSystemColor(SWT.COLOR_BLUE)); // toolkit.getHyperlinkGroup().setForeground(colors.getColor("Categorytitle")); toolkit .getHyperlinkGroup() .setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); body = form.getBody(); GridLayout bodyLayout = new GridLayout(); bodyLayout.verticalSpacing = 3; body.setLayout(bodyLayout); // body.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_INFO_BACKGROUND)); toolkit.paintBordersFor(body); return composite; }
private void createLabel(FormToolkit toolkit, Composite composite, String label) { Label portLabel = toolkit.createLabel(composite, label); portLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalIndent = 20; data.widthHint = 20; portLabel.setLayoutData(data); }
private void createTagsArea(Composite parent, FormToolkit toolkit, int span) { Composite tagArea = toolkit.createComposite(parent); GridLayoutFactory.fillDefaults().numColumns(2).equalWidth(false).applyTo(tagArea); GridDataFactory.fillDefaults().span(span, 1).grab(true, false).applyTo(tagArea); toolkit .createLabel(tagArea, UIText.CommitEditorPage_LabelTags) .setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE)); fillTags(tagArea, toolkit); }
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); }
@Override public void createPartControl(Composite parent) { Composite container = new Composite(parent, SWT.NONE); container.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE)); container.setLayout(new FormLayout()); FormToolkit toolkit = new FormToolkit(container.getDisplay()); Form form = toolkit.createForm(container); FormData data = new FormData(); data.top = new FormAttachment(0, 20); data.left = new FormAttachment(50, -100); data.right = new FormAttachment(50, 100); data.bottom = new FormAttachment(100, -20); form.setLayoutData(data); // form.setText(Messages.IntroTitle); FillLayout layout = new FillLayout(); layout.marginHeight = layout.marginWidth = 5; form.getBody().setLayout(layout); FormText text = toolkit.createFormText(form.getBody(), true); StringBuilder buf = new StringBuilder(); buf.append("<form>"); // $NON-NLS-1$ buf.append("<p><img href=\"logo\"/></p>"); // $NON-NLS-1$ buf.append("<p><span color=\"header\" font=\"header\">") // $NON-NLS-1$ .append(Messages.IntroTitle) // .append("</span></p>"); // $NON-NLS-1$ addLink(buf, "action:open", Messages.IntroOpenFile, Messages.IntroOpenFileText); // $NON-NLS-1$ addLink(buf, "action:new", Messages.IntroNewFile, Messages.IntroNewFileText); // $NON-NLS-1$ addLink( buf, "action:sample", Messages.IntroOpenSample, Messages.IntroOpenSampleText); // $NON-NLS-1$ addLink( buf, "action:daxsample", Messages.IntroOpenDaxSample, Messages.IntroOpenDaxSampleText); // $NON-NLS-1$ addLink( buf, "http://buchen.github.com/portfolio/new_and_noteworthy.html", //$NON-NLS-1$ Messages.IntroReadNews, Messages.IntroReadNewsText); buf.append("</form>"); // $NON-NLS-1$ text.setText(buf.toString(), true, false); text.setImage("logo", PortfolioPlugin.image(PortfolioPlugin.IMG_LOGO)); // $NON-NLS-1$ text.setColor("header", toolkit.getColors().getColor(IFormColors.TITLE)); // $NON-NLS-1$ text.setFont("header", JFaceResources.getHeaderFont()); // $NON-NLS-1$ text.addHyperlinkListener(this); }
private void createProgressMessageConfig(Composite parent) { fAddMessageButton = createButton(parent, fToolkit, PDEUIMessages.SplashSection_progressMessage); fAddMessageButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { boolean enable = fAddMessageButton.getSelection(); getSplashInfo().addProgressMessage(enable, false); updateFieldEnablement(); } }); fAddMessageButton.setEnabled(false); Color foreground = fToolkit.getColors().getColor(IFormColors.TITLE); fMessageControls[0] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageX); fMessageControls[1] = fMessageSpinners[0] = createSpinner(parent, fToolkit); fMessageControls[2] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageY); fMessageControls[3] = fMessageSpinners[1] = createSpinner(parent, fToolkit); fMessageControls[4] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageWidth); fMessageControls[5] = fMessageSpinners[2] = createSpinner(parent, fToolkit); fMessageControls[6] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageHeight); fMessageControls[7] = fMessageSpinners[3] = createSpinner(parent, fToolkit); fMessageControls[8] = createLabel(parent, fToolkit, foreground, PDEUIMessages.SplashSection_messageColor); fColorSelector = new ColorSelector(parent); fColorSelector.addListener( new IPropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent event) { if (!event.getNewValue().equals(event.getOldValue())) applyColor(); } }); fToolkit.adapt(fColorSelector.getButton(), true, true); fMessageControls[9] = fColorSelector.getButton(); // Add tooltips to coordinate controls addOffsetTooltips(fMessageControls); for (Spinner spinner : fMessageSpinners) { spinner.setEnabled(isEditable()); spinner.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { applySpinners(false); } }); } }
public IExtendableIntValueView create( String text, FormToolkit toolkit, final IInteractiveTrait trait) { final Button favoredButton = toolkit.createButton(parent, null, SWT.TOGGLE); initListening(trait, favoredButton); Color background = toolkit.getColors().getBackground(); createLabel(background, createGridData()).setText(text); final CanvasIntValueDisplay view = new CanvasIntValueDisplay( background, parent, passiveImage, activeImage, trait.getMaximalValue()); new TraitPresenter().initPresentation(trait, view); return view; }
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); }
private void createHeaderArea(Composite parent, FormToolkit toolkit, int span) { RevCommit commit = getCommit().getRevCommit(); Composite top = toolkit.createComposite(parent); GridDataFactory.fillDefaults().grab(true, false).span(span, 1).applyTo(top); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(top); Composite userArea = toolkit.createComposite(top); GridLayoutFactory.fillDefaults().spacing(2, 2).numColumns(1).applyTo(userArea); GridDataFactory.fillDefaults().grab(true, false).applyTo(userArea); PersonIdent author = commit.getAuthorIdent(); if (author != null) createUserArea(userArea, toolkit, author, true); PersonIdent committer = commit.getCommitterIdent(); if (committer != null && !committer.equals(author)) createUserArea(userArea, toolkit, committer, false); int count = commit.getParentCount(); if (count > 0) { Composite parents = toolkit.createComposite(top); GridLayoutFactory.fillDefaults().spacing(2, 2).numColumns(2).applyTo(parents); GridDataFactory.fillDefaults().grab(false, false).applyTo(parents); for (int i = 0; i < count; i++) { final RevCommit parentCommit = commit.getParent(i); toolkit .createLabel(parents, UIText.CommitEditorPage_LabelParent) .setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE)); final Hyperlink link = toolkit.createHyperlink( parents, parentCommit.abbreviate(PARENT_LENGTH).name(), SWT.NONE); link.addHyperlinkListener( new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { try { CommitEditor.open( new RepositoryCommit(getCommit().getRepository(), parentCommit)); if ((e.getStateMask() & SWT.MOD1) != 0) getEditor().close(false); } catch (PartInitException e1) { Activator.logError("Error opening commit editor", e1); // $NON-NLS-1$ } } }); } } createTagsArea(userArea, toolkit, 2); }
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; }
@Override protected void createClient(Section section, FormToolkit toolkit) { initializeAttributes(); section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1)); GridData data = new GridData(GridData.FILL_HORIZONTAL); data.horizontalSpan = 2; section.setLayoutData(data); section.setText(Messages.DSOptionsSection_title); section.setDescription(Messages.DSOptionsSection_description); Composite client = toolkit.createComposite(section); client.setLayout(new GridLayout(3, false)); client.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); // Attribute: factory fFactoryEntry = new FormEntry(client, toolkit, Messages.DSComponentDetails_factoryEntry, SWT.NONE); // Attribute: configuration policy Label label = toolkit.createLabel(client, Messages.DSComponentDetails_configurationPolicy, SWT.WRAP); label.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); fConfigurationPolicy = new ComboPart(); fConfigurationPolicy.createControl(client, toolkit, SWT.READ_ONLY); String[] items = new String[] { "", //$NON-NLS-1$ IDSConstants.VALUE_CONFIGURATION_POLICY_OPTIONAL, IDSConstants.VALUE_CONFIGURATION_POLICY_REQUIRE, IDSConstants.VALUE_CONFIGURATION_POLICY_IGNORE }; fConfigurationPolicy.setItems(items); GridDataFactory.fillDefaults() .grab(true, false) .indent(3, 0) .applyTo(fConfigurationPolicy.getControl()); createButtons(client, toolkit); setListeners(); updateUIFields(); toolkit.paintBordersFor(client); section.setClient(client); }
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) {} }); }
private void createFormMiscSection(final ScrolledForm form, FormToolkit toolkit) { /* Misc. Section */ Section miscSection = toolkit.createSection(form.getBody(), Section.TWISTIE | Section.EXPANDED); miscSection.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground()); miscSection.setToggleColor(toolkit.getColors().getColor(FormColors.SEPARATOR)); toolkit.createCompositeSeparator(miscSection); GridData miscSectionGridData = new GridData(); miscSectionGridData.horizontalSpan = 3; miscSectionGridData.horizontalAlignment = GridData.FILL; miscSectionGridData.grabExcessHorizontalSpace = true; miscSection.setLayoutData(miscSectionGridData); miscSection.addExpansionListener( new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { form.reflow(false); } }); miscSection.setText(Messages.getString("ScheduledTaskPage.section.misc")); // miscSection.setLayoutData(new TableWrapData(TableWrapData.FILL)); Composite miscSectionClient = toolkit.createComposite(miscSection); miscSectionClient.setLayout(new GridLayout()); toolkit.createLabel(miscSectionClient, "Pinned Servers"); GridData taskGroupGridData = new GridData(); taskGroupGridData.horizontalSpan = 3; taskGroupGridData.horizontalAlignment = GridData.FILL; taskGroupGridData.grabExcessHorizontalSpace = true; pinnedServers = toolkit.createText(miscSectionClient, ""); pinnedServers.setBackground(new Color(null, 229, 236, 253)); pinnedServers.setLayoutData(taskGroupGridData); pinnedServers.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setSave(true); updateDirtyState(); } }); miscSection.setClient(miscSectionClient); }
private void createUI26SmoothAltitude(final Composite parent) { /* * image: altitude */ _iconAltitude = new CLabel(parent, SWT.NONE); GridDataFactory.fillDefaults().indent(16, 0).applyTo(_iconAltitude); _iconAltitude.setBackground(_tk.getColors().getBackground()); _iconAltitude.setImage(_imageAltitude); /* * checkbox: smooth altitude */ _chkIsAltitudeSmoothing = _tk.createButton( parent, Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing, SWT.CHECK); GridDataFactory.fillDefaults() // .align(SWT.FILL, SWT.CENTER) .span(2, 1) .applyTo(_chkIsAltitudeSmoothing); _chkIsAltitudeSmoothing.setToolTipText( Messages.TourChart_Smoothing_Checkbox_IsAltitudeSmoothing_Tooltip); _chkIsAltitudeSmoothing.addSelectionListener(_selectionListener); }
public void createContents(Composite parent) { TableWrapLayout lo = new TableWrapLayout(); lo.leftMargin = 0; lo.rightMargin = 0; lo.topMargin = 0; lo.numColumns = 1; parent.setLayout(lo); FormToolkit toolkit = m_mform.getToolkit(); Section section = toolkit.createSection( parent, // // Section.DESCRIPTION | // Section.TITLE_BAR | // Section.EXPANDED); TableWrapData td = new TableWrapData(TableWrapData.FILL_GRAB, TableWrapData.TOP); td.colspan = 1; section.setLayoutData(td); section.setText("Edit Provided Capability"); Composite sectionClient = toolkit.createComposite(section); GridLayout layout = new GridLayout(2, false); sectionClient.setLayout(layout); FormColors colors = toolkit.getColors(); Color headerColor = colors.getColor("org.eclipse.ui.forms.TITLE"); // $NON-NLS-1$ Label label = null; // -- NAMESPACE label = toolkit.createLabel(sectionClient, "Namespace:"); label.setForeground(headerColor); final Text nsText = toolkit.createText(sectionClient, ""); // $NON-NLS-1$ GridData gd = new GridData(SWT.FILL, SWT.CENTER, true, false); gd.minimumWidth = 200; nsText.setLayoutData(gd); m_editAdapters.createEditAdapter( "nsText", nsText, //$NON-NLS-1$ new RequiredValidator(StructuredNameValidator.instance()), new Mutator() { @Override public String getValue() { return m_input != null && m_input.getNamespace() != null ? m_input.getNamespace() : ""; //$NON-NLS-1$ } @Override public void setValue(String input) throws Exception { m_input.setNamespace( input == null ? "" //$NON-NLS-1$ : input.trim()); } }); // -- NAME label = toolkit.createLabel(sectionClient, "Name:"); label.setForeground(headerColor); final Text nameText = toolkit.createText(sectionClient, ""); nameText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); m_editAdapters.createEditAdapter( "name", nameText, //$NON-NLS-1$ new RequiredValidator( NullValidator.instance()), // TODO: A ProvidedCapability name validator new Mutator() { @Override public String getValue() { return m_input != null && m_input.getName() != null ? m_input.getName() : ""; //$NON-NLS-1$ } @Override public void setValue(String input) throws Exception { m_input.setName( input == null ? "" //$NON-NLS-1$ : input.trim()); } }); // -- VERSION label = toolkit.createLabel(sectionClient, "Version:"); label.setForeground(headerColor); final Text versionText = toolkit.createText(sectionClient, ""); versionText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); m_editAdapters.createEditAdapter( "version", versionText, //$NON-NLS-1$ new RequiredValidator(VersionValidator.instance()), new Mutator() { @Override public String getValue() { return m_input != null && m_input.getVersion() != null ? m_input.getVersion() : ""; //$NON-NLS-1$ } @Override public void setValue(String input) throws Exception { m_input.setVersion( input == null ? "" //$NON-NLS-1$ : input.trim()); } }); section.setClient(sectionClient); }
private void createQueryPreferencesSection(Composite editorComposite, FormToolkit toolkit) { Section section = toolkit.createSection( editorComposite, ExpandableComposite.EXPANDED | ExpandableComposite.TITLE_BAR | ExpandableComposite.TWISTIE); section.setText("Query Preferences"); section.setLayout(new GridLayout()); section.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); section.addExpansionListener( new IExpansionListener() { public void expansionStateChanging(ExpansionEvent e) { m_sform.reflow(true); } public void expansionStateChanged(ExpansionEvent e) { m_sform.reflow(true); } }); Composite sectionClient = toolkit.createComposite(section); section.setClient(sectionClient); GridLayout layout = new GridLayout(); layout.numColumns = 2; sectionClient.setLayout(layout); GridData gridData = new GridData(GridData.FILL_HORIZONTAL); String[] fielddata; // Market Label label_market = toolkit.createLabel(sectionClient, "Market"); label_market.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_market = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_market.setLayoutData(gridData); try { fielddata = FieldDataHelper.getMarkets(); if (fielddata.length == 0) { m_combo_market.setEnabled(false); label_market.setEnabled(false); } else { m_combo_market.setItems(fielddata); } } catch (Exception e1) { m_combo_market.setEnabled(false); label_market.setEnabled(false); } // Segment Label label_segment = toolkit.createLabel(sectionClient, "Segment"); label_segment.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_segment = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_segment.setLayoutData(gridData); try { fielddata = FieldDataHelper.getSegments(); if (fielddata.length == 0) { m_combo_segment.setEnabled(false); label_segment.setEnabled(false); } else { m_combo_segment.setItems(fielddata); } } catch (Exception e1) { m_combo_segment.setEnabled(false); label_segment.setEnabled(false); } // Maker Label label_maker = toolkit.createLabel(sectionClient, "Maker"); label_maker.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_maker = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_maker.setLayoutData(gridData); try { fielddata = FieldDataHelper.getMakers(); if (fielddata.length == 0) { m_combo_maker.setEnabled(false); label_maker.setEnabled(false); } else { m_combo_maker.setItems(fielddata); } } catch (Exception e1) { m_combo_maker.setEnabled(false); label_maker.setEnabled(false); } // Model Label label_model = toolkit.createLabel(sectionClient, "Model"); label_model.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_model = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_model.setLayoutData(gridData); try { fielddata = FieldDataHelper.getModels(); if (fielddata.length == 0) { m_combo_model.setEnabled(false); label_model.setEnabled(false); } else { m_combo_model.setItems(fielddata); } } catch (Exception e1) { m_combo_model.setEnabled(false); label_model.setEnabled(false); } // Concept Label label_concept = toolkit.createLabel(sectionClient, "Concept"); label_concept.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_concept = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_concept.setLayoutData(gridData); try { fielddata = FieldDataHelper.getConcepts(); if (fielddata.length == 0) { m_combo_concept.setEnabled(false); label_concept.setEnabled(false); } else { m_combo_concept.setItems(fielddata); } } catch (Exception e1) { m_combo_concept.setEnabled(false); label_concept.setEnabled(false); } // Technology Label label_technology = toolkit.createLabel(sectionClient, "Technology"); label_technology.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_technology = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_technology.setLayoutData(gridData); try { fielddata = FieldDataHelper.getTechnology(); if (fielddata.length == 0) { m_combo_technology.setEnabled(false); label_technology.setEnabled(false); } else { m_combo_technology.setItems(fielddata); } } catch (Exception e1) { m_combo_technology.setEnabled(false); label_technology.setEnabled(false); } // Date Label label_date_from = toolkit.createLabel(sectionClient, "Date (from)"); label_date_from.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_text_date_from = toolkit.createText(sectionClient, new String(), SWT.BORDER); m_text_date_from.setLayoutData(gridData); m_text_date_from.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { firePropertyChange(IEditorPart.PROP_DIRTY); } }); // TODO: Dates currently not supported label_date_from.setEnabled(false); m_text_date_from.setEnabled(false); Label label_date_to = toolkit.createLabel(sectionClient, "Date (to)"); label_date_to.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_text_date_to = toolkit.createText(sectionClient, new String(), SWT.BORDER); m_text_date_to.setLayoutData(gridData); m_text_date_to.addModifyListener( new ModifyListener() { public void modifyText(ModifyEvent e) { firePropertyChange(IEditorPart.PROP_DIRTY); } }); // TODO: Dates currently not supported label_date_to.setEnabled(false); m_text_date_to.setEnabled(false); // Source Label label_source = toolkit.createLabel(sectionClient, "Source"); label_source.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_source = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_source.setLayoutData(gridData); try { fielddata = FieldDataHelper.getSources(); if (fielddata.length == 0) { m_combo_source.setEnabled(false); label_source.setEnabled(false); } else { m_combo_source.setItems(fielddata); } } catch (Exception e1) { m_combo_source.setEnabled(false); label_source.setEnabled(false); } // Language Label label_language = toolkit.createLabel(sectionClient, "Language"); label_language.setForeground(toolkit.getColors().getColor(FormColors.TITLE)); m_combo_language = new Combo(sectionClient, SWT.DROP_DOWN); m_combo_language.setLayoutData(gridData); try { fielddata = FieldDataHelper.getLanguages(); if (fielddata.length == 0) { m_combo_language.setEnabled(false); label_language.setEnabled(false); } else { m_combo_language.setItems(fielddata); } } catch (Exception e1) { m_combo_language.setEnabled(false); label_language.setEnabled(false); } }
private void createFormTriggerSection(final ScrolledForm form, final FormToolkit toolkit) { /* Trigger Information */ triggerSection = toolkit.createSection(form.getBody(), Section.TWISTIE | Section.EXPANDED); triggerSection.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground()); triggerSection.setToggleColor(toolkit.getColors().getColor(FormColors.SEPARATOR)); toolkit.createCompositeSeparator(triggerSection); GridData taskImplGridData = new GridData(); taskImplGridData.horizontalSpan = 3; taskImplGridData.horizontalAlignment = GridData.FILL; taskImplGridData.grabExcessHorizontalSpace = true; triggerSection.addExpansionListener( new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { form.reflow(false); } }); triggerSection.setLayoutData(taskImplGridData); triggerSection.setText(Messages.getString("ScheduledTaskPage.section.trigger")); // triggerSection.setLayoutData(new TableWrapData(TableWrapData.FILL)); final Composite triggerSectionClient = toolkit.createComposite(triggerSection); triggerSectionClient.setLayout(new GridLayout()); toolkit.createLabel(triggerSectionClient, "Trigger Type"); triggerType = new Combo(triggerSectionClient, SWT.READ_ONLY); triggerType.setLayoutData(new GridData(GridData.FILL_BOTH)); // triggerType.setBackground(new Color(null, 229,236,253)); String[] triggerTypes = {"Simple", "Cron"}; triggerType.setItems(triggerTypes); cronLbl = toolkit.createLabel(triggerSectionClient, "Cron"); cronLbl.setLayoutData(new GridData(GridData.FILL_BOTH)); cron = toolkit.createText(triggerSectionClient, ""); cron.setBackground(new Color(null, 229, 236, 253)); GridData cronLabelGridData = new GridData(); cronLabelGridData.horizontalSpan = 3; cronLabelGridData.horizontalAlignment = GridData.FILL; cronLabelGridData.grabExcessHorizontalSpace = true; cron.setLayoutData(cronLabelGridData); cron.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setSave(true); updateDirtyState(); } }); disableCronFields(); countLbl = toolkit.createLabel(triggerSectionClient, "Count"); countLbl.setLayoutData(new GridData(GridData.FILL_BOTH)); count = toolkit.createText(triggerSectionClient, "1"); count.setBackground(new Color(null, 229, 236, 253)); GridData countLabelGridData = new GridData(); countLabelGridData.horizontalSpan = 3; countLabelGridData.horizontalAlignment = GridData.FILL; countLabelGridData.grabExcessHorizontalSpace = true; count.setLayoutData(countLabelGridData); count.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setSave(true); updateDirtyState(); } }); intervalLbl = toolkit.createLabel(triggerSectionClient, "Interval"); intervalLbl.setLayoutData(new GridData(GridData.FILL_BOTH)); interval = toolkit.createText(triggerSectionClient, "0"); interval.setBackground(new Color(null, 229, 236, 253)); GridData intervalGridData = new GridData(); intervalGridData.horizontalSpan = 3; intervalGridData.horizontalAlignment = GridData.FILL; intervalGridData.grabExcessHorizontalSpace = true; interval.setLayoutData(intervalGridData); interval.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setSave(true); updateDirtyState(); } }); enableSimpleFields(); triggerType.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { if (triggerType.getSelectionIndex() == 0) { enableSimpleFields(); disableCronFields(); } else if (triggerType.getSelectionIndex() == 1) { enableCronFields(); disableSimpleFields(); } setSave(true); updateDirtyState(); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); triggerSection.setClient(triggerSectionClient); }
private void createFormImplSection(final ScrolledForm form, FormToolkit toolkit) { /* Task Implementation Section */ Section implSection = toolkit.createSection(form.getBody(), Section.TWISTIE | Section.EXPANDED); implSection.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground()); implSection.setToggleColor(toolkit.getColors().getColor(FormColors.SEPARATOR)); toolkit.createCompositeSeparator(implSection); GridData taskGroupGridData = new GridData(); taskGroupGridData.horizontalSpan = 3; taskGroupGridData.horizontalAlignment = GridData.FILL; taskGroupGridData.grabExcessHorizontalSpace = true; implSection.setLayoutData(taskGroupGridData); implSection.addExpansionListener( new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { form.reflow(false); } }); implSection.setText(Messages.getString("ScheduledTaskPage.section.impl")); // implSection.setLayoutData(new TableWrapData(TableWrapData.FILL)); Composite implSectionClient = toolkit.createComposite(implSection); implSectionClient.setLayout(new GridLayout()); toolkit.createLabel(implSectionClient, "Task Implementation"); GridData taskImplGridData = new GridData(); taskImplGridData.horizontalSpan = 3; taskImplGridData.horizontalAlignment = GridData.FILL; taskImplGridData.grabExcessHorizontalSpace = true; taskImpl = toolkit.createText(implSectionClient, "org.apache.synapse.startup.tasks.MessageInjector"); taskImpl.setLayoutData(taskImplGridData); taskImpl.setBackground(new Color(null, 229, 236, 253)); taskImpl.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setSave(true); updateDirtyState(); } }); // taskImpl.setLayoutData(new TableWrapData(TableWrapData.FILL_GRAB)); Button taskImplButton = toolkit.createButton(implSectionClient, "Task Implementation Properties", SWT.PUSH); taskImplButton.addSelectionListener( new SelectionListener() { @Override public void widgetSelected(SelectionEvent e) { Shell shell = Display.getDefault().getActiveShell(); TaskPropertyDialog taskPropDialog = new TaskPropertyDialog(shell, getTaskImpl().getText(), getTaskPropertyList()); taskPropDialog.setBlockOnOpen(true); taskPropDialog.open(); taskPropertyList = taskPropDialog.getTaskPropertyList(); setSave(true); updateDirtyState(); } @Override public void widgetDefaultSelected(SelectionEvent e) { // TODO Auto-generated method stub } }); setTaskPropertyList(taskPropertyList); implSection.setClient(implSectionClient); }
private void createFormBasicSection(final ScrolledForm form, FormToolkit toolkit) { /* Basic Section */ Section basicSection = toolkit.createSection(form.getBody(), Section.TWISTIE | Section.EXPANDED); basicSection.setActiveToggleColor(toolkit.getHyperlinkGroup().getActiveForeground()); basicSection.setToggleColor(toolkit.getColors().getColor(FormColors.SEPARATOR)); toolkit.createCompositeSeparator(basicSection); GridData samplegridData = new GridData(); samplegridData.horizontalSpan = 3; samplegridData.horizontalAlignment = SWT.FILL; samplegridData.grabExcessHorizontalSpace = true; basicSection.addExpansionListener( new ExpansionAdapter() { public void expansionStateChanged(ExpansionEvent e) { form.reflow(false); } }); basicSection.setLayoutData(samplegridData); basicSection.setText(Messages.getString("ScheduledTaskPage.section.basic")); // section.setLayoutData(new TableWrapData(TableWrapData.FILL)); Composite basicSectionClient = toolkit.createComposite(basicSection); basicSectionClient.setLayout(new GridLayout()); toolkit.createLabel(basicSectionClient, "Task Name"); taskName = toolkit.createText(basicSectionClient, ""); taskName.setBackground(new Color(null, 229, 236, 253)); taskName.setSize(8000, 10); GridData taskNameGridData = new GridData(); taskNameGridData.horizontalSpan = 3; taskNameGridData.horizontalAlignment = GridData.FILL; taskNameGridData.grabExcessHorizontalSpace = true; taskName.setLayoutData(taskNameGridData); taskName.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setSave(true); updateDirtyState(); } }); toolkit.createLabel(basicSectionClient, "Task Group"); taskGroup = toolkit.createText(basicSectionClient, "synapse.simple.quartz"); taskGroup.setBackground(new Color(null, 229, 236, 253)); GridData taskGroupGridData = new GridData(); taskGroupGridData.horizontalSpan = 3; taskGroupGridData.horizontalAlignment = GridData.FILL; taskGroupGridData.grabExcessHorizontalSpace = true; taskGroup.setLayoutData(taskGroupGridData); taskGroup.addModifyListener( new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setSave(true); updateDirtyState(); } }); basicSection.setClient(basicSectionClient); }
@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); }
private void createUILabelType(Composite parent) { Color foreground = fToolkit.getColors().getColor(IFormColors.TITLE); Label label = fToolkit.createLabel(parent, PDEUIMessages.SplashTemplatesSection_typeName, SWT.WRAP); label.setForeground(foreground); }
@Override protected void createBundleContent(Composite parent) { mform = new ManagedForm(parent); setManagedForm(mform); sform = mform.getForm(); FormToolkit toolkit = mform.getToolkit(); sform.setText("Server Console"); sform.setImage(ServerUICore.getLabelProvider().getImage(getServer())); sform.setExpandHorizontal(true); sform.setExpandVertical(true); toolkit.decorateFormHeading(sform.getForm()); Composite body = sform.getBody(); GridLayout layout = new GridLayout(1, false); layout.marginLeft = 6; layout.marginTop = 6; layout.marginRight = 6; body.setLayout(layout); Section manifestSection = toolkit.createSection(sform.getBody(), ExpandableComposite.TITLE_BAR | Section.DESCRIPTION); manifestSection.setText("Commands"); manifestSection.setDescription("Execute commands on server."); layout = new GridLayout(); manifestSection.setLayout(layout); manifestSection.setLayoutData(new GridData(GridData.FILL_BOTH)); Composite manifestComposite = toolkit.createComposite(manifestSection); layout = new GridLayout(); layout.marginLeft = 6; layout.marginTop = 6; layout.numColumns = 3; manifestComposite.setLayoutData(new GridData(GridData.FILL_BOTH)); manifestComposite.setLayout(layout); manifestSection.setClient(manifestComposite); Label commandLabel = toolkit.createLabel(manifestComposite, "Command:"); commandLabel.setForeground(toolkit.getColors().getColor(IFormColors.TITLE)); GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(commandLabel); commandText = toolkit.createText(manifestComposite, "", SWT.CANCEL | SWT.SEARCH); GridDataFactory.fillDefaults().grab(true, false).applyTo(commandText); commandText.addKeyListener( new KeyAdapter() { @Override public void keyPressed(KeyEvent e) { if (e.character == SWT.CR || e.character == SWT.LF) { history.add(commandText.getText()); String cmdLine = commandText.getText(); executeCommand(cmdLine); } else if (e.keyCode == SWT.ARROW_UP) { String command = history.back(); commandText.setText(command); commandText.setSelection(command.length()); e.doit = false; } else if (e.keyCode == SWT.ARROW_DOWN) { String command = history.forward(); commandText.setText(command); commandText.setSelection(command.length()); e.doit = false; } } }); Button commandButton = toolkit.createButton(manifestComposite, "Execute", SWT.PUSH); commandButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { history.add(commandText.getText()); String cmdLine = commandText.getText(); executeCommand(cmdLine); } }); Button clearButton = toolkit.createButton(manifestComposite, "Clear", SWT.PUSH); clearButton.addSelectionListener( new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { manifestText.setText(""); } }); manifestText = new StyledText(manifestComposite, SWT.BORDER | SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL); manifestText.setWordWrap(false); manifestText.setFont(JFaceResources.getTextFont()); GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 3; manifestText.setLayoutData(data); Label helpLabel = toolkit.createLabel(manifestComposite, "Type 'help' to get a list of supported commands."); GridDataFactory.fillDefaults().grab(true, false).span(3, 1).applyTo(helpLabel); toolBarManager = sform.getToolBarManager(); backAction = new Action("Back") { @Override public void run() { commandText.setText(history.back()); String cmdLine = commandText.getText(); executeCommand(cmdLine); } }; backAction.setImageDescriptor( ImageResource.getImageDescriptor( org.eclipse.ui.internal.browser.ImageResource.IMG_ELCL_NAV_BACKWARD)); backAction.setHoverImageDescriptor( ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_BACKWARD)); backAction.setDisabledImageDescriptor( ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_BACKWARD)); backAction.setEnabled(false); toolBarManager.add(backAction); forwardAction = new Action("Forward") { @Override public void run() { commandText.setText(history.forward()); String cmdLine = commandText.getText(); executeCommand(cmdLine); } }; forwardAction.setImageDescriptor( ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_FORWARD)); forwardAction.setHoverImageDescriptor( ImageResource.getImageDescriptor(ImageResource.IMG_CLCL_NAV_FORWARD)); forwardAction.setDisabledImageDescriptor( ImageResource.getImageDescriptor(ImageResource.IMG_DLCL_NAV_FORWARD)); forwardAction.setEnabled(false); toolBarManager.add(forwardAction); refreshAction = new Action( "Refresh from server", ImageResource.getImageDescriptor(ImageResource.IMG_ELCL_NAV_REFRESH)) { @Override public void run() { String cmdLine = history.current(); if (cmdLine != null) { executeCommand(cmdLine); } } }; toolBarManager.add(refreshAction); sform.updateToolBar(); }
private Composite createMessageAndPersonArea(Composite container) { Composite messageAndPersonArea = toolkit.createComposite(container); GridDataFactory.fillDefaults().grab(true, true).applyTo(messageAndPersonArea); GridLayoutFactory.swtDefaults().margins(0, 0).spacing(0, 0).applyTo(messageAndPersonArea); Section messageSection = toolkit.createSection( messageAndPersonArea, ExpandableComposite.TITLE_BAR | ExpandableComposite.CLIENT_INDENT); messageSection.setText(UIText.CommitDialog_CommitMessage); Composite messageArea = toolkit.createComposite(messageSection); GridLayoutFactory.fillDefaults().spacing(0, 0).extendedMargins(2, 2, 2, 2).applyTo(messageArea); toolkit.paintBordersFor(messageArea); GridDataFactory.fillDefaults().grab(true, true).applyTo(messageSection); GridLayoutFactory.swtDefaults().applyTo(messageSection); Composite headerArea = new Composite(messageSection, SWT.NONE); GridLayoutFactory.fillDefaults().spacing(0, 0).numColumns(2).applyTo(headerArea); ToolBar messageToolbar = new ToolBar(headerArea, SWT.FLAT | SWT.HORIZONTAL); GridDataFactory.fillDefaults() .align(SWT.END, SWT.FILL) .grab(true, false) .applyTo(messageToolbar); addMessageDropDown(headerArea); messageSection.setTextClient(headerArea); final CommitProposalProcessor commitProposalProcessor = new CommitProposalProcessor() { @Override protected Collection<String> computeFileNameProposals() { return getFileList(); } @Override protected Collection<String> computeMessageProposals() { return CommitMessageHistory.getCommitHistory(); } }; commitText = new CommitMessageArea(messageArea, commitMessage, SWT.NONE) { @Override protected CommitProposalProcessor getCommitProposalProcessor() { return commitProposalProcessor; } }; commitText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); messageSection.setClient(messageArea); Point size = commitText.getTextWidget().getSize(); int minHeight = commitText.getTextWidget().getLineHeight() * 3; commitText.setLayoutData( GridDataFactory.fillDefaults() .grab(true, true) .hint(size) .minSize(size.x, minHeight) .align(SWT.FILL, SWT.FILL) .create()); UIUtils.addBulbDecorator(commitText.getTextWidget(), UIText.CommitDialog_ContentAssist); Composite personArea = toolkit.createComposite(messageAndPersonArea); toolkit.paintBordersFor(personArea); GridLayoutFactory.swtDefaults().numColumns(2).applyTo(personArea); GridDataFactory.fillDefaults().grab(true, false).applyTo(personArea); toolkit .createLabel(personArea, UIText.CommitDialog_Author) .setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE)); authorText = toolkit.createText(personArea, null); authorText.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER); authorText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); if (repository != null && repository.getRepositoryState().equals(RepositoryState.CHERRY_PICKING_RESOLVED)) authorText.setEnabled(false); toolkit .createLabel(personArea, UIText.CommitDialog_Committer) .setForeground(toolkit.getColors().getColor(IFormColors.TB_TOGGLE)); committerText = toolkit.createText(personArea, null); committerText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create()); if (committer != null) committerText.setText(committer); amendingItem = new ToolItem(messageToolbar, SWT.CHECK); amendingItem.setSelection(amending); if (amending) amendingItem.setEnabled(false); // if already set, don't allow any // changes else if (!amendAllowed) amendingItem.setEnabled(false); amendingItem.setToolTipText(UIText.CommitDialog_AmendPreviousCommit); Image amendImage = UIIcons.AMEND_COMMIT.createImage(); UIUtils.hookDisposal(amendingItem, amendImage); amendingItem.setImage(amendImage); signedOffItem = new ToolItem(messageToolbar, SWT.CHECK); signedOffItem.setToolTipText(UIText.CommitDialog_AddSOB); Image signedOffImage = UIIcons.SIGNED_OFF.createImage(); UIUtils.hookDisposal(signedOffItem, signedOffImage); signedOffItem.setImage(signedOffImage); changeIdItem = new ToolItem(messageToolbar, SWT.CHECK); Image changeIdImage = UIIcons.GERRIT.createImage(); UIUtils.hookDisposal(changeIdItem, changeIdImage); changeIdItem.setImage(changeIdImage); changeIdItem.setToolTipText(UIText.CommitDialog_AddChangeIdLabel); final ICommitMessageComponentNotifications listener = new ICommitMessageComponentNotifications() { public void updateSignedOffToggleSelection(boolean selection) { signedOffItem.setSelection(selection); } public void updateChangeIdToggleSelection(boolean selection) { changeIdItem.setSelection(selection); } public void statusUpdated() { updateMessage(); } }; commitMessageComponent = new CommitMessageComponent(repository, listener); commitMessageComponent.enableListeners(false); commitMessageComponent.setDefaults(); commitMessageComponent.attachControls(commitText, authorText, committerText); commitMessageComponent.setCommitMessage(commitMessage); commitMessageComponent.setAuthor(author); commitMessageComponent.setCommitter(committer); commitMessageComponent.setAmending(amending); commitMessageComponent.setFilesToCommit(getFileList()); amendingItem.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { commitMessageComponent.setAmendingButtonSelection(amendingItem.getSelection()); } }); changeIdItem.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { commitMessageComponent.setChangeIdButtonSelection(changeIdItem.getSelection()); } }); signedOffItem.addSelectionListener( new SelectionAdapter() { public void widgetSelected(SelectionEvent arg0) { commitMessageComponent.setSignedOffButtonSelection(signedOffItem.getSelection()); } }); commitMessageComponent.updateUI(); commitMessageComponent.enableListeners(true); return messageAndPersonArea; }
/** * @param parent * @param toolkit * @param style */ public DynamicHelpPart(Composite parent, FormToolkit toolkit) { super(parent, toolkit, Section.EXPANDED | Section.TWISTIE | Section.TITLE_BAR); // configure section Section section = getSection(); section.setText(Messages.SearchPart_title); section.marginWidth = 5; section.addExpansionListener( new IExpansionListener() { public void expansionStateChanging(ExpansionEvent e) {} public void expansionStateChanged(ExpansionEvent e) { if (e.getState()) { refilter(); } } }); // create 'clear' hyperlink on the section tool bar // ImageHyperlink clearLink = new ImageHyperlink(section, SWT.NULL); // toolkit.adapt(clearLink, true, true); /* clearLink.setToolTipText(HelpUIResources .getString("SearchPart.clearResults")); //$NON-NLS-1$ clearLink.setImage(HelpUIResources .getImage(IHelpUIConstants.IMAGE_CLEAR)); clearLink.setBackground(section.getTitleBarGradientBackground()); clearLink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { clearResults(); } }); section.setTextClient(clearLink); */ resultSorter = new SorterByScore(); searchResults = toolkit.createFormText(section, false); section.setClient(searchResults); searchResults.setColor(IFormColors.TITLE, toolkit.getColors().getColor(IFormColors.TITLE)); String topicKey = IHelpUIConstants.IMAGE_FILE_F1TOPIC; String nwKey = IHelpUIConstants.IMAGE_NW; String searchKey = IHelpUIConstants.IMAGE_HELP_SEARCH; searchResults.setImage(topicKey, HelpUIResources.getImage(topicKey)); searchResults.setImage(nwKey, HelpUIResources.getImage(nwKey)); searchResults.setImage(searchKey, HelpUIResources.getImage(searchKey)); searchResults.addHyperlinkListener( new IHyperlinkListener() { public void linkActivated(HyperlinkEvent e) { Object href = e.getHref(); if (href.equals(CANCEL_HREF)) { if (runningJob != null) { runningJob.cancel(); runningJob = null; } clearResults(); } else if (href.equals(MORE_HREF)) { doMore(); } else doOpenLink(e.getHref()); } public void linkEntered(HyperlinkEvent e) { DynamicHelpPart.this.parent.handleLinkEntered(e); } public void linkExited(HyperlinkEvent e) { DynamicHelpPart.this.parent.handleLinkExited(e); } }); searchResults.setText("", false, false); // $NON-NLS-1$ jobListener = new JobListener(); Job.getJobManager().addJobChangeListener(jobListener); }