/** Add a modifier. * @param modifier the modifier to add. */ public void addModifier(String modifier) { if (!Strings.isEmpty(modifier)) { this.sarlArtifact.getModifiers().add(modifier); } }
/** Initialize the SARL artifact type. * * @param source the source. * @param inferredJvmType the JVM type. */ @SuppressWarnings("static-method") protected void initialize(SarlArtifact 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.sarlArtifact == null) { this.sarlArtifact = SarlFactory.eINSTANCE.createSarlArtifact(); script.getXtendTypes().add(this.sarlArtifact); this.sarlArtifact.setAnnotationInfo(XtendFactory.eINSTANCE.createXtendTypeDeclaration()); if (!Strings.isEmpty(name)) { this.sarlArtifact.setName(name); } } }
/** Replies the resource to which the SarlArtifact is attached. */ @Pure public Resource eResource() { return getSarlArtifact().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)) { getSarlArtifact().eAdapters().removeIf(new Predicate<Adapter>() { public boolean test(Adapter adapter) { return adapter.isAdapterForType(DocumentationAdapter.class); } }); } else { DocumentationAdapter adapter = (DocumentationAdapter) EcoreUtil.getExistingAdapter( getSarlArtifact(), DocumentationAdapter.class); if (adapter == null) { adapter = new DocumentationAdapter(); getSarlArtifact().eAdapters().add(adapter); } adapter.setDocumentation(doc); } }
/** Replies the resource to which the SarlArtifact is attached. */ @Pure public Resource eResource() { return getSarlArtifact().eResource(); }