X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=blobdiff_plain;f=bundles%2Forg.simantics.modeling.ui%2Fsrc%2Forg%2Fsimantics%2Fmodeling%2Fui%2FcomponentTypeEditor%2FConfigurationPropertiesSection.java;h=c11463f1321848cdbd9c69c28da204209ad3700d;hb=7da27cffbf636345be6a8227c1122389b2512314;hp=e919aa71f00d01a8fa27b926a022aef077609e38;hpb=72d52b5910e1ed0141b6768ef700e7321ac05553;p=simantics%2Fplatform.git diff --git a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java index e919aa71f..c11463f13 100644 --- a/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java +++ b/bundles/org.simantics.modeling.ui/src/org/simantics/modeling/ui/componentTypeEditor/ConfigurationPropertiesSection.java @@ -68,9 +68,16 @@ import org.slf4j.LoggerFactory; 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 = @@ -83,8 +90,8 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio */ private static final int[] IMMUTABLE_COLUMNS_WITH_IMMUTABLE_RELATION = { 0, 1, 3, 4, 5, 6 }; - ComponentTypeViewerData data; + Table table; TableColumn[] columns; TableEditor editor; @@ -104,7 +111,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio 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); @@ -176,7 +183,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio 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: { @@ -228,18 +235,18 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio 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); } @@ -287,7 +294,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio 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 @@ -355,7 +362,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio 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(name, null)); } @@ -370,7 +377,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio }); 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(); @@ -429,13 +436,13 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio 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++; } @@ -447,7 +454,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio } catch (DatabaseException e1) { - LOGGER.error("Lifting properties failed", e1); + LOGGER.error("Lifting properties failed", e1); //$NON-NLS-1$ return; } @@ -470,7 +477,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio 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) { @@ -569,7 +576,7 @@ public class ConfigurationPropertiesSection implements ComponentTypeViewerSectio } }); } catch (DatabaseException e) { - LOGGER.error("Finding UserDefinedProperties failed.", e); + LOGGER.error("Finding UserDefinedProperties failed.", e); //$NON-NLS-1$ return Collections.emptyMap(); } }