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

The following examples show how to use org.eclipse.jdt.internal.ui.util.SWTUtil#setButtonDimensionHint() . 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: ChangeParametersControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private Button createEditButton(Composite buttonComposite) {
	Button button= new Button(buttonComposite, SWT.PUSH);
	button.setText(RefactoringMessages.ChangeParametersControl_buttons_edit);
	button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	SWTUtil.setButtonDimensionHint(button);
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			try {
				ParameterInfo[] selected= getSelectedElements();
				Assert.isTrue(selected.length == 1);
				ParameterInfo parameterInfo= selected[0];
				ParameterEditDialog dialog= new ParameterEditDialog(getShell(), parameterInfo, fMode.canChangeTypes(), fMode.canChangeDefault(), fTypeContext);
				dialog.open();
				fListener.parameterChanged(parameterInfo);
				fTableViewer.update(parameterInfo, PROPERTIES);
			} finally {
				fTableViewer.getControl().setFocus();
			}
		}
	});
	return button;
}
 
Example 2
Source File: PullUpMethodPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createButtonComposite(final Composite superComposite) {
	final Composite buttonComposite= new Composite(superComposite, SWT.NONE);
	buttonComposite.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false));
	final GridLayout layout= new GridLayout(2, false);
	layout.marginWidth= 0;
	buttonComposite.setLayout(layout);

	fSelectionLabel= new Label(buttonComposite, SWT.LEFT | SWT.WRAP | SWT.HORIZONTAL);
	GridData data= new GridData(GridData.BEGINNING, GridData.BEGINNING, true, false);
	data.widthHint= convertWidthInCharsToPixels(32);
	fSelectionLabel.setLayoutData(data);

	final Button button= new Button(buttonComposite, SWT.PUSH);
	button.setText(RefactoringMessages.PullUpInputPage2_Select);
	button.setLayoutData(new GridData());
	SWTUtil.setButtonDimensionHint(button);
	button.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(final SelectionEvent e) {
			checkPulledUp();
			updateSelectionLabel();
		}
	});
}
 
Example 3
Source File: ChangeParametersControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Button createButton(Composite buttonComposite, String text, final boolean up) {
	Button button= new Button(buttonComposite, SWT.PUSH);
	button.setText(text);
	button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	SWTUtil.setButtonDimensionHint(button);
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			ISelection savedSelection= fTableViewer.getSelection();
			if (savedSelection == null)
				return;
			ParameterInfo[] selection= getSelectedElements();
			if (selection.length == 0)
				return;

			if (up) {
				moveUp(selection);
			} else {
				moveDown(selection);
			}
			fTableViewer.refresh();
			fTableViewer.setSelection(savedSelection);
			fListener.parameterListChanged();
			fTableViewer.getControl().setFocus();
		}
	});
	return button;
}
 
Example 4
Source File: ExternalizeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Button createTaskButton(Composite parent, String label, SelectionAdapter adapter) {
	Button button= new Button(parent, SWT.PUSH);
	button.setText(label);
	button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	SWTUtil.setButtonDimensionHint(button);
	button.addSelectionListener(adapter);
	return button;
}
 
Example 5
Source File: ChangeExceptionsControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Button createAddButton(Composite buttonComposite) {
	Button button= new Button(buttonComposite, SWT.PUSH);
	button.setText(RefactoringMessages.ChangeExceptionsControl_buttons_add);
	button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	SWTUtil.setButtonDimensionHint(button);
	button.setEnabled(true);
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			doAddException();
		}
	});
	return button;
}
 
Example 6
Source File: JarOptionsPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void createDescriptionFileGroup(Composite parent) {
	// destination specification group
	fDescriptionFileGroup= new Composite(parent, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.numColumns= 3;
	fDescriptionFileGroup.setLayout(layout);
	fDescriptionFileGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL));

	fDescriptionFileLabel= new Label(fDescriptionFileGroup, SWT.NONE);
	fDescriptionFileLabel.setText(JarPackagerMessages.JarOptionsPage_descriptionFile_label);

	// destination name entry field
	fDescriptionFileText= new Text(fDescriptionFileGroup, SWT.SINGLE | SWT.BORDER);
	fDescriptionFileText.addListener(SWT.Modify, new UntypedListener());
	GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
	data.widthHint= convertWidthInCharsToPixels(40);
	fDescriptionFileText.setLayoutData(data);

	// destination browse button
	fDescriptionFileBrowseButton= new Button(fDescriptionFileGroup, SWT.PUSH);
	fDescriptionFileBrowseButton.setText(JarPackagerMessages.JarOptionsPage_browseButton_text);
	fDescriptionFileBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	SWTUtil.setButtonDimensionHint(fDescriptionFileBrowseButton);
	fDescriptionFileBrowseButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			handleDescriptionFileBrowseButtonPressed();
		}
	});
}
 
Example 7
Source File: JavadocTreeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected void createJavadocCommandSet(Composite composite) {

		final int numColumns= 2;

		GridLayout layout= createGridLayout(numColumns);
		layout.marginHeight= 0;
		layout.marginWidth= 0;
		Composite group = new Composite(composite, SWT.NONE);
		group.setLayoutData(createGridData(GridData.FILL_HORIZONTAL, 6, 0));
		group.setLayout(layout);

		createLabel(group, SWT.NONE, JavadocExportMessages.JavadocTreeWizardPage_javadoccommand_label, createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, numColumns, 0));
		fJavadocCommandText= createCombo(group, SWT.NONE, null, createGridData(GridData.FILL_HORIZONTAL, numColumns - 1, 0));

		fJavadocCommandText.addModifyListener(new ModifyListener() {
			public void modifyText(ModifyEvent e) {
				doValidation(JAVADOCSTATUS);
			}
		});

		final Button javadocCommandBrowserButton= createButton(group, SWT.PUSH, JavadocExportMessages.JavadocTreeWizardPage_javadoccommand_button_label, createGridData(GridData.HORIZONTAL_ALIGN_FILL, 1, 0));
		SWTUtil.setButtonDimensionHint(javadocCommandBrowserButton);

		javadocCommandBrowserButton.addSelectionListener(new SelectionAdapter() {
			@Override
			public void widgetSelected(SelectionEvent event) {
				browseForJavadocCommand();
			}
		});
	}
 
Example 8
Source File: AbstractJarDestinationWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected void createDestinationGroup(Composite parent) {

	initializeDialogUnits(parent);

	// destination specification group
	Composite destinationSelectionGroup= new Composite(parent, SWT.NONE);
	GridLayout layout= new GridLayout();
	layout.numColumns= 3;
	destinationSelectionGroup.setLayout(layout);
	destinationSelectionGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL));

	String label= getDestinationLabel();
	if (label != null) {
		new Label(destinationSelectionGroup, SWT.NONE).setText(label);
	} else {
		layout.marginWidth= 0;
		layout.marginHeight= 0;
	}

	// destination name entry field
	fDestinationNamesCombo= new Combo(destinationSelectionGroup, SWT.SINGLE | SWT.BORDER);
	SWTUtil.setDefaultVisibleItemCount(fDestinationNamesCombo);
	fDestinationNamesCombo.addListener(SWT.Modify, this);
	fDestinationNamesCombo.addListener(SWT.Selection, this);
	GridData data= new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
	data.widthHint= SIZING_TEXT_FIELD_WIDTH;
	data.horizontalSpan= label == null ? 2 : 1;
	fDestinationNamesCombo.setLayoutData(data);
	if (label == null) {
		SWTUtil.setAccessibilityText(fDestinationNamesCombo, JarPackagerMessages.AbstractJarDestinationWizardPage_destinationCombo_AccessibilityText);
	}

	// destination browse button
	fDestinationBrowseButton= new Button(destinationSelectionGroup, SWT.PUSH);
	fDestinationBrowseButton.setText(JarPackagerMessages.JarPackageWizardPage_browseButton_text);
	fDestinationBrowseButton.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	SWTUtil.setButtonDimensionHint(fDestinationBrowseButton);
	fDestinationBrowseButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			handleDestinationBrowseButtonPressed();
		}
	});
}
 
Example 9
Source File: JavadocStandardWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void createStyleSheetGroup(Composite composite) {
	Composite c= new Composite(composite, SWT.NONE);
	c.setLayout(createGridLayout(3));
	c.setLayoutData(createGridData(GridData.FILL_HORIZONTAL, 4, 0));
	((GridLayout) c.getLayout()).marginWidth= 0;

	fStyleSheetButton= createButton(c, SWT.CHECK, JavadocExportMessages.JavadocStandardWizardPage_stylesheettext_label, createGridData(1));
	fStyleSheetText= createText(c, SWT.SINGLE | SWT.BORDER, null, createGridData(GridData.FILL_HORIZONTAL, 1, 0));
	SWTUtil.setAccessibilityText(fStyleSheetText, JavadocExportMessages.JavadocStandardWizardPage_stylesheettext_description);
	//there really aught to be a way to specify this
	 ((GridData) fStyleSheetText.getLayoutData()).widthHint= 200;
	fStyleSheetBrowseButton= createButton(c, SWT.PUSH, JavadocExportMessages.JavadocStandardWizardPage_stylesheetbrowsebutton_label, createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 0));
	SWTUtil.setButtonDimensionHint(fStyleSheetBrowseButton);

	String str= fStore.getStyleSheet();
	if (str.equals("")) { //$NON-NLS-1$
		//default
		fStyleSheetText.setEnabled(false);
		fStyleSheetBrowseButton.setEnabled(false);
	} else {
		fStyleSheetButton.setSelection(true);
		fStyleSheetText.setText(str);
	}

	//Listeners
	fStyleSheetButton.addSelectionListener(new ToggleSelectionAdapter(new Control[] { fStyleSheetText, fStyleSheetBrowseButton }) {
		@Override
		public void validate() {
			doValidation(STYLESHEETSTATUS);
		}
	});

	fStyleSheetText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			doValidation(STYLESHEETSTATUS);
		}
	});

	fStyleSheetBrowseButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			handleFileBrowseButtonPressed(fStyleSheetText, new String[] { "*.css" }, JavadocExportMessages.JavadocSpecificsWizardPage_stylesheetbrowsedialog_title);  //$NON-NLS-1$
		}
	});

}
 
Example 10
Source File: JavadocSpecificsWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void createExtraOptionsGroup(Composite composite) {
	Composite c= new Composite(composite, SWT.NONE);
	c.setLayout(createGridLayout(3));
	c.setLayoutData(createGridData(GridData.FILL_HORIZONTAL, 3, 0));
	((GridLayout) c.getLayout()).marginWidth= 0;

	fOverViewButton= createButton(c, SWT.CHECK, JavadocExportMessages.JavadocSpecificsWizardPage_overviewbutton_label, createGridData(1));
	fOverViewText= createText(c, SWT.SINGLE | SWT.BORDER, null, createGridData(GridData.FILL_HORIZONTAL, 1, 0));
	SWTUtil.setAccessibilityText(fOverViewText, JavadocExportMessages.JavadocSpecificsWizardPage_overviewbutton_description);
	//there really aught to be a way to specify this
	 ((GridData) fOverViewText.getLayoutData()).widthHint= 200;
	fOverViewBrowseButton= createButton(c, SWT.PUSH, JavadocExportMessages.JavadocSpecificsWizardPage_overviewbrowse_label, createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 0));
	SWTUtil.setButtonDimensionHint(fOverViewBrowseButton);

	String str= fStore.getOverview();
	if (str.length() == 0) {
		//default
		fOverViewText.setEnabled(false);
		fOverViewBrowseButton.setEnabled(false);
	} else {
		fOverViewButton.setSelection(true);
		fOverViewText.setText(str);
	}

	createLabel(composite, SWT.NONE, JavadocExportMessages.JavadocSpecificsWizardPage_vmoptionsfield_label, createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 3, 0));
	fVMOptionsText= createText(composite, SWT.SINGLE | SWT.BORDER, null, createGridData(GridData.HORIZONTAL_ALIGN_FILL, 3, 0));
	fVMOptionsText.setText(fStore.getVMParams());


	createLabel(composite, SWT.NONE, JavadocExportMessages.JavadocSpecificsWizardPage_extraoptionsfield_label, createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 3, 0));
	fExtraOptionsText= createText(composite, SWT.MULTI | SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL, null, createGridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.FILL_VERTICAL, 3, 0));
	//fExtraOptionsText.setSize(convertWidthInCharsToPixels(60), convertHeightInCharsToPixels(10));

	fExtraOptionsText.setText(fStore.getAdditionalParams());

	Composite inner= new Composite(composite, SWT.NONE);
	inner.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, false, false, 3, 1));
	GridLayout layout= new GridLayout(2, false);
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	inner.setLayout(layout);

	createLabel(inner, SWT.NONE, JavadocExportMessages.JavadocSpecificsWizardPage_sourcecompatibility_label, createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 0));

	fSourceCombo= createCombo(inner, SWT.NONE, fStore.getSource(), createGridData(1));
	String[] versions= { "-", //$NON-NLS-1$
			JavaCore.VERSION_1_3, JavaCore.VERSION_1_4, JavaCore.VERSION_1_5, JavaCore.VERSION_1_6, JavaCore.VERSION_1_7, JavaCore.VERSION_1_8 };
	fSourceCombo.setItems(versions);
	fSourceCombo.setText(fStore.getSource());


	//Listeners
	fOverViewButton.addSelectionListener(new ToggleSelectionAdapter(new Control[] { fOverViewBrowseButton, fOverViewText }) {
		@Override
		public void validate() {
			doValidation(OVERVIEWSTATUS);
		}
	});

	fOverViewText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			doValidation(OVERVIEWSTATUS);
		}
	});

	fOverViewBrowseButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			handleFileBrowseButtonPressed(fOverViewText, new String[] { "*.html" }, JavadocExportMessages.JavadocSpecificsWizardPage_overviewbrowsedialog_title);  //$NON-NLS-1$
		}
	});

}
 
Example 11
Source File: JavadocSpecificsWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
private void createAntGroup(Composite composite) {
	Composite c= new Composite(composite, SWT.NONE);
	c.setLayout(createGridLayout(3));
	c.setLayoutData(createGridData(GridData.FILL_HORIZONTAL, 3, 0));
	((GridLayout) c.getLayout()).marginWidth= 0;

	fAntButton= createButton(c, SWT.CHECK, JavadocExportMessages.JavadocSpecificsWizardPage_antscriptbutton_label, createGridData(3));
	createLabel(c, SWT.NONE, JavadocExportMessages.JavadocSpecificsWizardPage_antscripttext_label, createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 1, 0));
	fAntText= createText(c, SWT.SINGLE | SWT.BORDER, null, createGridData(GridData.FILL_HORIZONTAL, 1, 0));
	//there really aught to be a way to specify this
	 ((GridData) fAntText.getLayoutData()).widthHint= 200;

	fAntText.setText(fStore.getAntpath());

	fAntBrowseButton= createButton(c, SWT.PUSH, JavadocExportMessages.JavadocSpecificsWizardPage_antscriptbrowse_label, createGridData(GridData.HORIZONTAL_ALIGN_END, 1, 0));
	SWTUtil.setButtonDimensionHint(fAntBrowseButton);
	fAntText.setEnabled(false);
	fAntBrowseButton.setEnabled(false);

	fCheckbrowser= createButton(c, SWT.CHECK, JavadocExportMessages.JavadocSpecificsWizardPage_openbrowserbutton_label, createGridData(3));
	fCheckbrowser.setSelection(fStore.doOpenInBrowser());

	fAntButton.addSelectionListener(new ToggleSelectionAdapter(new Control[] { fAntText, fAntBrowseButton }) {
		@Override
		public void validate() {
			doValidation(ANTSTATUS);
		}
	});

	fAntText.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			doValidation(ANTSTATUS);
		}
	});

	fAntBrowseButton.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent event) {
			String temp= fAntText.getText();
			IPath path= Path.fromOSString(temp);
			String file= path.lastSegment();
			if (file == null)
				file= "javadoc.xml";//$NON-NLS-1$
			path= path.removeLastSegments(1);

			String selected= handleFolderBrowseButtonPressed(path.toOSString(), JavadocExportMessages.JavadocSpecificsWizardPage_antscriptbrowsedialog_title, JavadocExportMessages.JavadocSpecificsWizardPage_antscriptbrowsedialog_label);

			path= Path.fromOSString(selected).append(file);
			fAntText.setText(path.toOSString());

		}
	});
}