Java Code Examples for org.eclipse.swt.widgets.Composite#getFont()

The following examples show how to use org.eclipse.swt.widgets.Composite#getFont() . 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: AppEngineConfigWizardPage.java    From Pydev with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {

    Font font = parent.getFont();

    Composite composite = new Composite(parent, SWT.NONE);
    composite.setLayout(new GridLayout());
    composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    composite.setFont(font);

    // App Engine specification group
    Composite appEngineGroup = new Composite(composite, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 3;
    appEngineGroup.setLayout(layout);
    appEngineGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    appEngineGroup.setFont(font);

    createUserSpecifiedGoogleAppEngineLocationGroup(appEngineGroup);

    tree = new Tree(composite, SWT.SINGLE | SWT.BORDER);
    tree.setLayoutData(new GridData(GridData.FILL_BOTH));
    tree.setFont(font);

    setControl(composite);
}
 
Example 2
Source File: CommandPage.java    From EasyShell with Eclipse Public License 2.0 6 votes vote down vote up
private void createButtons(Composite pageComponent) {
    Font font = pageComponent.getFont();
    // button pageComponent
    Composite groupComponent = new Composite(pageComponent, SWT.NULL);
    GridLayout groupLayout = new GridLayout();
    groupLayout.marginWidth = 0;
    groupLayout.marginHeight = 0;
    groupComponent.setLayout(groupLayout);
    GridData gridData = new GridData();
    gridData.verticalAlignment = GridData.FILL;
    gridData.horizontalAlignment = GridData.FILL;
    groupComponent.setLayoutData(gridData);
    groupComponent.setFont(font);

    // buttons
    createNewButton(font, gridData, groupComponent);
    createEditButton(font, gridData, groupComponent);
    createCopyButton(font, gridData, groupComponent);
    createRemoveButton(font, gridData, groupComponent);
}
 
Example 3
Source File: MenuPage.java    From EasyShell with Eclipse Public License 2.0 6 votes vote down vote up
private void createButtons(Composite pageComponent) {
    Font font = pageComponent.getFont();
    // button pageComponent
    Composite groupComponent = new Composite(pageComponent, SWT.NULL);
    GridLayout groupLayout = new GridLayout();
    groupLayout.marginWidth = 0;
    groupLayout.marginHeight = 0;
    groupComponent.setLayout(groupLayout);
    GridData gridData = new GridData();
    gridData.verticalAlignment = GridData.FILL;
    gridData.horizontalAlignment = GridData.FILL;
    groupComponent.setLayoutData(gridData);
    groupComponent.setFont(font);

    // buttons
    createNewButton(font, gridData, groupComponent);
    createEditButton(font, gridData, groupComponent);
    createCopyButton(font, gridData, groupComponent);
    createRemoveButton(font, gridData, groupComponent);
    createUpButton(font, gridData, groupComponent);
    createDownButton(font, gridData, groupComponent);
}
 
Example 4
Source File: CommandDataDialog.java    From EasyShell with Eclipse Public License 2.0 6 votes vote down vote up
private void createConvertersOverview(Composite parent) {
    Font font = parent.getFont();
    Group pageGroup3 = new Group(parent, SWT.SHADOW_ETCHED_IN);
    pageGroup3.setText(Activator.getResourceString("easyshell.command.editor.dialog.title.group3"));
    pageGroup3.setToolTipText(Activator.getResourceString("easyshell.command.editor.dialog.tooltip.group3"));
    GridLayout layout3 = new GridLayout();
    layout3.numColumns = 2;
    layout3.makeColumnsEqualWidth = false;
    layout3.marginWidth = 5;
    layout3.marginHeight = 4;
    pageGroup3.setLayout(layout3);
    GridData data3 = new GridData(GridData.FILL_HORIZONTAL);
    pageGroup3.setLayoutData(data3);
    pageGroup3.setFont(font);
    // create converters labels
    for(int i=Converter.getFirstIndex();i<Converter.values().length;i++) {
        Converter conv = Converter.values()[i];
        if (conv.isVisible()) {
            createVariableLabel(pageGroup3, conv.getName(), ": " + conv.getDescription());
        }
    }
}
 
Example 5
Source File: CommandDataDialog.java    From EasyShell with Eclipse Public License 2.0 6 votes vote down vote up
private void createVariablesOverview(Composite parent) {
    Font font = parent.getFont();
    Group pageGroup2 = new Group(parent, SWT.SHADOW_ETCHED_IN);
    pageGroup2.setText(Activator.getResourceString("easyshell.command.editor.dialog.title.group2"));
    pageGroup2.setToolTipText(Activator.getResourceString("easyshell.command.editor.dialog.tooltip.group2"));
    GridLayout layout2 = new GridLayout();
    layout2.numColumns = 2;
    layout2.makeColumnsEqualWidth = false;
    layout2.marginWidth = 5;
    layout2.marginHeight = 4;
    pageGroup2.setLayout(layout2);
    GridData data2 = new GridData(GridData.FILL_HORIZONTAL);
    pageGroup2.setLayoutData(data2);
    pageGroup2.setFont(font);
    // create variable labels
    for(int i=Variable.getFirstIndex();i<Variable.values().length;i++) {
        Variable var = Variable.values()[i];
        if (var.isVisible()) {
            createVariableLabel(pageGroup2, var.getFullVariableName(), ": " + var.getDescription());
        }
    }
}
 
Example 6
Source File: NewExperimentDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void createExperimentNameGroup(Composite parent) {
    Font font = parent.getFont();
    Composite folderGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    folderGroup.setLayout(layout);
    folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // New experiment label
    Label experimentLabel = new Label(folderGroup, SWT.NONE);
    experimentLabel.setFont(font);
    experimentLabel.setText(Messages.NewExperimentDialog_ExperimentName);

    // New experiment name entry field
    fExperimentName = new Text(folderGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    fExperimentName.setLayoutData(data);
    fExperimentName.setFont(font);
    fExperimentName.addListener(SWT.Modify, event -> validateNewExperimentName());
}
 
Example 7
Source File: LauncherTabArguments.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
@Override
public void createControl(Composite parent) {
	Font font = parent.getFont();
	Composite comp = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout(1, true);
	comp.setLayout(layout);
	comp.setFont(font);
	
	GridData gd = new GridData(GridData.FILL_BOTH);
	comp.setLayoutData(gd);
	setControl(comp);

               argsCmdline = new ArgumentsBlock(Messages.LauncherTabArguments_ProgramArgs+':');
	
	argsCmdline.createControl(comp);
	
	fWorkingDirectoryBlock.createControl(comp);		
}
 
Example 8
Source File: NewProjectNameAndLocationWizardPage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Creates the project location specification controls.
 *
 * @param projectGroup the parent composite
 * @param enabled the initial enabled state of the widgets created
 */
private void createUserSpecifiedProjectLocationGroup(Composite projectGroup, boolean enabled) {
    Font font = projectGroup.getFont();
    // location label
    locationLabel = new Label(projectGroup, SWT.NONE);
    locationLabel.setFont(font);
    locationLabel.setText("Director&y");
    locationLabel.setEnabled(enabled);

    // project location entry field
    locationPathField = new Text(projectGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    locationPathField.setLayoutData(data);
    locationPathField.setFont(font);
    locationPathField.setEnabled(enabled);

    // browse button
    browseButton = new Button(projectGroup, SWT.PUSH);
    browseButton.setFont(font);
    browseButton.setText("B&rowse");
    browseButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            handleLocationBrowseButtonPressed();
        }
    });

    browseButton.setEnabled(enabled);

    // Set the initial value first before listener
    // to avoid handling an event during the creation.
    if (initialLocationFieldValue != null) {
        locationPathField.setText(initialLocationFieldValue.toOSString());
    }
    locationPathField.addListener(SWT.Modify, locationModifyListener);
}
 
Example 9
Source File: WizardFileSystemResourceExportPage2.java    From tmxeditor8 with GNU General Public License v2.0 5 votes vote down vote up
/**
 * Create the export destination specification widgets
 * @param parent
 *            org.eclipse.swt.widgets.Composite
 */
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);

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

	// destination name entry field
	destinationNameField = new Text(destinationSelectionGroup, 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);

	// 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 10
Source File: MenuDataDialog.java    From EasyShell with Eclipse Public License 2.0 5 votes vote down vote up
private void createCopyButton(Composite parent) {
    Font font = parent.getFont();
    addCopyButton = new Button(parent, SWT.PUSH);
    addCopyButton.setText(Activator.getResourceString("easyshell.menu.editor.dialog.button.text.copy"));
    addCopyButton.setToolTipText(Activator.getResourceString("easyshell.menu.editor.dialog.button.tooltip.copy"));
    addCopyButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent event) {
            addCopyDialog();
        }
    });
    addCopyButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    addCopyButton.setFont(font);
    setButtonLayoutData(addCopyButton);
}
 
Example 11
Source File: LaunchConfigurationMainTab.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
 **/
@Override
public void createControl(Composite parent) {
	Font font = parent.getFont();
	Composite comp = createComposite(parent, font, 1, 1, GridData.FILL_BOTH);
	createFileGroup(comp);
	setControl(comp);

}
 
Example 12
Source File: JavaCamelJobScriptsExportWSWizardPage.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
@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 13
Source File: TrimTraceDialog.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private void createNewTraceNameGroup(Composite parent) {
    setStatusLineAboveButtons(true);
    Font font = parent.getFont();
    Composite folderGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    folderGroup.setLayout(layout);
    folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    String name = fElement.getName();

    // New trace name label
    Label newTaceLabel = new Label(folderGroup, SWT.NONE);
    newTaceLabel.setFont(font);
    newTaceLabel.setText(Messages.RenameTraceDialog_TraceNewName);

    // New trace name entry field

    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    Text newElementName = new Text(folderGroup, SWT.BORDER);
    newElementName.setLayoutData(data);
    newElementName.setFont(font);
    newElementName.setFocus();
    newElementName.setText(name);
    newElementName.setSelection(0, name.length());
    newElementName.addListener(SWT.Modify, event -> validateNewTraceName());
    fNewElementName = newElementName;
    validateNewTraceName();
}
 
Example 14
Source File: Histogram.java    From tracecompass with Eclipse Public License 2.0 5 votes vote down vote up
private static Font adjustFont(final Composite composite) {
    // Reduce font size for a more pleasing rendering
    final int fontSizeAdjustment = -2;
    final Font font = composite.getFont();
    final FontData fontData = font.getFontData()[0];
    return new Font(font.getDevice(), fontData.getName(), fontData.getHeight() + fontSizeAdjustment, fontData.getStyle());
}
 
Example 15
Source File: MenuDataDialog.java    From EasyShell with Eclipse Public License 2.0 5 votes vote down vote up
public Composite createPageComponent(Composite parent) {
    Font font = parent.getFont();
    Composite pageComponent = new Composite(parent,SWT.NULL);
    GridLayout layoutComponent = new GridLayout();
    layoutComponent.numColumns = 1;
    layoutComponent.makeColumnsEqualWidth = false;
    layoutComponent.marginWidth = 5;
    layoutComponent.marginHeight = 4;
    pageComponent.setLayout(layoutComponent);
    GridData gridDataComponent = new GridData(GridData.FILL_HORIZONTAL);
    gridDataComponent.widthHint = 640;
    pageComponent.setLayoutData(gridDataComponent);
    pageComponent.setFont(font);
    return pageComponent;
}
 
Example 16
Source File: WorkingDirectoryBlock.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void createControl(Composite parent) {
    Font font = parent.getFont();
    Group group = createGroup(parent, "Working directory:", 2, 1, GridData.FILL_HORIZONTAL);
    setControl(group);
    // PlatformUI.getWorkbench().getHelpSystem().setHelp(group, IJavaDebugHelpContextIds.WORKING_DIRECTORY_BLOCK);
    //default choice
    Composite comp = createComposite(group, font, 2, 2, GridData.FILL_BOTH, 0, 0);
    fUseDefaultDirButton = createRadioButton(comp, "Default:");
    fUseDefaultDirButton.addSelectionListener(fListener);
    fWorkingDirText = createSingleText(comp, 1);
    fWorkingDirText.addModifyListener(fListener);
    fWorkingDirText.setEditable(false);
    //user enter choice
    fUseOtherDirButton = createRadioButton(comp, "Other:");
    fUseOtherDirButton.addSelectionListener(fListener);
    fOtherWorkingText = createSingleText(comp, 1);
    fOtherWorkingText.addModifyListener(fListener);
    //buttons
    Composite buttonComp = createComposite(comp, font, 3, 2, GridData.HORIZONTAL_ALIGN_END);
    GridLayout ld = (GridLayout) buttonComp.getLayout();
    ld.marginHeight = 1;
    ld.marginWidth = 0;
    fWorkspaceButton = createPushButton(buttonComp, "Workspace...", null);
    fWorkspaceButton.addSelectionListener(fListener);
    fFileSystemButton = createPushButton(buttonComp, "File System...", null);
    fFileSystemButton.addSelectionListener(fListener);
    fVariablesButton = createPushButton(buttonComp, "Variables...", null);
    fVariablesButton.addSelectionListener(fListener);
}
 
Example 17
Source File: AbstractLaunchConfigurationMainTab.java    From n4js with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * @see org.eclipse.debug.ui.ILaunchConfigurationTab#createControl(org.eclipse.swt.widgets.Composite)
 */
@Override
public void createControl(Composite parent) {
	Font font = parent.getFont();
	Composite comp = createComposite(parent, font, 1, 1, GridData.FILL_BOTH);
	createResourceGroup(comp);
	createImplementationIdGroup(comp);
	setControl(comp);
}
 
Example 18
Source File: FolderSelectionGroup.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create group
 * 
 * @param parent
 */
public void create( Composite parent )
{
	// get font
	Font font = parent.getFont( );

	// label control
	Label label = new Label( parent, SWT.LEFT );
	label.setFont( font );
	label.setText( this.labelText );

	Composite composite = new Composite( parent, SWT.NULL );
	GridLayout layout = new GridLayout( );
	layout.marginWidth = 0;
	layout.marginHeight = 0;
	layout.numColumns = 2;
	composite.setLayout( layout );

	GridData data = new GridData( GridData.FILL_HORIZONTAL );
	composite.setLayoutData( data );

	// text control
	text = new Text( composite, SWT.BORDER );
	text.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	text.setFont( font );
	text.setText( this.textValue );
	text.addVerifyListener( new VerifyListener( ) {

		public void verifyText( VerifyEvent e )
		{
			e.doit = e.text.indexOf( DELIMITER ) < 0;
		}
	} );

	// directory selection button
	button = new Button( composite, SWT.PUSH );
	button.setFont( font );
	button.setText( this.buttonText );
	button.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent event )
		{
			dialog = new DirectoryDialog( PlatformUI.getWorkbench( )
					.getDisplay( ).getActiveShell( ) );

			dialog.setText( dialogTitle );
			dialog.setMessage( dialogMessage );
			dialog.setFilterPath( dialogFilterPath );
			String folderName = dialog.open( );
			if ( folderName == null )
			{
				return;
			}
			text.setText( folderName );
		}
	} );
}
 
Example 19
Source File: NewReportPageSupport.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Creates the project location specification controls.
 * 
 * @param group
 *            the parent composite
 * @param enabled
 *            the initial enabled state of the widgets created
 */
private void createUserSpecifiedProjectLocationGroup( Composite group,
		boolean enabled )
{
	Font font = group.getFont( );

	// location label
	locationLabel = new Label( group, SWT.NONE );
	locationLabel.setText( LABEL_DIRECTORY );
	locationLabel.setEnabled( enabled );
	locationLabel.setFont( font );

	// file location entry field
	locationPathField = new Text( group, SWT.BORDER );
	GridData data = new GridData( GridData.FILL_HORIZONTAL );
	data.widthHint = 250;
	locationPathField.setLayoutData( data );
	locationPathField.setEnabled( enabled );
	locationPathField.setFont( font );

	// browse button
	browseButton = new Button( group, SWT.PUSH );
	browseButton.setText( LABEL_BROWSE );
	browseButton.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent event )
		{
			handleLocationBrowseButtonPressed( );
		}
	} );

	browseButton.setEnabled( enabled );
	browseButton.setFont( font );
	setButtonLayoutData( browseButton );

	if ( defaultFileLocation != null )
	{
		locationPathField.setText( defaultFileLocation );
	}
	else
	{
		locationPathField.setText( "" );//$NON-NLS-1$
	}
}
 
Example 20
Source File: NewFolderDialogOfHs.java    From translationstudio8 with GNU General Public License v2.0 votes vote down vote up
/**
		 * Creates the folder name specification controls.
		 *
		 * @param parent the parent composite
		 */
		private void createFolderNameGroup(Composite parent) {
			Font font = parent.getFont();
			// project specification group
			Composite folderGroup = new Composite(parent, SWT.NONE);
			GridLayout layout = new GridLayout();
			layout.numColumns = 2;
			folderGroup.setLayout(layout);
			folderGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

			// new folder label
			Label folderLabel = new Label(folderGroup, SWT.NONE);
			folderLabel.setFont(font);
			folderLabel.setText(IDEWorkbenchMessages.NewFolderDialog_nameLabel);

			// new folder name entry field
			folderNameField = new Text(folderGroup, SWT.BORDER);
			GridData data = new GridData(GridData.FILL_HORIZONTAL);
			data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
			folderNameField.setLayoutData(data);
			folderNameField.setFont(font);
			folderNameField.addListener(SWT.Modify, new Listener() {
				public void handleEvent(Event event) {
					validateLinkedResource();
				}
			});
		}