/** * Constructor. * * @param parent The parent {@link Composite}. * @param style The InfoBar {@link Composite#getStyle() style}. */ public InfoBar(Composite parent, int style) { super(parent, style); setVisible(false); FormLayout layout = new FormLayout(); layout.marginTop = 5; layout.marginBottom = 5; layout.marginLeft = 5; layout.marginRight = 5; layout.spacing = 5; setLayout(layout); Color backgroundColor = parent.getDisplay().getSystemColor(SWT.COLOR_INFO_BACKGROUND); setBackground(backgroundColor); _Label = new Label(this, SWT.LEAD | SWT.WRAP); _Label.setBackground(backgroundColor); FormData labelFormData = new FormData(); labelFormData.top = new FormAttachment(0, 0); labelFormData.left = new FormAttachment(0, 0); _Label.setLayoutData(labelFormData); }
@Override protected void createContent() { FormToolkit toolkit = getToolkit(); _Text = toolkit.createText(this, "", SWT.BORDER | SWT.SINGLE); _Text.setFont(JFaceResources.getTextFont()); FormData formData = new FormData(); formData.top = new FormAttachment(0, 0); formData.left = new FormAttachment(0, 0); formData.right = new FormAttachment(100, 0); _Text.setLayoutData(formData); _Text.addModifyListener(new ModifyListener() { @Override public void modifyText(ModifyEvent e) { setDirtyInternal(true); } }); }
@Override protected void createModelFormContent(IManagedForm managedForm, Composite client) { FormToolkit toolkit = managedForm.getToolkit(); _ScrolledFormText = new ScrolledFormText(client, false); _ScrolledFormText.setExpandHorizontal(true); toolkit.adapt(_ScrolledFormText, false, false); _JmxDocFormText = toolkit.createFormText(_ScrolledFormText, true); _ScrolledFormText.setFormText(_JmxDocFormText); JmxDocFormText.initFormText(_JmxDocFormText); FormData scrolledFormTextFormData = new FormData(); scrolledFormTextFormData.top = new FormAttachment(0, 0); scrolledFormTextFormData.left = new FormAttachment(0, 0); scrolledFormTextFormData.right = new FormAttachment(100, 0); scrolledFormTextFormData.bottom = new FormAttachment(100, 0); _ScrolledFormText.setLayoutData(scrolledFormTextFormData); }
@Override protected Section createDetailSection(ScrolledForm form, Composite client, FormToolkit toolkit) { Section section = createSection(form, client, toolkit, DETAIL_SECTION_TITLE, JmxActivator .getManagedImage(JmxActivator.IMAGE_KEY_OBJECT_JMX_DOC)); Composite sectionClient = createSectionClient(section, toolkit); _JmxDocFormText = toolkit.createFormText(sectionClient, false); JmxDocFormText.initFormText(_JmxDocFormText); FormData jmxdocFormTextFormData = new FormData(); jmxdocFormTextFormData.top = new FormAttachment(0, 0); jmxdocFormTextFormData.left = new FormAttachment(0, 0); _JmxDocFormText.setLayoutData(jmxdocFormTextFormData); GridData detailSectionGridData = new GridData(GridData.FILL_HORIZONTAL); section.setLayoutData(detailSectionGridData); return section; }
private void updateButtonVisibility(final Tag[] tags) { Utils.execSWTThread(new AERunnable() { @Override public void runSupport() { if (btnAnyTags == null || btnAnyTags.isDisposed()) { return; } boolean show = tags != null && tags.length > 1; btnAnyTags.setVisible(show); FormData fd = Utils.getFilledFormData(); fd.height = show ? SWT.DEFAULT : 0; btnAnyTags.setLayoutData(fd); Composite cTop = btnAnyTags.getParent(); cTop.getParent().layout(true, true); } }); }
private SWTSkinObjectContainer getGroupSO(String groupID) { String soID = "toolbar-group-" + groupID; SWTSkinObjectContainer soGroup = (SWTSkinObjectContainer) skin.getSkinObjectByID( soID, soMain); if (soGroup == null) { soGroup = (SWTSkinObjectContainer) skin.createSkinObject(soID, "toolbar.group", soMain); FormData fd = (FormData) soGroup.getControl().getLayoutData(); if (soLastGroup != null) { fd.left = new FormAttachment(soLastGroup.getControl(), 0, SWT.RIGHT); } else { fd.left = new FormAttachment(0, 2); } } soLastGroup = soGroup; return soGroup; }
public void dispose() { if (control == null || control.isDisposed()) { return; } if (!TEST_SWT_PAINTING) { control.removeListener(SWT.Resize, this); control.removeListener(SWT.Paint, this); control.getShell().removeListener(SWT.Show, this); } control.removeListener(SWT.Dispose, this); control.setBackgroundImage(null); FormData formData = (FormData) control.getLayoutData(); formData.width = SWT.DEFAULT; formData.height = SWT.DEFAULT; control.setData("BGPainter", null); }
protected Point betterComputeSize(Composite c, Point size, int wHint, int hHint) { if (c.getChildren().length == 0 && (size.x == 64 || size.y == 64)) { Object ld = c.getLayoutData(); if (ld instanceof FormData) { FormData fd = (FormData) ld; if (fd.width != 0 && fd.height != 0) { Rectangle trim = c.computeTrim (0, 0, fd.width, fd.height); return new Point(trim.width, trim.height); } } return new Point(1, 1); } if (size.x == 0 || size.y == 0) { return size; } if (minWidth > 0 && size.x < minWidth) { size.x = minWidth; } if (minHeight > 0 && size.y < minHeight) { size.y = minHeight; } return size; }
protected Point betterComputeSize(Composite c, Point size, int wHint, int hHint, boolean changed) { if (c.getChildren().length == 0 && (size.x == 64 || size.y == 64)) { Object ld = c.getLayoutData(); if (ld instanceof FormData) { FormData fd = (FormData) ld; if (fd.width != 0 && fd.height != 0) { Rectangle trim = c.computeTrim (0, 0, fd.width, fd.height); return new Point(trim.width, trim.height); } } return new Point(1, 1); } if (size.x == 0 || size.y == 0) { return size; } if (minWidth > 0 && size.x < minWidth) { size.x = minWidth; } if (minHeight > 0 && size.y < minHeight) { size.y = minHeight; } return size; }
@Override protected Control createDialogArea(Composite parent) { Composite composite = (Composite) super.createDialogArea(parent); Composite buttonComposite = (Composite) composite.getChildren()[0]; Button browseRegisteredExtensionsButton = new Button(buttonComposite, SWT.PUSH); browseRegisteredExtensionsButton .setText(Messages.LoadExtensionDialog_ExtensionRegistry); prepareBrowseRegisteredPackagesButton(browseRegisteredExtensionsButton); { FormData data = new FormData(); Control[] children = buttonComposite.getChildren(); data.right = new FormAttachment(children[0], -CONTROL_OFFSET); browseRegisteredExtensionsButton.setLayoutData(data); } return composite; }
@Override public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) { super.createControls(parent, aTabbedPropertySheetPage); Composite composite=this.getWidgetFactory().createFlatFormComposite(parent); composite.setLayout(new FormLayout()); Label la=this.getWidgetFactory().createLabel(composite,"名称:"); FormData laData=new FormData(); laData.top=new FormAttachment(0,12); laData.left=new FormAttachment(0,10); la.setLayoutData(laData); this.labelText=this.getWidgetFactory().createText(composite, ""); FormData textData=new FormData(); textData.left=new FormAttachment(la,1); textData.top=new FormAttachment(0,12); textData.right=new FormAttachment(100,-10); this.labelText.setLayoutData(textData); }
/** * Set the layout of the widgets for the no progress case. * */ private void setLayoutsForNoProgress() { FormData buttonData = new FormData(); buttonData.top = new FormAttachment(progressLabel, 0, SWT.TOP); buttonData.right = new FormAttachment(100, IDialogConstants.HORIZONTAL_SPACING * -1); actionBar.setLayoutData(buttonData); if (taskEntries.size() > 0) { FormData linkData = new FormData(); linkData.top = new FormAttachment(progressLabel, IDialogConstants.VERTICAL_SPACING); linkData.left = new FormAttachment(progressLabel, 0, SWT.LEFT); linkData.right = new FormAttachment(actionBar, 0, SWT.LEFT); taskEntries.get(0).setLayoutData(linkData); } }
public TagListCombinedWidget(Composite parent, int style, Composite callLayoutOnMe) { super(parent, style); FormLayout layout = new FormLayout(); setLayout(layout); FormData selfFormData = new FormData(); selfFormData.top = new FormAttachment(0, 0); selfFormData.left = new FormAttachment(0, 0); selfFormData.right = new FormAttachment(100, 0); setLayoutData(selfFormData); tagList = new TagListCombo(this, SWT.NONE); FormData tagListFormData = new FormData(); tagListFormData.top = new FormAttachment(0, 0); tagListFormData.left = new FormAttachment(0, 0); tagListFormData.right = new FormAttachment(100, 0); tagList.getControl().setLayoutData(tagListFormData); tagListSelected = new TagListSelected(this, SWT.NONE, callLayoutOnMe); FormData tagListSelectedFormData = new FormData(); tagListSelectedFormData.top = new FormAttachment(tagList.getControl(), 0); tagListSelectedFormData.left = new FormAttachment(0, 0); tagListSelectedFormData.right = new FormAttachment(100, 0); tagListSelected.getWidget().setLayoutData(tagListSelectedFormData); }
private void addCodeButton() { wbCodes = new Button(wSettingComp, SWT.PUSH); wbCodes.setText( BaseMessages.getString( PKG, "SdmxDialog.AddCodes.Button")); props.setLook(wbCodes); fdCodes = new FormData(); fdCodes.left = new FormAttachment( wCodeList, margin ); fdCodes.top = new FormAttachment( wbDimensions, margin ); wbCodes.setLayoutData( fdCodes ); wbCodes.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event e) { StringBuilder builder = new StringBuilder(); int ind[] = wCodeList.getSelectionIndices(); for (int anInd : ind) { if (builder.length() > 0) { builder.append("+"); } builder.append(wCodeList.getItem(anInd)[0]); } updateDimensionTable( sdmxDialogData.getActiveDimensionId(), builder.toString() ); } }); }
private void addTableView() { int margin = Const.MARGIN; ColumnInfo[] colinf = new ColumnInfo[rowMeta.size()]; for ( int i = 0; i < rowMeta.size(); i++ ) { ValueMetaInterface v = rowMeta.getValueMeta( i ); colinf[i] = new ColumnInfo( v.getName(), ColumnInfo.COLUMN_TYPE_TEXT, v.isNumeric() ); colinf[i].setToolTip( v.toStringMeta() ); colinf[i].setValueMeta( v ); } wSeriesTable = new TableView( variables, shell, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, 0, null, props ); wSeriesTable.setShowingBlueNullValues( true ); //// TODO: 25/05/16 wat? fdSeriesTable = new FormData(); fdSeriesTable.left = new FormAttachment( 0, 0 ); fdSeriesTable.top = new FormAttachment( 0, margin ); fdSeriesTable.right = new FormAttachment( 100, 0 ); fdSeriesTable.bottom = new FormAttachment( 100, -50 ); wSeriesTable.setLayoutData( fdSeriesTable ); fillTableView(); }
@Override public void createControl(final Composite parent) { final Composite container = new Composite(parent, SWT.NULL); final FormLayout formLayout = new FormLayout(); formLayout.marginHeight = FormHelper.MarginHeight(); formLayout.marginWidth = FormHelper.MarginWidth(); formLayout.spacing = FormHelper.Spacing(); container.setLayout(formLayout); setControl(container); final Label errorLabel = new Label(container, SWT.WRAP); final FormData errorLabelData = new FormData(); errorLabelData.top = new FormAttachment(0, 0); errorLabelData.left = new FormAttachment(0, 0); errorLabel.setLayoutData(errorLabelData); errorLabel.setText(Messages.getString("SelectMergeTargetMappingWizardPage.ErrorLabelText")); //$NON-NLS-1$ ControlSize.setCharWidthHint(errorLabel, MergeWizard.TEXT_CHARACTER_WIDTH); }
private void createBaselessWarningMessage(final Composite container, final Control imageNeighbour) { final Image baselessWarningImage = imageHelper.getImage("images/common/warning.gif"); //$NON-NLS-1$ baselessWarningImageLabel = new Label(container, SWT.NONE); baselessWarningImageLabel.setImage(baselessWarningImage); baselessWarningImageLabel.setToolTipText( Messages.getString("SelectMergeSourceTargetWizardPage.BaselessWarningText")); //$NON-NLS-1$ final FormData baselessWarningImageLabelData = new FormData(); final int warningImageTopOffset = FormHelper.VerticalOffset(baselessWarningImageLabel, imageNeighbour); baselessWarningImageLabelData.top = new FormAttachment(imageNeighbour, warningImageTopOffset, SWT.TOP); baselessWarningImageLabelData.left = new FormAttachment(imageNeighbour, 2, SWT.RIGHT); baselessWarningImageLabel.setLayoutData(baselessWarningImageLabelData); baselessWarningLabel = new Label(container, SWT.NONE); final FormData baselessWarningLabelData = new FormData(); baselessWarningLabelData.top = new FormAttachment(targetCombo, 5, SWT.BOTTOM); baselessWarningLabelData.left = new FormAttachment(0, 0); baselessWarningLabel.setLayoutData(baselessWarningLabelData); baselessWarningLabel.setText(Messages.getString("SelectMergeSourceTargetWizardPage.BaselessWarningText")); //$NON-NLS-1$ setBaselessWarningVisibility(false); }
private void addDateChooser(final Composite compositeFields) { final Button open = new Button(compositeFields, SWT.PUSH); final FormData fd_dtPasswordExpire = new FormData(); fd_dtPasswordExpire.left = new FormAttachment(txtPasswordExpire, 10, SWT.RIGHT); fd_dtPasswordExpire.top = new FormAttachment(txtPasswordExpire, 0, SWT.TOP); fd_dtPasswordExpire.bottom = new FormAttachment(txtPasswordExpire, 0, SWT.BOTTOM); open.setLayoutData(fd_dtPasswordExpire); open.setText(Messages.getString("EditDialog.Calendar")); //$NON-NLS-1$ open.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { final DateDialog dialog = new DateDialog(shell); dialog.setDate(entryToEdit.getExpires()); final Date result = dialog.open(); if (result != null && !result.equals(entryToEdit.getExpires())) { txtPasswordExpire.setText(format(result)); setDirty(true); } } }); }
public void resetLayoutData() { if (text != null) { FormData fd_styledText = new FormData(); if (composite.getVisible()) fd_styledText.bottom = new FormAttachment(composite, 1); else fd_styledText.bottom = new FormAttachment(100); fd_styledText.right = new FormAttachment(100); fd_styledText.top = new FormAttachment(0); if (tree.getVisible()) fd_styledText.left = new FormAttachment(tree, 1); else fd_styledText.left = new FormAttachment(0); text.setLayoutData(fd_styledText); layout(); } }
private void addRowHandlingGroup() { wgRowHandling = new Group( wcConfig, SWT.SHADOW_NONE ); props.setLook( wgRowHandling ); wgRowHandling.setText( BaseMessages.getString( PKG, "CPythonScriptExecutorDialog.ConfigTab.RowHandlingGroup" ) ); FormLayout wglRowHandling = new FormLayout(); wglRowHandling.marginWidth = 10; wglRowHandling.marginHeight = 10; wgRowHandling.setLayout( wglRowHandling ); fd = new FormData(); fd.left = new FormAttachment( 0, 0 ); fd.right = new FormAttachment( 100, 0 ); fd.top = new FormAttachment( 0, 0 ); wgRowHandling.setLayoutData( fd ); addRowsToProcessControllers(); // Number of Rows to Process addReservoirSamplingControllers(); // Reservoir Sampling addRandomSeedControllers(); // Random Seed }
private void addOptionsGroup() { // add second group wgOptions = new Group( wcConfig, SWT.SHADOW_NONE ); props.setLook( wgOptions ); wgOptions.setText( BaseMessages.getString( PKG, "CPythonScriptExecutorDialog.ConfigTab.OptionsGroup" ) ); FormLayout optionsGroupLayout = new FormLayout(); optionsGroupLayout.marginWidth = 10; optionsGroupLayout.marginHeight = 10; wgOptions.setLayout( optionsGroupLayout ); FormData fd = new FormData(); fd.left = new FormAttachment( 0, 0 ); fd.right = new FormAttachment( 100, 0 ); fd.top = new FormAttachment( wgRowHandling, MARGIN ); wgOptions.setLayoutData( fd ); addIncludeInputInOutputControllers(); }
/*************************************************************************** * Define the split layout **************************************************************************/ private void defineSectionsLayout() { FormData section1_data = new FormData(); section1_data.left = new FormAttachment(0, 0); section1_data.right = new FormAttachment(100, 0); section1_data.top = new FormAttachment(0, 0); section1_data.bottom = new FormAttachment(m_sash, 0); m_presentationSection.setLayoutData(section1_data); FormData section2_data = new FormData(); section2_data.left = new FormAttachment(0, 0); section2_data.right = new FormAttachment(100, 0); section2_data.top = new FormAttachment(m_sash, 0); section2_data.bottom = new FormAttachment(100, 0); m_controlSection.setLayoutData(section2_data); m_sashData = new FormData(); m_sashData.top = new FormAttachment(0, 500); m_sashData.left = new FormAttachment(0, 0); m_sashData.right = new FormAttachment(100, 0); m_sash.setLayoutData(m_sashData); m_sash.addListener(SWT.Selection, this); }
@Override public void createControls(Composite parent, TabbedPropertySheetPage tabbedPropertySheetPage) { super.createControls(parent, tabbedPropertySheetPage); TabbedPropertySheetWidgetFactory factory = getWidgetFactory(); Composite composite = factory.createFlatFormComposite(parent); FormData data; timeDurationText = createText(composite, factory, null); createLabel(composite, "Time duration", timeDurationText, factory); //$NON-NLS-1$ timeDateText = createText(composite, factory, timeDurationText); createLabel(composite, "Time date (ISO 8601)", timeDateText, factory); //$NON-NLS-1$ timeCycleText = createText(composite, factory, timeDateText); createLabel(composite, "Time cycle", timeCycleText, factory); //$NON-NLS-1$ }
/** * Create the main composite. */ protected void createMainComposite() { mainComposite = factory.createComposite(this, SWT.NO_FOCUS); mainComposite.setBackgroundMode(SWT.INHERIT_FORCE); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; mainComposite.setLayout(layout); FormData formData = new FormData(); formData.left = new FormAttachment(0, 0); formData.right = new FormAttachment(100, 0); formData.top = new FormAttachment(0, 0); formData.bottom = new FormAttachment(100, 0); mainComposite.setLayoutData(formData); createMainContents(); }
/** * Aligns the buttons as left-aligned on the dialog * @param buttons the array of buttons to align * @param width the standardized width of all the buttons * @param margin the margin between buttons * @param lastControl (optional) the bottom most control used for aligning the buttons relative * to the bottom of the controls on the dialog */ protected static void leftAlignButtons(Button[] buttons, int width, int margin, Control lastControl) { for (int i = 0; i < buttons.length; ++i) { FormData formData = createDefaultFormData(buttons[i], width, margin, lastControl); // Set the left side of the buttons (either offset from the edge, or relative to the previous button) if (i == 0) { formData.left = new FormAttachment(0, margin); } else { formData.left = new FormAttachment(buttons[i - 1], margin); } // Apply the layout data buttons[i].setLayoutData(formData); } }
public void closeSearchResults(final Map params) { Utils.execSWTThread(new AERunnable() { public void runSupport() { detailsBrowser.setVisible(false); FormData gd = (FormData) mainBrowser.getLayoutData(); gd.bottom = new FormAttachment(100, 0); mainBrowser.setLayoutData(gd); mainBrowser.getParent().layout(true); detailsBrowser.setUrl("about:blank"); //mainBrowser.setUrl( (String)mainBrowser.getData( "StartURL" )); } }); }
private FormData standardSpacing(Control control, boolean isLabel) { FormData fd = new FormData(); if (isLabel) fd.left = new FormAttachment(0, 0); else fd.left = new FormAttachment(middle, 0); if (isLabel) fd.right = new FormAttachment(middle, -Const.MARGIN); else fd.right = new FormAttachment(100, 0); if (control != null) fd.top = new FormAttachment(control, Const.MARGIN+verticalPadding); else fd.top = new FormAttachment(0, Const.MARGIN+verticalPadding); verticalPadding = 0; return fd; }
/** * Construct a decorated field which is parented by the specified composite * and has the given style bits. Use the controlCreator to create the * specific kind of control that is decorated inside the field. * * @param parent * the parent of the decorated field. * @param style * the desired style bits for the field. * @param controlCreator * the IControlCreator used to specify the specific kind of * control that is to be decorated. * * @see IControlCreator */ public DecoratedField(Composite parent, int style, IControlCreator controlCreator) { this.form = createForm(parent); this.control = controlCreator.createControl(form, style); addControlListeners(); form.setTabList(new Control[] { control }); // Set up the initial layout data. FormData data = new FormData(); data.left = new FormAttachment(0, 0); data.top = new FormAttachment(0, 0); data.right = new FormAttachment(100, 0); data.bottom = new FormAttachment(100, 0); control.setLayoutData(data); }
/** * Create contents of the wizard. * * @param parent * The parent ui element to place this one into. */ public void createControl(Composite parent) { Composite container = new Composite(parent, SWT.NULL); container.setLayout(new FormLayout()); setControl(container); Group resultPresentationGrp = createResultPresentationGroup(container); ruleConfigurationGroup = new Group(container, SWT.NONE); ruleConfigurationGroup.setText("Refinement Detection"); ruleConfigurationGroup.setLayout(new FormLayout()); FormData ruleConfigGroupFD = createFormDataMargin(resultPresentationGrp); ruleConfigurationGroup.setLayoutData(ruleConfigGroupFD); generateRuleComponents(ruleConfigurationGroup); ruleConfigGroupFD.height = ruleConfigurationGroup.computeSize(SWT.DEFAULT, SWT.DEFAULT).y; boolean isRefinementBrowser = (this.resultPresentation == ResultPresentation.REFINEMENT_BROWSER); enableRulesDetection(isRefinementBrowser); }
/** * Setting the layout of a <i>Reset</i> option button. Either a button * image is set - if existing - or a text. * * @param button * The button */ private FormData layoutResetOptionButton(Button button) { FormData fd = new FormData(); Image editButton = GUIResource.getInstance().getResetOptionButton(); if (editButton != null) { button.setImage(editButton); button.setBackground(GUIResource.getInstance().getColorWhite()); fd.width = editButton.getBounds().width + 4; fd.height = editButton.getBounds().height; } else { button.setText(BaseMessages.getString(PKG, "EnterOptionsDialog.Button.Reset")); } button.setToolTipText(BaseMessages.getString(PKG, "EnterOptionsDialog.Button.Reset.Tooltip")); return fd; }
protected void placeWidget( Control widget ) { FormData data = new FormData(); if ( this.topPlacement >= 0 ) { data.top = new FormAttachment( this.topPlacement, this.topMargin ); } else if ( this.top != null ) { data.top = new FormAttachment( this.top, this.topMargin ); } if ( this.leftPlacement >= 0 ) { data.left = new FormAttachment( this.leftPlacement, this.leftMargin ); } else if ( this.left != null ) { data.left = new FormAttachment( this.left, this.leftMargin ); } if ( this.rightPlacement >= 0 ) { data.right = new FormAttachment( this.rightPlacement, -this.rightMargin ); } else if ( this.width > 0 ) { data.width = this.width; } if ( this.bottomPlacement >= 0 ) { data.bottom = new FormAttachment( this.bottomPlacement, -this.bottomMargin ); } else if ( this.height > 0 ) { data.height = this.height; } widget.setLayoutData( data ); }
/** * Create contents of the dialog. */ private void createContents() { shlAbout = new Shell(getParent(), getStyle()); shlAbout.setSize(426, 252); shlAbout.setText("About"); shlAbout.setLayout(new FormLayout()); Button btnNewButton = new Button(shlAbout, SWT.NONE); btnNewButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { shlAbout.dispose(); } }); FormData fd_btnNewButton = new FormData(); fd_btnNewButton.bottom = new FormAttachment(100, -10); fd_btnNewButton.right = new FormAttachment(100, -10); btnNewButton.setLayoutData(fd_btnNewButton); btnNewButton.setText("Close"); }
/** * Open the dialog. * @return the result */ public Object open() { createContents(); createTriggers(); lblSavedPath = new Label(shlUSBLogviewer, SWT.NONE); FormData fd_lblSavedPath = new FormData(); fd_lblSavedPath.right = new FormAttachment(btnParse, -6); fd_lblSavedPath.bottom = new FormAttachment(100, -15); fd_lblSavedPath.left = new FormAttachment(0, 10); lblSavedPath.setLayoutData(fd_lblSavedPath); shlUSBLogviewer.open(); shlUSBLogviewer.layout(); Display display = getParent().getDisplay(); while (!shlUSBLogviewer.isDisposed()) { if (!display.readAndDispatch()) { display.sleep(); } } return result; }
public void setTopControl(Control control){ FormData controlData = new FormData (); if(layout == SWT.HORIZONTAL){ controlData.left = new FormAttachment (0, 0); controlData.right = new FormAttachment (100, 0); controlData.top = new FormAttachment (0, 0); controlData.bottom = new FormAttachment (sash, 0); } else{ controlData.left = new FormAttachment (0, 0); controlData.right = new FormAttachment (sash, 0); controlData.top = new FormAttachment (0, 0); controlData.bottom = new FormAttachment (100, 0); } control.setLayoutData (controlData); }
/** * @param factory * factory to use. */ protected void buildFastloadLine(final PluginWidgetFactory factory) { final Control topControl = this.wVariableSubstitution; this.wlFastLoadPath = factory.createRightLabel(BaseMessages.getString(PKG, "TeraFastDialog.FastloadPath.Label")); this.props.setLook(this.wlFastLoadPath); this.wlFastLoadPath.setLayoutData(factory.createLabelLayoutData(topControl)); this.wbFastLoadPath = factory.createPushButton(BaseMessages.getString(PKG, "TeraFastDialog.Browse.Button")); this.props.setLook(this.wbFastLoadPath); FormData formData = factory.createControlLayoutData(topControl); formData.left = null; this.wbFastLoadPath.setLayoutData(formData); this.wFastLoadPath = factory.createSingleTextVarLeft(); this.props.setLook(this.wFastLoadPath); formData = factory.createControlLayoutData(topControl); formData.right = new FormAttachment(this.wbFastLoadPath, -factory.getMargin()); this.wFastLoadPath.setLayoutData(formData); }
/** * Aligns the buttons as right-aligned on the dialog * @param buttons the array of buttons to align * @param width the standardized width of all the buttons * @param margin the margin between buttons * @param lastControl (optional) the bottom most control used for aligning the buttons relative * to the bottom of the controls on the dialog */ protected static void rightAlignButtons(Button[] buttons, int width, int margin, Control lastControl) { for (int i = buttons.length - 1; i >= 0; --i) { FormData formData = createDefaultFormData(buttons[i], width, margin, lastControl); // Set the right side of the buttons (either offset from the edge, or relative to the previous button) if (i == buttons.length - 1) { formData.left = new FormAttachment(100, -(width + margin)); } else { formData.left = new FormAttachment(buttons[i + 1], -(2 * (width + margin)) - margin); } // Apply the layout data buttons[i].setLayoutData(formData); } }
/** * Initializes the {@link InfoBar} with "Yes" and "No" {@link Button buttons}. * * @param managedForm The {@link IManagedForm} instance. * @param yesListener The {@link SelectionListener} to handle the Yes button selection. */ protected void initYesNoInfoBar(IManagedForm managedForm, SelectionListener yesListener, SelectionListener noListener) { InfoBar infoBar = getInfoBar(); FormToolkit toolkit = managedForm.getToolkit(); Button yesButton = toolkit.createButton(infoBar, "Yes", SWT.PUSH); if (yesListener != null) { yesButton.addSelectionListener(yesListener); } Button noButton = toolkit.createButton(infoBar, "No", SWT.PUSH); if (noListener != null) { noButton.addSelectionListener(noListener); } FormData yesButtonFormData = new FormData(); yesButtonFormData.top = new FormAttachment(0, 0); yesButtonFormData.right = new FormAttachment(noButton); yesButton.setLayoutData(yesButtonFormData); FormData noButtonFormData = new FormData(); noButtonFormData.top = new FormAttachment(0, 0); noButtonFormData.right = new FormAttachment(100, 0); noButton.setLayoutData(noButtonFormData); FormData labelFormData = new FormData(); labelFormData.top = new FormAttachment(yesButton, 0, SWT.CENTER); labelFormData.left = new FormAttachment(0, 0); infoBar.getLabel().setLayoutData(labelFormData); }