/** Add a modifier. * @param modifier the modifier to add. */ public void addModifier(String modifier) { if (!Strings.isEmpty(modifier)) { this.sarlSpace.getModifiers().add(modifier); } }
/** Initialize the SARL space type. * * @param source the source. * @param inferredJvmType the JVM type. */ @SuppressWarnings("static-method") protected void initialize(SarlSpace source, JvmGenericType inferredJvmType) { // Issue #356: do not generate if the space has no name. assert source != null; assert inferredJvmType != null; if (Strings.isNullOrEmpty(source.getName())) { return; } }
/** Initialize the Ecore element when inside a script. */ public void eInit(SarlScript script, String name, IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.sarlSpace == null) { this.sarlSpace = SarlFactory.eINSTANCE.createSarlSpace(); script.getXtendTypes().add(this.sarlSpace); this.sarlSpace.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration()); if (!Strings.isEmpty(name)) { this.sarlSpace.setName(name); } } }
/** Replies the resource to which the SarlSpace is attached. */ @Pure public Resource eResource() { return getSarlSpace().eResource(); }
/** Change the documentation of the element. * * <p>The documentation will be displayed just before the element. * * @param doc the documentation. */ public void setDocumentation(String doc) { if (Strings.isEmpty(doc)) { getSarlSpace().eAdapters().removeIf(new Predicate<Adapter>() { public boolean test(Adapter adapter) { return adapter.isAdapterForType(DocumentationAdapter.class); } }); } else { DocumentationAdapter adapter = (DocumentationAdapter) EcoreUtil.getExistingAdapter( getSarlSpace(), DocumentationAdapter.class); if (adapter == null) { adapter = new DocumentationAdapter(); getSarlSpace().eAdapters().add(adapter); } adapter.setDocumentation(doc); } }
/** Replies the resource to which the SarlSpace is attached. */ @Pure public Resource eResource() { return getSarlSpace().eResource(); }