Java Code Examples for org.eclipse.swt.widgets.Label#setText()

The following examples show how to use org.eclipse.swt.widgets.Label#setText() . 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: CopyTraceDialog.java    From tracecompass with Eclipse Public License 2.0 6 votes vote down vote up
private void createNewTraceNameGroup(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));

    String name = fTrace.getName();

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

    // New trace name entry field
    fNewTraceName = new Text(folderGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = IDialogConstants.ENTRY_FIELD_WIDTH;
    fNewTraceName.setLayoutData(data);
    fNewTraceName.setFont(font);
    fNewTraceName.setFocus();
    fNewTraceName.setText(name);
    fNewTraceName.setSelection(0, name.length());
    fNewTraceName.addListener(SWT.Modify, event -> validateNewTraceName());
}
 
Example 2
Source File: PieSeriesAttributeComposite.java    From birt with Eclipse Public License 1.0 6 votes vote down vote up
protected void createLeaderLineStyle( Composite cmpStyle )
{
	// Leader Line Style composite
	Label lblLeaderStyle = new Label( cmpStyle, SWT.NONE );
	GridData gdLBLLeaderStyle = new GridData( );
	lblLeaderStyle.setLayoutData( gdLBLLeaderStyle );
	lblLeaderStyle.setText( Messages.getString( "PieSeriesAttributeComposite.Lbl.LeaderLineStyle" ) ); //$NON-NLS-1$

	cmbLeaderLine = context.getUIFactory( ).createChartCombo( cmpStyle,
			SWT.DROP_DOWN | SWT.READ_ONLY,
			series,
			"leaderLineStyle", //$NON-NLS-1$
			defSeries.getLeaderLineStyle( ).getName( ) );
	GridData gdCMBLeaderLine = new GridData( GridData.FILL_HORIZONTAL );
	cmbLeaderLine.setLayoutData( gdCMBLeaderLine );
	cmbLeaderLine.addSelectionListener( this );

	NameSet ns = LiteralHelper.leaderLineStyleSet;
	cmbLeaderLine.setItems( ns.getDisplayNames( ) );
	cmbLeaderLine.setItemData( ns.getNames( ) );
	cmbLeaderLine.setSelection( series.getLeaderLineStyle( ).getName( ) );
}
 
Example 3
Source File: CompositeFactory.java    From erflute with Apache License 2.0 6 votes vote down vote up
public static Label createExampleLabel(Composite composite, String title, int span) {
    final Label label = new Label(composite, SWT.NONE);
    label.setText(DisplayMessages.getMessage(title));

    if (span > 0) {
        final GridData gridData = new GridData();
        gridData.horizontalSpan = span;
        label.setLayoutData(gridData);
    }

    final FontData fontData = Display.getCurrent().getSystemFont().getFontData()[0];
    final Font font = new Font(Display.getCurrent(), fontData.getName(), 8, SWT.NORMAL);
    label.setFont(font);

    return label;
}
 
Example 4
Source File: XPathExpressionEditor.java    From bonita-studio with GNU General Public License v2.0 6 votes vote down vote up
protected void createReturnTypeComposite(final Composite parent) {
    final Composite typeComposite = new Composite(parent, SWT.NONE);
    typeComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    final GridLayout gl = new GridLayout(2, false);
    gl.marginWidth = 0;
    gl.marginHeight = 0;
    typeComposite.setLayout(gl);

    final Label typeLabel = new Label(typeComposite, SWT.NONE);
    typeLabel.setText(Messages.returnType);
    typeLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.FILL, SWT.CENTER).create());

    typeCombo = new ComboViewer(typeComposite, SWT.BORDER | SWT.READ_ONLY);
    typeCombo.getControl().setLayoutData(GridDataFactory.fillDefaults().grab(true, false).align(SWT.FILL, SWT.CENTER).create());
    typeCombo.setContentProvider(new ArrayContentProvider());
    typeCombo.setInput(XPathReturnType.getAvailableReturnTypes());
    typeCombo.setSelection(new StructuredSelection(XPathReturnType.XPATH_STRING));

}
 
Example 5
Source File: CommitSetDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
protected Label createWrappingLabel(Composite parent, String text) {
	Label label = new Label(parent, SWT.LEFT | SWT.WRAP);
	label.setText(text);
	GridData data = new GridData();
	data.horizontalSpan = 1;
	data.horizontalAlignment = GridData.FILL;
	data.horizontalIndent = 0;
	data.grabExcessHorizontalSpace = true;
	data.widthHint = 200;
	label.setLayoutData(data);
	return label;
}
 
Example 6
Source File: BusinessObjectDataWizardPage.java    From bonita-studio with GNU General Public License v2.0 5 votes vote down vote up
protected void createBusinessObjectTypeControl(final Composite mainComposite,
        final EMFDataBindingContext ctx) {
    final Label businessObjectLabel = new Label(mainComposite, SWT.NONE);
    businessObjectLabel.setLayoutData(fillDefaults().align(SWT.END, SWT.CENTER).create());
    businessObjectLabel.setText(Messages.businessObject + " *");

    final Composite comboComposite = new Composite(mainComposite, SWT.NONE);
    comboComposite.setLayout(GridLayoutFactory.fillDefaults().margins(0, 0).create());
    comboComposite.setLayoutData(fillDefaults().grab(true, false).create());

    final ComboViewer businessObjectComboViewer = new ComboViewer(comboComposite, SWT.READ_ONLY | SWT.BORDER);
    businessObjectComboViewer.getControl().setLayoutData(fillDefaults().grab(true, false).create());
    businessObjectComboViewer.setContentProvider(new ObservableListContentProvider());
    businessObjectComboViewer.setLabelProvider(businessObjectLabelProvider());

    final IObservableList<BusinessObject> businessObjectsObservableList = new WritableList(getAllBusinessObjects(),
            BusinessObject.class);

    final IViewerObservableValue observeSingleSelection = ViewersObservables
            .observeSingleSelection(businessObjectComboViewer);
    businessObjectComboViewer.setInput(businessObjectsObservableList);

    classNameObservable = EMFObservables.observeValue(businessObjectData,
            ProcessPackage.Literals.JAVA_OBJECT_DATA__CLASS_NAME);
    ctx.bindValue(observeSingleSelection,
            classNameObservable,
            updateValueStrategy().withConverter(businessObjectToFQN())
                    .withValidator(mandatoryValidator(Messages.businessObject))
                    .create(),
            updateValueStrategy().withConverter(fqnToBusinessObject())
                    .create());

    defaultValueReturnTypeObservable = EMFObservables.observeValue(businessObjectData.getDefaultValue(),
            ExpressionPackage.Literals.EXPRESSION__RETURN_TYPE);

    final String className = businessObjectData.getClassName();
    if ((className == null || className.isEmpty()) && !businessObjectsObservableList.isEmpty()) {
        observeSingleSelection.setValue(businessObjectsObservableList.get(0));
    }
}
 
Example 7
Source File: RadlNewWizardPage.java    From RADL with Apache License 2.0 5 votes vote down vote up
private void addServiceControl(Composite parent) {
  Label label = new Label(parent, SWT.NULL);
  label.setText("REST &API:");
  serviceText = new Text(parent, SWT.BORDER | SWT.SINGLE);
  GridData gd = new GridData(GridData.FILL_HORIZONTAL);
  serviceText.setLayoutData(gd);
  serviceText.addModifyListener(new ModifyListener() {
    @Override
    public void modifyText(ModifyEvent e) {
      validateInput();
    }
  });
  new Label(parent, SWT.NULL);
}
 
Example 8
Source File: SortDesign.java    From ldparteditor with MIT License 5 votes vote down vote up
/**
 * Create contents of the dialog.
 *
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent) {
    Composite cmp_container = (Composite) super.createDialogArea(parent);
    GridLayout gridLayout = (GridLayout) cmp_container.getLayout();
    gridLayout.verticalSpacing = 10;
    gridLayout.horizontalSpacing = 10;

    Label lbl_specify = new Label(cmp_container, SWT.NONE);
    lbl_specify.setText(I18n.SORT_Title);

    Label lbl_separator = new Label(cmp_container, SWT.SEPARATOR | SWT.HORIZONTAL);
    lbl_separator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));

    Combo cmb_scope = new Combo(cmp_container, SWT.READ_ONLY);
    this.cmb_scope[0] = cmb_scope;
    cmb_scope.setItems(new String[] {I18n.SORT_ScopeFile, I18n.SORT_ScopeSelection});
    cmb_scope.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    if (fromLine == toLine) {
        cmb_scope.select(0);
        scope = 0;
    } else {
        cmb_scope.select(1);
        scope = 1;
    }

    Combo cmb_sortCriteria = new Combo(cmp_container, SWT.READ_ONLY);
    this.cmb_sortCriteria[0] = cmb_sortCriteria;
    cmb_sortCriteria.setItems(new String[] {I18n.SORT_ByColourAsc, I18n.SORT_ByColourDesc, I18n.SORT_ByTypeAsc, I18n.SORT_ByTypeDesc, I18n.SORT_ByTypeColourAsc, I18n.SORT_ByTypeColourDesc});
    cmb_sortCriteria.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1));
    cmb_sortCriteria.select(2);
    criteria = 2;

    NButton btn_ignoreStructure = new NButton(cmp_container, SWT.CHECK);
    this.btn_ignoreStructure[0] = btn_ignoreStructure;
    btn_ignoreStructure.setText(I18n.SORT_IgnoreStructure);
    cmp_container.pack();
    return cmp_container;
}
 
Example 9
Source File: ChoiceDialog.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
@Override
protected Control createDialogArea(Composite parent){
	Composite ret = (Composite) super.createDialogArea(parent);
	Label msg = new Label(ret, SWT.NONE);
	msg.setText(message);
	for (int i = 0; i < choices.length; i++) {
		buttons[i] = new Button(ret, SWT.RADIO);
		buttons[i].setText(choices[i]);
		buttons[i].setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
	}
	return ret;
}
 
Example 10
Source File: SnippetCompositeTableDataBinding.java    From nebula with Eclipse Public License 2.0 5 votes vote down vote up
private void doLayout() {
	setLayout(new FormLayout());
	Label lblName = new Label(this, SWT.CENTER);
	lblName.setText("Name");

	int index = 0;
	FormData data = new FormData();
	data.left = new FormAttachment(cols[index], 100, 5);
	data.right = new FormAttachment(cols[index + 1], 100, 0);
	data.top = new FormAttachment(0, 100, 5);

	lblName.setLayoutData(data);
	index++;

	Label lblFirstname = new Label(this, SWT.CENTER);
	lblFirstname.setText("Firstname");

	data = new FormData();
	data.left = new FormAttachment(cols[index], 100, 5);
	data.right = new FormAttachment(cols[index + 1], 100, 0);
	data.top = new FormAttachment(0, 100, 5);

	lblFirstname.setLayoutData(data);
	index++;

	Label lblAction = new Label(this, SWT.CENTER);
	lblAction.setText("Action");

	data = new FormData();
	data.left = new FormAttachment(cols[index], 100, 5);
	data.right = new FormAttachment(cols[index + 1], 100, 0);
	data.top = new FormAttachment(0, 100, 5);

	lblAction.setLayoutData(data);

}
 
Example 11
Source File: QueryOverwriteDialog.java    From elexis-3-core with Eclipse Public License 1.0 5 votes vote down vote up
/**
 * Create contents of the dialog.
 * 
 * @param parent
 */
@Override
protected Control createDialogArea(Composite parent){
	Composite container = (Composite) super.createDialogArea(parent);
	container.setLayout(new GridLayout(1, false));
	
	Label lblMessage = new Label(container, SWT.NONE);
	lblMessage.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, true, 1, 1));
	lblMessage.setText(_message);
	
	return container;
}
 
Example 12
Source File: JavaScriptViewer.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * Execute application
 * 
 * @param args
 */
public static void main( String[] args )
{

	Display display = Display.getDefault( );
	Shell shell = new Shell( display );
	shell.setSize( 600, 400 );
	shell.setLayout( new GridLayout( ) );

	JavaScriptViewer jsViewer = new JavaScriptViewer( shell,
			SWT.NO_BACKGROUND );
	jsViewer.setLayoutData( new GridData( GridData.FILL_BOTH ) );
	jsViewer.addPaintListener( jsViewer );

	Composite cBottom = new Composite( shell, SWT.NONE );
	cBottom.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	cBottom.setLayout( new RowLayout( ) );

	description = new Label( shell, SWT.NONE );
	description.setLayoutData( new GridData( GridData.FILL_HORIZONTAL ) );
	description.setText( "beforeDrawAxisLabel( Axis, Label, IChartScriptContext )" //$NON-NLS-1$
			+ "\nbeforeDrawAxisTitle( Axis, Label, IChartScriptContext )" ); //$NON-NLS-1$

	Label la = new Label( cBottom, SWT.NONE );

	la.setText( "&Choose: " );//$NON-NLS-1$
	cbType = new Combo( cBottom, SWT.DROP_DOWN | SWT.READ_ONLY );
	cbType.add( "Axis" );//$NON-NLS-1$
	cbType.add( "DataPoints" );//$NON-NLS-1$
	cbType.add( "Marker" );//$NON-NLS-1$
	cbType.add( "Series" );//$NON-NLS-1$
	cbType.add( "Series Title" ); //$NON-NLS-1$
	cbType.add( "Block" );//$NON-NLS-1$
	cbType.add( "Legend" ); //$NON-NLS-1$
	cbType.select( 0 );

	btn = new Button( cBottom, SWT.NONE );
	btn.setText( "&Update" );//$NON-NLS-1$
	btn.setToolTipText( "Update" );//$NON-NLS-1$
	btn.addSelectionListener( jsViewer );

	shell.open( );
	while ( !shell.isDisposed( ) )
	{
		if ( !display.readAndDispatch( ) )
			display.sleep( );
	}
	display.dispose( );
}
 
Example 13
Source File: JDBCPathDialog.java    From ermaster-b with Apache License 2.0 4 votes vote down vote up
@Override
protected void initialize(Composite composite) {
	GridData gridData = new GridData();
	gridData.horizontalSpan = 3;
	gridData.heightHint = 50;

	Label label = new Label(composite, SWT.NONE);
	label.setLayoutData(gridData);
	label.setText(ResourceString
			.getResourceString("label.jdbc.driver.message"));

	if (this.database != null) {
		DBManager dbManager = DBManagerFactory.getDBManager(this.database);

		if (dbManager.getDriverClassName().equals(this.driverClassName)
				&& !dbManager.getDriverClassName().equals("")) {
			this.editable = false;
		}

	}

	if (this.editable) {
		this.databaseCombo = CompositeFactory.createReadOnlyCombo(this,
				composite, "label.database", 2, -1);
		this.databaseCombo.setVisibleItemCount(10);

	} else {
		CompositeFactory.createLabel(composite, "label.database");
		CompositeFactory.createLabel(composite, this.database, 2);
	}

	this.driverClassNameText = CompositeFactory.createText(this, composite,
			"label.driver.class.name", 2, -1, SWT.BORDER, false);

	this.driverClassNameText.setEditable(editable);

	this.fileFieldEditor = new MultiFileFieldEditor("", ResourceString
			.getResourceString("label.path"), composite);
	this.fileFieldEditor.setMultiple(true);

	this.fileFieldEditor.setFocus();
}
 
Example 14
Source File: WizardGSImportPage.java    From slr-toolkit with Eclipse Public License 1.0 4 votes vote down vote up
@Override
public void createControl(Composite parent) {
	container = new Composite(parent, SWT.NONE);
	container.setLayout(new GridLayout(2, true));
	
	Label label1 = new Label(container, SWT.NONE);
	label1.setText("mit allen Wörtern");
	
	as_q = new Text(container, SWT.BORDER | SWT.SINGLE);
	as_q.setText("");
	as_q.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	Label label2 = new Label(container, SWT.NONE);
	label2.setText("mit ger genauen Worgruppe");
	
	as_epq = new Text(container, SWT.BORDER | SWT.SINGLE);
	as_epq.setText("");
	as_epq.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	Label label3 = new Label(container, SWT.NONE);
	label3.setText("mit irgendeinem der Wörter");
	
	as_oq = new Text(container, SWT.BORDER | SWT.SINGLE);
	as_oq.setText("");
	as_oq.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	Label label4 = new Label(container, SWT.NONE);
	label4.setText("ohne die Wörter");
	
	as_eq = new Text(container, SWT.BORDER | SWT.SINGLE);
	as_eq.setText("");
	as_eq.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	Label label5 = new Label(container, SWT.NONE);
	label5.setText("die meine Wörter enthalten");
	
	Group occt = new Group(container, SWT.NONE);
	GridLayout occt_layout = new GridLayout();
	occt_layout.numColumns = 1;
	occt.setLayout(occt_layout);
	occt.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	
	Button occt_any = new Button(occt, SWT.RADIO);
	occt_any.setText("irgendwo im Artikel");
	occt_any.setData("value", "any");
	
	Button occt_title = new Button(occt, SWT.RADIO);
	occt_title.setText("im Titel des Artikels");
	occt_any.setData("value", "title");
	
	SelectionListener occt_selectionListener = new SelectionAdapter () {
		public void widgetSelected(SelectionEvent event) {
			Button button = ((Button) event.widget);
			if(event.widget.equals(occt_any)) {
				as_occt = "any";
			}
			if(event.widget.equals(occt_title)) {
				as_occt="title";
			}
		};
	};
	occt_any.addSelectionListener(occt_selectionListener);
	occt_title.addSelectionListener(occt_selectionListener);
	
	Label label6 = new Label(container, SWT.NONE);
	label6.setText("Artikel zurückgeben, die von folgendem Autor verfasst wurden");
	
	as_sauthors = new Text(container, SWT.BORDER | SWT.SINGLE);
	as_sauthors.setText("");
	as_sauthors.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	Label label7 = new Label(container, SWT.NONE);
	label7.setText("Artikel zurückgeben, die hier veröffentlicht wurden");
	
	as_publication = new Text(container, SWT.BORDER | SWT.SINGLE);
	as_publication.setText("");
	as_publication.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	
	Label label8 = new Label(container, SWT.NONE);
	label8.setText("Artikel zurückgeben, die in folgendem Zeitraum geschrieben wurden");
	
	Composite years = new Composite(container, SWT.NONE);
	years.setLayout(new GridLayout(3, false));
	
	as_ylo = new Text(years, SWT.BORDER | SWT.SINGLE);
	as_ylo.setText("");
	
	Label label9 = new Label(years, SWT.NONE);
	label9.setText("--");
	
	as_yhi = new Text(years, SWT.BORDER | SWT.SINGLE);
	as_yhi.setText("");
	
	setControl(container);
	setPageComplete(true);
}
 
Example 15
Source File: SimpleFileSetsEditor.java    From eclipse-cs with GNU Lesser General Public License v2.1 4 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
public Control createContents(Composite parent) throws CheckstylePluginException {

  mController = new Controller();

  // group composite containing the config settings
  Group configArea = new Group(parent, SWT.NULL);
  configArea.setText(Messages.SimpleFileSetsEditor_titleSimpleConfig);
  configArea.setLayout(new FormLayout());

  this.mBtnManageConfigs = new Button(configArea, SWT.PUSH);
  this.mBtnManageConfigs.setText(Messages.SimpleFileSetsEditor_btnManageConfigs);
  this.mBtnManageConfigs.addSelectionListener(mController);
  FormData fd = new FormData();
  fd.top = new FormAttachment(0, 3);
  fd.right = new FormAttachment(100, -3);
  this.mBtnManageConfigs.setLayoutData(fd);

  mComboViewer = new ComboViewer(configArea);
  mComboViewer.getCombo().setVisibleItemCount(10);
  mComboViewer.setContentProvider(new CheckConfigurationContentProvider());
  mComboViewer.setLabelProvider(new CheckConfigurationLabelProvider());
  mComboViewer.setComparator(new CheckConfigurationViewerSorter());
  mComboViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mComboViewer.addSelectionChangedListener(mController);
  fd = new FormData();
  fd.left = new FormAttachment(0, 3);
  fd.top = new FormAttachment(0, 3);
  fd.right = new FormAttachment(mBtnManageConfigs, -3, SWT.LEFT);
  // fd.right = new FormAttachment(100, -3);
  mComboViewer.getCombo().setLayoutData(fd);

  // Description
  Label lblConfigDesc = new Label(configArea, SWT.LEFT);
  lblConfigDesc.setText(Messages.SimpleFileSetsEditor_lblDescription);
  fd = new FormData();
  fd.left = new FormAttachment(0, 3);
  fd.top = new FormAttachment(mComboViewer.getCombo(), 3, SWT.BOTTOM);
  fd.right = new FormAttachment(100, -3);
  lblConfigDesc.setLayoutData(fd);

  this.mTxtConfigDescription = new Text(configArea,
          SWT.LEFT | SWT.WRAP | SWT.MULTI | SWT.READ_ONLY | SWT.BORDER | SWT.VERTICAL);
  fd = new FormData();
  fd.left = new FormAttachment(0, 3);
  fd.top = new FormAttachment(lblConfigDesc, 0, SWT.BOTTOM);
  fd.right = new FormAttachment(100, -3);
  fd.bottom = new FormAttachment(100, -3);
  this.mTxtConfigDescription.setLayoutData(fd);

  // init the check configuration combo
  mComboViewer.setInput(mPropertyPage.getProjectConfigurationWorkingCopy());
  if (mDefaultFileSet.getCheckConfig() != null) {
    mComboViewer.setSelection(new StructuredSelection(mDefaultFileSet.getCheckConfig()));
  }

  return configArea;
}
 
Example 16
Source File: ColumnFilterDialog.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected void createExtendedArea(Composite parent) {
   super.createExtendedArea(parent);
   if (column.getSortDataType() == SortDataType.Date) {

      widgetComp = new Composite(parent, SWT.NONE);
      widgetComp.setLayout(new GridLayout(6, false));
      GridData gd = new GridData(GridData.FILL_HORIZONTAL);
      gd.horizontalSpan = 2;
      widgetComp.setLayoutData(gd);

      Label label = new Label(widgetComp, SWT.NONE);
      label.setText("Date Match: ");

      dateRangeTypeCombo = new ComboViewer(widgetComp, SWT.NONE);
      dateRangeTypeCombo.setContentProvider(new ArrayContentProvider());
      dateRangeTypeCombo.setLabelProvider(new LabelProvider() {

         @Override
         public String getText(Object element) {
            return ((DateRangeType) element).getDisplayName();
         }

      });
      dateRangeTypeCombo.setInput(DateRangeType.values());
      dateRangeTypeCombo.addSelectionChangedListener(event -> {
            String text2 = dateRangeTypeCombo.getCombo().getText();
            dateRangeType = DateRangeType.get(text2);
            updateDate2Composite();
      });

      date1Widget = new DateTime(widgetComp, SWT.CALENDAR);
      date1Widget.addListener(SWT.Selection, e-> setDate1Selection());

      // set initial date
      Calendar cal = Calendar.getInstance();
      cal.set(date1Widget.getYear(), date1Widget.getMonth(), date1Widget.getDay(), 0, 0);
      date1 = cal.getTime();

      time1Widget = new DateTime(widgetComp, SWT.TIME);
      time1Widget.addListener(SWT.Selection, e-> setDate1Selection());
      time1Widget.setHours(0);
      time1Widget.setMinutes(0);
      time1Widget.setSeconds(0);

   }
}
 
Example 17
Source File: TmfTimestampFormatPage.java    From tracecompass with Eclipse Public License 2.0 4 votes vote down vote up
@Override
protected Control createContents(Composite parent) {

    // Overall preference page layout
    GridLayout gl = new GridLayout();
    gl.marginHeight = 0;
    gl.marginWidth = 0;
    parent.setLayout(gl);
    fPage = new Composite(parent, SWT.NONE);
    fPage.setLayout(new GridLayout());
    fPage.setLayoutData(new GridData(
            GridData.GRAB_HORIZONTAL | GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_VERTICAL | GridData.VERTICAL_ALIGN_FILL));

    // Example section
    fExampleSection = new Composite(fPage, SWT.NONE);
    fExampleSection.setLayout(new GridLayout(2, false));
    fExampleSection.setLayoutData(new GridData(GridData.FILL_BOTH));

    Label patternLabel = new Label(fExampleSection, SWT.HORIZONTAL);
    patternLabel.setText("Current Format: "); //$NON-NLS-1$
    fPatternDisplay = new Text(fExampleSection, SWT.BORDER | SWT.READ_ONLY);
    fPatternDisplay.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label exampleLabel = new Label(fExampleSection, SWT.NONE);
    exampleLabel.setText("Sample Display: "); //$NON-NLS-1$
    fExampleDisplay = new Text(fExampleSection, SWT.BORDER | SWT.READ_ONLY);
    fExampleDisplay.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    Label separator = new Label(fPage, SWT.SEPARATOR | SWT.HORIZONTAL | SWT.SHADOW_NONE);
    separator.setLayoutData(
            new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL | GridData.VERTICAL_ALIGN_FILL));

    // Time Zones
    String[][] timeZoneIntervals = new String[timeZones.length][2];
    timeZoneIntervals[0][0] = timeZones[0];
    timeZoneIntervals[0][1] = fPreferenceStore.getDefaultString(ITmfTimePreferencesConstants.TIME_ZONE);
    for (int i = 1; i < timeZones.length; i++) {
        TimeZone tz = null;
        try {
            tz = TimeZone.getTimeZone(timeZones[i]);
            timeZoneIntervals[i][0] = tz.getDisplayName();
            timeZoneIntervals[i][1] = tz.getID();
        } catch (NullPointerException e) {
            Activator.getDefault().logError("TimeZone " + timeZones[i] + " does not exist.", e); //$NON-NLS-1$ //$NON-NLS-2$
        }
    }

    fCombo = new ComboFieldEditor(ITmfTimePreferencesConstants.TIME_ZONE, "Time Zone", timeZoneIntervals, fPage); //$NON-NLS-1$
    fCombo.setPreferenceStore(fPreferenceStore);
    fCombo.load();
    fCombo.setPropertyChangeListener(this);

    // Date and Time section
    fDateTimeFields = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.DATIME, "Date and Time format", 3, fDateTimeFormats, fPage, true); //$NON-NLS-1$
    fDateTimeFields.setPreferenceStore(fPreferenceStore);
    fDateTimeFields.load();
    fDateTimeFields.setPropertyChangeListener(this);

    // Sub-second section
    fSSecFields = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.SUBSEC, "Sub-second format", 3, fSubSecondFormats, fPage, true); //$NON-NLS-1$
    fSSecFields.setPreferenceStore(fPreferenceStore);
    fSSecFields.load();
    fSSecFields.setPropertyChangeListener(this);

    // Separators section
    fDateFieldDelim = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.DATE_DELIMITER, "Date delimiter", 5, fDateTimeDelimiters, fPage, true); //$NON-NLS-1$
    fDateFieldDelim.setPreferenceStore(fPreferenceStore);
    fDateFieldDelim.load();
    fDateFieldDelim.setPropertyChangeListener(this);

    fTimeFieldDelim = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.TIME_DELIMITER, "Time delimiter", 5, fDateTimeDelimiters, fPage, true); //$NON-NLS-1$
    fTimeFieldDelim.setPreferenceStore(fPreferenceStore);
    fTimeFieldDelim.load();
    fTimeFieldDelim.setPropertyChangeListener(this);

    fSSecFieldDelim = new RadioGroupFieldEditor(
            ITmfTimePreferencesConstants.SSEC_DELIMITER, "Sub-Second Delimiter", 5, fSubSecondDelimiters, fPage, true); //$NON-NLS-1$
    fSSecFieldDelim.setPreferenceStore(fPreferenceStore);
    fSSecFieldDelim.load();
    fSSecFieldDelim.setPropertyChangeListener(this);

    refresh();
    return fPage;
}
 
Example 18
Source File: DatabaseConnectorOutputWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected Composite createNRowsOneColumOuputControl(final Composite parent,
        final EMFDataBindingContext context) {
    final Composite mainComposite = new Composite(parent, SWT.NONE);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(3).margins(20, 20).create());

    Operation singleModeOuputOperation = getOuputOperationFor(NROW_ONECOL_RESULT_OUTPUT);
    if (singleModeOuputOperation == null) {
        singleModeOuputOperation = createDefaultOutput(NROW_ONECOL_RESULT_OUTPUT, getDefinition());
        getConnector().getOutputs().add(singleModeOuputOperation);
    }
    singleModeOuputOperation.getLeftOperand().setReturnType(Collection.class.getName());
    singleModeOuputOperation.getLeftOperand().setReturnTypeFixed(true);

    final ReadOnlyExpressionViewer targetDataExpressionViewer = new ReadOnlyExpressionViewer(mainComposite, SWT.BORDER,
            null, null, ExpressionPackage.Literals.OPERATION__LEFT_OPERAND);
    targetDataExpressionViewer.getControl()
            .setLayoutData(GridDataFactory.fillDefaults().grab(true, false).hint(250, SWT.DEFAULT).create());

    final IExpressionNatureProvider storageExpressionProvider = getStorageExpressionProvider();
    if (storageExpressionProvider != null) {
        targetDataExpressionViewer.setExpressionNatureProvider(storageExpressionProvider);
    }
    targetDataExpressionViewer.addFilter(leftFilter);
    targetDataExpressionViewer.setContext(getElementContainer());
    targetDataExpressionViewer.setInput(singleModeOuputOperation);

    context.bindValue(ViewersObservables.observeSingleSelection(targetDataExpressionViewer),
            EMFObservables.observeValue(singleModeOuputOperation, ExpressionPackage.Literals.OPERATION__LEFT_OPERAND));

    final Label takeValueOfLabel = new Label(mainComposite, SWT.NONE);
    takeValueOfLabel.setLayoutData(GridDataFactory.swtDefaults().align(SWT.FILL, SWT.CENTER).create());
    takeValueOfLabel.setText(Messages.takeValueOf);

    nRowsOneColumnColumnText = new Text(mainComposite, SWT.BORDER | SWT.READ_ONLY);
    nRowsOneColumnColumnText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());

    final Label hintLabel = new Label(mainComposite, SWT.WRAP);
    hintLabel.setLayoutData(GridDataFactory.swtDefaults().span(3, 1).create());
    hintLabel.setText(Messages.nRowsOneColOutputHint);

    return mainComposite;
}
 
Example 19
Source File: AndroidSimOptionsTab.java    From thym with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * @wbp.parser.entryPoint
 */
@Override
public void createControl(Composite parent) {
	Composite comp = new Composite(parent, SWT.NONE);
	setControl(comp);
	comp.setLayout(new GridLayout(1, false));
	Group grpProject = new Group(comp, SWT.NONE);
	grpProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	grpProject.setText("Project");
	grpProject.setLayout(new GridLayout(3, false));
	
	Label lblProject = new Label(grpProject, SWT.NONE);
	lblProject.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblProject.setText("Project:");
	
	textProject = new Text(grpProject, SWT.BORDER);
	textProject.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	textProject.addListener(SWT.Modify, dirtyListener);
	
	Button btnProjectBrowse = new Button(grpProject, SWT.NONE);
	btnProjectBrowse.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e) {
			ElementListSelectionDialog es = new ElementListSelectionDialog(getShell(), WorkbenchLabelProvider.getDecoratingWorkbenchLabelProvider());
			es.setTitle("Project Selection");
			es.setMessage("Select a project to run");
			es.setElements(HybridCore.getHybridProjects().toArray());
			if (es.open() == Window.OK) {			
				HybridProject project = (HybridProject) es.getFirstResult();
				textProject.setText(project.getProject().getName());
			}		
		}
	});
	btnProjectBrowse.setText("Browse...");
	
	Group grpEmulator = new Group(comp, SWT.NONE);
	grpEmulator.setLayout(new GridLayout(2, false));
	grpEmulator.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	grpEmulator.setText("Emulator");
	
	Label lblVirtualDeviceavd = new Label(grpEmulator, SWT.NONE);
	lblVirtualDeviceavd.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblVirtualDeviceavd.setText("Virtual Device (AVD):");
	
	AVDCombo = new Combo(grpEmulator, SWT.READ_ONLY);
	AVDCombo.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	AVDCombo.add("", 0);
	AVDCombo.addListener(SWT.Selection, dirtyListener);

	
	
	Label lblLogFilter = new Label(grpEmulator, SWT.NONE);
	lblLogFilter.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1));
	lblLogFilter.setText("Log Filter:");
	
	logFilterTxt = new Text(grpEmulator, SWT.BORDER);
	logFilterTxt.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1));
	logFilterTxt.addListener(SWT.Modify, dirtyListener);
	try {
		AndroidSDKManager sdk = AndroidSDKManager.getManager();
		avds = sdk.listAVDs();
		for (AndroidAVD avd : avds) {
			AVDCombo.add(avd.getName());
		}
	} catch (CoreException e1) {
		AVDCombo.removeAll();// let it fallback to default
	}
}
 
Example 20
Source File: SWTUtil.java    From APICloud-Studio with GNU General Public License v3.0 3 votes vote down vote up
/**
 * Creates a new label widget
 * 
 * @param parent
 *            the parent composite to add this label widget to
 * @param text
 *            the text for the label
 * @param hspan
 *            the horizontal span to take up in the parent composite
 * @return the new label
 * @since 3.2
 */
public static Label createLabel(Composite parent, String text, int hspan)
{
	Label l = new Label(parent, SWT.NONE);
	l.setFont(parent.getFont());
	l.setText(text);
	GridData gd = new GridData(GridData.FILL_HORIZONTAL);
	gd.horizontalSpan = hspan;
	l.setLayoutData(gd);
	return l;
}