Java Code Examples for org.eclipse.swt.widgets.Button#setLayoutData()

The following examples show how to use org.eclipse.swt.widgets.Button#setLayoutData() . 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: RadioTab.java    From hop with Apache License 2.0 8 votes vote down vote up
public Composite createContent( String radioText ) {
  Control[] existingButtons = radioGroup.getChildren();
  Button button = new Button( radioGroup, SWT.RADIO );
  button.setText( radioText );
  props.setLook( button );
  FormData fdButton = new FormData();
  fdButton.top = new FormAttachment( 0 );
  fdButton.left = existingButtons.length == 0
    ? new FormAttachment( 0 ) : new FormAttachment( existingButtons[ existingButtons.length - 1 ], 40 );
  button.setLayoutData( fdButton );
  button.setSelection( existingButtons.length == 0 );
  Composite content = new Composite( contentArea, SWT.NONE );
  content.setVisible( existingButtons.length == 0 );
  props.setLook( content );
  content.setLayout( noMarginLayout );
  content.setLayoutData( fdMaximize );
  button.addSelectionListener( new SelectionAdapter() {
    @Override public void widgetSelected( SelectionEvent selectionEvent ) {
      for ( Control control : contentArea.getChildren() ) {
        control.setVisible( false );
      }
      content.setVisible( true );
    }
  } );
  return content;
}
 
Example 2
Source File: ManageOrganizationWizardPage.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
private void createRemoveButton(final Composite buttonComposite) {
    removeButton = new Button(buttonComposite, SWT.FLAT) ;
    removeButton.setText(Messages.remove) ;
    removeButton.setLayoutData(GridDataFactory.fillDefaults().grab(true,false).create()) ;
    removeButton.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(final SelectionEvent e) {
            final List<?> list = ((IStructuredSelection) viewer.getSelection()).toList();
            if(list.size() > 1){
                FileActionDialog.activateYesNoToAll() ;
            }
            for(final Object sel : list){
                if(FileActionDialog.confirmDeletionQuestion(((Organization)sel).getName())){
                    organizations.remove(sel) ;
                }
            }
            FileActionDialog.deactivateYesNoToAll() ;
            viewer.setInput(organizations) ;
        }
    }) ;
}
 
Example 3
Source File: ReverseConversionWizardPage.java    From tmxeditor8 with GNU General Public License v2.0 6 votes vote down vote up
/**
 * 转换选项组
 * @param contents
 *            ;
 */
private void createConversionOptionsGroup(Composite contents) {
	Group options = new Group(contents, SWT.NONE);
	options.setText(Messages.getString("wizard.ReverseConversionWizardPage.options"));
	options.setLayout(new GridLayout());
	options.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	btnReplaceTarget = new Button(options, SWT.CHECK);
	btnReplaceTarget.setText(Messages.getString("wizard.ReverseConversionWizardPage.btnReplaceTarget"));
	btnReplaceTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	btnReplaceTarget.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			for (ConversionConfigBean conversionConfigBean : conversionConfigBeans) {
				conversionConfigBean.setReplaceTarget(btnReplaceTarget.getSelection());
			}

			validate();
		}
	});
}
 
Example 4
Source File: TSWizardDialog.java    From translationstudio8 with GNU General Public License v2.0 5 votes vote down vote up
protected void setButtonLayoutData(Button button) {
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);

	// On large fonts this can make this dialog huge
	widthHint = Math.min(widthHint,
			button.getDisplay().getBounds().width / 5);
	Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	data.widthHint = Math.max(widthHint, minSize.x);

	button.setLayoutData(data);
}
 
Example 5
Source File: DialogArea.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Button createRadioButton(Composite parent, String label, int span) {
	Button button = new Button(parent, SWT.RADIO);
	button.setText(label);
	GridData data = new GridData();
	data.horizontalSpan = span;
	button.setLayoutData(data);
	return button;
}
 
Example 6
Source File: AddRemoveList.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
/**
 * Sets the <code>GridData</code> on the specified button to be one that is spaced for the current dialog page
 * units. The method <code>initializeDialogUnits</code> must be called once before calling this method for the first
 * time.
 * 
 * @param button
 *            the button to set the <code>GridData</code>
 * @return the <code>GridData</code> set on the specified button
 */
protected GridData setButtonLayoutData(Button button)
{
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	PixelConverter converter = new PixelConverter(button);
	int widthHint = converter.convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH);
	Point minSize = button.computeSize(SWT.DEFAULT, SWT.DEFAULT, true);
	data.widthHint = Math.max(widthHint, minSize.x);
	button.setLayoutData(data);
	return data;
}
 
Example 7
Source File: SVNMenuIconsPreferencesPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private Button createRadio(Composite group, String label, int horizontalSpan) {
    Button button = new Button(group, SWT.RADIO);
    button.setText(label);
    GridData data = new GridData();
    data.horizontalSpan = horizontalSpan;
    button.setLayoutData(data);
    return button;
}
 
Example 8
Source File: ChartCheckbox.java    From birt with Eclipse Public License 1.0 5 votes vote down vote up
protected void placeComponents( int styles )
{
	GridLayout gl = new GridLayout( );
	gl.marginHeight = 0;
	gl.marginWidth = 0;
	gl.marginLeft = 2;
	gl.marginRight = 2;
	gl.marginTop = 2;
	gl.marginBottom = 2;
	setLayout( gl );
	button = new Button( this, SWT.CHECK | styles );
	GridData gd = new GridData( GridData.FILL_BOTH );
	button.setLayoutData( gd );
}
 
Example 9
Source File: ConfigurationWizardAutoconnectPage.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
public void createControl(Composite parent) {
	Composite composite = createComposite(parent, 2);
	setControl(composite);
	
	// set F1 help
	PlatformUI.getWorkbench().getHelpSystem().setHelp(composite, IHelpContextIds.SHARING_AUTOCONNECT_PAGE);
	
	Label description = createWrappingLabel(composite, Policy.bind("RepositorySelectionPage.description"), 0 /* indent */, 2 /* columns */); //$NON-NLS-1$
	description.setText(Policy.bind("ConfigurationWizardAutoconnectPage.description")); //$NON-NLS-1$
	
	if (location == null) return;

	// Spacer
	createLabel(composite, ""); //$NON-NLS-1$
	createLabel(composite, ""); //$NON-NLS-1$
	
	createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.user")); //$NON-NLS-1$
	createLabel(composite, location.getUsername());
	createLabel(composite, Policy.bind("ConfigurationWizardAutoconnectPage.host")); //$NON-NLS-1$
	createLabel(composite, location.getUrl().toString());
       
	// Spacer
	createLabel(composite, ""); //$NON-NLS-1$
	createLabel(composite, ""); //$NON-NLS-1$
	
	final Button check = new Button(composite, SWT.CHECK);
	GridData data = new GridData();
	data.horizontalSpan = 2;
	check.setLayoutData(data);
	check.setText(Policy.bind("ConfigurationWizardAutoconnectPage.validate")); //$NON-NLS-1$
	check.addListener(SWT.Selection, new Listener() {
		public void handleEvent(Event event) {
			validate = check.getSelection();
		}
	});
	check.setSelection(true);		
}
 
Example 10
Source File: CompositeFactory.java    From ermasterr with Apache License 2.0 5 votes vote down vote up
public static Button createDownButton(final Composite composite) {
    final GridData gridData = new GridData();
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.BEGINNING;
    gridData.widthHint = Resources.SMALL_BUTTON_WIDTH;

    final Button button = new Button(composite, SWT.NONE);
    button.setText(ResourceString.getResourceString("label.down.arrow"));
    button.setLayoutData(gridData);

    return button;
}
 
Example 11
Source File: ChangeExceptionsControl.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
private Button createAddButton(Composite buttonComposite) {
	Button button= new Button(buttonComposite, SWT.PUSH);
	button.setText(RefactoringMessages.ChangeExceptionsControl_buttons_add);
	button.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	SWTUtil.setButtonDimensionHint(button);
	button.setEnabled(true);
	button.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			doAddException();
		}
	});
	return button;
}
 
Example 12
Source File: TransDialog.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void addDepTab() {
  // ////////////////////////
  // START OF Dep TAB///
  // /
  wDepTab = new CTabItem( wTabFolder, SWT.NONE );
  wDepTab.setText( BaseMessages.getString( PKG, "TransDialog.DepTab.Label" ) );

  FormLayout DepLayout = new FormLayout();
  DepLayout.marginWidth = Const.MARGIN;
  DepLayout.marginHeight = Const.MARGIN;

  Composite wDepComp = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wDepComp );
  wDepComp.setLayout( DepLayout );

  Label wlFields = new Label( wDepComp, SWT.RIGHT );
  wlFields.setText( BaseMessages.getString( PKG, "TransDialog.Fields.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  final int FieldsCols = 3;
  final int FieldsRows = transMeta.nrDependencies();

  ColumnInfo[] colinf = new ColumnInfo[FieldsCols];
  colinf[0] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "TransDialog.ColumnInfo.Connection.Label" ),
      ColumnInfo.COLUMN_TYPE_CCOMBO, connectionNames );
  colinf[1] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "TransDialog.ColumnInfo.Table.Label" ), ColumnInfo.COLUMN_TYPE_TEXT,
      false );
  colinf[2] =
    new ColumnInfo(
      BaseMessages.getString( PKG, "TransDialog.ColumnInfo.Field.Label" ), ColumnInfo.COLUMN_TYPE_TEXT,
      false );

  wFields =
    new TableView(
      transMeta, wDepComp, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, FieldsRows, lsMod, props );

  wGet = new Button( wDepComp, SWT.PUSH );
  wGet.setText( BaseMessages.getString( PKG, "TransDialog.GetDependenciesButton.Label" ) );

  fdGet = new FormData();
  fdGet.bottom = new FormAttachment( 100, 0 );
  fdGet.left = new FormAttachment( 50, 0 );
  wGet.setLayoutData( fdGet );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( wGet, 0 );
  wFields.setLayoutData( fdFields );

  FormData fdDepComp = new FormData();
  fdDepComp.left = new FormAttachment( 0, 0 );
  fdDepComp.top = new FormAttachment( 0, 0 );
  fdDepComp.right = new FormAttachment( 100, 0 );
  fdDepComp.bottom = new FormAttachment( 100, 0 );
  wDepComp.setLayoutData( fdDepComp );

  wDepComp.layout();
  wDepTab.setControl( wDepComp );

  // ///////////////////////////////////////////////////////////
  // / END OF DEP TAB
  // ///////////////////////////////////////////////////////////
}
 
Example 13
Source File: QuestionsPage.java    From CogniCrypt with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void createControl(final Composite parent) {
	final Composite container = new Composite(parent, SWT.NONE);
	setControl(container);

	// make the page layout two-column
	container.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
	container.setLayout(new GridLayout(2, false));

	setCompositeToHoldGranularUIElements(new CompositeToHoldGranularUIElements(container, getName()));
	// fill the available space on the with the big composite
	getCompositeToHoldGranularUIElements().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

	TaskIntegrationWizard tiWizard = null;

	if (TaskIntegrationWizard.class.isInstance(getWizard())) {
		tiWizard = (TaskIntegrationWizard) getWizard();
	} else {
		Activator.getDefault().logError("PageForTaskIntegratorWizard was instantiated by a wizard other than TaskIntegrationWizard");
	}

	final PageForTaskIntegratorWizard claferPage = tiWizard.getTIPageByName(Constants.PAGE_NAME_FOR_CLAFER_FILE_CREATION);
	final CompositeToHoldGranularUIElements claferPageComposite = claferPage.getCompositeToHoldGranularUIElements();

	final QuestionDialog questionDialog = new QuestionDialog(parent.getShell());
	final Button qstnDialog = new Button(container, SWT.NONE);
	qstnDialog.setLayoutData(new GridData(SWT.RIGHT, SWT.TOP, false, false));
	qstnDialog.setText("Add Question");

	qstnDialog.addSelectionListener(new SelectionAdapter() {

		@Override
		public void widgetSelected(final SelectionEvent e) {
			final int response = questionDialog.open();
			final int qID = QuestionsPage.this.compositeToHoldGranularUIElements.getListOfAllQuestions().size();
			if (response == Window.OK) {
				QuestionsPage.this.counter++;
				// Question questionDetails = getDummyQuestion(questionDialog.getQuestionText(),questionDialog.getquestionType(),questionDialog.getAnswerValue());
				final Question questionDetails = questionDialog.getQuestionDetails();
				questionDetails.setId(qID);

				// Update the array list.
				QuestionsPage.this.compositeToHoldGranularUIElements.getListOfAllQuestions().add(questionDetails);
				QuestionsPage.this.compositeToHoldGranularUIElements.addQuestionUIElements(questionDetails, claferPageComposite.getClaferModel(), false);
				// rebuild the UI
				QuestionsPage.this.compositeToHoldGranularUIElements.updateQuestionContainer();
			}
		}
	});
}
 
Example 14
Source File: SWTOtherEditor.java    From buffer_bci with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates a new instance.
 *
 * @param parent  the parent.
 * @param style  the style.
 * @param chart  the chart.
 */
public SWTOtherEditor(Composite parent, int style, JFreeChart chart) {
    super(parent, style);
    FillLayout layout = new FillLayout();
    layout.marginHeight = layout.marginWidth = 4;
    setLayout(layout);

    Group general = new Group(this, SWT.NONE);
    general.setLayout(new GridLayout(3, false));
    general.setText(localizationResources.getString("General"));

    // row 1: antialiasing
    this.antialias = new Button(general, SWT.CHECK);
    this.antialias.setText(localizationResources.getString(
            "Draw_anti-aliased"));
    this.antialias.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true,
            false, 3, 1));
    this.antialias.setSelection(chart.getAntiAlias());

    //row 2: background paint for the chart
    new Label(general, SWT.NONE).setText(localizationResources.getString(
            "Background_paint"));
    this.backgroundPaintCanvas = new SWTPaintCanvas(general, SWT.NONE,
            SWTUtils.toSwtColor(getDisplay(), chart.getBackgroundPaint()));
    GridData bgGridData = new GridData(SWT.FILL, SWT.CENTER, true, false);
    bgGridData.heightHint = 20;
    this.backgroundPaintCanvas.setLayoutData(bgGridData);
    Button selectBgPaint = new Button(general, SWT.PUSH);
    selectBgPaint.setText(localizationResources.getString("Select..."));
    selectBgPaint.setLayoutData(new GridData(SWT.CENTER, SWT.CENTER, false,
            false));
    selectBgPaint.addSelectionListener(
            new SelectionAdapter() {
                public void widgetSelected(SelectionEvent event) {
                    ColorDialog dlg = new ColorDialog(getShell());
                    dlg.setText(localizationResources.getString(
                            "Background_paint"));
                    dlg.setRGB(SWTOtherEditor.this.backgroundPaintCanvas
                            .getColor().getRGB());
                    RGB rgb = dlg.open();
                    if (rgb != null) {
                        SWTOtherEditor.this.backgroundPaintCanvas.setColor(
                                new Color(getDisplay(), rgb));
                    }
                }
            }
    );
}
 
Example 15
Source File: UserDefinedJavaClassDialog.java    From hop with Apache License 2.0 4 votes vote down vote up
private void addFieldsTab() {
  fieldsTab = new CTabItem( wTabFolder, SWT.NONE );
  fieldsTab.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Fields.Title" ) );
  fieldsTab.setToolTipText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Tabs.Fields.TooltipText" ) );

  Composite wBottom = new Composite( wTabFolder, SWT.NONE );
  props.setLook( wBottom );
  fieldsTab.setControl( wBottom );
  FormLayout bottomLayout = new FormLayout();
  bottomLayout.marginWidth = Const.FORM_MARGIN;
  bottomLayout.marginHeight = Const.FORM_MARGIN;
  wBottom.setLayout( bottomLayout );

  Label wlFields = new Label( wBottom, SWT.NONE );
  wlFields.setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.Fields.Label" ) );
  props.setLook( wlFields );
  FormData fdlFields = new FormData();
  fdlFields.left = new FormAttachment( 0, 0 );
  fdlFields.top = new FormAttachment( 0, 0 );
  wlFields.setLayoutData( fdlFields );

  wClearResultFields = new Button( wBottom, SWT.CHECK );
  wClearResultFields
    .setText( BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ClearResultFields.Label" ) );
  props.setLook( wClearResultFields );
  FormData fdClearResultFields = new FormData();
  fdClearResultFields.right = new FormAttachment( 100, 0 );
  fdClearResultFields.top = new FormAttachment( 0, 0 );
  wClearResultFields.setLayoutData( fdClearResultFields );

  final int fieldsRows = input.getFieldInfo().size();

  ColumnInfo[] colinf =
    new ColumnInfo[] {
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Filename" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Type" ),
        ColumnInfo.COLUMN_TYPE_CCOMBO, ValueMetaFactory.getValueMetaNames() ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Length" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ),
      new ColumnInfo(
        BaseMessages.getString( PKG, "UserDefinedJavaClassDialog.ColumnInfo.Precision" ),
        ColumnInfo.COLUMN_TYPE_TEXT, false ), };

  wFields =
    new TableView(
      pipelineMeta, wBottom, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI, colinf, fieldsRows, lsMod, props );

  FormData fdFields = new FormData();
  fdFields.left = new FormAttachment( 0, 0 );
  fdFields.top = new FormAttachment( wlFields, margin );
  fdFields.right = new FormAttachment( 100, 0 );
  fdFields.bottom = new FormAttachment( 100, 0 );
  wFields.setLayoutData( fdFields );

  FormData fdBottom = new FormData();
  fdBottom.left = new FormAttachment( 0, 0 );
  fdBottom.top = new FormAttachment( 0, 0 );
  fdBottom.right = new FormAttachment( 100, 0 );
  fdBottom.bottom = new FormAttachment( 100, 0 );
  wBottom.setLayoutData( fdBottom );

}
 
Example 16
Source File: EditboxPreferencePage.java    From gama with GNU General Public License v3.0 4 votes vote down vote up
protected Control createCategoryControl(final Composite parent) {
	final Composite c = new Composite(parent, SWT.NONE);
	c.setLayout(new GridLayout(2, true));

	final Label categoryLabel = new Label(c, SWT.NONE);
	categoryLabel.setText("Themes");

	final Label namesLabel = new Label(c, SWT.NONE);
	namesLabel.setText("Associated file names");
	namesLabel.setAlignment(SWT.RIGHT);

	categoryList = new List(c, SWT.V_SCROLL | SWT.BORDER);
	categoryList.setLayoutData(new GridData(GridData.FILL_BOTH));
	categoryList.addSelectionListener(new SelectCategory());
	namesList = new List(c, SWT.V_SCROLL | SWT.BORDER);
	namesList.setLayoutData(new GridData(GridData.FILL_BOTH));

	final Composite cLeft = new Composite(c, SWT.NONE);
	cLeft.setLayout(new GridLayout(2, true));
	final Button bAddCategory = new Button(cLeft, SWT.NONE);
	bAddCategory.setText("Add");
	bAddCategory.addSelectionListener(new AddCategory());
	bAddCategory.setLayoutData(new GridData(GridData.FILL_BOTH));
	final Button bRemoveCategory = new Button(cLeft, SWT.NONE);
	bRemoveCategory.setText("Remove");
	bRemoveCategory.setLayoutData(new GridData(GridData.FILL_BOTH));
	bRemoveCategory.addSelectionListener(new RemoveCategory());

	final Composite cRight = new Composite(c, SWT.NONE);
	cRight.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_END));
	cRight.setLayout(new GridLayout(2, true));
	bAddFile = new Button(cRight, SWT.NONE);
	bAddFile.setText("Add");
	bAddFile.setLayoutData(new GridData(GridData.FILL_BOTH));
	bAddFile.addSelectionListener(new AddFile());
	bAddFile.setEnabled(false);
	final Button bRemoveFile = new Button(cRight, SWT.NONE);
	bRemoveFile.setText("Remove");
	bRemoveFile.setLayoutData(new GridData(GridData.FILL_BOTH));
	bRemoveFile.addSelectionListener(new RemoveFile());

	loadData();

	return c;
}
 
Example 17
Source File: TranslationPreferencePage.java    From translationstudio8 with GNU General Public License v2.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {
	Composite tparent = new Composite(parent, SWT.NONE);
	tparent.setLayout(new GridLayout());
	tparent.setLayoutData(new GridData(GridData.FILL_BOTH));

	Group group = new Group(tparent, SWT.NONE);
	group.setLayout(new GridLayout());
	group.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	group.setText(Messages.getString("translation.TranslationPreferencePage.group"));

	HsImageLabel imageLabel = new HsImageLabel(
			Messages.getString("translation.TranslationPreferencePage.imageLabel"),
			Activator.getImageDescriptor("images/preference/translate/trans_32.png"));

	Composite comp = imageLabel.createControl(group);

	btnAutoAdaptSpacePosition = new Button(comp, SWT.CHECK);
	btnAutoAdaptSpacePosition.setText(Messages
			.getString("translation.TranslationPreferencePage.btnAutoAdaptSpacePosition"));
	btnAutoAdaptSpacePosition.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	btnAutoApplyTmMatch = new Button(comp, SWT.CHECK);
	btnAutoApplyTmMatch.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	btnAutoApplyTmMatch.setText(Messages.getString("translation.TranslationPreferencePage.btnAutoApplyTmMatch"));

	btnCopyToTarget = new Button(comp, SWT.CHECK);
	btnCopyToTarget.setText(Messages.getString("translation.TranslationPreferencePage.btnCopyToTarget"));
	btnCopyToTarget.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	// btnSkipNotTranslateText = new Button(comp, SWT.CHECK);
	// btnSkipNotTranslateText.setText("翻译时跳过锁定文本段");
	// btnSkipNotTranslateText.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	btnAutoQuickTranslation = new Button(comp, SWT.CHECK);
	btnAutoQuickTranslation.setText(Messages
			.getString("translation.TranslationPreferencePage.btnAutoQuickTranslation"));
	btnAutoQuickTranslation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

	imageLabel.computeSize();

	Group openOfficeGroup = new Group(tparent, SWT.NONE);
	openOfficeGroup.setLayout(new GridLayout());
	openOfficeGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	openOfficeGroup.setText(Messages.getString("translation.TranslationPreferencePage.openOfficeGroup"));

	HsImageLabel imageLabel2 = new HsImageLabel(
			Messages.getString("translation.TranslationPreferencePage.imageLabel2"),
			Activator.getImageDescriptor("images/preference/translate/trans_office_32.png"));

	Composite composite = imageLabel2.createControl(openOfficeGroup);
	GridLayout gd = new GridLayout(3, false);
	gd.marginLeft = 0;
	gd.marginTop = 0;
	composite.setLayout(gd);

	new Label(composite, SWT.NONE).setText(Messages.getString("translation.TranslationPreferencePage.lblOO"));
	txtPath = new Text(composite, SWT.BORDER | SWT.READ_ONLY);
	txtPath.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	btnBrowse = new Button(composite, SWT.NONE);
	btnBrowse.setText(Messages.getString("translation.TranslationPreferencePage.btnBrowse"));

	imageLabel2.computeSize();

	setValues(false);
	initListener();
	return tparent;
}
 
Example 18
Source File: Widgets.java    From depan with Apache License 2.0 4 votes vote down vote up
public static Button buildCompactPushButton(Composite parent, String label) {
  Button result = new Button(parent, SWT.PUSH);
  result.setLayoutData(new GridData());
  result.setText(label);
  return result;
}
 
Example 19
Source File: StatisticsView.java    From CogniCrypt with Eclipse Public License 2.0 4 votes vote down vote up
@Override
public void createPartControl(Composite parent) {
	GridLayout layout = new GridLayout(3, false);
	parent.setLayout(layout);
	resultsEnabled = true;

	// Project Name
	Label projectnameLabel = new Label(parent, SWT.NONE);
	projectnameLabel.setText("Project Name: ");
	projectname = new StyledText(parent, SWT.NONE);
	projectname.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
	projectname.setText("Nothing for now");
	projectname.setEditable(false);

	// Refresh Button
	reRunButton = new Button(parent, SWT.PUSH);
	reRunButton.setText("Rerun the Analysis on this Project");
	reRunButton.setEnabled(false);
	reRunButton.setLayoutData(new GridData(SWT.END, SWT.CENTER, false, false));
	// register listener for the selection event
	reRunButton.addSelectionListener(new SelectionListener() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			final AnalysisKickOff runningAnalysis = new AnalysisKickOff();
			runningAnalysis.setUp(JavaCore.create(lastProject));
			runningAnalysis.run();
			resultsEnabled = true;
		}

		@Override
		public void widgetDefaultSelected(SelectionEvent arg0) {}

	});

	// Time of Analysis
	Label timeofanalysisLabel = new Label(parent, SWT.NONE);
	timeofanalysisLabel.setText("Time of Analysis: ");
	timeofanalysis = new StyledText(parent, SWT.NONE);
	timeofanalysis.setLayoutData(new GridData(GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL));
	timeofanalysis.setWordWrap(true);
	timeofanalysis.setEditable(false);

	// Results Table
	createViewer(parent);
}
 
Example 20
Source File: Widgets.java    From depan with Apache License 2.0 4 votes vote down vote up
public static Button buildCompactRadio(Composite parent, String label) {
  Button result = new Button(parent, SWT.RADIO);
  result.setLayoutData(new GridData());
  result.setText(label);
  return result;
}