Java Code Examples for org.eclipse.ui.forms.widgets.FormToolkit#adapt()

The following examples show how to use org.eclipse.ui.forms.widgets.FormToolkit#adapt() . 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: SankeySelectionDialog.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
private void createCutoffSpinner(FormToolkit tk, Composite comp) {
	tk.createLabel(comp, M.DontShowSmallerThen);
	Composite inner = tk.createComposite(comp);
	UI.gridLayout(inner, 2, 10, 0);
	Spinner spinner = new Spinner(inner, SWT.BORDER);
	spinner.setIncrement(100);
	spinner.setMinimum(0);
	spinner.setMaximum(100000);
	spinner.setDigits(3);
	spinner.setSelection((int) (cutoff * 100000));
	spinner.addModifyListener(e -> {
		cutoff = spinner.getSelection() / 100000d;
	});
	tk.adapt(spinner);
	tk.createLabel(inner, "%");
}
 
Example 2
Source File: LocationPage.java    From olca-app with Mozilla Public License 2.0 6 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	ScrolledForm form = UI.formHeader(mform,
			Labels.name(setup.productSystem),
			Images.get(result));
	FormToolkit tk = mform.getToolkit();
	Composite body = UI.formBody(form, tk);
	createCombos(body, tk);
	SashForm sash = new SashForm(body, SWT.VERTICAL);
	UI.gridData(sash, true, true);
	tk.adapt(sash);
	createTree(sash, tk);
	map = ResultMap.on(sash, tk);
	form.reflow(true);
	refreshSelection();
}
 
Example 3
Source File: AbstractFormPage.java    From typescript.java with MIT License 6 votes vote down vote up
protected CCombo createCombo(Composite parent, String label, IJSONPath path, String[] values, String defaultValue) {
	FormToolkit toolkit = getToolkit();
	Composite composite = toolkit.createComposite(parent, SWT.NONE);
	composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	GridLayout layout = new GridLayout(2, false);
	layout.marginWidth = 0;
	layout.marginBottom = 0;
	layout.marginTop = 0;
	layout.marginHeight = 0;
	layout.verticalSpacing = 0;
	composite.setLayout(layout);

	toolkit.createLabel(composite, label);

	CCombo combo = new CCombo(composite, SWT.DROP_DOWN | SWT.READ_ONLY | SWT.BORDER);
	combo.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	combo.setItems(values);
	toolkit.adapt(combo, true, false);

	bind(combo, path, defaultValue);
	return combo;
}
 
Example 4
Source File: LocationPage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createCombos(Composite body, FormToolkit tk) {

		Composite outer = tk.createComposite(body);
		UI.gridLayout(outer, 2, 5, 0);
		Composite comboComp = tk.createComposite(outer);
		UI.gridLayout(comboComp, 2);
		combos = Combo.on(result)
				.onSelected(this::onSelected)
				.withSelection(result.getFlows().iterator().next())
				.create(comboComp, tk);

		Composite cutoffComp = tk.createComposite(outer);
		UI.gridLayout(cutoffComp, 1, 0, 0);
		GridData gd = new GridData(SWT.FILL, SWT.BOTTOM, true, false);
		cutoffComp.setLayoutData(gd);

		Composite checkComp = tk.createComposite(cutoffComp);
		tk.createLabel(checkComp, M.DontShowSmallerThen);
		Spinner spinner = new Spinner(checkComp, SWT.BORDER);
		spinner.setValues(1, 0, 100, 0, 1, 10);
		tk.adapt(spinner);
		tk.createLabel(checkComp, "%");
		Controls.onSelect(spinner, e -> {
			cutoff = (spinner.getSelection()) / 100d;
			refreshSelection();
		});

		UI.gridLayout(checkComp, 5);
		Button zeroCheck = UI.formCheckBox(checkComp, tk, M.ExcludeZeroEntries);
		zeroCheck.setSelection(skipZeros);
		Controls.onSelect(zeroCheck, event -> {
			skipZeros = zeroCheck.getSelection();
			refreshSelection();
		});
	}
 
Example 5
Source File: DefaultEntryCompositeProvider.java    From ice with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public IEntryComposite getEntryComposite(Composite parentComposite, IEntry entry, int swtStyle,
		FormToolkit toolKit) {
	// Set the parent Composite and the SWT style
	parent = parentComposite;
	style = swtStyle;
	
	// Create the correct IEntryComposite using the Visitor pattern
	entry.accept(this);

	// Decorate the IEntryComposite. Use the FormToolKit if possible.
	if (toolKit != null) {
		toolKit.adapt(entryComposite.getComposite());
	} else {
		entryComposite.getComposite().setBackground(parent.getBackground());
	}

	// Set the LayoutData. The DataComponentComposite has a GridLayout. The
	// IEntryComposite should grab all available horizontal space.
	entryComposite.getComposite().setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
	
	// Set the Listener.
	// Create a listener for the Entry composite that will pass events to
	// any other listeners.
	Listener entryListener = new Listener() {
		@Override
		public void handleEvent(Event e) {
			// Let them know
			parent.notifyListeners(SWT.Selection, new Event());
		}
	};

	entryComposite.getComposite().addListener(SWT.Selection, entryListener);

	return entryComposite;
}
 
Example 6
Source File: ReplaceFlowsDialog.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createTop(Composite parent, FormToolkit toolkit) {
	Composite top = UI.formComposite(parent, toolkit);
	UI.gridLayout(top, 2, 20, 5);
	UI.gridData(top, true, false);
	selectionViewer = createFlowViewer(top, toolkit, M.ReplaceFlow, this::updateReplacementCandidates);
	replacementViewer = createFlowViewer(top, toolkit, M.With, selected -> updateButtons());
	replacementViewer.setEnabled(false);
	selectionViewer.setInput(getUsed());
	toolkit.paintBordersFor(top);
	toolkit.adapt(top);
}
 
Example 7
Source File: CamelDependenciesEditor.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
private ManageRouteResourcePanel createResourceTableViewer(Composite parent, FormToolkit toolkit, String title) {
    Section section = toolkit.createSection(parent, Section.TITLE_BAR);
    section.setText(title);

    final ManageRouteResourcePanel c = new ManageRouteResourcePanel(section, isReadOnly(), this, this);

    section.setClient(c);
    toolkit.adapt(c);
    return c;
}
 
Example 8
Source File: CamelDependenciesEditor.java    From tesb-studio-se with Apache License 2.0 5 votes vote down vote up
private CamelDependenciesPanel createTableViewer(Composite parent, FormToolkit toolkit, String title, String type) {
    Section section = toolkit.createSection(parent, Section.TITLE_BAR);
    section.setText(title);
    final CamelDependenciesPanel c = (type == ManifestItem.BUNDLE_CLASSPATH)
        ? new CheckedCamelDependenciesPanel(section, type, isReadOnly(), this, this)
        : new CamelDependenciesPanel(section, type, isReadOnly(), this, this);
    section.setClient(c);
    toolkit.adapt(c);
    return c;
}
 
Example 9
Source File: ServiceInvocationPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * @param parent the parent composite
 * @param widgetFactory factory to use to instanciante widget of the form
 * 
 */
protected Composite createServiceRefFlatComboViewer(Composite parent, FormToolkit widgetFactory) {
	createDescription(parent, EipViewsRepository.ServiceInvocation.Properties.serviceRef, EipMessages.ServiceInvocationPropertiesEditionPart_ServiceRefLabel);
	serviceRef = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(EipViewsRepository.ServiceInvocation.Properties.serviceRef, EipViewsRepository.FORM_KIND));
	widgetFactory.adapt(serviceRef);
	serviceRef.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
	GridData serviceRefData = new GridData(GridData.FILL_HORIZONTAL);
	serviceRef.setLayoutData(serviceRefData);
	serviceRef.addSelectionChangedListener(new ISelectionChangedListener() {

		/**
		 * {@inheritDoc}
		 * 
		 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
		 */
		public void selectionChanged(SelectionChangedEvent event) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ServiceInvocationPropertiesEditionPartForm.this, EipViewsRepository.ServiceInvocation.Properties.serviceRef, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getServiceRef()));
		}

	});
	serviceRef.setID(EipViewsRepository.ServiceInvocation.Properties.serviceRef);
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EipViewsRepository.ServiceInvocation.Properties.serviceRef, EipViewsRepository.FORM_KIND), null); //$NON-NLS-1$
	// Start of user code for createServiceRefFlatComboViewer

	// End of user code
	return parent;
}
 
Example 10
Source File: ChannelPropertiesEditionPartForm.java    From eip-designer with Apache License 2.0 5 votes vote down vote up
/**
 * @param parent the parent composite
 * @param widgetFactory factory to use to instanciante widget of the form
 * 
 */
protected Composite createFromEndpointFlatComboViewer(Composite parent, FormToolkit widgetFactory) {
	createDescription(parent, EipViewsRepository.Channel.Properties.fromEndpoint, EipMessages.ChannelPropertiesEditionPart_FromEndpointLabel);
	fromEndpoint = new EObjectFlatComboViewer(parent, !propertiesEditionComponent.isRequired(EipViewsRepository.Channel.Properties.fromEndpoint, EipViewsRepository.FORM_KIND));
	widgetFactory.adapt(fromEndpoint);
	fromEndpoint.setLabelProvider(new AdapterFactoryLabelProvider(adapterFactory));
	GridData fromEndpointData = new GridData(GridData.FILL_HORIZONTAL);
	fromEndpoint.setLayoutData(fromEndpointData);
	fromEndpoint.addSelectionChangedListener(new ISelectionChangedListener() {

		/**
		 * {@inheritDoc}
		 * 
		 * @see org.eclipse.jface.viewers.ISelectionChangedListener#selectionChanged(org.eclipse.jface.viewers.SelectionChangedEvent)
		 */
		public void selectionChanged(SelectionChangedEvent event) {
			if (propertiesEditionComponent != null)
				propertiesEditionComponent.firePropertiesChanged(new PropertiesEditionEvent(ChannelPropertiesEditionPartForm.this, EipViewsRepository.Channel.Properties.fromEndpoint, PropertiesEditionEvent.COMMIT, PropertiesEditionEvent.SET, null, getFromEndpoint()));
		}

	});
	fromEndpoint.setID(EipViewsRepository.Channel.Properties.fromEndpoint);
	FormUtils.createHelpButton(widgetFactory, parent, propertiesEditionComponent.getHelpContent(EipViewsRepository.Channel.Properties.fromEndpoint, EipViewsRepository.FORM_KIND), null); //$NON-NLS-1$
	// Start of user code for createFromEndpointFlatComboViewer

	// End of user code
	return parent;
}
 
Example 11
Source File: FormHelper.java    From tlaplus with MIT License 5 votes vote down vote up
public static SourceViewer createFormsSourceViewer(FormToolkit toolkit, Composite parent, int flags, SourceViewerConfiguration config)
{
    SourceViewer sourceViewer = createSourceViewer(parent, flags, config);
    sourceViewer.setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TREE_BORDER);

    sourceViewer.getTextWidget().setData(FormToolkit.KEY_DRAW_BORDER, FormToolkit.TEXT_BORDER);
    toolkit.adapt(sourceViewer.getTextWidget(), true, true);

    return sourceViewer;
}
 
Example 12
Source File: ContributionTreePage.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createTree(FormToolkit tk, Composite comp) {
	tree = Trees.createViewer(comp, HEADERS,
			new ContributionLabelProvider());
	tree.setAutoExpandLevel(2);
	tree.getTree().setLinesVisible(false);
	tree.setContentProvider(new ContributionContentProvider());
	tk.adapt(tree.getTree(), false, false);
	tk.paintBordersFor(tree.getTree());
	tree.getTree().getColumns()[2].setAlignment(SWT.RIGHT);
	Trees.bindColumnWidths(tree.getTree(),
			0.20, 0.50, 0.20, 0.10);

	// action bindings
	Action onOpen = Actions.onOpen(() -> {
		UpstreamNode n = Viewers.getFirstSelected(tree);
		if (n == null || n.provider == null)
			return;
		App.openEditor(n.provider.process);
	});

	Action onExport = Actions.create(M.ExportToExcel,
			Images.descriptor(FileType.EXCEL), () -> {
				Object input = tree.getInput();
				if (!(input instanceof UpstreamTree))
					return;
				TreeExportDialog.open((UpstreamTree) input);
			});

	Actions.bind(tree, onOpen, TreeClipboard.onCopy(tree), onExport);
	Trees.onDoubleClick(tree, e -> onOpen.run());
}
 
Example 13
Source File: SqlEditor.java    From olca-app with Mozilla Public License 2.0 5 votes vote down vote up
private void createStatementSection(Composite body, FormToolkit toolkit) {
	Section section = UI.section(body, toolkit, "SQL Statement");
	Composite composite = UI.sectionClient(section, toolkit, 1);
	queryText = new StyledText(composite, SWT.BORDER);
	toolkit.adapt(queryText);
	UI.gridData(queryText, true, false).heightHint = 150;
	queryText.addModifyListener(new SyntaxStyler(queryText));
	Actions.bind(section, runAction = new RunAction());
}
 
Example 14
Source File: DBConnectFirstPage.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl(Composite parent){
	FormToolkit tk = UiDesk.getToolkit();
	Form form = tk.createForm(parent);
	form.setText(Messages.DBConnectFirstPage_connectioNDetails); //$NON-NLS-1$
	Composite body = form.getBody();
	body.setLayout(new TableWrapLayout());
	FormText alt = tk.createFormText(body, false);
	StringBuilder old = new StringBuilder();
	old.append("<form>"); //$NON-NLS-1$
	String driver = "";
	String user = "";
	String typ = "";
	String connectString = "";
	Hashtable<Object, Object> hConn = null;
	String cnt = CoreHub.localCfg.get(Preferences.CFG_FOLDED_CONNECTION, null);
	if (cnt != null) {
		hConn = PersistentObject.fold(StringTool.dePrintable(cnt));
		if (hConn != null) {
			driver =
				PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_DRIVER));
			connectString =
				PersistentObject.checkNull(hConn
					.get(Preferences.CFG_FOLDED_CONNECTION_CONNECTSTRING));
			user =
				PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_USER));
			typ = PersistentObject.checkNull(hConn.get(Preferences.CFG_FOLDED_CONNECTION_TYPE));
		}
	}
	// Check whether we were overridden
	String dbUser = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_USERNAME);
	String dbPw = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_PASSWORD);
	String dbFlavor = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_FLAVOR);
	String dbSpec = System.getProperty(ElexisSystemPropertyConstants.CONN_DB_SPEC);
	if (dbUser != null && dbPw != null && dbFlavor != null && dbSpec != null) {
		old.append("<br/><li><b>Aktuelle Verbindung wurde via Übergabeparameter ans Programm gesetzt!</b></li><br/>"); //$NON-NLS-1$
	}
	if (ch.rgw.tools.StringTool.isNothing(connectString)) {
		old.append("<br/>"); //$NON-NLS-1$
		old.append("Keine konfigurierte Verbindung."); //$NON-NLS-1$
	} else {
		old.append("Konfigurierte Verbindung ist:<br/>"); //$NON-NLS-1$
		old.append("<li><b>Typ:</b>       ").append(typ).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
		old.append("<li><b>Treiber</b>    ").append(driver).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
		old.append("<li><b>Verbinde</b>   ").append(connectString).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
		old.append("<li><b>Username</b>   ").append(user).append("</li>"); //$NON-NLS-1$ //$NON-NLS-2$
	}
	if (PersistentObject.getConnection() != null
		&& PersistentObject.getConnection().getConnectString() != null) {
		old.append("<li><b>Effektiv</b> verwendet wird:").append( //$NON-NLS-1$
			PersistentObject.getConnection().getConnectString()).append("</li>"); //$NON-NLS-1$
	}
	old.append("</form>"); //$NON-NLS-1$
	alt.setText(old.toString(), true, false);
	// Composite form=new Composite(parent, SWT.BORDER);
	Label sep = tk.createSeparator(body, SWT.NONE);
	TableWrapData twd = new TableWrapData();
	twd.heightHint = 5;
	sep.setLayoutData(twd);
	tk.createLabel(body, Messages.DBConnectFirstPage_enterType); //$NON-NLS-1$
	dbTypes = new Combo(body, SWT.BORDER | SWT.SIMPLE);
	dbTypes.setItems(supportedDB);
	dbTypes.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			int it = dbTypes.getSelectionIndex();
			switch (it) {
			case 0:
			case 1:
				server.setEnabled(true);
				dbName.setEnabled(true);
				defaultUser = "elexis"; //$NON-NLS-1$
				defaultPassword = "elexisTest"; //$NON-NLS-1$
				break;
			case 2:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa"; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			default:
				break;
			}
			DBConnectSecondPage sec = (DBConnectSecondPage) getNextPage();
			sec.name.setText(defaultUser);
			sec.pwd.setText(defaultPassword);
			
		}
		
	});
	tk.adapt(dbTypes, true, true);
	tk.createLabel(body, Messages.DBConnectFirstPage_serevrAddress); //$NON-NLS-1$
	server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
	server.setLayoutData(twr);
	tk.createLabel(body, Messages.DBConnectFirstPage_databaseName); //$NON-NLS-1$
	dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
	dbName.setLayoutData(twr2);
	setControl(form);
}
 
Example 15
Source File: CComboWidget.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void adapt(FormToolkit toolkit) {
    super.adapt(toolkit);
    toolkit.adapt(combo.getParent().getParent());
    toolkit.adapt(combo, true, true);
}
 
Example 16
Source File: MenuBar.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
void apply(FormToolkit toolkit) {
	toolkit.adapt(this);
	for (Control comp : getChildren())
		toolkit.adapt(comp, false, false);
}
 
Example 17
Source File: ICEResourcePage.java    From ice with Eclipse Public License 1.0 4 votes vote down vote up
/**
 * This operation overrides the default/abstract implementation of
 * FormPage.createFormContents to create the contents of the
 * ICEResourcePage.
 *
 * @param managedForm
 *            The Form widget on which the ICEResourcePage exists.
 */
@Override
protected void createFormContent(IManagedForm managedForm) {

	// Local Declarations
	final FormToolkit toolkit = managedForm.getToolkit();

	// Try to show the Resource View.
	try {
		getSite().getWorkbenchWindow().getActivePage()
				.showView(ICEResourceView.ID);
	} catch (PartInitException e) {
		logger.error(getClass().getName() + " Exception!", e);
	}

	// Get the parent Composite for the Resource Page widgets and set its
	// layout to the StackLayout.
	pageComposite = managedForm.getForm().getBody();
	pageComposite.setLayout(stackLayout);

	// Register the page with the SelectionService as a listener. Note that
	// this call can be updated to only listen for selections from a
	// particular part.
	getSite().getWorkbenchWindow().getSelectionService()
			.addSelectionListener(this);
	// If the page is disposed, then this should be removed as a selection
	// listener.
	pageComposite.addDisposeListener(new DisposeListener() {
		@Override
		public void widgetDisposed(DisposeEvent event) {
			getSite().getWorkbenchWindow().getSelectionService()
					.removeSelectionListener(ICEResourcePage.this);
		}
	});

	// Create the browser.
	browser = createBrowser(pageComposite, toolkit);
	stackLayout.topControl = browser;

	// Set an error message if no brwoser was detected.
	if (browser == null) {
		Label label = new Label(pageComposite, SWT.CENTER);
		label.setText(
				"No browser detected. You must install or configure a web browser for your operating system, if availabe, to view some resources. Some resources may be openable and appear in text editors in new tabs.");
		stackLayout.topControl = label;
	}

	pageComposite.layout();

	// Create the grid of plots.
	plotGridComposite = new PlotGridComposite(pageComposite, SWT.NONE);
	toolkit.adapt(plotGridComposite);

	// Set the workbench page reference
	workbenchPage = PlatformUI.getWorkbench().getActiveWorkbenchWindow()
			.getActivePage();

	return;
}
 
Example 18
Source File: ComboWidget.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
@Override
public void adapt(FormToolkit toolkit) {
    super.adapt(toolkit);
    toolkit.adapt(combo.getParent());
    toolkit.adapt(combo, true, true);
}
 
Example 19
Source File: DBImportFirstPage.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
public void createControl(Composite parent){
	DBImportWizard wiz = (DBImportWizard) getWizard();
	
	FormToolkit tk = UiDesk.getToolkit();
	Form form = tk.createForm(parent);
	form.setText(Messages.DBImportFirstPage_Connection); //$NON-NLS-1$
	Composite body = form.getBody();
	body.setLayout(new TableWrapLayout());
	tk.createLabel(body, Messages.DBImportFirstPage_EnterType); //$NON-NLS-1$
	dbTypes = new List(body, SWT.BORDER);
	dbTypes.setItems(supportedDB);
	dbTypes.addSelectionListener(new SelectionAdapter() {
		@Override
		public void widgetSelected(SelectionEvent e){
			int it = dbTypes.getSelectionIndex();
			switch (it) {
			case MYSQL:
			case POSTGRESQL:
				server.setEnabled(true);
				dbName.setEnabled(true);
				defaultUser = ""; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			case H2:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa";
				defaultPassword = "";
				break;
			case ODBC:
				server.setEnabled(false);
				dbName.setEnabled(true);
				defaultUser = "sa"; //$NON-NLS-1$
				defaultPassword = ""; //$NON-NLS-1$
				break;
			default:
				break;
			}
			DBImportSecondPage sec = (DBImportSecondPage) getNextPage();
			sec.name.setText(defaultUser);
			sec.pwd.setText(defaultPassword);
			
		}
		
	});
	
	tk.adapt(dbTypes, true, true);
	tk.createLabel(body, Messages.DBImportFirstPage_serverAddress); //$NON-NLS-1$
	server = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	
	TableWrapData twr = new TableWrapData(TableWrapData.FILL_GRAB);
	server.setLayoutData(twr);
	tk.createLabel(body, Messages.DBImportFirstPage_databaseName); //$NON-NLS-1$
	dbName = tk.createText(body, "", SWT.BORDER); //$NON-NLS-1$
	TableWrapData twr2 = new TableWrapData(TableWrapData.FILL_GRAB);
	dbName.setLayoutData(twr2);
	if (wiz.preset != null && wiz.preset.length > 1) {
		int idx = StringTool.getIndex(supportedDB, wiz.preset[0]);
		if (idx < dbTypes.getItemCount()) {
			dbTypes.select(idx);
		}
		server.setText(wiz.preset[1]);
		dbName.setText(wiz.preset[2]);
	}
	setControl(form);
}
 
Example 20
Source File: ContributionCutoff.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
public static ContributionCutoff create(Composite parent, FormToolkit toolkit) {
	ContributionCutoff spinner = new ContributionCutoff(parent, toolkit);
	toolkit.adapt(spinner.spinner);
	return spinner;
}