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

The following examples show how to use org.eclipse.jdt.internal.ui.util.SWTUtil#setDefaultVisibleItemCount() . 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: PullUpMemberPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createSuperTypeCombo(Composite parent) {
	final Label label= new Label(parent, SWT.NONE);
	label.setText(RefactoringMessages.PullUpInputPage1_Select_destination);
	label.setLayoutData(new GridData());

	fSuperTypesCombo= new Combo(parent, SWT.READ_ONLY);
	SWTUtil.setDefaultVisibleItemCount(fSuperTypesCombo);
	if (fCandidateTypes.length > 0) {
		for (int i= 0; i < fCandidateTypes.length; i++) {
			final String comboLabel= fCandidateTypes[i].getFullyQualifiedName('.');
			fSuperTypesCombo.add(comboLabel);
		}
		fSuperTypesCombo.select(fCandidateTypes.length - 1);
		fSuperTypesCombo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	}
}
 
Example 2
Source File: FatJarPackageWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createLaunchConfigSelectionGroup(Composite parent) {
	fLaunchConfigurationCombo= new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
	SWTUtil.setDefaultVisibleItemCount(fLaunchConfigurationCombo);
	fLaunchConfigurationCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

	fLauchConfigurationModel.addAll(Arrays.asList(getLaunchConfigurations()));
	String[] names= new String[fLauchConfigurationModel.size()];
	for (int i= 0, size= fLauchConfigurationModel.size(); i < size; i++) {
		LaunchConfigurationElement element= fLauchConfigurationModel.get(i);
		names[i]= element.getLaunchConfigurationName();
	}
	fLaunchConfigurationCombo.setItems(names);

	fLaunchConfigurationCombo.addListener(SWT.Selection, this);
	fLaunchConfigurationCombo.addListener(SWT.Modify, this);
}
 
Example 3
Source File: OptionsConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
protected Combo newComboControl(Composite composite, Key key, String[] values, String[] valueLabels) {
	ControlData data= new ControlData(key, values);

	Combo comboBox= new Combo(composite, SWT.READ_ONLY);
	comboBox.setItems(valueLabels);
	comboBox.setData(data);
	comboBox.addSelectionListener(getSelectionListener());
	comboBox.setFont(JFaceResources.getDialogFont());
	SWTUtil.setDefaultVisibleItemCount(comboBox);

	makeScrollableCompositeAware(comboBox);

	updateCombo(comboBox);

	fComboBoxes.add(comboBox);
	return comboBox;
}
 
Example 4
Source File: FixedFatJarExportPage.java    From sarl with Apache License 2.0 6 votes vote down vote up
private void createLaunchConfigSelectionGroup(Composite parent) {
	fLaunchConfigurationCombo= new Combo(parent, SWT.DROP_DOWN | SWT.READ_ONLY);
	SWTUtil.setDefaultVisibleItemCount(fLaunchConfigurationCombo);
	fLaunchConfigurationCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

	fLauchConfigurationModel.addAll(Arrays.asList(getLaunchConfigurations()));
	String[] names= new String[fLauchConfigurationModel.size()];
	for (int i= 0, size= fLauchConfigurationModel.size(); i < size; i++) {
		LaunchConfigurationElement element= fLauchConfigurationModel.get(i);
		names[i]= element.getLaunchConfigurationName();
	}
	fLaunchConfigurationCombo.setItems(names);

	fLaunchConfigurationCombo.addListener(SWT.Selection, this);
	fLaunchConfigurationCombo.addListener(SWT.Modify, this);
}
 
Example 5
Source File: ComboSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	getShell().setText(fShellTitle);

	Composite composite = (Composite)super.createDialogArea(parent);
	Composite innerComposite = new Composite(composite, SWT.NONE);
	innerComposite.setLayoutData(new GridData());
	GridLayout gl= new GridLayout();
	gl.numColumns= 2;
	innerComposite.setLayout(gl);

	Label label= new Label(innerComposite, SWT.NONE);
	label.setText(fLabelText);
	label.setLayoutData(new GridData());

	final Combo combo= new Combo(innerComposite, SWT.READ_ONLY);
	SWTUtil.setDefaultVisibleItemCount(combo);
	for (int i = 0; i < fAllowedStrings.length; i++) {
		combo.add(fAllowedStrings[i]);
	}
	combo.select(fInitialSelectionIndex);
	fSelection= combo.getItem(combo.getSelectionIndex());
	GridData gd= new GridData();
	gd.widthHint= convertWidthInCharsToPixels(getMaxStringLength());
	combo.setLayoutData(gd);
	combo.addSelectionListener(new SelectionAdapter(){
		@Override
		public void widgetSelected(SelectionEvent e) {
			fSelection= combo.getItem(combo.getSelectionIndex());
		}
	});
	applyDialogFont(composite);
	return composite;
}
 
Example 6
Source File: JavadocWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
protected Combo createCombo(Composite composite, int style, String message, GridData gd) {
	Combo combo= new Combo(composite, style);
	SWTUtil.setDefaultVisibleItemCount(combo);
	if (message != null)
		combo.setText(message);
	combo.setLayoutData(gd);
	return combo;
}
 
Example 7
Source File: GenerateConstructorUsingFieldsSelectionDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
Composite addSuperClassConstructorChoices(Composite composite) {
	Label label= new Label(composite, SWT.NONE);
	label.setText(ActionMessages.GenerateConstructorUsingFieldsSelectionDialog_sort_constructor_choices_label);
	GridData gd= new GridData(GridData.FILL_HORIZONTAL);
	label.setLayoutData(gd);

	BindingLabelProvider provider= new BindingLabelProvider();
	final Combo combo= new Combo(composite, SWT.READ_ONLY);
	SWTUtil.setDefaultVisibleItemCount(combo);
	for (int i= 0; i < fSuperConstructors.length; i++) {
		combo.add(provider.getText(fSuperConstructors[i]));
	}

	// TODO: Can we be a little more intelligent about guessing the super() ?
	combo.setText(combo.getItem(0));
	combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	combo.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent e) {
			fSuperIndex= combo.getSelectionIndex();
			// Disable omit super checkbox unless default constructor
			fOmitSuperButton.setEnabled(getSuperConstructorChoice().getParameterTypes().length == 0);
			updateOKStatus();
		}
	});

	return composite;
}
 
Example 8
Source File: WhiteSpaceTabPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void createContents(int numColumns, Composite parent) {

            fPageBook= new PageBook(parent, SWT.NONE);
            fPageBook.setLayoutData(createGridData(numColumns, GridData.FILL_BOTH, SWT.DEFAULT));

            fJavaElementComponent.createContents(numColumns, fPageBook);
            fSyntaxComponent.createContents(numColumns, fPageBook);

            fSwitchCombo= new Combo(parent, SWT.READ_ONLY);
    		SWTUtil.setDefaultVisibleItemCount(fSwitchCombo);
            final GridData gd= createGridData(numColumns, GridData.HORIZONTAL_ALIGN_END, SWT.DEFAULT);
            fSwitchCombo.setLayoutData(gd);
            fSwitchCombo.setItems(fItems);
        }
 
Example 9
Source File: ProfileConfigurationBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private static Combo createProfileCombo(Composite composite, int span, int widthHint) {
	final GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	gd.horizontalSpan = span;
	gd.widthHint= widthHint;

	final Combo combo= new Combo(composite, SWT.DROP_DOWN | SWT.READ_ONLY );
	combo.setFont(composite.getFont());
	SWTUtil.setDefaultVisibleItemCount(combo);
	combo.setLayoutData(gd);
	return combo;
}
 
Example 10
Source File: ModifyDialogTabPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create a new ComboPreference.
 * @param composite The composite on which the SWT widgets are added.
 * @param numColumns The number of columns in the composite's GridLayout.
 * @param preferences The map to store the values.
 * @param key The key to store the values.
 * @param values An array of n elements indicating the values to store for each selection.
 * @param text The label text for this Preference.
 * @param items An array of n elements indicating the text to be written in the combo box.
 */
public ComboPreference(Composite composite, int numColumns,
						  Map<String, String> preferences, String key,
						  String [] values, String text, String [] items) {
    super(preferences, key);
    if (values == null || items == null || text == null)
        throw new IllegalArgumentException(FormatterMessages.ModifyDialogTabPage_error_msg_values_items_text_unassigned);
	fValues= values;
	fItems= items;
	createLabel(numColumns - 1, composite, text);
	fCombo= new Combo(composite, SWT.SINGLE | SWT.READ_ONLY);
	fCombo.setFont(composite.getFont());
	SWTUtil.setDefaultVisibleItemCount(fCombo);
	fCombo.setItems(items);

	int max= 0;
	for (int i= 0; i < items.length; i++)
	    if (items[i].length() > max) max= items[i].length();

	fCombo.setLayoutData(createGridData(1, GridData.HORIZONTAL_ALIGN_FILL, fCombo.computeSize(SWT.DEFAULT, SWT.DEFAULT).x));

	updateWidget();

	fCombo.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			comboSelected(((Combo)e.widget).getSelectionIndex());
		}
	});
}
 
Example 11
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();
		}
	});
}