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

The following examples show how to use org.eclipse.swt.widgets.Text#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: INSDComponentPage.java    From uima-uimaj with Apache License 2.0 6 votes vote down vote up
/**
 * Adds the text field.
 *
 * @param parent the parent
 * @param strLabel the str label
 * @param strText the str text
 * @param editable the editable
 * @return the text
 */
public Text addTextField(Composite parent, String strLabel, String strText, boolean editable) {
  Label label = new Label(parent, SWT.NULL);
  label.setText(strLabel);

  Text text = new Text(parent, SWT.BORDER | SWT.SINGLE);
  text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  text.setText(strText);
  text.addModifyListener(new ModifyListener() {
    @Override
    public void modifyText(ModifyEvent e) {
      dialogChanged();
    }
  });
  text.setEditable(editable);
  return text;
}
 
Example 2
Source File: TopLevelFolderPropertyPage.java    From gama with GNU General Public License v3.0 6 votes vote down vote up
private void addSecondSection(final Composite parent) {
	final Composite composite = createDefaultComposite(parent);

	// Label for owner field
	final Label ownerLabel = new Label(composite, SWT.NONE);
	ownerLabel.setText("Groups projects of nature");

	// Owner text field
	ownerText = new Text(composite, SWT.SINGLE | SWT.BORDER | SWT.READ_ONLY);
	final GridData gd = new GridData();
	gd.widthHint = convertWidthInCharsToPixels(TEXT_FIELD_WIDTH);
	ownerText.setLayoutData(gd);

	// Populate owner text field
	final String owner = getFolder().getNature();
	ownerText.setText(owner != null ? owner : "user");
}
 
Example 3
Source File: NewProjectFromScratchPage.java    From xds-ide with Eclipse Public License 1.0 6 votes vote down vote up
/**
 * @param src - Text control after text change
 * @param srcTextBefore - text from 'src' before change 
 * @param dest - Text control to edit
 * 
 * When file name (w/o extension) in 'dest' is the same with file name (w/o extension) from
 * 'srcTextBefore', changes this name in 'dest' with the new one from 'src'  
 */
private void autoEdit(Text src, String srcTextBefore, Text dest) {
    if (hsAutoEditRecursionDetector.add(dest)) {
        String oldSrcName = FilenameUtils.getBaseName(srcTextBefore.trim()).trim();
        String destTxt = dest.getText().trim();
        String destName = FilenameUtils.getBaseName(destTxt).trim();
        if (destName.isEmpty() || (destName.equals(oldSrcName) && !destName.contains("$("))) {
            String newSrcName = FilenameUtils.getBaseName(src.getText().trim()).trim();
            String newDstText = FilenameUtils.getPath(destTxt) + newSrcName;
            String ext = FilenameUtils.getExtension(destTxt);
            if (!ext.isEmpty()) {
                newDstText += '.';
                newDstText += ext;
            }
            dest.setText(newDstText);
        }
        hsAutoEditRecursionDetector.remove(dest);
    }
}
 
Example 4
Source File: SendMessageWizard.java    From offspring with MIT License 6 votes vote down vote up
@Override
public Control createControl(Composite parent) {
  textReferenced = new Text(parent, SWT.BORDER);
  textReferenced.setMessage("transaction id or empty");
  if (referencedTransactionId != null)
    textReferenced.setText(Convert.toUnsignedLong(referencedTransactionId));
  else
    textReferenced.setText("");
  textReferenced.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      requestVerification();
    }
  });
  return textReferenced;
}
 
Example 5
Source File: UtilsUI.java    From EasyShell with Eclipse Public License 2.0 6 votes vote down vote up
static public Text createTextField(Composite parent, String labelText, String labelTooltip, String editValue, boolean emptyLabel, boolean editable) {
    // draw label
    if (labelText != null) {
        UtilsUI.createLabel(parent, labelText, labelTooltip);
    }
    if (emptyLabel) {
        UtilsUI.createLabel(parent, "", null);
    }
    // draw textfield
    Text text = new Text(parent,SWT.BORDER);
    text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
    text.setText(editValue);
    text.setEditable(editable);
    text.setToolTipText(labelTooltip);
    return text;
}
 
Example 6
Source File: PipelineArgumentsTabTest.java    From google-cloud-eclipse with Apache License 2.0 6 votes vote down vote up
@Test
public void testValidatePage_doesNotClearErrorSetByChildren() {
  String errorMessage;
  Combo emailKey =
      CompositeUtil.findControlAfterLabel(shellResource.getShell(), Combo.class, "&Account:");
  if (emailKey.getText().isEmpty()) {
    errorMessage = "No Google account selected for this launch.";
  } else {
    Text serviceAccountKey = CompositeUtil.findControlAfterLabel(shellResource.getShell(),
        Text.class, "Service account key:");
    serviceAccountKey.setText("/non/existing/file");
    errorMessage = "/non/existing/file does not exist.";
  }
  assertEquals(errorMessage, pipelineArgumentsTab.getErrorMessage());

  pipelineArgumentsTab.isValid(configuration1);
  assertEquals(errorMessage, pipelineArgumentsTab.getErrorMessage());
}
 
Example 7
Source File: ExtractClassWizard.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 6 votes vote down vote up
private void createClassNameInput(Composite result) {
	Label label= new Label(result, SWT.LEAD);
	label.setText(RefactoringMessages.ExtractClassWizard_label_class_name);
	final Text text= new Text(result, SWT.SINGLE | SWT.BORDER);
	fClassNameDecoration= new ControlDecoration(text, SWT.TOP | SWT.LEAD);
	text.setText(fDescriptor.getClassName());
	text.selectAll();
	text.setFocus();
	text.addModifyListener(new ModifyListener() {

		public void modifyText(ModifyEvent e) {
			fDescriptor.setClassName(text.getText());
			validateRefactoring();
		}

	});
	GridData gridData= new GridData(GridData.FILL_HORIZONTAL);
	gridData.horizontalIndent= FieldDecorationRegistry.getDefault().getMaximumDecorationWidth();
	text.setLayoutData(gridData);
}
 
Example 8
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 9
Source File: MultipleInputDialog.java    From goclipse with Eclipse Public License 1.0 5 votes vote down vote up
protected void createTextField(String labelText, String initialValue, boolean allowEmpty) { 
	Label label = new Label(panel, SWT.NONE);
	label.setText(labelText);
	label.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_BEGINNING));
	
	final Text text = new Text(panel, SWT.SINGLE | SWT.BORDER);
	text.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
	text.setData(FIELD_NAME, labelText);
	
	// make sure rows are the same height on both panels.
	label.setSize(label.getSize().x, text.getSize().y); 
	
	if (initialValue != null) {
		text.setText(initialValue);
	}
	
	if (!allowEmpty) {
		validators.add(new Validator() {
			@Override
			public boolean validate() {
				return !text.getText().equals(IInternalDebugCoreConstants.EMPTY_STRING);
			}
		});
		text.addModifyListener(new ModifyListener() {
			@Override
			public void modifyText(ModifyEvent e) {
				validateFields();
			}
		});
	}
	
	controlList.add(text);
}
 
Example 10
Source File: RenameInputWizardPage.java    From Eclipse-Postfix-Code-Completion with Eclipse Public License 1.0 5 votes vote down vote up
@Override
public void setVisible(boolean visible) {
	if (visible) {
		INameUpdating nameUpdating= (INameUpdating)getRefactoring().getAdapter(INameUpdating.class);
		if (nameUpdating != null) {
			String newName= getNewName(nameUpdating);
			if (newName != null && newName.length() > 0 && !newName.equals(getInitialValue())) {
				Text textField= getTextField();
				textField.setText(newName);
				textField.setSelection(0, newName.length());
			}
		}
	}
	super.setVisible(visible);
}
 
Example 11
Source File: ViewEditor.java    From depan with Apache License 2.0 5 votes vote down vote up
@SuppressWarnings("unused")
private void createDetailsPage() {
  Composite parent = new Composite(getContainer(), SWT.NONE);
  GridLayout layout = new GridLayout();
  layout.numColumns = 3;
  layout.marginTop = 9;
  parent.setLayout(layout);

  Label nameLabel = Widgets.buildCompactLabel(parent, "Description");
  final Text name = Widgets.buildGridBoxedText(parent);

  String descr = Strings.nullToEmpty(viewInfo.getDescription());
  name.setText(descr);

  name.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      if (viewInfo != null) {
        String newDescription = name.getText();
        viewInfo.setDescription(newDescription);
        markDirty();
      }
    }
  });
  int index = addPage(parent);
  setPageText(index, "Properties");
}
 
Example 12
Source File: IssueAssetWizard.java    From offspring with MIT License 5 votes vote down vote up
@Override
public Control createControl(Composite parent) {
  textQuantity = new Text(parent, SWT.BORDER);
  textQuantity.setText("0");
  textQuantity.addModifyListener(new ModifyListener() {

    @Override
    public void modifyText(ModifyEvent e) {
      requestVerification();
    }
  });
  return textQuantity;
}
 
Example 13
Source File: IgnoreResourcesDialog.java    From APICloud-Studio with GNU General Public License v3.0 5 votes vote down vote up
private Text createIndentedText(Composite parent, String text, int indent) {
	Text textbox = new Text(parent, SWT.BORDER);
	textbox.setText(text);
	GridData data = new GridData(GridData.HORIZONTAL_ALIGN_FILL);
	data.horizontalIndent = indent;
	textbox.setLayoutData(data);
	return textbox;
}
 
Example 14
Source File: ResolvablePropertyEditDialog.java    From eclipse-cs with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * {@inheritDoc}
 */
@Override
protected Control createDialogArea(Composite parent) {

  Composite composite = (Composite) super.createDialogArea(parent);
  this.setTitle(Messages.ResolvablePropertyEditDialog_titleMessageArea);
  this.setMessage(Messages.ResolvablePropertyEditDialog_msgEditProperty);

  Composite dialog = new Composite(composite, SWT.NONE);
  dialog.setLayout(new GridLayout(2, false));
  dialog.setLayoutData(new GridData(GridData.FILL_BOTH));

  Label lblName = new Label(dialog, SWT.NULL);
  lblName.setText(Messages.ResolvablePropertyEditDialog_lblName);
  mTxtName = new Text(dialog, SWT.SINGLE | SWT.BORDER);
  mTxtName.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mTxtName.setText(mProperty.getPropertyName() != null ? mProperty.getPropertyName() : ""); //$NON-NLS-1$

  Label lblValue = new Label(dialog, SWT.NULL);
  lblValue.setText(Messages.ResolvablePropertyEditDialog_lblValue);
  mTxtValue = new Text(dialog, SWT.SINGLE | SWT.BORDER);
  mTxtValue.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
  mTxtValue.setText(mProperty.getValue() != null ? mProperty.getValue() : ""); //$NON-NLS-1$

  // integrate content assist
  ContentAssistHandler.createHandlerForText(mTxtValue, createContentAssistant());

  return composite;
}
 
Example 15
Source File: DatabaseConnectorOutputWizardPage.java    From bonita-studio with GNU General Public License v2.0 4 votes vote down vote up
protected Composite createNRowsNColsOuputControl(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(TABLE_RESULT_OUTPUT);
    if (singleModeOuputOperation == null) {
        singleModeOuputOperation = createDefaultOutput(TABLE_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);

    final Text nRowsNColumnsColumnText = new Text(mainComposite, SWT.BORDER | SWT.READ_ONLY);
    nRowsNColumnsColumnText.setLayoutData(GridDataFactory.fillDefaults().grab(true, false).create());
    nRowsNColumnsColumnText.setText(singleModeOuputOperation.getRightOperand().getName());

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

    return mainComposite;
}
 
Example 16
Source File: TransHistoryDelegate.java    From pentaho-kettle with Apache License 2.0 4 votes vote down vote up
private void showLogEntry() {
  TransHistoryLogTab model = models[tabFolder.getSelectionIndex()];

  Text text = model.logDisplayText;

  if ( text == null || text.isDisposed() ) {
    return;
  }

  List<Object[]> list = model.rows;

  if ( list == null || list.size() == 0 ) {
    String message;
    if ( model.logTable.isDefined() ) {
      message = BaseMessages.getString( PKG, "TransHistory.PleaseRefresh.Message" );
    } else {
      message = BaseMessages.getString( PKG, "TransHistory.HistoryConfiguration.Message" );
    }
    text.setText( message );
    return;
  }

  // grab the selected line in the table:
  int nr = model.logDisplayTableView.table.getSelectionIndex();
  if ( nr >= 0 && nr < list.size() ) {
    // OK, grab this one from the buffer...
    Object[] row = list.get( nr );

    // What is the name of the log field?
    //
    LogTableField logField = model.logTable.getLogField();
    if ( logField != null ) {
      int index = model.logTableFields.indexOf( logField );
      if ( index >= 0 ) {
        String logText = row[index].toString();

        text.setText( Const.NVL( logText, "" ) );

        text.setSelection( text.getText().length() );
        text.showSelection();
      } else {
        text.setText( BaseMessages.getString( PKG, "TransHistory.HistoryConfiguration.NoLoggingFieldDefined" ) );
      }
    }
  }
}
 
Example 17
Source File: WidgetFactory.java    From elexis-3-core with Eclipse Public License 1.0 4 votes vote down vote up
/** Simples Eingabefeld mit Vorgabetext pre erzeugen */
public Text createText(String pre){
	Text inp = new Text(parent, SWT.BORDER);
	inp.setText(pre);
	return inp;
}
 
Example 18
Source File: ExtendedPropertyEditorComposite.java    From birt with Eclipse Public License 1.0 4 votes vote down vote up
public void widgetSelected( SelectionEvent e )
{
	if ( e.getSource( ).equals( btnAdd ) )
	{
		String sKey = txtNewKey.getText( );
		if ( sKey.length( ) > 0 && !propMap.containsKey( sKey ) )
		{
			String[] sProperty = new String[2];
			sProperty[0] = sKey;
			sProperty[1] = ""; //$NON-NLS-1$

			TableItem tiProp = new TableItem( table, SWT.NONE );
			tiProp.setText( sProperty );
			table.select( table.getItemCount( ) - 1 );

			updateModel( sProperty[0], sProperty[1] );
			txtNewKey.setText( "" ); //$NON-NLS-1$
		}
	}
	else if ( e.getSource( ).equals( btnRemove ) )
	{
		if ( table.getSelection( ).length != 0 )
		{
			int index = table.getSelectionIndex( );
			String key = table.getSelection( )[0].getText( 0 );
			ExtendedProperty property = propMap.get( key );
			if ( property != null )
			{
				extendedProperties.remove( property );
				propMap.remove( key );
				table.remove( table.getSelectionIndex( ) );
				table.select( index<table.getItemCount( ) ?index:table.getItemCount( )- 1 );
			}
			Control editor = editorValue.getEditor( );
			if ( editor != null )
			{
				editor.dispose( );
			}
		}
	}
	else if ( e.getSource( ).equals( table ) )
	{
		Control oldEditor = editorValue.getEditor( );
		if ( oldEditor != null )
			oldEditor.dispose( );

		// Identify the selected row
		final TableItem item = (TableItem) e.item;
		if ( item == null )
		{
			return;
		}

		// The control that will be the editor must be a child of the Table
		Text newEditor = new Text( table, SWT.NONE );
		newEditor.setText( item.getText( 1 ) );
		newEditor.addListener( SWT.FocusOut, new Listener( ) {

			public void handleEvent( Event event )
			{
				Text text = (Text) event.widget;
				editorValue.getItem( ).setText( 1, text.getText( ) );
				updateModel( item.getText( 0 ), text.getText( ) );
			}
		} );
		newEditor.selectAll( );
		newEditor.setFocus( );
		editorValue.setEditor( newEditor, item, 1 );
	}
	btnRemove.setEnabled( !propDisabledMap.containsKey( table.getSelection( )[0].getText( 0 ) ) );
}
 
Example 19
Source File: PromptSupportSnippet.java    From nebula with Eclipse Public License 2.0 4 votes vote down vote up
private static void createText(final Group group) {
	group.setLayout(new GridLayout(2, false));
	group.setText("Text widget");

	final Label lbl0 = new Label(group, SWT.NONE);
	lbl0.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl0.setText("No prompt :");

	final Text txt0 = new Text(group, SWT.BORDER);
	txt0.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));

	final Label lbl1 = new Label(group, SWT.NONE);
	lbl1.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl1.setText("Simple text prompt :");

	final Text txt1 = new Text(group, SWT.BORDER);
	txt1.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	PromptSupport.setPrompt("Type anything you want", txt1);

	final Label lbl2 = new Label(group, SWT.NONE);
	lbl2.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl2.setText("Other style (bold) :");

	final Text txt2 = new Text(group, SWT.BORDER);
	txt2.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	PromptSupport.setPrompt("Type anything you want in bold", txt2);
	PromptSupport.setFontStyle(SWT.BOLD, txt2);

	final Label lbl3 = new Label(group, SWT.NONE);
	lbl3.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl3.setText("Behaviour highlight :");

	final Text txt3 = new Text(group, SWT.BORDER);
	txt3.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	PromptSupport.setPrompt("Type anything you want", txt3);
	PromptSupport.setFocusBehavior(FocusBehavior.HIGHLIGHT_PROMPT, txt3);

	final Label lbl4 = new Label(group, SWT.NONE);
	lbl4.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl4.setText("Change colors :");

	final Text txt4 = new Text(group, SWT.BORDER);
	txt4.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	PromptSupport.setPrompt("Type anything you want", txt4);
	PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW), txt4);
	PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK), txt4);

	final Label lbl5 = new Label(group, SWT.NONE);
	lbl5.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, false, false));
	lbl5.setText("Change when widget is initialized :");

	final Text txt5 = new Text(group, SWT.BORDER);
	txt5.setLayoutData(new GridData(GridData.FILL, GridData.CENTER, true, false));
	txt5.setText("Remove what is typed...");
	txt5.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_BLACK));
	txt5.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_YELLOW));

	PromptSupport.setPrompt("Type anything you want", txt5);
	PromptSupport.setForeground(txt4.getDisplay().getSystemColor(SWT.COLOR_DARK_BLUE), txt5);
	PromptSupport.setBackground(txt4.getDisplay().getSystemColor(SWT.COLOR_WHITE), txt5);

}
 
Example 20
Source File: MappingDialog.java    From olca-app with Mozilla Public License 2.0 4 votes vote down vote up
@Override
protected void createFormContent(IManagedForm mform) {
	this.mform = mform;
	FormToolkit tk = mform.getToolkit();
	Composite body = mform.getForm().getBody();
	UI.gridLayout(body, 1);
	Composite comp = tk.createComposite(body);
	UI.gridLayout(comp, 1);
	UI.gridData(comp, true, false);

	// source flow
	Fn.with(UI.formLabel(comp, tk, "Source flow"), label -> {
		label.setFont(UI.boldFont());
		UI.gridData(label, true, false);
	});
	RefPanel sourcePanel = new RefPanel(entry.sourceFlow, true);
	sourcePanel.render(comp, tk);
	UI.gridData(tk.createLabel(
			comp, "", SWT.SEPARATOR | SWT.HORIZONTAL), true, false);

	// target flow
	Fn.with(UI.formLabel(comp, tk, "Target flow"), label -> {
		label.setFont(UI.boldFont());
		UI.gridData(label, true, false);
	});
	RefPanel targetPanel = new RefPanel(entry.targetFlow, false);
	targetPanel.render(comp, tk);
	UI.gridData(tk.createLabel(
			comp, "", SWT.SEPARATOR | SWT.HORIZONTAL), true, false);

	// text with conversion factor
	Composite convComp = tk.createComposite(body);
	UI.gridLayout(convComp, 3);
	UI.gridData(convComp, true, false);
	Text convText = UI.formText(convComp, tk, M.ConversionFactor);
	convText.setText(Double.toString(entry.factor));
	convText.addModifyListener(e -> {
		try {
			entry.factor = Double.parseDouble(
					convText.getText());
		} catch (Exception _e) {
		}
	});

	UI.gridData(convText, true, false);
	Label unitLabel = UI.formLabel(convComp, tk, "");
	Runnable updateUnit = () -> {
		String sunit = "?";
		String tunit = "?";
		if (entry.sourceFlow != null
				&& entry.sourceFlow.unit != null
				&& entry.sourceFlow.unit.name != null) {
			sunit = entry.sourceFlow.unit.name;
		}
		if (entry.targetFlow != null
				&& entry.targetFlow.unit != null
				&& entry.targetFlow.unit.name != null) {
			tunit = entry.targetFlow.unit.name;
		}
		unitLabel.setText(sunit + "/" + tunit);
		unitLabel.getParent().pack();
	};
	updateUnit.run();
	sourcePanel.onChange = updateUnit;
	targetPanel.onChange = updateUnit;
}