use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class TransitionPossibleValuesService method compute.
@Override
protected void compute(Set<String> values) {
/*
* if we are a task return states and tasks, if we are a state, find
* tasks.
*/
Element modelElement = context(Element.class);
WorkflowDefinition workflow = modelElement.nearest(WorkflowDefinition.class);
if (workflow == null) {
workflow = modelElement.adapt(WorkflowDefinition.class);
}
if (workflow != null) {
addNodeNames(values, workflow.getTasks());
addNodeNames(values, workflow.getStates());
addNodeNames(values, workflow.getConditions());
addNodeNames(values, workflow.getForks());
addNodeNames(values, workflow.getJoins());
Value<Version> schemaVersion = workflow.getSchemaVersion();
Version version = schemaVersion.content();
if (version.compareTo(new Version("6.2")) >= 0) {
addNodeNames(values, workflow.getJoinXors());
}
}
}
use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class StructuresTests method testDDMStructureBasicDocumentRead.
@Test
public void testDDMStructureBasicDocumentRead() throws Exception {
final Element element = getElementFromFile(getCurrentProject(), DDM_STRUCTURE_BASIC_DOCUMENT, Root.TYPE);
setElement(element);
final Root root = element.nearest(Root.class);
assertNotNull(root);
assertEquals("en_US", root.getAvailableLocales().content());
assertEquals("en_US", root.getDefaultLocale().content());
final ElementList<DynamicElement> dynamicElements = root.getDynamicElements();
assertEquals(154, dynamicElements.size());
final DynamicElement dynamicElement = dynamicElements.get(1);
assertNotNull(dynamicElement);
assertEquals("string", dynamicElement.getDataType().content(false));
assertEquals("ClimateForcast_COMMAND_LINE", dynamicElement.getName().content(false));
assertEquals("text", dynamicElement.getType().content(false));
final DynamicElementMetadata metaData = dynamicElement.getMetadata().content(false);
assertNotNull(metaData);
assertEquals("en_US", metaData.getLocale().content(false));
final ElementList<Entry> entries = metaData.getEntries();
assertNotNull(entries);
assertEquals(4, entries.size());
final Entry entry = entries.get(2);
assertNotNull(entry);
assertEquals("required", entry.getName().content(false));
assertEquals("false", entry.getValue().content(false));
}
use of org.eclipse.sapphire.Element in project liferay-ide by liferay.
the class StructuresTests method getElementFromFile.
protected Element getElementFromFile(IProject project, IPath filePath, ElementType type) throws Exception {
final String filePathValue = filePath.toOSString();
final IFile file = createFile(project, filePathValue, this.getClass().getResourceAsStream(filePathValue));
assertEquals(file.getFullPath().lastSegment(), filePath.lastSegment());
final InputStream contents = file.getContents();
final Element element = type.instantiate(new RootXmlResource(new XmlResourceStore(contents)));
contents.close();
return element;
}
Aggregations