import org.simantics.structural.stubs.StructuralResource2;
public class DerivedPropertiesSection implements ComponentTypeViewerSection {
- private static final String[] COLUMN_NAMES =
- new String[] {"Name", "Type", "Expression", "Unit", "Label", "Description"};
+ private static final String[] COLUMN_NAMES = {
+ Messages.DerivedPropertiesSection_Name,
+ Messages.DerivedPropertiesSection_Type,
+ Messages.DerivedPropertiesSection_Expression,
+ Messages.DerivedPropertiesSection_Unit,
+ Messages.DerivedPropertiesSection_Label,
+ Messages.DerivedPropertiesSection_Description
+ };
private static final int[] COLUMN_LENGTHS =
new int[] { 120, 100, 100, 70, 100, 100 };
private static final int[] COLUMN_WEIGHTS =
Form form = data.form;
section = tk.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED);
section.setLayout(new FillLayout());
- section.setText("Derived properties");
+ section.setText(Messages.DerivedPropertiesSection_DerivedProperties);
Composite sectionBody = tk.createComposite(section);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(sectionBody);
GridDataFactory.fillDefaults().applyTo(buttons);
GridLayoutFactory.fillDefaults().applyTo(buttons);
- newProperty = tk.createButton(buttons, "New property", SWT.PUSH);
+ newProperty = tk.createButton(buttons, Messages.DerivedPropertiesSection_NewProperty, SWT.PUSH);
GridDataFactory.fillDefaults().applyTo(newProperty);
- removeProperty = tk.createButton(buttons, "Remove property", SWT.PUSH);
+ removeProperty = tk.createButton(buttons, Messages.DerivedPropertiesSection_RemoveProperty, SWT.PUSH);
GridDataFactory.fillDefaults().applyTo(removeProperty);
// Actions
public static String validateMonitorExpression(final RequestProcessor processor, final Resource componentType, final Resource relation, final String expression) {
if (expression.trim().isEmpty()) {
- return "Expression is empty.";
+ return Messages.DerivedPropertiesSection_ExpressionIsEmpty;
}
if (expression.trim().isEmpty()) {
- return "Expression is empty.";
+ return Messages.DerivedPropertiesSection_ExpressionIsEmpty;
}
try {
return processor.sync(new UniqueRead<String>() {
} catch (Exception e) {
String msg = e.getMessage();
- int index = msg.indexOf(":");
+ int index = msg.indexOf(":"); //$NON-NLS-1$
if(index > 0) msg = msg.substring(index);
return msg;
}
TableItem item = new TableItem(table, SWT.NONE);
- item.setText(0, info.valid != null ? info.name + " (!)" : info.name);
+ item.setText(0, info.valid != null ? info.name + " (!)" : info.name); //$NON-NLS-1$
item.setText(1, info.type);
item.setText(2, info.expression);
item.setText(3, info.unitString());