use of com.archimatetool.model.IProperty in project archi by archimatetool.
the class CommonTests method testProperties.
public static void testProperties(IProperties properties) {
testList(properties.getProperties(), IArchimatePackage.eINSTANCE.getProperty());
String key = "some_key", value = "some_value";
IProperty property = IArchimateFactory.eINSTANCE.createProperty();
property.setKey(key);
property.setValue(value);
properties.getProperties().add(property);
// Check entry is correct
EList<IProperty> entries = properties.getProperties();
assertEquals(1, entries.size());
IProperty testProperty = entries.get(0);
assertEquals(property, testProperty);
assertEquals(testProperty.getKey(), key);
assertEquals(testProperty.getValue(), value);
}
use of com.archimatetool.model.IProperty in project archi by archimatetool.
the class PropertiesModelDataSourceTests method runOnceBeforeEachTest.
@Before
public void runOnceBeforeEachTest() {
model = IArchimateFactory.eINSTANCE.createArchimateModel();
IProperty property = IArchimateFactory.eINSTANCE.createProperty();
property.setKey("key1");
property.setValue("value1");
model.getProperties().add(property);
property = IArchimateFactory.eINSTANCE.createProperty();
property.setKey("key2");
property.setValue("value2");
model.getProperties().add(property);
ds = new PropertiesModelDataSource(model);
}
use of com.archimatetool.model.IProperty in project archi by archimatetool.
the class PropertiesRenderer method renderPropertiesValuesCustomList.
// List of all of a certain property key with separator
private String renderPropertiesValuesCustomList(IArchimateModelObject object, String text) {
Matcher matcher = FILTERED_PROPERTIES_WITH_SEPARATOR_PATTERN.matcher(text);
while (matcher.find()) {
String prefix = matcher.group(1);
String separator = matcher.group(2);
String key = matcher.group(3);
String s = "";
IArchimateModelObject refObject = getObjectFromPrefix(object, prefix);
if (refObject instanceof IProperties) {
for (IProperty property : ((IProperties) refObject).getProperties()) {
if (property.getKey().equals(key)) {
if (!s.isEmpty()) {
s += separator;
}
s += property.getValue();
}
}
text = text.replace(matcher.group(), s);
}
}
return text;
}
use of com.archimatetool.model.IProperty in project archi by archimatetool.
the class UserPropertiesManagerDialog method checkDeletions.
/**
* Check for deletions
*/
private void checkDeletions(CompoundCommand compoundCmd) {
for (Iterator<EObject> iter = fArchimateModel.eAllContents(); iter.hasNext(); ) {
EObject element = iter.next();
if (element instanceof IProperty) {
IProperty property = (IProperty) element;
String key = property.getKey();
if (key != null && !fKeysTable.containsKey(key)) {
Command cmd = new DeletePropertyKeyCommand(((IProperties) property.eContainer()).getProperties(), property);
compoundCmd.add(cmd);
}
}
}
}
use of com.archimatetool.model.IProperty in project archi by archimatetool.
the class UserPropertiesManagerDialog method addKeyNameChangeCommands.
/**
* Change all instances of key to new name
*/
private void addKeyNameChangeCommands(CompoundCommand compoundCmd, String oldName, String newName) {
for (Iterator<EObject> iter = fArchimateModel.eAllContents(); iter.hasNext(); ) {
EObject element = iter.next();
if (element instanceof IProperty) {
String key = ((IProperty) element).getKey();
if (key != null && key.equals(oldName)) {
Command cmd = new RenamePropertyKeyCommand((IProperty) element, oldName, newName);
compoundCmd.add(cmd);
}
}
}
}
Aggregations