Java Code Examples for org.eclipse.swt.widgets.Button#getLayoutData()
The following examples show how to use
org.eclipse.swt.widgets.Button#getLayoutData() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SWTUtil.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
/** * Sets width and height hint for the button control.<br> * <b>Note:</b> This is a NOP if the button's layout data is not an instance of <code>GridData</code>. * * @param button * the button for which to set the dimension hint */ public static void setButtonDimensionHint(Button button) { Assert.isNotNull(button); Object gd = button.getLayoutData(); if (gd instanceof GridData) { ((GridData) gd).widthHint = getButtonWidthHint(button); ((GridData) gd).horizontalAlignment = GridData.FILL; } }
Example 2
Source File: SWTFactory.java From goclipse with Eclipse Public License 1.0 | 5 votes |
/** * Sets width and height hint for the button control. * <b>Note:</b> This is a NOP if the button's layout data is not * an instance of <code>GridData</code>. * * @param the button for which to set the dimension hint */ public static void setButtonDimensionHint(Button button) { Assert.isNotNull(button); Object gd= button.getLayoutData(); if (gd instanceof GridData) { ((GridData)gd).widthHint= getButtonWidthHint(button); ((GridData)gd).horizontalAlignment = GridData.FILL; } }
Example 3
Source File: SWTUtil.java From Pydev with Eclipse Public License 1.0 | 5 votes |
/** * Sets width and height hint for the button control. * <b>Note:</b> This is a NOP if the button's layout data is not * an instance of <code>GridData</code>. * * @param button the button for which to set the dimension hint */ public static void setButtonDimensionHint(Button button) { Assert.isNotNull(button); Object gd = button.getLayoutData(); if (gd instanceof GridData) { ((GridData) gd).widthHint = getButtonWidthHint(button); ((GridData) gd).horizontalAlignment = GridData.FILL; } }
Example 4
Source File: StringVariableSelectionDialog.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * @param button */ public static void setButtonDimensionHint( Button button ) { Assert.isNotNull( button ); Object gd = button.getLayoutData( ); if ( gd instanceof GridData ) { ( (GridData) gd ).widthHint = getButtonWidthHint( button ); ( (GridData) gd ).horizontalAlignment = GridData.FILL; } }
Example 5
Source File: ScriptSWTFactory.java From birt with Eclipse Public License 1.0 | 5 votes |
/** * @param button */ private static void setButtonDimensionHint( Button button ) { Assert.isNotNull( button ); Object gd = button.getLayoutData( ); if ( gd instanceof GridData ) { ( (GridData) gd ).widthHint = getButtonWidthHint( button ); ( (GridData) gd ).horizontalAlignment = GridData.FILL; } }
Example 6
Source File: CustomPreviewTable.java From birt with Eclipse Public License 1.0 | 5 votes |
public void moveTo(int index ) { int offset = 0; for ( int i = 0; i <= index; i++ ) { offset += columnWidths.get( i ).intValue( ) ; } if ( offset > this.getVisibleTableWidth( ) ) { offset -= this.getVisibleTableWidth( ); iHiddenWidth = offset; // APPLY PIXEL SHIFT TO RELOCATE BUTTONS if ( btnHeaders.size( ) > 0 ) { // MOVE ALL BUTTONS TO THE LEFT...AS MUCH AS THE // SCROLLING VALUE Button btn = btnHeaders.get( 0 ); ( (FormData) btn.getLayoutData( ) ).left = new FormAttachment( 0, -offset ); } } getHorizontalBar( ).setSelection( offset ); cmpHeaders.layout( ); selectColumn( index ); iLastProcessedHorizontalScrollPosition = getHorizontalBar( ).getSelection( ); redraw( ); }
Example 7
Source File: ApplyButtonHandler.java From birt with Eclipse Public License 1.0 | 5 votes |
public void setButton( Button button ) { this.button = button; ( (GridData) button.getLayoutData( ) ).horizontalIndent = 10; // Default status is disabled button.setEnabled( false ); }
Example 8
Source File: WizardUtils.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
public static Button createRadio(Composite parent, String text, int span, SelectionListener listener, int indent) { Button btn = createRadio(parent, text, span, listener); GridData gridData = (GridData) btn.getLayoutData(); gridData.horizontalIndent = indent; return btn; }
Example 9
Source File: WizardUtils.java From XPagesExtensionLibrary with Apache License 2.0 | 5 votes |
public static Button createCheckBox(Composite parent, String text, int span, boolean select, int indent) { Button btn = createCheckBox(parent, text,span, select); GridData gridData = (GridData) btn.getLayoutData(); gridData.horizontalIndent = indent; return btn; }
Example 10
Source File: SWTUtil.java From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 | 5 votes |
/** * Sets width and height hint for the button control. * <b>Note:</b> This is a NOP if the button's layout data is not * an instance of <code>GridData</code>. * * @param button the button for which to set the dimension hint */ public static void setButtonDimensionHint(Button button) { Assert.isNotNull(button); Object gd= button.getLayoutData(); if (gd instanceof GridData) { ((GridData)gd).widthHint= getButtonWidthHint(button); ((GridData)gd).horizontalAlignment = GridData.FILL; } }
Example 11
Source File: SWTFactory.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Sets width and height hint for the button control. <b>Note:</b> This is a NOP if the button's layout data is not * an instance of <code>GridData</code>. * * @param the * button for which to set the dimension hint */ public static void setButtonDimensionHint(Button button) { Object gd = button.getLayoutData(); if (gd instanceof GridData) { ((GridData) gd).widthHint = getButtonWidthHint(button); ((GridData) gd).horizontalAlignment = GridData.FILL; } }
Example 12
Source File: SWTUtil.java From APICloud-Studio with GNU General Public License v3.0 | 5 votes |
/** * Sets width and height hint for the button control. <b>Note:</b> This is a NOP if the button's layout data is not * an instance of <code>GridData</code>. * * @param the * button for which to set the dimension hint */ public static void setButtonDimensionHint(Button button) { Assert.isNotNull(button); Object gd = button.getLayoutData(); if (gd instanceof GridData) { ((GridData) gd).widthHint = getButtonWidthHint(button); ((GridData) gd).horizontalAlignment = GridData.FILL; } }
Example 13
Source File: SWTFactory.java From tlaplus with MIT License | 5 votes |
/** * Sets width and height hint for the button control. * <b>Note:</b> This is a NOP if the button's layout data is not * an instance of <code>GridData</code>. * * @param the button for which to set the dimension hint */ public static void setButtonDimensionHint(Button button) { Assert.isNotNull(button); Object gd = button.getLayoutData(); if (gd instanceof GridData) { ((GridData)gd).widthHint = getButtonWidthHint(button); ((GridData)gd).horizontalAlignment = GridData.FILL; } }
Example 14
Source File: DotExportRadioGroupFieldEditor.java From gef with Eclipse Public License 2.0 | 5 votes |
protected void showOpenExportedFileBooleanFieldEditor() { // show the open exported file automatically boolean field editor Button checkBox = openExportedFileBooleanFieldEditor .getChangeControl(parent); checkBox.setVisible(true); ((GridData) checkBox.getLayoutData()).exclude = false; }
Example 15
Source File: DotExportRadioGroupFieldEditor.java From gef with Eclipse Public License 2.0 | 5 votes |
protected void hideOpenExportedFileBooleanFieldEditor() { // hide the open exported file automatically boolean field editor Button checkBox = openExportedFileBooleanFieldEditor .getChangeControl(parent); checkBox.setVisible(false); ((GridData) checkBox.getLayoutData()).exclude = true; }
Example 16
Source File: SWTFactory.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
public static void setButtonDimensionHint(Button button) { Assert.isNotNull(button); Object gd= button.getLayoutData(); if (gd instanceof GridData) { ((GridData)gd).widthHint= getButtonWidthHint(button); ((GridData)gd).horizontalAlignment = GridData.FILL; } }
Example 17
Source File: TabPageIndentation.java From xds-ide with Eclipse Public License 1.0 | 5 votes |
private Control addSettingControl(Composite parent, FormatterProfile.IndentSetting bs, String label) { if (bs.isRange()) { Button cbox = null; if (bs.isRangeWithCheckbox()) { cbox = SWTFactory.createCheckbox(parent, label, 1); } else { SWTFactory.createLabel(parent, label, 1); } Combo cmb = SWTFactory.createCombo(parent, 1, SWT.DROP_DOWN | SWT.READ_ONLY, GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_END); for (int i=bs.getMinVal(); i<=bs.getMaxVal(); ++i) { cmb.add(""+i); //$NON-NLS-1$ } cmb.select(fp.getValueForDialog(bs) - bs.getMinVal()); SettingSelectionListener ssl = new SettingSelectionListener(cmb, cbox, bs); cmb.addSelectionListener(ssl); if (cbox != null) { boolean unch = fp.getRangeCheckboxUncheckedState(bs); cbox.setSelection(!unch); cmb.setEnabled(!unch); cbox.addSelectionListener(ssl); } return cmb; } else { Button cb = SWTFactory.createCheckbox(parent, label, 2); cb.setSelection(fp.getAsBoolean(bs)); cb.addSelectionListener(new SettingSelectionListener(cb, null, bs)); GridData gd = (GridData)cb.getLayoutData(); gd.heightHint = prefHeight; cb.setLayoutData(gd); return cb; } }
Example 18
Source File: CustomPreviewTable.java From birt with Eclipse Public License 1.0 | 4 votes |
public void widgetSelected( SelectionEvent e ) { if ( e.getSource( ) instanceof ScrollBar ) { ScrollBar sb = (ScrollBar) e.getSource( ); if ( ( sb.getStyle( ) | SWT.H_SCROLL ) == SWT.H_SCROLL ) { if ( iLastProcessedHorizontalScrollPosition == 0 ) { // Initialize the value iLastProcessedHorizontalScrollPosition = cnvCells.getVisibleTableWidth( ); } if ( sb.getSelection( ) == iLastProcessedHorizontalScrollPosition ) { return; } if ( ( sb.getStyle( ) | SWT.H_SCROLL ) == SWT.H_SCROLL ) { // CALCULATE PIXEL SHIFT IN BUTTON POSITION int iShift = 0; if ( e.detail == SWT.ARROW_UP || e.detail == SWT.PAGE_UP ) { // SHIFT HEADERS ONE COLUMN TO THE RIGHT iShift = -SCROLL_HORIZONTAL_STEP; } else if ( e.detail == SWT.ARROW_DOWN || e.detail == SWT.PAGE_DOWN ) { // SHIFT HEADERS ONE COLUMN TO THE LEFT iShift = SCROLL_HORIZONTAL_STEP; } else { iShift = sb.getSelection( ) - iLastProcessedHorizontalScrollPosition; } iHiddenWidth += iShift; // Correction for negative value or overflow if ( iHiddenWidth < 0 ) { iShift -= iHiddenWidth; iHiddenWidth = 0; } else if ( iHiddenWidth + getVisibleTableWidth( ) > getMaxTableWidth( ) ) { int diff = getMaxTableWidth( ) - getVisibleTableWidth( ) - iHiddenWidth; iShift += diff; iHiddenWidth += diff; } // APPLY PIXEL SHIFT TO RELOCATE BUTTONS if ( btnHeaders.size( ) > 0 ) { // MOVE ALL BUTTONS TO THE LEFT...AS MUCH AS THE // SCROLLING VALUE Button btn = btnHeaders.get( 0 ); ( (FormData) btn.getLayoutData( ) ).left = new FormAttachment( 0, btn.getLocation( ).x - iShift ); } cmpHeaders.layout( ); // UPDATE LAST HORIZONTAL SCROLL POSITION iLastProcessedHorizontalScrollPosition = sb.getSelection( ); } } else { if ( getVerticalBar( ).getSelection( ) == iLastProcessedVerticalScrollPosition ) { return; } if ( e.detail == SWT.ARROW_UP || e.detail == SWT.PAGE_UP ) { if ( iVScroll > 0 ) { iVScroll--; } } else if ( e.detail == SWT.ARROW_DOWN || e.detail == SWT.PAGE_DOWN ) { iVScroll++; } else { iVScroll += ( sb.getSelection( ) - iLastProcessedVerticalScrollPosition ); } iLastProcessedVerticalScrollPosition = sb.getSelection( ); } redraw( ); } }
Example 19
Source File: WorkspaceMergeDialog.java From MergeProcessor with Apache License 2.0 | 4 votes |
/** * {@inheritDoc} */ @Override protected void finishedRun() { clearCursors(); if (isConfirmCommit) { ((RowData) buttonConfirmCommit.getLayoutData()).exclude = false; buttonConfirmCommit.setVisible(true); } if (commitButton.getListeners(SWT.Selection).length > 1) { commitButton.setVisible(true); ((GridData) commitButton.getLayoutData()).exclude = false; if (isConfirmCommit) { commitButton.setEnabled(false); } } if (openButton.getListeners(SWT.Selection).length > 1) { openButton.setVisible(true); ((GridData) openButton.getLayoutData()).exclude = false; } if (openWorkingCopyButton.getListeners(SWT.Selection).length > 1) { openWorkingCopyButton.setVisible(true); ((GridData) openWorkingCopyButton.getLayoutData()).exclude = false; } if (openTortoiseSvnButton.getListeners(SWT.Selection).length > 1) { openTortoiseSvnButton.setVisible(true); ((GridData) openTortoiseSvnButton.getLayoutData()).exclude = false; } closeButton.setVisible(true); ((GridData) closeButton.getLayoutData()).exclude = false; final Button cancelButton = getButton(IDialogConstants.CANCEL_ID); cancelButton.setVisible(false); ((GridData) cancelButton.getLayoutData()).exclude = true; if (warningsTableViewer.getList().getItemCount() > 0) { ((GridData) warningsTableViewer.getList().getParent().getLayoutData()).exclude = false; warningsTableViewer.getList().setVisible(true); } final Point size = getShell().computeSize(SWT.DEFAULT, SWT.DEFAULT); getShell().setSize(size); getShell().layout(true, true); }
Example 20
Source File: NewFolderDialogOfHs.java From translationstudio8 with GNU General Public License v2.0 | votes |
/** * Creates the widget for advanced options. * * @param parent the parent composite */ protected void createAdvancedControls(Composite parent) { Preferences preferences = ResourcesPlugin.getPlugin() .getPluginPreferences(); if (preferences.getBoolean(ResourcesPlugin.PREF_DISABLE_LINKING) == false && isValidContainer()) { linkedResourceParent = new Composite(parent, SWT.NONE); linkedResourceParent.setFont(parent.getFont()); linkedResourceParent.setLayoutData(new GridData( GridData.FILL_HORIZONTAL)); GridLayout layout = new GridLayout(); layout.marginHeight = 0; layout.marginWidth = 0; linkedResourceParent.setLayout(layout); advancedButton = new Button(linkedResourceParent, SWT.PUSH); advancedButton.setFont(linkedResourceParent.getFont()); advancedButton.setText(IDEWorkbenchMessages.showAdvanced); setButtonLayoutData(advancedButton); GridData data = (GridData) advancedButton.getLayoutData(); data.horizontalAlignment = GridData.BEGINNING; advancedButton.setLayoutData(data); advancedButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { handleAdvancedButtonSelect(); } }); } linkedResourceGroup = new CreateLinkedResourceGroup(IResource.FOLDER, new Listener() { public void handleEvent(Event e) { validateLinkedResource(); firstLinkCheck = false; } }, new CreateLinkedResourceGroup.IStringValue() { public void setValue(String string) { folderNameField.setText(string); } public String getValue() { return folderNameField.getText(); } public IResource getResource() { return container; } }); }