Java Code Examples for org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil#setHorizontalGrabbing()

The following examples show how to use org.eclipse.jdt.internal.ui.wizards.dialogfields.LayoutUtil#setHorizontalGrabbing() . 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: PackageFragmentSelection.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public Control[] doFillIntoGrid(Composite parent, int nColumns, int textWidth) {
	Control[] res= super.doFillIntoGrid(parent, nColumns);

	final Text text= getTextControl(null);
	text.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			updateListener();
		}
	});
	LayoutUtil.setWidthHint(text, textWidth);
	LayoutUtil.setHorizontalGrabbing(text);
	ControlContentAssistHelper.createTextContentAssistant(text, fCurrPackageCompletionProcessor);
	TextFieldNavigationHandler.install(text);

	return res;
}
 
Example 2
Source File: JavadocStandardWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createListDialogField(Composite composite) {
	Composite c= new Composite(composite, SWT.NONE);
	c.setFont(composite.getFont());
	c.setLayout(createGridLayout(3));
	c.setLayoutData(createGridData(GridData.FILL_HORIZONTAL | GridData.FILL_VERTICAL, 4, 0));
	((GridLayout) c.getLayout()).marginWidth= 0;

	String[] buttonlabels= new String[] { JavadocExportMessages.JavadocStandardWizardPage_selectallbutton_label, JavadocExportMessages.JavadocStandardWizardPage_clearallbutton_label, JavadocExportMessages.JavadocStandardWizardPage_configurebutton_label};

	JavadocLinkDialogLabelProvider labelProvider= new JavadocLinkDialogLabelProvider();

	ListAdapter adapter= new ListAdapter();

	fListDialogField= new CheckedListDialogField<JavadocLinkRef>(adapter, buttonlabels, labelProvider);
	fListDialogField.setDialogFieldListener(adapter);
	fListDialogField.setCheckAllButtonIndex(0);
	fListDialogField.setUncheckAllButtonIndex(1);
	fListDialogField.setViewerComparator(new ViewerComparator());

	createLabel(c, SWT.NONE, JavadocExportMessages.JavadocStandardWizardPage_referencedclasses_label, createGridData(GridData.HORIZONTAL_ALIGN_BEGINNING, 4, 0));
	fListDialogField.doFillIntoGrid(c, 3);

	LayoutUtil.setHorizontalGrabbing(fListDialogField.getListControl(null));

	fListDialogField.enableButton(2, false);
}
 
Example 3
Source File: HistoryListAction.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	initializeDialogUnits(parent);

	Composite composite= (Composite) super.createDialogArea(parent);

	Composite inner= new Composite(composite, SWT.NONE);
	inner.setLayoutData(new GridData(GridData.FILL_BOTH));
	inner.setFont(composite.getFont());

	LayoutUtil.doDefaultLayout(inner, new DialogField[] { fHistoryList }, true, 0, 0);
	LayoutUtil.setHeightHint(fHistoryList.getListControl(null), convertHeightInCharsToPixels(12));
	LayoutUtil.setHorizontalGrabbing(fHistoryList.getListControl(null));

	applyDialogFont(composite);
	return composite;
}
 
Example 4
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
public Control createContent(Composite composite) {
	fGroup= new Group(composite, SWT.NONE);
	fGroup.setFont(composite.getFont());
	fGroup.setLayout(initGridLayout(new GridLayout(3, false), true));
	fGroup.setText(NewWizardMessages.NewJavaProjectWizardPageOne_LayoutGroup_title);

	fStdRadio.doFillIntoGrid(fGroup, 3);
	LayoutUtil.setHorizontalGrabbing(fStdRadio.getSelectionButton(null));

	fSrcBinRadio.doFillIntoGrid(fGroup, 2);

	fPreferenceLink= new Link(fGroup, SWT.NONE);
	fPreferenceLink.setText(NewWizardMessages.NewJavaProjectWizardPageOne_LayoutGroup_link_description);
	fPreferenceLink.setLayoutData(new GridData(GridData.END, GridData.END, false, false));
	fPreferenceLink.addSelectionListener(this);

	updateEnableState();
	return fGroup;
}
 
Example 5
Source File: JavaMethodFilterInputDialog.java    From jdt-codemining with Eclipse Public License 1.0 6 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite= (Composite) super.createDialogArea(parent);

	Composite inner= new Composite(composite, SWT.NONE);
	LayoutUtil.doDefaultLayout(inner, new DialogField[] { fNameDialogField }, true, 0, 0);

	int fieldWidthHint= convertWidthInCharsToPixels(60);
	Text text= fNameDialogField.getTextControl(null);
	LayoutUtil.setWidthHint(text, fieldWidthHint);
	LayoutUtil.setHorizontalGrabbing(text);
	//BidiUtils.applyBidiProcessing(text, StructuredTextTypeHandlerFactory.JAVA);
	TextFieldNavigationHandler.install(text);

	fNameDialogField.postSetFocusOnDialogField(parent.getDisplay());

	applyDialogFont(composite);
	return composite;
}
 
Example 6
Source File: JavaMethodFiltersTable.java    From jdt-codemining with Eclipse Public License 1.0 6 votes vote down vote up
public void createControl(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	composite.setFont(parent.getFont());

	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	layout.marginWidth = 0;
	layout.marginHeight = 0;

	composite.setLayout(layout);

	fFilterListField.doFillIntoGrid(composite, 3);
	LayoutUtil.setHorizontalSpan(fFilterListField.getLabelControl(null), 2);
	// LayoutUtil.setWidthHint(fFilterListField.getLabelControl(null),
	// convertWidthInCharsToPixels(40));
	LayoutUtil.setHorizontalGrabbing(fFilterListField.getListControl(null));

	fFilterListField.getTableViewer().setComparator(new ViewerComparator());

}
 
Example 7
Source File: VariableBlock.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public Control createContents(Composite parent) {
	Composite composite= new Composite(parent, SWT.NONE);
	composite.setFont(parent.getFont());

	LayoutUtil.doDefaultLayout(composite, new DialogField[] { fVariablesList }, true, 0, 0);
	LayoutUtil.setHorizontalGrabbing(fVariablesList.getListControl(null));

	fWarning= new CLabel(composite, SWT.NONE);
	fWarning.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, fVariablesList.getNumberOfControls() - 1, 1));

	fControl= composite;
	updateDeprecationWarning();

	return composite;
}
 
Example 8
Source File: RenameTypeWizardSimilarElementsPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	final Composite composite= (Composite) super.createDialogArea(parent);
	LayoutUtil.doDefaultLayout(composite, new DialogField[] { fNameField }, true, SWT.DEFAULT, SWT.DEFAULT);
	fNameField.postSetFocusOnDialogField(parent.getDisplay());

	LayoutUtil.setWidthHint(fNameField.getLabelControl(null), convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH));
	Text text= fNameField.getTextControl(null);
	LayoutUtil.setHorizontalGrabbing(text);
	TextFieldNavigationHandler.install(text);

	Dialog.applyDialogFont(composite);
	return composite;
}
 
Example 9
Source File: EditVariableEntryDialog.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
	initializeDialogUnits(parent);
	Composite composite= (Composite) super.createDialogArea(parent);

	GridLayout layout= (GridLayout) composite.getLayout();
	layout.numColumns= 3;

	int widthHint= convertWidthInCharsToPixels(50);

	GridData gd= new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	gd.horizontalSpan= 3;

	// archive name field
	fFileNameField.doFillIntoGrid(composite, 4);
	LayoutUtil.setHorizontalSpan(fFileNameField.getLabelControl(null), 3);
	LayoutUtil.setWidthHint(fFileNameField.getTextControl(null), widthHint);
	LayoutUtil.setHorizontalGrabbing(fFileNameField.getTextControl(null));

	// label that shows the resolved path for variable jars
	//DialogField.createEmptySpace(composite, 1);
	fFullPathResolvedLabel= new CLabel(composite, SWT.LEFT);
	fFullPathResolvedLabel.setText(getResolvedLabelString());
	fFullPathResolvedLabel.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL));
	DialogField.createEmptySpace(composite, 2);


	fFileNameField.postSetFocusOnDialogField(parent.getDisplay());

	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.SOURCE_ATTACHMENT_BLOCK);
	applyDialogFont(composite);
	return composite;
}
 
Example 10
Source File: CategoryFilterActionGroup.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite= (Composite) super.createDialogArea(parent);
	LayoutUtil.doDefaultLayout(composite, new DialogField[] { fCategoryList }, true, 5, 5);
	LayoutUtil.setHorizontalGrabbing(fCategoryList.getListControl(null));
	Dialog.applyDialogFont(composite);
	setHelpAvailable(false);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(parent, IJavaHelpContextIds.VISIBLE_CATEGORIES_DIALOG);
	return composite;
}
 
Example 11
Source File: VariableCreationDialog.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);

	Composite inner= new Composite(composite, SWT.NONE);
	inner.setFont(composite.getFont());

	GridLayout layout= new GridLayout();
	layout.marginWidth= 0;
	layout.marginHeight= 0;
	layout.numColumns= 4;
	inner.setLayout(layout);

	int fieldWidthHint= convertWidthInCharsToPixels(50);

	fNameField.doFillIntoGrid(inner, 2);
	LayoutUtil.setWidthHint(fNameField.getTextControl(null), fieldWidthHint);
	LayoutUtil.setHorizontalGrabbing(fNameField.getTextControl(null));

	DialogField.createEmptySpace(inner, 2);

	fPathField.doFillIntoGrid(inner, 3);
	LayoutUtil.setWidthHint(fPathField.getTextControl(null), fieldWidthHint);
	BidiUtils.applyBidiProcessing(fPathField.getTextControl(null), StructuredTextTypeHandlerFactory.FILE);

	fDirButton.doFillIntoGrid(inner, 1);

	DialogField focusField= (fElement == null) ? fNameField : fPathField;
	focusField.postSetFocusOnDialogField(parent.getDisplay());
	applyDialogFont(composite);
	return composite;
}
 
Example 12
Source File: TypeFilterPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	initializeDialogUnits(parent);

	Composite composite= new Composite(parent, SWT.NONE);
	composite.setFont(parent.getFont());

	GridLayout layout= new GridLayout();
	layout.numColumns= 2;
	layout.marginWidth= 0;
	layout.marginHeight= 0;

	composite.setLayout(layout);

	fFilterListField.doFillIntoGrid(composite, 3);
	LayoutUtil.setHorizontalSpan(fFilterListField.getLabelControl(null), 2);
	LayoutUtil.setWidthHint(fFilterListField.getLabelControl(null), convertWidthInCharsToPixels(40));
	LayoutUtil.setHorizontalGrabbing(fFilterListField.getListControl(null));

	fFilterListField.getTableViewer().setComparator(new ViewerComparator());
	
	Label spacer= new Label(composite, SWT.LEFT );
	GridData gd= new GridData(SWT.DEFAULT, convertHeightInCharsToPixels(1) / 2);
	gd.horizontalSpan= 2;
	spacer.setLayoutData(gd);
	
	String label= PreferencesMessages.TypeFilterPreferencePage_restricted_link;
	Map<String, String> targetInfo= new java.util.HashMap<String, String>(2);
	targetInfo.put(ProblemSeveritiesPreferencePage.DATA_SELECT_OPTION_KEY,	JavaCore.COMPILER_PB_FORBIDDEN_REFERENCE);
	targetInfo.put(ProblemSeveritiesPreferencePage.DATA_SELECT_OPTION_QUALIFIER, JavaCore.PLUGIN_ID);
	createPreferencePageLink(composite, label, targetInfo);
	
	fHideForbiddenField.doFillIntoGrid(composite, 2);
	fHideDiscouragedField.doFillIntoGrid(composite, 2);

	Dialog.applyDialogFont(composite);
	return composite;
}
 
Example 13
Source File: NewJavaProjectWizardPageOne.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public Control createControl(Composite composite) {
	Composite nameComposite= new Composite(composite, SWT.NONE);
	nameComposite.setFont(composite.getFont());
	nameComposite.setLayout(new GridLayout(2, false));

	fNameField.doFillIntoGrid(nameComposite, 2);
	LayoutUtil.setHorizontalGrabbing(fNameField.getTextControl(null));

	return nameComposite;
}
 
Example 14
Source File: AddSourceFolderWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
public void createControl(Composite parent) {
	initializeDialogUnits(parent);

	Composite composite= new Composite(parent, SWT.NONE);

	GridLayout layout= new GridLayout();
	layout.numColumns= 4;
	composite.setLayout(layout);

	if (fLinkedMode) {
		fLinkFields.doFillIntoGrid(composite, layout.numColumns);
		fRootDialogField.doFillIntoGrid(composite, layout.numColumns - 1);
	} else {
		fRootDialogField.doFillIntoGrid(composite, layout.numColumns - 1);
	}

	if (fAllowRemoveProjectFolder)
		fRemoveProjectFolder.doFillIntoGrid(composite, layout.numColumns);

	if (fAllowAddExclusionPatterns)
		fAddExclusionPatterns.doFillIntoGrid(composite, layout.numColumns);

	if (fAllowConflict)
		fIgnoreConflicts.doFillIntoGrid(composite, layout.numColumns);

	LayoutUtil.setHorizontalSpan(fRootDialogField.getLabelControl(null), layout.numColumns);
	LayoutUtil.setHorizontalGrabbing(fRootDialogField.getTextControl(null));

	setControl(composite);
	Dialog.applyDialogFont(composite);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.NEW_PACKAGEROOT_WIZARD_PAGE);
}
 
Example 15
Source File: NewTypeWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the controls for the package name field. Expects a <code>GridLayout</code> with at
 * least 4 columns.
 *
 * @param composite the parent composite
 * @param nColumns number of columns to span
 */
protected void createPackageControls(Composite composite, int nColumns) {
	fPackageDialogField.doFillIntoGrid(composite, nColumns);
	Text text= fPackageDialogField.getTextControl(null);
	BidiUtils.applyBidiProcessing(text, StructuredTextTypeHandlerFactory.JAVA);
	LayoutUtil.setWidthHint(text, getMaxFieldWidth());
	LayoutUtil.setHorizontalGrabbing(text);
	ControlContentAssistHelper.createTextContentAssistant(text, fCurrPackageCompletionProcessor);
	TextFieldNavigationHandler.install(text);
}
 
Example 16
Source File: NewModuleWizardPage.java    From gwt-eclipse-plugin with Eclipse Public License 1.0 5 votes vote down vote up
protected void createModuleNameControls(Composite composite, int nColumns) {
  moduleNameField.doFillIntoGrid(composite, nColumns - 1);
  DialogField.createEmptySpace(composite);

  Text moduleNameText = moduleNameField.getTextControl(null);
  LayoutUtil.setWidthHint(moduleNameText, getMaxFieldWidth());
  LayoutUtil.setHorizontalGrabbing(moduleNameText);
}
 
Example 17
Source File: NameConventionConfigurationBlock.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);
	Composite inner= new Composite(composite, SWT.NONE);
	inner.setFont(composite.getFont());
	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	layout.numColumns= 2;
	inner.setLayout(layout);

	fMessageField.doFillIntoGrid(inner, 2);
	fPrefixField.doFillIntoGrid(inner, 2);
	fSuffixField.doFillIntoGrid(inner, 2);

	LayoutUtil.setHorizontalGrabbing(fPrefixField.getTextControl(null));
	LayoutUtil.setWidthHint(fPrefixField.getTextControl(null), convertWidthInCharsToPixels(45));
	LayoutUtil.setWidthHint(fSuffixField.getTextControl(null), convertWidthInCharsToPixels(45));

	fPrefixField.postSetFocusOnDialogField(parent.getDisplay());

	applyDialogFont(composite);

	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.CODE_STYLE_EDIT_PREFIX_SUFFIX);

	return composite;
}
 
Example 18
Source File: ExclusionInclusionDialog.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);

	Composite inner= new Composite(composite, SWT.NONE);
	inner.setFont(parent.getFont());

	GridLayout layout= new GridLayout();
	layout.marginHeight= 0;
	layout.marginWidth= 0;
	layout.numColumns= 2;
	inner.setLayout(layout);
	inner.setLayoutData(new GridData(GridData.FILL_BOTH));

	DialogField labelField= new DialogField();
	labelField.setLabelText(Messages.format(NewWizardMessages.ExclusionInclusionDialog_description, BasicElementLabels.getPathLabel(fCurrElement.getPath(), false)));
	labelField.doFillIntoGrid(inner, 2);

	fInclusionPatternList.doFillIntoGrid(inner, 3);
	LayoutUtil.setHorizontalSpan(fInclusionPatternList.getLabelControl(null), 2);
	LayoutUtil.setHorizontalGrabbing(fInclusionPatternList.getListControl(null));

	fExclusionPatternList.doFillIntoGrid(inner, 3);
	LayoutUtil.setHorizontalSpan(fExclusionPatternList.getLabelControl(null), 2);
	LayoutUtil.setHorizontalGrabbing(fExclusionPatternList.getListControl(null));

	applyDialogFont(composite);
	return composite;
}
 
Example 19
Source File: PropertyAndPreferencePage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
protected Label createDescriptionLabel(Composite parent) {
	fParentComposite= parent;
	if (isProjectPreferencePage()) {
		Composite composite= new Composite(parent, SWT.NONE);
		composite.setFont(parent.getFont());
		GridLayout layout= new GridLayout();
		layout.marginHeight= 0;
		layout.marginWidth= 0;
		layout.numColumns= 2;
		composite.setLayout(layout);
		composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));

		IDialogFieldListener listener= new IDialogFieldListener() {
			public void dialogFieldChanged(DialogField field) {
				boolean enabled= ((SelectionButtonDialogField) field).isSelected();
				enableProjectSpecificSettings(enabled);

				if (enabled && getData() != null) {
					applyData(getData());
				}
			}
		};

		fUseProjectSettings= new SelectionButtonDialogField(SWT.CHECK);
		fUseProjectSettings.setDialogFieldListener(listener);
		fUseProjectSettings.setLabelText(PreferencesMessages.PropertyAndPreferencePage_useprojectsettings_label);
		fUseProjectSettings.doFillIntoGrid(composite, 1);
		LayoutUtil.setHorizontalGrabbing(fUseProjectSettings.getSelectionButton(null));

		if (offerLink()) {
			fChangeWorkspaceSettings= createLink(composite, PreferencesMessages.PropertyAndPreferencePage_useworkspacesettings_change);
			fChangeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
		} else {
			LayoutUtil.setHorizontalSpan(fUseProjectSettings.getSelectionButton(null), 2);
		}

		Label horizontalLine= new Label(composite, SWT.SEPARATOR | SWT.HORIZONTAL);
		horizontalLine.setLayoutData(new GridData(GridData.FILL, GridData.FILL, true, false, 2, 1));
		horizontalLine.setFont(composite.getFont());
	} else if (supportsProjectSpecificOptions() && offerLink()) {
		fChangeWorkspaceSettings= createLink(parent, PreferencesMessages.PropertyAndPreferencePage_showprojectspecificsettings_label);
		fChangeWorkspaceSettings.setLayoutData(new GridData(SWT.END, SWT.CENTER, true, false));
	}

	return super.createDescriptionLabel(parent);
   }
 
Example 20
Source File: LibrariesWorkbookPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public Control getControl(Composite parent) {
	PixelConverter converter= new PixelConverter(parent);

	Composite composite= new Composite(parent, SWT.NONE);

	LayoutUtil.doDefaultLayout(composite, new DialogField[] { fLibrariesList }, true, SWT.DEFAULT, SWT.DEFAULT);
	LayoutUtil.setHorizontalGrabbing(fLibrariesList.getTreeControl(null));

	int buttonBarWidth= converter.convertWidthInCharsToPixels(24);
	fLibrariesList.setButtonsMinWidth(buttonBarWidth);

	fLibrariesList.setViewerComparator(new CPListElementSorter());

	fSWTControl= composite;

	return composite;
}