Java Code Examples for org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getChoiceOfValues()

The following examples show how to use org.eclipse.emf.edit.provider.IItemPropertyDescriptor#getChoiceOfValues() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ModelDefinitionItemProviderTests.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void getChoiceOfValuesEPackage() {
    final IItemPropertyDescriptor descriptor = provider.getPropertyDescriptor(definition,
            GenconfPackage.Literals.MODEL_DEFINITION__VALUE);

    properties.getVariables().put(SELF, "ecore::EPackage");
    properties.save();
    saveDocument();

    @SuppressWarnings("unchecked")
    final List<EPackage> values = (List<EPackage>) descriptor.getChoiceOfValues(definition);

    assertNotNull(values);
    assertEquals(4, values.size());
    assertEquals("package1", values.get(0).getName());
    assertEquals("package2", values.get(1).getName());
    assertEquals("package3", values.get(2).getName());
    assertEquals(null, values.get(3));
}
 
Example 2
Source File: ModelDefinitionItemProviderTests.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void getChoiceOfValuesEClass() {
    final IItemPropertyDescriptor descriptor = provider.getPropertyDescriptor(definition,
            GenconfPackage.Literals.MODEL_DEFINITION__VALUE);

    properties.getVariables().put(SELF, "ecore::EClass");
    properties.save();
    saveDocument();

    @SuppressWarnings("unchecked")
    final List<EClass> values = (List<EClass>) descriptor.getChoiceOfValues(definition);

    assertNotNull(values);
    assertEquals(4, values.size());
    assertEquals("Class1", values.get(0).getName());
    assertEquals("Class2", values.get(1).getName());
    assertEquals("Class3", values.get(2).getName());
    assertEquals(null, values.get(3));
}
 
Example 3
Source File: ModelDefinitionItemProviderTests.java    From M2Doc with Eclipse Public License 1.0 6 votes vote down vote up
@Test
public void getChoiceOfValuesGeneration() {
    final IItemPropertyDescriptor descriptor = provider.getPropertyDescriptor(definition,
            GenconfPackage.Literals.MODEL_DEFINITION__VALUE);

    properties.getVariables().put(SELF, "genconf::Generation");
    properties.save();
    saveDocument();

    @SuppressWarnings("unchecked")
    final List<Generation> values = (List<Generation>) descriptor.getChoiceOfValues(definition);

    assertNotNull(values);
    assertEquals(2, values.size());
    assertEquals(definition.eContainer(), values.get(0));
    assertEquals(null, values.get(1));
}
 
Example 4
Source File: ModelDefinitionItemProviderTests.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void getChoiceOfValuesNotAVariable() {
    final IItemPropertyDescriptor descriptor = provider.getPropertyDescriptor(definition,
            GenconfPackage.Literals.MODEL_DEFINITION__VALUE);

    definition.setKey("NotAVariable");
    properties.save();
    saveDocument();

    final List<?> values = (List<?>) descriptor.getChoiceOfValues(definition);

    assertNotNull(values);
    assertEquals(1, values.size());
    assertEquals(null, values.get(0));
}
 
Example 5
Source File: ModelDefinitionItemProviderTests.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void getChoiceOfValuesNoType() {
    final IItemPropertyDescriptor descriptor = provider.getPropertyDescriptor(definition,
            GenconfPackage.Literals.MODEL_DEFINITION__VALUE);

    properties.getVariables().put(SELF, "");
    properties.save();
    saveDocument();

    final List<?> values = (List<?>) descriptor.getChoiceOfValues(definition);

    assertNotNull(values);
    assertEquals(1, values.size());
    assertEquals(null, values.get(0));
}
 
Example 6
Source File: ModelDefinitionItemProviderTests.java    From M2Doc with Eclipse Public License 1.0 5 votes vote down vote up
@Test
public void getChoiceOfValuesInvalideType() {
    final IItemPropertyDescriptor descriptor = provider.getPropertyDescriptor(definition,
            GenconfPackage.Literals.MODEL_DEFINITION__VALUE);

    properties.getVariables().put(SELF, "InvalidType");
    properties.save();
    saveDocument();

    final List<?> values = (List<?>) descriptor.getChoiceOfValues(definition);

    assertNotNull(values);
    assertEquals(1, values.size());
    assertEquals(null, values.get(0));
}