Java Code Examples for org.eclipse.swt.layout.GridData#VERTICAL_ALIGN_CENTER

The following examples show how to use org.eclipse.swt.layout.GridData#VERTICAL_ALIGN_CENTER . 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: EncodingDialog.java    From LogViewer with Eclipse Public License 2.0 6 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	// create composite
	Composite composite = (Composite) super.createDialogArea(parent);
	// create combo
	encodingCombo = new Combo(composite,SWT.LEFT);
	GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
	encodingCombo.setLayoutData(data);
	// fill the encoding data
	SortedMap<?, ?> charsets = Charset.availableCharsets();
	Set<?> keys = charsets.keySet();
	// fill the combo with all available encoding types
	Iterator<?> keyIterator = keys.iterator();
	while(keyIterator.hasNext()) {
		Object obj = charsets.get(keyIterator.next());
		try {
			Method method = obj.getClass().getMethod("displayName",new Class[]{}); //$NON-NLS-1$
			String encoding = (String)method.invoke(obj,new Object[]{});
			encodingCombo.add(encoding);
		} catch(Exception e) {
               logger.logError("problem while resolving all available character encondings for this platform",e); //$NON-NLS-1$
		}
	}
	encodingCombo.setText(oldValue);
	applyDialogFont(composite);
	return composite;
}
 
Example 2
Source File: LogFileTypeDialog.java    From LogViewer with Eclipse Public License 2.0 6 votes vote down vote up
protected Control createDialogArea(Composite parent) {
   	String fileTypeName = "File";
	// create composite
	Composite composite = (Composite) super.createDialogArea(parent);
	// create combo
	typeCombo = new Combo(composite,SWT.LEFT);
	GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
	typeCombo.setLayoutData(data);
	// fill
   	IConsole[] consoles = ConsolePlugin.getDefault().getConsoleManager().getConsoles();
   	typeCombo.add(fileTypeName);
   	value = fileTypeName;    	
   	for (int i=0;i<consoles.length;i++) {
   		typeCombo.add("Console: " + consoles[i].getName());
   	}
	applyDialogFont(composite);
	return composite;
}
 
Example 3
Source File: InsetsComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createTop( Composite grpInsets ) 
{
	lblTop = new Label( grpInsets, SWT.NONE );
	GridData gdLTop = new GridData( GridData.VERTICAL_ALIGN_CENTER );
	// gdLTop.heightHint = 20;
	lblTop.setLayoutData( gdLTop );
	lblTop.setText( Messages.getString( "InsetsComposite.Lbl.Top" ) ); //$NON-NLS-1$

	txtTop = new LocalizedNumberEditorComposite( grpInsets, SWT.BORDER );
	new TextNumberEditorAssistField( txtTop.getTextControl( ), null );
	
	GridData gdTTop = new GridData( GridData.FILL_BOTH );
	// gdTTop.heightHint = 20;
	gdTTop.widthHint = 45;
	txtTop.setLayoutData( gdTTop );
}
 
Example 4
Source File: InsetsComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createLeft( Composite grpInsets )
{
	lblLeft = new Label( grpInsets, SWT.NONE );
	GridData gdLLeft = new GridData( GridData.VERTICAL_ALIGN_CENTER );
	// gdLLeft.heightHint = 20;
	lblLeft.setLayoutData( gdLLeft );
	lblLeft.setText( Messages.getString( "InsetsComposite.Lbl.Left" ) ); //$NON-NLS-1$

	txtLeft = new LocalizedNumberEditorComposite( grpInsets, SWT.BORDER );
	new TextNumberEditorAssistField( txtLeft.getTextControl( ), null );
	
	GridData gdTLeft = new GridData( GridData.FILL_BOTH );
	// gdTLeft.heightHint = 20;
	gdTLeft.widthHint = 45;
	txtLeft.setLayoutData( gdTLeft );
}
 
Example 5
Source File: InsetsComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createBottom( Composite grpInsets )
{
	lblBottom = new Label( grpInsets, SWT.NONE );
	GridData gdLBottom = new GridData( GridData.VERTICAL_ALIGN_CENTER );
	// gdLBottom.heightHint = 20;
	lblBottom.setLayoutData( gdLBottom );
	lblBottom.setText( Messages.getString( "InsetsComposite.Lbl.Bottom" ) ); //$NON-NLS-1$

	txtBottom = new LocalizedNumberEditorComposite( grpInsets, SWT.BORDER );
	new TextNumberEditorAssistField( txtBottom.getTextControl( ), null );
	
	GridData gdTBottom = new GridData( GridData.FILL_BOTH );
	// gdTBottom.heightHint = 20;
	gdTBottom.widthHint = 45;
	txtBottom.setLayoutData( gdTBottom );
}
 
Example 6
Source File: InsetsComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createRight( Composite grpInsets )
{
	lblRight = new Label( grpInsets, SWT.NONE );
	GridData gdLRight = new GridData( GridData.VERTICAL_ALIGN_CENTER );
	// gdLRight.heightHint = 20;
	lblRight.setLayoutData( gdLRight );
	lblRight.setText( Messages.getString( "InsetsComposite.Lbl.Right" ) ); //$NON-NLS-1$

	txtRight = new LocalizedNumberEditorComposite( grpInsets, SWT.BORDER );
	new TextNumberEditorAssistField( txtRight.getTextControl( ), null );
	
	GridData gdTRight = new GridData( GridData.FILL_BOTH );
	// gdTRight.heightHint = 20;
	gdTRight.widthHint = 45;
	txtRight.setLayoutData( gdTRight );
}
 
Example 7
Source File: UIPWFinishPanel.java    From BiglyBT with GNU General Public License v2.0 6 votes vote down vote up
@Override
 public void show() {
   wizard.setTitle(MessageText.getString("uninstallPluginsWizard.finish.title"));
   wizard.setErrorMessage("");

Composite rootPanel = wizard.getPanel();
GridLayout layout = new GridLayout();
layout.numColumns = 1;
rootPanel.setLayout(layout);

Composite panel = new Composite(rootPanel, SWT.NULL);
GridData gridData = new GridData(GridData.VERTICAL_ALIGN_CENTER | GridData.FILL_HORIZONTAL);
panel.setLayoutData(gridData);
layout = new GridLayout();
layout.numColumns = 1;
panel.setLayout(layout);

Label lblExplanation = new Label(panel,SWT.WRAP);
GridData data = new GridData(GridData.FILL_BOTH);
lblExplanation.setLayoutData(data);
Messages.setLanguageText(lblExplanation,"uninstallPluginsWizard.finish.explanation");
 }
 
Example 8
Source File: FileCoverMsgDialog.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
@Override
protected Control createButtonBar(Composite parent) {
	Composite composite = new Composite(parent, SWT.NONE);
	GridLayout layout = new GridLayout();
	layout.numColumns = 2; // this is incremented by createButton
	layout.marginWidth = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_MARGIN);
	layout.marginHeight = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_MARGIN);
	layout.horizontalSpacing = convertHorizontalDLUsToPixels(IDialogConstants.HORIZONTAL_SPACING);
	layout.verticalSpacing = convertVerticalDLUsToPixels(IDialogConstants.VERTICAL_SPACING);
	composite.setLayout(layout);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL
			| GridData.VERTICAL_ALIGN_CENTER);
	composite.setLayoutData(data);
	composite.setFont(parent.getFont());
	
	createAlwaysBtnArea(composite);
	createBtnArea(composite);
	
	return composite;
}
 
Example 9
Source File: RebootConfirmDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	// create composite
	Composite composite = (Composite) super.createDialogArea(parent);
	// create message
	if (message != null) {
		Label label = new Label(composite, SWT.WRAP);
		label.setText(message);
		GridData data = new GridData(GridData.GRAB_HORIZONTAL
				| GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
				| GridData.VERTICAL_ALIGN_CENTER);
		data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
		label.setLayoutData(data);
		label.setFont(parent.getFont());
	}
	// label=new Label(composite,SWT.NONE);
	// label.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
	// | GridData.HORIZONTAL_ALIGN_FILL));
	// label.setText("12345678");
	errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
	errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
			| GridData.HORIZONTAL_ALIGN_FILL));
	errorMessageText.setBackground(errorMessageText.getDisplay()
			.getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
	// Set the error message text
	// See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
	setErrorMessage(errorMessage);

	applyDialogFont(composite);
	return composite;
}
 
Example 10
Source File: DialogComboSelection.java    From arx with Apache License 2.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);
        GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL |
                                     GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    combo = new Combo(composite, SWT.NONE);
    combo.setItems(choices);
    combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    combo.addModifyListener(new ModifyListener() {
        @Override
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay().getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}
 
Example 11
Source File: InputDialogWithLongMessage.java    From Pydev with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Text messageText = new Text(composite,
                SWT.BORDER | SWT.MULTI | SWT.READ_ONLY | SWT.V_SCROLL | SWT.H_SCROLL);
        messageText.setText(message);
        GridData data = new GridData(GridData.GRAB_HORIZONTAL
                | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
                | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        messageText.setLayoutData(data);
        messageText.setFont(parent.getFont());
    }
    text = new Text(composite, getInputTextStyle());
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
            | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(e -> validateInput());
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
            | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay()
            .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}
 
Example 12
Source File: InputDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
    // create composite
    Composite composite = (Composite) super.createDialogArea(parent);
    // create message
    if (message != null) {
        Label label = new Label(composite, SWT.WRAP);
        label.setText(message);
        GridData data = new GridData(GridData.GRAB_HORIZONTAL
                | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
                | GridData.VERTICAL_ALIGN_CENTER);
        data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
        label.setLayoutData(data);
        label.setFont(parent.getFont());
    }
    text = new Text(composite, SWT.PASSWORD);
    text.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
            | GridData.HORIZONTAL_ALIGN_FILL));
    text.addModifyListener(new ModifyListener() {
        public void modifyText(ModifyEvent e) {
            validateInput();
        }
    });
    errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
    errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
            | GridData.HORIZONTAL_ALIGN_FILL));
    errorMessageText.setBackground(errorMessageText.getDisplay()
            .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
    // Set the error message text
    // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
    setErrorMessage(errorMessage);

    applyDialogFont(composite);
    return composite;
}
 
Example 13
Source File: DetailsDialogWithProjects.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * @see DetailsDialog#createMainDialogArea(Composite)
 */
protected void createMainDialogArea(Composite composite) {
	Label label = new Label(composite, SWT.WRAP);
	label.setText(message); //$NON-NLS-1$
	GridData data = new GridData(
		GridData.GRAB_HORIZONTAL |
		GridData.GRAB_VERTICAL |
		GridData.HORIZONTAL_ALIGN_FILL |
		GridData.VERTICAL_ALIGN_CENTER);
	data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
	label.setLayoutData(data);
	label.setFont(composite.getFont());
	updateEnablements();
}
 
Example 14
Source File: CommentTemplateEditDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
      // create composite
      Composite composite = (Composite) super.createDialogArea(parent);
      // create message
      if (message != null) {
          Label label = new Label(composite, SWT.WRAP);
          label.setText(message);
          GridData data = new GridData(GridData.GRAB_HORIZONTAL
                  | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
                  | GridData.VERTICAL_ALIGN_CENTER);
          data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
          label.setLayoutData(data);
          label.setFont(parent.getFont());
      }
      text = new Text(composite, SWT.MULTI | SWT.BORDER);
      GridData gd = new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL);
gd.heightHint = convertHeightInCharsToPixels(5);
text.setLayoutData(gd);
      text.addModifyListener(new ModifyListener() {
          public void modifyText(ModifyEvent e) {
              validateInput();
          }
      });
      errorMessageText = new Text(composite, SWT.READ_ONLY);
      errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      errorMessageText.setBackground(errorMessageText.getDisplay()
              .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));

      applyDialogFont(composite);
      return composite;
  }
 
Example 15
Source File: InputURLDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
      // create composite
      Composite composite = (Composite) super.createDialogArea(parent);
      // create message
      if (message != null) {
          Label label = new Label(composite, SWT.WRAP);
          label.setText(message);
          GridData data = new GridData(GridData.GRAB_HORIZONTAL
                  | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL
                  | GridData.VERTICAL_ALIGN_CENTER);
          data.widthHint = convertHorizontalDLUsToPixels(IDialogConstants.MINIMUM_MESSAGE_AREA_WIDTH);
          label.setLayoutData(data);
          label.setFont(parent.getFont());
      }
      combo = new CCombo(composite, getInputComboStyle());
      combo.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      combo.addModifyListener(new ModifyListener() {
          public void modifyText(ModifyEvent e) {
              validateInput();
          }
      });
      errorMessageText = new Text(composite, SWT.READ_ONLY | SWT.WRAP);
      errorMessageText.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL
              | GridData.HORIZONTAL_ALIGN_FILL));
      errorMessageText.setBackground(errorMessageText.getDisplay()
              .getSystemColor(SWT.COLOR_WIDGET_BACKGROUND));
errorMessageText.setForeground(errorMessageText.getDisplay()
		.getSystemColor(SWT.COLOR_RED));
      // Set the error message text
      // See https://bugs.eclipse.org/bugs/show_bug.cgi?id=66292
      setErrorMessage(errorMessage);

      applyDialogFont(composite);
      return composite;
  }
 
Example 16
Source File: TabRenameDialog.java    From LogViewer with Eclipse Public License 2.0 5 votes vote down vote up
protected Control createDialogArea(Composite parent) {
	// create composite
	Composite composite = (Composite) super.createDialogArea(parent);
	// create text input field
	nameField = new Text(composite,SWT.LEFT);
	GridData data = new GridData(GridData.GRAB_HORIZONTAL | GridData.GRAB_VERTICAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_CENTER);
	nameField.setLayoutData(data);
	// fill the text with the current tab name
	nameField.setText(oldValue);
	applyDialogFont(composite);
	return composite;
}
 
Example 17
Source File: ExcelFileSelectionWizardPage.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Create the middle button composite that displays ADD button
 * 
 * @param composite
 * @return
 */
private Composite createAddBtnComposite( Composite composite )
{
	FormData data = new FormData( );
	data.top = new FormAttachment( 50, 5 );
	data.left = new FormAttachment( availableList, 3 );

	Composite btnComposite = new Composite( composite, SWT.NONE );
	btnComposite.setLayoutData( data );
	GridLayout layout = new GridLayout( );
	layout.numColumns = 1;
	btnComposite.setLayout( layout );

	btnAdd = new Button( btnComposite, SWT.NONE );
	GridData gridData = new GridData( GridData.VERTICAL_ALIGN_CENTER
			| GridData.FILL_HORIZONTAL );
	gridData.heightHint = 25;
	btnAdd.setLayoutData( gridData );
	btnAdd.setToolTipText( Messages.getString( "tooltip.button.add" ) ); //$NON-NLS-1$

	if ( btnAdd.getStyle( ) == ( btnAdd.getStyle( ) | SWT.LEFT_TO_RIGHT ) )
	{
		btnAdd.setImage( PlatformUI.getWorkbench( )
				.getSharedImages( )
				.getImage( ISharedImages.IMG_TOOL_FORWARD ) );
	}
	else
	{
		btnAdd.setImage( PlatformUI.getWorkbench( )
				.getSharedImages( )
				.getImage( ISharedImages.IMG_TOOL_BACK ) );
	}

	btnAdd.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent e )
		{
			addColumns( );
		}
	} );
	btnAdd.setEnabled( false );
	return btnComposite;
}
 
Example 18
Source File: SWTFactory.java    From tlaplus with MIT License 3 votes vote down vote up
/**
 * Creates a new link widget
 * 
 * @param parent the parent composite to add this label widget to
 * @param text the text for the label
 * @param font the font for the label
 * @param hspan the horizontal span to take up in the parent composite
 * @return the new label
 */
public static Link createLink(Composite parent, String text, Font font, int hspan) {
	Link l = new Link(parent, SWT.UNDERLINE_LINK);
	l.setFont(font);
	l.setText(text);
	GridData gd = new GridData(GridData.BEGINNING, GridData.VERTICAL_ALIGN_CENTER, true, false, hspan, 1);
	l.setLayoutData(gd);
	return l;
}