repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java | ExtraLanguagePreferenceAccess.getXtextKey | private static String getXtextKey(String preferenceContainerID, String preferenceName) {
return GENERATOR_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + preferenceContainerID
+ PreferenceConstants.SEPARATOR + preferenceName;
} | java | private static String getXtextKey(String preferenceContainerID, String preferenceName) {
return GENERATOR_PREFERENCE_TAG + PreferenceConstants.SEPARATOR + preferenceContainerID
+ PreferenceConstants.SEPARATOR + preferenceName;
} | [
"private",
"static",
"String",
"getXtextKey",
"(",
"String",
"preferenceContainerID",
",",
"String",
"preferenceName",
")",
"{",
"return",
"GENERATOR_PREFERENCE_TAG",
"+",
"PreferenceConstants",
".",
"SEPARATOR",
"+",
"preferenceContainerID",
"+",
"PreferenceConstants",
"... | Create a preference key according to the Xtext option block standards.
@param preferenceContainerID the identifier of the generator's preference container.
@param preferenceName the name of the preference.
@return the key. | [
"Create",
"a",
"preference",
"key",
"according",
"to",
"the",
"Xtext",
"option",
"block",
"standards",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L100-L103 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java | ExtraLanguagePreferenceAccess.getPrefixedKey | public static String getPrefixedKey(String preferenceContainerID, String preferenceName) {
return getXtextKey(getPropertyPrefix(preferenceContainerID), preferenceName);
} | java | public static String getPrefixedKey(String preferenceContainerID, String preferenceName) {
return getXtextKey(getPropertyPrefix(preferenceContainerID), preferenceName);
} | [
"public",
"static",
"String",
"getPrefixedKey",
"(",
"String",
"preferenceContainerID",
",",
"String",
"preferenceName",
")",
"{",
"return",
"getXtextKey",
"(",
"getPropertyPrefix",
"(",
"preferenceContainerID",
")",
",",
"preferenceName",
")",
";",
"}"
] | Create a preference key.
@param preferenceContainerID the identifier of the generator's preference container.
@param preferenceName the name of the preference.
@return the key. | [
"Create",
"a",
"preference",
"key",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L111-L113 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java | ExtraLanguagePreferenceAccess.hasProjectSpecificOptions | public boolean hasProjectSpecificOptions(String preferenceContainerID, IProject project) {
final IPreferenceStore store = getWritablePreferenceStore(project);
// Compute the key
String key = IS_PROJECT_SPECIFIC;
if (preferenceContainerID != null) {
key = getPropertyPrefix(preferenceContainerID) + "." + IS_PROJECT_SPECIFIC; //$NON-NLS-1$
}
// backward compatibility
final boolean oldSettingsUsed = store.getBoolean(IS_PROJECT_SPECIFIC);
final boolean newSettingsValue = store.getBoolean(key);
if (oldSettingsUsed && !newSettingsValue) {
store.setValue(key, true);
return true;
}
return newSettingsValue;
} | java | public boolean hasProjectSpecificOptions(String preferenceContainerID, IProject project) {
final IPreferenceStore store = getWritablePreferenceStore(project);
// Compute the key
String key = IS_PROJECT_SPECIFIC;
if (preferenceContainerID != null) {
key = getPropertyPrefix(preferenceContainerID) + "." + IS_PROJECT_SPECIFIC; //$NON-NLS-1$
}
// backward compatibility
final boolean oldSettingsUsed = store.getBoolean(IS_PROJECT_SPECIFIC);
final boolean newSettingsValue = store.getBoolean(key);
if (oldSettingsUsed && !newSettingsValue) {
store.setValue(key, true);
return true;
}
return newSettingsValue;
} | [
"public",
"boolean",
"hasProjectSpecificOptions",
"(",
"String",
"preferenceContainerID",
",",
"IProject",
"project",
")",
"{",
"final",
"IPreferenceStore",
"store",
"=",
"getWritablePreferenceStore",
"(",
"project",
")",
";",
"// Compute the key",
"String",
"key",
"=",... | Replies if the project has specific configuration for extra language generation provided by the given container.
<p>This code is copied from {@link AbstractGeneratorConfigurationBlock} and its super types.
@param preferenceContainerID the identifier of the generator's preference container.
@param project the context.
@return {@code true} if the given project has a specific configuration. {@code false} if
the general configuration should be used. | [
"Replies",
"if",
"the",
"project",
"has",
"specific",
"configuration",
"for",
"extra",
"language",
"generation",
"provided",
"by",
"the",
"given",
"container",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L221-L236 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java | ExtraLanguagePreferenceAccess.ifSpecificConfiguration | public IProject ifSpecificConfiguration(String preferenceContainerID, IProject project) {
if (project != null && hasProjectSpecificOptions(preferenceContainerID, project)) {
return project;
}
return null;
} | java | public IProject ifSpecificConfiguration(String preferenceContainerID, IProject project) {
if (project != null && hasProjectSpecificOptions(preferenceContainerID, project)) {
return project;
}
return null;
} | [
"public",
"IProject",
"ifSpecificConfiguration",
"(",
"String",
"preferenceContainerID",
",",
"IProject",
"project",
")",
"{",
"if",
"(",
"project",
"!=",
"null",
"&&",
"hasProjectSpecificOptions",
"(",
"preferenceContainerID",
",",
"project",
")",
")",
"{",
"return... | Filter the project according to the specific configuration.
<p>If the given project has a specific configuration, it is replied.
Otherwise, {@code null} is replied.
@param preferenceContainerID the identifier of the generator's preference container.
@param project the context. If {@code null}, the global context is assumed.
@return the unmodifiable preference store. | [
"Filter",
"the",
"project",
"according",
"to",
"the",
"specific",
"configuration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L247-L252 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java | ExtraLanguagePreferenceAccess.parseConverterPreferenceValue | public static boolean parseConverterPreferenceValue(String input, Procedure2<? super String, ? super String> output) {
final StringTokenizer tokenizer = new StringTokenizer(input, PREFERENCE_SEPARATOR);
String key = null;
boolean foundValue = false;
while (tokenizer.hasMoreTokens()) {
final String token = tokenizer.nextToken();
if (key != null) {
output.apply(key, token);
foundValue = true;
key = null;
} else {
key = token;
}
}
return foundValue;
} | java | public static boolean parseConverterPreferenceValue(String input, Procedure2<? super String, ? super String> output) {
final StringTokenizer tokenizer = new StringTokenizer(input, PREFERENCE_SEPARATOR);
String key = null;
boolean foundValue = false;
while (tokenizer.hasMoreTokens()) {
final String token = tokenizer.nextToken();
if (key != null) {
output.apply(key, token);
foundValue = true;
key = null;
} else {
key = token;
}
}
return foundValue;
} | [
"public",
"static",
"boolean",
"parseConverterPreferenceValue",
"(",
"String",
"input",
",",
"Procedure2",
"<",
"?",
"super",
"String",
",",
"?",
"super",
"String",
">",
"output",
")",
"{",
"final",
"StringTokenizer",
"tokenizer",
"=",
"new",
"StringTokenizer",
... | Parse the given input which is the preference string representation.
@param input the string representation from the preferences.
@param output the function to call for saving the parsed element. The first parameter is the element to be
converted. The second parameter is the target string.
@return {@code true} if a data was parsed. {@code false} if no value was parsed. | [
"Parse",
"the",
"given",
"input",
"which",
"is",
"the",
"preference",
"string",
"representation",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/preferences/ExtraLanguagePreferenceAccess.java#L271-L286 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/validation/SARLEarlyExitValidator.java | SARLEarlyExitValidator.markAsDeadCode | private boolean markAsDeadCode(XExpression expression) {
if (expression instanceof XBlockExpression) {
final XBlockExpression block = (XBlockExpression) expression;
final EList<XExpression> expressions = block.getExpressions();
if (!expressions.isEmpty()) {
markAsDeadCode(expressions.get(0));
return true;
}
}
if (expression != null) {
error("Unreachable expression.", expression, null, IssueCodes.UNREACHABLE_CODE); //$NON-NLS-1$
return true;
}
return false;
} | java | private boolean markAsDeadCode(XExpression expression) {
if (expression instanceof XBlockExpression) {
final XBlockExpression block = (XBlockExpression) expression;
final EList<XExpression> expressions = block.getExpressions();
if (!expressions.isEmpty()) {
markAsDeadCode(expressions.get(0));
return true;
}
}
if (expression != null) {
error("Unreachable expression.", expression, null, IssueCodes.UNREACHABLE_CODE); //$NON-NLS-1$
return true;
}
return false;
} | [
"private",
"boolean",
"markAsDeadCode",
"(",
"XExpression",
"expression",
")",
"{",
"if",
"(",
"expression",
"instanceof",
"XBlockExpression",
")",
"{",
"final",
"XBlockExpression",
"block",
"=",
"(",
"XBlockExpression",
")",
"expression",
";",
"final",
"EList",
"... | This code is copied from the super type | [
"This",
"code",
"is",
"copied",
"from",
"the",
"super",
"type"
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/validation/SARLEarlyExitValidator.java#L111-L125 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/config/CodeBuilderConfig.java | CodeBuilderConfig.addForbiddenInjectionPrefix | public void addForbiddenInjectionPrefix(String prefix) {
if (!Strings.isEmpty(prefix)) {
final String real = prefix.endsWith(".") ? prefix.substring(0, prefix.length() - 1) : prefix; //$NON-NLS-1$
this.forbiddenInjectionPrefixes.add(real);
}
} | java | public void addForbiddenInjectionPrefix(String prefix) {
if (!Strings.isEmpty(prefix)) {
final String real = prefix.endsWith(".") ? prefix.substring(0, prefix.length() - 1) : prefix; //$NON-NLS-1$
this.forbiddenInjectionPrefixes.add(real);
}
} | [
"public",
"void",
"addForbiddenInjectionPrefix",
"(",
"String",
"prefix",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"prefix",
")",
")",
"{",
"final",
"String",
"real",
"=",
"prefix",
".",
"endsWith",
"(",
"\".\"",
")",
"?",
"prefix",
".",... | Add a prefix of typenames that should not be considered for injection overriding.
@param prefix the prefix. | [
"Add",
"a",
"prefix",
"of",
"typenames",
"that",
"should",
"not",
"be",
"considered",
"for",
"injection",
"overriding",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/config/CodeBuilderConfig.java#L223-L228 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/config/CodeBuilderConfig.java | CodeBuilderConfig.addForbiddenInjectionPostfixes | public void addForbiddenInjectionPostfixes(String postfix) {
if (!Strings.isEmpty(postfix)) {
final String real = postfix.startsWith(".") ? postfix.substring(1) : postfix; //$NON-NLS-1$
this.forbiddenInjectionPrefixes.add(real);
}
} | java | public void addForbiddenInjectionPostfixes(String postfix) {
if (!Strings.isEmpty(postfix)) {
final String real = postfix.startsWith(".") ? postfix.substring(1) : postfix; //$NON-NLS-1$
this.forbiddenInjectionPrefixes.add(real);
}
} | [
"public",
"void",
"addForbiddenInjectionPostfixes",
"(",
"String",
"postfix",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"postfix",
")",
")",
"{",
"final",
"String",
"real",
"=",
"postfix",
".",
"startsWith",
"(",
"\".\"",
")",
"?",
"postfix... | Add a postfix of typenames that should not be considered for injection overriding.
@param postfix the postfix. | [
"Add",
"a",
"postfix",
"of",
"typenames",
"that",
"should",
"not",
"be",
"considered",
"for",
"injection",
"overriding",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/config/CodeBuilderConfig.java#L234-L239 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/config/CodeBuilderConfig.java | CodeBuilderConfig.addModifier | public void addModifier(Modifier modifier) {
if (modifier != null) {
final String ruleName = modifier.getType();
if (!Strings.isEmpty(ruleName)) {
List<String> modifiers = this.modifiers.get(ruleName);
if (modifiers == null) {
modifiers = new ArrayList<>();
this.modifiers.put(ruleName, modifiers);
}
modifiers.addAll(modifier.getModifiers());
}
}
} | java | public void addModifier(Modifier modifier) {
if (modifier != null) {
final String ruleName = modifier.getType();
if (!Strings.isEmpty(ruleName)) {
List<String> modifiers = this.modifiers.get(ruleName);
if (modifiers == null) {
modifiers = new ArrayList<>();
this.modifiers.put(ruleName, modifiers);
}
modifiers.addAll(modifier.getModifiers());
}
}
} | [
"public",
"void",
"addModifier",
"(",
"Modifier",
"modifier",
")",
"{",
"if",
"(",
"modifier",
"!=",
"null",
")",
"{",
"final",
"String",
"ruleName",
"=",
"modifier",
".",
"getType",
"(",
")",
";",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"ruleN... | Add a modifier for a rule.
<p>The first modifier is the default modifier.
@param modifier the modifier. | [
"Add",
"a",
"modifier",
"for",
"a",
"rule",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/config/CodeBuilderConfig.java#L450-L462 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/config/CodeBuilderConfig.java | CodeBuilderConfig.addDefaultSuper | public void addDefaultSuper(SuperTypeMapping mapping) {
if (mapping != null) {
this.superTypeMapping.put(mapping.getType(), mapping.getSuper());
}
} | java | public void addDefaultSuper(SuperTypeMapping mapping) {
if (mapping != null) {
this.superTypeMapping.put(mapping.getType(), mapping.getSuper());
}
} | [
"public",
"void",
"addDefaultSuper",
"(",
"SuperTypeMapping",
"mapping",
")",
"{",
"if",
"(",
"mapping",
"!=",
"null",
")",
"{",
"this",
".",
"superTypeMapping",
".",
"put",
"(",
"mapping",
".",
"getType",
"(",
")",
",",
"mapping",
".",
"getSuper",
"(",
... | Add a default super type.
@param mapping the mapping for the super type. | [
"Add",
"a",
"default",
"super",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/config/CodeBuilderConfig.java#L779-L783 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java | Reflect.getField | public static <T> T getField(Object obj, String string, Class<?> clazz, Class<T> fieldType) {
try {
final Field field = clazz.getDeclaredField(string);
field.setAccessible(true);
final Object value = field.get(obj);
return fieldType.cast(value);
} catch (Exception exception) {
throw new Error(exception);
}
} | java | public static <T> T getField(Object obj, String string, Class<?> clazz, Class<T> fieldType) {
try {
final Field field = clazz.getDeclaredField(string);
field.setAccessible(true);
final Object value = field.get(obj);
return fieldType.cast(value);
} catch (Exception exception) {
throw new Error(exception);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"getField",
"(",
"Object",
"obj",
",",
"String",
"string",
",",
"Class",
"<",
"?",
">",
"clazz",
",",
"Class",
"<",
"T",
">",
"fieldType",
")",
"{",
"try",
"{",
"final",
"Field",
"field",
"=",
"clazz",
".",
... | Replies the value of the field.
@param <T> the field type.
@param obj the instance.
@param string the field name.
@param clazz the container type.
@param fieldType the field type.
@return the value. | [
"Replies",
"the",
"value",
"of",
"the",
"field",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java#L118-L127 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java | Reflect.copyFields | public static <T> void copyFields(Class<T> type, T dest, T source) {
Class<?> clazz = type;
while (clazz != null && !Object.class.equals(clazz)) {
for (final Field field : clazz.getDeclaredFields()) {
if (!Modifier.isStatic(field.getModifiers())) {
field.setAccessible(true);
try {
field.set(dest, field.get(source));
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
}
}
clazz = clazz.getSuperclass();
}
} | java | public static <T> void copyFields(Class<T> type, T dest, T source) {
Class<?> clazz = type;
while (clazz != null && !Object.class.equals(clazz)) {
for (final Field field : clazz.getDeclaredFields()) {
if (!Modifier.isStatic(field.getModifiers())) {
field.setAccessible(true);
try {
field.set(dest, field.get(source));
} catch (IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
}
}
clazz = clazz.getSuperclass();
}
} | [
"public",
"static",
"<",
"T",
">",
"void",
"copyFields",
"(",
"Class",
"<",
"T",
">",
"type",
",",
"T",
"dest",
",",
"T",
"source",
")",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"type",
";",
"while",
"(",
"clazz",
"!=",
"null",
"&&",
"!",
"Ob... | Clone the fields.
@param <T> the type of the objects.
@param type the type of the objects.
@param dest the destination.
@param source the source. | [
"Clone",
"the",
"fields",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/utils/Reflect.java#L136-L151 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java | SREConfigurationBlock.createControl | public Control createControl(Composite parent) {
this.control = SWTFactory.createComposite(
parent, parent.getFont(), 1, 1, GridData.FILL_HORIZONTAL);
final int nbColumns = this.enableSystemWideSelector ? 3 : 2;
final Group group = SWTFactory.createGroup(this.control,
MoreObjects.firstNonNull(this.title, Messages.SREConfigurationBlock_7),
nbColumns, 1, GridData.FILL_HORIZONTAL);
if (this.enableSystemWideSelector || !this.projectProviderFactories.isEmpty()) {
createSystemWideSelector(group);
createProjectSelector(group);
this.specificSREButton = SWTFactory.createRadioButton(group,
Messages.SREConfigurationBlock_2, 1);
this.specificSREButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("synthetic-access")
@Override
public void widgetSelected(SelectionEvent event) {
if (SREConfigurationBlock.this.specificSREButton.getSelection()) {
handleSpecificConfigurationSelected();
}
}
});
} else {
this.systemSREButton = null;
this.projectSREButton = null;
this.specificSREButton = null;
}
createSRESelector(group);
return getControl();
} | java | public Control createControl(Composite parent) {
this.control = SWTFactory.createComposite(
parent, parent.getFont(), 1, 1, GridData.FILL_HORIZONTAL);
final int nbColumns = this.enableSystemWideSelector ? 3 : 2;
final Group group = SWTFactory.createGroup(this.control,
MoreObjects.firstNonNull(this.title, Messages.SREConfigurationBlock_7),
nbColumns, 1, GridData.FILL_HORIZONTAL);
if (this.enableSystemWideSelector || !this.projectProviderFactories.isEmpty()) {
createSystemWideSelector(group);
createProjectSelector(group);
this.specificSREButton = SWTFactory.createRadioButton(group,
Messages.SREConfigurationBlock_2, 1);
this.specificSREButton.addSelectionListener(new SelectionAdapter() {
@SuppressWarnings("synthetic-access")
@Override
public void widgetSelected(SelectionEvent event) {
if (SREConfigurationBlock.this.specificSREButton.getSelection()) {
handleSpecificConfigurationSelected();
}
}
});
} else {
this.systemSREButton = null;
this.projectSREButton = null;
this.specificSREButton = null;
}
createSRESelector(group);
return getControl();
} | [
"public",
"Control",
"createControl",
"(",
"Composite",
"parent",
")",
"{",
"this",
".",
"control",
"=",
"SWTFactory",
".",
"createComposite",
"(",
"parent",
",",
"parent",
".",
"getFont",
"(",
")",
",",
"1",
",",
"1",
",",
"GridData",
".",
"FILL_HORIZONTA... | Creates this block's control in the given control.
@param parent containing control
@return the control.
@see #getControl() | [
"Creates",
"this",
"block",
"s",
"control",
"in",
"the",
"given",
"control",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java#L314-L346 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java | SREConfigurationBlock.updateExternalSREButtonLabels | public void updateExternalSREButtonLabels() {
if (this.enableSystemWideSelector) {
final ISREInstall wideSystemSRE = SARLRuntime.getDefaultSREInstall();
final String wideSystemSRELabel;
if (wideSystemSRE == null) {
wideSystemSRELabel = Messages.SREConfigurationBlock_0;
} else {
wideSystemSRELabel = wideSystemSRE.getName();
}
this.systemSREButton.setText(MessageFormat.format(
Messages.SREConfigurationBlock_1, wideSystemSRELabel));
}
if (!this.projectProviderFactories.isEmpty()) {
final ISREInstall projectSRE = retreiveProjectSRE();
final String projectSRELabel;
if (projectSRE == null) {
projectSRELabel = Messages.SREConfigurationBlock_0;
} else {
projectSRELabel = projectSRE.getName();
}
this.projectSREButton.setText(MessageFormat.format(
Messages.SREConfigurationBlock_3, projectSRELabel));
}
} | java | public void updateExternalSREButtonLabels() {
if (this.enableSystemWideSelector) {
final ISREInstall wideSystemSRE = SARLRuntime.getDefaultSREInstall();
final String wideSystemSRELabel;
if (wideSystemSRE == null) {
wideSystemSRELabel = Messages.SREConfigurationBlock_0;
} else {
wideSystemSRELabel = wideSystemSRE.getName();
}
this.systemSREButton.setText(MessageFormat.format(
Messages.SREConfigurationBlock_1, wideSystemSRELabel));
}
if (!this.projectProviderFactories.isEmpty()) {
final ISREInstall projectSRE = retreiveProjectSRE();
final String projectSRELabel;
if (projectSRE == null) {
projectSRELabel = Messages.SREConfigurationBlock_0;
} else {
projectSRELabel = projectSRE.getName();
}
this.projectSREButton.setText(MessageFormat.format(
Messages.SREConfigurationBlock_3, projectSRELabel));
}
} | [
"public",
"void",
"updateExternalSREButtonLabels",
"(",
")",
"{",
"if",
"(",
"this",
".",
"enableSystemWideSelector",
")",
"{",
"final",
"ISREInstall",
"wideSystemSRE",
"=",
"SARLRuntime",
".",
"getDefaultSREInstall",
"(",
")",
";",
"final",
"String",
"wideSystemSRE... | Update the label of the "system-wide" and "project" configuration buttons. | [
"Update",
"the",
"label",
"of",
"the",
"system",
"-",
"wide",
"and",
"project",
"configuration",
"buttons",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java#L350-L373 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java | SREConfigurationBlock.selectSpecificSRE | @SuppressWarnings("checkstyle:npathcomplexity")
public boolean selectSpecificSRE(ISREInstall sre) {
ISREInstall theSRE = sre;
if (theSRE == null) {
theSRE = SARLRuntime.getDefaultSREInstall();
}
if (theSRE != null) {
boolean changed = false;
final boolean oldNotify = this.notify;
try {
this.notify = false;
if (isSystemWideDefaultSRE()) {
doSpecificSREButtonClick();
changed = true;
}
final ISREInstall oldSRE = getSelectedSRE();
if (oldSRE != theSRE) {
final int index = indexOf(theSRE);
if (index >= 0) {
this.runtimeEnvironmentCombo.select(index);
changed = true;
}
}
if (!this.runtimeEnvironments.isEmpty()) {
int selection = this.runtimeEnvironmentCombo.getSelectionIndex();
if (selection < 0 || selection >= this.runtimeEnvironments.size()) {
// Ensure that there is a selected element
selection = indexOf(theSRE);
this.runtimeEnvironmentCombo.select((selection < 0) ? 0 : selection);
changed = true;
}
}
} finally {
this.notify = oldNotify;
}
if (changed) {
firePropertyChange();
return true;
}
}
return false;
} | java | @SuppressWarnings("checkstyle:npathcomplexity")
public boolean selectSpecificSRE(ISREInstall sre) {
ISREInstall theSRE = sre;
if (theSRE == null) {
theSRE = SARLRuntime.getDefaultSREInstall();
}
if (theSRE != null) {
boolean changed = false;
final boolean oldNotify = this.notify;
try {
this.notify = false;
if (isSystemWideDefaultSRE()) {
doSpecificSREButtonClick();
changed = true;
}
final ISREInstall oldSRE = getSelectedSRE();
if (oldSRE != theSRE) {
final int index = indexOf(theSRE);
if (index >= 0) {
this.runtimeEnvironmentCombo.select(index);
changed = true;
}
}
if (!this.runtimeEnvironments.isEmpty()) {
int selection = this.runtimeEnvironmentCombo.getSelectionIndex();
if (selection < 0 || selection >= this.runtimeEnvironments.size()) {
// Ensure that there is a selected element
selection = indexOf(theSRE);
this.runtimeEnvironmentCombo.select((selection < 0) ? 0 : selection);
changed = true;
}
}
} finally {
this.notify = oldNotify;
}
if (changed) {
firePropertyChange();
return true;
}
}
return false;
} | [
"@",
"SuppressWarnings",
"(",
"\"checkstyle:npathcomplexity\"",
")",
"public",
"boolean",
"selectSpecificSRE",
"(",
"ISREInstall",
"sre",
")",
"{",
"ISREInstall",
"theSRE",
"=",
"sre",
";",
"if",
"(",
"theSRE",
"==",
"null",
")",
"{",
"theSRE",
"=",
"SARLRuntime... | Select a specific SRE.
@param sre the sre, if <code>null</code> reset to default.
@return <code>true</code> if the selection changed. | [
"Select",
"a",
"specific",
"SRE",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java#L447-L488 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java | SREConfigurationBlock.getSelectedSRE | public ISREInstall getSelectedSRE() {
if (this.enableSystemWideSelector && this.systemSREButton.getSelection()) {
return SARLRuntime.getDefaultSREInstall();
}
if (!this.projectProviderFactories.isEmpty() && this.projectSREButton.getSelection()) {
return retreiveProjectSRE();
}
return getSpecificSRE();
} | java | public ISREInstall getSelectedSRE() {
if (this.enableSystemWideSelector && this.systemSREButton.getSelection()) {
return SARLRuntime.getDefaultSREInstall();
}
if (!this.projectProviderFactories.isEmpty() && this.projectSREButton.getSelection()) {
return retreiveProjectSRE();
}
return getSpecificSRE();
} | [
"public",
"ISREInstall",
"getSelectedSRE",
"(",
")",
"{",
"if",
"(",
"this",
".",
"enableSystemWideSelector",
"&&",
"this",
".",
"systemSREButton",
".",
"getSelection",
"(",
")",
")",
"{",
"return",
"SARLRuntime",
".",
"getDefaultSREInstall",
"(",
")",
";",
"}... | Replies the selected SARL runtime environment.
@return the SARL runtime environment or <code>null</code> if
there is no selected SRE.
@see #isSystemWideDefaultSRE() | [
"Replies",
"the",
"selected",
"SARL",
"runtime",
"environment",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java#L536-L544 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java | SREConfigurationBlock.getSpecificSRE | public ISREInstall getSpecificSRE() {
final int index = this.runtimeEnvironmentCombo.getSelectionIndex();
if (index >= 0 && index < this.runtimeEnvironments.size()) {
return this.runtimeEnvironments.get(index);
}
return null;
} | java | public ISREInstall getSpecificSRE() {
final int index = this.runtimeEnvironmentCombo.getSelectionIndex();
if (index >= 0 && index < this.runtimeEnvironments.size()) {
return this.runtimeEnvironments.get(index);
}
return null;
} | [
"public",
"ISREInstall",
"getSpecificSRE",
"(",
")",
"{",
"final",
"int",
"index",
"=",
"this",
".",
"runtimeEnvironmentCombo",
".",
"getSelectionIndex",
"(",
")",
";",
"if",
"(",
"index",
">=",
"0",
"&&",
"index",
"<",
"this",
".",
"runtimeEnvironments",
".... | Replies the specific SARL runtime environment.
@return the SARL runtime environment or <code>null</code> if
there is no selected SRE.
@see #isSystemWideDefaultSRE() | [
"Replies",
"the",
"specific",
"SARL",
"runtime",
"environment",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java#L552-L558 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java | SREConfigurationBlock.updateEnableState | public void updateEnableState() {
boolean comboEnabled = !this.runtimeEnvironments.isEmpty();
boolean searchEnabled = true;
if (isSystemWideDefaultSRE() || isProjectSRE()) {
comboEnabled = false;
searchEnabled = false;
}
this.runtimeEnvironmentCombo.setEnabled(comboEnabled);
this.runtimeEnvironmentSearchButton.setEnabled(searchEnabled);
} | java | public void updateEnableState() {
boolean comboEnabled = !this.runtimeEnvironments.isEmpty();
boolean searchEnabled = true;
if (isSystemWideDefaultSRE() || isProjectSRE()) {
comboEnabled = false;
searchEnabled = false;
}
this.runtimeEnvironmentCombo.setEnabled(comboEnabled);
this.runtimeEnvironmentSearchButton.setEnabled(searchEnabled);
} | [
"public",
"void",
"updateEnableState",
"(",
")",
"{",
"boolean",
"comboEnabled",
"=",
"!",
"this",
".",
"runtimeEnvironments",
".",
"isEmpty",
"(",
")",
";",
"boolean",
"searchEnabled",
"=",
"true",
";",
"if",
"(",
"isSystemWideDefaultSRE",
"(",
")",
"||",
"... | Update the enable state of the block. | [
"Update",
"the",
"enable",
"state",
"of",
"the",
"block",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java#L562-L571 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java | SREConfigurationBlock.initialize | public void initialize() {
// Initialize the SRE list
this.runtimeEnvironments.clear();
final ISREInstall[] sres = SARLRuntime.getSREInstalls();
Arrays.sort(sres, new Comparator<ISREInstall>() {
@Override
public int compare(ISREInstall o1, ISREInstall o2) {
return o1.getName().compareTo(o2.getName());
}
});
final List<String> labels = new ArrayList<>(sres.length);
for (int i = 0; i < sres.length; ++i) {
if (sres[i].getValidity().isOK()) {
this.runtimeEnvironments.add(sres[i]);
labels.add(sres[i].getName());
}
}
this.runtimeEnvironmentCombo.setItems(labels.toArray(new String[labels.size()]));
// Reset the labels of the external SRE configurations
updateExternalSREButtonLabels();
// Initialize the type of configuration
if (this.enableSystemWideSelector) {
this.specificSREButton.setSelection(false);
if (!this.projectProviderFactories.isEmpty()) {
this.projectSREButton.setSelection(false);
}
this.systemSREButton.setSelection(true);
} else if (!this.projectProviderFactories.isEmpty()) {
this.specificSREButton.setSelection(false);
if (this.enableSystemWideSelector) {
this.systemSREButton.setSelection(false);
}
this.projectSREButton.setSelection(true);
}
// Wait for SRE list updates.
this.sreListener = new InstallChange();
SARLRuntime.addSREInstallChangedListener(this.sreListener);
updateEnableState();
} | java | public void initialize() {
// Initialize the SRE list
this.runtimeEnvironments.clear();
final ISREInstall[] sres = SARLRuntime.getSREInstalls();
Arrays.sort(sres, new Comparator<ISREInstall>() {
@Override
public int compare(ISREInstall o1, ISREInstall o2) {
return o1.getName().compareTo(o2.getName());
}
});
final List<String> labels = new ArrayList<>(sres.length);
for (int i = 0; i < sres.length; ++i) {
if (sres[i].getValidity().isOK()) {
this.runtimeEnvironments.add(sres[i]);
labels.add(sres[i].getName());
}
}
this.runtimeEnvironmentCombo.setItems(labels.toArray(new String[labels.size()]));
// Reset the labels of the external SRE configurations
updateExternalSREButtonLabels();
// Initialize the type of configuration
if (this.enableSystemWideSelector) {
this.specificSREButton.setSelection(false);
if (!this.projectProviderFactories.isEmpty()) {
this.projectSREButton.setSelection(false);
}
this.systemSREButton.setSelection(true);
} else if (!this.projectProviderFactories.isEmpty()) {
this.specificSREButton.setSelection(false);
if (this.enableSystemWideSelector) {
this.systemSREButton.setSelection(false);
}
this.projectSREButton.setSelection(true);
}
// Wait for SRE list updates.
this.sreListener = new InstallChange();
SARLRuntime.addSREInstallChangedListener(this.sreListener);
updateEnableState();
} | [
"public",
"void",
"initialize",
"(",
")",
"{",
"// Initialize the SRE list",
"this",
".",
"runtimeEnvironments",
".",
"clear",
"(",
")",
";",
"final",
"ISREInstall",
"[",
"]",
"sres",
"=",
"SARLRuntime",
".",
"getSREInstalls",
"(",
")",
";",
"Arrays",
".",
"... | Initialize the block with the installed JREs.
The selection and the components states are not updated
by this function. | [
"Initialize",
"the",
"block",
"with",
"the",
"installed",
"JREs",
".",
"The",
"selection",
"and",
"the",
"components",
"states",
"are",
"not",
"updated",
"by",
"this",
"function",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java#L577-L619 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java | SREConfigurationBlock.handleInstalledSREsButtonSelected | protected void handleInstalledSREsButtonSelected() {
PreferencesUtil.createPreferenceDialogOn(
getControl().getShell(),
SREsPreferencePage.ID,
new String[] {SREsPreferencePage.ID},
null).open();
} | java | protected void handleInstalledSREsButtonSelected() {
PreferencesUtil.createPreferenceDialogOn(
getControl().getShell(),
SREsPreferencePage.ID,
new String[] {SREsPreferencePage.ID},
null).open();
} | [
"protected",
"void",
"handleInstalledSREsButtonSelected",
"(",
")",
"{",
"PreferencesUtil",
".",
"createPreferenceDialogOn",
"(",
"getControl",
"(",
")",
".",
"getShell",
"(",
")",
",",
"SREsPreferencePage",
".",
"ID",
",",
"new",
"String",
"[",
"]",
"{",
"SREsP... | Invoked when the user want to search for a SARL runtime environment. | [
"Invoked",
"when",
"the",
"user",
"want",
"to",
"search",
"for",
"a",
"SARL",
"runtime",
"environment",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java#L632-L638 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java | SREConfigurationBlock.validate | public IStatus validate(ISREInstall sre) {
final IStatus status;
if (this.enableSystemWideSelector && this.systemSREButton.getSelection()) {
if (SARLRuntime.getDefaultSREInstall() == null) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, Messages.SREConfigurationBlock_5);
} else {
status = SARLEclipsePlugin.getDefault().createOkStatus();
}
} else if (!this.projectProviderFactories.isEmpty() && this.projectSREButton.getSelection()) {
if (retreiveProjectSRE() == null) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SREConfigurationBlock_6);
} else {
status = SARLEclipsePlugin.getDefault().createOkStatus();
}
} else if (this.runtimeEnvironments.isEmpty()) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SREConfigurationBlock_8);
} else {
status = sre.getValidity();
}
return status;
} | java | public IStatus validate(ISREInstall sre) {
final IStatus status;
if (this.enableSystemWideSelector && this.systemSREButton.getSelection()) {
if (SARLRuntime.getDefaultSREInstall() == null) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, Messages.SREConfigurationBlock_5);
} else {
status = SARLEclipsePlugin.getDefault().createOkStatus();
}
} else if (!this.projectProviderFactories.isEmpty() && this.projectSREButton.getSelection()) {
if (retreiveProjectSRE() == null) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SREConfigurationBlock_6);
} else {
status = SARLEclipsePlugin.getDefault().createOkStatus();
}
} else if (this.runtimeEnvironments.isEmpty()) {
status = SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR,
Messages.SREConfigurationBlock_8);
} else {
status = sre.getValidity();
}
return status;
} | [
"public",
"IStatus",
"validate",
"(",
"ISREInstall",
"sre",
")",
"{",
"final",
"IStatus",
"status",
";",
"if",
"(",
"this",
".",
"enableSystemWideSelector",
"&&",
"this",
".",
"systemSREButton",
".",
"getSelection",
"(",
")",
")",
"{",
"if",
"(",
"SARLRuntim... | Validate that the given SRE is valid in the context of the SRE configuration.
@param sre the SRE.
@return the state of the validation, never <code>null</code>. | [
"Validate",
"that",
"the",
"given",
"SRE",
"is",
"valid",
"in",
"the",
"context",
"of",
"the",
"SRE",
"configuration",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SREConfigurationBlock.java#L666-L688 | train |
sarl/sarl | contribs/io.sarl.examples/io.sarl.examples.plugin/src/io/sarl/examples/wizard/SarlExampleInstallerWizard.java | SarlExampleInstallerWizard.closeWelcomePage | protected static void closeWelcomePage() {
final IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
if (introManager != null) {
final IIntroPart intro = introManager.getIntro();
if (intro != null) {
introManager.closeIntro(intro);
}
}
} | java | protected static void closeWelcomePage() {
final IIntroManager introManager = PlatformUI.getWorkbench().getIntroManager();
if (introManager != null) {
final IIntroPart intro = introManager.getIntro();
if (intro != null) {
introManager.closeIntro(intro);
}
}
} | [
"protected",
"static",
"void",
"closeWelcomePage",
"(",
")",
"{",
"final",
"IIntroManager",
"introManager",
"=",
"PlatformUI",
".",
"getWorkbench",
"(",
")",
".",
"getIntroManager",
"(",
")",
";",
"if",
"(",
"introManager",
"!=",
"null",
")",
"{",
"final",
"... | Close the welcome page. | [
"Close",
"the",
"welcome",
"page",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.examples/io.sarl.examples.plugin/src/io/sarl/examples/wizard/SarlExampleInstallerWizard.java#L138-L146 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java | SpaceRepository.destroy | public void destroy() {
// Unregister from Hazelcast layer.
synchronized (getSpaceIDsMutex()) {
if (this.internalListener != null) {
this.spaceIDs.removeDMapListener(this.internalListener);
}
// Delete the spaces. If this function is called, it
// means that the spaces seems to have no more participant.
// The process cannot be done through hazelcast.
final List<SpaceID> ids = new ArrayList<>(this.spaceIDs.keySet());
this.spaceIDs.clear();
for (final SpaceID spaceId : ids) {
removeLocalSpaceDefinition(spaceId, true);
}
}
} | java | public void destroy() {
// Unregister from Hazelcast layer.
synchronized (getSpaceIDsMutex()) {
if (this.internalListener != null) {
this.spaceIDs.removeDMapListener(this.internalListener);
}
// Delete the spaces. If this function is called, it
// means that the spaces seems to have no more participant.
// The process cannot be done through hazelcast.
final List<SpaceID> ids = new ArrayList<>(this.spaceIDs.keySet());
this.spaceIDs.clear();
for (final SpaceID spaceId : ids) {
removeLocalSpaceDefinition(spaceId, true);
}
}
} | [
"public",
"void",
"destroy",
"(",
")",
"{",
"// Unregister from Hazelcast layer.",
"synchronized",
"(",
"getSpaceIDsMutex",
"(",
")",
")",
"{",
"if",
"(",
"this",
".",
"internalListener",
"!=",
"null",
")",
"{",
"this",
".",
"spaceIDs",
".",
"removeDMapListener"... | Destroy this repository and releaqse all the resources. | [
"Destroy",
"this",
"repository",
"and",
"releaqse",
"all",
"the",
"resources",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L149-L164 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java | SpaceRepository.ensureLocalSpaceDefinition | @SuppressWarnings({ "unchecked", "rawtypes" })
protected void ensureLocalSpaceDefinition(SpaceID id, Object[] initializationParameters) {
synchronized (getSpaceRepositoryMutex()) {
if (!this.spaces.containsKey(id)) {
createSpaceInstance((Class) id.getSpaceSpecification(), id, false, initializationParameters);
}
}
} | java | @SuppressWarnings({ "unchecked", "rawtypes" })
protected void ensureLocalSpaceDefinition(SpaceID id, Object[] initializationParameters) {
synchronized (getSpaceRepositoryMutex()) {
if (!this.spaces.containsKey(id)) {
createSpaceInstance((Class) id.getSpaceSpecification(), id, false, initializationParameters);
}
}
} | [
"@",
"SuppressWarnings",
"(",
"{",
"\"unchecked\"",
",",
"\"rawtypes\"",
"}",
")",
"protected",
"void",
"ensureLocalSpaceDefinition",
"(",
"SpaceID",
"id",
",",
"Object",
"[",
"]",
"initializationParameters",
")",
"{",
"synchronized",
"(",
"getSpaceRepositoryMutex",
... | Add the existing, but not yet known, spaces into this repository.
@param id identifier of the space
@param initializationParameters parameters for initialization. | [
"Add",
"the",
"existing",
"but",
"not",
"yet",
"known",
"spaces",
"into",
"this",
"repository",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L209-L216 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java | SpaceRepository.removeLocalSpaceDefinition | protected void removeLocalSpaceDefinition(SpaceID id, boolean isLocalDestruction) {
final Space space;
synchronized (getSpaceRepositoryMutex()) {
space = this.spaces.remove(id);
if (space != null) {
this.spacesBySpec.remove(id.getSpaceSpecification(), id);
}
}
if (space != null) {
fireSpaceRemoved(space, isLocalDestruction);
}
} | java | protected void removeLocalSpaceDefinition(SpaceID id, boolean isLocalDestruction) {
final Space space;
synchronized (getSpaceRepositoryMutex()) {
space = this.spaces.remove(id);
if (space != null) {
this.spacesBySpec.remove(id.getSpaceSpecification(), id);
}
}
if (space != null) {
fireSpaceRemoved(space, isLocalDestruction);
}
} | [
"protected",
"void",
"removeLocalSpaceDefinition",
"(",
"SpaceID",
"id",
",",
"boolean",
"isLocalDestruction",
")",
"{",
"final",
"Space",
"space",
";",
"synchronized",
"(",
"getSpaceRepositoryMutex",
"(",
")",
")",
"{",
"space",
"=",
"this",
".",
"spaces",
".",... | Remove a remote space.
@param id identifier of the space
@param isLocalDestruction indicates if the destruction is initiated by the local kernel. | [
"Remove",
"a",
"remote",
"space",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L224-L235 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java | SpaceRepository.removeLocalSpaceDefinitions | protected void removeLocalSpaceDefinitions(boolean isLocalDestruction) {
List<Space> removedSpaces = null;
synchronized (getSpaceRepositoryMutex()) {
if (!this.spaces.isEmpty()) {
removedSpaces = new ArrayList<>(this.spaces.size());
final Iterator<Entry<SpaceID, Space>> iterator = this.spaces.entrySet().iterator();
Space space;
SpaceID id;
while (iterator.hasNext()) {
final Entry<SpaceID, Space> entry = iterator.next();
id = entry.getKey();
space = entry.getValue();
iterator.remove();
this.spacesBySpec.remove(id.getSpaceSpecification(), id);
removedSpaces.add(space);
}
}
}
if (removedSpaces != null) {
for (final Space s : removedSpaces) {
fireSpaceRemoved(s, isLocalDestruction);
}
}
} | java | protected void removeLocalSpaceDefinitions(boolean isLocalDestruction) {
List<Space> removedSpaces = null;
synchronized (getSpaceRepositoryMutex()) {
if (!this.spaces.isEmpty()) {
removedSpaces = new ArrayList<>(this.spaces.size());
final Iterator<Entry<SpaceID, Space>> iterator = this.spaces.entrySet().iterator();
Space space;
SpaceID id;
while (iterator.hasNext()) {
final Entry<SpaceID, Space> entry = iterator.next();
id = entry.getKey();
space = entry.getValue();
iterator.remove();
this.spacesBySpec.remove(id.getSpaceSpecification(), id);
removedSpaces.add(space);
}
}
}
if (removedSpaces != null) {
for (final Space s : removedSpaces) {
fireSpaceRemoved(s, isLocalDestruction);
}
}
} | [
"protected",
"void",
"removeLocalSpaceDefinitions",
"(",
"boolean",
"isLocalDestruction",
")",
"{",
"List",
"<",
"Space",
">",
"removedSpaces",
"=",
"null",
";",
"synchronized",
"(",
"getSpaceRepositoryMutex",
"(",
")",
")",
"{",
"if",
"(",
"!",
"this",
".",
"... | Remove all the remote spaces.
@param isLocalDestruction indicates if the destruction is initiated by the local kernel. | [
"Remove",
"all",
"the",
"remote",
"spaces",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L242-L265 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java | SpaceRepository.createSpace | public <S extends io.sarl.lang.core.Space> S createSpace(SpaceID spaceID,
Class<? extends SpaceSpecification<S>> spec, Object... creationParams) {
synchronized (getSpaceRepositoryMutex()) {
if (!this.spaces.containsKey(spaceID)) {
return createSpaceInstance(spec, spaceID, true, creationParams);
}
}
return null;
} | java | public <S extends io.sarl.lang.core.Space> S createSpace(SpaceID spaceID,
Class<? extends SpaceSpecification<S>> spec, Object... creationParams) {
synchronized (getSpaceRepositoryMutex()) {
if (!this.spaces.containsKey(spaceID)) {
return createSpaceInstance(spec, spaceID, true, creationParams);
}
}
return null;
} | [
"public",
"<",
"S",
"extends",
"io",
".",
"sarl",
".",
"lang",
".",
"core",
".",
"Space",
">",
"S",
"createSpace",
"(",
"SpaceID",
"spaceID",
",",
"Class",
"<",
"?",
"extends",
"SpaceSpecification",
"<",
"S",
">",
">",
"spec",
",",
"Object",
"...",
"... | Create a space.
@param <S> - the type of the space to reply.
@param spaceID ID of the space.
@param spec specification of the space.
@param creationParams creation parameters.
@return the new space, or <code>null</code> if the space already exists. | [
"Create",
"a",
"space",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L276-L284 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java | SpaceRepository.getOrCreateSpaceWithSpec | @SuppressWarnings("unchecked")
public <S extends io.sarl.lang.core.Space> S getOrCreateSpaceWithSpec(SpaceID spaceID,
Class<? extends SpaceSpecification<S>> spec, Object... creationParams) {
synchronized (getSpaceRepositoryMutex()) {
final Collection<SpaceID> ispaces = this.spacesBySpec.get(spec);
final S firstSpace;
if (ispaces == null || ispaces.isEmpty()) {
firstSpace = createSpaceInstance(spec, spaceID, true, creationParams);
} else {
firstSpace = (S) this.spaces.get(ispaces.iterator().next());
}
assert firstSpace != null;
return firstSpace;
}
} | java | @SuppressWarnings("unchecked")
public <S extends io.sarl.lang.core.Space> S getOrCreateSpaceWithSpec(SpaceID spaceID,
Class<? extends SpaceSpecification<S>> spec, Object... creationParams) {
synchronized (getSpaceRepositoryMutex()) {
final Collection<SpaceID> ispaces = this.spacesBySpec.get(spec);
final S firstSpace;
if (ispaces == null || ispaces.isEmpty()) {
firstSpace = createSpaceInstance(spec, spaceID, true, creationParams);
} else {
firstSpace = (S) this.spaces.get(ispaces.iterator().next());
}
assert firstSpace != null;
return firstSpace;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"S",
"extends",
"io",
".",
"sarl",
".",
"lang",
".",
"core",
".",
"Space",
">",
"S",
"getOrCreateSpaceWithSpec",
"(",
"SpaceID",
"spaceID",
",",
"Class",
"<",
"?",
"extends",
"SpaceSpecificat... | Retrieve the first space of the given specification, or create a space if none.
@param <S> - the type of the space to reply.
@param spaceID ID of the space (used only when creating a space).
@param spec specification of the space.
@param creationParams creation parameters (used only when creating a space).
@return the new space. | [
"Retrieve",
"the",
"first",
"space",
"of",
"the",
"given",
"specification",
"or",
"create",
"a",
"space",
"if",
"none",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L295-L309 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java | SpaceRepository.getOrCreateSpaceWithID | @SuppressWarnings("unchecked")
public <S extends io.sarl.lang.core.Space> S getOrCreateSpaceWithID(SpaceID spaceID,
Class<? extends SpaceSpecification<S>> spec, Object... creationParams) {
synchronized (getSpaceRepositoryMutex()) {
Space space = this.spaces.get(spaceID);
if (space == null) {
space = createSpaceInstance(spec, spaceID, true, creationParams);
}
assert space != null;
return (S) space;
}
} | java | @SuppressWarnings("unchecked")
public <S extends io.sarl.lang.core.Space> S getOrCreateSpaceWithID(SpaceID spaceID,
Class<? extends SpaceSpecification<S>> spec, Object... creationParams) {
synchronized (getSpaceRepositoryMutex()) {
Space space = this.spaces.get(spaceID);
if (space == null) {
space = createSpaceInstance(spec, spaceID, true, creationParams);
}
assert space != null;
return (S) space;
}
} | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"<",
"S",
"extends",
"io",
".",
"sarl",
".",
"lang",
".",
"core",
".",
"Space",
">",
"S",
"getOrCreateSpaceWithID",
"(",
"SpaceID",
"spaceID",
",",
"Class",
"<",
"?",
"extends",
"SpaceSpecificatio... | Retrieve the first space of the given identifier, or create a space if none.
@param <S> - the type of the space to reply.
@param spaceID ID of the space.
@param spec specification of the space.
@param creationParams creation parameters (used only when creating a space).
@return the new space. | [
"Retrieve",
"the",
"first",
"space",
"of",
"the",
"given",
"identifier",
"or",
"create",
"a",
"space",
"if",
"none",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L320-L331 | train |
sarl/sarl | sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java | SpaceRepository.getSpaces | public SynchronizedCollection<? extends Space> getSpaces() {
synchronized (getSpaceRepositoryMutex()) {
return Collections3.synchronizedCollection(Collections.unmodifiableCollection(this.spaces.values()),
getSpaceRepositoryMutex());
}
} | java | public SynchronizedCollection<? extends Space> getSpaces() {
synchronized (getSpaceRepositoryMutex()) {
return Collections3.synchronizedCollection(Collections.unmodifiableCollection(this.spaces.values()),
getSpaceRepositoryMutex());
}
} | [
"public",
"SynchronizedCollection",
"<",
"?",
"extends",
"Space",
">",
"getSpaces",
"(",
")",
"{",
"synchronized",
"(",
"getSpaceRepositoryMutex",
"(",
")",
")",
"{",
"return",
"Collections3",
".",
"synchronizedCollection",
"(",
"Collections",
".",
"unmodifiableColl... | Returns the collection of all spaces stored in this repository.
@return the collection of all spaces stored in this repository. | [
"Returns",
"the",
"collection",
"of",
"all",
"spaces",
"stored",
"in",
"this",
"repository",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/contextspace/SpaceRepository.java#L338-L343 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/AbstractSREInstall.java | AbstractSREInstall.revalidate | protected IStatus revalidate(int ignoreCauses) {
try {
setDirty(false);
resolveDirtyFields(false);
return getValidity(ignoreCauses);
} catch (Throwable e) {
if ((ignoreCauses & CODE_GENERAL) == 0) {
return SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, CODE_GENERAL, e);
}
return SARLEclipsePlugin.getDefault().createOkStatus();
}
} | java | protected IStatus revalidate(int ignoreCauses) {
try {
setDirty(false);
resolveDirtyFields(false);
return getValidity(ignoreCauses);
} catch (Throwable e) {
if ((ignoreCauses & CODE_GENERAL) == 0) {
return SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, CODE_GENERAL, e);
}
return SARLEclipsePlugin.getDefault().createOkStatus();
}
} | [
"protected",
"IStatus",
"revalidate",
"(",
"int",
"ignoreCauses",
")",
"{",
"try",
"{",
"setDirty",
"(",
"false",
")",
";",
"resolveDirtyFields",
"(",
"false",
")",
";",
"return",
"getValidity",
"(",
"ignoreCauses",
")",
";",
"}",
"catch",
"(",
"Throwable",
... | Force the computation of the installation validity.
@param ignoreCauses a set of bits that indicates the invalidity causes to ignore.
@return the validity status. | [
"Force",
"the",
"computation",
"of",
"the",
"installation",
"validity",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/AbstractSREInstall.java#L167-L178 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/AbstractSREInstall.java | AbstractSREInstall.setClassPathEntries | @Override
public void setClassPathEntries(List<IRuntimeClasspathEntry> libraries) {
if (isDirty()) {
setDirty(false);
resolveDirtyFields(true);
}
if ((libraries == null && this.classPathEntries != null)
|| (libraries != null
&& (this.classPathEntries == null
|| libraries != this.classPathEntries))) {
final PropertyChangeEvent event = new PropertyChangeEvent(
this, ISREInstallChangedListener.PROPERTY_LIBRARY_LOCATIONS,
this.classPathEntries, libraries);
this.classPathEntries = libraries;
if (this.notify) {
SARLRuntime.fireSREChanged(event);
}
}
} | java | @Override
public void setClassPathEntries(List<IRuntimeClasspathEntry> libraries) {
if (isDirty()) {
setDirty(false);
resolveDirtyFields(true);
}
if ((libraries == null && this.classPathEntries != null)
|| (libraries != null
&& (this.classPathEntries == null
|| libraries != this.classPathEntries))) {
final PropertyChangeEvent event = new PropertyChangeEvent(
this, ISREInstallChangedListener.PROPERTY_LIBRARY_LOCATIONS,
this.classPathEntries, libraries);
this.classPathEntries = libraries;
if (this.notify) {
SARLRuntime.fireSREChanged(event);
}
}
} | [
"@",
"Override",
"public",
"void",
"setClassPathEntries",
"(",
"List",
"<",
"IRuntimeClasspathEntry",
">",
"libraries",
")",
"{",
"if",
"(",
"isDirty",
"(",
")",
")",
"{",
"setDirty",
"(",
"false",
")",
";",
"resolveDirtyFields",
"(",
"true",
")",
";",
"}"... | Change the library locations of this ISREInstall.
@param libraries The library locations of this ISREInstall.
Must not be <code>null</code>. | [
"Change",
"the",
"library",
"locations",
"of",
"this",
"ISREInstall",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/AbstractSREInstall.java#L356-L374 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/AbstractSREInstall.java | AbstractSREInstall.formatCommandLineOption | protected static String formatCommandLineOption(String name, String value) {
final StringBuilder str = new StringBuilder();
str.append("--"); //$NON-NLS-1$
if (!Strings.isNullOrEmpty(name)) {
str.append(name);
if (!Strings.isNullOrEmpty(value)) {
str.append("="); //$NON-NLS-1$
str.append(value);
}
}
return str.toString();
} | java | protected static String formatCommandLineOption(String name, String value) {
final StringBuilder str = new StringBuilder();
str.append("--"); //$NON-NLS-1$
if (!Strings.isNullOrEmpty(name)) {
str.append(name);
if (!Strings.isNullOrEmpty(value)) {
str.append("="); //$NON-NLS-1$
str.append(value);
}
}
return str.toString();
} | [
"protected",
"static",
"String",
"formatCommandLineOption",
"(",
"String",
"name",
",",
"String",
"value",
")",
"{",
"final",
"StringBuilder",
"str",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"str",
".",
"append",
"(",
"\"--\"",
")",
";",
"//$NON-NLS-1$",
... | Replies the string representation of a command-line option.
@param name the name of the option.
@param value the value to put in the command-line.
@return the string representation of the command-line option. | [
"Replies",
"the",
"string",
"representation",
"of",
"a",
"command",
"-",
"line",
"option",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/AbstractSREInstall.java#L497-L508 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastedExpressionTypeComputationState.java | CastedExpressionTypeComputationState.isCastOperatorLinkingEnabled | public boolean isCastOperatorLinkingEnabled(SarlCastedExpression cast) {
final LightweightTypeReference sourceType = getStackedResolvedTypes().getReturnType(cast.getTarget());
final LightweightTypeReference destinationType = getReferenceOwner().toLightweightTypeReference(cast.getType());
if (sourceType.isPrimitiveVoid() || destinationType.isPrimitiveVoid()) {
return false;
}
if (sourceType.isPrimitive() && destinationType.isPrimitive()) {
return false;
}
return !sourceType.isSubtypeOf(destinationType.getType());
} | java | public boolean isCastOperatorLinkingEnabled(SarlCastedExpression cast) {
final LightweightTypeReference sourceType = getStackedResolvedTypes().getReturnType(cast.getTarget());
final LightweightTypeReference destinationType = getReferenceOwner().toLightweightTypeReference(cast.getType());
if (sourceType.isPrimitiveVoid() || destinationType.isPrimitiveVoid()) {
return false;
}
if (sourceType.isPrimitive() && destinationType.isPrimitive()) {
return false;
}
return !sourceType.isSubtypeOf(destinationType.getType());
} | [
"public",
"boolean",
"isCastOperatorLinkingEnabled",
"(",
"SarlCastedExpression",
"cast",
")",
"{",
"final",
"LightweightTypeReference",
"sourceType",
"=",
"getStackedResolvedTypes",
"(",
")",
".",
"getReturnType",
"(",
"cast",
".",
"getTarget",
"(",
")",
")",
";",
... | Replies if the linking to the cast operator functions is enabled.
@param cast the cast operator.
@return {@code true} if the linking is enabled. | [
"Replies",
"if",
"the",
"linking",
"to",
"the",
"cast",
"operator",
"functions",
"is",
"enabled",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastedExpressionTypeComputationState.java#L93-L103 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastedExpressionTypeComputationState.java | CastedExpressionTypeComputationState.getLinkingCandidates | public List<? extends ILinkingCandidate> getLinkingCandidates(SarlCastedExpression cast) {
// Prepare the type resolver.
final StackedResolvedTypes demandComputedTypes = pushTypes();
final AbstractTypeComputationState forked = withNonVoidExpectation(demandComputedTypes);
final ForwardingResolvedTypes demandResolvedTypes = new ForwardingResolvedTypes() {
@Override
protected IResolvedTypes delegate() {
return forked.getResolvedTypes();
}
@Override
public LightweightTypeReference getActualType(XExpression expression) {
final LightweightTypeReference type = super.getActualType(expression);
if (type == null) {
final ITypeComputationResult result = forked.computeTypes(expression);
return result.getActualExpressionType();
}
return type;
}
};
// Create the scope
final IScope scope = getCastScopeSession().getScope(cast,
// Must be the feature of the AbstractFeatureCall in order to enable the scoping for a function call.
//XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE,
SarlPackage.Literals.SARL_CASTED_EXPRESSION__FEATURE,
demandResolvedTypes);
// Search for the features into the scope
final LightweightTypeReference targetType = getReferenceOwner().toLightweightTypeReference(cast.getType());
final List<ILinkingCandidate> resultList = Lists.newArrayList();
final LightweightTypeReference expressionType = getStackedResolvedTypes().getActualType(cast.getTarget());
final ISelector validator = this.candidateValidator.prepare(
getParent(), targetType, expressionType);
// FIXME: The call to getAllElements() is not efficient; find another way in order to be faster.
for (final IEObjectDescription description : scope.getAllElements()) {
final IIdentifiableElementDescription idesc = toIdentifiableDescription(description);
if (validator.isCastOperatorCandidate(idesc)) {
final ExpressionAwareStackedResolvedTypes descriptionResolvedTypes = pushTypes(cast);
final ExpressionTypeComputationState descriptionState = createExpressionComputationState(cast, descriptionResolvedTypes);
final ILinkingCandidate candidate = createCandidate(cast, descriptionState, idesc);
if (candidate != null) {
resultList.add(candidate);
}
}
}
return resultList;
} | java | public List<? extends ILinkingCandidate> getLinkingCandidates(SarlCastedExpression cast) {
// Prepare the type resolver.
final StackedResolvedTypes demandComputedTypes = pushTypes();
final AbstractTypeComputationState forked = withNonVoidExpectation(demandComputedTypes);
final ForwardingResolvedTypes demandResolvedTypes = new ForwardingResolvedTypes() {
@Override
protected IResolvedTypes delegate() {
return forked.getResolvedTypes();
}
@Override
public LightweightTypeReference getActualType(XExpression expression) {
final LightweightTypeReference type = super.getActualType(expression);
if (type == null) {
final ITypeComputationResult result = forked.computeTypes(expression);
return result.getActualExpressionType();
}
return type;
}
};
// Create the scope
final IScope scope = getCastScopeSession().getScope(cast,
// Must be the feature of the AbstractFeatureCall in order to enable the scoping for a function call.
//XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE,
SarlPackage.Literals.SARL_CASTED_EXPRESSION__FEATURE,
demandResolvedTypes);
// Search for the features into the scope
final LightweightTypeReference targetType = getReferenceOwner().toLightweightTypeReference(cast.getType());
final List<ILinkingCandidate> resultList = Lists.newArrayList();
final LightweightTypeReference expressionType = getStackedResolvedTypes().getActualType(cast.getTarget());
final ISelector validator = this.candidateValidator.prepare(
getParent(), targetType, expressionType);
// FIXME: The call to getAllElements() is not efficient; find another way in order to be faster.
for (final IEObjectDescription description : scope.getAllElements()) {
final IIdentifiableElementDescription idesc = toIdentifiableDescription(description);
if (validator.isCastOperatorCandidate(idesc)) {
final ExpressionAwareStackedResolvedTypes descriptionResolvedTypes = pushTypes(cast);
final ExpressionTypeComputationState descriptionState = createExpressionComputationState(cast, descriptionResolvedTypes);
final ILinkingCandidate candidate = createCandidate(cast, descriptionState, idesc);
if (candidate != null) {
resultList.add(candidate);
}
}
}
return resultList;
} | [
"public",
"List",
"<",
"?",
"extends",
"ILinkingCandidate",
">",
"getLinkingCandidates",
"(",
"SarlCastedExpression",
"cast",
")",
"{",
"// Prepare the type resolver.",
"final",
"StackedResolvedTypes",
"demandComputedTypes",
"=",
"pushTypes",
"(",
")",
";",
"final",
"Ab... | Compute the best candidates for the feature behind the cast operator.
@param cast the cast operator.
@return the candidates. | [
"Compute",
"the",
"best",
"candidates",
"for",
"the",
"feature",
"behind",
"the",
"cast",
"operator",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastedExpressionTypeComputationState.java#L110-L158 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastedExpressionTypeComputationState.java | CastedExpressionTypeComputationState.createCandidate | protected ILinkingCandidate createCandidate(SarlCastedExpression cast,
ExpressionTypeComputationState state,
IIdentifiableElementDescription description) {
return new CastOperatorLinkingCandidate(cast, description,
getSingleExpectation(state),
state);
} | java | protected ILinkingCandidate createCandidate(SarlCastedExpression cast,
ExpressionTypeComputationState state,
IIdentifiableElementDescription description) {
return new CastOperatorLinkingCandidate(cast, description,
getSingleExpectation(state),
state);
} | [
"protected",
"ILinkingCandidate",
"createCandidate",
"(",
"SarlCastedExpression",
"cast",
",",
"ExpressionTypeComputationState",
"state",
",",
"IIdentifiableElementDescription",
"description",
")",
"{",
"return",
"new",
"CastOperatorLinkingCandidate",
"(",
"cast",
",",
"descr... | Create a candidate from the given description.
@param cast the cast operator.
@param state the state
@param description the description of the cast linked operation.
@return the linking candidate. | [
"Create",
"a",
"candidate",
"from",
"the",
"given",
"description",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastedExpressionTypeComputationState.java#L175-L181 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastedExpressionTypeComputationState.java | CastedExpressionTypeComputationState.resetFeature | @SuppressWarnings("static-method")
public void resetFeature(SarlCastedExpression object) {
setStructuralFeature(object, SarlPackage.Literals.SARL_CASTED_EXPRESSION__FEATURE, null);
setStructuralFeature(object, SarlPackage.Literals.SARL_CASTED_EXPRESSION__RECEIVER, null);
setStructuralFeature(object, SarlPackage.Literals.SARL_CASTED_EXPRESSION__ARGUMENT, null);
} | java | @SuppressWarnings("static-method")
public void resetFeature(SarlCastedExpression object) {
setStructuralFeature(object, SarlPackage.Literals.SARL_CASTED_EXPRESSION__FEATURE, null);
setStructuralFeature(object, SarlPackage.Literals.SARL_CASTED_EXPRESSION__RECEIVER, null);
setStructuralFeature(object, SarlPackage.Literals.SARL_CASTED_EXPRESSION__ARGUMENT, null);
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"public",
"void",
"resetFeature",
"(",
"SarlCastedExpression",
"object",
")",
"{",
"setStructuralFeature",
"(",
"object",
",",
"SarlPackage",
".",
"Literals",
".",
"SARL_CASTED_EXPRESSION__FEATURE",
",",
"null",
... | Reset the properties of the given feature in order to have casted expression that is not linked
to an operation.
@param object the expression to reset. | [
"Reset",
"the",
"properties",
"of",
"the",
"given",
"feature",
"in",
"order",
"to",
"have",
"casted",
"expression",
"that",
"is",
"not",
"linked",
"to",
"an",
"operation",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastedExpressionTypeComputationState.java#L188-L193 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/SARLSourceViewer.java | SARLSourceViewer.getDocumentAutoFormatter | public IDocumentAutoFormatter getDocumentAutoFormatter() {
final IDocument document = getDocument();
if (document instanceof IXtextDocument) {
final IDocumentAutoFormatter formatter = this.autoFormatterProvider.get();
formatter.bind((IXtextDocument) document, this.fContentFormatter);
return formatter;
}
return new IDocumentAutoFormatter() {
//
};
} | java | public IDocumentAutoFormatter getDocumentAutoFormatter() {
final IDocument document = getDocument();
if (document instanceof IXtextDocument) {
final IDocumentAutoFormatter formatter = this.autoFormatterProvider.get();
formatter.bind((IXtextDocument) document, this.fContentFormatter);
return formatter;
}
return new IDocumentAutoFormatter() {
//
};
} | [
"public",
"IDocumentAutoFormatter",
"getDocumentAutoFormatter",
"(",
")",
"{",
"final",
"IDocument",
"document",
"=",
"getDocument",
"(",
")",
";",
"if",
"(",
"document",
"instanceof",
"IXtextDocument",
")",
"{",
"final",
"IDocumentAutoFormatter",
"formatter",
"=",
... | Replies the document auto-formatter.
@return the service. | [
"Replies",
"the",
"document",
"auto",
"-",
"formatter",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/editor/SARLSourceViewer.java#L85-L95 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlFieldBuilderImpl.java | SarlFieldBuilderImpl.getInitialValue | @Pure
public IExpressionBuilder getInitialValue() {
IExpressionBuilder exprBuilder = this.expressionProvider.get();
exprBuilder.eInit(getSarlField(), new Procedures.Procedure1<XExpression>() {
public void apply(XExpression expr) {
getSarlField().setInitialValue(expr);
}
}, getTypeResolutionContext());
return exprBuilder;
} | java | @Pure
public IExpressionBuilder getInitialValue() {
IExpressionBuilder exprBuilder = this.expressionProvider.get();
exprBuilder.eInit(getSarlField(), new Procedures.Procedure1<XExpression>() {
public void apply(XExpression expr) {
getSarlField().setInitialValue(expr);
}
}, getTypeResolutionContext());
return exprBuilder;
} | [
"@",
"Pure",
"public",
"IExpressionBuilder",
"getInitialValue",
"(",
")",
"{",
"IExpressionBuilder",
"exprBuilder",
"=",
"this",
".",
"expressionProvider",
".",
"get",
"(",
")",
";",
"exprBuilder",
".",
"eInit",
"(",
"getSarlField",
"(",
")",
",",
"new",
"Proc... | Change the initialValue.
@param value the value of the initialValue. It may be <code>null</code>. | [
"Change",
"the",
"initialValue",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlFieldBuilderImpl.java#L129-L138 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.setOutlineEntryFormat | public void setOutlineEntryFormat(String formatWithoutNumbers, String formatWithNumbers) {
if (!Strings.isEmpty(formatWithoutNumbers)) {
this.outlineEntryWithoutNumberFormat = formatWithoutNumbers;
}
if (!Strings.isEmpty(formatWithNumbers)) {
this.outlineEntryWithNumberFormat = formatWithNumbers;
}
} | java | public void setOutlineEntryFormat(String formatWithoutNumbers, String formatWithNumbers) {
if (!Strings.isEmpty(formatWithoutNumbers)) {
this.outlineEntryWithoutNumberFormat = formatWithoutNumbers;
}
if (!Strings.isEmpty(formatWithNumbers)) {
this.outlineEntryWithNumberFormat = formatWithNumbers;
}
} | [
"public",
"void",
"setOutlineEntryFormat",
"(",
"String",
"formatWithoutNumbers",
",",
"String",
"formatWithNumbers",
")",
"{",
"if",
"(",
"!",
"Strings",
".",
"isEmpty",
"(",
"formatWithoutNumbers",
")",
")",
"{",
"this",
".",
"outlineEntryWithoutNumberFormat",
"="... | Change the formats to be applied to the outline entries.
<p>The format must be compatible with {@link MessageFormat}.
<p>If section auto-numbering is on,
the first parameter <code>{0}</code> equals to the prefix,
the second parameter <code>{1}</code> equals to the string representation of the section number,
the third parameter <code>{2}</code> equals to the title text, and the fourth parameter
<code>{3}</code> is the reference id of the section.
<p>If section auto-numbering is off,
the first parameter <code>{0}</code> equals to the prefix,
the second parameter <code>{1}</code> equals to the title text, and the third parameter
<code>{2}</code> is the reference id of the section.
@param formatWithoutNumbers the format for the outline entries without section numbers.
@param formatWithNumbers the format for the outline entries with section numbers. | [
"Change",
"the",
"formats",
"to",
"be",
"applied",
"to",
"the",
"outline",
"entries",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L330-L337 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.setOutlineDepthRange | public void setOutlineDepthRange(IntegerRange level) {
if (level == null) {
this.outlineDepthRange = new IntegerRange(DEFAULT_OUTLINE_TOP_LEVEL, DEFAULT_OUTLINE_TOP_LEVEL);
} else {
this.outlineDepthRange = level;
}
} | java | public void setOutlineDepthRange(IntegerRange level) {
if (level == null) {
this.outlineDepthRange = new IntegerRange(DEFAULT_OUTLINE_TOP_LEVEL, DEFAULT_OUTLINE_TOP_LEVEL);
} else {
this.outlineDepthRange = level;
}
} | [
"public",
"void",
"setOutlineDepthRange",
"(",
"IntegerRange",
"level",
")",
"{",
"if",
"(",
"level",
"==",
"null",
")",
"{",
"this",
".",
"outlineDepthRange",
"=",
"new",
"IntegerRange",
"(",
"DEFAULT_OUTLINE_TOP_LEVEL",
",",
"DEFAULT_OUTLINE_TOP_LEVEL",
")",
";"... | Change the level at which the titles may appear in the outline.
@param level the level, at least 1. | [
"Change",
"the",
"level",
"at",
"which",
"the",
"titles",
"may",
"appear",
"in",
"the",
"outline",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L420-L426 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.extractReferencableElements | @SuppressWarnings("static-method")
protected ReferenceContext extractReferencableElements(String text) {
final ReferenceContext context = new ReferenceContext();
// Visit the links and record the transformations
final MutableDataSet options = new MutableDataSet();
final Parser parser = Parser.builder(options).build();
final Node document = parser.parse(text);
final Pattern pattern = Pattern.compile(SECTION_PATTERN_AUTONUMBERING);
NodeVisitor visitor = new NodeVisitor(
new VisitHandler<>(Paragraph.class, it -> {
final Matcher matcher = pattern.matcher(it.getContentChars());
if (matcher.find()) {
final String number = matcher.group(2);
final String title = matcher.group(3);
final String key1 = computeHeaderId(number, title);
final String key2 = computeHeaderId(null, title);
context.registerSection(key1, key2, title);
}
}));
visitor.visitChildren(document);
visitor = new NodeVisitor(
new VisitHandler<>(Heading.class, it -> {
String key = it.getAnchorRefId();
final String title = it.getAnchorRefText();
final String key2 = computeHeaderId(null, title);
if (Strings.isEmpty(key)) {
key = key2;
}
context.registerSection(key, key2, title);
}));
visitor.visitChildren(document);
return context;
} | java | @SuppressWarnings("static-method")
protected ReferenceContext extractReferencableElements(String text) {
final ReferenceContext context = new ReferenceContext();
// Visit the links and record the transformations
final MutableDataSet options = new MutableDataSet();
final Parser parser = Parser.builder(options).build();
final Node document = parser.parse(text);
final Pattern pattern = Pattern.compile(SECTION_PATTERN_AUTONUMBERING);
NodeVisitor visitor = new NodeVisitor(
new VisitHandler<>(Paragraph.class, it -> {
final Matcher matcher = pattern.matcher(it.getContentChars());
if (matcher.find()) {
final String number = matcher.group(2);
final String title = matcher.group(3);
final String key1 = computeHeaderId(number, title);
final String key2 = computeHeaderId(null, title);
context.registerSection(key1, key2, title);
}
}));
visitor.visitChildren(document);
visitor = new NodeVisitor(
new VisitHandler<>(Heading.class, it -> {
String key = it.getAnchorRefId();
final String title = it.getAnchorRefText();
final String key2 = computeHeaderId(null, title);
if (Strings.isEmpty(key)) {
key = key2;
}
context.registerSection(key, key2, title);
}));
visitor.visitChildren(document);
return context;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"ReferenceContext",
"extractReferencableElements",
"(",
"String",
"text",
")",
"{",
"final",
"ReferenceContext",
"context",
"=",
"new",
"ReferenceContext",
"(",
")",
";",
"// Visit the links and record t... | Extract all the referencable objects from the given content.
@param text the content to parse.
@return the referencables objects | [
"Extract",
"all",
"the",
"referencable",
"objects",
"from",
"the",
"given",
"content",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L511-L546 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.transformHtmlLinks | protected String transformHtmlLinks(String content, ReferenceContext references) {
if (!isPureHtmlReferenceTransformation()) {
return content;
}
// Prepare replacement data structures
final Map<String, String> replacements = new TreeMap<>();
// Visit the links and record the transformations
final org.jsoup.select.NodeVisitor visitor = new org.jsoup.select.NodeVisitor() {
@Override
public void tail(org.jsoup.nodes.Node node, int index) {
//
}
@Override
public void head(org.jsoup.nodes.Node node, int index) {
if (node instanceof Element) {
final Element tag = (Element) node;
if ("a".equals(tag.nodeName()) && tag.hasAttr("href")) { //$NON-NLS-1$ //$NON-NLS-2$
final String href = tag.attr("href"); //$NON-NLS-1$
if (!Strings.isEmpty(href)) {
URL url = FileSystem.convertStringToURL(href, true);
url = transformURL(url, references);
if (url != null) {
replacements.put(href, convertURLToString(url));
}
}
}
}
}
};
final Document htmlDocument = Jsoup.parse(content);
htmlDocument.traverse(visitor);
// Apply the replacements
if (!replacements.isEmpty()) {
String buffer = content;
for (final Entry<String, String> entry : replacements.entrySet()) {
final String source = entry.getKey();
final String dest = entry.getValue();
buffer = buffer.replaceAll(Pattern.quote(source), Matcher.quoteReplacement(dest));
}
return buffer;
}
return content;
} | java | protected String transformHtmlLinks(String content, ReferenceContext references) {
if (!isPureHtmlReferenceTransformation()) {
return content;
}
// Prepare replacement data structures
final Map<String, String> replacements = new TreeMap<>();
// Visit the links and record the transformations
final org.jsoup.select.NodeVisitor visitor = new org.jsoup.select.NodeVisitor() {
@Override
public void tail(org.jsoup.nodes.Node node, int index) {
//
}
@Override
public void head(org.jsoup.nodes.Node node, int index) {
if (node instanceof Element) {
final Element tag = (Element) node;
if ("a".equals(tag.nodeName()) && tag.hasAttr("href")) { //$NON-NLS-1$ //$NON-NLS-2$
final String href = tag.attr("href"); //$NON-NLS-1$
if (!Strings.isEmpty(href)) {
URL url = FileSystem.convertStringToURL(href, true);
url = transformURL(url, references);
if (url != null) {
replacements.put(href, convertURLToString(url));
}
}
}
}
}
};
final Document htmlDocument = Jsoup.parse(content);
htmlDocument.traverse(visitor);
// Apply the replacements
if (!replacements.isEmpty()) {
String buffer = content;
for (final Entry<String, String> entry : replacements.entrySet()) {
final String source = entry.getKey();
final String dest = entry.getValue();
buffer = buffer.replaceAll(Pattern.quote(source), Matcher.quoteReplacement(dest));
}
return buffer;
}
return content;
} | [
"protected",
"String",
"transformHtmlLinks",
"(",
"String",
"content",
",",
"ReferenceContext",
"references",
")",
"{",
"if",
"(",
"!",
"isPureHtmlReferenceTransformation",
"(",
")",
")",
"{",
"return",
"content",
";",
"}",
"// Prepare replacement data structures",
"f... | Apply link transformation on the HTML links.
@param content the original content.
@param references the references into the document.
@return the result of the transformation. | [
"Apply",
"link",
"transformation",
"on",
"the",
"HTML",
"links",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L554-L600 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.transformMardownLinks | protected String transformMardownLinks(String content, ReferenceContext references) {
if (!isMarkdownToHtmlReferenceTransformation()) {
return content;
}
// Prepare replacement data structures
final Map<BasedSequence, String> replacements = new TreeMap<>((cmp1, cmp2) -> {
final int cmp = Integer.compare(cmp2.getStartOffset(), cmp1.getStartOffset());
if (cmp != 0) {
return cmp;
}
return Integer.compare(cmp2.getEndOffset(), cmp1.getEndOffset());
});
// Visit the links and record the transformations
final MutableDataSet options = new MutableDataSet();
final Parser parser = Parser.builder(options).build();
final Node document = parser.parse(content);
final NodeVisitor visitor = new NodeVisitor(
new VisitHandler<>(Link.class, it -> {
URL url = FileSystem.convertStringToURL(it.getUrl().toString(), true);
url = transformURL(url, references);
if (url != null) {
replacements.put(it.getUrl(), convertURLToString(url));
}
}));
visitor.visitChildren(document);
// Apply the replacements
if (!replacements.isEmpty()) {
final StringBuilder buffer = new StringBuilder(content);
for (final Entry<BasedSequence, String> entry : replacements.entrySet()) {
final BasedSequence seq = entry.getKey();
buffer.replace(seq.getStartOffset(), seq.getEndOffset(), entry.getValue());
}
return buffer.toString();
}
return content;
} | java | protected String transformMardownLinks(String content, ReferenceContext references) {
if (!isMarkdownToHtmlReferenceTransformation()) {
return content;
}
// Prepare replacement data structures
final Map<BasedSequence, String> replacements = new TreeMap<>((cmp1, cmp2) -> {
final int cmp = Integer.compare(cmp2.getStartOffset(), cmp1.getStartOffset());
if (cmp != 0) {
return cmp;
}
return Integer.compare(cmp2.getEndOffset(), cmp1.getEndOffset());
});
// Visit the links and record the transformations
final MutableDataSet options = new MutableDataSet();
final Parser parser = Parser.builder(options).build();
final Node document = parser.parse(content);
final NodeVisitor visitor = new NodeVisitor(
new VisitHandler<>(Link.class, it -> {
URL url = FileSystem.convertStringToURL(it.getUrl().toString(), true);
url = transformURL(url, references);
if (url != null) {
replacements.put(it.getUrl(), convertURLToString(url));
}
}));
visitor.visitChildren(document);
// Apply the replacements
if (!replacements.isEmpty()) {
final StringBuilder buffer = new StringBuilder(content);
for (final Entry<BasedSequence, String> entry : replacements.entrySet()) {
final BasedSequence seq = entry.getKey();
buffer.replace(seq.getStartOffset(), seq.getEndOffset(), entry.getValue());
}
return buffer.toString();
}
return content;
} | [
"protected",
"String",
"transformMardownLinks",
"(",
"String",
"content",
",",
"ReferenceContext",
"references",
")",
"{",
"if",
"(",
"!",
"isMarkdownToHtmlReferenceTransformation",
"(",
")",
")",
"{",
"return",
"content",
";",
"}",
"// Prepare replacement data structur... | Apply link transformation on the Markdown links.
@param content the original content.
@param references the references into the document.
@return the result of the transformation. | [
"Apply",
"link",
"transformation",
"on",
"the",
"Markdown",
"links",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L608-L646 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.convertURLToString | static String convertURLToString(URL url) {
if (URISchemeType.FILE.isURL(url)) {
final StringBuilder externalForm = new StringBuilder();
externalForm.append(url.getPath());
final String ref = url.getRef();
if (!Strings.isEmpty(ref)) {
externalForm.append("#").append(ref); //$NON-NLS-1$
}
return externalForm.toString();
}
return url.toExternalForm();
} | java | static String convertURLToString(URL url) {
if (URISchemeType.FILE.isURL(url)) {
final StringBuilder externalForm = new StringBuilder();
externalForm.append(url.getPath());
final String ref = url.getRef();
if (!Strings.isEmpty(ref)) {
externalForm.append("#").append(ref); //$NON-NLS-1$
}
return externalForm.toString();
}
return url.toExternalForm();
} | [
"static",
"String",
"convertURLToString",
"(",
"URL",
"url",
")",
"{",
"if",
"(",
"URISchemeType",
".",
"FILE",
".",
"isURL",
"(",
"url",
")",
")",
"{",
"final",
"StringBuilder",
"externalForm",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"externalForm",
"... | Convert the given URL to its string representation that is compatible with Markdown document linking mechanism.
@param url the URL to transform.
@return the sting representation of the URL. | [
"Convert",
"the",
"given",
"URL",
"to",
"its",
"string",
"representation",
"that",
"is",
"compatible",
"with",
"Markdown",
"document",
"linking",
"mechanism",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L653-L664 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.transformURL | protected URL transformURL(URL link, ReferenceContext references) {
if (URISchemeType.FILE.isURL(link)) {
File filename = FileSystem.convertURLToFile(link);
if (Strings.isEmpty(filename.getName())) {
// This is a link to the local document.
final String anchor = transformURLAnchor(filename, link.getRef(), references);
final URL url = FileSystemAddons.convertFileToURL(filename, true);
if (!Strings.isEmpty(anchor)) {
try {
return new URL(url.toExternalForm() + "#" + anchor); //$NON-NLS-1$
} catch (MalformedURLException e) {
//
}
}
return url;
}
// This is a link to another document.
final String extension = FileSystem.extension(filename);
if (isMarkdownFileExtension(extension)) {
filename = FileSystem.replaceExtension(filename, ".html"); //$NON-NLS-1$
final String anchor = transformURLAnchor(filename, link.getRef(), null);
final URL url = FileSystemAddons.convertFileToURL(filename, true);
if (!Strings.isEmpty(anchor)) {
try {
return new URL(url.toExternalForm() + "#" + anchor); //$NON-NLS-1$
} catch (MalformedURLException e) {
//
}
}
return url;
}
}
return null;
} | java | protected URL transformURL(URL link, ReferenceContext references) {
if (URISchemeType.FILE.isURL(link)) {
File filename = FileSystem.convertURLToFile(link);
if (Strings.isEmpty(filename.getName())) {
// This is a link to the local document.
final String anchor = transformURLAnchor(filename, link.getRef(), references);
final URL url = FileSystemAddons.convertFileToURL(filename, true);
if (!Strings.isEmpty(anchor)) {
try {
return new URL(url.toExternalForm() + "#" + anchor); //$NON-NLS-1$
} catch (MalformedURLException e) {
//
}
}
return url;
}
// This is a link to another document.
final String extension = FileSystem.extension(filename);
if (isMarkdownFileExtension(extension)) {
filename = FileSystem.replaceExtension(filename, ".html"); //$NON-NLS-1$
final String anchor = transformURLAnchor(filename, link.getRef(), null);
final URL url = FileSystemAddons.convertFileToURL(filename, true);
if (!Strings.isEmpty(anchor)) {
try {
return new URL(url.toExternalForm() + "#" + anchor); //$NON-NLS-1$
} catch (MalformedURLException e) {
//
}
}
return url;
}
}
return null;
} | [
"protected",
"URL",
"transformURL",
"(",
"URL",
"link",
",",
"ReferenceContext",
"references",
")",
"{",
"if",
"(",
"URISchemeType",
".",
"FILE",
".",
"isURL",
"(",
"link",
")",
")",
"{",
"File",
"filename",
"=",
"FileSystem",
".",
"convertURLToFile",
"(",
... | Transform an URL from Markdown format to HTML format.
<p>Usually, the file extension ".md" is replaced by ".html".
<p>This function replaces the anchor to the local reference with the correct one (modified by outline feature).
@param link the link to transform.
@param references the set of references from the local document.
@return the result of the transformation. {@code null} if the link should not changed. | [
"Transform",
"an",
"URL",
"from",
"Markdown",
"format",
"to",
"HTML",
"format",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L676-L709 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.transformURLAnchor | @SuppressWarnings("static-method")
protected String transformURLAnchor(File file, String anchor, ReferenceContext references) {
String anc = anchor;
if (references != null) {
anc = references.validateAnchor(anc);
}
return anc;
} | java | @SuppressWarnings("static-method")
protected String transformURLAnchor(File file, String anchor, ReferenceContext references) {
String anc = anchor;
if (references != null) {
anc = references.validateAnchor(anc);
}
return anc;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"String",
"transformURLAnchor",
"(",
"File",
"file",
",",
"String",
"anchor",
",",
"ReferenceContext",
"references",
")",
"{",
"String",
"anc",
"=",
"anchor",
";",
"if",
"(",
"references",
"!="... | Transform the anchor of an URL from Markdown format to HTML format.
@param file the linked file.
@param anchor the anchor to transform.
@param references the set of references from the local document, or {@code null}.
@return the result of the transformation.
@since 0.7 | [
"Transform",
"the",
"anchor",
"of",
"an",
"URL",
"from",
"Markdown",
"format",
"to",
"HTML",
"format",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L719-L726 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.isMarkdownFileExtension | public static boolean isMarkdownFileExtension(String extension) {
for (final String ext : MARKDOWN_FILE_EXTENSIONS) {
if (Strings.equal(ext, extension)) {
return true;
}
}
return false;
} | java | public static boolean isMarkdownFileExtension(String extension) {
for (final String ext : MARKDOWN_FILE_EXTENSIONS) {
if (Strings.equal(ext, extension)) {
return true;
}
}
return false;
} | [
"public",
"static",
"boolean",
"isMarkdownFileExtension",
"(",
"String",
"extension",
")",
"{",
"for",
"(",
"final",
"String",
"ext",
":",
"MARKDOWN_FILE_EXTENSIONS",
")",
"{",
"if",
"(",
"Strings",
".",
"equal",
"(",
"ext",
",",
"extension",
")",
")",
"{",
... | Replies if the given extension is for Markdown file.
@param extension the extension to test.
@return {@code true} if the extension is for a Markdown file. | [
"Replies",
"if",
"the",
"given",
"extension",
"is",
"for",
"Markdown",
"file",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L733-L740 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.addOutlineEntry | protected void addOutlineEntry(StringBuilder outline, int level, String sectionNumber, String title,
String sectionId, boolean htmlOutput) {
if (htmlOutput) {
indent(outline, level - 1, " "); //$NON-NLS-1$
outline.append("<li><a href=\"#"); //$NON-NLS-1$
outline.append(sectionId);
outline.append("\">"); //$NON-NLS-1$
if (isAutoSectionNumbering() && !Strings.isEmpty(sectionNumber)) {
outline.append(sectionNumber).append(". "); //$NON-NLS-1$
}
outline.append(title);
outline.append("</a></li>"); //$NON-NLS-1$
} else {
final String prefix = "*"; //$NON-NLS-1$
final String entry;
outline.append("> "); //$NON-NLS-1$
indent(outline, level - 1, "\t"); //$NON-NLS-1$
if (isAutoSectionNumbering()) {
entry = MessageFormat.format(getOutlineEntryFormat(), prefix,
Strings.emptyIfNull(sectionNumber), title, sectionId);
} else {
entry = MessageFormat.format(getOutlineEntryFormat(), prefix, title, sectionId);
}
outline.append(entry);
}
outline.append("\n"); //$NON-NLS-1$
} | java | protected void addOutlineEntry(StringBuilder outline, int level, String sectionNumber, String title,
String sectionId, boolean htmlOutput) {
if (htmlOutput) {
indent(outline, level - 1, " "); //$NON-NLS-1$
outline.append("<li><a href=\"#"); //$NON-NLS-1$
outline.append(sectionId);
outline.append("\">"); //$NON-NLS-1$
if (isAutoSectionNumbering() && !Strings.isEmpty(sectionNumber)) {
outline.append(sectionNumber).append(". "); //$NON-NLS-1$
}
outline.append(title);
outline.append("</a></li>"); //$NON-NLS-1$
} else {
final String prefix = "*"; //$NON-NLS-1$
final String entry;
outline.append("> "); //$NON-NLS-1$
indent(outline, level - 1, "\t"); //$NON-NLS-1$
if (isAutoSectionNumbering()) {
entry = MessageFormat.format(getOutlineEntryFormat(), prefix,
Strings.emptyIfNull(sectionNumber), title, sectionId);
} else {
entry = MessageFormat.format(getOutlineEntryFormat(), prefix, title, sectionId);
}
outline.append(entry);
}
outline.append("\n"); //$NON-NLS-1$
} | [
"protected",
"void",
"addOutlineEntry",
"(",
"StringBuilder",
"outline",
",",
"int",
"level",
",",
"String",
"sectionNumber",
",",
"String",
"title",
",",
"String",
"sectionId",
",",
"boolean",
"htmlOutput",
")",
"{",
"if",
"(",
"htmlOutput",
")",
"{",
"indent... | Update the outline entry.
@param outline the outline.
@param level the depth level in the outline.
@param sectionNumber the auto-computed section number, or {@code null} if no auto-computed number.
@param title the title of the section.
@param sectionId the identifier of the section.
@param htmlOutput indicates if the output should be HTML or not. | [
"Update",
"the",
"outline",
"entry",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L910-L936 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.formatSectionTitle | protected String formatSectionTitle(String prefix, String sectionNumber, String title, String sectionId) {
return MessageFormat.format(getSectionTitleFormat(), prefix, sectionNumber, title, sectionId) + "\n"; //$NON-NLS-1$
} | java | protected String formatSectionTitle(String prefix, String sectionNumber, String title, String sectionId) {
return MessageFormat.format(getSectionTitleFormat(), prefix, sectionNumber, title, sectionId) + "\n"; //$NON-NLS-1$
} | [
"protected",
"String",
"formatSectionTitle",
"(",
"String",
"prefix",
",",
"String",
"sectionNumber",
",",
"String",
"title",
",",
"String",
"sectionId",
")",
"{",
"return",
"MessageFormat",
".",
"format",
"(",
"getSectionTitleFormat",
"(",
")",
",",
"prefix",
"... | Format the section title.
@param prefix the Markdown prefix.
@param sectionNumber the section number.
@param title the section title.
@param sectionId the identifier of the section.
@return the formatted section title. | [
"Format",
"the",
"section",
"title",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L955-L957 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.indent | protected static void indent(StringBuilder buffer, int number, String character) {
for (int i = 0; i < number; ++i) {
buffer.append(character);
}
} | java | protected static void indent(StringBuilder buffer, int number, String character) {
for (int i = 0; i < number; ++i) {
buffer.append(character);
}
} | [
"protected",
"static",
"void",
"indent",
"(",
"StringBuilder",
"buffer",
",",
"int",
"number",
",",
"String",
"character",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"number",
";",
"++",
"i",
")",
"{",
"buffer",
".",
"append",
"(",
... | Create indentation in the given buffer.
@param buffer the buffer.
@param number the number of identations.
@param character the string for a single indentation. | [
"Create",
"indentation",
"in",
"the",
"given",
"buffer",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L965-L969 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.computeLineNo | protected static int computeLineNo(Node node) {
final int offset = node.getStartOffset();
final BasedSequence seq = node.getDocument().getChars();
int tmpOffset = seq.endOfLine(0);
int lineno = 1;
while (tmpOffset < offset) {
++lineno;
tmpOffset = seq.endOfLineAnyEOL(tmpOffset + seq.eolLength(tmpOffset));
}
return lineno;
} | java | protected static int computeLineNo(Node node) {
final int offset = node.getStartOffset();
final BasedSequence seq = node.getDocument().getChars();
int tmpOffset = seq.endOfLine(0);
int lineno = 1;
while (tmpOffset < offset) {
++lineno;
tmpOffset = seq.endOfLineAnyEOL(tmpOffset + seq.eolLength(tmpOffset));
}
return lineno;
} | [
"protected",
"static",
"int",
"computeLineNo",
"(",
"Node",
"node",
")",
"{",
"final",
"int",
"offset",
"=",
"node",
".",
"getStartOffset",
"(",
")",
";",
"final",
"BasedSequence",
"seq",
"=",
"node",
".",
"getDocument",
"(",
")",
".",
"getChars",
"(",
"... | Compute the number of lines for reaching the given node.
@param node the node.
@return the line number for the node. | [
"Compute",
"the",
"number",
"of",
"lines",
"for",
"reaching",
"the",
"given",
"node",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L1010-L1020 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.createValidatorComponents | protected Iterable<DynamicValidationComponent> createValidatorComponents(Image it, File currentFile,
DynamicValidationContext context) {
final Collection<DynamicValidationComponent> components = new ArrayList<>();
if (isLocalImageReferenceValidation()) {
final int lineno = computeLineNo(it);
final URL url = FileSystem.convertStringToURL(it.getUrl().toString(), true);
if (URISchemeType.FILE.isURL(url)) {
final DynamicValidationComponent component = createLocalImageValidatorComponent(
it, url, lineno, currentFile, context);
if (component != null) {
components.add(component);
}
}
}
return components;
} | java | protected Iterable<DynamicValidationComponent> createValidatorComponents(Image it, File currentFile,
DynamicValidationContext context) {
final Collection<DynamicValidationComponent> components = new ArrayList<>();
if (isLocalImageReferenceValidation()) {
final int lineno = computeLineNo(it);
final URL url = FileSystem.convertStringToURL(it.getUrl().toString(), true);
if (URISchemeType.FILE.isURL(url)) {
final DynamicValidationComponent component = createLocalImageValidatorComponent(
it, url, lineno, currentFile, context);
if (component != null) {
components.add(component);
}
}
}
return components;
} | [
"protected",
"Iterable",
"<",
"DynamicValidationComponent",
">",
"createValidatorComponents",
"(",
"Image",
"it",
",",
"File",
"currentFile",
",",
"DynamicValidationContext",
"context",
")",
"{",
"final",
"Collection",
"<",
"DynamicValidationComponent",
">",
"components",... | Create a validation component for an image reference.
@param it the image reference.
@param currentFile the current file.
@param context the validation context.
@return the validation components. | [
"Create",
"a",
"validation",
"component",
"for",
"an",
"image",
"reference",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L1029-L1044 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.createValidatorComponents | protected Iterable<DynamicValidationComponent> createValidatorComponents(Link it, File currentFile,
DynamicValidationContext context) {
final Collection<DynamicValidationComponent> components = new ArrayList<>();
if (isLocalFileReferenceValidation() || isRemoteReferenceValidation()) {
final int lineno = computeLineNo(it);
final URL url = FileSystem.convertStringToURL(it.getUrl().toString(), true);
if (URISchemeType.HTTP.isURL(url) || URISchemeType.HTTPS.isURL(url) || URISchemeType.FTP.isURL(url)) {
if (isRemoteReferenceValidation()) {
final Collection<DynamicValidationComponent> newComponents = createRemoteReferenceValidatorComponents(
it, url, lineno, currentFile, context);
if (newComponents != null && !newComponents.isEmpty()) {
components.addAll(newComponents);
}
}
} else if (URISchemeType.FILE.isURL(url)) {
if (isLocalFileReferenceValidation()) {
final Collection<DynamicValidationComponent> newComponents = createLocalFileValidatorComponents(
it, url, lineno, currentFile, context);
if (newComponents != null && !newComponents.isEmpty()) {
components.addAll(newComponents);
}
}
}
}
return components;
} | java | protected Iterable<DynamicValidationComponent> createValidatorComponents(Link it, File currentFile,
DynamicValidationContext context) {
final Collection<DynamicValidationComponent> components = new ArrayList<>();
if (isLocalFileReferenceValidation() || isRemoteReferenceValidation()) {
final int lineno = computeLineNo(it);
final URL url = FileSystem.convertStringToURL(it.getUrl().toString(), true);
if (URISchemeType.HTTP.isURL(url) || URISchemeType.HTTPS.isURL(url) || URISchemeType.FTP.isURL(url)) {
if (isRemoteReferenceValidation()) {
final Collection<DynamicValidationComponent> newComponents = createRemoteReferenceValidatorComponents(
it, url, lineno, currentFile, context);
if (newComponents != null && !newComponents.isEmpty()) {
components.addAll(newComponents);
}
}
} else if (URISchemeType.FILE.isURL(url)) {
if (isLocalFileReferenceValidation()) {
final Collection<DynamicValidationComponent> newComponents = createLocalFileValidatorComponents(
it, url, lineno, currentFile, context);
if (newComponents != null && !newComponents.isEmpty()) {
components.addAll(newComponents);
}
}
}
}
return components;
} | [
"protected",
"Iterable",
"<",
"DynamicValidationComponent",
">",
"createValidatorComponents",
"(",
"Link",
"it",
",",
"File",
"currentFile",
",",
"DynamicValidationContext",
"context",
")",
"{",
"final",
"Collection",
"<",
"DynamicValidationComponent",
">",
"components",
... | Create a validation component for an hyper reference.
@param it the hyper reference.
@param currentFile the current file.
@param context the validation context.
@return the validation components. | [
"Create",
"a",
"validation",
"component",
"for",
"an",
"hyper",
"reference",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L1053-L1078 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.createLocalImageValidatorComponent | @SuppressWarnings("static-method")
protected DynamicValidationComponent createLocalImageValidatorComponent(Image it, URL url, int lineno,
File currentFile, DynamicValidationContext context) {
File fn = FileSystem.convertURLToFile(url);
if (!fn.isAbsolute()) {
fn = FileSystem.join(currentFile.getParentFile(), fn);
}
final File filename = fn;
return new DynamicValidationComponent() {
@Override
public String functionName() {
return "Image_reference_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.appendFileExistenceTest(it, filename, Messages.MarkdownParser_0);
}
};
} | java | @SuppressWarnings("static-method")
protected DynamicValidationComponent createLocalImageValidatorComponent(Image it, URL url, int lineno,
File currentFile, DynamicValidationContext context) {
File fn = FileSystem.convertURLToFile(url);
if (!fn.isAbsolute()) {
fn = FileSystem.join(currentFile.getParentFile(), fn);
}
final File filename = fn;
return new DynamicValidationComponent() {
@Override
public String functionName() {
return "Image_reference_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.appendFileExistenceTest(it, filename, Messages.MarkdownParser_0);
}
};
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"DynamicValidationComponent",
"createLocalImageValidatorComponent",
"(",
"Image",
"it",
",",
"URL",
"url",
",",
"int",
"lineno",
",",
"File",
"currentFile",
",",
"DynamicValidationContext",
"context",
... | Create a validation component for a reference to a local image.
@param it the reference.
@param url the parsed URL of the link.
@param lineno the position of the link into the Markdown file.
@param currentFile the current file.
@param context the validation context.
@return the validation component. | [
"Create",
"a",
"validation",
"component",
"for",
"a",
"reference",
"to",
"a",
"local",
"image",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L1089-L1108 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.createLocalFileValidatorComponents | @SuppressWarnings("static-method")
protected Collection<DynamicValidationComponent> createLocalFileValidatorComponents(Link it, URL url, int lineno,
File currentFile, DynamicValidationContext context) {
File fn = FileSystem.convertURLToFile(url);
if (Strings.isEmpty(fn.getName())) {
// Special case: the URL should point to a anchor in the current document.
final String linkRef = url.getRef();
if (!Strings.isEmpty(linkRef)) {
return Arrays.asList(new DynamicValidationComponent() {
@Override
public String functionName() {
return "Documentation_reference_anchor_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.setTempResourceRoots(null);
context.appendTitleAnchorExistenceTest(it, currentFile,
url.getRef(),
SECTION_PATTERN_TITLE_EXTRACTOR,
Iterables.concat(
Arrays.asList(MARKDOWN_FILE_EXTENSIONS),
Arrays.asList(HTML_FILE_EXTENSIONS)));
}
});
}
// No need to validate the current file's existency and anchor.
return null;
}
if (!fn.isAbsolute()) {
fn = FileSystem.join(currentFile.getParentFile(), fn);
}
final File filename = fn;
final String extension = FileSystem.extension(filename);
if (isMarkdownFileExtension(extension) || isHtmlFileExtension(extension)) {
// Special case: the file may be a HTML or a Markdown file.
final DynamicValidationComponent existence = new DynamicValidationComponent() {
@Override
public String functionName() {
return "Documentation_reference_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.setTempResourceRoots(context.getSourceRoots());
context.appendFileExistenceTest(it, filename, Messages.MarkdownParser_1,
Iterables.concat(
Arrays.asList(MARKDOWN_FILE_EXTENSIONS),
Arrays.asList(HTML_FILE_EXTENSIONS)));
}
};
if (!Strings.isEmpty(url.getRef())) {
final DynamicValidationComponent refValidity = new DynamicValidationComponent() {
@Override
public String functionName() {
return "Documentation_reference_anchor_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.setTempResourceRoots(null);
context.appendTitleAnchorExistenceTest(it, filename,
url.getRef(),
SECTION_PATTERN_TITLE_EXTRACTOR,
Iterables.concat(
Arrays.asList(MARKDOWN_FILE_EXTENSIONS),
Arrays.asList(HTML_FILE_EXTENSIONS)));
}
};
return Arrays.asList(existence, refValidity);
}
return Collections.singleton(existence);
}
return Arrays.asList(new DynamicValidationComponent() {
@Override
public String functionName() {
return "File_reference_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.appendFileExistenceTest(it, filename, Messages.MarkdownParser_1);
}
});
} | java | @SuppressWarnings("static-method")
protected Collection<DynamicValidationComponent> createLocalFileValidatorComponents(Link it, URL url, int lineno,
File currentFile, DynamicValidationContext context) {
File fn = FileSystem.convertURLToFile(url);
if (Strings.isEmpty(fn.getName())) {
// Special case: the URL should point to a anchor in the current document.
final String linkRef = url.getRef();
if (!Strings.isEmpty(linkRef)) {
return Arrays.asList(new DynamicValidationComponent() {
@Override
public String functionName() {
return "Documentation_reference_anchor_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.setTempResourceRoots(null);
context.appendTitleAnchorExistenceTest(it, currentFile,
url.getRef(),
SECTION_PATTERN_TITLE_EXTRACTOR,
Iterables.concat(
Arrays.asList(MARKDOWN_FILE_EXTENSIONS),
Arrays.asList(HTML_FILE_EXTENSIONS)));
}
});
}
// No need to validate the current file's existency and anchor.
return null;
}
if (!fn.isAbsolute()) {
fn = FileSystem.join(currentFile.getParentFile(), fn);
}
final File filename = fn;
final String extension = FileSystem.extension(filename);
if (isMarkdownFileExtension(extension) || isHtmlFileExtension(extension)) {
// Special case: the file may be a HTML or a Markdown file.
final DynamicValidationComponent existence = new DynamicValidationComponent() {
@Override
public String functionName() {
return "Documentation_reference_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.setTempResourceRoots(context.getSourceRoots());
context.appendFileExistenceTest(it, filename, Messages.MarkdownParser_1,
Iterables.concat(
Arrays.asList(MARKDOWN_FILE_EXTENSIONS),
Arrays.asList(HTML_FILE_EXTENSIONS)));
}
};
if (!Strings.isEmpty(url.getRef())) {
final DynamicValidationComponent refValidity = new DynamicValidationComponent() {
@Override
public String functionName() {
return "Documentation_reference_anchor_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.setTempResourceRoots(null);
context.appendTitleAnchorExistenceTest(it, filename,
url.getRef(),
SECTION_PATTERN_TITLE_EXTRACTOR,
Iterables.concat(
Arrays.asList(MARKDOWN_FILE_EXTENSIONS),
Arrays.asList(HTML_FILE_EXTENSIONS)));
}
};
return Arrays.asList(existence, refValidity);
}
return Collections.singleton(existence);
}
return Arrays.asList(new DynamicValidationComponent() {
@Override
public String functionName() {
return "File_reference_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
context.appendFileExistenceTest(it, filename, Messages.MarkdownParser_1);
}
});
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Collection",
"<",
"DynamicValidationComponent",
">",
"createLocalFileValidatorComponents",
"(",
"Link",
"it",
",",
"URL",
"url",
",",
"int",
"lineno",
",",
"File",
"currentFile",
",",
"DynamicValida... | Create a validation component for an hyper reference to a local file.
@param it the hyper reference.
@param url the parsed URL of the link.
@param lineno the position of the link into the Markdown file.
@param currentFile the current File.
@param context the validation context.
@return the validation component. | [
"Create",
"a",
"validation",
"component",
"for",
"an",
"hyper",
"reference",
"to",
"a",
"local",
"file",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L1119-L1203 | train |
sarl/sarl | main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java | MarkdownParser.createRemoteReferenceValidatorComponents | @SuppressWarnings("static-method")
protected Collection<DynamicValidationComponent> createRemoteReferenceValidatorComponents(Link it, URL url, int lineno,
File currentFile, DynamicValidationContext context) {
return Collections.singleton(new DynamicValidationComponent() {
@Override
public String functionName() {
return "Web_reference_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
it.append("assertURLAccessibility(").append(Integer.toString(lineno)); //$NON-NLS-1$
it.append(", new "); //$NON-NLS-1$
it.append(URL.class).append("(\""); //$NON-NLS-1$
it.append(Strings.convertToJavaString(url.toExternalForm()));
it.append("\"));"); //$NON-NLS-1$
}
});
} | java | @SuppressWarnings("static-method")
protected Collection<DynamicValidationComponent> createRemoteReferenceValidatorComponents(Link it, URL url, int lineno,
File currentFile, DynamicValidationContext context) {
return Collections.singleton(new DynamicValidationComponent() {
@Override
public String functionName() {
return "Web_reference_test_" + lineno + "_"; //$NON-NLS-1$ //$NON-NLS-2$
}
@Override
public void generateValidationCode(ITreeAppendable it) {
it.append("assertURLAccessibility(").append(Integer.toString(lineno)); //$NON-NLS-1$
it.append(", new "); //$NON-NLS-1$
it.append(URL.class).append("(\""); //$NON-NLS-1$
it.append(Strings.convertToJavaString(url.toExternalForm()));
it.append("\"));"); //$NON-NLS-1$
}
});
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"Collection",
"<",
"DynamicValidationComponent",
">",
"createRemoteReferenceValidatorComponents",
"(",
"Link",
"it",
",",
"URL",
"url",
",",
"int",
"lineno",
",",
"File",
"currentFile",
",",
"Dynamic... | Create a validation component for an hyper reference to a remote Internet page.
@param it the hyper reference.
@param url the parsed URL of the link.
@param lineno the position of the link into the Markdown file.
@param currentFile the current file.
@param context the validation context.
@return the validation component. | [
"Create",
"a",
"validation",
"component",
"for",
"an",
"hyper",
"reference",
"to",
"a",
"remote",
"Internet",
"page",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/markdown/MarkdownParser.java#L1214-L1232 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java | AbstractBuilder.newTypeRef | public JvmParameterizedTypeReference newTypeRef(Notifier context, String typeName) {
JvmTypeReference typeReference;
try {
typeReference = findType(context, typeName);
getImportManager().addImportFor(typeReference.getType());
return (JvmParameterizedTypeReference) typeReference;
} catch (TypeNotPresentException exception) {
}
final JvmParameterizedTypeReference pref = ExpressionBuilderImpl.parseType(context, typeName, this);
final JvmTypeReference baseType = findType(context, pref.getType().getIdentifier());
final int len = pref.getArguments().size();
final JvmTypeReference[] args = new JvmTypeReference[len];
for (int i = 0; i < len; ++i) {
final JvmTypeReference original = pref.getArguments().get(i);
if (original instanceof JvmAnyTypeReference) {
args[i] = EcoreUtil.copy(original);
} else if (original instanceof JvmWildcardTypeReference) {
final JvmWildcardTypeReference wc = EcoreUtil.copy((JvmWildcardTypeReference) original);
for (final JvmTypeConstraint c : wc.getConstraints()) {
c.setTypeReference(newTypeRef(context, c.getTypeReference().getIdentifier()));
}
args[i] = wc;
} else {
args[i] = newTypeRef(context, original.getIdentifier());
}
}
final TypeReferences typeRefs = getTypeReferences();
return typeRefs.createTypeRef(baseType.getType(), args);
} | java | public JvmParameterizedTypeReference newTypeRef(Notifier context, String typeName) {
JvmTypeReference typeReference;
try {
typeReference = findType(context, typeName);
getImportManager().addImportFor(typeReference.getType());
return (JvmParameterizedTypeReference) typeReference;
} catch (TypeNotPresentException exception) {
}
final JvmParameterizedTypeReference pref = ExpressionBuilderImpl.parseType(context, typeName, this);
final JvmTypeReference baseType = findType(context, pref.getType().getIdentifier());
final int len = pref.getArguments().size();
final JvmTypeReference[] args = new JvmTypeReference[len];
for (int i = 0; i < len; ++i) {
final JvmTypeReference original = pref.getArguments().get(i);
if (original instanceof JvmAnyTypeReference) {
args[i] = EcoreUtil.copy(original);
} else if (original instanceof JvmWildcardTypeReference) {
final JvmWildcardTypeReference wc = EcoreUtil.copy((JvmWildcardTypeReference) original);
for (final JvmTypeConstraint c : wc.getConstraints()) {
c.setTypeReference(newTypeRef(context, c.getTypeReference().getIdentifier()));
}
args[i] = wc;
} else {
args[i] = newTypeRef(context, original.getIdentifier());
}
}
final TypeReferences typeRefs = getTypeReferences();
return typeRefs.createTypeRef(baseType.getType(), args);
} | [
"public",
"JvmParameterizedTypeReference",
"newTypeRef",
"(",
"Notifier",
"context",
",",
"String",
"typeName",
")",
"{",
"JvmTypeReference",
"typeReference",
";",
"try",
"{",
"typeReference",
"=",
"findType",
"(",
"context",
",",
"typeName",
")",
";",
"getImportMan... | Replies the type reference for the given name in the given context. | [
"Replies",
"the",
"type",
"reference",
"for",
"the",
"given",
"name",
"in",
"the",
"given",
"context",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java#L189-L217 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java | AbstractBuilder.isSubTypeOf | @Pure
protected boolean isSubTypeOf(EObject context, JvmTypeReference subType, JvmTypeReference superType) {
if (isTypeReference(superType) && isTypeReference(subType)) {
StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, context);
LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(owner, false);
LightweightTypeReference reference = factory.toLightweightReference(subType);
return reference.isSubtypeOf(superType.getType());
}
return false;
} | java | @Pure
protected boolean isSubTypeOf(EObject context, JvmTypeReference subType, JvmTypeReference superType) {
if (isTypeReference(superType) && isTypeReference(subType)) {
StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner(services, context);
LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory(owner, false);
LightweightTypeReference reference = factory.toLightweightReference(subType);
return reference.isSubtypeOf(superType.getType());
}
return false;
} | [
"@",
"Pure",
"protected",
"boolean",
"isSubTypeOf",
"(",
"EObject",
"context",
",",
"JvmTypeReference",
"subType",
",",
"JvmTypeReference",
"superType",
")",
"{",
"if",
"(",
"isTypeReference",
"(",
"superType",
")",
"&&",
"isTypeReference",
"(",
"subType",
")",
... | Replies if the first parameter is a subtype of the second parameter.
@param context the context.
@param subType the subtype to test.
@param superType the expected super type.
@return the type reference. | [
"Replies",
"if",
"the",
"first",
"parameter",
"is",
"a",
"subtype",
"of",
"the",
"second",
"parameter",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java#L226-L235 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java | AbstractBuilder.isTypeReference | @Pure
protected boolean isTypeReference(JvmTypeReference typeReference) {
return (typeReference != null && !typeReference.eIsProxy()
&& typeReference.getType() != null && !typeReference.getType().eIsProxy());
} | java | @Pure
protected boolean isTypeReference(JvmTypeReference typeReference) {
return (typeReference != null && !typeReference.eIsProxy()
&& typeReference.getType() != null && !typeReference.getType().eIsProxy());
} | [
"@",
"Pure",
"protected",
"boolean",
"isTypeReference",
"(",
"JvmTypeReference",
"typeReference",
")",
"{",
"return",
"(",
"typeReference",
"!=",
"null",
"&&",
"!",
"typeReference",
".",
"eIsProxy",
"(",
")",
"&&",
"typeReference",
".",
"getType",
"(",
")",
"!... | Replies if the given object is a valid type reference. | [
"Replies",
"if",
"the",
"given",
"object",
"is",
"a",
"valid",
"type",
"reference",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java#L239-L243 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java | AbstractBuilder.isActionBodyAllowed | @Pure
protected boolean isActionBodyAllowed(XtendTypeDeclaration type) {
return !(type instanceof SarlAnnotationType
|| type instanceof SarlCapacity
|| type instanceof SarlEvent
|| type instanceof SarlInterface);
} | java | @Pure
protected boolean isActionBodyAllowed(XtendTypeDeclaration type) {
return !(type instanceof SarlAnnotationType
|| type instanceof SarlCapacity
|| type instanceof SarlEvent
|| type instanceof SarlInterface);
} | [
"@",
"Pure",
"protected",
"boolean",
"isActionBodyAllowed",
"(",
"XtendTypeDeclaration",
"type",
")",
"{",
"return",
"!",
"(",
"type",
"instanceof",
"SarlAnnotationType",
"||",
"type",
"instanceof",
"SarlCapacity",
"||",
"type",
"instanceof",
"SarlEvent",
"||",
"typ... | Replies if the type could contains functions with a body. | [
"Replies",
"if",
"the",
"type",
"could",
"contains",
"functions",
"with",
"a",
"body",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/AbstractBuilder.java#L281-L287 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/InjectionRecommender2.java | InjectionRecommender2.recommendFrom | protected void recommendFrom(String label, Set<BindingElement> source, Set<Binding> current) {
this.bindingFactory.setName(getName());
boolean hasRecommend = false;
for (final BindingElement sourceElement : source) {
final Binding wrapElement = this.bindingFactory.toBinding(sourceElement);
if (!current.contains(wrapElement)) {
if (!hasRecommend) {
LOG.info(MessageFormat.format("Begin recommendations for {0}", //$NON-NLS-1$
label));
hasRecommend = true;
}
LOG.warn(MessageFormat.format("\t{1}", //$NON-NLS-1$
label, sourceElement.getKeyString()));
}
}
if (hasRecommend) {
LOG.info(MessageFormat.format("End recommendations for {0}", //$NON-NLS-1$
label));
} else {
LOG.info(MessageFormat.format("No recommendation for {0}", //$NON-NLS-1$
label));
}
} | java | protected void recommendFrom(String label, Set<BindingElement> source, Set<Binding> current) {
this.bindingFactory.setName(getName());
boolean hasRecommend = false;
for (final BindingElement sourceElement : source) {
final Binding wrapElement = this.bindingFactory.toBinding(sourceElement);
if (!current.contains(wrapElement)) {
if (!hasRecommend) {
LOG.info(MessageFormat.format("Begin recommendations for {0}", //$NON-NLS-1$
label));
hasRecommend = true;
}
LOG.warn(MessageFormat.format("\t{1}", //$NON-NLS-1$
label, sourceElement.getKeyString()));
}
}
if (hasRecommend) {
LOG.info(MessageFormat.format("End recommendations for {0}", //$NON-NLS-1$
label));
} else {
LOG.info(MessageFormat.format("No recommendation for {0}", //$NON-NLS-1$
label));
}
} | [
"protected",
"void",
"recommendFrom",
"(",
"String",
"label",
",",
"Set",
"<",
"BindingElement",
">",
"source",
",",
"Set",
"<",
"Binding",
">",
"current",
")",
"{",
"this",
".",
"bindingFactory",
".",
"setName",
"(",
"getName",
"(",
")",
")",
";",
"bool... | Provide the recommendations.
@param label the source of the recommendation.
@param source the source of recommendation.
@param current the current bindings. | [
"Provide",
"the",
"recommendations",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/InjectionRecommender2.java#L220-L242 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/InjectionRecommender2.java | InjectionRecommender2.recommend | protected void recommend(Class<?> superModule, GuiceModuleAccess currentModuleAccess) {
LOG.info(MessageFormat.format("Building injection configuration from {0}", //$NON-NLS-1$
superModule.getName()));
final Set<BindingElement> superBindings = new LinkedHashSet<>();
fillFrom(superBindings, superModule.getSuperclass());
fillFrom(superBindings, superModule);
final Set<Binding> currentBindings = currentModuleAccess.getBindings();
recommendFrom(superModule.getName(), superBindings, currentBindings);
} | java | protected void recommend(Class<?> superModule, GuiceModuleAccess currentModuleAccess) {
LOG.info(MessageFormat.format("Building injection configuration from {0}", //$NON-NLS-1$
superModule.getName()));
final Set<BindingElement> superBindings = new LinkedHashSet<>();
fillFrom(superBindings, superModule.getSuperclass());
fillFrom(superBindings, superModule);
final Set<Binding> currentBindings = currentModuleAccess.getBindings();
recommendFrom(superModule.getName(), superBindings, currentBindings);
} | [
"protected",
"void",
"recommend",
"(",
"Class",
"<",
"?",
">",
"superModule",
",",
"GuiceModuleAccess",
"currentModuleAccess",
")",
"{",
"LOG",
".",
"info",
"(",
"MessageFormat",
".",
"format",
"(",
"\"Building injection configuration from {0}\"",
",",
"//$NON-NLS-1$"... | Provide the recommendations for the given module.
@param superModule the super module to extract definitions from.
@param currentModuleAccess the accessor to the the current module's definition. | [
"Provide",
"the",
"recommendations",
"for",
"the",
"given",
"module",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/InjectionRecommender2.java#L249-L259 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/ExtraLanguageFeatureNameConverter.java | ExtraLanguageFeatureNameConverter.getConversionTypeFor | public ConversionType getConversionTypeFor(XAbstractFeatureCall featureCall) {
if (this.conversions == null) {
this.conversions = initMapping();
}
final List<Object> receiver = new ArrayList<>();
AbstractExpressionGenerator.buildCallReceiver(
featureCall,
this.keywords.getThisKeywordLambda(),
this.referenceNameLambda,
receiver);
final String simpleName = AbstractExpressionGenerator.getCallSimpleName(
featureCall,
this.logicalContainerProvider,
this.simpleNameProvider,
this.keywords.getNullKeywordLambda(),
this.keywords.getThisKeywordLambda(),
this.keywords.getSuperKeywordLambda(),
this.referenceNameLambda2);
final List<Pair<FeaturePattern, FeatureReplacement>> struct = this.conversions.get(getKey(simpleName));
if (struct != null) {
final String replacementId = featureCall.getFeature().getIdentifier();
final FeatureReplacement replacement = matchFirstPattern(struct, replacementId, simpleName, receiver);
if (replacement != null) {
if (replacement.hasReplacement()) {
return ConversionType.EXPLICIT;
}
return ConversionType.FORBIDDEN_CONVERSION;
}
}
return ConversionType.IMPLICIT;
} | java | public ConversionType getConversionTypeFor(XAbstractFeatureCall featureCall) {
if (this.conversions == null) {
this.conversions = initMapping();
}
final List<Object> receiver = new ArrayList<>();
AbstractExpressionGenerator.buildCallReceiver(
featureCall,
this.keywords.getThisKeywordLambda(),
this.referenceNameLambda,
receiver);
final String simpleName = AbstractExpressionGenerator.getCallSimpleName(
featureCall,
this.logicalContainerProvider,
this.simpleNameProvider,
this.keywords.getNullKeywordLambda(),
this.keywords.getThisKeywordLambda(),
this.keywords.getSuperKeywordLambda(),
this.referenceNameLambda2);
final List<Pair<FeaturePattern, FeatureReplacement>> struct = this.conversions.get(getKey(simpleName));
if (struct != null) {
final String replacementId = featureCall.getFeature().getIdentifier();
final FeatureReplacement replacement = matchFirstPattern(struct, replacementId, simpleName, receiver);
if (replacement != null) {
if (replacement.hasReplacement()) {
return ConversionType.EXPLICIT;
}
return ConversionType.FORBIDDEN_CONVERSION;
}
}
return ConversionType.IMPLICIT;
} | [
"public",
"ConversionType",
"getConversionTypeFor",
"(",
"XAbstractFeatureCall",
"featureCall",
")",
"{",
"if",
"(",
"this",
".",
"conversions",
"==",
"null",
")",
"{",
"this",
".",
"conversions",
"=",
"initMapping",
"(",
")",
";",
"}",
"final",
"List",
"<",
... | Replies the type of conversion for the given feature call.
@param featureCall the feature call.
@return the type of conversion. | [
"Replies",
"the",
"type",
"of",
"conversion",
"for",
"the",
"given",
"feature",
"call",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/ExtraLanguageFeatureNameConverter.java#L152-L182 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/ExtraLanguageFeatureNameConverter.java | ExtraLanguageFeatureNameConverter.convertFeatureCall | public ConversionResult convertFeatureCall(String simpleName, JvmIdentifiableElement calledFeature, List<Object> leftOperand,
List<Object> receiver, List<XExpression> arguments) {
if (this.conversions == null) {
this.conversions = initMapping();
}
final List<Pair<FeaturePattern, FeatureReplacement>> struct = this.conversions.get(getKey(simpleName));
if (struct != null) {
final String replacementId = calledFeature.getIdentifier();
final FeatureReplacement replacement = matchFirstPattern(struct, replacementId, simpleName, receiver);
if (replacement != null) {
if (replacement.hasReplacement()) {
return replacement.replace(calledFeature, leftOperand, receiver, arguments);
}
return null;
}
}
return new ConversionResult(simpleName);
} | java | public ConversionResult convertFeatureCall(String simpleName, JvmIdentifiableElement calledFeature, List<Object> leftOperand,
List<Object> receiver, List<XExpression> arguments) {
if (this.conversions == null) {
this.conversions = initMapping();
}
final List<Pair<FeaturePattern, FeatureReplacement>> struct = this.conversions.get(getKey(simpleName));
if (struct != null) {
final String replacementId = calledFeature.getIdentifier();
final FeatureReplacement replacement = matchFirstPattern(struct, replacementId, simpleName, receiver);
if (replacement != null) {
if (replacement.hasReplacement()) {
return replacement.replace(calledFeature, leftOperand, receiver, arguments);
}
return null;
}
}
return new ConversionResult(simpleName);
} | [
"public",
"ConversionResult",
"convertFeatureCall",
"(",
"String",
"simpleName",
",",
"JvmIdentifiableElement",
"calledFeature",
",",
"List",
"<",
"Object",
">",
"leftOperand",
",",
"List",
"<",
"Object",
">",
"receiver",
",",
"List",
"<",
"XExpression",
">",
"arg... | Convert a full call to a feature.
<p>This function is supposed to change the two list parameters for reflecting the conversion.
@param simpleName the simple name of the feature to be called.
@param calledFeature the called feature.
@param leftOperand the description of the elements into the left operand (usually, before assignment sign).
@param receiver the description of the receiver, i.e. the object on which the feature is called.
@param arguments the list of the arguments.
@return a description of the conversion; or {@code null} for ignoring the call. | [
"Convert",
"a",
"full",
"call",
"to",
"a",
"feature",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/ExtraLanguageFeatureNameConverter.java#L195-L212 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/ExtraLanguageFeatureNameConverter.java | ExtraLanguageFeatureNameConverter.convertDeclarationName | public String convertDeclarationName(String simpleName, SarlAction feature) {
assert simpleName != null;
assert feature != null;
final JvmOperation operation = this.associations.getDirectlyInferredOperation(feature);
if (operation != null) {
if (this.conversions == null) {
this.conversions = initMapping();
}
final List<Pair<FeaturePattern, FeatureReplacement>> struct = this.conversions.get(getKey(simpleName));
if (struct == null) {
return simpleName;
}
final FeatureReplacement replacement = matchFirstPattern(struct, operation.getIdentifier());
if (replacement != null) {
if (replacement.hasReplacement()) {
return replacement.getText();
}
return null;
}
return simpleName;
}
return simpleName;
} | java | public String convertDeclarationName(String simpleName, SarlAction feature) {
assert simpleName != null;
assert feature != null;
final JvmOperation operation = this.associations.getDirectlyInferredOperation(feature);
if (operation != null) {
if (this.conversions == null) {
this.conversions = initMapping();
}
final List<Pair<FeaturePattern, FeatureReplacement>> struct = this.conversions.get(getKey(simpleName));
if (struct == null) {
return simpleName;
}
final FeatureReplacement replacement = matchFirstPattern(struct, operation.getIdentifier());
if (replacement != null) {
if (replacement.hasReplacement()) {
return replacement.getText();
}
return null;
}
return simpleName;
}
return simpleName;
} | [
"public",
"String",
"convertDeclarationName",
"(",
"String",
"simpleName",
",",
"SarlAction",
"feature",
")",
"{",
"assert",
"simpleName",
"!=",
"null",
";",
"assert",
"feature",
"!=",
"null",
";",
"final",
"JvmOperation",
"operation",
"=",
"this",
".",
"associa... | Convert the given name for the given feature to its equivalent in the extra language.
<p>Usually, this function is called to convert the function's name when it is declared.
@param simpleName the feature's simple name to convert.
@param feature the JVM feature that corresponds to the name.
@return the conversion result, or {@code null} if the equivalent function not exists,
or {@code simpleName} if the function name should stay unchanged. | [
"Convert",
"the",
"given",
"name",
"for",
"the",
"given",
"feature",
"to",
"its",
"equivalent",
"in",
"the",
"extra",
"language",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/compiler/ExtraLanguageFeatureNameConverter.java#L274-L296 | train |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyInitializers.java | PyInitializers.getTypeConverterInitializer | public static IExtraLanguageConversionInitializer getTypeConverterInitializer() {
return it -> {
final List<Pair<String, String>> properties = loadPropertyFile(TYPE_CONVERSION_FILENAME);
if (!properties.isEmpty()) {
for (final Pair<String, String> entry : properties) {
final String source = Objects.toString(entry.getKey());
final String target = Objects.toString(entry.getValue());
final String baseName;
final Matcher matcher = TYPE_NAME_PAT.matcher(source);
if (matcher.find()) {
baseName = matcher.group(1);
} else {
baseName = source;
}
it.apply(baseName, source, target);
}
}
};
} | java | public static IExtraLanguageConversionInitializer getTypeConverterInitializer() {
return it -> {
final List<Pair<String, String>> properties = loadPropertyFile(TYPE_CONVERSION_FILENAME);
if (!properties.isEmpty()) {
for (final Pair<String, String> entry : properties) {
final String source = Objects.toString(entry.getKey());
final String target = Objects.toString(entry.getValue());
final String baseName;
final Matcher matcher = TYPE_NAME_PAT.matcher(source);
if (matcher.find()) {
baseName = matcher.group(1);
} else {
baseName = source;
}
it.apply(baseName, source, target);
}
}
};
} | [
"public",
"static",
"IExtraLanguageConversionInitializer",
"getTypeConverterInitializer",
"(",
")",
"{",
"return",
"it",
"->",
"{",
"final",
"List",
"<",
"Pair",
"<",
"String",
",",
"String",
">",
">",
"properties",
"=",
"loadPropertyFile",
"(",
"TYPE_CONVERSION_FIL... | Replies the initializer for the type converter.
@return the initializer. | [
"Replies",
"the",
"initializer",
"for",
"the",
"type",
"converter",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyInitializers.java#L74-L92 | train |
sarl/sarl | contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyInitializers.java | PyInitializers.getFeatureNameConverterInitializer | public static IExtraLanguageConversionInitializer getFeatureNameConverterInitializer() {
return it -> {
final List<Pair<String, String>> properties = loadPropertyFile(FEATURE_CONVERSION_FILENAME);
if (!properties.isEmpty()) {
for (final Pair<String, String> entry : properties) {
final String source = Objects.toString(entry.getKey());
final String target = Objects.toString(entry.getValue());
final Matcher matcher = FEATURE_NAME_PAT.matcher(source);
final String featureName;
if (matcher.find()) {
featureName = matcher.group(1);
} else {
featureName = source;
}
it.apply(featureName, source, target);
}
}
};
} | java | public static IExtraLanguageConversionInitializer getFeatureNameConverterInitializer() {
return it -> {
final List<Pair<String, String>> properties = loadPropertyFile(FEATURE_CONVERSION_FILENAME);
if (!properties.isEmpty()) {
for (final Pair<String, String> entry : properties) {
final String source = Objects.toString(entry.getKey());
final String target = Objects.toString(entry.getValue());
final Matcher matcher = FEATURE_NAME_PAT.matcher(source);
final String featureName;
if (matcher.find()) {
featureName = matcher.group(1);
} else {
featureName = source;
}
it.apply(featureName, source, target);
}
}
};
} | [
"public",
"static",
"IExtraLanguageConversionInitializer",
"getFeatureNameConverterInitializer",
"(",
")",
"{",
"return",
"it",
"->",
"{",
"final",
"List",
"<",
"Pair",
"<",
"String",
",",
"String",
">",
">",
"properties",
"=",
"loadPropertyFile",
"(",
"FEATURE_CONV... | Replies the initializer for the feature name converter.
@return the initializer. | [
"Replies",
"the",
"initializer",
"for",
"the",
"feature",
"name",
"converter",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyInitializers.java#L98-L116 | train |
sarl/sarl | main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenProjectAdapter.java | MavenProjectAdapter.install | public static void install(ResourceSet rs, MavenProject project) {
final Iterator<Adapter> iterator = rs.eAdapters().iterator();
while (iterator.hasNext()) {
if (iterator.next() instanceof MavenProjectAdapter) {
iterator.remove();
}
}
rs.eAdapters().add(new MavenProjectAdapter(project));
} | java | public static void install(ResourceSet rs, MavenProject project) {
final Iterator<Adapter> iterator = rs.eAdapters().iterator();
while (iterator.hasNext()) {
if (iterator.next() instanceof MavenProjectAdapter) {
iterator.remove();
}
}
rs.eAdapters().add(new MavenProjectAdapter(project));
} | [
"public",
"static",
"void",
"install",
"(",
"ResourceSet",
"rs",
",",
"MavenProject",
"project",
")",
"{",
"final",
"Iterator",
"<",
"Adapter",
">",
"iterator",
"=",
"rs",
".",
"eAdapters",
"(",
")",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iterato... | Install the adapter.
@param rs the resource set that will receive the project.
@param project the project. | [
"Install",
"the",
"adapter",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/internalmaven/sarl-maven-plugin/src/main/java/io/sarl/maven/compiler/MavenProjectAdapter.java#L65-L73 | train |
sarl/sarl | products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/ProgressBarConfig.java | ProgressBarConfig.getConfiguration | public static ProgressBarConfig getConfiguration(ConfigurationFactory configFactory) {
assert configFactory != null;
return configFactory.config(ProgressBarConfig.class, PREFIX);
} | java | public static ProgressBarConfig getConfiguration(ConfigurationFactory configFactory) {
assert configFactory != null;
return configFactory.config(ProgressBarConfig.class, PREFIX);
} | [
"public",
"static",
"ProgressBarConfig",
"getConfiguration",
"(",
"ConfigurationFactory",
"configFactory",
")",
"{",
"assert",
"configFactory",
"!=",
"null",
";",
"return",
"configFactory",
".",
"config",
"(",
"ProgressBarConfig",
".",
"class",
",",
"PREFIX",
")",
"... | Replies the configuration factory for the logging.
@param configFactory the general configuration factory.
@return the logging configuration factory. | [
"Replies",
"the",
"configuration",
"factory",
"for",
"the",
"logging",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/ProgressBarConfig.java#L82-L85 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java | TopElementBuilderFragment.getGeneratedTypeAccessor | @SuppressWarnings("static-method")
@Pure
protected String getGeneratedTypeAccessor(TypeReference generatedType) {
return "get" //$NON-NLS-1$
+ Strings.toFirstUpper(generatedType.getSimpleName())
+ "()"; //$NON-NLS-1$
} | java | @SuppressWarnings("static-method")
@Pure
protected String getGeneratedTypeAccessor(TypeReference generatedType) {
return "get" //$NON-NLS-1$
+ Strings.toFirstUpper(generatedType.getSimpleName())
+ "()"; //$NON-NLS-1$
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"@",
"Pure",
"protected",
"String",
"getGeneratedTypeAccessor",
"(",
"TypeReference",
"generatedType",
")",
"{",
"return",
"\"get\"",
"//$NON-NLS-1$",
"+",
"Strings",
".",
"toFirstUpper",
"(",
"generatedType",
".... | Replies the accessor to the generated type.
@param generatedType the name of the type.
@return the accessor name. | [
"Replies",
"the",
"accessor",
"to",
"the",
"generated",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java#L80-L86 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java | TopElementBuilderFragment.generateMembers | protected List<StringConcatenationClient> generateMembers(
Collection<CodeElementExtractor.ElementDescription> grammarContainers,
TopElementDescription description, boolean forInterface, boolean forAppender, boolean namedMembers) {
final List<StringConcatenationClient> clients = new ArrayList<>();
for (final CodeElementExtractor.ElementDescription elementDescription : grammarContainers) {
clients.addAll(generateMember(elementDescription, description, forInterface, forAppender, namedMembers));
}
return clients;
} | java | protected List<StringConcatenationClient> generateMembers(
Collection<CodeElementExtractor.ElementDescription> grammarContainers,
TopElementDescription description, boolean forInterface, boolean forAppender, boolean namedMembers) {
final List<StringConcatenationClient> clients = new ArrayList<>();
for (final CodeElementExtractor.ElementDescription elementDescription : grammarContainers) {
clients.addAll(generateMember(elementDescription, description, forInterface, forAppender, namedMembers));
}
return clients;
} | [
"protected",
"List",
"<",
"StringConcatenationClient",
">",
"generateMembers",
"(",
"Collection",
"<",
"CodeElementExtractor",
".",
"ElementDescription",
">",
"grammarContainers",
",",
"TopElementDescription",
"description",
",",
"boolean",
"forInterface",
",",
"boolean",
... | Generate the creators of members.
@param grammarContainers the containers from which the members' definitions could be retreived.
@param description the description of the top element.
@param forInterface <code>true</code> if the generation is for an interface.
@param forAppender <code>true</code> if the generation is for the ISourceAppender.
@param namedMembers <code>true</code> if the members have name.
@return the code. | [
"Generate",
"the",
"creators",
"of",
"members",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java#L440-L448 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java | TopElementBuilderFragment.generateMember | protected List<StringConcatenationClient> generateMember(CodeElementExtractor.ElementDescription memberDescription,
TopElementDescription topElementDescription, boolean forInterface, boolean forAppender, boolean namedMember) {
if (namedMember) {
return generateNamedMember(memberDescription, topElementDescription, forInterface, forAppender);
}
return generateUnnamedMember(memberDescription, topElementDescription, forInterface, forAppender);
} | java | protected List<StringConcatenationClient> generateMember(CodeElementExtractor.ElementDescription memberDescription,
TopElementDescription topElementDescription, boolean forInterface, boolean forAppender, boolean namedMember) {
if (namedMember) {
return generateNamedMember(memberDescription, topElementDescription, forInterface, forAppender);
}
return generateUnnamedMember(memberDescription, topElementDescription, forInterface, forAppender);
} | [
"protected",
"List",
"<",
"StringConcatenationClient",
">",
"generateMember",
"(",
"CodeElementExtractor",
".",
"ElementDescription",
"memberDescription",
",",
"TopElementDescription",
"topElementDescription",
",",
"boolean",
"forInterface",
",",
"boolean",
"forAppender",
","... | Generate a member from the grammar.
@param memberDescription the description of the member.
@param topElementDescription the description of the top element.
@param forInterface indicates if the generated code is for interfaces.
@param forAppender <code>true</code> if the generation is for the ISourceAppender.
@param namedMember <code>true</code> if the member has name.
@return the member functions. | [
"Generate",
"a",
"member",
"from",
"the",
"grammar",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java#L459-L465 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java | TopElementBuilderFragment.generateTopElements | @SuppressWarnings("unlikely-arg-type")
protected List<TopElementDescription> generateTopElements(boolean forInterface, boolean forAppender) {
final Set<String> memberElements = determineMemberElements();
final Collection<EObject> topElementContainers = new ArrayList<>();
final List<TopElementDescription> topElements = new ArrayList<>();
for (final CodeElementExtractor.ElementDescription description : getCodeElementExtractor().getTopElements(
getGrammar(), getCodeBuilderConfig())) {
final TopElementDescription topElementDescription = new TopElementDescription(
description,
memberElements.contains(description.getElementType().getName()),
getCodeBuilderConfig().isXtendSupportEnabled() && description.isAnnotationInfo());
generateTopElement(topElementDescription, forInterface, forAppender);
topElements.add(topElementDescription);
topElementContainers.add(topElementDescription.getElementDescription().getGrammarComponent());
}
// Remove the top elements as members.
for (final TopElementDescription description : topElements) {
description.getNamedMembers().removeAll(topElementContainers);
}
return topElements;
} | java | @SuppressWarnings("unlikely-arg-type")
protected List<TopElementDescription> generateTopElements(boolean forInterface, boolean forAppender) {
final Set<String> memberElements = determineMemberElements();
final Collection<EObject> topElementContainers = new ArrayList<>();
final List<TopElementDescription> topElements = new ArrayList<>();
for (final CodeElementExtractor.ElementDescription description : getCodeElementExtractor().getTopElements(
getGrammar(), getCodeBuilderConfig())) {
final TopElementDescription topElementDescription = new TopElementDescription(
description,
memberElements.contains(description.getElementType().getName()),
getCodeBuilderConfig().isXtendSupportEnabled() && description.isAnnotationInfo());
generateTopElement(topElementDescription, forInterface, forAppender);
topElements.add(topElementDescription);
topElementContainers.add(topElementDescription.getElementDescription().getGrammarComponent());
}
// Remove the top elements as members.
for (final TopElementDescription description : topElements) {
description.getNamedMembers().removeAll(topElementContainers);
}
return topElements;
} | [
"@",
"SuppressWarnings",
"(",
"\"unlikely-arg-type\"",
")",
"protected",
"List",
"<",
"TopElementDescription",
">",
"generateTopElements",
"(",
"boolean",
"forInterface",
",",
"boolean",
"forAppender",
")",
"{",
"final",
"Set",
"<",
"String",
">",
"memberElements",
... | Generate top elements from the grammar.
@param forInterface indicates if the generated code is for interfaces.
@param forAppender <code>true</code> if the generation is for the ISourceAppender.
@return the top elements. | [
"Generate",
"top",
"elements",
"from",
"the",
"grammar",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/fragments/TopElementBuilderFragment.java#L853-L873 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper.isUnpureOperationPrototype | @SuppressWarnings("static-method")
protected boolean isUnpureOperationPrototype(XtendFunction operation) {
if (operation == null
|| operation.isAbstract() || operation.isDispatch() || operation.isNative()
|| operation.getExpression() == null) {
return true;
}
final XtendTypeDeclaration declaringType = operation.getDeclaringType();
return declaringType instanceof SarlCapacity;
} | java | @SuppressWarnings("static-method")
protected boolean isUnpureOperationPrototype(XtendFunction operation) {
if (operation == null
|| operation.isAbstract() || operation.isDispatch() || operation.isNative()
|| operation.getExpression() == null) {
return true;
}
final XtendTypeDeclaration declaringType = operation.getDeclaringType();
return declaringType instanceof SarlCapacity;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"boolean",
"isUnpureOperationPrototype",
"(",
"XtendFunction",
"operation",
")",
"{",
"if",
"(",
"operation",
"==",
"null",
"||",
"operation",
".",
"isAbstract",
"(",
")",
"||",
"operation",
".",... | Replies if the given function is purable according to its modifiers and prototype.
<p>Basically, an operation is purable if:<ul>
<li></li>
</ul>
@param operation the operation to test.
@return {@code true} if the operation is not pure according to the prototype. | [
"Replies",
"if",
"the",
"given",
"function",
"is",
"purable",
"according",
"to",
"its",
"modifiers",
"and",
"prototype",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L156-L165 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper.isPurableOperation | boolean isPurableOperation(XtendFunction operation, ISideEffectContext context) {
if (isUnpureOperationPrototype(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForNotPureOperation(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForPureOperation(operation)) {
return true;
}
if (context == null) {
return !hasSideEffects(
getInferredPrototype(operation),
operation.getExpression());
}
final Boolean result = internalHasSideEffects(operation.getExpression(), context);
return result == null || !result.booleanValue();
} | java | boolean isPurableOperation(XtendFunction operation, ISideEffectContext context) {
if (isUnpureOperationPrototype(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForNotPureOperation(operation)) {
return false;
}
if (this.nameValidator.isNamePatternForPureOperation(operation)) {
return true;
}
if (context == null) {
return !hasSideEffects(
getInferredPrototype(operation),
operation.getExpression());
}
final Boolean result = internalHasSideEffects(operation.getExpression(), context);
return result == null || !result.booleanValue();
} | [
"boolean",
"isPurableOperation",
"(",
"XtendFunction",
"operation",
",",
"ISideEffectContext",
"context",
")",
"{",
"if",
"(",
"isUnpureOperationPrototype",
"(",
"operation",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
"(",
"this",
".",
"nameValidator",
".... | Replies if the given is purable in the given context.
@param operation the operation to test.
@param context the context.
@return {@code true} if the operation could be marked as pure. | [
"Replies",
"if",
"the",
"given",
"is",
"purable",
"in",
"the",
"given",
"context",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L178-L195 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper.isReassignmentOperator | protected boolean isReassignmentOperator(XBinaryOperation operator) {
if (operator.isReassignFirstArgument()) {
return true;
}
final QualifiedName operatorName = this.operatorMapping.getOperator(
QualifiedName.create(operator.getFeature().getSimpleName()));
final QualifiedName compboundOperatorName = this.operatorMapping.getSimpleOperator(operatorName);
return compboundOperatorName != null;
} | java | protected boolean isReassignmentOperator(XBinaryOperation operator) {
if (operator.isReassignFirstArgument()) {
return true;
}
final QualifiedName operatorName = this.operatorMapping.getOperator(
QualifiedName.create(operator.getFeature().getSimpleName()));
final QualifiedName compboundOperatorName = this.operatorMapping.getSimpleOperator(operatorName);
return compboundOperatorName != null;
} | [
"protected",
"boolean",
"isReassignmentOperator",
"(",
"XBinaryOperation",
"operator",
")",
"{",
"if",
"(",
"operator",
".",
"isReassignFirstArgument",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"final",
"QualifiedName",
"operatorName",
"=",
"this",
".",
"o... | Replies if the given operator is a reassignment operator.
A reassignment operator changes its left operand.
@param operator the operator.
@return {@code true} if the operator changes its left operand. | [
"Replies",
"if",
"the",
"given",
"operator",
"is",
"a",
"reassignment",
"operator",
".",
"A",
"reassignment",
"operator",
"changes",
"its",
"left",
"operand",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L643-L651 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java | SARLOperationHelper.evaluatePureAnnotationAdapters | boolean evaluatePureAnnotationAdapters(org.eclipse.xtext.common.types.JvmOperation operation, ISideEffectContext context) {
int index = -1;
int i = 0;
for (final Adapter adapter : operation.eAdapters()) {
if (adapter.isAdapterForType(AnnotationJavaGenerationAdapter.class)) {
index = i;
break;
}
++i;
}
if (index >= 0) {
final AnnotationJavaGenerationAdapter annotationAdapter = (AnnotationJavaGenerationAdapter) operation.eAdapters().get(index);
assert annotationAdapter != null;
return annotationAdapter.applyAdaptations(this, operation, context);
}
return false;
} | java | boolean evaluatePureAnnotationAdapters(org.eclipse.xtext.common.types.JvmOperation operation, ISideEffectContext context) {
int index = -1;
int i = 0;
for (final Adapter adapter : operation.eAdapters()) {
if (adapter.isAdapterForType(AnnotationJavaGenerationAdapter.class)) {
index = i;
break;
}
++i;
}
if (index >= 0) {
final AnnotationJavaGenerationAdapter annotationAdapter = (AnnotationJavaGenerationAdapter) operation.eAdapters().get(index);
assert annotationAdapter != null;
return annotationAdapter.applyAdaptations(this, operation, context);
}
return false;
} | [
"boolean",
"evaluatePureAnnotationAdapters",
"(",
"org",
".",
"eclipse",
".",
"xtext",
".",
"common",
".",
"types",
".",
"JvmOperation",
"operation",
",",
"ISideEffectContext",
"context",
")",
"{",
"int",
"index",
"=",
"-",
"1",
";",
"int",
"i",
"=",
"0",
... | Evalute the Pure annotatino adapters.
@param operation the operation to adapt.
@param context the context.
@return {@code true} if the pure annotation could be associated to the given operation. | [
"Evalute",
"the",
"Pure",
"annotatino",
"adapters",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLOperationHelper.java#L793-L809 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLLabelProvider.java | SARLLabelProvider.handleImageDescriptorError | protected ImageDescriptor handleImageDescriptorError(Object[] params, Throwable exception) {
if (exception instanceof NullPointerException) {
final Object defaultImage = getDefaultImage();
if (defaultImage instanceof ImageDescriptor) {
return (ImageDescriptor) defaultImage;
}
if (defaultImage instanceof Image) {
return ImageDescriptor.createFromImage((Image) defaultImage);
}
return super.imageDescriptor(params[0]);
}
return Exceptions.throwUncheckedException(exception);
} | java | protected ImageDescriptor handleImageDescriptorError(Object[] params, Throwable exception) {
if (exception instanceof NullPointerException) {
final Object defaultImage = getDefaultImage();
if (defaultImage instanceof ImageDescriptor) {
return (ImageDescriptor) defaultImage;
}
if (defaultImage instanceof Image) {
return ImageDescriptor.createFromImage((Image) defaultImage);
}
return super.imageDescriptor(params[0]);
}
return Exceptions.throwUncheckedException(exception);
} | [
"protected",
"ImageDescriptor",
"handleImageDescriptorError",
"(",
"Object",
"[",
"]",
"params",
",",
"Throwable",
"exception",
")",
"{",
"if",
"(",
"exception",
"instanceof",
"NullPointerException",
")",
"{",
"final",
"Object",
"defaultImage",
"=",
"getDefaultImage",... | Invoked when an image descriptor cannot be found.
@param params the parameters given to the method polymorphic dispatcher.
@param exception the cause of the error.
@return the image descriptor for the error. | [
"Invoked",
"when",
"an",
"image",
"descriptor",
"cannot",
"be",
"found",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLLabelProvider.java#L162-L174 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLLabelProvider.java | SARLLabelProvider.signatureWithoutReturnType | protected StyledString signatureWithoutReturnType(StyledString simpleName, JvmExecutable element) {
return simpleName.append(this.uiStrings.styledParameters(element));
} | java | protected StyledString signatureWithoutReturnType(StyledString simpleName, JvmExecutable element) {
return simpleName.append(this.uiStrings.styledParameters(element));
} | [
"protected",
"StyledString",
"signatureWithoutReturnType",
"(",
"StyledString",
"simpleName",
",",
"JvmExecutable",
"element",
")",
"{",
"return",
"simpleName",
".",
"append",
"(",
"this",
".",
"uiStrings",
".",
"styledParameters",
"(",
"element",
")",
")",
";",
"... | Create a string representation of a signature without the return type.
@param simpleName the action name.
@param element the executable element.
@return the signature. | [
"Create",
"a",
"string",
"representation",
"of",
"a",
"signature",
"without",
"the",
"return",
"type",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLLabelProvider.java#L182-L184 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLLabelProvider.java | SARLLabelProvider.getHumanReadableName | protected StyledString getHumanReadableName(JvmTypeReference reference) {
if (reference == null) {
return new StyledString("Object"); //$NON-NLS-1$
}
final String name = this.uiStrings.referenceToString(reference, "Object"); //$NON-NLS-1$
return convertToStyledString(name);
} | java | protected StyledString getHumanReadableName(JvmTypeReference reference) {
if (reference == null) {
return new StyledString("Object"); //$NON-NLS-1$
}
final String name = this.uiStrings.referenceToString(reference, "Object"); //$NON-NLS-1$
return convertToStyledString(name);
} | [
"protected",
"StyledString",
"getHumanReadableName",
"(",
"JvmTypeReference",
"reference",
")",
"{",
"if",
"(",
"reference",
"==",
"null",
")",
"{",
"return",
"new",
"StyledString",
"(",
"\"Object\"",
")",
";",
"//$NON-NLS-1$",
"}",
"final",
"String",
"name",
"=... | Create a string representation of the given element.
@param reference the element.
@return the string representation. | [
"Create",
"a",
"string",
"representation",
"of",
"the",
"given",
"element",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/labeling/SARLLabelProvider.java#L216-L222 | train |
sarl/sarl | main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/ImportMavenSarlProjectsJob.java | ImportMavenSarlProjectsJob.createOperation | protected AbstractCreateMavenProjectsOperation createOperation() {
return new AbstractCreateMavenProjectsOperation() {
@SuppressWarnings("synthetic-access")
@Override
protected List<IProject> doCreateMavenProjects(IProgressMonitor progressMonitor) throws CoreException {
final SubMonitor monitor = SubMonitor.convert(progressMonitor, 101);
try {
final List<IMavenProjectImportResult> results = MavenImportUtils.runFixedImportJob(
true,
getProjects(),
getImportConfiguration(),
new MavenProjectWorkspaceAssigner(getWorkingSets()),
monitor.newChild(100));
return toProjects(results);
} finally {
restorePom();
monitor.done();
}
}
};
} | java | protected AbstractCreateMavenProjectsOperation createOperation() {
return new AbstractCreateMavenProjectsOperation() {
@SuppressWarnings("synthetic-access")
@Override
protected List<IProject> doCreateMavenProjects(IProgressMonitor progressMonitor) throws CoreException {
final SubMonitor monitor = SubMonitor.convert(progressMonitor, 101);
try {
final List<IMavenProjectImportResult> results = MavenImportUtils.runFixedImportJob(
true,
getProjects(),
getImportConfiguration(),
new MavenProjectWorkspaceAssigner(getWorkingSets()),
monitor.newChild(100));
return toProjects(results);
} finally {
restorePom();
monitor.done();
}
}
};
} | [
"protected",
"AbstractCreateMavenProjectsOperation",
"createOperation",
"(",
")",
"{",
"return",
"new",
"AbstractCreateMavenProjectsOperation",
"(",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"synthetic-access\"",
")",
"@",
"Override",
"protected",
"List",
"<",
"IProject",... | Create the operation for creating the projects.
@return the operation. | [
"Create",
"the",
"operation",
"for",
"creating",
"the",
"projects",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.m2e/src/io/sarl/m2e/wizards/importproject/ImportMavenSarlProjectsJob.java#L114-L134 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/dialog/SARLArgumentsTab.java | SARLArgumentsTab.createSREArgsBlock | protected void createSREArgsBlock(Composite parent, Font font) {
// Create the block for the SRE
final Group group = new Group(parent, SWT.NONE);
group.setFont(font);
final GridLayout layout = new GridLayout();
group.setLayout(layout);
group.setLayoutData(new GridData(GridData.FILL_BOTH));
// Move the SRE argument block before the JVM argument block
group.moveAbove(this.fVMArgumentsBlock.getControl());
group.setText(Messages.SARLArgumentsTab_1);
createSREArgsText(group, font);
createSREArgsVariableButton(group);
} | java | protected void createSREArgsBlock(Composite parent, Font font) {
// Create the block for the SRE
final Group group = new Group(parent, SWT.NONE);
group.setFont(font);
final GridLayout layout = new GridLayout();
group.setLayout(layout);
group.setLayoutData(new GridData(GridData.FILL_BOTH));
// Move the SRE argument block before the JVM argument block
group.moveAbove(this.fVMArgumentsBlock.getControl());
group.setText(Messages.SARLArgumentsTab_1);
createSREArgsText(group, font);
createSREArgsVariableButton(group);
} | [
"protected",
"void",
"createSREArgsBlock",
"(",
"Composite",
"parent",
",",
"Font",
"font",
")",
"{",
"// Create the block for the SRE",
"final",
"Group",
"group",
"=",
"new",
"Group",
"(",
"parent",
",",
"SWT",
".",
"NONE",
")",
";",
"group",
".",
"setFont",
... | Create the block for the SRE arguments.
@param parent the parent composite.
@param font the font for the block. | [
"Create",
"the",
"block",
"for",
"the",
"SRE",
"arguments",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/launching/dialog/SARLArgumentsTab.java#L103-L117 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/SarlConfiguration.java | SarlConfiguration.resetPackageList | private void resetPackageList() {
final Set<PackageDoc> set = new TreeSet<>();
for (final PackageDoc pack : this.root.specifiedPackages()) {
set.add(pack);
}
for (final ClassDoc clazz : this.root.specifiedClasses()) {
set.add(clazz.containingPackage());
}
this.packages = Utils.toArray(this.packages, set);
} | java | private void resetPackageList() {
final Set<PackageDoc> set = new TreeSet<>();
for (final PackageDoc pack : this.root.specifiedPackages()) {
set.add(pack);
}
for (final ClassDoc clazz : this.root.specifiedClasses()) {
set.add(clazz.containingPackage());
}
this.packages = Utils.toArray(this.packages, set);
} | [
"private",
"void",
"resetPackageList",
"(",
")",
"{",
"final",
"Set",
"<",
"PackageDoc",
">",
"set",
"=",
"new",
"TreeSet",
"<>",
"(",
")",
";",
"for",
"(",
"final",
"PackageDoc",
"pack",
":",
"this",
".",
"root",
".",
"specifiedPackages",
"(",
")",
")... | Reset the list of packages for avoiding duplicates.
<p>The inherited implementation uses a HashSet that allow
the same package to be stored multiple times. Here,
we uses a TreeSet for using the "compareTo" mechanism. | [
"Reset",
"the",
"list",
"of",
"packages",
"for",
"avoiding",
"duplicates",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/SarlConfiguration.java#L118-L127 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java | AbstractGeneratorConfigurationBlock.getOutputConfiguration | protected OutputConfiguration getOutputConfiguration() {
final Set<OutputConfiguration> outputConfigurations = this.configurationProvider.getOutputConfigurations(getProject());
final String expectedName = ExtraLanguageOutputConfigurations.createOutputConfigurationName(getPreferenceID());
return Iterables.find(outputConfigurations, it -> expectedName.equals(it.getName()));
} | java | protected OutputConfiguration getOutputConfiguration() {
final Set<OutputConfiguration> outputConfigurations = this.configurationProvider.getOutputConfigurations(getProject());
final String expectedName = ExtraLanguageOutputConfigurations.createOutputConfigurationName(getPreferenceID());
return Iterables.find(outputConfigurations, it -> expectedName.equals(it.getName()));
} | [
"protected",
"OutputConfiguration",
"getOutputConfiguration",
"(",
")",
"{",
"final",
"Set",
"<",
"OutputConfiguration",
">",
"outputConfigurations",
"=",
"this",
".",
"configurationProvider",
".",
"getOutputConfigurations",
"(",
"getProject",
"(",
")",
")",
";",
"fin... | Replies the output configuration associated to the extra language generator.
@return the output configuration. | [
"Replies",
"the",
"output",
"configuration",
"associated",
"to",
"the",
"extra",
"language",
"generator",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L259-L263 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java | AbstractGeneratorConfigurationBlock.createTypeConversionSectionItems | protected void createTypeConversionSectionItems(Composite parentComposite) {
final TypeConversionTable typeConversionTable = new TypeConversionTable(
this, getTargetLanguageImage(),
getPreferenceStore(), getPreferenceID());
typeConversionTable.doCreate(parentComposite, getDialogSettings());
makeScrollableCompositeAware(typeConversionTable.getControl());
addExtraControl(typeConversionTable);
} | java | protected void createTypeConversionSectionItems(Composite parentComposite) {
final TypeConversionTable typeConversionTable = new TypeConversionTable(
this, getTargetLanguageImage(),
getPreferenceStore(), getPreferenceID());
typeConversionTable.doCreate(parentComposite, getDialogSettings());
makeScrollableCompositeAware(typeConversionTable.getControl());
addExtraControl(typeConversionTable);
} | [
"protected",
"void",
"createTypeConversionSectionItems",
"(",
"Composite",
"parentComposite",
")",
"{",
"final",
"TypeConversionTable",
"typeConversionTable",
"=",
"new",
"TypeConversionTable",
"(",
"this",
",",
"getTargetLanguageImage",
"(",
")",
",",
"getPreferenceStore",... | Create the items for the "Type Conversion" section.
@param parentComposite the parent. | [
"Create",
"the",
"items",
"for",
"the",
"Type",
"Conversion",
"section",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L315-L322 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java | AbstractGeneratorConfigurationBlock.makeScrollableCompositeAware | protected static void makeScrollableCompositeAware(Control control) {
final ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(control);
if (parentScrolledComposite != null) {
parentScrolledComposite.adaptChild(control);
}
} | java | protected static void makeScrollableCompositeAware(Control control) {
final ScrolledPageContent parentScrolledComposite = getParentScrolledComposite(control);
if (parentScrolledComposite != null) {
parentScrolledComposite.adaptChild(control);
}
} | [
"protected",
"static",
"void",
"makeScrollableCompositeAware",
"(",
"Control",
"control",
")",
"{",
"final",
"ScrolledPageContent",
"parentScrolledComposite",
"=",
"getParentScrolledComposite",
"(",
"control",
")",
";",
"if",
"(",
"parentScrolledComposite",
"!=",
"null",
... | Make the given control awaer of the scrolling events.
@param control the control to adapt to. | [
"Make",
"the",
"given",
"control",
"awaer",
"of",
"the",
"scrolling",
"events",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L339-L344 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java | AbstractGeneratorConfigurationBlock.createFeatureConversionSectionItems | protected void createFeatureConversionSectionItems(Composite parentComposite) {
final FeatureNameConversionTable typeConversionTable = new FeatureNameConversionTable(
this, getTargetLanguageImage(),
getPreferenceStore(), getPreferenceID());
typeConversionTable.doCreate(parentComposite, getDialogSettings());
makeScrollableCompositeAware(typeConversionTable.getControl());
addExtraControl(typeConversionTable);
} | java | protected void createFeatureConversionSectionItems(Composite parentComposite) {
final FeatureNameConversionTable typeConversionTable = new FeatureNameConversionTable(
this, getTargetLanguageImage(),
getPreferenceStore(), getPreferenceID());
typeConversionTable.doCreate(parentComposite, getDialogSettings());
makeScrollableCompositeAware(typeConversionTable.getControl());
addExtraControl(typeConversionTable);
} | [
"protected",
"void",
"createFeatureConversionSectionItems",
"(",
"Composite",
"parentComposite",
")",
"{",
"final",
"FeatureNameConversionTable",
"typeConversionTable",
"=",
"new",
"FeatureNameConversionTable",
"(",
"this",
",",
"getTargetLanguageImage",
"(",
")",
",",
"get... | Create the items for the "Feature Conversion" section.
@param parentComposite the parent. | [
"Create",
"the",
"items",
"for",
"the",
"Feature",
"Conversion",
"section",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L350-L357 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java | AbstractGeneratorConfigurationBlock.createExperimentalWarningMessage | protected void createExperimentalWarningMessage(Composite composite) {
final Label dangerIcon = new Label(composite, SWT.WRAP);
dangerIcon.setImage(getImage(IMAGE));
final GridData labelLayoutData = new GridData();
labelLayoutData.horizontalIndent = 0;
dangerIcon.setLayoutData(labelLayoutData);
} | java | protected void createExperimentalWarningMessage(Composite composite) {
final Label dangerIcon = new Label(composite, SWT.WRAP);
dangerIcon.setImage(getImage(IMAGE));
final GridData labelLayoutData = new GridData();
labelLayoutData.horizontalIndent = 0;
dangerIcon.setLayoutData(labelLayoutData);
} | [
"protected",
"void",
"createExperimentalWarningMessage",
"(",
"Composite",
"composite",
")",
"{",
"final",
"Label",
"dangerIcon",
"=",
"new",
"Label",
"(",
"composite",
",",
"SWT",
".",
"WRAP",
")",
";",
"dangerIcon",
".",
"setImage",
"(",
"getImage",
"(",
"IM... | Create the "experimental" warning message.
@param composite the parent. | [
"Create",
"the",
"experimental",
"warning",
"message",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L369-L375 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java | AbstractGeneratorConfigurationBlock.getImage | protected final Image getImage(String imagePath) {
final ImageDescriptor descriptor = getImageDescriptor(imagePath);
if (descriptor == null) {
return null;
}
return descriptor.createImage();
} | java | protected final Image getImage(String imagePath) {
final ImageDescriptor descriptor = getImageDescriptor(imagePath);
if (descriptor == null) {
return null;
}
return descriptor.createImage();
} | [
"protected",
"final",
"Image",
"getImage",
"(",
"String",
"imagePath",
")",
"{",
"final",
"ImageDescriptor",
"descriptor",
"=",
"getImageDescriptor",
"(",
"imagePath",
")",
";",
"if",
"(",
"descriptor",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"re... | Replies the image.
@param imagePath the image path.
@return the image. | [
"Replies",
"the",
"image",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L382-L388 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java | AbstractGeneratorConfigurationBlock.getImageDescriptor | @SuppressWarnings("static-method")
protected ImageDescriptor getImageDescriptor(String imagePath) {
final LangActivator activator = LangActivator.getInstance();
final ImageRegistry registry = activator.getImageRegistry();
ImageDescriptor descriptor = registry.getDescriptor(imagePath);
if (descriptor == null) {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(activator.getBundle().getSymbolicName(), imagePath);
if (descriptor != null) {
registry.put(imagePath, descriptor);
}
}
return descriptor;
} | java | @SuppressWarnings("static-method")
protected ImageDescriptor getImageDescriptor(String imagePath) {
final LangActivator activator = LangActivator.getInstance();
final ImageRegistry registry = activator.getImageRegistry();
ImageDescriptor descriptor = registry.getDescriptor(imagePath);
if (descriptor == null) {
descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(activator.getBundle().getSymbolicName(), imagePath);
if (descriptor != null) {
registry.put(imagePath, descriptor);
}
}
return descriptor;
} | [
"@",
"SuppressWarnings",
"(",
"\"static-method\"",
")",
"protected",
"ImageDescriptor",
"getImageDescriptor",
"(",
"String",
"imagePath",
")",
"{",
"final",
"LangActivator",
"activator",
"=",
"LangActivator",
".",
"getInstance",
"(",
")",
";",
"final",
"ImageRegistry"... | Replies the image descriptor.
@param imagePath the image path.
@return the image descriptor. | [
"Replies",
"the",
"image",
"descriptor",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L395-L407 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java | AbstractGeneratorConfigurationBlock.createGeneralSectionItems | protected void createGeneralSectionItems(Composite composite) {
addCheckBox(composite, getActivationText(),
ExtraLanguagePreferenceAccess.getPrefixedKey(getPreferenceID(),
ExtraLanguagePreferenceAccess.ENABLED_PROPERTY),
BOOLEAN_VALUES, 0);
} | java | protected void createGeneralSectionItems(Composite composite) {
addCheckBox(composite, getActivationText(),
ExtraLanguagePreferenceAccess.getPrefixedKey(getPreferenceID(),
ExtraLanguagePreferenceAccess.ENABLED_PROPERTY),
BOOLEAN_VALUES, 0);
} | [
"protected",
"void",
"createGeneralSectionItems",
"(",
"Composite",
"composite",
")",
"{",
"addCheckBox",
"(",
"composite",
",",
"getActivationText",
"(",
")",
",",
"ExtraLanguagePreferenceAccess",
".",
"getPrefixedKey",
"(",
"getPreferenceID",
"(",
")",
",",
"ExtraLa... | Create the items for the "General" section.
@param composite the parent. | [
"Create",
"the",
"items",
"for",
"the",
"General",
"section",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L413-L418 | train |
sarl/sarl | main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java | AbstractGeneratorConfigurationBlock.createOutputSectionItems | protected void createOutputSectionItems(Composite composite, OutputConfiguration outputConfiguration) {
final Text defaultDirectoryField = addTextField(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_Directory,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_DIRECTORY), 0, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CreateDirectory,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_CREATE_DIRECTORY), BOOLEAN_VALUES, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_OverrideExistingResources,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_OVERRIDE), BOOLEAN_VALUES, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CreatesDerivedResources,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_DERIVED), BOOLEAN_VALUES, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CleanupDerivedResources,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_CLEANUP_DERIVED), BOOLEAN_VALUES, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CleanDirectory,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_CLEAN_DIRECTORY), BOOLEAN_VALUES, 0);
final Button installAsPrimaryButton = addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.BuilderConfigurationBlock_InstallDslAsPrimarySource,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.INSTALL_DSL_AS_PRIMARY_SOURCE), BOOLEAN_VALUES, 0);
final Button hideLocalButton = addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.BuilderConfigurationBlock_hideSyntheticLocalVariables,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.HIDE_LOCAL_SYNTHETIC_VARIABLES), BOOLEAN_VALUES, 0);
hideLocalButton.setEnabled(installAsPrimaryButton.getSelection());
installAsPrimaryButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent exception) {
hideLocalButton.setEnabled(installAsPrimaryButton.getSelection());
}
});
final GridData hideLocalButtonData = new GridData();
hideLocalButtonData.horizontalIndent = INDENT_AMOUNT;
hideLocalButton.setLayoutData(hideLocalButtonData);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_KeepLocalHistory,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_KEEP_LOCAL_HISTORY), BOOLEAN_VALUES, 0);
if (getProject() != null && !outputConfiguration.getSourceFolders().isEmpty()) {
final Button outputPerSourceButton = addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_UseOutputPerSourceFolder,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.USE_OUTPUT_PER_SOURCE_FOLDER), BOOLEAN_VALUES, 0);
final Table table = createOutputFolderTable(composite, outputConfiguration, defaultDirectoryField);
table.setVisible(outputPerSourceButton.getSelection());
outputPerSourceButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent exception) {
table.setVisible(outputPerSourceButton.getSelection());
}
});
}
} | java | protected void createOutputSectionItems(Composite composite, OutputConfiguration outputConfiguration) {
final Text defaultDirectoryField = addTextField(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_Directory,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_DIRECTORY), 0, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CreateDirectory,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_CREATE_DIRECTORY), BOOLEAN_VALUES, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_OverrideExistingResources,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_OVERRIDE), BOOLEAN_VALUES, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CreatesDerivedResources,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_DERIVED), BOOLEAN_VALUES, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CleanupDerivedResources,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_CLEANUP_DERIVED), BOOLEAN_VALUES, 0);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_CleanDirectory,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_CLEAN_DIRECTORY), BOOLEAN_VALUES, 0);
final Button installAsPrimaryButton = addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.BuilderConfigurationBlock_InstallDslAsPrimarySource,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.INSTALL_DSL_AS_PRIMARY_SOURCE), BOOLEAN_VALUES, 0);
final Button hideLocalButton = addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.BuilderConfigurationBlock_hideSyntheticLocalVariables,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.HIDE_LOCAL_SYNTHETIC_VARIABLES), BOOLEAN_VALUES, 0);
hideLocalButton.setEnabled(installAsPrimaryButton.getSelection());
installAsPrimaryButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent exception) {
hideLocalButton.setEnabled(installAsPrimaryButton.getSelection());
}
});
final GridData hideLocalButtonData = new GridData();
hideLocalButtonData.horizontalIndent = INDENT_AMOUNT;
hideLocalButton.setLayoutData(hideLocalButtonData);
addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_KeepLocalHistory,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.OUTPUT_KEEP_LOCAL_HISTORY), BOOLEAN_VALUES, 0);
if (getProject() != null && !outputConfiguration.getSourceFolders().isEmpty()) {
final Button outputPerSourceButton = addCheckBox(composite,
org.eclipse.xtext.builder.preferences.Messages.OutputConfigurationPage_UseOutputPerSourceFolder,
BuilderPreferenceAccess.getKey(outputConfiguration,
EclipseOutputConfigurationProvider.USE_OUTPUT_PER_SOURCE_FOLDER), BOOLEAN_VALUES, 0);
final Table table = createOutputFolderTable(composite, outputConfiguration, defaultDirectoryField);
table.setVisible(outputPerSourceButton.getSelection());
outputPerSourceButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent exception) {
table.setVisible(outputPerSourceButton.getSelection());
}
});
}
} | [
"protected",
"void",
"createOutputSectionItems",
"(",
"Composite",
"composite",
",",
"OutputConfiguration",
"outputConfiguration",
")",
"{",
"final",
"Text",
"defaultDirectoryField",
"=",
"addTextField",
"(",
"composite",
",",
"org",
".",
"eclipse",
".",
"xtext",
".",... | Create the items for the "Output" section.
@param composite the parent.
@param outputConfiguration the output configuration. | [
"Create",
"the",
"items",
"for",
"the",
"Output",
"section",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractGeneratorConfigurationBlock.java#L494-L556 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/explorer/SARLPackageExplorerPart.java | SARLPackageExplorerPart.getDialogSettings | protected IDialogSettings getDialogSettings() {
try {
return (IDialogSettings) this.reflect.get(this, "fDialogSettings"); //$NON-NLS-1$
} catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
} | java | protected IDialogSettings getDialogSettings() {
try {
return (IDialogSettings) this.reflect.get(this, "fDialogSettings"); //$NON-NLS-1$
} catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
} | [
"protected",
"IDialogSettings",
"getDialogSettings",
"(",
")",
"{",
"try",
"{",
"return",
"(",
"IDialogSettings",
")",
"this",
".",
"reflect",
".",
"get",
"(",
"this",
",",
"\"fDialogSettings\"",
")",
";",
"//$NON-NLS-1$",
"}",
"catch",
"(",
"SecurityException",... | Replies the dialog settings for this view.
@return the settings. | [
"Replies",
"the",
"dialog",
"settings",
"for",
"this",
"view",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/explorer/SARLPackageExplorerPart.java#L128-L134 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/explorer/SARLPackageExplorerPart.java | SARLPackageExplorerPart.restoreFilterAndSorter | protected void restoreFilterAndSorter() {
final ProblemTreeViewer viewer = getViewer();
viewer.addFilter(new EmptyInnerPackageFilter());
viewer.addFilter(new HiddenFileFilter());
} | java | protected void restoreFilterAndSorter() {
final ProblemTreeViewer viewer = getViewer();
viewer.addFilter(new EmptyInnerPackageFilter());
viewer.addFilter(new HiddenFileFilter());
} | [
"protected",
"void",
"restoreFilterAndSorter",
"(",
")",
"{",
"final",
"ProblemTreeViewer",
"viewer",
"=",
"getViewer",
"(",
")",
";",
"viewer",
".",
"addFilter",
"(",
"new",
"EmptyInnerPackageFilter",
"(",
")",
")",
";",
"viewer",
".",
"addFilter",
"(",
"new"... | Restore the filters and sorters. | [
"Restore",
"the",
"filters",
"and",
"sorters",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/explorer/SARLPackageExplorerPart.java#L182-L186 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/explorer/SARLPackageExplorerPart.java | SARLPackageExplorerPart.internalResetLabelProvider | protected void internalResetLabelProvider() {
try {
final PackageExplorerLabelProvider provider = createLabelProvider();
this.reflect.set(this, "fLabelProvider", provider); //$NON-NLS-1$
provider.setIsFlatLayout(isFlatLayout());
final DecoratingJavaLabelProvider decoratingProvider = new DecoratingJavaLabelProvider(
provider, false, isFlatLayout());
this.reflect.set(this, "fDecoratingLabelProvider", decoratingProvider); //$NON-NLS-1$
getViewer().setLabelProvider(decoratingProvider);
} catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
} | java | protected void internalResetLabelProvider() {
try {
final PackageExplorerLabelProvider provider = createLabelProvider();
this.reflect.set(this, "fLabelProvider", provider); //$NON-NLS-1$
provider.setIsFlatLayout(isFlatLayout());
final DecoratingJavaLabelProvider decoratingProvider = new DecoratingJavaLabelProvider(
provider, false, isFlatLayout());
this.reflect.set(this, "fDecoratingLabelProvider", decoratingProvider); //$NON-NLS-1$
getViewer().setLabelProvider(decoratingProvider);
} catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
} | [
"protected",
"void",
"internalResetLabelProvider",
"(",
")",
"{",
"try",
"{",
"final",
"PackageExplorerLabelProvider",
"provider",
"=",
"createLabelProvider",
"(",
")",
";",
"this",
".",
"reflect",
".",
"set",
"(",
"this",
",",
"\"fLabelProvider\"",
",",
"provider... | Reset the label provider for using the SARL one. | [
"Reset",
"the",
"label",
"provider",
"for",
"using",
"the",
"SARL",
"one",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/explorer/SARLPackageExplorerPart.java#L197-L210 | train |
sarl/sarl | main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/explorer/SARLPackageExplorerPart.java | SARLPackageExplorerPart.getViewer | protected ProblemTreeViewer getViewer() {
try {
return (ProblemTreeViewer) this.reflect.get(this, "fViewer"); //$NON-NLS-1$
} catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
} | java | protected ProblemTreeViewer getViewer() {
try {
return (ProblemTreeViewer) this.reflect.get(this, "fViewer"); //$NON-NLS-1$
} catch (SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e) {
throw new Error(e);
}
} | [
"protected",
"ProblemTreeViewer",
"getViewer",
"(",
")",
"{",
"try",
"{",
"return",
"(",
"ProblemTreeViewer",
")",
"this",
".",
"reflect",
".",
"get",
"(",
"this",
",",
"\"fViewer\"",
")",
";",
"//$NON-NLS-1$",
"}",
"catch",
"(",
"SecurityException",
"|",
"N... | Replies the viewer.
@return the viewer. | [
"Replies",
"the",
"viewer",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/explorer/SARLPackageExplorerPart.java#L228-L234 | train |
sarl/sarl | main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlEnumerationBuilderImpl.java | SarlEnumerationBuilderImpl.addSarlEnumLiteral | public ISarlEnumLiteralBuilder addSarlEnumLiteral(String name) {
ISarlEnumLiteralBuilder builder = this.iSarlEnumLiteralBuilderProvider.get();
builder.eInit(getSarlEnumeration(), name, getTypeResolutionContext());
return builder;
} | java | public ISarlEnumLiteralBuilder addSarlEnumLiteral(String name) {
ISarlEnumLiteralBuilder builder = this.iSarlEnumLiteralBuilderProvider.get();
builder.eInit(getSarlEnumeration(), name, getTypeResolutionContext());
return builder;
} | [
"public",
"ISarlEnumLiteralBuilder",
"addSarlEnumLiteral",
"(",
"String",
"name",
")",
"{",
"ISarlEnumLiteralBuilder",
"builder",
"=",
"this",
".",
"iSarlEnumLiteralBuilderProvider",
".",
"get",
"(",
")",
";",
"builder",
".",
"eInit",
"(",
"getSarlEnumeration",
"(",
... | Create a SarlEnumLiteral.
@param name the name of the SarlEnumLiteral.
@return the builder. | [
"Create",
"a",
"SarlEnumLiteral",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/SarlEnumerationBuilderImpl.java#L141-L145 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/proxy/ProgrammaticWrappingProxyInstaller.java | ProgrammaticWrappingProxyInstaller.wrap | public ClassDoc wrap(ClassDoc source) {
if (source == null || source instanceof Proxy<?> || !(source instanceof ClassDocImpl)) {
return source;
}
return new ClassDocWrapper((ClassDocImpl) source);
} | java | public ClassDoc wrap(ClassDoc source) {
if (source == null || source instanceof Proxy<?> || !(source instanceof ClassDocImpl)) {
return source;
}
return new ClassDocWrapper((ClassDocImpl) source);
} | [
"public",
"ClassDoc",
"wrap",
"(",
"ClassDoc",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
"||",
"source",
"instanceof",
"Proxy",
"<",
"?",
">",
"||",
"!",
"(",
"source",
"instanceof",
"ClassDocImpl",
")",
")",
"{",
"return",
"source",
";",
... | Wrap a class doc.
@param source the source
@return the wrapper. | [
"Wrap",
"a",
"class",
"doc",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/proxy/ProgrammaticWrappingProxyInstaller.java#L162-L167 | train |
sarl/sarl | docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/proxy/ProgrammaticWrappingProxyInstaller.java | ProgrammaticWrappingProxyInstaller.wrap | public FieldDoc wrap(FieldDoc source) {
if (source == null || source instanceof Proxy<?> || !(source instanceof FieldDocImpl)) {
return source;
}
return new FieldDocWrapper((FieldDocImpl) source);
} | java | public FieldDoc wrap(FieldDoc source) {
if (source == null || source instanceof Proxy<?> || !(source instanceof FieldDocImpl)) {
return source;
}
return new FieldDocWrapper((FieldDocImpl) source);
} | [
"public",
"FieldDoc",
"wrap",
"(",
"FieldDoc",
"source",
")",
"{",
"if",
"(",
"source",
"==",
"null",
"||",
"source",
"instanceof",
"Proxy",
"<",
"?",
">",
"||",
"!",
"(",
"source",
"instanceof",
"FieldDocImpl",
")",
")",
"{",
"return",
"source",
";",
... | Wrap a field doc.
@param source the source
@return the wrapper. | [
"Wrap",
"a",
"field",
"doc",
"."
] | ca00ff994598c730339972def4e19a60e0b8cace | https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/proxy/ProgrammaticWrappingProxyInstaller.java#L230-L235 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.