Java Code Examples for org.eclipse.jdt.internal.ui.util.SWTUtil#getButtonWidthHint()

The following examples show how to use org.eclipse.jdt.internal.ui.util.SWTUtil#getButtonWidthHint() . 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: JarManifestWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * Makes the size of all buttons equal.
 */
protected void setEqualButtonSizes() {
	int width= SWTUtil.getButtonWidthHint(fManifestFileBrowseButton);
	int width2= SWTUtil.getButtonWidthHint(fNewManifestFileBrowseButton);
	width= Math.max(width, width2);

	width2= SWTUtil.getButtonWidthHint(fSealedPackagesDetailsButton);
	width= Math.max(width, width2);

	width2= SWTUtil.getButtonWidthHint(fUnSealedPackagesDetailsButton);
	width= Math.max(width, width2);

	width2= SWTUtil.getButtonWidthHint(fMainClassBrowseButton);
	width= Math.max(width, width2);

	setSize(fManifestFileBrowseButton, width, SWT.DEFAULT);
	setSize(fNewManifestFileBrowseButton, width, SWT.DEFAULT);
	setSize(fSealedPackagesDetailsButton, width, SWT.DEFAULT);
	setSize(fUnSealedPackagesDetailsButton, width, SWT.DEFAULT);
	setSize(fMainClassBrowseButton, width, SWT.DEFAULT);
}
 
Example 2
Source File: SelectionButtonDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public Control[] doFillIntoGrid(Composite parent, int nColumns) {
	assertEnoughColumns(nColumns);

	Button button= getSelectionButton(parent);
	GridData gd= new GridData();
	gd.horizontalSpan= nColumns;
	gd.horizontalAlignment= GridData.FILL;
	if (fButtonStyle == SWT.PUSH) {
		gd.widthHint = SWTUtil.getButtonWidthHint(button);
	}

	button.setLayoutData(gd);

	return new Control[] { button };
}
 
Example 3
Source File: ModuleSelectionDialogButtonField.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
private static GridData gridDataForButton(Button button, int span) {
  GridData gd = new GridData();
  gd.horizontalAlignment = GridData.FILL;
  gd.grabExcessHorizontalSpace = false;
  gd.horizontalSpan = span;
  gd.widthHint = SWTUtil.getButtonWidthHint(button);
  return gd;
}
 
Example 4
Source File: ProfileConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static Button createButton(Composite composite, String text, final int style) {
	final Button button= new Button(composite, SWT.PUSH);
	button.setFont(composite.getFont());
	button.setText(text);

	final GridData gd= new GridData(style);
	gd.widthHint= SWTUtil.getButtonWidthHint(button);
	button.setLayoutData(gd);
	return button;
}
 
Example 5
Source File: ListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected Button createButton(Composite parent, String label, SelectionListener listener) {
	Button button= new Button(parent, SWT.PUSH);
	button.setFont(parent.getFont());
	button.setText(label);
	button.addSelectionListener(listener);
	GridData gd= new GridData();
	gd.horizontalAlignment= GridData.FILL;
	gd.grabExcessHorizontalSpace= true;
	gd.verticalAlignment= GridData.BEGINNING;
	gd.widthHint = SWTUtil.getButtonWidthHint(button);

	button.setLayoutData(gd);

	return button;
}
 
Example 6
Source File: TreeListDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected Button createButton(Composite parent, String label, SelectionListener listener) {
	Button button= new Button(parent, SWT.PUSH);
	button.setFont(parent.getFont());
	button.setText(label);
	button.addSelectionListener(listener);
	GridData gd= new GridData();
	gd.horizontalAlignment= GridData.FILL;
	gd.grabExcessHorizontalSpace= true;
	gd.verticalAlignment= GridData.BEGINNING;
	gd.widthHint= SWTUtil.getButtonWidthHint(button);

	button.setLayoutData(gd);
	return button;
}
 
Example 7
Source File: StringButtonDialogField.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected static GridData gridDataForButton(Button button, int span) {
	GridData gd= new GridData();
	gd.horizontalAlignment= GridData.FILL;
	gd.grabExcessHorizontalSpace= false;
	gd.horizontalSpan= span;
	gd.widthHint = SWTUtil.getButtonWidthHint(button);
	return gd;
}
 
Example 8
Source File: OutputLocationDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite= (Composite)super.createDialogArea(parent);

	int widthHint= convertWidthInCharsToPixels(70);
	int indent= convertWidthInCharsToPixels(4);

	Composite inner= new Composite(composite, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	layout.numColumns= 2;
	inner.setLayout(layout);

	fUseDefault.doFillIntoGrid(inner, 2);
	fUseSpecific.doFillIntoGrid(inner, 2);

	Text textControl= fContainerDialogField.getTextControl(inner);
	GridData textData= new GridData();
	textData.widthHint= widthHint;
	textData.grabExcessHorizontalSpace= true;
	textData.horizontalIndent= indent;
	textControl.setLayoutData(textData);

	Button buttonControl= fContainerDialogField.getChangeControl(inner);
	GridData buttonData= new GridData();
	buttonData.widthHint= SWTUtil.getButtonWidthHint(buttonControl);
	buttonControl.setLayoutData(buttonData);

	applyDialogFont(composite);
	return composite;
}
 
Example 9
Source File: ReferencesInBinaryStatusContextViewer.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
public void createControl(Composite parent) {
	fForm= new ViewForm(parent, SWT.BORDER | SWT.FLAT);
	fForm.marginWidth= 0;
	fForm.marginHeight= 0;

	fLabel= new CLabel(fForm, SWT.NONE);
	fLabel.setText(RefactoringMessages.ReferencesInBinaryStatusContextViewer_title);
	fForm.setTopLeft(fLabel);

	Composite composite= new Composite(fForm, SWT.NONE);
	composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	GridLayout layout= new GridLayout(1, false);
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	composite.setLayout(layout);


	fTreeViewer= new TreeViewer(composite, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL);
	final AppearanceAwareLabelProvider labelProvider= new AppearanceAwareLabelProvider();
	fTreeViewer.setLabelProvider(new DelegatingStyledCellLabelProvider(labelProvider));
	fTreeViewer.setComparator(new ViewerComparator() {
		private Collator fCollator= Collator.getInstance();
		@Override
		public int compare(Viewer viewer, Object e1, Object e2) {
			String l1= labelProvider.getText(e1);
			String l2= labelProvider.getText(e2);
			return fCollator.compare(l1, l2);
		}
	});
	fTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	fButton= new Button(composite, SWT.PUSH);
	fButton.setText(RefactoringMessages.ReferencesInBinaryStatusContextViewer_show_as_search_button);
	GridData layoutData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false);
	layoutData.widthHint= SWTUtil.getButtonWidthHint(fButton);
	fButton.setLayoutData(layoutData);
	fButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			fillInSearchView();
		}
	});
	fButton.setEnabled(false);

	fForm.setContent(composite);

	Dialog.applyDialogFont(parent);
}