Java Code Examples for org.eclipse.swt.widgets.Text.setFont()

The following are Jave code examples for showing how to use setFont() of the org.eclipse.swt.widgets.Text class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: convertigo-eclipse   File: TextEditorComposite.java   View Source Code Vote up 6 votes
private void initialize() {
	GridLayout gridLayout = new GridLayout();
	gridLayout.numColumns = 1;
	GridData gridData = new org.eclipse.swt.layout.GridData();
	gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData.grabExcessVerticalSpace = true;
	gridData.grabExcessHorizontalSpace = true;
	gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
	
	//minimum size (when dialog open)
	gridData.minimumHeight = 200;
	gridData.minimumWidth = 300;
	
	this.setLayout(gridLayout);
	textArea = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	textArea.setFont(new Font(null,"Tahoma",10,0));
	textArea.setLayoutData(gridData);
}
 
Example 2
Project: convertigo-eclipse   File: SqlQueryEditorComposite.java   View Source Code Vote up 6 votes
private void initialize() {
	labelSyntaxe = new Label(this, SWT.NONE);
	
	labelSyntaxe.setText("SQL query syntax examples :\n");
	labelSyntaxe.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
	labelSQLQuery = new Label(this, SWT.NONE);
	labelSQLQuery.setFont(new Font(null,"Tahoma",8,1));
	labelSQLQuery.setText("SELECT * FROM EMPLOYEES WHERE (NAME='{parameter_name}')\n"
							+ "{? = CALL STORED_FUNCTION({parameter_name})}\n"
							+ "{CALL STORED_PROCEDURE({parameter_name})}\n\n");
	labelSQLQuery.setLayoutData(new GridData(SWT.FILL,SWT.CENTER,true,false));
	textAreaSQLQuery = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	textAreaSQLQuery.setFont(new Font(null,"Tahoma",10,0));
	textAreaSQLQuery.setLayoutData(new GridData(SWT.FILL,SWT.FILL,true,true));
	GridLayout gridLayout = new GridLayout();
	this.setLayout(gridLayout);
	setSize(new org.eclipse.swt.graphics.Point(402,289));
}
 
Example 3
Project: convertigo-eclipse   File: UrlMappingWizardPage.java   View Source Code Vote up 6 votes
public void createControl(Composite parent) {
	container = new Composite(parent, SWT.NULL);
	GridLayout gridLayout = new GridLayout();
	gridLayout.verticalSpacing = 10;
	container.setLayout(gridLayout);
	
	Label label = new Label(container, SWT.NONE);
	label.setText("Please enter the Convertigo api path of the mapping\n");
	
	mappingPath = new Text(container, SWT.BORDER | SWT.SINGLE);
	mappingPath.setFont(new Font(container.getDisplay(), "Tahoma", 10, 0));
	mappingPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	mappingPath.setText("/");
	mappingPath.addModifyListener(new ModifyListener() {
		public void modifyText(ModifyEvent e) {
			dialogChanged();
		}
	});
	
	setControl(container);
}
 
Example 4
Project: pgcodekeeper   File: SQLEditor.java   View Source Code Vote up 6 votes
@Override
protected Control createDialogArea(Composite parent) {
    Composite comp = (Composite) super.createDialogArea(parent);
    Text filed = new Text(comp, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL
            | SWT.READ_ONLY | SWT.MULTI);
    filed.setText(text);
    filed.setBackground(getShell().getDisplay().getSystemColor(
            SWT.COLOR_LIST_BACKGROUND));
    filed.setFont(JFaceResources.getTextFont());
    PixelConverter pc = new PixelConverter(filed);
    GridData gd = new GridData(GridData.FILL_BOTH);
    gd.widthHint = pc.convertWidthInCharsToPixels(80);
    gd.heightHint = pc.convertHeightInCharsToPixels(30);
    filed.setLayoutData(gd);
    return comp;
}
 
Example 5
Project: Hydrograph   File: CommentBoxLabelEditManager.java   View Source Code Vote up 6 votes
/**
 * update scaledFonts
 * @param zoom
 * 				at zoom 
 */
private void updateScaledFont(double zoom) {
	if (cachedZoom == zoom)
		return;
	
	Text text = (Text)getCellEditor().getControl();
	Font font = getEditPart().getFigure().getFont();
	
	disposeScaledFont();
	cachedZoom = zoom;
	if (zoom == 1.0)
		text.setFont(font);
	else {
		FontData fd = font.getFontData()[0];
		fd.setHeight((int)(fd.getHeight() * zoom));
		text.setFont(scaledFont = new Font(null, fd));
	}
}
 
Example 6
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   View Source Code Vote up 5 votes
/***
 * Create the Field where user enters the language used to execute
 * 
 * @param parent container composite
 * @param font used font
 * @return the created composite containing the fields
 */
public Composite createLanguageLayout(Composite parent, Font font) {
	// Language
	createTextLabelLayout(parent, "Melange languages");
	_languageCombo = new Combo(parent, SWT.NONE);
	_languageCombo.setLayoutData(createStandardLayout());

	List<String> languagesNames = MelangeHelper.getAllLanguages();
	String[] empty = {};
	_languageCombo.setItems(languagesNames.toArray(empty));
	_languageCombo.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			//String selection = _languageCombo.getText();
			//List<String> modelTypeNames = MelangeHelper.getModelTypes(selection);
			updateLaunchConfigurationDialog();
		}
	});
	createTextLabelLayout(parent, "");

	createTextLabelLayout(parent, "Melange resource adapter query");
	_melangeQueryText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_melangeQueryText.setLayoutData(createStandardLayout());
	_melangeQueryText.setFont(font);
	_melangeQueryText.setEditable(false);
	createTextLabelLayout(parent, "");
	
	return parent;
}
 
Example 7
Project: gemoc-studio-modeldebugging   File: AskLanguageNameWizardPage.java   View Source Code Vote up 5 votes
@Override
public void createControl(Composite parent) {
       // project specification group
       Composite composite = new Composite(parent, SWT.NONE);
       GridLayout layout = new GridLayout();
       layout.numColumns = 2;
       composite.setLayout(layout);
       composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

       // new project label
       Label label = new Label(composite, SWT.NONE);
       label.setText("Language name");
       label.setFont(parent.getFont());

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

       // Set the initial value first before listener
       // to avoid handling an event during the creation.
       if (_initialLanguageName != null) {
		_nameField.setText(_initialLanguageName);
	}
       _nameField.addListener(SWT.Modify, nameModifyListener);
       BidiUtils.applyBidiProcessing(_nameField, BidiUtils.BTD_DEFAULT);	
       setControl(composite);
}
 
Example 8
Project: convertigo-eclipse   File: CicsConnectorComposite.java   View Source Code Vote up 5 votes
protected void initialize() {
	GridData gridData = new org.eclipse.swt.layout.GridData();
	gridData.horizontalAlignment = org.eclipse.swt.layout.GridData.FILL;
	gridData.grabExcessHorizontalSpace = true;
	gridData.grabExcessVerticalSpace = true;
	gridData.verticalAlignment = org.eclipse.swt.layout.GridData.FILL;
	cicsData = new Text(this, SWT.MULTI | SWT.WRAP | SWT.V_SCROLL);
	cicsData.setEditable(false);
	cicsData.setBackground(new Color(null,253,253,244));
	cicsData.setFont(new Font(null,"Courier New",10,1));
	cicsData.setLayoutData(gridData);
	cicsData.setText("");
	this.setLayout(new GridLayout());
	setSize(new Point(300, 200));
}
 
Example 9
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   View Source Code Vote up 4 votes
/***
 * Create the Fields where user enters model to execute
 * 
 * @param parent container composite
 * @param font used font
 * @return the created composite containing the fields
 */
public Composite createModelLayout(Composite parent, Font font) {
	createTextLabelLayout(parent, "Model to execute");
	// Model location text
	_modelLocationText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_modelLocationText.setLayoutData(createStandardLayout());
	_modelLocationText.setFont(font);
	_modelLocationText.addModifyListener(fBasicModifyListener);
	Button modelLocationButton = createPushButton(parent, "Browse", null);
	modelLocationButton.addSelectionListener(new SelectionAdapter() {

		public void widgetSelected(SelectionEvent evt) {
			// handleModelLocationButtonSelected();
			// TODO launch the appropriate selector

			SelectAnyIFileDialog dialog = new SelectAnyIFileDialog();
			if (dialog.open() == Dialog.OK) {
				String modelPath = ((IResource) dialog.getResult()[0])
						.getFullPath().toPortableString();
				_modelLocationText.setText(modelPath);
				updateLaunchConfigurationDialog();
				_modelProject = ((IResource) dialog.getResult()[0]).getProject();
			}
		}
	});
	createTextLabelLayout(parent, "Model initialization method");
	_modelInitializationMethodText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_modelInitializationMethodText.setLayoutData(createStandardLayout());
	_modelInitializationMethodText.setFont(font);
	_modelInitializationMethodText.setEditable(false);
	createTextLabelLayout(parent, "");
	createTextLabelLayout(parent, "Model initialization arguments");
	_modelInitializationArgumentsText = new Text(parent, SWT.MULTI | SWT.BORDER |  SWT.WRAP | SWT.V_SCROLL);
	_modelInitializationArgumentsText.setToolTipText("one argument per line");
	GridData gridData = new GridData(GridData.FILL_BOTH);
	gridData.heightHint = 40;
	_modelInitializationArgumentsText.setLayoutData(gridData);
	//_modelInitializationArgumentsText.setLayoutData(createStandardLayout());
	_modelInitializationArgumentsText.setFont(font);
	_modelInitializationArgumentsText.setEditable(true);
	_modelInitializationArgumentsText.addModifyListener(new ModifyListener() {
		@Override
		public void modifyText(ModifyEvent e) {
			updateLaunchConfigurationDialog();
		}
	});
	createTextLabelLayout(parent, "");
	
	return parent;
}
 
Example 10
Project: gemoc-studio-modeldebugging   File: LaunchConfigurationMainTab.java   View Source Code Vote up 4 votes
private Composite createAnimationLayout(Composite parent, Font font) {
	createTextLabelLayout(parent, "Animator");

	_siriusRepresentationLocationText = new Text(parent, SWT.SINGLE
			| SWT.BORDER);
	_siriusRepresentationLocationText.setLayoutData(createStandardLayout());
	_siriusRepresentationLocationText.setFont(font);
	_siriusRepresentationLocationText
			.addModifyListener(fBasicModifyListener);
	Button siriusRepresentationLocationButton = createPushButton(parent,
			"Browse", null);
	siriusRepresentationLocationButton
			.addSelectionListener(new SelectionAdapter() {
				public void widgetSelected(SelectionEvent evt) {
					// handleModelLocationButtonSelected();
					// TODO launch the appropriate selector

					SelectAIRDIFileDialog dialog = new SelectAIRDIFileDialog();
					if (dialog.open() == Dialog.OK) {
						String modelPath = ((IResource) dialog.getResult()[0])
								.getFullPath().toPortableString();
						_siriusRepresentationLocationText
								.setText(modelPath);
						updateLaunchConfigurationDialog();
					}
				}
			});

	createTextLabelLayout(parent, "Delay");
	_delayText = new Text(parent, SWT.SINGLE | SWT.BORDER);
	_delayText.setLayoutData(createStandardLayout());
	_delayText.addModifyListener(new ModifyListener() {

		@Override
		public void modifyText(ModifyEvent e) {
			updateLaunchConfigurationDialog();
		}
	});
	createTextLabelLayout(parent, "(in milliseconds)");

	new Label(parent, SWT.NONE).setText("");
	_animationFirstBreak = new Button(parent, SWT.CHECK);
	_animationFirstBreak.setText("Break at start");
	_animationFirstBreak.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(SelectionEvent event) {
			updateLaunchConfigurationDialog();
		}
	}

	);

	return parent;
}
 
Example 11
Project: scanning   File: ModelCellEditor.java   View Source Code Vote up 3 votes
/**
    * Creates the controls used to show the value of this cell area.
    * <p>
    * The default implementation of this framework method creates
    * a label widget, using the same font and background color as the parent control.
    * </p>
    * <p>
    * Subclasses may reimplement.  If you reimplement this method, you
    * should also reimplement <code>updateContents</code>.
    * </p>
    *
    * @param cell the control for this cell area
    * @return the underlying control
    */
   protected Control createTextContents(Composite cell) {
Text txt = new Text(cell, SWT.LEFT);
txt.setFont(cell.getFont());
txt.setBackground(cell.getBackground());
txt.setEditable(false);
GridData gData = new GridData(SWT.FILL, SWT.FILL, true, true);
gData.widthHint = 100;
txt.setLayoutData(gData);
defaultLabel = txt;
       return txt;
   }