Java Code Examples for org.eclipse.jface.util.BidiUtils

The following examples show how to use org.eclipse.jface.util.BidiUtils. These examples are extracted from open source projects. 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
/**
 * Creates the controls for the superclass name field. Expects a <code>GridLayout</code>
 * with at least 3 columns.
 *
 * @param composite the parent composite
 * @param nColumns number of columns to span
 */
protected void createSuperClassControls(Composite composite, int nColumns) {
	fSuperClassDialogField.doFillIntoGrid(composite, nColumns);
	Text text= fSuperClassDialogField.getTextControl(null);
	LayoutUtil.setWidthHint(text, getMaxFieldWidth());
	BidiUtils.applyBidiProcessing(text, StructuredTextTypeHandlerFactory.JAVA);

	JavaTypeCompletionProcessor superClassCompletionProcessor= new JavaTypeCompletionProcessor(false, false, true);
	superClassCompletionProcessor.setCompletionContextRequestor(new CompletionContextRequestor() {
		@Override
		public StubTypeContext getStubTypeContext() {
			return getSuperClassStubTypeContext();
		}
	});

	ControlContentAssistHelper.createTextContentAssistant(text, superClassCompletionProcessor);
	TextFieldNavigationHandler.install(text);
}
 
Example 2
@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 3
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite= (Composite) super.createDialogArea(parent);
	DialogField[] fields;
	if (isSave()) {
		fields= new DialogField[] { fExportImportList, fLocationField };
	} else {
		fields= new DialogField[] { fLocationField, fExportImportList };
	}
	LayoutUtil.doDefaultLayout(composite, fields, true, SWT.DEFAULT, SWT.DEFAULT);
	fExportImportList.getListControl(null).setLayoutData(new GridData(GridData.FILL_BOTH));

	fLocationField.postSetFocusOnDialogField(parent.getDisplay());
	BidiUtils.applyBidiProcessing(fLocationField.getTextControl(parent), StructuredTextTypeHandlerFactory.FILE);

	Dialog.applyDialogFont(composite);

	if (isSave()) {
		PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.CP_EXPORT_USER_LIBRARY);
	} else {
		PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.CP_IMPORT_USER_LIBRARY);
	}

	return composite;
}
 
Example 4
public void createControl(Composite parent) {
	initializeDialogUnits(parent);

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

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

	fProjectField.doFillIntoGrid(composite, 3);
	fRootDialogField.doFillIntoGrid(composite, 3);
	fExcludeInOthersFields.doFillIntoGrid(composite, 3);
	fIgnoreOptionalProblemsField.doFillIntoGrid(composite, 3);

	int maxFieldWidth= convertWidthInCharsToPixels(40);
	LayoutUtil.setWidthHint(fProjectField.getTextControl(null), maxFieldWidth);
	LayoutUtil.setHorizontalGrabbing(fProjectField.getTextControl(null));
	LayoutUtil.setWidthHint(fRootDialogField.getTextControl(null), maxFieldWidth);
	BidiUtils.applyBidiProcessing(fRootDialogField.getTextControl(null), StructuredTextTypeHandlerFactory.FILE);

	setControl(composite);
	Dialog.applyDialogFont(composite);
	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IJavaHelpContextIds.NEW_PACKAGEROOT_WIZARD_PAGE);
}
 
Example 5
/**
 * Creates the project name specification controls.
 *
 * @param parent
 *            the parent composite
 */
private final void createProjectNameGroup(Composite parent) {
	// project specification group
	Composite projectGroup = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 2;
	projectGroup.setLayout(layout);
	projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	// new project label
	Label projectLabel = new Label(projectGroup, SWT.NONE);
	projectLabel.setText(IDEWorkbenchMessages.WizardNewProjectCreationPage_nameLabel);
	projectLabel.setFont(parent.getFont());

	// new project name entry field
	projectNameField = new Text(projectGroup, SWT.BORDER);
	GridData data = new GridData(GridData.FILL_HORIZONTAL);
	data.widthHint = SIZING_TEXT_FIELD_WIDTH;
	projectNameField.setLayoutData(data);
	projectNameField.setFont(parent.getFont());

	// Set the initial value first before listener
	// to avoid handling an event during the creation.
	if (initialProjectFieldValue != null) {
		projectNameField.setText(initialProjectFieldValue);
	}
	projectNameField.addListener(SWT.Modify, nameModifyListener);
	BidiUtils.applyBidiProcessing(projectNameField, BidiUtils.BTD_DEFAULT);
}
 
Example 6
public Control createControl(Composite composite) {
	final int numColumns= 4;

	final Composite locationComposite= new Composite(composite, SWT.NONE);
	locationComposite.setLayout(new GridLayout(numColumns, false));

	fUseDefaults.doFillIntoGrid(locationComposite, numColumns);
	fLocation.doFillIntoGrid(locationComposite, numColumns);
	LayoutUtil.setHorizontalGrabbing(fLocation.getTextControl(null));
	BidiUtils.applyBidiProcessing(fLocation.getTextControl(null), StructuredTextTypeHandlerFactory.FILE);

	return locationComposite;
}
 
Example 7
private void createPackageControls(Composite composite, int nColumns) {
	fPackageDialogField.doFillIntoGrid(composite, nColumns - 1);
	Text text= fPackageDialogField.getTextControl(null);
	LayoutUtil.setWidthHint(text, getMaxFieldWidth());
	LayoutUtil.setHorizontalGrabbing(text);
	DialogField.createEmptySpace(composite);

	TextFieldNavigationHandler.install(text);
	
	fCreatePackageInfoJavaDialogField.doFillIntoGrid(composite, nColumns);
	BidiUtils.applyBidiProcessing(fPackageDialogField.getTextControl(null), StructuredTextTypeHandlerFactory.JAVA);
}
 
Example 8
/**
 * 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 9
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite= (Composite) super.createDialogArea(parent);
	initializeDialogUnits(parent);

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

	fNameDialogField.doFillIntoGrid(composite, 3);

	fNameDialogField.getChangeControl(null).setVisible(!fIsEditingMember);

	LayoutUtil.setHorizontalSpan(fNameDialogField.getLabelControl(null), 2);

	int fieldWidthHint= convertWidthInCharsToPixels(60);
	Text text= fNameDialogField.getTextControl(null);
	LayoutUtil.setWidthHint(text, fieldWidthHint);
	LayoutUtil.setHorizontalGrabbing(text);
	LayoutUtil.setHorizontalSpan(text, fIsEditingMember ? 2 : 1);
	BidiUtils.applyBidiProcessing(text, StructuredTextTypeHandlerFactory.JAVA);
	TextFieldNavigationHandler.install(text);

	DialogField.createEmptySpace(composite, 1);

	fNameDialogField.postSetFocusOnDialogField(parent.getDisplay());


	applyDialogFont(composite);
	return composite;
}
 
Example 10
@Override
protected Control createDialogArea(Composite parent) {
	Composite composite= (Composite) super.createDialogArea(parent);
	initializeDialogUnits(parent);

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

	fNameDialogField.doFillIntoGrid(composite, 3);

	LayoutUtil.setHorizontalSpan(fNameDialogField.getLabelControl(null), 2);

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

	DialogField.createEmptySpace(composite, 1);
	fBrowseTypeButton.doFillIntoGrid(composite, 1);

	fNameDialogField.postSetFocusOnDialogField(parent.getDisplay());

	applyDialogFont(composite);
	return composite;
}
 
Example 11
@Override
public Control getControl(Composite parent) {
	PixelConverter converter= new PixelConverter(parent);
	Composite composite= new Composite(parent, SWT.NONE);

	LayoutUtil.doDefaultLayout(composite, new DialogField[] { fFoldersList, fUseFolderOutputs , fOutputLocationField}, true, SWT.DEFAULT, SWT.DEFAULT);
	BidiUtils.applyBidiProcessing(fOutputLocationField.getTextControl(null), StructuredTextTypeHandlerFactory.FILE);
	LayoutUtil.setHorizontalGrabbing(fFoldersList.getTreeControl(null));

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

	fSWTControl= composite;

	// expand
	List<CPListElement> elements= fFoldersList.getElements();
	for (int i= 0; i < elements.size(); i++) {
		CPListElement elem= elements.get(i);
		IPath[] exclusionPatterns= (IPath[]) elem.getAttribute(CPListElement.EXCLUSION);
		IPath[] inclusionPatterns= (IPath[]) elem.getAttribute(CPListElement.INCLUSION);
		IPath output= (IPath) elem.getAttribute(CPListElement.OUTPUT);
		if (exclusionPatterns.length > 0 || inclusionPatterns.length > 0 || output != null) {
			fFoldersList.expandElement(elem, 3);
		}
	}
	return composite;
}
 
Example 12
@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 13
private void doFillIntoGrid(Composite parent, int numColumns) {
	fLinkLocation.doFillIntoGrid(parent, numColumns);

	LayoutUtil.setHorizontalSpan(fLinkLocation.getLabelControl(null), numColumns);
	LayoutUtil.setHorizontalGrabbing(fLinkLocation.getTextControl(null));
	BidiUtils.applyBidiProcessing(fLinkLocation.getTextControl(null), StructuredTextTypeHandlerFactory.FILE);

	fVariables.doFillIntoGrid(parent, 1);
}
 
Example 14
Source Project: sarl   Source File: MainProjectWizardPage.java    License: Apache License 2.0 5 votes vote down vote up
public Control createControl(Composite composite) {
	final int numColumns = 4;

	final Composite locationComposite = new Composite(composite, SWT.NONE);
	locationComposite.setLayout(new GridLayout(numColumns, false));

	this.useDefaults.doFillIntoGrid(locationComposite, numColumns);
	this.location.doFillIntoGrid(locationComposite, numColumns);
	LayoutUtil.setHorizontalGrabbing(this.location.getTextControl(null));
	BidiUtils.applyBidiProcessing(this.location.getTextControl(null), StructuredTextTypeHandlerFactory.FILE);

	return locationComposite;
}
 
Example 15
@Override
protected void createDestinationGroup(Composite parent) {
    Font font = parent.getFont();
    // 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));
    destinationSelectionGroup.setFont(font);

    destinationLabel = new Label(destinationSelectionGroup, SWT.NONE);
    destinationLabel.setText(getDestinationLabel());
    destinationLabel.setFont(font);

    // destination name entry field
    destinationNameField = new Combo(destinationSelectionGroup, SWT.SINGLE | SWT.BORDER);
    destinationNameField.addListener(SWT.Modify, this);
    destinationNameField.addListener(SWT.Selection, this);
    GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    destinationNameField.setLayoutData(data);
    destinationNameField.setFont(font);
    BidiUtils.applyBidiProcessing(destinationNameField, "file"); //$NON-NLS-1$

    // destination browse button
    destinationBrowseButton = new Button(destinationSelectionGroup, SWT.PUSH);
    destinationBrowseButton.setText(DataTransferMessages.DataTransfer_browse);
    destinationBrowseButton.addListener(SWT.Selection, this);
    destinationBrowseButton.setFont(font);
    setButtonLayoutData(destinationBrowseButton);

    new Label(parent, SWT.NONE); // vertical spacer
}
 
Example 16
public Control createContents(Composite parent) {
	fShell= parent.getShell();

	PixelConverter converter= new PixelConverter(parent);
	Composite topComp= new Composite(parent, SWT.NONE);
	GridLayout topLayout= new GridLayout();
	topLayout.numColumns= 3;
	topLayout.marginWidth= 0;
	topLayout.marginHeight= 0;
	topComp.setLayout(topLayout);

	// Add the first radio button for the path
	if (!fIsForSource) {
		fURLRadioButton.doFillIntoGrid(topComp, 3);
	}

	fURLField.doFillIntoGrid(topComp, 2);
	LayoutUtil.setWidthHint(fURLField.getTextControl(null), converter.convertWidthInCharsToPixels(43));
	LayoutUtil.setHorizontalGrabbing(fURLField.getTextControl(null));
	BidiUtils.applyBidiProcessing(fURLField.getTextControl(null), StructuredTextTypeHandlerFactory.URL);

	fBrowseFolder.doFillIntoGrid(topComp, 1);

	DialogField.createEmptySpace(topComp, 2);
	fValidateURLButton.doFillIntoGrid(topComp, 1);

	//DialogField.createEmptySpace(topComp, 3);

	if (!fIsForSource) {
		// Add the second radio button for the jar/zip
		fArchiveRadioButton.doFillIntoGrid(topComp, 3);


		// external - workspace selection
		DialogField.createEmptySpace(topComp, 1);
		Composite radioComposite= new Composite(topComp, SWT.NONE);
		radioComposite.setLayoutData(new GridData(GridData.FILL, GridData.FILL, false, false));
		GridLayout layout= new GridLayout(2, true);
		layout.marginHeight= 0;
		layout.marginWidth= 0;
		radioComposite.setLayout(layout);
		fExternalRadio.doFillIntoGrid(radioComposite, 1);
		fWorkspaceRadio.doFillIntoGrid(radioComposite, 1);
		DialogField.createEmptySpace(topComp, 1);

		// Add the jar/zip field
		fArchiveField.doFillIntoGrid(topComp, 2);
		LayoutUtil.setWidthHint(fArchiveField.getTextControl(null), converter.convertWidthInCharsToPixels(43));
		LayoutUtil.setHorizontalGrabbing(fArchiveField.getTextControl(null));
		BidiUtils.applyBidiProcessing(fArchiveField.getTextControl(null), StructuredTextTypeHandlerFactory.FILE);

		fBrowseArchive.doFillIntoGrid(topComp, 1);

		// Add the path chooser for the jar/zip
		fArchivePathField.doFillIntoGrid(topComp, 2);
		LayoutUtil.setWidthHint(fArchivePathField.getTextControl(null), converter.convertWidthInCharsToPixels(43));
		LayoutUtil.setHorizontalGrabbing(fArchivePathField.getTextControl(null));
		BidiUtils.applyBidiProcessing(fArchivePathField.getTextControl(null), StructuredTextTypeHandlerFactory.FILE);

		fBrowseArchivePath.doFillIntoGrid(topComp, 1);

		DialogField.createEmptySpace(topComp, 2);
		fValidateArchiveButton.doFillIntoGrid(topComp, 1);

		LayoutUtil.setHorizontalIndent(fArchiveField.getLabelControl(null));
		LayoutUtil.setHorizontalIndent(fArchivePathField.getLabelControl(null));
		LayoutUtil.setHorizontalIndent(fURLField.getLabelControl(null));

		fURLRadioButton.attachDialogFields(new DialogField[] {fURLField,  fBrowseFolder, fValidateURLButton });
		fArchiveRadioButton.attachDialogFields(new DialogField[] {fArchiveField,  fBrowseArchive, fExternalRadio, fWorkspaceRadio, fArchivePathField, fBrowseArchivePath, fValidateArchiveButton });
	}


	return topComp;
}
 
Example 17
/**
 * Creates the necessary controls (label, text field and browse button) to edit
 * the source folder location. The method expects that the parent composite
 * uses a <code>GridLayout</code> as its layout manager and that the
 * grid layout has at least 3 columns.
 *
 * @param parent the parent composite
 * @param nColumns the number of columns to span. This number must be
 *  greater or equal three
 */
protected void createContainerControls(Composite parent, int nColumns) {
	fContainerDialogField.doFillIntoGrid(parent, nColumns);
	LayoutUtil.setWidthHint(fContainerDialogField.getTextControl(null), getMaxFieldWidth());
	BidiUtils.applyBidiProcessing(fContainerDialogField.getTextControl(null), StructuredTextTypeHandlerFactory.FILE);
}