public class ConfigurationPropertiesSection implements ComponentTypeViewerSection {
private static final Logger LOGGER = LoggerFactory.getLogger(ConfigurationPropertiesSection.class);
-
- private static final String[] COLUMN_NAMES =
- new String[] {"Name", "Type", "Default Value", "Unit", "Range", "Label", "Description"};
+
+ private static final String[] COLUMN_NAMES = {
+ Messages.ConfigurationPropertiesSection_Name,
+ Messages.ConfigurationPropertiesSection_Type,
+ Messages.ConfigurationPropertiesSection_DefaultValue,
+ Messages.ConfigurationPropertiesSection_Unit,
+ Messages.ConfigurationPropertiesSection_Range,
+ Messages.ConfigurationPropertiesSection_Label,
+ Messages.ConfigurationPropertiesSection_Description
+ };
private static final int[] COLUMN_LENGTHS =
new int[] { 120, 100, 100, 50, 100, 100, 100 };
private static final int[] COLUMN_WEIGHTS =
*/
private static final int[] IMMUTABLE_COLUMNS_WITH_IMMUTABLE_RELATION =
{ 0, 1, 3, 4, 5, 6 };
-
ComponentTypeViewerData data;
+
Table table;
TableColumn[] columns;
TableEditor editor;
section = tk.createSection(form.getBody(), Section.TITLE_BAR | Section.EXPANDED);
section.setLayout(new FillLayout());
- section.setText("Configuration properties");
+ section.setText(Messages.ConfigurationPropertiesSection_ConfigurationProperties);
Composite sectionBody = tk.createComposite(section);
GridLayoutFactory.fillDefaults().numColumns(2).applyTo(sectionBody);
break;
case 1:
- data.editType(table, editor, propertyInfo, selectedItem, column, true);
+ data.editType(table, editor, propertyInfo, selectedItem, column, selectedItem.getText(4), true);
break;
case 2: {
GridDataFactory.fillDefaults().applyTo(buttons);
GridLayoutFactory.fillDefaults().applyTo(buttons);
- newProperty = tk.createButton(buttons, "New property", SWT.PUSH);
+ newProperty = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_NewProperty, SWT.PUSH);
GridDataFactory.fillDefaults().applyTo(newProperty);
- removeProperty = tk.createButton(buttons, "Remove property", SWT.PUSH);
+ removeProperty = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_RemoveProperty, SWT.PUSH);
GridDataFactory.fillDefaults().applyTo(removeProperty);
- liftProperties = tk.createButton(buttons, "Lift Properties", SWT.PUSH);
+ liftProperties = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_LiftProperties, SWT.PUSH);
GridDataFactory.fillDefaults().applyTo(liftProperties);
hasTypes = !getTypes().isEmpty();
if(hasTypes) {
- setTypes = tk.createButton(buttons, "Assign Types", SWT.PUSH);
+ setTypes = tk.createButton(buttons, Messages.ConfigurationPropertiesSection_AssignTypes, SWT.PUSH);
GridDataFactory.fillDefaults().applyTo(setTypes);
}
if (!info.immutable)
propertiesToBeRemoved.add(info.resource);
}
- System.out.println("remove " + propertiesToBeRemoved.size() + " resources");
+ //System.out.println("remove " + propertiesToBeRemoved.size() + " resources"); //$NON-NLS-1$ //$NON-NLS-2$
if(!propertiesToBeRemoved.isEmpty())
Simantics.getSession().async(new WriteRequest() {
@Override
String predicateName = NameUtils.getSafeName(graph, predicate);
if(existing.contains(predicateName)) continue;
- String name = componentName + " " + predicateName;
+ String name = componentName + " " + predicateName; //$NON-NLS-1$
map.put(new LiftedProperty(component, type, predicate), new Pair<String, ImageDescriptor>(name, null));
}
});
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- LiftPropertiesDialog dialog = new LiftPropertiesDialog(shell, map, "Select properties to lift") {
+ LiftPropertiesDialog dialog = new LiftPropertiesDialog(shell, map, Messages.ConfigurationPropertiesSection_SelectPropertiesToLift) {
@Override
protected IDialogSettings getBaseDialogSettings() {
return Activator.getDefault().getDialogSettings();
graph.claim(data.componentType, L0.DomainOf, copy);
Layer0Utils.assert_(graph, data.componentType, copy, copyAss.iterator().next());
CommentMetadata cm = graph.getMetadata(CommentMetadata.class);
- graph.addMetadata(cm.add("Lifted property " + NameUtils.getSafeName(graph, copy) + " into "+ NameUtils.getSafeName(graph, data.componentType)));
+ graph.addMetadata(cm.add("Lifted property " + NameUtils.getSafeName(graph, copy) + " into "+ NameUtils.getSafeName(graph, data.componentType))); //$NON-NLS-1$ //$NON-NLS-2$
}
if(mapProperties) {
Variable v = Variables.getVariable(graph, p.getComponent());
Variable property = v.getProperty(graph, p.getPredicate());
Variable displayValue = property.getProperty(graph, Variables.DISPLAY_VALUE);
- displayValue.setValue(graph, "=" + NameUtils.getSafeName(graph, p.getPredicate()), Bindings.STRING);
+ displayValue.setValue(graph, "=" + NameUtils.getSafeName(graph, p.getPredicate()), Bindings.STRING); //$NON-NLS-1$
}
index++;
}
} catch (DatabaseException e1) {
- LOGGER.error("Lifting properties failed", e1);
+ LOGGER.error("Lifting properties failed", e1); //$NON-NLS-1$
return;
}
if(propertiesToSet.size() != 1) return;
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
- SetTypesDialog page = new SetTypesDialog(shell, getTypes(), "Select user types for property");
+ SetTypesDialog page = new SetTypesDialog(shell, getTypes(), Messages.ConfigurationPropertiesSection_SelectUserTypesForProp);
if (page.open() == Window.OK) {
final Object[] result = page.getResult();
if (result != null && result.length > 0) {
item.setText(0, info.name);
item.setText(1, info.type);
item.setText(2, info.defaultValue);
- item.setText(3, unitStr(info));
- item.setText(4, rangeStr(info));
+ item.setText(3, info.unitString());
+ item.setText(4, info.rangeString());
item.setText(5, info.label);
item.setText(6, info.description);
}
});
} catch (DatabaseException e) {
- LOGGER.error("Finding UserDefinedProperties failed.", e);
+ LOGGER.error("Finding UserDefinedProperties failed.", e); //$NON-NLS-1$
return Collections.emptyMap();
}
}
- private String unitStr(ComponentTypeViewerPropertyInfo info) {
- String unit = info.numberType == null ? null : info.numberType.getUnit();
- if (unit == null)
- unit = info.unit;
- return unit != null ? unit : "";
- }
-
- private String rangeStr(ComponentTypeViewerPropertyInfo info) {
- String range = info.numberType == null ? null : info.numberType.getRangeStr();
- return range != null ? range : "";
- }
-
@Override
public void setReadOnly(boolean readOnly) {
boolean e = !readOnly;