Java Code Examples for org.eclipse.swt.SWT#BORDER

The following examples show how to use org.eclipse.swt.SWT#BORDER . These examples are extracted from open source projects. 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 Project: birt   File: RotatedTextBuilder.java    License: Eclipse Public License 1.0 9 votes vote down vote up
protected void createTextArea( Composite parent )
{
	Label lb = new Label( parent, SWT.None );
	lb.setText( "Text Content:" ); //$NON-NLS-1$

	txtText = new Text( parent, SWT.BORDER );
	GridData gd = new GridData( GridData.FILL_HORIZONTAL );
	txtText.setLayoutData( gd );

	Button btnExp = new Button( parent, SWT.PUSH );
	btnExp.setText( "..." ); //$NON-NLS-1$
	btnExp.setToolTipText( "Invoke Expression Builder" ); //$NON-NLS-1$

	btnExp.addSelectionListener( new SelectionAdapter( ) {

		public void widgetSelected( SelectionEvent event )
		{
			openExpression( txtText );
		}
	} );

}
 
Example 2
/**
 * Creates the default tree and sets it as the control. The default styles
 * will show scrollbars as needed, and allows for multiple selection.
 *
 * @param parent
 *        The parent for the Tree
 * @return the control
 */
@Override
public Control createControl(final Composite parent) {
    parent.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    final Composite mainComposite = new Composite(parent, SWT.BORDER);
    mainComposite.setLayoutData(GridDataFactory.fillDefaults().grab(true, true).create());
    mainComposite.setLayout(GridLayoutFactory.fillDefaults().numColumns(1).margins(5, 10).create());
    mainComposite.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
    final TreeViewer treeViewer = createFilteredTree(mainComposite);

    treeViewer.setLabelProvider(adapterFactoryLabelProvider);
    treeViewer.setContentProvider(adapterFactoryContentProvider);

    addFilters(treeViewer);
    treeViewer.addSelectionChangedListener(
            new TabbedPropertySynchronizerListener(editPartResolver, new TabbedPropertySelectionProviderRegistry(),
                    PlatformUI.getWorkbench()
                            .getActiveWorkbenchWindow().getActivePage()));
    setControl(mainComposite);
    return mainComposite;
}
 
Example 3
protected Control createDialogArea(Composite parent) {
	Composite composite = (Composite) super.createDialogArea(parent);

	Label lbName = new Label(composite, SWT.NONE);
	lbName.setText("Name :");

	txName = new Text(composite, SWT.BORDER);

	Label lbFirstname = new Label(composite, SWT.NONE);
	lbFirstname.setText("Firstname :");

	txFirstname = new Text(composite, SWT.BORDER);

	GridLayoutFactory.fillDefaults().generateLayout(composite);

	// binding
	Binding b = dbc.bindValue(SWTObservables.observeText(txFirstname, SWT.FocusOut), PojoObservables.observeValue(hero, "firstname"), null, null);
	b = dbc.bindValue(SWTObservables.observeText(txName, SWT.FocusOut), PojoObservables.observeValue(hero, "name"), null, null);
	return composite;
}
 
Example 4
Source Project: ermasterr   File: TestDataDialog.java    License: Apache License 2.0 6 votes vote down vote up
private void createAllTableList(final Composite composite) {
    final Group group = new Group(composite, SWT.NONE);

    final GridData gridData = new GridData();
    gridData.verticalSpan = 2;
    gridData.horizontalAlignment = GridData.BEGINNING;
    gridData.grabExcessVerticalSpace = true;
    gridData.verticalAlignment = GridData.FILL;
    group.setLayoutData(gridData);

    final GridLayout groupLayout = new GridLayout();
    group.setLayout(groupLayout);
    group.setText(ResourceString.getResourceString("label.all.table"));

    final GridData comboGridData = new GridData();
    comboGridData.widthHint = 300;
    comboGridData.grabExcessVerticalSpace = true;
    comboGridData.verticalAlignment = GridData.FILL;

    allTableListWidget = new org.eclipse.swt.widgets.List(group, SWT.BORDER | SWT.V_SCROLL | SWT.MULTI);
    allTableListWidget.setLayoutData(comboGridData);
}
 
Example 5
private void createBuildingInfoFields(final Composite detailsInfoComposite, final EReference reference) {
    final Label buildingLabel = new Label(detailsInfoComposite, SWT.NONE);
    buildingLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create());
    buildingLabel.setText(Messages.buildingLabel);

    final Composite buildingInfo = new Composite(detailsInfoComposite, SWT.NONE);
    buildingInfo.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    buildingInfo.setLayout(
            GridLayoutFactory.fillDefaults().numColumns(3).margins(0, 0).spacing(2, 0).equalWidth(false).create());

    final Text buildingText = new Text(buildingInfo, SWT.BORDER);
    buildingText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    buildingText.setMessage(Messages.buildingHint);
    bindTextToUserAttribute(buildingText, reference, OrganizationPackage.Literals.CONTACT_DATA__BUILDING,
            updateValueStrategy()
                    .withValidator(maxLengthValidator(Messages.buildingLabel, SHORT_FIELD_MAX_LENGTH)).create());

    createPersonalRoomField(buildingInfo, reference);
}
 
Example 6
/**
 * @param topLevel
 */
protected void createNameSelect(Composite topLevel, boolean setFocus) {
    createNameLabel(topLevel);
    textName = new Text(topLevel, SWT.BORDER);
    textName.addKeyListener(this);
    setLayout(null, textName, null);
    if (initialTextName != null) {
        textName.setText(initialTextName);
    }
    if (setFocus) {
        setFocusOn(textName, "name");
        textName.setSelection(textName.getText().length());
    }

    //just create an empty to complete the line (that needs 3 items in the layout)
    Label label = new Label(topLevel, SWT.NONE);
    label.setText("");
}
 
Example 7
Source Project: arx   File: ViewCostBenefitModel.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Creates an input field
 * @param caption
 * @param callback
 * @return
 */
private Text createInputField(String caption, final Callback<Double> callback) {

    // Label
    Label label = new Label(root, SWT.NONE);
    label.setText(caption); 
    
    // Text field
    final Text text = new Text(root, SWT.BORDER | SWT.SINGLE);
    text.setText("0"); //$NON-NLS-1$
    text.setToolTipText("0"); //$NON-NLS-1$
    text.setLayoutData(SWTUtil.createFillHorizontallyGridData());
    text.setEditable(false);
    
    // Button
    Button btn1 = new Button(root, SWT.FLAT);
    btn1.setText(Resources.getMessage("ViewCostBenefitModel.0")); //$NON-NLS-1$
    btn1.addSelectionListener(new SelectionAdapter() {
        @Override
        public void widgetSelected(SelectionEvent arg0) {
            String value = controller.actionShowInputDialog(root.getShell(), 
                                                            Resources.getMessage("ViewCostBenefitModel.5"),  //$NON-NLS-1$
                                                            Resources.getMessage("ViewCostBenefitModel.6"),  //$NON-NLS-1$
                                                            text.getToolTipText(), 
                                                            validator);
            if (value != null) {
                callback.call(Double.valueOf(value));
                update();
            }
        }
    });
    
    // Return
    return text;
}
 
Example 8
/**
 * Creates the text field showing the commit message.
 * 
 * @param parent the parent composite of the text field
 * @return the text field
 */
private static Text createCommitMessageText(final Composite parent) {
	final Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(new GridLayout(2, false));
	GridDataFactory.fillDefaults().span(2, 1).applyTo(composite);
	new Label(composite, SWT.NONE).setText("Commit Message: ");
	final Text text = new Text(composite, SWT.BORDER);
	text.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
	text.setEditable(false);
	return text;
}
 
Example 9
public MoneyInput(final Composite parent, final String label){
	super(parent, SWT.NONE);
	setLayout(new GridLayout());
	new Label(this, SWT.NONE).setText(label);
	text = new Text(this, SWT.BORDER);
	prepare();
	text.setLayoutData(SWTHelper.getFillGridData(1, true, 1, false));
}
 
Example 10
Source Project: cppcheclipse   File: CheckedTreeEditor.java    License: Apache License 2.0 5 votes vote down vote up
/**
 * Returns this field editor's list control.
 * 
 * @param parent
 *            the parent control
 * @return the list control
 */
public Tree createListControl(Composite parent) {
	Tree table = (Tree) getTreeControl();
	if (table == null) {
		listParent = parent;
		treeViewer = new ContainerCheckedTreeViewer(parent, SWT.BORDER | SWT.MULTI
				| SWT.V_SCROLL | SWT.H_SCROLL | SWT.FULL_SELECTION);
		table = treeViewer.getTree();
		table.setFont(parent.getFont());
		treeViewer.addCheckStateListener(this);
	} else {
		checkParent(table, parent);
	}
	return table;
}
 
Example 11
Source Project: depan   File: NewRelationSetPage.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public Composite createOptionsControl(Composite container) {
  Group result = new Group(container, SWT.NONE);
  result.setText("Relation Set Options");

  GridLayout grid = new GridLayout();
  grid.numColumns = 2;
  grid.verticalSpacing = 9;
  result.setLayout(grid);

  GridData fillHorz = new GridData(SWT.FILL, SWT.BEGINNING, true, false);

  // Row 1) Container selection
  Label label = new Label(result, SWT.NULL);
  label.setText("&Name:");

  setName = new Text(result, SWT.BORDER | SWT.SINGLE);
  setName.setLayoutData(fillHorz);
  setName.setText(guessSetName());
  setName.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      updatePageStatus();
    }
  });

  return result;
}
 
Example 12
private void createEmailField(final Composite detailsInfoComposite, final EReference reference) {
    final Label emailLabel = new Label(detailsInfoComposite, SWT.NONE);
    emailLabel.setLayoutData(GridDataFactory.fillDefaults().align(SWT.END, SWT.CENTER).create());
    emailLabel.setText(Messages.emailLabel);

    final Text emailText = new Text(detailsInfoComposite, SWT.BORDER);
    emailText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    emailText.setMessage(Messages.emailHint);

    bindTextToUserAttribute(emailText, reference, OrganizationPackage.Literals.CONTACT_DATA__EMAIL,
            updateValueStrategy()
                    .withValidator(maxLengthValidator(Messages.countryLabel, LONG_FIELD_MAX_LENGTH)).create());

}
 
Example 13
/**
 * Creates the project name specification controls.
 *
 * @param parent the parent composite
 */
private final void createProjectNameGroup(Composite parent) {
    Font font = parent.getFont();
    // project specification group
    Composite projectGroup = new Composite(parent, SWT.NONE);
    GridLayout layout = new GridLayout();
    layout.numColumns = 2;
    projectGroup.setLayout(layout);
    projectGroup.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));

    // new project label
    Label projectLabel = new Label(projectGroup, SWT.NONE);
    projectLabel.setFont(font);

    projectLabel.setText("&Project name:");

    // new project name entry field
    projectNameField = new Text(projectGroup, SWT.BORDER);
    GridData data = new GridData(GridData.FILL_HORIZONTAL);
    data.widthHint = SIZING_TEXT_FIELD_WIDTH;
    projectNameField.setLayoutData(data);
    projectNameField.setFont(font);

    // Set the initial value first before listener
    // to avoid handling an event during the creation.
    if (initialProjectFieldValue != null) {
        projectNameField.setText(initialProjectFieldValue);
    }
    projectNameField.addListener(SWT.Modify, nameModifyListener);
}
 
Example 14
Source Project: offspring   File: PlaceAskOrderWizard.java    License: MIT License 4 votes vote down vote up
@Override
public Control createReadonlyControl(Composite parent) {
  textQuantityReadonly = new Text(parent, SWT.BORDER);
  textQuantityReadonly.setEditable(false);
  return textQuantityReadonly;
}
 
Example 15
/**
 * createUserAgentTable
 * 
 * @param parent
 */
protected void createUserAgentTable(Composite parent)
{
	Label label = new Label(parent, SWT.WRAP);
	label.setText(Messages.UserAgentPreferencePage_Select_User_Agents);
	label.setLayoutData(GridDataFactory.fillDefaults().span(2, 0).grab(true, true).create());

	Composite composite = new Composite(parent, SWT.NONE);
	composite.setLayout(GridLayoutFactory.fillDefaults().create());
	composite.setLayoutData(GridDataFactory.fillDefaults().span(2, 0).hint(400, 120).grab(true, true).create());

	Table table = new Table(composite, SWT.CHECK | SWT.BORDER | SWT.SINGLE);
	table.setFont(parent.getFont());

	categoryViewer = new CheckboxTableViewer(table);
	categoryViewer.getControl().setFont(parent.getFont());
	categoryViewer.getControl().setLayoutData(new GridData(GridData.FILL_BOTH));
	categoryViewer.setContentProvider(ArrayContentProvider.getInstance());

	CategoryLabelProvider categoryLabelProvider = new CategoryLabelProvider(true);
	categoryViewer.setLabelProvider(categoryLabelProvider);
	categoryViewer.setComparator(new ViewerComparator()
	{
		@Override
		public int compare(Viewer viewer, Object e1, Object e2)
		{
			if (e1 instanceof IUserAgent && e2 instanceof IUserAgent)
			{
				IUserAgent ua1 = (IUserAgent) e1;
				IUserAgent ua2 = (IUserAgent) e2;

				String uaName1 = StringUtil.getStringValue(ua1.getName());
				String uaName2 = StringUtil.getStringValue(ua2.getName());

				return uaName1.compareToIgnoreCase(uaName2);
			}

			return super.compare(viewer, e1, e2);
		}
	});

	categoryViewer.setInput(UserAgentManager.getInstance().getAllUserAgents());
}
 
Example 16
protected void createGWTJUnitSettingsComponent(Composite parent) {
  Group group = SWTFactory.createGroup(parent, "GWT JUnit Settings", 2, 1,
      GridData.FILL_HORIZONTAL);

  SWTFactory.createLabel(group, "Log level:", 1);
  logLevelComboViewer = new ComboViewer(group, SWT.READ_ONLY);
  logLevelComboViewer.setContentProvider(new ArrayContentProvider());
  logLevelComboViewer.setLabelProvider(new DefaultComboLabelProvider());
  logLevelComboViewer.setInput(LogLevelArgumentProcessor.LOG_LEVELS);
  // logLevelComboViewer.setSelection(new StructuredSelection("DEBUG"));
  logLevelComboViewer.addSelectionChangedListener(settingChangedListener);

  SWTFactory.createLabel(group, "Output style:", 1);
  outputStyleComboViewer = new ComboViewer(group, SWT.READ_ONLY);
  outputStyleComboViewer.setContentProvider(new ArrayContentProvider());
  outputStyleComboViewer.setLabelProvider(new DefaultComboLabelProvider());
  outputStyleComboViewer.setInput(GWTLaunchConstants.OUTPUT_STYLES);
  // outputStyleComboViewer.setSelection(new StructuredSelection("PRETTY"));
  outputStyleComboViewer.addSelectionChangedListener(settingChangedListener);

  notHeadlessButton = SWTFactory.createCheckButton(group,
      "Display the log window and browser windows (useful for debugging)",
      null, true, 2);
  notHeadlessButton.addSelectionListener(settingChangedListener);

  webModeButton = SWTFactory.createCheckButton(group,
      "Run tests in production mode", null, false, 2);
  webModeButton.addSelectionListener(settingChangedListener);

  standardsModeButton = SWTFactory.createCheckButton(group,
      "Use standards mode", null, false, 2);
  standardsModeButton.addSelectionListener(settingChangedListener);
  GridData standardsModeButtonData = new GridData(SWT.BEGINNING,
      SWT.BEGINNING, false, false, 2, 1);
  standardsModeButton.setLayoutData(standardsModeButtonData);

  SWTFactory.createLabel(group, "Output directory:", 1);
  outputDirectoryField = new Text(group, SWT.BORDER);
  outputDirectoryField.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  outputDirectoryField.addModifyListener(settingChangedListener);
}
 
Example 17
Source Project: hop   File: WorkflowExecutorDialog.java    License: Apache License 2.0 4 votes vote down vote up
private void addResultRowsTab() {

    final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
    wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRows.Title" ) );
    wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRows.Tooltip" ) );

    ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
    scrolledComposite.setLayout( new FillLayout() );

    Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
    props.setLook( wInputComposite );

    FormLayout tabLayout = new FormLayout();
    tabLayout.marginWidth = 15;
    tabLayout.marginHeight = 15;
    wInputComposite.setLayout( tabLayout );

    wlResultRowsTarget = new Label( wInputComposite, SWT.RIGHT );
    props.setLook( wlResultRowsTarget );
    wlResultRowsTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultRowsTarget.Label" ) );
    FormData fdlResultRowsTarget = new FormData();
    fdlResultRowsTarget.top = new FormAttachment( 0, 0 );
    fdlResultRowsTarget.left = new FormAttachment( 0, 0 ); // First one in the left
    wlResultRowsTarget.setLayoutData( fdlResultRowsTarget );

    wResultRowsTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
    props.setLook( wResultRowsTarget );
    wResultRowsTarget.addModifyListener( lsMod );
    FormData fdResultRowsTarget = new FormData();
    fdResultRowsTarget.width = 250;
    fdResultRowsTarget.top = new FormAttachment( wlResultRowsTarget, 5 );
    fdResultRowsTarget.left = new FormAttachment( 0, 0 ); // To the right
    wResultRowsTarget.setLayoutData( fdResultRowsTarget );

    wlResultFields = new Label( wInputComposite, SWT.NONE );
    wlResultFields.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFields.Label" ) );
    props.setLook( wlResultFields );
    FormData fdlResultFields = new FormData();
    fdlResultFields.left = new FormAttachment( 0, 0 );
    fdlResultFields.top = new FormAttachment( wResultRowsTarget, 10 );
    wlResultFields.setLayoutData( fdlResultFields );

    int nrRows = ( workflowExecutorMeta.getResultRowsField() != null ? workflowExecutorMeta.getResultRowsField().length : 1 );

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

    wResultRowsFields =
      new TableView( pipelineMeta, wInputComposite, SWT.BORDER | SWT.FULL_SELECTION | SWT.MULTI | SWT.V_SCROLL
        | SWT.H_SCROLL, ciResultFields, nrRows, false, lsMod, props, false );

    FormData fdResultFields = new FormData();
    fdResultFields.left = new FormAttachment( 0, 0 );
    fdResultFields.top = new FormAttachment( wlResultFields, 5 );
    fdResultFields.right = new FormAttachment( 100, 0 );
    fdResultFields.bottom = new FormAttachment( 100, 0 );
    wResultRowsFields.setLayoutData( fdResultFields );
    wResultRowsFields.getTable().addListener( SWT.Resize, new ColumnsResizer( 0, 25, 25, 25, 25 ) );

    wInputComposite.pack();
    Rectangle bounds = wInputComposite.getBounds();

    scrolledComposite.setContent( wInputComposite );
    scrolledComposite.setExpandHorizontal( true );
    scrolledComposite.setExpandVertical( true );
    scrolledComposite.setMinWidth( bounds.width );
    scrolledComposite.setMinHeight( bounds.height );

    wTab.setControl( scrolledComposite );
    wTabFolder.setSelection( wTab );
  }
 
Example 18
Source Project: nebula   File: FloatingText.java    License: Eclipse Public License 2.0 4 votes vote down vote up
/**
 * Constructs a new instance of this class given its parent and a style value
 * describing its behavior and appearance.
 * <p>
 * The style value is either one of the style constants defined in class
 * <code>SWT</code> which is applicable to instances of this class, or must be
 * built by <em>bitwise OR</em>'ing together (that is, using the
 * <code>int</code> "|" operator) two or more of those <code>SWT</code> style
 * constants. The class description lists the style constants that are
 * applicable to the class. Style bits are NOT inherited from superclasses.
 * </p>
 *
 * @param parent a composite control which will be the parent of the new
 *               instance (cannot be null)
 * @param style  the style of control to construct
 *
 * @exception IllegalArgumentException
 *                                     <ul>
 *                                     <li>ERROR_NULL_ARGUMENT - if the parent
 *                                     is null</li>
 *                                     </ul>
 * @exception SWTException
 *                                     <ul>
 *                                     <li>ERROR_THREAD_INVALID_ACCESS - if not
 *                                     called from the thread that created the
 *                                     parent</li>
 *                                     <li>ERROR_INVALID_SUBCLASS - if this
 *                                     class is not an allowed subclass</li>
 *                                     </ul>
 *
 * @see SWT#SEPARATOR
 * @see SWT#SINGLE
 * @see SWT#MULTI
 * @see SWT#READ_ONLY
 * @see SWT#WRAP
 * @see SWT#LEFT
 * @see SWT#RIGHT
 * @see SWT#CENTER
 * @see SWT#PASSWORD
 * @see SWT#SEARCH
 * @see SWT#BORDER
 * @see SWT#H_SCROLL
 * @see SWT#V_SCROLL
 * @see SWT#LEFT_TO_RIGHT
 * @see SWT#RIGHT_TO_LEFT
 * @see SWT#FLIP_TEXT_DIRECTION
 * @see Widget#checkSubclass
 * @see Widget#getStyle
 */
public FloatingText(final Composite pParent, final int pStyle) {
	super(pParent, SWT.DOUBLE_BUFFERED | (pStyle & SWT.BORDER));
	fStyle = pStyle;
	setLayout(createLayout(pStyle));
	fLabel = createLabel(pStyle);
	fText = new Text(this, removeStyles(pStyle, SWT.BORDER, SWT.SEPARATOR));
	fText.setLayoutData(getTextLayoutData());
	fLabel.setBackground(fText.getBackground());
	fLabel.setForeground(fText.getForeground());
	fLabel.setLayoutData(getLabelLayoutData());
	fText.addListener(SWT.FocusIn, e -> setLabelText(true));
	fText.addListener(SWT.FocusOut, e -> setLabelText(false));
	fText.addListener(SWT.Modify, e -> {
		if (!fText.getText().isEmpty() && fLabel.getText().isEmpty()) {
			fLabel.setText(fText.getMessage());
		}
		if (fText.getText().isEmpty() && !fLabel.getText().isEmpty() && !(getDisplay().getFocusControl() == fText)) {
			fLabel.setText("");
		}
	});
}
 
Example 19
public void createControl(Composite parent) {
	context = new DataBindingContext();
	Composite mainComposite = new Composite(parent, SWT.NONE);
	GridLayout gl = new GridLayout(1, false);
	mainComposite.setLayout(gl);
	
	new Label(mainComposite, SWT.NONE).setText(Messages.chooseTargetStepOrProcess);
	
	
	modelTree = new FilteredTree(mainComposite, SWT.BORDER | SWT.SINGLE, new PatternFilter(), true);
	modelTree.getViewer().setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
	modelTree.getViewer().setContentProvider(new AdapterFactoryContentProvider(adapterFactory));
	DataAwareElementViewerFilter filter = new DataAwareElementViewerFilter(sourceContainer) ;
	modelTree.getViewer().setFilters(new ViewerFilter[]{filter,modelTree.getViewer().getFilters()[0]});
	modelTree.getViewer().setInput(sourceProcess);
	modelTree.getViewer().expandAll() ;

	UpdateValueStrategy selectionStrategy = new UpdateValueStrategy();
	selectionStrategy.setAfterGetValidator(new IValidator() {
		
		@Override
		public IStatus validate(Object value) {
		
			
			if(value==null){
				return ValidationStatus.error(Messages.dataMoveErrorTargetSelected);
			}
			if(!(value instanceof DataAware)){
				return ValidationStatus.error(Messages.datamoveErrorWrongTarget);
			}
			if(value.equals(sourceContainer)){
				return ValidationStatus.error(Messages.dataMoveErrorTargetCantBeSource);
			}
			return ValidationStatus.ok();
		}
	});
	context.bindValue(ViewersObservables.observeSingleSelection(modelTree.getViewer()), PojoProperties.value(MoveDataWizardPage.class, "selectedDataAwareElement").observe(this),selectionStrategy,null);
	
	WizardPageSupport.create(this, context);
	setControl(mainComposite);
}
 
Example 20
Source Project: hop   File: WorkflowExecutorDialog.java    License: Apache License 2.0 4 votes vote down vote up
private void addResultFilesTab() {
  final CTabItem wTab = new CTabItem( wTabFolder, SWT.NONE );
  wTab.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Title" ) );
  wTab.setToolTipText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFiles.Tooltip" ) );

  ScrolledComposite scrolledComposite = new ScrolledComposite( wTabFolder, SWT.V_SCROLL | SWT.H_SCROLL );
  scrolledComposite.setLayout( new FillLayout() );

  Composite wInputComposite = new Composite( scrolledComposite, SWT.NONE );
  props.setLook( wInputComposite );

  FormLayout tabLayout = new FormLayout();
  tabLayout.marginWidth = 15;
  tabLayout.marginHeight = 15;
  wInputComposite.setLayout( tabLayout );

  wlResultFilesTarget = new Label( wInputComposite, SWT.RIGHT );
  props.setLook( wlResultFilesTarget );
  wlResultFilesTarget.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFilesTarget.Label" ) );
  FormData fdlResultFilesTarget = new FormData();
  fdlResultFilesTarget.top = new FormAttachment( 0, 0 );
  fdlResultFilesTarget.left = new FormAttachment( 0, 0 ); // First one in the left
  wlResultFilesTarget.setLayoutData( fdlResultFilesTarget );

  wResultFilesTarget = new CCombo( wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wResultFilesTarget );
  wResultFilesTarget.addModifyListener( lsMod );
  FormData fdResultFilesTarget = new FormData();
  fdResultFilesTarget.width = 250;
  fdResultFilesTarget.top = new FormAttachment( wlResultFilesTarget, 5 );
  fdResultFilesTarget.left = new FormAttachment( 0, 0 ); // To the right
  wResultFilesTarget.setLayoutData( fdResultFilesTarget );

  // ResultFileNameField
  //
  wlResultFileNameField = new Label( wInputComposite, SWT.RIGHT );
  props.setLook( wlResultFileNameField );
  wlResultFileNameField.setText( BaseMessages.getString( PKG, "JobExecutorDialog.ResultFileNameField.Label" ) );
  FormData fdlResultFileNameField = new FormData();
  fdlResultFileNameField.top = new FormAttachment( wResultFilesTarget, 10 );
  fdlResultFileNameField.left = new FormAttachment( 0, 0 ); // First one in the left
  wlResultFileNameField.setLayoutData( fdlResultFileNameField );

  wResultFileNameField = new TextVar( pipelineMeta, wInputComposite, SWT.SINGLE | SWT.LEFT | SWT.BORDER );
  props.setLook( wResultFileNameField );
  wResultFileNameField.addModifyListener( lsMod );
  FormData fdResultFileNameField = new FormData();
  fdResultFileNameField.width = 250;
  fdResultFileNameField.top = new FormAttachment( wlResultFileNameField, 5 );
  fdResultFileNameField.left = new FormAttachment( 0, 0 ); // To the right
  wResultFileNameField.setLayoutData( fdResultFileNameField );

  wInputComposite.pack();
  Rectangle bounds = wInputComposite.getBounds();

  scrolledComposite.setContent( wInputComposite );
  scrolledComposite.setExpandHorizontal( true );
  scrolledComposite.setExpandVertical( true );
  scrolledComposite.setMinWidth( bounds.width );
  scrolledComposite.setMinHeight( bounds.height );

  wTab.setControl( scrolledComposite );
  wTabFolder.setSelection( wTab );
}