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.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.fireDefaultSREChanged
private static void fireDefaultSREChanged(ISREInstall previous, ISREInstall current) { for (final Object listener : SRE_LISTENERS.getListeners()) { ((ISREInstallChangedListener) listener).defaultSREInstallChanged(previous, current); } }
java
private static void fireDefaultSREChanged(ISREInstall previous, ISREInstall current) { for (final Object listener : SRE_LISTENERS.getListeners()) { ((ISREInstallChangedListener) listener).defaultSREInstallChanged(previous, current); } }
[ "private", "static", "void", "fireDefaultSREChanged", "(", "ISREInstall", "previous", ",", "ISREInstall", "current", ")", "{", "for", "(", "final", "Object", "listener", ":", "SRE_LISTENERS", ".", "getListeners", "(", ")", ")", "{", "(", "(", "ISREInstallChanged...
Notifies registered listeners that the default SRE has changed. @param previous the previous SRE @param current the new current default SRE
[ "Notifies", "registered", "listeners", "that", "the", "default", "SRE", "has", "changed", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L391-L395
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.isPlatformSRE
public static boolean isPlatformSRE(ISREInstall sre) { if (sre != null) { LOCK.lock(); try { return platformSREInstalls.contains(sre.getId()); } finally { LOCK.unlock(); } } return false; }
java
public static boolean isPlatformSRE(ISREInstall sre) { if (sre != null) { LOCK.lock(); try { return platformSREInstalls.contains(sre.getId()); } finally { LOCK.unlock(); } } return false; }
[ "public", "static", "boolean", "isPlatformSRE", "(", "ISREInstall", "sre", ")", "{", "if", "(", "sre", "!=", "null", ")", "{", "LOCK", ".", "lock", "(", ")", ";", "try", "{", "return", "platformSREInstalls", ".", "contains", "(", "sre", ".", "getId", "...
Replies if the given SRE is provided by the Eclipse platform through an extension point. @param sre the sre. @return <code>true</code> if the SRE was provided through an extension point.
[ "Replies", "if", "the", "given", "SRE", "is", "provided", "by", "the", "Eclipse", "platform", "through", "an", "extension", "point", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L421-L431
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.clearSREConfiguration
public static void clearSREConfiguration() throws CoreException { final SARLEclipsePlugin plugin = SARLEclipsePlugin.getDefault(); plugin.getPreferences().remove(getCurrentPreferenceKey()); plugin.savePreferences(); }
java
public static void clearSREConfiguration() throws CoreException { final SARLEclipsePlugin plugin = SARLEclipsePlugin.getDefault(); plugin.getPreferences().remove(getCurrentPreferenceKey()); plugin.savePreferences(); }
[ "public", "static", "void", "clearSREConfiguration", "(", ")", "throws", "CoreException", "{", "final", "SARLEclipsePlugin", "plugin", "=", "SARLEclipsePlugin", ".", "getDefault", "(", ")", ";", "plugin", ".", "getPreferences", "(", ")", ".", "remove", "(", "get...
Remove the SRE configuration information from the preferences. @throws CoreException if trying to save the current state of SREs encounters a problem
[ "Remove", "the", "SRE", "configuration", "information", "from", "the", "preferences", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L457-L461
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.initializeSREExtensions
private static void initializeSREExtensions() { final MultiStatus status = new MultiStatus(SARLEclipsePlugin.PLUGIN_ID, IStatus.OK, "Exceptions occurred", null); //$NON-NLS-1$ final IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( SARLEclipsePlugin.PLUGIN_ID, SARLEclipseConfig.EXTENSION_POINT_SARL_RUNTIME_ENVIRONMENT); if (extensionPoint != null) { Object obj; for (final IConfigurationElement element : extensionPoint.getConfigurationElements()) { try { obj = element.createExecutableExtension("class"); //$NON-NLS-1$ if (obj instanceof ISREInstall) { final ISREInstall sre = (ISREInstall) obj; platformSREInstalls.add(sre.getId()); ALL_SRE_INSTALLS.put(sre.getId(), sre); } else { SARLEclipsePlugin.getDefault().logErrorMessage( "Cannot instance extension point: " + element.getName()); //$NON-NLS-1$ } } catch (CoreException e) { status.add(e.getStatus()); } } if (!status.isOK()) { //only happens on a CoreException SARLEclipsePlugin.getDefault().getLog().log(status); } } }
java
private static void initializeSREExtensions() { final MultiStatus status = new MultiStatus(SARLEclipsePlugin.PLUGIN_ID, IStatus.OK, "Exceptions occurred", null); //$NON-NLS-1$ final IExtensionPoint extensionPoint = Platform.getExtensionRegistry().getExtensionPoint( SARLEclipsePlugin.PLUGIN_ID, SARLEclipseConfig.EXTENSION_POINT_SARL_RUNTIME_ENVIRONMENT); if (extensionPoint != null) { Object obj; for (final IConfigurationElement element : extensionPoint.getConfigurationElements()) { try { obj = element.createExecutableExtension("class"); //$NON-NLS-1$ if (obj instanceof ISREInstall) { final ISREInstall sre = (ISREInstall) obj; platformSREInstalls.add(sre.getId()); ALL_SRE_INSTALLS.put(sre.getId(), sre); } else { SARLEclipsePlugin.getDefault().logErrorMessage( "Cannot instance extension point: " + element.getName()); //$NON-NLS-1$ } } catch (CoreException e) { status.add(e.getStatus()); } } if (!status.isOK()) { //only happens on a CoreException SARLEclipsePlugin.getDefault().getLog().log(status); } } }
[ "private", "static", "void", "initializeSREExtensions", "(", ")", "{", "final", "MultiStatus", "status", "=", "new", "MultiStatus", "(", "SARLEclipsePlugin", ".", "PLUGIN_ID", ",", "IStatus", ".", "OK", ",", "\"Exceptions occurred\"", ",", "null", ")", ";", "//$...
Initializes SRE extensions.
[ "Initializes", "SRE", "extensions", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L466-L493
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.getSREsAsXML
public static String getSREsAsXML(IProgressMonitor monitor) throws CoreException { initializeSREs(); try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); final Document xmldocument = builder.newDocument(); final Element rootElement = getXml(xmldocument); xmldocument.appendChild(rootElement); final TransformerFactory transFactory = TransformerFactory.newInstance(); final Transformer trans = transFactory.newTransformer(); try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { final DOMSource source = new DOMSource(xmldocument); final PrintWriter flot = new PrintWriter(baos); final StreamResult xmlStream = new StreamResult(flot); trans.transform(source, xmlStream); return new String(baos.toByteArray()); } } catch (Throwable e) { throw new CoreException(SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, e)); } }
java
public static String getSREsAsXML(IProgressMonitor monitor) throws CoreException { initializeSREs(); try { final DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance(); final DocumentBuilder builder = factory.newDocumentBuilder(); final Document xmldocument = builder.newDocument(); final Element rootElement = getXml(xmldocument); xmldocument.appendChild(rootElement); final TransformerFactory transFactory = TransformerFactory.newInstance(); final Transformer trans = transFactory.newTransformer(); try (ByteArrayOutputStream baos = new ByteArrayOutputStream()) { final DOMSource source = new DOMSource(xmldocument); final PrintWriter flot = new PrintWriter(baos); final StreamResult xmlStream = new StreamResult(flot); trans.transform(source, xmlStream); return new String(baos.toByteArray()); } } catch (Throwable e) { throw new CoreException(SARLEclipsePlugin.getDefault().createStatus(IStatus.ERROR, e)); } }
[ "public", "static", "String", "getSREsAsXML", "(", "IProgressMonitor", "monitor", ")", "throws", "CoreException", "{", "initializeSREs", "(", ")", ";", "try", "{", "final", "DocumentBuilderFactory", "factory", "=", "DocumentBuilderFactory", ".", "newInstance", "(", ...
Returns the listing of currently installed SREs as a single XML file. @param monitor monitor on the XML building. @return an XML representation of all of the currently installed SREs. @throws CoreException if trying to compute the XML for the SRE state encounters a problem.
[ "Returns", "the", "listing", "of", "currently", "installed", "SREs", "as", "a", "single", "XML", "file", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L552-L572
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.initializePersistedSREs
@SuppressWarnings("checkstyle:cyclomaticcomplexity") private static String initializePersistedSREs() { // // FOR DEBUG // try { // clearSREConfiguration(); // } catch (CoreException e1) { // e1.printStackTrace(); // } final String rawXml = SARLEclipsePlugin.getDefault().getPreferences().get( getCurrentPreferenceKey(), ""); //$NON-NLS-1$ try { Element config = null; // If the preference was found, load SREs from it into memory if (!Strings.isNullOrEmpty(rawXml)) { config = parseXML(rawXml, true); } else { // Otherwise, look for the old file that previously held the SRE definitions final SARLEclipsePlugin plugin = SARLEclipsePlugin.getDefault(); if (plugin.getBundle() != null) { final IPath stateLocation = plugin.getStateLocation(); final IPath stateFile = stateLocation.append("sreConfiguration.xml"); //$NON-NLS-1$ final File file = stateFile.toFile(); if (file.exists()) { // If file exists, load SRE definitions from it into memory and // write the definitions to the preference store WITHOUT triggering // any processing of the new value try (InputStream fileInputStream = new BufferedInputStream(new FileInputStream(file))) { config = parseXML(fileInputStream, true); } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } } } } if (config != null) { final String defaultId = config.getAttribute("defaultSRE"); //$NON-NLS-1$ final NodeList children = config.getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { try { final Node child = children.item(i); if ("SRE".equalsIgnoreCase(child.getNodeName()) //$NON-NLS-1$ && child instanceof Element) { final Element element = (Element) child; final boolean isPlatform = Boolean.parseBoolean(element.getAttribute("platform")); //$NON-NLS-1$ final String id = element.getAttribute("id"); //$NON-NLS-1$ if (!isPlatform || !(ALL_SRE_INSTALLS.containsKey(id))) { final ISREInstall sre = createSRE( element.getAttribute("class"), //$NON-NLS-1$ id); if (sre == null) { throw new IOException("Invalid XML format of the SRE preferences of " + id); //$NON-NLS-1$ } try { sre.setFromXML(element); } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } ALL_SRE_INSTALLS.put(id, sre); if (isPlatform) { platformSREInstalls.add(id); } } else { final ISREInstall sre = ALL_SRE_INSTALLS.get(id); if (sre != null) { try { sre.setFromXML(element); } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } } } } } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } } return defaultId; } } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } return null; }
java
@SuppressWarnings("checkstyle:cyclomaticcomplexity") private static String initializePersistedSREs() { // // FOR DEBUG // try { // clearSREConfiguration(); // } catch (CoreException e1) { // e1.printStackTrace(); // } final String rawXml = SARLEclipsePlugin.getDefault().getPreferences().get( getCurrentPreferenceKey(), ""); //$NON-NLS-1$ try { Element config = null; // If the preference was found, load SREs from it into memory if (!Strings.isNullOrEmpty(rawXml)) { config = parseXML(rawXml, true); } else { // Otherwise, look for the old file that previously held the SRE definitions final SARLEclipsePlugin plugin = SARLEclipsePlugin.getDefault(); if (plugin.getBundle() != null) { final IPath stateLocation = plugin.getStateLocation(); final IPath stateFile = stateLocation.append("sreConfiguration.xml"); //$NON-NLS-1$ final File file = stateFile.toFile(); if (file.exists()) { // If file exists, load SRE definitions from it into memory and // write the definitions to the preference store WITHOUT triggering // any processing of the new value try (InputStream fileInputStream = new BufferedInputStream(new FileInputStream(file))) { config = parseXML(fileInputStream, true); } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } } } } if (config != null) { final String defaultId = config.getAttribute("defaultSRE"); //$NON-NLS-1$ final NodeList children = config.getChildNodes(); for (int i = 0; i < children.getLength(); ++i) { try { final Node child = children.item(i); if ("SRE".equalsIgnoreCase(child.getNodeName()) //$NON-NLS-1$ && child instanceof Element) { final Element element = (Element) child; final boolean isPlatform = Boolean.parseBoolean(element.getAttribute("platform")); //$NON-NLS-1$ final String id = element.getAttribute("id"); //$NON-NLS-1$ if (!isPlatform || !(ALL_SRE_INSTALLS.containsKey(id))) { final ISREInstall sre = createSRE( element.getAttribute("class"), //$NON-NLS-1$ id); if (sre == null) { throw new IOException("Invalid XML format of the SRE preferences of " + id); //$NON-NLS-1$ } try { sre.setFromXML(element); } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } ALL_SRE_INSTALLS.put(id, sre); if (isPlatform) { platformSREInstalls.add(id); } } else { final ISREInstall sre = ALL_SRE_INSTALLS.get(id); if (sre != null) { try { sre.setFromXML(element); } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } } } } } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } } return defaultId; } } catch (IOException e) { SARLEclipsePlugin.getDefault().log(e); } return null; }
[ "@", "SuppressWarnings", "(", "\"checkstyle:cyclomaticcomplexity\"", ")", "private", "static", "String", "initializePersistedSREs", "(", ")", "{", "//\t\t// FOR DEBUG", "//\t\ttry {", "//\t\t\tclearSREConfiguration();", "//\t\t} catch (CoreException e1) {", "//\t\t\te1.printStackTrac...
This method loads installed SREs based an existing user preference or old SRE configurations file.
[ "This", "method", "loads", "installed", "SREs", "based", "an", "existing", "user", "preference", "or", "old", "SRE", "configurations", "file", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L640-L723
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.initializeSREs
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:variabledeclarationusagedistance", "checkstyle:npathcomplexity"}) private static void initializeSREs() { ISREInstall[] newSREs = new ISREInstall[0]; boolean savePrefs = false; LOCK.lock(); final String previousDefault = defaultSREId; try { if (platformSREInstalls == null) { platformSREInstalls = new HashSet<>(); ALL_SRE_INSTALLS.clear(); // Install the SREs from the Eclipse extension points if (enableSreExtensionPoints) { initializeSREExtensions(); } // install the SREs from the user-defined preferences. final String predefinedDefaultId = Strings.nullToEmpty(initializePersistedSREs()); newSREs = new ISREInstall[ALL_SRE_INSTALLS.size()]; // Verify default SRE is valid ISREInstall initDefaultSRE = null; final Iterator<ISREInstall> iterator = ALL_SRE_INSTALLS.values().iterator(); for (int i = 0; iterator.hasNext(); ++i) { final ISREInstall sre = iterator.next(); newSREs[i] = sre; if (sre.getValidity().isOK()) { if (initDefaultSRE == null && sre.getId().equals(predefinedDefaultId)) { initDefaultSRE = sre; } } } final String oldDefaultId = initDefaultSRE == null ? null : initDefaultSRE.getId(); defaultSREId = oldDefaultId; savePrefs = true; } if (Strings.isNullOrEmpty(defaultSREId)) { ISREInstall firstSRE = null; ISREInstall firstValidSRE = null; final Iterator<ISREInstall> iterator = ALL_SRE_INSTALLS.values().iterator(); while (firstValidSRE == null && iterator.hasNext()) { final ISREInstall sre = iterator.next(); if (firstSRE == null) { firstSRE = sre; } if (sre.getValidity().isOK()) { firstValidSRE = sre; } } if (firstValidSRE == null) { firstValidSRE = firstSRE; } if (firstValidSRE != null) { savePrefs = true; defaultSREId = firstValidSRE.getId(); } } } finally { LOCK.unlock(); } // Save the preferences. if (savePrefs) { safeSaveSREConfiguration(); } if (newSREs.length > 0) { for (final ISREInstall sre : newSREs) { fireSREAdded(sre); } } if (!Objects.equal(previousDefault, defaultSREId)) { fireDefaultSREChanged( getSREFromId(previousDefault), getSREFromId(defaultSREId)); } }
java
@SuppressWarnings({"checkstyle:cyclomaticcomplexity", "checkstyle:variabledeclarationusagedistance", "checkstyle:npathcomplexity"}) private static void initializeSREs() { ISREInstall[] newSREs = new ISREInstall[0]; boolean savePrefs = false; LOCK.lock(); final String previousDefault = defaultSREId; try { if (platformSREInstalls == null) { platformSREInstalls = new HashSet<>(); ALL_SRE_INSTALLS.clear(); // Install the SREs from the Eclipse extension points if (enableSreExtensionPoints) { initializeSREExtensions(); } // install the SREs from the user-defined preferences. final String predefinedDefaultId = Strings.nullToEmpty(initializePersistedSREs()); newSREs = new ISREInstall[ALL_SRE_INSTALLS.size()]; // Verify default SRE is valid ISREInstall initDefaultSRE = null; final Iterator<ISREInstall> iterator = ALL_SRE_INSTALLS.values().iterator(); for (int i = 0; iterator.hasNext(); ++i) { final ISREInstall sre = iterator.next(); newSREs[i] = sre; if (sre.getValidity().isOK()) { if (initDefaultSRE == null && sre.getId().equals(predefinedDefaultId)) { initDefaultSRE = sre; } } } final String oldDefaultId = initDefaultSRE == null ? null : initDefaultSRE.getId(); defaultSREId = oldDefaultId; savePrefs = true; } if (Strings.isNullOrEmpty(defaultSREId)) { ISREInstall firstSRE = null; ISREInstall firstValidSRE = null; final Iterator<ISREInstall> iterator = ALL_SRE_INSTALLS.values().iterator(); while (firstValidSRE == null && iterator.hasNext()) { final ISREInstall sre = iterator.next(); if (firstSRE == null) { firstSRE = sre; } if (sre.getValidity().isOK()) { firstValidSRE = sre; } } if (firstValidSRE == null) { firstValidSRE = firstSRE; } if (firstValidSRE != null) { savePrefs = true; defaultSREId = firstValidSRE.getId(); } } } finally { LOCK.unlock(); } // Save the preferences. if (savePrefs) { safeSaveSREConfiguration(); } if (newSREs.length > 0) { for (final ISREInstall sre : newSREs) { fireSREAdded(sre); } } if (!Objects.equal(previousDefault, defaultSREId)) { fireDefaultSREChanged( getSREFromId(previousDefault), getSREFromId(defaultSREId)); } }
[ "@", "SuppressWarnings", "(", "{", "\"checkstyle:cyclomaticcomplexity\"", ",", "\"checkstyle:variabledeclarationusagedistance\"", ",", "\"checkstyle:npathcomplexity\"", "}", ")", "private", "static", "void", "initializeSREs", "(", ")", "{", "ISREInstall", "[", "]", "newSREs...
Perform SRE install initialization. Does not hold locks while performing change notification. @since 3.2
[ "Perform", "SRE", "install", "initialization", ".", "Does", "not", "hold", "locks", "while", "performing", "change", "notification", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L731-L812
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.createUniqueIdentifier
public static String createUniqueIdentifier() { String id; do { id = UUID.randomUUID().toString(); } while (getSREFromId(id) != null); return id; }
java
public static String createUniqueIdentifier() { String id; do { id = UUID.randomUUID().toString(); } while (getSREFromId(id) != null); return id; }
[ "public", "static", "String", "createUniqueIdentifier", "(", ")", "{", "String", "id", ";", "do", "{", "id", "=", "UUID", ".", "randomUUID", "(", ")", ".", "toString", "(", ")", ";", "}", "while", "(", "getSREFromId", "(", "id", ")", "!=", "null", ")...
Replies an unique identifier. @return a unique identifier.
[ "Replies", "an", "unique", "identifier", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L826-L832
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.isUnpackedSRE
public static boolean isUnpackedSRE(File directory) { File manifestFile = new File(directory, "META-INF"); //$NON-NLS-1$ manifestFile = new File(manifestFile, "MANIFEST.MF"); //$NON-NLS-1$ if (manifestFile.canRead()) { try (InputStream manifestStream = new FileInputStream(manifestFile)) { final Manifest manifest = new Manifest(manifestStream); final Attributes sarlSection = manifest.getAttributes(SREConstants.MANIFEST_SECTION_SRE); if (sarlSection == null) { return false; } final String sarlVersion = sarlSection.getValue(SREConstants.MANIFEST_SARL_SPEC_VERSION); if (sarlVersion == null || sarlVersion.isEmpty()) { return false; } final Version sarlVer = Version.parseVersion(sarlVersion); return sarlVer != null; } catch (IOException exception) { return false; } } return false; }
java
public static boolean isUnpackedSRE(File directory) { File manifestFile = new File(directory, "META-INF"); //$NON-NLS-1$ manifestFile = new File(manifestFile, "MANIFEST.MF"); //$NON-NLS-1$ if (manifestFile.canRead()) { try (InputStream manifestStream = new FileInputStream(manifestFile)) { final Manifest manifest = new Manifest(manifestStream); final Attributes sarlSection = manifest.getAttributes(SREConstants.MANIFEST_SECTION_SRE); if (sarlSection == null) { return false; } final String sarlVersion = sarlSection.getValue(SREConstants.MANIFEST_SARL_SPEC_VERSION); if (sarlVersion == null || sarlVersion.isEmpty()) { return false; } final Version sarlVer = Version.parseVersion(sarlVersion); return sarlVer != null; } catch (IOException exception) { return false; } } return false; }
[ "public", "static", "boolean", "isUnpackedSRE", "(", "File", "directory", ")", "{", "File", "manifestFile", "=", "new", "File", "(", "directory", ",", "\"META-INF\"", ")", ";", "//$NON-NLS-1$", "manifestFile", "=", "new", "File", "(", "manifestFile", ",", "\"M...
Replies if the given directory contains a SRE. @param directory the directory. @return <code>true</code> if the given directory contains a SRE. Otherwise <code>false</code>. @see #isPackedSRE(File)
[ "Replies", "if", "the", "given", "directory", "contains", "a", "SRE", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L870-L891
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.isPackedSRE
public static boolean isPackedSRE(File jarFile) { try (JarFile jFile = new JarFile(jarFile)) { final Manifest manifest = jFile.getManifest(); if (manifest == null) { return false; } final Attributes sarlSection = manifest.getAttributes(SREConstants.MANIFEST_SECTION_SRE); if (sarlSection == null) { return false; } final String sarlVersion = sarlSection.getValue(SREConstants.MANIFEST_SARL_SPEC_VERSION); if (sarlVersion == null || sarlVersion.isEmpty()) { return false; } final Version sarlVer = Version.parseVersion(sarlVersion); return sarlVer != null; } catch (IOException exception) { return false; } }
java
public static boolean isPackedSRE(File jarFile) { try (JarFile jFile = new JarFile(jarFile)) { final Manifest manifest = jFile.getManifest(); if (manifest == null) { return false; } final Attributes sarlSection = manifest.getAttributes(SREConstants.MANIFEST_SECTION_SRE); if (sarlSection == null) { return false; } final String sarlVersion = sarlSection.getValue(SREConstants.MANIFEST_SARL_SPEC_VERSION); if (sarlVersion == null || sarlVersion.isEmpty()) { return false; } final Version sarlVer = Version.parseVersion(sarlVersion); return sarlVer != null; } catch (IOException exception) { return false; } }
[ "public", "static", "boolean", "isPackedSRE", "(", "File", "jarFile", ")", "{", "try", "(", "JarFile", "jFile", "=", "new", "JarFile", "(", "jarFile", ")", ")", "{", "final", "Manifest", "manifest", "=", "jFile", ".", "getManifest", "(", ")", ";", "if", ...
Replies if the given JAR file contains a SRE. <p>The SRE detection is based on the content of the manifest. @param jarFile the JAR file to test. @return <code>true</code> if the given directory contains a SRE. Otherwise <code>false</code>. @see #isUnpackedSRE(File)
[ "Replies", "if", "the", "given", "JAR", "file", "contains", "a", "SRE", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L928-L947
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java
SARLRuntime.getDeclaredBootstrap
public static String getDeclaredBootstrap(IPath path) { try { final IFile location = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (location != null) { final IPath pathLocation = location.getLocation(); if (pathLocation != null) { final File file = pathLocation.toFile(); if (file.exists()) { if (file.isDirectory()) { return getDeclaredBootstrapInFolder(file); } if (file.isFile()) { return getDeclaredBootstrapInJar(file); } return null; } } } final File file = path.makeAbsolute().toFile(); if (file.exists()) { if (file.isDirectory()) { return getDeclaredBootstrapInJar(file); } if (file.isFile()) { return getDeclaredBootstrapInFolder(file); } } } catch (Exception exception) { // } return null; }
java
public static String getDeclaredBootstrap(IPath path) { try { final IFile location = ResourcesPlugin.getWorkspace().getRoot().getFile(path); if (location != null) { final IPath pathLocation = location.getLocation(); if (pathLocation != null) { final File file = pathLocation.toFile(); if (file.exists()) { if (file.isDirectory()) { return getDeclaredBootstrapInFolder(file); } if (file.isFile()) { return getDeclaredBootstrapInJar(file); } return null; } } } final File file = path.makeAbsolute().toFile(); if (file.exists()) { if (file.isDirectory()) { return getDeclaredBootstrapInJar(file); } if (file.isFile()) { return getDeclaredBootstrapInFolder(file); } } } catch (Exception exception) { // } return null; }
[ "public", "static", "String", "getDeclaredBootstrap", "(", "IPath", "path", ")", "{", "try", "{", "final", "IFile", "location", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", "(", ")", ".", "getFile", "(", "path", ")", ";", "if", ...
Replies the bootstrap name declared within the given path, corresponding to a JAR file or a folder. <p>The SRE bootstrap detection is based on the service definition within META-INF folder. @param path the path to test. @return the bootstrap or {@code null} if none. @since 0.7 @see #containsPackedBootstrap(IPath) @see #containsUnpackedBootstrap(IPath)
[ "Replies", "the", "bootstrap", "name", "declared", "within", "the", "given", "path", "corresponding", "to", "a", "JAR", "file", "or", "a", "folder", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/runtime/SARLRuntime.java#L1110-L1141
train
sarl/sarl
docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/proxy/JreProxyInstaller.java
JreProxyInstaller.processElement
protected Object processElement(Object obj, Class<?> expectedType) { if (obj == null || obj instanceof Proxy) { return obj; } if (obj instanceof Doc) { return wrap(obj); } else if (expectedType != null && expectedType.isArray()) { final Class<?> componentType = expectedType.getComponentType(); if (Doc.class.isAssignableFrom(componentType)) { final int len = Array.getLength(obj); final List<Object> list = new ArrayList<>(len); final ApidocExcluder excluder = this.configuration.get().getApidocExcluder(); for (int i = 0; i < len; ++i) { final Object entry = Array.get(obj, i); if (!(entry instanceof Doc)) { list.add(processElement(entry, componentType)); } else if (excluder.isExcluded((Doc) entry)) { if (excluder.isTranslatableToTag((Doc) entry)) { // } } else { list.add(processElement(entry, componentType)); } } final Object newArray = Array.newInstance(componentType, list.size()); int i = 0; for (final Object element : list) { Array.set(newArray, i, element); ++i; } return newArray; } } return obj; }
java
protected Object processElement(Object obj, Class<?> expectedType) { if (obj == null || obj instanceof Proxy) { return obj; } if (obj instanceof Doc) { return wrap(obj); } else if (expectedType != null && expectedType.isArray()) { final Class<?> componentType = expectedType.getComponentType(); if (Doc.class.isAssignableFrom(componentType)) { final int len = Array.getLength(obj); final List<Object> list = new ArrayList<>(len); final ApidocExcluder excluder = this.configuration.get().getApidocExcluder(); for (int i = 0; i < len; ++i) { final Object entry = Array.get(obj, i); if (!(entry instanceof Doc)) { list.add(processElement(entry, componentType)); } else if (excluder.isExcluded((Doc) entry)) { if (excluder.isTranslatableToTag((Doc) entry)) { // } } else { list.add(processElement(entry, componentType)); } } final Object newArray = Array.newInstance(componentType, list.size()); int i = 0; for (final Object element : list) { Array.set(newArray, i, element); ++i; } return newArray; } } return obj; }
[ "protected", "Object", "processElement", "(", "Object", "obj", ",", "Class", "<", "?", ">", "expectedType", ")", "{", "if", "(", "obj", "==", "null", "||", "obj", "instanceof", "Proxy", ")", "{", "return", "obj", ";", "}", "if", "(", "obj", "instanceof...
Filter the given document. @param obj the document to filter. @param expectedType the expected type of the {@code obj}. @return the filtered {@code obj}.
[ "Filter", "the", "given", "document", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/proxy/JreProxyInstaller.java#L100-L134
train
sarl/sarl
docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/proxy/JreProxyInstaller.java
JreProxyInstaller.wrap
protected Object wrap(Object object) { if (object == null || object instanceof Proxy) { return object; } final Class<?> type = object.getClass(); return Proxy.newProxyInstance(type.getClassLoader(), type.getInterfaces(), new ProxyHandler(object)); }
java
protected Object wrap(Object object) { if (object == null || object instanceof Proxy) { return object; } final Class<?> type = object.getClass(); return Proxy.newProxyInstance(type.getClassLoader(), type.getInterfaces(), new ProxyHandler(object)); }
[ "protected", "Object", "wrap", "(", "Object", "object", ")", "{", "if", "(", "object", "==", "null", "||", "object", "instanceof", "Proxy", ")", "{", "return", "object", ";", "}", "final", "Class", "<", "?", ">", "type", "=", "object", ".", "getClass",...
Unwrap the given object. @param object the object. @return the unwrapped object.
[ "Unwrap", "the", "given", "object", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/docs/io.sarl.docs.doclet/src/main/java/io/sarl/docs/doclet/proxy/JreProxyInstaller.java#L146-L152
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.writePackageFiles
protected void writePackageFiles(QualifiedName name, String lineSeparator, IExtraLanguageGeneratorContext context) { final IFileSystemAccess2 fsa = context.getFileSystemAccess(); final String outputConfiguration = getOutputConfigurationName(); QualifiedName libraryName = null; for (final String segment : name.skipLast(1).getSegments()) { if (libraryName == null) { libraryName = QualifiedName.create(segment, LIBRARY_FILENAME); } else { libraryName = libraryName.append(segment).append(LIBRARY_FILENAME); } final String fileName = toFilename(libraryName); if (!fsa.isFile(fileName)) { final String content = PYTHON_FILE_HEADER + lineSeparator + getGenerationComment(context) + lineSeparator + LIBRARY_CONTENT; if (Strings.isEmpty(outputConfiguration)) { fsa.generateFile(fileName, content); } else { fsa.generateFile(fileName, outputConfiguration, content); } } libraryName = libraryName.skipLast(1); } }
java
protected void writePackageFiles(QualifiedName name, String lineSeparator, IExtraLanguageGeneratorContext context) { final IFileSystemAccess2 fsa = context.getFileSystemAccess(); final String outputConfiguration = getOutputConfigurationName(); QualifiedName libraryName = null; for (final String segment : name.skipLast(1).getSegments()) { if (libraryName == null) { libraryName = QualifiedName.create(segment, LIBRARY_FILENAME); } else { libraryName = libraryName.append(segment).append(LIBRARY_FILENAME); } final String fileName = toFilename(libraryName); if (!fsa.isFile(fileName)) { final String content = PYTHON_FILE_HEADER + lineSeparator + getGenerationComment(context) + lineSeparator + LIBRARY_CONTENT; if (Strings.isEmpty(outputConfiguration)) { fsa.generateFile(fileName, content); } else { fsa.generateFile(fileName, outputConfiguration, content); } } libraryName = libraryName.skipLast(1); } }
[ "protected", "void", "writePackageFiles", "(", "QualifiedName", "name", ",", "String", "lineSeparator", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "IFileSystemAccess2", "fsa", "=", "context", ".", "getFileSystemAccess", "(", ")", ";", "final"...
Generate the Python package files. <p>This function generates the "__init__.py" files for all the packages. @param name the name of the generated type. @param lineSeparator the line separator. @param context the generation context.
[ "Generate", "the", "Python", "package", "files", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L203-L227
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.generatePythonClassDeclaration
@SuppressWarnings("static-method") protected boolean generatePythonClassDeclaration(String typeName, boolean isAbstract, List<? extends JvmTypeReference> superTypes, String comment, boolean ignoreObjectType, PyAppendable it, IExtraLanguageGeneratorContext context) { if (!Strings.isEmpty(typeName)) { it.append("class ").append(typeName).append("("); //$NON-NLS-1$ //$NON-NLS-2$ boolean isOtherSuperType = false; boolean first = true; for (final JvmTypeReference reference : superTypes) { if (!ignoreObjectType || !Strings.equal(reference.getQualifiedName(), Object.class.getCanonicalName())) { isOtherSuperType = true; if (first) { first = false; } else { it.append(","); //$NON-NLS-1$ } it.append(reference.getType()); } } if (isOtherSuperType) { it.append(","); //$NON-NLS-1$ } // Add "object to avoid a bug within the Python interpreter. it.append("object):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); generateDocString(comment, it); return true; } return false; }
java
@SuppressWarnings("static-method") protected boolean generatePythonClassDeclaration(String typeName, boolean isAbstract, List<? extends JvmTypeReference> superTypes, String comment, boolean ignoreObjectType, PyAppendable it, IExtraLanguageGeneratorContext context) { if (!Strings.isEmpty(typeName)) { it.append("class ").append(typeName).append("("); //$NON-NLS-1$ //$NON-NLS-2$ boolean isOtherSuperType = false; boolean first = true; for (final JvmTypeReference reference : superTypes) { if (!ignoreObjectType || !Strings.equal(reference.getQualifiedName(), Object.class.getCanonicalName())) { isOtherSuperType = true; if (first) { first = false; } else { it.append(","); //$NON-NLS-1$ } it.append(reference.getType()); } } if (isOtherSuperType) { it.append(","); //$NON-NLS-1$ } // Add "object to avoid a bug within the Python interpreter. it.append("object):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); generateDocString(comment, it); return true; } return false; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "boolean", "generatePythonClassDeclaration", "(", "String", "typeName", ",", "boolean", "isAbstract", ",", "List", "<", "?", "extends", "JvmTypeReference", ">", "superTypes", ",", "String", "comment"...
Generate the type declaration for a Python class. @param typeName name of the type. @param isAbstract indicates if the type is abstract (interface included). @param superTypes the super types. @param comment the type declaration's comment. @param ignoreObjectType ignores the "Object" type if the super types. @param it the output. @param context the generation context. @return {@code true} if the declaration was generated. {@code false} if the declaration was not generated.
[ "Generate", "the", "type", "declaration", "for", "a", "Python", "class", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L251-L280
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.generateDocString
protected static boolean generateDocString(String comment, PyAppendable it) { final String cmt = comment == null ? null : comment.trim(); if (!Strings.isEmpty(cmt)) { assert cmt != null; it.append("\"\"\"").increaseIndentation(); //$NON-NLS-1$ for (final String line : cmt.split("[\n\r\f]+")) { //$NON-NLS-1$ it.newLine().append(line); } it.decreaseIndentation().newLine(); it.append("\"\"\"").newLine(); //$NON-NLS-1$ return true; } return false; }
java
protected static boolean generateDocString(String comment, PyAppendable it) { final String cmt = comment == null ? null : comment.trim(); if (!Strings.isEmpty(cmt)) { assert cmt != null; it.append("\"\"\"").increaseIndentation(); //$NON-NLS-1$ for (final String line : cmt.split("[\n\r\f]+")) { //$NON-NLS-1$ it.newLine().append(line); } it.decreaseIndentation().newLine(); it.append("\"\"\"").newLine(); //$NON-NLS-1$ return true; } return false; }
[ "protected", "static", "boolean", "generateDocString", "(", "String", "comment", ",", "PyAppendable", "it", ")", "{", "final", "String", "cmt", "=", "comment", "==", "null", "?", "null", ":", "comment", ".", "trim", "(", ")", ";", "if", "(", "!", "String...
Generate a Python docstring with the given comment. @param comment the comment. @param it the receiver of the docstring. @return {@code true} if the docstring is added, {@code false} otherwise.
[ "Generate", "a", "Python", "docstring", "with", "the", "given", "comment", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L288-L301
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.generateBlockComment
protected static boolean generateBlockComment(String comment, PyAppendable it) { final String cmt = comment == null ? null : comment.trim(); if (!Strings.isEmpty(cmt)) { assert cmt != null; for (final String line : cmt.split("[\n\r\f]+")) { //$NON-NLS-1$ it.append("# ").append(line).newLine(); //$NON-NLS-1$ } return true; } return false; }
java
protected static boolean generateBlockComment(String comment, PyAppendable it) { final String cmt = comment == null ? null : comment.trim(); if (!Strings.isEmpty(cmt)) { assert cmt != null; for (final String line : cmt.split("[\n\r\f]+")) { //$NON-NLS-1$ it.append("# ").append(line).newLine(); //$NON-NLS-1$ } return true; } return false; }
[ "protected", "static", "boolean", "generateBlockComment", "(", "String", "comment", ",", "PyAppendable", "it", ")", "{", "final", "String", "cmt", "=", "comment", "==", "null", "?", "null", ":", "comment", ".", "trim", "(", ")", ";", "if", "(", "!", "Str...
Generate a Python block comment with the given comment. @param comment the comment. @param it the receiver of the block comment. @return {@code true} if the block comment is added, {@code false} otherwise.
[ "Generate", "a", "Python", "block", "comment", "with", "the", "given", "comment", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L309-L319
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.generateTypeDeclaration
@SuppressWarnings({ "checkstyle:parameternumber" }) protected boolean generateTypeDeclaration( String fullyQualifiedName, String name, boolean isAbstract, List<? extends JvmTypeReference> superTypes, String comment, boolean ignoreObjectType, List<? extends XtendMember> members, PyAppendable it, IExtraLanguageGeneratorContext context, Procedure2<? super PyAppendable, ? super IExtraLanguageGeneratorContext> memberGenerator) { if (!Strings.isEmpty(name)) { if (!generatePythonClassDeclaration(name, isAbstract, superTypes, comment, ignoreObjectType, it, context) || context.getCancelIndicator().isCanceled()) { return false; } // it.openScope(); // if (!generateSarlMembers(members, it, context) || context.getCancelIndicator().isCanceled()) { return false; } // if (memberGenerator != null) { memberGenerator.apply(it, context); } // if (!generatePythonConstructors(fullyQualifiedName, members, it, context) || context.getCancelIndicator().isCanceled()) { return false; } // it.decreaseIndentation().newLine().newLine(); // it.closeScope(); // if (context.getCancelIndicator().isCanceled()) { return false; } return true; } return false; }
java
@SuppressWarnings({ "checkstyle:parameternumber" }) protected boolean generateTypeDeclaration( String fullyQualifiedName, String name, boolean isAbstract, List<? extends JvmTypeReference> superTypes, String comment, boolean ignoreObjectType, List<? extends XtendMember> members, PyAppendable it, IExtraLanguageGeneratorContext context, Procedure2<? super PyAppendable, ? super IExtraLanguageGeneratorContext> memberGenerator) { if (!Strings.isEmpty(name)) { if (!generatePythonClassDeclaration(name, isAbstract, superTypes, comment, ignoreObjectType, it, context) || context.getCancelIndicator().isCanceled()) { return false; } // it.openScope(); // if (!generateSarlMembers(members, it, context) || context.getCancelIndicator().isCanceled()) { return false; } // if (memberGenerator != null) { memberGenerator.apply(it, context); } // if (!generatePythonConstructors(fullyQualifiedName, members, it, context) || context.getCancelIndicator().isCanceled()) { return false; } // it.decreaseIndentation().newLine().newLine(); // it.closeScope(); // if (context.getCancelIndicator().isCanceled()) { return false; } return true; } return false; }
[ "@", "SuppressWarnings", "(", "{", "\"checkstyle:parameternumber\"", "}", ")", "protected", "boolean", "generateTypeDeclaration", "(", "String", "fullyQualifiedName", ",", "String", "name", ",", "boolean", "isAbstract", ",", "List", "<", "?", "extends", "JvmTypeRefere...
Generate the given type. @param fullyQualifiedName the fully qualified name of the type. @param name the name of the type. @param isAbstract indicates if the type is abstract. @param superTypes the super types. @param comment the comment. @param ignoreObjectType ignores the "Object" type if the super types. @param members the members. @param it the output. @param context the context. @param memberGenerator the generator of members. @return {@code true} if the type declaration was generated.
[ "Generate", "the", "given", "type", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L335-L375
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.generateEnumerationDeclaration
protected boolean generateEnumerationDeclaration(SarlEnumeration enumeration, PyAppendable it, IExtraLanguageGeneratorContext context) { if (!Strings.isEmpty(enumeration.getName())) { it.append("class ").append(enumeration.getName()); //$NON-NLS-1$ it.append("(Enum"); //$NON-NLS-1$ it.append(newType("enum.Enum")); //$NON-NLS-1$ it.append("):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); generateDocString(getTypeBuilder().getDocumentation(enumeration), it); int i = 0; for (final XtendMember item : enumeration.getMembers()) { if (context.getCancelIndicator().isCanceled()) { return false; } if (item instanceof XtendEnumLiteral) { final XtendEnumLiteral literal = (XtendEnumLiteral) item; it.append(literal.getName()).append(" = "); //$NON-NLS-1$ it.append(Integer.toString(i)); it.newLine(); ++i; } } // it.decreaseIndentation().newLine().newLine(); return true; } return false; }
java
protected boolean generateEnumerationDeclaration(SarlEnumeration enumeration, PyAppendable it, IExtraLanguageGeneratorContext context) { if (!Strings.isEmpty(enumeration.getName())) { it.append("class ").append(enumeration.getName()); //$NON-NLS-1$ it.append("(Enum"); //$NON-NLS-1$ it.append(newType("enum.Enum")); //$NON-NLS-1$ it.append("):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); generateDocString(getTypeBuilder().getDocumentation(enumeration), it); int i = 0; for (final XtendMember item : enumeration.getMembers()) { if (context.getCancelIndicator().isCanceled()) { return false; } if (item instanceof XtendEnumLiteral) { final XtendEnumLiteral literal = (XtendEnumLiteral) item; it.append(literal.getName()).append(" = "); //$NON-NLS-1$ it.append(Integer.toString(i)); it.newLine(); ++i; } } // it.decreaseIndentation().newLine().newLine(); return true; } return false; }
[ "protected", "boolean", "generateEnumerationDeclaration", "(", "SarlEnumeration", "enumeration", ",", "PyAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "if", "(", "!", "Strings", ".", "isEmpty", "(", "enumeration", ".", "getName", "(", ...
Generate the given enumeration declaration. @param enumeration the enumeration. @param it the receiver of the generated code. @param context the context. @return {@code true} if a declaration was generated. {@code false} if no enumeration was generated. @since 0.8
[ "Generate", "the", "given", "enumeration", "declaration", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L385-L411
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.generatePythonConstructors
protected boolean generatePythonConstructors(String container, List<? extends XtendMember> members, PyAppendable it, IExtraLanguageGeneratorContext context) { // Prepare field initialization boolean hasConstructor = false; for (final XtendMember member : members) { if (context.getCancelIndicator().isCanceled()) { return false; } if (member instanceof SarlConstructor) { hasConstructor = true; generate(member, it, context); it.newLine(); } } if (context.getCancelIndicator().isCanceled()) { return false; } if (!hasConstructor) { it.append("def __init__(self):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); final List<SarlField> fields = context.getMultimapValues(INSTANCE_VARIABLES_MEMENTO, container); if (fields.isEmpty()) { it.append("pass"); //$NON-NLS-1$ } else { for (final SarlField field : fields) { generatePythonField(field, it, context); } } it.decreaseIndentation().newLine(); } return true; }
java
protected boolean generatePythonConstructors(String container, List<? extends XtendMember> members, PyAppendable it, IExtraLanguageGeneratorContext context) { // Prepare field initialization boolean hasConstructor = false; for (final XtendMember member : members) { if (context.getCancelIndicator().isCanceled()) { return false; } if (member instanceof SarlConstructor) { hasConstructor = true; generate(member, it, context); it.newLine(); } } if (context.getCancelIndicator().isCanceled()) { return false; } if (!hasConstructor) { it.append("def __init__(self):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); final List<SarlField> fields = context.getMultimapValues(INSTANCE_VARIABLES_MEMENTO, container); if (fields.isEmpty()) { it.append("pass"); //$NON-NLS-1$ } else { for (final SarlField field : fields) { generatePythonField(field, it, context); } } it.decreaseIndentation().newLine(); } return true; }
[ "protected", "boolean", "generatePythonConstructors", "(", "String", "container", ",", "List", "<", "?", "extends", "XtendMember", ">", "members", ",", "PyAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "// Prepare field initialization", "...
Generate the constructors for a Python class. @param container the fully qualified name of the container. @param members the members to be added. @param it the output. @param context the generation context. @return {@code true} if a constructor was generated. {@code false} if no constructor was generated.
[ "Generate", "the", "constructors", "for", "a", "Python", "class", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L421-L452
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.newType
@SuppressWarnings("static-method") protected JvmType newType(String pythonName) { final JvmGenericType type = TypesFactory.eINSTANCE.createJvmGenericType(); final int index = pythonName.indexOf("."); //$NON-NLS-1$ if (index <= 0) { type.setSimpleName(pythonName); } else { type.setPackageName(pythonName.substring(0, index - 1)); type.setSimpleName(pythonName.substring(index + 1)); } return type; }
java
@SuppressWarnings("static-method") protected JvmType newType(String pythonName) { final JvmGenericType type = TypesFactory.eINSTANCE.createJvmGenericType(); final int index = pythonName.indexOf("."); //$NON-NLS-1$ if (index <= 0) { type.setSimpleName(pythonName); } else { type.setPackageName(pythonName.substring(0, index - 1)); type.setSimpleName(pythonName.substring(index + 1)); } return type; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "JvmType", "newType", "(", "String", "pythonName", ")", "{", "final", "JvmGenericType", "type", "=", "TypesFactory", ".", "eINSTANCE", ".", "createJvmGenericType", "(", ")", ";", "final", "int", ...
Create a JvmType for a Python type. @param pythonName the python type name. @return the type.
[ "Create", "a", "JvmType", "for", "a", "Python", "type", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L459-L470
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.generatePythonField
protected void generatePythonField(SarlField field, PyAppendable it, IExtraLanguageGeneratorContext context) { generateBlockComment(getTypeBuilder().getDocumentation(field), it); if (!field.isStatic()) { it.append("self."); //$NON-NLS-1$ } final String fieldName = it.declareUniqueNameVariable(field, field.getName()); it.append(fieldName); it.append(" = "); //$NON-NLS-1$ if (field.getInitialValue() != null) { generate(field.getInitialValue(), null, it, context); } else { it.append(PyExpressionGenerator.toDefaultValue(field.getType())); } it.newLine(); }
java
protected void generatePythonField(SarlField field, PyAppendable it, IExtraLanguageGeneratorContext context) { generateBlockComment(getTypeBuilder().getDocumentation(field), it); if (!field.isStatic()) { it.append("self."); //$NON-NLS-1$ } final String fieldName = it.declareUniqueNameVariable(field, field.getName()); it.append(fieldName); it.append(" = "); //$NON-NLS-1$ if (field.getInitialValue() != null) { generate(field.getInitialValue(), null, it, context); } else { it.append(PyExpressionGenerator.toDefaultValue(field.getType())); } it.newLine(); }
[ "protected", "void", "generatePythonField", "(", "SarlField", "field", ",", "PyAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "generateBlockComment", "(", "getTypeBuilder", "(", ")", ".", "getDocumentation", "(", "field", ")", ",", "i...
Create a field declaration. @param field the field to generate. @param it the output @param context the generation context.
[ "Create", "a", "field", "declaration", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L478-L492
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator.generateGuardEvaluators
protected void generateGuardEvaluators(String container, PyAppendable it, IExtraLanguageGeneratorContext context) { final Map<String, Map<String, List<Pair<XExpression, String>>>> allGuardEvaluators = context.getMapData(EVENT_GUARDS_MEMENTO); final Map<String, List<Pair<XExpression, String>>> guardEvaluators = allGuardEvaluators.get(container); if (guardEvaluators == null) { return; } boolean first = true; for (final Entry<String, List<Pair<XExpression, String>>> entry : guardEvaluators.entrySet()) { if (first) { first = false; } else { it.newLine(); } it.append("def __guard_"); //$NON-NLS-1$ it.append(entry.getKey().replaceAll("[^a-zA-Z0-9_]+", "_")); //$NON-NLS-1$ //$NON-NLS-2$ it.append("__(self, occurrence):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); it.append("it = occurrence").newLine(); //$NON-NLS-1$ final String eventHandleName = it.declareUniqueNameVariable(new Object(), "__event_handles"); //$NON-NLS-1$ it.append(eventHandleName).append(" = list"); //$NON-NLS-1$ for (final Pair<XExpression, String> guardDesc : entry.getValue()) { it.newLine(); if (guardDesc.getKey() == null) { it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ } else { it.append("if "); //$NON-NLS-1$ generate(guardDesc.getKey(), null, it, context); it.append(":").increaseIndentation().newLine(); //$NON-NLS-1$ it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ it.decreaseIndentation(); } } it.newLine().append("return ").append(eventHandleName); //$NON-NLS-1$ it.decreaseIndentation().newLine(); } }
java
protected void generateGuardEvaluators(String container, PyAppendable it, IExtraLanguageGeneratorContext context) { final Map<String, Map<String, List<Pair<XExpression, String>>>> allGuardEvaluators = context.getMapData(EVENT_GUARDS_MEMENTO); final Map<String, List<Pair<XExpression, String>>> guardEvaluators = allGuardEvaluators.get(container); if (guardEvaluators == null) { return; } boolean first = true; for (final Entry<String, List<Pair<XExpression, String>>> entry : guardEvaluators.entrySet()) { if (first) { first = false; } else { it.newLine(); } it.append("def __guard_"); //$NON-NLS-1$ it.append(entry.getKey().replaceAll("[^a-zA-Z0-9_]+", "_")); //$NON-NLS-1$ //$NON-NLS-2$ it.append("__(self, occurrence):"); //$NON-NLS-1$ it.increaseIndentation().newLine(); it.append("it = occurrence").newLine(); //$NON-NLS-1$ final String eventHandleName = it.declareUniqueNameVariable(new Object(), "__event_handles"); //$NON-NLS-1$ it.append(eventHandleName).append(" = list"); //$NON-NLS-1$ for (final Pair<XExpression, String> guardDesc : entry.getValue()) { it.newLine(); if (guardDesc.getKey() == null) { it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ } else { it.append("if "); //$NON-NLS-1$ generate(guardDesc.getKey(), null, it, context); it.append(":").increaseIndentation().newLine(); //$NON-NLS-1$ it.append(eventHandleName).append(".add(").append(guardDesc.getValue()).append(")"); //$NON-NLS-1$ //$NON-NLS-2$ it.decreaseIndentation(); } } it.newLine().append("return ").append(eventHandleName); //$NON-NLS-1$ it.decreaseIndentation().newLine(); } }
[ "protected", "void", "generateGuardEvaluators", "(", "String", "container", ",", "PyAppendable", "it", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "final", "Map", "<", "String", ",", "Map", "<", "String", ",", "List", "<", "Pair", "<", "XExpressi...
Generate the memorized guard evaluators. @param container the fully qualified name of the container of the guards. @param it the output. @param context the generation context.
[ "Generate", "the", "memorized", "guard", "evaluators", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L601-L636
train
sarl/sarl
contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java
PyGenerator._before
protected void _before(SarlCapacityUses uses, IExtraLanguageGeneratorContext context) { // Rename the function in order to produce the good features at the calls. for (final JvmTypeReference capacity : uses.getCapacities()) { final JvmType type = capacity.getType(); if (type instanceof JvmDeclaredType) { computeCapacityFunctionMarkers((JvmDeclaredType) type); } } }
java
protected void _before(SarlCapacityUses uses, IExtraLanguageGeneratorContext context) { // Rename the function in order to produce the good features at the calls. for (final JvmTypeReference capacity : uses.getCapacities()) { final JvmType type = capacity.getType(); if (type instanceof JvmDeclaredType) { computeCapacityFunctionMarkers((JvmDeclaredType) type); } } }
[ "protected", "void", "_before", "(", "SarlCapacityUses", "uses", ",", "IExtraLanguageGeneratorContext", "context", ")", "{", "// Rename the function in order to produce the good features at the calls.", "for", "(", "final", "JvmTypeReference", "capacity", ":", "uses", ".", "g...
Mark the functions of the used capacities in order to have a valid feature call within the code. @param uses the capacity uses. @param context the context.
[ "Mark", "the", "functions", "of", "the", "used", "capacities", "in", "order", "to", "have", "a", "valid", "feature", "call", "within", "the", "code", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/contribs/io.sarl.pythongenerator/io.sarl.pythongenerator.generator/src/io/sarl/pythongenerator/generator/generator/PyGenerator.java#L1035-L1043
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/validator/ExtraLanguageValidatorSupport.java
ExtraLanguageValidatorSupport.checkExtraLanguageRules
@Check(CheckType.NORMAL) public void checkExtraLanguageRules(EObject currentObject) { final List<AbstractExtraLanguageValidator> validators = this.validatorProvider.getValidators( currentObject.eResource()); if (!validators.isEmpty()) { for (final AbstractExtraLanguageValidator validator : validators) { final ValidationMessageAcceptor acceptor = getMessageAcceptor(); final StateAccess stateAccess = setMessageAcceptor(acceptor); validator.validate(stateAccess, acceptor); } } }
java
@Check(CheckType.NORMAL) public void checkExtraLanguageRules(EObject currentObject) { final List<AbstractExtraLanguageValidator> validators = this.validatorProvider.getValidators( currentObject.eResource()); if (!validators.isEmpty()) { for (final AbstractExtraLanguageValidator validator : validators) { final ValidationMessageAcceptor acceptor = getMessageAcceptor(); final StateAccess stateAccess = setMessageAcceptor(acceptor); validator.validate(stateAccess, acceptor); } } }
[ "@", "Check", "(", "CheckType", ".", "NORMAL", ")", "public", "void", "checkExtraLanguageRules", "(", "EObject", "currentObject", ")", "{", "final", "List", "<", "AbstractExtraLanguageValidator", ">", "validators", "=", "this", ".", "validatorProvider", ".", "getV...
Check the rules for the activated extra languages. @param currentObject the current object to test.
[ "Check", "the", "rules", "for", "the", "activated", "extra", "languages", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/extralanguage/validator/ExtraLanguageValidatorSupport.java#L76-L87
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/InjectionFragment2.java
InjectionFragment2.setComment
public void setComment(String comment) { this.comment = comment; if (!Strings.isEmpty(comment)) { this.name = MessageFormat.format("{0} [{1}]", getClass().getName(), comment); //$NON-NLS-1$ } else { this.name = getClass().getName(); } }
java
public void setComment(String comment) { this.comment = comment; if (!Strings.isEmpty(comment)) { this.name = MessageFormat.format("{0} [{1}]", getClass().getName(), comment); //$NON-NLS-1$ } else { this.name = getClass().getName(); } }
[ "public", "void", "setComment", "(", "String", "comment", ")", "{", "this", ".", "comment", "=", "comment", ";", "if", "(", "!", "Strings", ".", "isEmpty", "(", "comment", ")", ")", "{", "this", ".", "name", "=", "MessageFormat", ".", "format", "(", ...
Change the comment for the injection fragment. @param comment the comment for the fragment.
[ "Change", "the", "comment", "for", "the", "injection", "fragment", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/binding/InjectionFragment2.java#L88-L95
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SARLGeneratorConfigProvider.java
SARLGeneratorConfigProvider.createDefaultGeneratorConfig
protected GeneratorConfig createDefaultGeneratorConfig() { final GeneratorConfig config = new GeneratorConfig(); if (this.defaultVersion == null) { this.defaultVersion = JavaVersion.fromQualifier(System.getProperty("java.specification.version")); //$NON-NLS-1$ if (this.defaultVersion != null) { config.setJavaSourceVersion(this.defaultVersion); } } else { config.setJavaSourceVersion(this.defaultVersion); } return config; }
java
protected GeneratorConfig createDefaultGeneratorConfig() { final GeneratorConfig config = new GeneratorConfig(); if (this.defaultVersion == null) { this.defaultVersion = JavaVersion.fromQualifier(System.getProperty("java.specification.version")); //$NON-NLS-1$ if (this.defaultVersion != null) { config.setJavaSourceVersion(this.defaultVersion); } } else { config.setJavaSourceVersion(this.defaultVersion); } return config; }
[ "protected", "GeneratorConfig", "createDefaultGeneratorConfig", "(", ")", "{", "final", "GeneratorConfig", "config", "=", "new", "GeneratorConfig", "(", ")", ";", "if", "(", "this", ".", "defaultVersion", "==", "null", ")", "{", "this", ".", "defaultVersion", "=...
Invoked for creating the default generator configuration. @return the configuration.
[ "Invoked", "for", "creating", "the", "default", "generator", "configuration", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SARLGeneratorConfigProvider.java#L71-L82
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/sarl/actionprototype/DefaultActionPrototypeProvider.java
DefaultActionPrototypeProvider.createPrototype
protected InferredPrototype createPrototype(QualifiedActionName id, boolean isVarargs, FormalParameterProvider parameters) { assert parameters != null; final ActionParameterTypes key = new ActionParameterTypes(isVarargs, parameters.getFormalParameterCount()); final Map<ActionParameterTypes, List<InferredStandardParameter>> ip = buildSignaturesForArgDefaultValues( id.getDeclaringType(), key.toActionPrototype(id.getActionName()).toActionId(), parameters, key); final List<InferredStandardParameter> op = ip.remove(key); final InferredPrototype proto = new DefaultInferredPrototype( id, parameters, key, op, ip); final String containerID = id.getContainerID(); Map<String, Map<ActionParameterTypes, InferredPrototype>> c = this.prototypes.get(containerID); if (c == null) { c = new TreeMap<>(); this.prototypes.put(containerID, c); } Map<ActionParameterTypes, InferredPrototype> list = c.get(id.getActionName()); if (list == null) { list = new TreeMap<>(); c.put(id.getActionName(), list); } list.put(key, proto); return proto; }
java
protected InferredPrototype createPrototype(QualifiedActionName id, boolean isVarargs, FormalParameterProvider parameters) { assert parameters != null; final ActionParameterTypes key = new ActionParameterTypes(isVarargs, parameters.getFormalParameterCount()); final Map<ActionParameterTypes, List<InferredStandardParameter>> ip = buildSignaturesForArgDefaultValues( id.getDeclaringType(), key.toActionPrototype(id.getActionName()).toActionId(), parameters, key); final List<InferredStandardParameter> op = ip.remove(key); final InferredPrototype proto = new DefaultInferredPrototype( id, parameters, key, op, ip); final String containerID = id.getContainerID(); Map<String, Map<ActionParameterTypes, InferredPrototype>> c = this.prototypes.get(containerID); if (c == null) { c = new TreeMap<>(); this.prototypes.put(containerID, c); } Map<ActionParameterTypes, InferredPrototype> list = c.get(id.getActionName()); if (list == null) { list = new TreeMap<>(); c.put(id.getActionName(), list); } list.put(key, proto); return proto; }
[ "protected", "InferredPrototype", "createPrototype", "(", "QualifiedActionName", "id", ",", "boolean", "isVarargs", ",", "FormalParameterProvider", "parameters", ")", "{", "assert", "parameters", "!=", "null", ";", "final", "ActionParameterTypes", "key", "=", "new", "...
Build and replies the inferred action signature for the element with the given ID. This function creates the different signatures according to the definition, or not, of default values for the formal parameters. @param id identifier of the function. @param isVarargs indicates if the signature has a variatic parameter. @param parameters list of the formal parameters of the function. @return the signature or <code>null</code> if none.
[ "Build", "and", "replies", "the", "inferred", "action", "signature", "for", "the", "element", "with", "the", "given", "ID", ".", "This", "function", "creates", "the", "different", "signatures", "according", "to", "the", "definition", "or", "not", "of", "defaul...
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/sarl/actionprototype/DefaultActionPrototypeProvider.java#L239-L267
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/bugfixes/unpublished/BugMultilineCommentIndentation.java
BugMultilineCommentIndentation.fix
@SuppressWarnings("static-method") public ITextReplacerContext fix(final ITextReplacerContext context, IComment comment) { final IHiddenRegion hiddenRegion = comment.getHiddenRegion(); if (detectBugSituation(hiddenRegion) && fixBug(hiddenRegion)) { // Indentation of the first comment line final ITextRegionAccess access = comment.getTextRegionAccess(); final ITextSegment target = access.regionForOffset(comment.getOffset(), 0); context.addReplacement(target.replaceWith(context.getIndentationString(1))); // Indentation of the comment's lines return new FixedReplacementContext(context); } return context; }
java
@SuppressWarnings("static-method") public ITextReplacerContext fix(final ITextReplacerContext context, IComment comment) { final IHiddenRegion hiddenRegion = comment.getHiddenRegion(); if (detectBugSituation(hiddenRegion) && fixBug(hiddenRegion)) { // Indentation of the first comment line final ITextRegionAccess access = comment.getTextRegionAccess(); final ITextSegment target = access.regionForOffset(comment.getOffset(), 0); context.addReplacement(target.replaceWith(context.getIndentationString(1))); // Indentation of the comment's lines return new FixedReplacementContext(context); } return context; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "public", "ITextReplacerContext", "fix", "(", "final", "ITextReplacerContext", "context", ",", "IComment", "comment", ")", "{", "final", "IHiddenRegion", "hiddenRegion", "=", "comment", ".", "getHiddenRegion", "(...
Fixing the bug. @param context the replacement context. @param comment the comment for which the fix must be applied. @return the new context.
[ "Fixing", "the", "bug", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/bugfixes/unpublished/BugMultilineCommentIndentation.java#L59-L71
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/MainProjectWizardPage.java
MainProjectWizardPage.putDefaultClasspathEntriesIn
public void putDefaultClasspathEntriesIn(Collection<IClasspathEntry> classpathEntries) { final IPath newPath = this.jreGroup.getJREContainerPath(); if (newPath != null) { classpathEntries.add(JavaCore.newContainerEntry(newPath)); } else { final IClasspathEntry[] entries = PreferenceConstants.getDefaultJRELibrary(); classpathEntries.addAll(Arrays.asList(entries)); } final IClasspathEntry sarlClasspathEntry = JavaCore.newContainerEntry( SARLClasspathContainerInitializer.CONTAINER_ID, new IAccessRule[0], new IClasspathAttribute[0], true); classpathEntries.add(sarlClasspathEntry); }
java
public void putDefaultClasspathEntriesIn(Collection<IClasspathEntry> classpathEntries) { final IPath newPath = this.jreGroup.getJREContainerPath(); if (newPath != null) { classpathEntries.add(JavaCore.newContainerEntry(newPath)); } else { final IClasspathEntry[] entries = PreferenceConstants.getDefaultJRELibrary(); classpathEntries.addAll(Arrays.asList(entries)); } final IClasspathEntry sarlClasspathEntry = JavaCore.newContainerEntry( SARLClasspathContainerInitializer.CONTAINER_ID, new IAccessRule[0], new IClasspathAttribute[0], true); classpathEntries.add(sarlClasspathEntry); }
[ "public", "void", "putDefaultClasspathEntriesIn", "(", "Collection", "<", "IClasspathEntry", ">", "classpathEntries", ")", "{", "final", "IPath", "newPath", "=", "this", ".", "jreGroup", ".", "getJREContainerPath", "(", ")", ";", "if", "(", "newPath", "!=", "nul...
Returns the default class path entries to be added on new projects. By default this is the JRE container as selected by the user. @param classpathEntries the collection in which the classpath entries will be added.
[ "Returns", "the", "default", "class", "path", "entries", "to", "be", "added", "on", "new", "projects", ".", "By", "default", "this", "is", "the", "JRE", "container", "as", "selected", "by", "the", "user", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/MainProjectWizardPage.java#L383-L398
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/MainProjectWizardPage.java
MainProjectWizardPage.getOutputLocation
public IPath getOutputLocation() { IPath outputLocationPath = new Path(getProjectName()).makeAbsolute(); outputLocationPath = outputLocationPath.append( Path.fromPortableString(SARLConfig.FOLDER_BIN)); return outputLocationPath; }
java
public IPath getOutputLocation() { IPath outputLocationPath = new Path(getProjectName()).makeAbsolute(); outputLocationPath = outputLocationPath.append( Path.fromPortableString(SARLConfig.FOLDER_BIN)); return outputLocationPath; }
[ "public", "IPath", "getOutputLocation", "(", ")", "{", "IPath", "outputLocationPath", "=", "new", "Path", "(", "getProjectName", "(", ")", ")", ".", "makeAbsolute", "(", ")", ";", "outputLocationPath", "=", "outputLocationPath", ".", "append", "(", "Path", "."...
Returns the source class path entries to be added on new projects. The underlying resource may not exist. @return returns the default class path entries
[ "Returns", "the", "source", "class", "path", "entries", "to", "be", "added", "on", "new", "projects", ".", "The", "underlying", "resource", "may", "not", "exist", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/MainProjectWizardPage.java#L406-L413
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/extractor/AbstractCodeElementExtractor.java
AbstractCodeElementExtractor.findAction
protected static Action findAction(EObject grammarComponent, String assignmentName) { for (final Action action : GrammarUtil.containedActions(grammarComponent)) { if (GrammarUtil.isAssignedAction(action)) { if (Objects.equals(assignmentName, action.getFeature())) { return action; } } } return null; }
java
protected static Action findAction(EObject grammarComponent, String assignmentName) { for (final Action action : GrammarUtil.containedActions(grammarComponent)) { if (GrammarUtil.isAssignedAction(action)) { if (Objects.equals(assignmentName, action.getFeature())) { return action; } } } return null; }
[ "protected", "static", "Action", "findAction", "(", "EObject", "grammarComponent", ",", "String", "assignmentName", ")", "{", "for", "(", "final", "Action", "action", ":", "GrammarUtil", ".", "containedActions", "(", "grammarComponent", ")", ")", "{", "if", "(",...
Replies the assignment component with the given nazme in the given grammar component. @param grammarComponent the component to explore. @param assignmentName the name of the assignment to search for. @return the assignment component.
[ "Replies", "the", "assignment", "component", "with", "the", "given", "nazme", "in", "the", "given", "grammar", "component", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/extractor/AbstractCodeElementExtractor.java#L112-L121
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/extractor/AbstractCodeElementExtractor.java
AbstractCodeElementExtractor.getContainerInRule
protected EObject getContainerInRule(EObject root, EObject content) { EObject container = content; do { final EClassifier classifier = getGeneratedTypeFor(container); if (classifier != null) { return container; } container = container.eContainer(); } while (container != root); final EClassifier classifier = getGeneratedTypeFor(root); if (classifier != null) { return root; } return null; }
java
protected EObject getContainerInRule(EObject root, EObject content) { EObject container = content; do { final EClassifier classifier = getGeneratedTypeFor(container); if (classifier != null) { return container; } container = container.eContainer(); } while (container != root); final EClassifier classifier = getGeneratedTypeFor(root); if (classifier != null) { return root; } return null; }
[ "protected", "EObject", "getContainerInRule", "(", "EObject", "root", ",", "EObject", "content", ")", "{", "EObject", "container", "=", "content", ";", "do", "{", "final", "EClassifier", "classifier", "=", "getGeneratedTypeFor", "(", "container", ")", ";", "if",...
Replies the container in the grammar rule for the given content element. @param root the biggest enclosing element to consider in the grammar. @param content the grammar element to search for the container. @return the container of the content.
[ "Replies", "the", "container", "in", "the", "grammar", "rule", "for", "the", "given", "content", "element", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/codebuilder/extractor/AbstractCodeElementExtractor.java#L157-L171
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.createClassCellEditor
protected CellEditor createClassCellEditor() { return new DialogCellEditor(getControl()) { @Override protected Object openDialogBox(Control cellEditorWindow) { final OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog( getControl().getShell(), false, PlatformUI.getWorkbench().getProgressService(), null, IJavaSearchConstants.TYPE); dialog.setTitle(JavaUIMessages.OpenTypeAction_dialogTitle); dialog.setMessage(JavaUIMessages.OpenTypeAction_dialogMessage); final int result = dialog.open(); if (result != IDialogConstants.OK_ID) { return null; } final Object[] types = dialog.getResult(); if (types == null || types.length != 1 || !(types[0] instanceof IType)) { return null; } final IType type = (IType) types[0]; final String name = type.getFullyQualifiedName(); return Strings.emptyIfNull(name); } }; }
java
protected CellEditor createClassCellEditor() { return new DialogCellEditor(getControl()) { @Override protected Object openDialogBox(Control cellEditorWindow) { final OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog( getControl().getShell(), false, PlatformUI.getWorkbench().getProgressService(), null, IJavaSearchConstants.TYPE); dialog.setTitle(JavaUIMessages.OpenTypeAction_dialogTitle); dialog.setMessage(JavaUIMessages.OpenTypeAction_dialogMessage); final int result = dialog.open(); if (result != IDialogConstants.OK_ID) { return null; } final Object[] types = dialog.getResult(); if (types == null || types.length != 1 || !(types[0] instanceof IType)) { return null; } final IType type = (IType) types[0]; final String name = type.getFullyQualifiedName(); return Strings.emptyIfNull(name); } }; }
[ "protected", "CellEditor", "createClassCellEditor", "(", ")", "{", "return", "new", "DialogCellEditor", "(", "getControl", "(", ")", ")", "{", "@", "Override", "protected", "Object", "openDialogBox", "(", "Control", "cellEditorWindow", ")", "{", "final", "OpenType...
Create a cell editor that enables to select a class. @return the cell editor.
[ "Create", "a", "cell", "editor", "that", "enables", "to", "select", "a", "class", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L334-L359
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.enableButtons
private void enableButtons() { final int itemCount = this.list.getTable().getItemCount(); final boolean hasElement = itemCount > 0; IStructuredSelection selection; if (hasElement) { selection = this.list.getStructuredSelection(); final int selectionCount = selection.size(); if (selectionCount <= 0 || selectionCount > itemCount) { selection = null; } } else { selection = null; } this.removeButton.setEnabled(selection != null); this.clearButton.setEnabled(hasElement); if (this.isSortedElements) { final Object firstElement = selection != null ? this.list.getTable().getItem(0).getData() : null; final Object lastElement = selection != null ? this.list.getTable().getItem(this.list.getTable().getItemCount() - 1).getData() : null; final boolean isNotFirst = firstElement != null && selection != null && firstElement != selection.getFirstElement(); final boolean isNotLast = lastElement != null && selection != null && lastElement != selection.getFirstElement(); this.moveTopButton.setEnabled(isNotFirst); this.moveUpButton.setEnabled(isNotFirst); this.moveDownButton.setEnabled(isNotLast); this.moveBottomButton.setEnabled(isNotLast); } }
java
private void enableButtons() { final int itemCount = this.list.getTable().getItemCount(); final boolean hasElement = itemCount > 0; IStructuredSelection selection; if (hasElement) { selection = this.list.getStructuredSelection(); final int selectionCount = selection.size(); if (selectionCount <= 0 || selectionCount > itemCount) { selection = null; } } else { selection = null; } this.removeButton.setEnabled(selection != null); this.clearButton.setEnabled(hasElement); if (this.isSortedElements) { final Object firstElement = selection != null ? this.list.getTable().getItem(0).getData() : null; final Object lastElement = selection != null ? this.list.getTable().getItem(this.list.getTable().getItemCount() - 1).getData() : null; final boolean isNotFirst = firstElement != null && selection != null && firstElement != selection.getFirstElement(); final boolean isNotLast = lastElement != null && selection != null && lastElement != selection.getFirstElement(); this.moveTopButton.setEnabled(isNotFirst); this.moveUpButton.setEnabled(isNotFirst); this.moveDownButton.setEnabled(isNotLast); this.moveBottomButton.setEnabled(isNotLast); } }
[ "private", "void", "enableButtons", "(", ")", "{", "final", "int", "itemCount", "=", "this", ".", "list", ".", "getTable", "(", ")", ".", "getItemCount", "(", ")", ";", "final", "boolean", "hasElement", "=", "itemCount", ">", "0", ";", "IStructuredSelectio...
Enables the type conversion buttons based on selected items counts in the viewer.
[ "Enables", "the", "type", "conversion", "buttons", "based", "on", "selected", "items", "counts", "in", "the", "viewer", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L389-L414
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.setTypeConversions
protected void setTypeConversions(List<Pair<String, String>> typeConversions, boolean notifyController) { this.conversions.clear(); if (typeConversions != null) { for (final Pair<String, String> entry : typeConversions) { this.conversions.add(new ConversionMapping(entry.getKey(), entry.getValue())); } } this.list.setInput(this.conversions); refreshListUI(); if (notifyController) { preferenceValueChanged(); } }
java
protected void setTypeConversions(List<Pair<String, String>> typeConversions, boolean notifyController) { this.conversions.clear(); if (typeConversions != null) { for (final Pair<String, String> entry : typeConversions) { this.conversions.add(new ConversionMapping(entry.getKey(), entry.getValue())); } } this.list.setInput(this.conversions); refreshListUI(); if (notifyController) { preferenceValueChanged(); } }
[ "protected", "void", "setTypeConversions", "(", "List", "<", "Pair", "<", "String", ",", "String", ">", ">", "typeConversions", ",", "boolean", "notifyController", ")", "{", "this", ".", "conversions", ".", "clear", "(", ")", ";", "if", "(", "typeConversions...
Sets the type conversions to be displayed in this block. @param typeConversions the type conversions. @param notifyController indicates if the controller should be notified.
[ "Sets", "the", "type", "conversions", "to", "be", "displayed", "in", "this", "block", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L422-L434
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.addTypeConversion
protected void addTypeConversion(String javaType, String targetType, boolean updateSelection) { final ConversionMapping entry = new ConversionMapping(javaType, targetType); this.conversions.add(entry); //refresh from model refreshListUI(); if (updateSelection) { this.list.setSelection(new StructuredSelection(entry)); } //ensure labels are updated if (!this.list.isBusy()) { this.list.refresh(true); } enableButtons(); preferenceValueChanged(); }
java
protected void addTypeConversion(String javaType, String targetType, boolean updateSelection) { final ConversionMapping entry = new ConversionMapping(javaType, targetType); this.conversions.add(entry); //refresh from model refreshListUI(); if (updateSelection) { this.list.setSelection(new StructuredSelection(entry)); } //ensure labels are updated if (!this.list.isBusy()) { this.list.refresh(true); } enableButtons(); preferenceValueChanged(); }
[ "protected", "void", "addTypeConversion", "(", "String", "javaType", ",", "String", "targetType", ",", "boolean", "updateSelection", ")", "{", "final", "ConversionMapping", "entry", "=", "new", "ConversionMapping", "(", "javaType", ",", "targetType", ")", ";", "th...
Add a type conversion. @param javaType the name of the java type. @param targetType the name of the target type. @param updateSelection indicates if the selection should be updated.
[ "Add", "a", "type", "conversion", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L442-L456
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.removeCurrentTypeConversion
@SuppressWarnings("unchecked") protected void removeCurrentTypeConversion() { final IStructuredSelection selection = this.list.getStructuredSelection(); final String[] types = new String[selection.size()]; final Iterator<ConversionMapping> iter = selection.iterator(); int i = 0; while (iter.hasNext()) { types[i] = iter.next().getSource(); i++; } removeTypeConversions(types); }
java
@SuppressWarnings("unchecked") protected void removeCurrentTypeConversion() { final IStructuredSelection selection = this.list.getStructuredSelection(); final String[] types = new String[selection.size()]; final Iterator<ConversionMapping> iter = selection.iterator(); int i = 0; while (iter.hasNext()) { types[i] = iter.next().getSource(); i++; } removeTypeConversions(types); }
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "protected", "void", "removeCurrentTypeConversion", "(", ")", "{", "final", "IStructuredSelection", "selection", "=", "this", ".", "list", ".", "getStructuredSelection", "(", ")", ";", "final", "String", "[", "]"...
Remove the current type conversion.
[ "Remove", "the", "current", "type", "conversion", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L468-L479
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.moveSelectionTop
protected void moveSelectionTop() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index > 0) { final int endIndex = index + selection.size() - 1; for (int i = 0; i < selection.size(); ++i) { final ConversionMapping next = this.conversions.remove(endIndex); this.conversions.addFirst(next); } refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); } }
java
protected void moveSelectionTop() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index > 0) { final int endIndex = index + selection.size() - 1; for (int i = 0; i < selection.size(); ++i) { final ConversionMapping next = this.conversions.remove(endIndex); this.conversions.addFirst(next); } refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); } }
[ "protected", "void", "moveSelectionTop", "(", ")", "{", "final", "IStructuredSelection", "selection", "=", "this", ".", "list", ".", "getStructuredSelection", "(", ")", ";", "final", "int", "index", "=", "this", ".", "conversions", ".", "indexOf", "(", "select...
Move the selection at the top.
[ "Move", "the", "selection", "at", "the", "top", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L483-L497
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.moveSelectionUp
protected void moveSelectionUp() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index > 0) { final ConversionMapping previous = this.conversions.remove(index - 1); this.conversions.add(index + selection.size() - 1, previous); refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); } }
java
protected void moveSelectionUp() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index > 0) { final ConversionMapping previous = this.conversions.remove(index - 1); this.conversions.add(index + selection.size() - 1, previous); refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); } }
[ "protected", "void", "moveSelectionUp", "(", ")", "{", "final", "IStructuredSelection", "selection", "=", "this", ".", "list", ".", "getStructuredSelection", "(", ")", ";", "final", "int", "index", "=", "this", ".", "conversions", ".", "indexOf", "(", "selecti...
Move the selection up.
[ "Move", "the", "selection", "up", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L501-L512
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.moveSelectionDown
protected void moveSelectionDown() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index >= 0 && (index + selection.size()) < this.conversions.size()) { final ConversionMapping next = this.conversions.remove(index + selection.size()); this.conversions.add(index, next); refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); } }
java
protected void moveSelectionDown() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index >= 0 && (index + selection.size()) < this.conversions.size()) { final ConversionMapping next = this.conversions.remove(index + selection.size()); this.conversions.add(index, next); refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); } }
[ "protected", "void", "moveSelectionDown", "(", ")", "{", "final", "IStructuredSelection", "selection", "=", "this", ".", "list", ".", "getStructuredSelection", "(", ")", ";", "final", "int", "index", "=", "this", ".", "conversions", ".", "indexOf", "(", "selec...
Move the selection down.
[ "Move", "the", "selection", "down", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L516-L527
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.moveSelectionBottom
protected void moveSelectionBottom() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index >= 0 && (index + selection.size()) < this.conversions.size()) { for (int i = 0; i < selection.size(); ++i) { final ConversionMapping previous = this.conversions.remove(index); this.conversions.addLast(previous); } refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); } }
java
protected void moveSelectionBottom() { final IStructuredSelection selection = this.list.getStructuredSelection(); final int index = this.conversions.indexOf(selection.getFirstElement()); if (index >= 0 && (index + selection.size()) < this.conversions.size()) { for (int i = 0; i < selection.size(); ++i) { final ConversionMapping previous = this.conversions.remove(index); this.conversions.addLast(previous); } refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); } }
[ "protected", "void", "moveSelectionBottom", "(", ")", "{", "final", "IStructuredSelection", "selection", "=", "this", ".", "list", ".", "getStructuredSelection", "(", ")", ";", "final", "int", "index", "=", "this", ".", "conversions", ".", "indexOf", "(", "sel...
Move the selection at the bottom.
[ "Move", "the", "selection", "at", "the", "bottom", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L531-L544
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.removeTypeConversions
protected void removeTypeConversions(String... types) { for (final String type : types) { final Iterator<ConversionMapping> iterator = this.conversions.iterator(); while (iterator.hasNext()) { final ConversionMapping pair = iterator.next(); if (Strings.equal(pair.getSource(), type)) { iterator.remove(); break; } } } refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); }
java
protected void removeTypeConversions(String... types) { for (final String type : types) { final Iterator<ConversionMapping> iterator = this.conversions.iterator(); while (iterator.hasNext()) { final ConversionMapping pair = iterator.next(); if (Strings.equal(pair.getSource(), type)) { iterator.remove(); break; } } } refreshListUI(); this.list.refresh(true); enableButtons(); preferenceValueChanged(); }
[ "protected", "void", "removeTypeConversions", "(", "String", "...", "types", ")", "{", "for", "(", "final", "String", "type", ":", "types", ")", "{", "final", "Iterator", "<", "ConversionMapping", ">", "iterator", "=", "this", ".", "conversions", ".", "itera...
Remove the given type conversions. @param types the type conversions to be removed.
[ "Remove", "the", "given", "type", "conversions", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L550-L565
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.refreshListUI
protected void refreshListUI() { final Display display = Display.getDefault(); if (display.getThread().equals(Thread.currentThread())) { if (!this.list.isBusy()) { this.list.refresh(); } } else { display.syncExec(new Runnable() { @SuppressWarnings("synthetic-access") @Override public void run() { if (!AbstractConversionTable.this.list.isBusy()) { AbstractConversionTable.this.list.refresh(); } } }); } }
java
protected void refreshListUI() { final Display display = Display.getDefault(); if (display.getThread().equals(Thread.currentThread())) { if (!this.list.isBusy()) { this.list.refresh(); } } else { display.syncExec(new Runnable() { @SuppressWarnings("synthetic-access") @Override public void run() { if (!AbstractConversionTable.this.list.isBusy()) { AbstractConversionTable.this.list.refresh(); } } }); } }
[ "protected", "void", "refreshListUI", "(", ")", "{", "final", "Display", "display", "=", "Display", ".", "getDefault", "(", ")", ";", "if", "(", "display", ".", "getThread", "(", ")", ".", "equals", "(", "Thread", ".", "currentThread", "(", ")", ")", "...
Refresh the UI list of type conversions.
[ "Refresh", "the", "UI", "list", "of", "type", "conversions", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L579-L596
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java
AbstractConversionTable.sortByTargetColumn
private void sortByTargetColumn() { this.list.setComparator(new ViewerComparator() { @Override public int compare(Viewer viewer, Object e1, Object e2) { if (e1 != null && e2 != null) { return e1.toString().compareToIgnoreCase(e2.toString()); } return super.compare(viewer, e1, e2); } @Override public boolean isSorterProperty(Object element, String property) { return true; } }); this.sort = Column.TARGET; }
java
private void sortByTargetColumn() { this.list.setComparator(new ViewerComparator() { @Override public int compare(Viewer viewer, Object e1, Object e2) { if (e1 != null && e2 != null) { return e1.toString().compareToIgnoreCase(e2.toString()); } return super.compare(viewer, e1, e2); } @Override public boolean isSorterProperty(Object element, String property) { return true; } }); this.sort = Column.TARGET; }
[ "private", "void", "sortByTargetColumn", "(", ")", "{", "this", ".", "list", ".", "setComparator", "(", "new", "ViewerComparator", "(", ")", "{", "@", "Override", "public", "int", "compare", "(", "Viewer", "viewer", ",", "Object", "e1", ",", "Object", "e2"...
Sorts the type conversions by target type.
[ "Sorts", "the", "type", "conversions", "by", "target", "type", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/extralanguage/properties/AbstractConversionTable.java#L630-L646
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java
BuildSettingWizardPage.updateStatus
private void updateStatus(Throwable event) { Throwable cause = event; while (cause != null && (!(cause instanceof CoreException)) && cause.getCause() != null && cause.getCause() != cause) { cause = cause.getCause(); } if (cause instanceof CoreException) { updateStatus(((CoreException) cause).getStatus()); } else { final String message; if (cause != null) { message = cause.getLocalizedMessage(); } else { message = event.getLocalizedMessage(); } final IStatus status = new StatusInfo(IStatus.ERROR, message); updateStatus(status); } }
java
private void updateStatus(Throwable event) { Throwable cause = event; while (cause != null && (!(cause instanceof CoreException)) && cause.getCause() != null && cause.getCause() != cause) { cause = cause.getCause(); } if (cause instanceof CoreException) { updateStatus(((CoreException) cause).getStatus()); } else { final String message; if (cause != null) { message = cause.getLocalizedMessage(); } else { message = event.getLocalizedMessage(); } final IStatus status = new StatusInfo(IStatus.ERROR, message); updateStatus(status); } }
[ "private", "void", "updateStatus", "(", "Throwable", "event", ")", "{", "Throwable", "cause", "=", "event", ";", "while", "(", "cause", "!=", "null", "&&", "(", "!", "(", "cause", "instanceof", "CoreException", ")", ")", "&&", "cause", ".", "getCause", "...
Update the status of this page according to the given exception. @param event the exception.
[ "Update", "the", "status", "of", "this", "page", "according", "to", "the", "given", "exception", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java#L193-L213
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java
BuildSettingWizardPage.performFinish
public void performFinish(IProgressMonitor monitor) throws CoreException, InterruptedException { final SubMonitor subMonitor = SubMonitor.convert(monitor, 4); try { monitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_operation_create, 3); if (this.currProject == null) { updateProject(subMonitor.newChild(1)); } final String newProjectCompliance = this.keepContent ? null : this.firstPage.getCompilerCompliance(); configureJavaProject(newProjectCompliance, subMonitor.newChild(1)); } catch (Throwable e) { if (this.currProject != null) { removeProvisonalProject(); } throw e; } finally { subMonitor.done(); this.currProject = null; if (this.isAutobuild != null) { CoreUtility.setAutoBuilding(this.isAutobuild.booleanValue()); this.isAutobuild = null; } } }
java
public void performFinish(IProgressMonitor monitor) throws CoreException, InterruptedException { final SubMonitor subMonitor = SubMonitor.convert(monitor, 4); try { monitor.beginTask(NewWizardMessages.NewJavaProjectWizardPageTwo_operation_create, 3); if (this.currProject == null) { updateProject(subMonitor.newChild(1)); } final String newProjectCompliance = this.keepContent ? null : this.firstPage.getCompilerCompliance(); configureJavaProject(newProjectCompliance, subMonitor.newChild(1)); } catch (Throwable e) { if (this.currProject != null) { removeProvisonalProject(); } throw e; } finally { subMonitor.done(); this.currProject = null; if (this.isAutobuild != null) { CoreUtility.setAutoBuilding(this.isAutobuild.booleanValue()); this.isAutobuild = null; } } }
[ "public", "void", "performFinish", "(", "IProgressMonitor", "monitor", ")", "throws", "CoreException", ",", "InterruptedException", "{", "final", "SubMonitor", "subMonitor", "=", "SubMonitor", ".", "convert", "(", "monitor", ",", "4", ")", ";", "try", "{", "moni...
Called from the wizard on finish. @param monitor the progress monitor @throws CoreException thrown when the project creation or configuration failed @throws InterruptedException thrown when the user canceled the project creation
[ "Called", "from", "the", "wizard", "on", "finish", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java#L604-L627
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java
BuildSettingWizardPage.createProvisonalProject
protected IProject createProvisonalProject() { final IStatus status = changeToNewProject(); if (status != null) { updateStatus(status); if (!status.isOK()) { ErrorDialog.openError( getShell(), NewWizardMessages.NewJavaProjectWizardPageTwo_error_title, null, status); } } return this.currProject; }
java
protected IProject createProvisonalProject() { final IStatus status = changeToNewProject(); if (status != null) { updateStatus(status); if (!status.isOK()) { ErrorDialog.openError( getShell(), NewWizardMessages.NewJavaProjectWizardPageTwo_error_title, null, status); } } return this.currProject; }
[ "protected", "IProject", "createProvisonalProject", "(", ")", "{", "final", "IStatus", "status", "=", "changeToNewProject", "(", ")", ";", "if", "(", "status", "!=", "null", ")", "{", "updateStatus", "(", "status", ")", ";", "if", "(", "!", "status", ".", ...
Creates the provisional project on which the wizard is working on. The provisional project is typically created when the page is entered the first time. The early project creation is required to configure linked folders. @return the provisional project
[ "Creates", "the", "provisional", "project", "on", "which", "the", "wizard", "is", "working", "on", ".", "The", "provisional", "project", "is", "typically", "created", "when", "the", "page", "is", "entered", "the", "first", "time", ".", "The", "early", "proje...
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java#L637-L650
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java
BuildSettingWizardPage.removeProvisonalProject
protected void removeProvisonalProject() { if (!this.currProject.exists()) { this.currProject = null; return; } final IRunnableWithProgress op = new IRunnableWithProgress() { @SuppressWarnings("synthetic-access") @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { doRemoveProject(monitor); } }; try { getContainer().run(true, true, new WorkspaceModifyDelegatingOperation(op)); } catch (InvocationTargetException e) { final String title = NewWizardMessages.NewJavaProjectWizardPageTwo_error_remove_title; final String message = NewWizardMessages.NewJavaProjectWizardPageTwo_error_remove_message; ExceptionHandler.handle(e, getShell(), title, message); } catch (InterruptedException e) { // cancel pressed } }
java
protected void removeProvisonalProject() { if (!this.currProject.exists()) { this.currProject = null; return; } final IRunnableWithProgress op = new IRunnableWithProgress() { @SuppressWarnings("synthetic-access") @Override public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException { doRemoveProject(monitor); } }; try { getContainer().run(true, true, new WorkspaceModifyDelegatingOperation(op)); } catch (InvocationTargetException e) { final String title = NewWizardMessages.NewJavaProjectWizardPageTwo_error_remove_title; final String message = NewWizardMessages.NewJavaProjectWizardPageTwo_error_remove_message; ExceptionHandler.handle(e, getShell(), title, message); } catch (InterruptedException e) { // cancel pressed } }
[ "protected", "void", "removeProvisonalProject", "(", ")", "{", "if", "(", "!", "this", ".", "currProject", ".", "exists", "(", ")", ")", "{", "this", ".", "currProject", "=", "null", ";", "return", ";", "}", "final", "IRunnableWithProgress", "op", "=", "...
Removes the provisional project. The provisional project is typically removed when the user cancels the wizard or goes back to the first page.
[ "Removes", "the", "provisional", "project", ".", "The", "provisional", "project", "is", "typically", "removed", "when", "the", "user", "cancels", "the", "wizard", "or", "goes", "back", "to", "the", "first", "page", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/newproject/BuildSettingWizardPage.java#L656-L679
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/UniqueAddressParticipantRepository.java
UniqueAddressParticipantRepository.registerParticipant
public ADDRESST registerParticipant(ADDRESST address, EventListener entity) { synchronized (mutex()) { addListener(address, entity); this.participants.put(entity.getID(), address); } return address; }
java
public ADDRESST registerParticipant(ADDRESST address, EventListener entity) { synchronized (mutex()) { addListener(address, entity); this.participants.put(entity.getID(), address); } return address; }
[ "public", "ADDRESST", "registerParticipant", "(", "ADDRESST", "address", ",", "EventListener", "entity", ")", "{", "synchronized", "(", "mutex", "(", ")", ")", "{", "addListener", "(", "address", ",", "entity", ")", ";", "this", ".", "participants", ".", "pu...
Registers a new participant in this repository. @param address the address of the participant @param entity the entity associated to the specified address @return the address of the participant
[ "Registers", "a", "new", "participant", "in", "this", "repository", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/UniqueAddressParticipantRepository.java#L87-L93
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/UniqueAddressParticipantRepository.java
UniqueAddressParticipantRepository.unregisterParticipant
public ADDRESST unregisterParticipant(UUID entityID) { synchronized (mutex()) { removeListener(this.participants.get(entityID)); return this.participants.remove(entityID); } }
java
public ADDRESST unregisterParticipant(UUID entityID) { synchronized (mutex()) { removeListener(this.participants.get(entityID)); return this.participants.remove(entityID); } }
[ "public", "ADDRESST", "unregisterParticipant", "(", "UUID", "entityID", ")", "{", "synchronized", "(", "mutex", "(", ")", ")", "{", "removeListener", "(", "this", ".", "participants", ".", "get", "(", "entityID", ")", ")", ";", "return", "this", ".", "part...
Remove a participant with the given ID from this repository. @param entityID identifier of the participant to remove from this repository. @return the address that was mapped to the given participant.
[ "Remove", "a", "participant", "with", "the", "given", "ID", "from", "this", "repository", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/UniqueAddressParticipantRepository.java#L111-L116
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/UniqueAddressParticipantRepository.java
UniqueAddressParticipantRepository.getParticipantAddresses
public SynchronizedCollection<ADDRESST> getParticipantAddresses() { final Object mutex = mutex(); synchronized (mutex) { return Collections3.synchronizedCollection(this.participants.values(), mutex); } }
java
public SynchronizedCollection<ADDRESST> getParticipantAddresses() { final Object mutex = mutex(); synchronized (mutex) { return Collections3.synchronizedCollection(this.participants.values(), mutex); } }
[ "public", "SynchronizedCollection", "<", "ADDRESST", ">", "getParticipantAddresses", "(", ")", "{", "final", "Object", "mutex", "=", "mutex", "(", ")", ";", "synchronized", "(", "mutex", ")", "{", "return", "Collections3", ".", "synchronizedCollection", "(", "th...
Replies all the addresses of the participants that ar einside this repository. @return all the addresses.
[ "Replies", "all", "the", "addresses", "of", "the", "participants", "that", "ar", "einside", "this", "repository", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/UniqueAddressParticipantRepository.java#L145-L150
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/UniqueAddressParticipantRepository.java
UniqueAddressParticipantRepository.getParticipantIDs
public SynchronizedSet<UUID> getParticipantIDs() { final Object mutex = mutex(); synchronized (mutex) { return Collections3.synchronizedSet(this.participants.keySet(), mutex); } }
java
public SynchronizedSet<UUID> getParticipantIDs() { final Object mutex = mutex(); synchronized (mutex) { return Collections3.synchronizedSet(this.participants.keySet(), mutex); } }
[ "public", "SynchronizedSet", "<", "UUID", ">", "getParticipantIDs", "(", ")", "{", "final", "Object", "mutex", "=", "mutex", "(", ")", ";", "synchronized", "(", "mutex", ")", "{", "return", "Collections3", ".", "synchronizedSet", "(", "this", ".", "participa...
Replies the identifiers of all the participants in this repository. @return all the identifiers.
[ "Replies", "the", "identifiers", "of", "all", "the", "participants", "in", "this", "repository", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/repository/UniqueAddressParticipantRepository.java#L157-L162
train
sarl/sarl
main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/InitializeMojo.java
InitializeMojo.addSourceFolder
protected void addSourceFolder(String path) { final List<String> existingFolders1 = this.project.getCompileSourceRoots(); final List<String> existingFolders2 = this.project.getTestCompileSourceRoots(); if (!existingFolders1.contains(path) && !existingFolders2.contains(path)) { getLog().info(MessageFormat.format(Messages.InitializeMojo_0, path)); this.session.getCurrentProject().addCompileSourceRoot(path); } else { getLog().info(MessageFormat.format(Messages.InitializeMojo_1, path)); } }
java
protected void addSourceFolder(String path) { final List<String> existingFolders1 = this.project.getCompileSourceRoots(); final List<String> existingFolders2 = this.project.getTestCompileSourceRoots(); if (!existingFolders1.contains(path) && !existingFolders2.contains(path)) { getLog().info(MessageFormat.format(Messages.InitializeMojo_0, path)); this.session.getCurrentProject().addCompileSourceRoot(path); } else { getLog().info(MessageFormat.format(Messages.InitializeMojo_1, path)); } }
[ "protected", "void", "addSourceFolder", "(", "String", "path", ")", "{", "final", "List", "<", "String", ">", "existingFolders1", "=", "this", ".", "project", ".", "getCompileSourceRoots", "(", ")", ";", "final", "List", "<", "String", ">", "existingFolders2",...
Add a source folder in the current projecT. @param path the source folder path.
[ "Add", "a", "source", "folder", "in", "the", "current", "projecT", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/externalmaven/io.sarl.maven.docs.generator/src/main/java/io/sarl/maven/docs/InitializeMojo.java#L70-L79
train
sarl/sarl
main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/acceptors/MissedMethodAddModification.java
MissedMethodAddModification.cloneTypeReferences
private List<LightweightTypeReference> cloneTypeReferences(List<JvmTypeReference> types, Map<String, JvmTypeReference> typeParameterMap) { final List<LightweightTypeReference> newList = new ArrayList<>(types.size()); for (final JvmTypeReference type : types) { newList.add(cloneTypeReference(type, typeParameterMap)); } return newList; }
java
private List<LightweightTypeReference> cloneTypeReferences(List<JvmTypeReference> types, Map<String, JvmTypeReference> typeParameterMap) { final List<LightweightTypeReference> newList = new ArrayList<>(types.size()); for (final JvmTypeReference type : types) { newList.add(cloneTypeReference(type, typeParameterMap)); } return newList; }
[ "private", "List", "<", "LightweightTypeReference", ">", "cloneTypeReferences", "(", "List", "<", "JvmTypeReference", ">", "types", ",", "Map", "<", "String", ",", "JvmTypeReference", ">", "typeParameterMap", ")", "{", "final", "List", "<", "LightweightTypeReference...
Clone the given types by applying the type parameter mapping when necessary. @param types the types to clone. @param typeParameterMap the type parameter mapping. @return the clones.
[ "Clone", "the", "given", "types", "by", "applying", "the", "type", "parameter", "mapping", "when", "necessary", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.ui/src/io/sarl/lang/ui/quickfix/acceptors/MissedMethodAddModification.java#L321-L328
train
sarl/sarl
products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/subconfigs/ValidatorConfig.java
ValidatorConfig.setWarningLevels
@BQConfigProperty("Specify the levels of specific warnings") public void setWarningLevels(Map<String, Severity> levels) { if (levels == null) { this.warningLevels = new HashMap<>(); } else { this.warningLevels = levels; } }
java
@BQConfigProperty("Specify the levels of specific warnings") public void setWarningLevels(Map<String, Severity> levels) { if (levels == null) { this.warningLevels = new HashMap<>(); } else { this.warningLevels = levels; } }
[ "@", "BQConfigProperty", "(", "\"Specify the levels of specific warnings\"", ")", "public", "void", "setWarningLevels", "(", "Map", "<", "String", ",", "Severity", ">", "levels", ")", "{", "if", "(", "levels", "==", "null", ")", "{", "this", ".", "warningLevels"...
Change the specific warning levels. @param levels the warnings levels.
[ "Change", "the", "specific", "warning", "levels", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/products/sarlc/src/main/java/io/sarl/lang/sarlc/configs/subconfigs/ValidatorConfig.java#L90-L97
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.quoteRegex
protected static String quoteRegex(String regex) { if (regex == null) { return ""; //$NON-NLS-1$ } return regex.replaceAll(REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_PROTECT); }
java
protected static String quoteRegex(String regex) { if (regex == null) { return ""; //$NON-NLS-1$ } return regex.replaceAll(REGEX_SPECIAL_CHARS, REGEX_SPECIAL_CHARS_PROTECT); }
[ "protected", "static", "String", "quoteRegex", "(", "String", "regex", ")", "{", "if", "(", "regex", "==", "null", ")", "{", "return", "\"\"", ";", "//$NON-NLS-1$", "}", "return", "regex", ".", "replaceAll", "(", "REGEX_SPECIAL_CHARS", ",", "REGEX_SPECIAL_CHAR...
Protect the given regular expression. @param regex the expression to protect. @return the protected expression.
[ "Protect", "the", "given", "regular", "expression", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L136-L141
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.orRegex
protected static String orRegex(Iterable<String> elements) { final StringBuilder regex = new StringBuilder(); for (final String element : elements) { if (regex.length() > 0) { regex.append("|"); //$NON-NLS-1$ } regex.append("(?:"); //$NON-NLS-1$ regex.append(quoteRegex(element)); regex.append(")"); //$NON-NLS-1$ } return regex.toString(); }
java
protected static String orRegex(Iterable<String> elements) { final StringBuilder regex = new StringBuilder(); for (final String element : elements) { if (regex.length() > 0) { regex.append("|"); //$NON-NLS-1$ } regex.append("(?:"); //$NON-NLS-1$ regex.append(quoteRegex(element)); regex.append(")"); //$NON-NLS-1$ } return regex.toString(); }
[ "protected", "static", "String", "orRegex", "(", "Iterable", "<", "String", ">", "elements", ")", "{", "final", "StringBuilder", "regex", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "final", "String", "element", ":", "elements", ")", "{", "if",...
Build a regular expression that is matching one of the given elements. @param elements the elements to match. @return the regular expression
[ "Build", "a", "regular", "expression", "that", "is", "matching", "one", "of", "the", "given", "elements", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L148-L159
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.sortedConcat
@SafeVarargs protected static Set<String> sortedConcat(Iterable<String>... iterables) { final Set<String> set = new TreeSet<>(); for (final Iterable<String> iterable : iterables) { for (final String obj : iterable) { set.add(obj); } } return set; }
java
@SafeVarargs protected static Set<String> sortedConcat(Iterable<String>... iterables) { final Set<String> set = new TreeSet<>(); for (final Iterable<String> iterable : iterables) { for (final String obj : iterable) { set.add(obj); } } return set; }
[ "@", "SafeVarargs", "protected", "static", "Set", "<", "String", ">", "sortedConcat", "(", "Iterable", "<", "String", ">", "...", "iterables", ")", "{", "final", "Set", "<", "String", ">", "set", "=", "new", "TreeSet", "<>", "(", ")", ";", "for", "(", ...
Concat the given iterables. @param iterables the iterables. @return the concat result.
[ "Concat", "the", "given", "iterables", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L175-L184
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.addMimeType
public void addMimeType(String mimeType) { if (!Strings.isEmpty(mimeType)) { for (final String mtype : mimeType.split("[:;,]")) { //$NON-NLS-1$ this.mimeTypes.add(mtype); } } }
java
public void addMimeType(String mimeType) { if (!Strings.isEmpty(mimeType)) { for (final String mtype : mimeType.split("[:;,]")) { //$NON-NLS-1$ this.mimeTypes.add(mtype); } } }
[ "public", "void", "addMimeType", "(", "String", "mimeType", ")", "{", "if", "(", "!", "Strings", ".", "isEmpty", "(", "mimeType", ")", ")", "{", "for", "(", "final", "String", "mtype", ":", "mimeType", ".", "split", "(", "\"[:;,]\"", ")", ")", "{", "...
Add a mime type for the SARL source code. @param mimeType the mime type of SARL.
[ "Add", "a", "mime", "type", "for", "the", "SARL", "source", "code", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L190-L196
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.getMimeTypes
@Pure public List<String> getMimeTypes() { if (this.mimeTypes.isEmpty()) { return Arrays.asList("text/x-" + getLanguageSimpleName().toLowerCase()); //$NON-NLS-1$ } return this.mimeTypes; }
java
@Pure public List<String> getMimeTypes() { if (this.mimeTypes.isEmpty()) { return Arrays.asList("text/x-" + getLanguageSimpleName().toLowerCase()); //$NON-NLS-1$ } return this.mimeTypes; }
[ "@", "Pure", "public", "List", "<", "String", ">", "getMimeTypes", "(", ")", "{", "if", "(", "this", ".", "mimeTypes", ".", "isEmpty", "(", ")", ")", "{", "return", "Arrays", ".", "asList", "(", "\"text/x-\"", "+", "getLanguageSimpleName", "(", ")", "....
Replies the mime types for the SARL source code. @return the mime type for SARL.
[ "Replies", "the", "mime", "types", "for", "the", "SARL", "source", "code", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L202-L208
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.getBasename
@Pure public String getBasename(String defaultName) { if (Strings.isEmpty(this.basename)) { return defaultName; } return this.basename; }
java
@Pure public String getBasename(String defaultName) { if (Strings.isEmpty(this.basename)) { return defaultName; } return this.basename; }
[ "@", "Pure", "public", "String", "getBasename", "(", "String", "defaultName", ")", "{", "if", "(", "Strings", ".", "isEmpty", "(", "this", ".", "basename", ")", ")", "{", "return", "defaultName", ";", "}", "return", "this", ".", "basename", ";", "}" ]
Replies the basename of the XML file to generate. @param defaultName the name to reply if the basename was not set. @return the basename.
[ "Replies", "the", "basename", "of", "the", "XML", "file", "to", "generate", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L235-L241
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.exploreGrammar
@SuppressWarnings("checkstyle:nestedifdepth") private static void exploreGrammar(Grammar grammar, Set<String> expressionKeywords, Set<String> modifiers, Set<String> primitiveTypes, Set<String> punctuation, Set<String> literals, Set<String> excludedKeywords, Set<String> ignored) { for (final AbstractRule rule : grammar.getRules()) { final boolean isModifierRule = MODIFIER_RULE_PATTERN.matcher(rule.getName()).matches(); final TreeIterator<EObject> iterator = rule.eAllContents(); while (iterator.hasNext()) { final EObject object = iterator.next(); if (object instanceof Keyword) { final Keyword xkeyword = (Keyword) object; final String value = xkeyword.getValue(); if (!Strings.isEmpty(value)) { if (KEYWORD_PATTERN.matcher(value).matches()) { if (!literals.contains(value) && !primitiveTypes.contains(value)) { if (excludedKeywords.contains(value)) { ignored.add(value); } else { if (isModifierRule) { modifiers.add(value); } else { expressionKeywords.add(value); } } } } else if (PUNCTUATION_PATTERN.matcher(value).matches()) { punctuation.add(value); } } } } } }
java
@SuppressWarnings("checkstyle:nestedifdepth") private static void exploreGrammar(Grammar grammar, Set<String> expressionKeywords, Set<String> modifiers, Set<String> primitiveTypes, Set<String> punctuation, Set<String> literals, Set<String> excludedKeywords, Set<String> ignored) { for (final AbstractRule rule : grammar.getRules()) { final boolean isModifierRule = MODIFIER_RULE_PATTERN.matcher(rule.getName()).matches(); final TreeIterator<EObject> iterator = rule.eAllContents(); while (iterator.hasNext()) { final EObject object = iterator.next(); if (object instanceof Keyword) { final Keyword xkeyword = (Keyword) object; final String value = xkeyword.getValue(); if (!Strings.isEmpty(value)) { if (KEYWORD_PATTERN.matcher(value).matches()) { if (!literals.contains(value) && !primitiveTypes.contains(value)) { if (excludedKeywords.contains(value)) { ignored.add(value); } else { if (isModifierRule) { modifiers.add(value); } else { expressionKeywords.add(value); } } } } else if (PUNCTUATION_PATTERN.matcher(value).matches()) { punctuation.add(value); } } } } } }
[ "@", "SuppressWarnings", "(", "\"checkstyle:nestedifdepth\"", ")", "private", "static", "void", "exploreGrammar", "(", "Grammar", "grammar", ",", "Set", "<", "String", ">", "expressionKeywords", ",", "Set", "<", "String", ">", "modifiers", ",", "Set", "<", "Stri...
Explore the grammar for extracting the key elements. @param grammar the grammar to explore. @param expressionKeywords the SARL keywords, usually within expressions. @param modifiers the modifier keywords. @param primitiveTypes the primitive types. @param punctuation the set of detected punctuation symbols. @param literals the set of detected literals. @param excludedKeywords the set of given excluded keywords. @param ignored the set of ignored tokens that is filled by this function.
[ "Explore", "the", "grammar", "for", "extracting", "the", "key", "elements", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L329-L361
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.generate
protected final void generate(Set<String> literals, Set<String> expressionKeywords, Set<String> modifiers, Set<String> primitiveTypes, Set<String> punctuation, Set<String> ignored, Set<String> specialKeywords, Set<String> typeDeclarationKeywords) { final T appendable = newStyleAppendable(); generate(appendable, literals, expressionKeywords, modifiers, primitiveTypes, punctuation, ignored, specialKeywords, typeDeclarationKeywords); final String language = getLanguageSimpleName().toLowerCase(); final String basename = getBasename(MessageFormat.format(getBasenameTemplate(), language)); writeFile(basename, appendable); generateAdditionalFiles(basename, appendable); generateReadme(basename); }
java
protected final void generate(Set<String> literals, Set<String> expressionKeywords, Set<String> modifiers, Set<String> primitiveTypes, Set<String> punctuation, Set<String> ignored, Set<String> specialKeywords, Set<String> typeDeclarationKeywords) { final T appendable = newStyleAppendable(); generate(appendable, literals, expressionKeywords, modifiers, primitiveTypes, punctuation, ignored, specialKeywords, typeDeclarationKeywords); final String language = getLanguageSimpleName().toLowerCase(); final String basename = getBasename(MessageFormat.format(getBasenameTemplate(), language)); writeFile(basename, appendable); generateAdditionalFiles(basename, appendable); generateReadme(basename); }
[ "protected", "final", "void", "generate", "(", "Set", "<", "String", ">", "literals", ",", "Set", "<", "String", ">", "expressionKeywords", ",", "Set", "<", "String", ">", "modifiers", ",", "Set", "<", "String", ">", "primitiveTypes", ",", "Set", "<", "S...
Generate the external specification. @param literals the SARL literals. @param expressionKeywords the SARL keywords, usually within expressions. @param modifiers the modifier keywords. @param primitiveTypes the primitive types. @param punctuation the SARL punctuation symbols. @param ignored the ignored literals (mostly for information). @param specialKeywords the keywords that are marked as special. They are also in {@code keywords}. @param typeDeclarationKeywords the keywords that are marked as type declaration keywords. They are also in {@code keywords}.
[ "Generate", "the", "external", "specification", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L476-L487
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.concat
public static CharSequence concat(CharSequence... lines) { return new CharSequence() { private final StringBuilder content = new StringBuilder(); private int next; private int length = -1; @Override public String toString() { ensure(length()); return this.content.toString(); } private void ensure(int index) { while (this.next < lines.length && index >= this.content.length()) { if (lines[this.next] != null) { this.content.append(lines[this.next]).append("\n"); //$NON-NLS-1$ } ++this.next; } } @Override public CharSequence subSequence(int start, int end) { ensure(end - 1); return this.content.subSequence(start, end); } @Override public int length() { if (this.length < 0) { int len = 0; for (final CharSequence seq : lines) { len += seq.length() + 1; } len = Math.max(0, len - 1); this.length = len; } return this.length; } @Override public char charAt(int index) { ensure(index); return this.content.charAt(index); } }; }
java
public static CharSequence concat(CharSequence... lines) { return new CharSequence() { private final StringBuilder content = new StringBuilder(); private int next; private int length = -1; @Override public String toString() { ensure(length()); return this.content.toString(); } private void ensure(int index) { while (this.next < lines.length && index >= this.content.length()) { if (lines[this.next] != null) { this.content.append(lines[this.next]).append("\n"); //$NON-NLS-1$ } ++this.next; } } @Override public CharSequence subSequence(int start, int end) { ensure(end - 1); return this.content.subSequence(start, end); } @Override public int length() { if (this.length < 0) { int len = 0; for (final CharSequence seq : lines) { len += seq.length() + 1; } len = Math.max(0, len - 1); this.length = len; } return this.length; } @Override public char charAt(int index) { ensure(index); return this.content.charAt(index); } }; }
[ "public", "static", "CharSequence", "concat", "(", "CharSequence", "...", "lines", ")", "{", "return", "new", "CharSequence", "(", ")", "{", "private", "final", "StringBuilder", "content", "=", "new", "StringBuilder", "(", ")", ";", "private", "int", "next", ...
Contact the given strings of characters. @param lines the lines. @return the concatenation result.
[ "Contact", "the", "given", "strings", "of", "characters", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L528-L577
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.generateReadme
protected void generateReadme(String basename) { final Object content = getReadmeFileContent(basename); if (content != null) { final String textualContent = content.toString(); if (!Strings.isEmpty(textualContent)) { final byte[] bytes = textualContent.getBytes(); for (final String output : getOutputs()) { final File directory = new File(output).getAbsoluteFile(); try { directory.mkdirs(); final File outputFile = new File(directory, README_BASENAME); Files.write(Paths.get(outputFile.getAbsolutePath()), bytes); } catch (IOException e) { throw new RuntimeException(e); } } } } }
java
protected void generateReadme(String basename) { final Object content = getReadmeFileContent(basename); if (content != null) { final String textualContent = content.toString(); if (!Strings.isEmpty(textualContent)) { final byte[] bytes = textualContent.getBytes(); for (final String output : getOutputs()) { final File directory = new File(output).getAbsoluteFile(); try { directory.mkdirs(); final File outputFile = new File(directory, README_BASENAME); Files.write(Paths.get(outputFile.getAbsolutePath()), bytes); } catch (IOException e) { throw new RuntimeException(e); } } } } }
[ "protected", "void", "generateReadme", "(", "String", "basename", ")", "{", "final", "Object", "content", "=", "getReadmeFileContent", "(", "basename", ")", ";", "if", "(", "content", "!=", "null", ")", "{", "final", "String", "textualContent", "=", "content",...
Generate the README file. @param basename the basename of the generated file. @since 0.6
[ "Generate", "the", "README", "file", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L584-L602
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.getLanguageSimpleName
protected String getLanguageSimpleName() { final String name = getGrammar().getName(); final int index = name.lastIndexOf('.'); if (index > 0) { return name.substring(index + 1); } return name; }
java
protected String getLanguageSimpleName() { final String name = getGrammar().getName(); final int index = name.lastIndexOf('.'); if (index > 0) { return name.substring(index + 1); } return name; }
[ "protected", "String", "getLanguageSimpleName", "(", ")", "{", "final", "String", "name", "=", "getGrammar", "(", ")", ".", "getName", "(", ")", ";", "final", "int", "index", "=", "name", ".", "lastIndexOf", "(", "'", "'", ")", ";", "if", "(", "index",...
Replies the simple name of the language. @return the name.
[ "Replies", "the", "simple", "name", "of", "the", "language", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L665-L672
train
sarl/sarl
main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java
AbstractExternalHighlightingFragment2.lines
@Pure protected String lines(String prefix, String... lines) { final String delimiter = getCodeConfig().getLineDelimiter(); final StringBuilder buffer = new StringBuilder(); for (final String line : lines) { buffer.append(prefix); buffer.append(line); buffer.append(delimiter); } return buffer.toString(); }
java
@Pure protected String lines(String prefix, String... lines) { final String delimiter = getCodeConfig().getLineDelimiter(); final StringBuilder buffer = new StringBuilder(); for (final String line : lines) { buffer.append(prefix); buffer.append(line); buffer.append(delimiter); } return buffer.toString(); }
[ "@", "Pure", "protected", "String", "lines", "(", "String", "prefix", ",", "String", "...", "lines", ")", "{", "final", "String", "delimiter", "=", "getCodeConfig", "(", ")", ".", "getLineDelimiter", "(", ")", ";", "final", "StringBuilder", "buffer", "=", ...
Merge the given lines with prefix. @param prefix the prefix to add to each line. @param lines the lines. @return the merged elements.
[ "Merge", "the", "given", "lines", "with", "prefix", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.mwe2/src/io/sarl/lang/mwe2/externalspec/AbstractExternalHighlightingFragment2.java#L694-L704
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlOutputConfigurationProvider.java
SarlOutputConfigurationProvider.createStandardOutputConfiguration
@SuppressWarnings("static-method") protected OutputConfiguration createStandardOutputConfiguration() { final OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT); defaultOutput.setDescription(Messages.SarlOutputConfigurationProvider_0); defaultOutput.setOutputDirectory(SARLConfig.FOLDER_SOURCE_GENERATED); defaultOutput.setOverrideExistingResources(true); defaultOutput.setCreateOutputDirectory(true); defaultOutput.setCanClearOutputDirectory(false); defaultOutput.setCleanUpDerivedResources(true); defaultOutput.setSetDerivedProperty(true); defaultOutput.setKeepLocalHistory(false); return defaultOutput; }
java
@SuppressWarnings("static-method") protected OutputConfiguration createStandardOutputConfiguration() { final OutputConfiguration defaultOutput = new OutputConfiguration(IFileSystemAccess.DEFAULT_OUTPUT); defaultOutput.setDescription(Messages.SarlOutputConfigurationProvider_0); defaultOutput.setOutputDirectory(SARLConfig.FOLDER_SOURCE_GENERATED); defaultOutput.setOverrideExistingResources(true); defaultOutput.setCreateOutputDirectory(true); defaultOutput.setCanClearOutputDirectory(false); defaultOutput.setCleanUpDerivedResources(true); defaultOutput.setSetDerivedProperty(true); defaultOutput.setKeepLocalHistory(false); return defaultOutput; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "protected", "OutputConfiguration", "createStandardOutputConfiguration", "(", ")", "{", "final", "OutputConfiguration", "defaultOutput", "=", "new", "OutputConfiguration", "(", "IFileSystemAccess", ".", "DEFAULT_OUTPUT",...
Create the standard output configuration. @return the configuration, never {@code null}. @since 0.8
[ "Create", "the", "standard", "output", "configuration", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/compiler/SarlOutputConfigurationProvider.java#L67-L79
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/modules/kernel/MandatoryKernelModule.java
MandatoryKernelModule.getKernel
@Provides @io.janusproject.kernel.annotations.Kernel @Singleton public static AgentContext getKernel(ContextSpaceService contextService, @Named(JanusConfig.DEFAULT_CONTEXT_ID_NAME) UUID janusContextID, @Named(JanusConfig.DEFAULT_SPACE_ID_NAME) UUID defaultJanusSpaceId) { return contextService.createContext(janusContextID, defaultJanusSpaceId); }
java
@Provides @io.janusproject.kernel.annotations.Kernel @Singleton public static AgentContext getKernel(ContextSpaceService contextService, @Named(JanusConfig.DEFAULT_CONTEXT_ID_NAME) UUID janusContextID, @Named(JanusConfig.DEFAULT_SPACE_ID_NAME) UUID defaultJanusSpaceId) { return contextService.createContext(janusContextID, defaultJanusSpaceId); }
[ "@", "Provides", "@", "io", ".", "janusproject", ".", "kernel", ".", "annotations", ".", "Kernel", "@", "Singleton", "public", "static", "AgentContext", "getKernel", "(", "ContextSpaceService", "contextService", ",", "@", "Named", "(", "JanusConfig", ".", "DEFAU...
Construct the root agent context within the Janus platform. @param contextService the service for managing the contexts. @param janusContextID the root context's id. @param defaultJanusSpaceId the id of the space within the root context. @return the root context.
[ "Construct", "the", "root", "agent", "context", "within", "the", "Janus", "platform", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/modules/kernel/MandatoryKernelModule.java#L93-L100
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/modules/kernel/MandatoryKernelModule.java
MandatoryKernelModule.createAgentInternalEventsDispatcher
@Provides public static AgentInternalEventsDispatcher createAgentInternalEventsDispatcher(Injector injector) { final AgentInternalEventsDispatcher aeb = new AgentInternalEventsDispatcher(injector.getInstance(ExecutorService.class)); // to be able to inject the ExecutorService and SubscriberFindingStrategy injector.injectMembers(aeb); return aeb; }
java
@Provides public static AgentInternalEventsDispatcher createAgentInternalEventsDispatcher(Injector injector) { final AgentInternalEventsDispatcher aeb = new AgentInternalEventsDispatcher(injector.getInstance(ExecutorService.class)); // to be able to inject the ExecutorService and SubscriberFindingStrategy injector.injectMembers(aeb); return aeb; }
[ "@", "Provides", "public", "static", "AgentInternalEventsDispatcher", "createAgentInternalEventsDispatcher", "(", "Injector", "injector", ")", "{", "final", "AgentInternalEventsDispatcher", "aeb", "=", "new", "AgentInternalEventsDispatcher", "(", "injector", ".", "getInstance...
Create an instance of the event dispatcher for an agent. @param injector the injector. @return the event dispatcher.
[ "Create", "an", "instance", "of", "the", "event", "dispatcher", "for", "an", "agent", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/modules/kernel/MandatoryKernelModule.java#L107-L113
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java
SARLReentrantTypeResolver.getSarlCapacityFieldType
protected LightweightTypeReference getSarlCapacityFieldType(IResolvedTypes resolvedTypes, JvmField field) { // For capacity call redirection LightweightTypeReference fieldType = resolvedTypes.getActualType(field); final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field, ImportedCapacityFeature.class); if (capacityAnnotation != null) { final JvmTypeReference ref = ((JvmTypeAnnotationValue) capacityAnnotation.getValues().get(0)).getValues().get(0); fieldType = resolvedTypes.getActualType(ref.getType()); } return fieldType; }
java
protected LightweightTypeReference getSarlCapacityFieldType(IResolvedTypes resolvedTypes, JvmField field) { // For capacity call redirection LightweightTypeReference fieldType = resolvedTypes.getActualType(field); final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field, ImportedCapacityFeature.class); if (capacityAnnotation != null) { final JvmTypeReference ref = ((JvmTypeAnnotationValue) capacityAnnotation.getValues().get(0)).getValues().get(0); fieldType = resolvedTypes.getActualType(ref.getType()); } return fieldType; }
[ "protected", "LightweightTypeReference", "getSarlCapacityFieldType", "(", "IResolvedTypes", "resolvedTypes", ",", "JvmField", "field", ")", "{", "// For capacity call redirection", "LightweightTypeReference", "fieldType", "=", "resolvedTypes", ".", "getActualType", "(", "field"...
Replies the type of the field that represents a SARL capacity buffer. @param resolvedTypes the resolver of types. @param field the field. @return the type, never {@code null}.
[ "Replies", "the", "type", "of", "the", "field", "that", "represents", "a", "SARL", "capacity", "buffer", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java#L143-L153
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java
SARLReentrantTypeResolver.createSarlCapacityExtensionProvider
protected XAbstractFeatureCall createSarlCapacityExtensionProvider(JvmIdentifiableElement thisFeature, JvmField field) { // For capacity call redirection if (thisFeature instanceof JvmDeclaredType) { final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field, ImportedCapacityFeature.class); if (capacityAnnotation != null) { final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName( field.getSimpleName()); final JvmOperation callerOperation = findOperation((JvmDeclaredType) thisFeature, methodName); if (callerOperation != null) { final XbaseFactory baseFactory = getXbaseFactory(); final XMemberFeatureCall extensionProvider = baseFactory.createXMemberFeatureCall(); extensionProvider.setFeature(callerOperation); final XFeatureCall thisAccess = baseFactory.createXFeatureCall(); thisAccess.setFeature(thisFeature); extensionProvider.setMemberCallTarget(thisAccess); return extensionProvider; } } } return null; }
java
protected XAbstractFeatureCall createSarlCapacityExtensionProvider(JvmIdentifiableElement thisFeature, JvmField field) { // For capacity call redirection if (thisFeature instanceof JvmDeclaredType) { final JvmAnnotationReference capacityAnnotation = this.annotationLookup.findAnnotation(field, ImportedCapacityFeature.class); if (capacityAnnotation != null) { final String methodName = Utils.createNameForHiddenCapacityImplementationCallingMethodFromFieldName( field.getSimpleName()); final JvmOperation callerOperation = findOperation((JvmDeclaredType) thisFeature, methodName); if (callerOperation != null) { final XbaseFactory baseFactory = getXbaseFactory(); final XMemberFeatureCall extensionProvider = baseFactory.createXMemberFeatureCall(); extensionProvider.setFeature(callerOperation); final XFeatureCall thisAccess = baseFactory.createXFeatureCall(); thisAccess.setFeature(thisFeature); extensionProvider.setMemberCallTarget(thisAccess); return extensionProvider; } } } return null; }
[ "protected", "XAbstractFeatureCall", "createSarlCapacityExtensionProvider", "(", "JvmIdentifiableElement", "thisFeature", ",", "JvmField", "field", ")", "{", "// For capacity call redirection", "if", "(", "thisFeature", "instanceof", "JvmDeclaredType", ")", "{", "final", "Jvm...
Create the extension provider dedicated to the access to the used capacity functions. @param thisFeature the current object. @param field the extension field. @return the SARL capacity extension provider, or {@code null}.
[ "Create", "the", "extension", "provider", "dedicated", "to", "the", "access", "to", "the", "used", "capacity", "functions", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/SARLReentrantTypeResolver.java#L161-L182
train
sarl/sarl
sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/executors/JdkRejectedExecutionHandler.java
JdkRejectedExecutionHandler.runRejectedTask
protected static boolean runRejectedTask(Runnable runnable, ThreadPoolExecutor executor) { // Runs the task directly in the calling thread of the {@code execute} method, // unless the executor has been shut down, in which case the task // is discarded. if (!executor.isShutdown()) { runnable.run(); return true; } return false; }
java
protected static boolean runRejectedTask(Runnable runnable, ThreadPoolExecutor executor) { // Runs the task directly in the calling thread of the {@code execute} method, // unless the executor has been shut down, in which case the task // is discarded. if (!executor.isShutdown()) { runnable.run(); return true; } return false; }
[ "protected", "static", "boolean", "runRejectedTask", "(", "Runnable", "runnable", ",", "ThreadPoolExecutor", "executor", ")", "{", "// Runs the task directly in the calling thread of the {@code execute} method,", "// unless the executor has been shut down, in which case the task", "// is...
Run the given task within the current thread if the executor is not shut down. The task is not run by the given executor. The executor is used for checking if the executor service is shut down. @param runnable the runnable task to be executed @param executor the executor attempting to give the shut down status @return {@code true} if the task is run. {@code false} if the task was not run. @since 0.7 @see CallerRunsPolicy
[ "Run", "the", "given", "task", "within", "the", "current", "thread", "if", "the", "executor", "is", "not", "shut", "down", ".", "The", "task", "is", "not", "run", "by", "the", "given", "executor", ".", "The", "executor", "is", "used", "for", "checking", ...
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/sre/io.janusproject/io.janusproject.plugin/src/io/janusproject/kernel/services/jdk/executors/JdkRejectedExecutionHandler.java#L79-L88
train
sarl/sarl
main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Capacities.java
Capacities.createSkillDelegator
@Pure public static <C extends Capacity> C createSkillDelegator(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller) throws Exception { final String name = capacity.getName() + CAPACITY_WRAPPER_NAME; final Class<?> type = Class.forName(name, true, capacity.getClassLoader()); final Constructor<?> cons = type.getDeclaredConstructor(capacity, AgentTrait.class); return capacity.cast(cons.newInstance(originalSkill, capacityCaller)); }
java
@Pure public static <C extends Capacity> C createSkillDelegator(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller) throws Exception { final String name = capacity.getName() + CAPACITY_WRAPPER_NAME; final Class<?> type = Class.forName(name, true, capacity.getClassLoader()); final Constructor<?> cons = type.getDeclaredConstructor(capacity, AgentTrait.class); return capacity.cast(cons.newInstance(originalSkill, capacityCaller)); }
[ "@", "Pure", "public", "static", "<", "C", "extends", "Capacity", ">", "C", "createSkillDelegator", "(", "Skill", "originalSkill", ",", "Class", "<", "C", ">", "capacity", ",", "AgentTrait", "capacityCaller", ")", "throws", "Exception", "{", "final", "String",...
Create a delegator for the given skill. <p>The delegator is wrapping the original skill in order to set the value of the caller that will be replied by {@link #getCaller()}. The associated caller is given as argument. <p>The delegator is an instance of an specific inner type, sub-type of {@link Capacity.ContextAwareCapacityWrapper}, which is declared in the given {@code capacity}. <p>This function fails if the delegator instance cannot be created due to inner type not found, invalid constructor signature, run-time exception when creating the instance. This functions assumes that the name of the definition type is the same as {@link Capacity.ContextAwareCapacityWrapper}, and this definition extends the delegator definition of the first super type of the {@code capacity}, and implements all the super types of the {@code capacity}. The expected constructor for this inner type has the same signature as the one of {@link Capacity.ContextAwareCapacityWrapper}. <p>The function {@link #createSkillDelegatorIfPossible(Skill, Class, AgentTrait)} is a similar function than this function, except that it does not fail when the delegator instance cannot be created. In this last case, the function {@link #createSkillDelegatorIfPossible(Skill, Class, AgentTrait)} reply the original skill itself. @param <C> the type of the capacity. @param originalSkill the skill to delegate to after ensure the capacity caller is correctly set. @param capacity the capacity that contains the definition of the delegator. @param capacityCaller the caller of the capacity functions. @return the delegator. @throws Exception if the delegator cannot be created. @see #createSkillDelegatorIfPossible(Skill, Class, AgentTrait)
[ "Create", "a", "delegator", "for", "the", "given", "skill", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Capacities.java#L87-L94
train
sarl/sarl
main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Capacities.java
Capacities.createSkillDelegatorIfPossible
@Pure public static <C extends Capacity> C createSkillDelegatorIfPossible(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller) throws ClassCastException { try { return Capacities.createSkillDelegator(originalSkill, capacity, capacityCaller); } catch (Exception e) { return capacity.cast(originalSkill); } }
java
@Pure public static <C extends Capacity> C createSkillDelegatorIfPossible(Skill originalSkill, Class<C> capacity, AgentTrait capacityCaller) throws ClassCastException { try { return Capacities.createSkillDelegator(originalSkill, capacity, capacityCaller); } catch (Exception e) { return capacity.cast(originalSkill); } }
[ "@", "Pure", "public", "static", "<", "C", "extends", "Capacity", ">", "C", "createSkillDelegatorIfPossible", "(", "Skill", "originalSkill", ",", "Class", "<", "C", ">", "capacity", ",", "AgentTrait", "capacityCaller", ")", "throws", "ClassCastException", "{", "...
Create a delegator for the given skill when it is possible. <p>The delegator is wrapping the original skill in order to set the value of the caller that will be replied by {@link #getCaller()}. The associated caller is given as argument. <p>The delegator is an instance of an specific inner type, sub-type of {@link Capacity.ContextAwareCapacityWrapper}, which is declared in the given {@code capacity}. <p>This functions assumes that the name of the definition type is the same as {@link Capacity.ContextAwareCapacityWrapper}, and this definition extends the delegator definition of the first super type of the {@code capacity}, and implements all the super types of the {@code capacity}. The expected constructor for this inner type has the same signature as the one of {@link Capacity.ContextAwareCapacityWrapper}. If the delegator instance cannot be created due to to inner type not found, invalid constructor signature, run-time exception when creating the instance, this function replies the original skill. <p>The function {@link #createSkillDelegator(Skill, Class, AgentTrait)} is a similar function than this function, except that it fails when the delegator instance cannot be created. @param <C> the type of the capacity. @param originalSkill the skill to delegate to after ensure the capacity caller is correctly set. @param capacity the capacity that contains the definition of the delegator. @param capacityCaller the caller of the capacity functions. @return the delegator, or the original skill. @throws ClassCastException if the skill is not implementing the capacity. @see #createSkillDelegator(Skill, Class, AgentTrait)
[ "Create", "a", "delegator", "for", "the", "given", "skill", "when", "it", "is", "possible", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang.core/src/io/sarl/lang/core/Capacities.java#L122-L130
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/AbstractSourceAppender.java
AbstractSourceAppender.build
protected void build(EObject object, ISourceAppender appender) throws IOException { final IJvmTypeProvider provider = getTypeResolutionContext(); if (provider != null) { final Map<Key<?>, Binding<?>> bindings = this.originalInjector.getBindings(); Injector localInjector = CodeBuilderFactory.createOverridingInjector(this.originalInjector, (binder) -> binder.bind(AbstractTypeScopeProvider.class).toInstance(AbstractSourceAppender.this.scopeProvider)); final IScopeProvider oldDelegate = this.typeScopes.getDelegate(); localInjector.injectMembers(this.typeScopes); try { final AppenderSerializer serializer = localInjector.getProvider(AppenderSerializer.class).get(); serializer.serialize(object, appender, isFormatting()); } finally { try { final Field f = DelegatingScopes.class.getDeclaredField("delegate"); if (!f.isAccessible()) { f.setAccessible(true); } f.set(this.typeScopes, oldDelegate); } catch (Exception exception) { throw new Error(exception); } } } else { final AppenderSerializer serializer = this.originalInjector.getProvider(AppenderSerializer.class).get(); serializer.serialize(object, appender, isFormatting()); } }
java
protected void build(EObject object, ISourceAppender appender) throws IOException { final IJvmTypeProvider provider = getTypeResolutionContext(); if (provider != null) { final Map<Key<?>, Binding<?>> bindings = this.originalInjector.getBindings(); Injector localInjector = CodeBuilderFactory.createOverridingInjector(this.originalInjector, (binder) -> binder.bind(AbstractTypeScopeProvider.class).toInstance(AbstractSourceAppender.this.scopeProvider)); final IScopeProvider oldDelegate = this.typeScopes.getDelegate(); localInjector.injectMembers(this.typeScopes); try { final AppenderSerializer serializer = localInjector.getProvider(AppenderSerializer.class).get(); serializer.serialize(object, appender, isFormatting()); } finally { try { final Field f = DelegatingScopes.class.getDeclaredField("delegate"); if (!f.isAccessible()) { f.setAccessible(true); } f.set(this.typeScopes, oldDelegate); } catch (Exception exception) { throw new Error(exception); } } } else { final AppenderSerializer serializer = this.originalInjector.getProvider(AppenderSerializer.class).get(); serializer.serialize(object, appender, isFormatting()); } }
[ "protected", "void", "build", "(", "EObject", "object", ",", "ISourceAppender", "appender", ")", "throws", "IOException", "{", "final", "IJvmTypeProvider", "provider", "=", "getTypeResolutionContext", "(", ")", ";", "if", "(", "provider", "!=", "null", ")", "{",...
Build the source code and put it into the given appender. @param the object to serialize @param appender the object that permits to create the source code. @param context the context for type resolution.
[ "Build", "the", "source", "code", "and", "put", "it", "into", "the", "given", "appender", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/appenders/AbstractSourceAppender.java#L100-L125
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/controlflow/ExtendedSARLEarlyExitComputer.java
ExtendedSARLEarlyExitComputer.isEarlyExitSARLStatement
protected boolean isEarlyExitSARLStatement(XExpression expression) { if (expression instanceof XAbstractFeatureCall) { // Do not call expression.getFeature() since the feature may be unresolved. // The type resolution at this point causes exceptions in the reentrant type resolver. // The second parameter (false) forces to ignore feature resolution. final Object element = expression.eGet( XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, false); return this.originalComputer.isEarlyExitAnnotatedElement(element); } return false; }
java
protected boolean isEarlyExitSARLStatement(XExpression expression) { if (expression instanceof XAbstractFeatureCall) { // Do not call expression.getFeature() since the feature may be unresolved. // The type resolution at this point causes exceptions in the reentrant type resolver. // The second parameter (false) forces to ignore feature resolution. final Object element = expression.eGet( XbasePackage.Literals.XABSTRACT_FEATURE_CALL__FEATURE, false); return this.originalComputer.isEarlyExitAnnotatedElement(element); } return false; }
[ "protected", "boolean", "isEarlyExitSARLStatement", "(", "XExpression", "expression", ")", "{", "if", "(", "expression", "instanceof", "XAbstractFeatureCall", ")", "{", "// Do not call expression.getFeature() since the feature may be unresolved.", "// The type resolution at this poin...
Replies if the given expression is a early-exit SARL statement. @param expression the expression to test. @return <code>true</code> if the given expression is a SARL early-exit statement, <code>false</code> otherwise. @see ISarlEarlyExitComputer#isEarlyExitAnnotatedElement(Object)
[ "Replies", "if", "the", "given", "expression", "is", "a", "early", "-", "exit", "SARL", "statement", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/controlflow/ExtendedSARLEarlyExitComputer.java#L68-L79
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/TypeParameterBuilderImpl.java
TypeParameterBuilderImpl.addUpperConstraint
public void addUpperConstraint(String type) { final JvmUpperBound constraint = this.jvmTypesFactory.createJvmUpperBound(); constraint.setTypeReference(newTypeRef(this.context, type)); getJvmTypeParameter().getConstraints().add(constraint); }
java
public void addUpperConstraint(String type) { final JvmUpperBound constraint = this.jvmTypesFactory.createJvmUpperBound(); constraint.setTypeReference(newTypeRef(this.context, type)); getJvmTypeParameter().getConstraints().add(constraint); }
[ "public", "void", "addUpperConstraint", "(", "String", "type", ")", "{", "final", "JvmUpperBound", "constraint", "=", "this", ".", "jvmTypesFactory", ".", "createJvmUpperBound", "(", ")", ";", "constraint", ".", "setTypeReference", "(", "newTypeRef", "(", "this", ...
Add upper type bounds. @param type the type.
[ "Add", "upper", "type", "bounds", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/TypeParameterBuilderImpl.java#L88-L92
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/TypeParameterBuilderImpl.java
TypeParameterBuilderImpl.addLowerConstraint
public void addLowerConstraint(String type) { final JvmLowerBound constraint = this.jvmTypesFactory.createJvmLowerBound(); constraint.setTypeReference(newTypeRef(this.context, type)); getJvmTypeParameter().getConstraints().add(constraint); }
java
public void addLowerConstraint(String type) { final JvmLowerBound constraint = this.jvmTypesFactory.createJvmLowerBound(); constraint.setTypeReference(newTypeRef(this.context, type)); getJvmTypeParameter().getConstraints().add(constraint); }
[ "public", "void", "addLowerConstraint", "(", "String", "type", ")", "{", "final", "JvmLowerBound", "constraint", "=", "this", ".", "jvmTypesFactory", ".", "createJvmLowerBound", "(", ")", ";", "constraint", ".", "setTypeReference", "(", "newTypeRef", "(", "this", ...
Add lower type bounds. @param type the type.
[ "Add", "lower", "type", "bounds", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/TypeParameterBuilderImpl.java#L97-L101
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java
SARLEclipsePlugin.getImageDescriptor
public ImageDescriptor getImageDescriptor(String imagePath) { ImageDescriptor descriptor = getImageRegistry().getDescriptor(imagePath); if (descriptor == null) { descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SARLEclipsePlugin.PLUGIN_ID, imagePath); if (descriptor != null) { getImageRegistry().put(imagePath, descriptor); } } return descriptor; }
java
public ImageDescriptor getImageDescriptor(String imagePath) { ImageDescriptor descriptor = getImageRegistry().getDescriptor(imagePath); if (descriptor == null) { descriptor = AbstractUIPlugin.imageDescriptorFromPlugin(SARLEclipsePlugin.PLUGIN_ID, imagePath); if (descriptor != null) { getImageRegistry().put(imagePath, descriptor); } } return descriptor; }
[ "public", "ImageDescriptor", "getImageDescriptor", "(", "String", "imagePath", ")", "{", "ImageDescriptor", "descriptor", "=", "getImageRegistry", "(", ")", ".", "getDescriptor", "(", "imagePath", ")", ";", "if", "(", "descriptor", "==", "null", ")", "{", "descr...
Replies the image descriptor for the given image path. @param imagePath path of the image. @return the image descriptor.
[ "Replies", "the", "image", "descriptor", "for", "the", "given", "image", "path", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java#L130-L139
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java
SARLEclipsePlugin.createMultiStatus
@SuppressWarnings("static-method") public IStatus createMultiStatus(Iterable<? extends IStatus> status) { final IStatus max = findMax(status); final MultiStatus multiStatus; if (max == null) { multiStatus = new MultiStatus(PLUGIN_ID, 0, null, null); } else { multiStatus = new MultiStatus(PLUGIN_ID, 0, max.getMessage(), max.getException()); } for (final IStatus s : status) { multiStatus.add(s); } return multiStatus; }
java
@SuppressWarnings("static-method") public IStatus createMultiStatus(Iterable<? extends IStatus> status) { final IStatus max = findMax(status); final MultiStatus multiStatus; if (max == null) { multiStatus = new MultiStatus(PLUGIN_ID, 0, null, null); } else { multiStatus = new MultiStatus(PLUGIN_ID, 0, max.getMessage(), max.getException()); } for (final IStatus s : status) { multiStatus.add(s); } return multiStatus; }
[ "@", "SuppressWarnings", "(", "\"static-method\"", ")", "public", "IStatus", "createMultiStatus", "(", "Iterable", "<", "?", "extends", "IStatus", ">", "status", ")", "{", "final", "IStatus", "max", "=", "findMax", "(", "status", ")", ";", "final", "MultiStatu...
Create a multistatus. @param status the status to put in the same status instance. @return the status.
[ "Create", "a", "multistatus", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java#L256-L269
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java
SARLEclipsePlugin.logErrorMessage
public void logErrorMessage(String message) { getILog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, null)); }
java
public void logErrorMessage(String message) { getILog().log(new Status(IStatus.ERROR, PLUGIN_ID, message, null)); }
[ "public", "void", "logErrorMessage", "(", "String", "message", ")", "{", "getILog", "(", ")", ".", "log", "(", "new", "Status", "(", "IStatus", ".", "ERROR", ",", "PLUGIN_ID", ",", "message", ",", "null", ")", ")", ";", "}" ]
Logs an internal error with the specified message. @param message the error message to log
[ "Logs", "an", "internal", "error", "with", "the", "specified", "message", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java#L286-L288
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java
SARLEclipsePlugin.logDebugMessage
@SuppressWarnings({"static-method", "checkstyle:regexp"}) public void logDebugMessage(String message, Throwable cause) { Debug.println(message); if (cause != null) { Debug.printStackTrace(cause); } }
java
@SuppressWarnings({"static-method", "checkstyle:regexp"}) public void logDebugMessage(String message, Throwable cause) { Debug.println(message); if (cause != null) { Debug.printStackTrace(cause); } }
[ "@", "SuppressWarnings", "(", "{", "\"static-method\"", ",", "\"checkstyle:regexp\"", "}", ")", "public", "void", "logDebugMessage", "(", "String", "message", ",", "Throwable", "cause", ")", "{", "Debug", ".", "println", "(", "message", ")", ";", "if", "(", ...
Logs an internal debug message with the specified message. @param message the debug message to log @param cause the cause of the message log.
[ "Logs", "an", "internal", "debug", "message", "with", "the", "specified", "message", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java#L316-L322
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java
SARLEclipsePlugin.savePreferences
public void savePreferences() { final IEclipsePreferences prefs = getPreferences(); try { prefs.flush(); } catch (BackingStoreException e) { getILog().log(createStatus(IStatus.ERROR, e)); } }
java
public void savePreferences() { final IEclipsePreferences prefs = getPreferences(); try { prefs.flush(); } catch (BackingStoreException e) { getILog().log(createStatus(IStatus.ERROR, e)); } }
[ "public", "void", "savePreferences", "(", ")", "{", "final", "IEclipsePreferences", "prefs", "=", "getPreferences", "(", ")", ";", "try", "{", "prefs", ".", "flush", "(", ")", ";", "}", "catch", "(", "BackingStoreException", "e", ")", "{", "getILog", "(", ...
Saves the preferences for the plug-in.
[ "Saves", "the", "preferences", "for", "the", "plug", "-", "in", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java#L356-L363
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java
SARLEclipsePlugin.openError
public void openError(Shell shell, String title, String message, Throwable exception) { final Throwable ex = (exception != null) ? Throwables.getRootCause(exception) : null; if (ex != null) { log(ex); final IStatus status = createStatus(IStatus.ERROR, message, ex); ErrorDialog.openError(shell, title, message, status); } else { MessageDialog.openError(shell, title, message); } }
java
public void openError(Shell shell, String title, String message, Throwable exception) { final Throwable ex = (exception != null) ? Throwables.getRootCause(exception) : null; if (ex != null) { log(ex); final IStatus status = createStatus(IStatus.ERROR, message, ex); ErrorDialog.openError(shell, title, message, status); } else { MessageDialog.openError(shell, title, message); } }
[ "public", "void", "openError", "(", "Shell", "shell", ",", "String", "title", ",", "String", "message", ",", "Throwable", "exception", ")", "{", "final", "Throwable", "ex", "=", "(", "exception", "!=", "null", ")", "?", "Throwables", ".", "getRootCause", "...
Display an error dialog and log the error. @param shell the parent container. @param title the title of the dialog box. @param message the message to display into the dialog box. @param exception the exception to be logged. @since 0.6 @see #log(Throwable)
[ "Display", "an", "error", "dialog", "and", "log", "the", "error", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/SARLEclipsePlugin.java#L375-L384
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractSuperTypeSelectionDialog.java
AbstractSuperTypeSelectionDialog.createSearchScope
public static IJavaSearchScope createSearchScope(IJavaProject project, Class<?> type, boolean onlySubTypes) { try { final IType superType = project.findType(type.getName()); return SearchEngine.createStrictHierarchyScope( project, superType, // only sub types onlySubTypes, // include the type true, null); } catch (JavaModelException e) { SARLEclipsePlugin.getDefault().log(e); } return SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); }
java
public static IJavaSearchScope createSearchScope(IJavaProject project, Class<?> type, boolean onlySubTypes) { try { final IType superType = project.findType(type.getName()); return SearchEngine.createStrictHierarchyScope( project, superType, // only sub types onlySubTypes, // include the type true, null); } catch (JavaModelException e) { SARLEclipsePlugin.getDefault().log(e); } return SearchEngine.createJavaSearchScope(new IJavaElement[] {project}); }
[ "public", "static", "IJavaSearchScope", "createSearchScope", "(", "IJavaProject", "project", ",", "Class", "<", "?", ">", "type", ",", "boolean", "onlySubTypes", ")", "{", "try", "{", "final", "IType", "superType", "=", "project", ".", "findType", "(", "type",...
Creates a searching scope including only one project. @param project the scope of the search. @param type the expected super type. @param onlySubTypes indicates if only the subtypes of the given types are allowed. If <code>false</code>, the super type is allowed too. @return the search scope.
[ "Creates", "a", "searching", "scope", "including", "only", "one", "project", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractSuperTypeSelectionDialog.java#L99-L114
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractSuperTypeSelectionDialog.java
AbstractSuperTypeSelectionDialog.fillWizardPageWithSelectedTypes
private void fillWizardPageWithSelectedTypes() { final StructuredSelection selection = getSelectedItems(); if (selection == null) { return; } for (final Iterator<?> iter = selection.iterator(); iter.hasNext();) { final Object obj = iter.next(); if (obj instanceof TypeNameMatch) { accessedHistoryItem(obj); final TypeNameMatch type = (TypeNameMatch) obj; final String qualifiedName = Utilities.getNameWithTypeParameters(type.getType()); final String message; if (addTypeToWizardPage(this.typeWizardPage, qualifiedName)) { message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_2, TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS)); } else { message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_3, TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS)); } updateStatus(new StatusInfo(IStatus.INFO, message)); } } }
java
private void fillWizardPageWithSelectedTypes() { final StructuredSelection selection = getSelectedItems(); if (selection == null) { return; } for (final Iterator<?> iter = selection.iterator(); iter.hasNext();) { final Object obj = iter.next(); if (obj instanceof TypeNameMatch) { accessedHistoryItem(obj); final TypeNameMatch type = (TypeNameMatch) obj; final String qualifiedName = Utilities.getNameWithTypeParameters(type.getType()); final String message; if (addTypeToWizardPage(this.typeWizardPage, qualifiedName)) { message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_2, TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS)); } else { message = MessageFormat.format(Messages.AbstractSuperTypeSelectionDialog_3, TextProcessor.process(qualifiedName, JAVA_ELEMENT_DELIMITERS)); } updateStatus(new StatusInfo(IStatus.INFO, message)); } } }
[ "private", "void", "fillWizardPageWithSelectedTypes", "(", ")", "{", "final", "StructuredSelection", "selection", "=", "getSelectedItems", "(", ")", ";", "if", "(", "selection", "==", "null", ")", "{", "return", ";", "}", "for", "(", "final", "Iterator", "<", ...
Adds selected interfaces to the list.
[ "Adds", "selected", "interfaces", "to", "the", "list", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/elements/AbstractSuperTypeSelectionDialog.java#L190-L213
train
sarl/sarl
main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastScopeSession.java
CastScopeSession.createCastOperatorScope
protected IScope createCastOperatorScope(EObject context, EReference reference, IResolvedTypes resolvedTypes) { if (!(context instanceof SarlCastedExpression)) { return IScope.NULLSCOPE; } final SarlCastedExpression call = (SarlCastedExpression) context; final XExpression receiver = call.getTarget(); if (receiver == null) { return IScope.NULLSCOPE; } return getFeatureScopes().createFeatureCallScopeForReceiver(call, receiver, getParent(), resolvedTypes); }
java
protected IScope createCastOperatorScope(EObject context, EReference reference, IResolvedTypes resolvedTypes) { if (!(context instanceof SarlCastedExpression)) { return IScope.NULLSCOPE; } final SarlCastedExpression call = (SarlCastedExpression) context; final XExpression receiver = call.getTarget(); if (receiver == null) { return IScope.NULLSCOPE; } return getFeatureScopes().createFeatureCallScopeForReceiver(call, receiver, getParent(), resolvedTypes); }
[ "protected", "IScope", "createCastOperatorScope", "(", "EObject", "context", ",", "EReference", "reference", ",", "IResolvedTypes", "resolvedTypes", ")", "{", "if", "(", "!", "(", "context", "instanceof", "SarlCastedExpression", ")", ")", "{", "return", "IScope", ...
create a scope for cast operator. @param context the context. @param reference the reference to the internal feature. @param resolvedTypes the resolved types. @return the scope.
[ "create", "a", "scope", "for", "cast", "operator", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src/io/sarl/lang/typesystem/cast/CastScopeSession.java#L78-L88
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/BlockExpressionBuilderImpl.java
BlockExpressionBuilderImpl.eInit
public void eInit(IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.block == null) { this.block = XbaseFactory.eINSTANCE.createXBlockExpression(); } }
java
public void eInit(IJvmTypeProvider context) { setTypeResolutionContext(context); if (this.block == null) { this.block = XbaseFactory.eINSTANCE.createXBlockExpression(); } }
[ "public", "void", "eInit", "(", "IJvmTypeProvider", "context", ")", "{", "setTypeResolutionContext", "(", "context", ")", ";", "if", "(", "this", ".", "block", "==", "null", ")", "{", "this", ".", "block", "=", "XbaseFactory", ".", "eINSTANCE", ".", "creat...
Create the XBlockExpression.
[ "Create", "the", "XBlockExpression", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/BlockExpressionBuilderImpl.java#L66-L71
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/BlockExpressionBuilderImpl.java
BlockExpressionBuilderImpl.getAutoGeneratedActionString
@Pure public String getAutoGeneratedActionString(Resource resource) { TaskTags tags = getTaskTagProvider().getTaskTags(resource); String taskTag; if (tags != null && tags.getTaskTags() != null && !tags.getTaskTags().isEmpty()) { taskTag = tags.getTaskTags().get(0).getName(); } else { taskTag = "TODO"; } return taskTag + " Auto-generated code."; }
java
@Pure public String getAutoGeneratedActionString(Resource resource) { TaskTags tags = getTaskTagProvider().getTaskTags(resource); String taskTag; if (tags != null && tags.getTaskTags() != null && !tags.getTaskTags().isEmpty()) { taskTag = tags.getTaskTags().get(0).getName(); } else { taskTag = "TODO"; } return taskTag + " Auto-generated code."; }
[ "@", "Pure", "public", "String", "getAutoGeneratedActionString", "(", "Resource", "resource", ")", "{", "TaskTags", "tags", "=", "getTaskTagProvider", "(", ")", ".", "getTaskTags", "(", "resource", ")", ";", "String", "taskTag", ";", "if", "(", "tags", "!=", ...
Replies the string for "auto-generated" comments. @param resource the resource for which the comment must be determined. @return the comment text.
[ "Replies", "the", "string", "for", "auto", "-", "generated", "comments", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/BlockExpressionBuilderImpl.java#L85-L95
train
sarl/sarl
main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/BlockExpressionBuilderImpl.java
BlockExpressionBuilderImpl.addExpression
public IExpressionBuilder addExpression() { final IExpressionBuilder builder = this.expressionProvider.get(); builder.eInit(getXBlockExpression(), new Procedures.Procedure1<XExpression>() { private int index = -1; public void apply(XExpression it) { if (this.index >= 0) { getXBlockExpression().getExpressions().set(index, it); } else { getXBlockExpression().getExpressions().add(it); this.index = getXBlockExpression().getExpressions().size() - 1; } } }, getTypeResolutionContext()); return builder; }
java
public IExpressionBuilder addExpression() { final IExpressionBuilder builder = this.expressionProvider.get(); builder.eInit(getXBlockExpression(), new Procedures.Procedure1<XExpression>() { private int index = -1; public void apply(XExpression it) { if (this.index >= 0) { getXBlockExpression().getExpressions().set(index, it); } else { getXBlockExpression().getExpressions().add(it); this.index = getXBlockExpression().getExpressions().size() - 1; } } }, getTypeResolutionContext()); return builder; }
[ "public", "IExpressionBuilder", "addExpression", "(", ")", "{", "final", "IExpressionBuilder", "builder", "=", "this", ".", "expressionProvider", ".", "get", "(", ")", ";", "builder", ".", "eInit", "(", "getXBlockExpression", "(", ")", ",", "new", "Procedures", ...
Add an expression inside the block. @return the expression builder.
[ "Add", "an", "expression", "inside", "the", "block", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.lang/src-gen/io/sarl/lang/codebuilder/builders/BlockExpressionBuilderImpl.java#L139-L153
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.handleAntScriptBrowseButtonPressed
private void handleAntScriptBrowseButtonPressed() { FileDialog dialog= new FileDialog(getContainer().getShell(), SWT.SAVE); dialog.setFilterExtensions(new String[] { "*." + ANTSCRIPT_EXTENSION }); //$NON-NLS-1$ String currentSourceString= getAntScriptValue(); int lastSeparatorIndex= currentSourceString.lastIndexOf(File.separator); if (lastSeparatorIndex != -1) { dialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex)); dialog.setFileName(currentSourceString.substring(lastSeparatorIndex + 1, currentSourceString.length())); } String selectedFileName= dialog.open(); if (selectedFileName != null) fAntScriptNamesCombo.setText(selectedFileName); }
java
private void handleAntScriptBrowseButtonPressed() { FileDialog dialog= new FileDialog(getContainer().getShell(), SWT.SAVE); dialog.setFilterExtensions(new String[] { "*." + ANTSCRIPT_EXTENSION }); //$NON-NLS-1$ String currentSourceString= getAntScriptValue(); int lastSeparatorIndex= currentSourceString.lastIndexOf(File.separator); if (lastSeparatorIndex != -1) { dialog.setFilterPath(currentSourceString.substring(0, lastSeparatorIndex)); dialog.setFileName(currentSourceString.substring(lastSeparatorIndex + 1, currentSourceString.length())); } String selectedFileName= dialog.open(); if (selectedFileName != null) fAntScriptNamesCombo.setText(selectedFileName); }
[ "private", "void", "handleAntScriptBrowseButtonPressed", "(", ")", "{", "FileDialog", "dialog", "=", "new", "FileDialog", "(", "getContainer", "(", ")", ".", "getShell", "(", ")", ",", "SWT", ".", "SAVE", ")", ";", "dialog", ".", "setFilterExtensions", "(", ...
Open an appropriate ant script browser so that the user can specify a source to import from
[ "Open", "an", "appropriate", "ant", "script", "browser", "so", "that", "the", "user", "can", "specify", "a", "source", "to", "import", "from" ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L279-L292
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.getAntScriptValue
private String getAntScriptValue() { String antScriptText= fAntScriptNamesCombo.getText().trim(); if (antScriptText.indexOf('.') < 0) antScriptText+= "." + ANTSCRIPT_EXTENSION; //$NON-NLS-1$ return antScriptText; }
java
private String getAntScriptValue() { String antScriptText= fAntScriptNamesCombo.getText().trim(); if (antScriptText.indexOf('.') < 0) antScriptText+= "." + ANTSCRIPT_EXTENSION; //$NON-NLS-1$ return antScriptText; }
[ "private", "String", "getAntScriptValue", "(", ")", "{", "String", "antScriptText", "=", "fAntScriptNamesCombo", ".", "getText", "(", ")", ".", "trim", "(", ")", ";", "if", "(", "antScriptText", ".", "indexOf", "(", "'", "'", ")", "<", "0", ")", "antScri...
Answer the contents of the ant script specification widget. If this value does not have the required suffix then add it first. @return java.lang.String
[ "Answer", "the", "contents", "of", "the", "ant", "script", "specification", "widget", ".", "If", "this", "value", "does", "not", "have", "the", "required", "suffix", "then", "add", "it", "first", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L300-L305
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.createLabel
protected Label createLabel(Composite parent, String text, boolean bold) { Label label= new Label(parent, SWT.NONE); if (bold) label.setFont(JFaceResources.getBannerFont()); label.setText(text); GridData gridData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false); label.setLayoutData(gridData); return label; }
java
protected Label createLabel(Composite parent, String text, boolean bold) { Label label= new Label(parent, SWT.NONE); if (bold) label.setFont(JFaceResources.getBannerFont()); label.setText(text); GridData gridData= new GridData(SWT.BEGINNING, SWT.CENTER, false, false); label.setLayoutData(gridData); return label; }
[ "protected", "Label", "createLabel", "(", "Composite", "parent", ",", "String", "text", ",", "boolean", "bold", ")", "{", "Label", "label", "=", "new", "Label", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", "if", "(", "bold", ")", "label", ".", "...
Creates a new label with an optional bold font. @param parent the parent control @param text the label text @param bold bold or not @return the new label control
[ "Creates", "a", "new", "label", "with", "an", "optional", "bold", "font", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L315-L323
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.createLibraryHandlingGroup
protected void createLibraryHandlingGroup(Composite parent) { fLibraryHandlingGroup= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); fLibraryHandlingGroup.setLayout(layout); fLibraryHandlingGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); createLabel(fLibraryHandlingGroup, FatJarPackagerMessages.FatJarPackageWizardPage_libraryHandlingGroupTitle, false); fExtractJarsRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fExtractJarsRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_extractJars_text); fExtractJarsRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fExtractJarsRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new ExtractLibraryHandler(); } }); fPackageJarsRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fPackageJarsRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_packageJars_text); fPackageJarsRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fPackageJarsRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new PackageLibraryHandler(); } }); fCopyJarFilesRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fCopyJarFilesRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_copyJarFiles_text); fCopyJarFilesRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fCopyJarFilesRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new CopyLibraryHandler(); } }); // set default for first selection (no previous widget settings to restore) setLibraryHandler(new ExtractLibraryHandler()); }
java
protected void createLibraryHandlingGroup(Composite parent) { fLibraryHandlingGroup= new Composite(parent, SWT.NONE); GridLayout layout= new GridLayout(); fLibraryHandlingGroup.setLayout(layout); fLibraryHandlingGroup.setLayoutData(new GridData(GridData.HORIZONTAL_ALIGN_FILL | GridData.VERTICAL_ALIGN_FILL | GridData.GRAB_HORIZONTAL)); createLabel(fLibraryHandlingGroup, FatJarPackagerMessages.FatJarPackageWizardPage_libraryHandlingGroupTitle, false); fExtractJarsRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fExtractJarsRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_extractJars_text); fExtractJarsRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fExtractJarsRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new ExtractLibraryHandler(); } }); fPackageJarsRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fPackageJarsRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_packageJars_text); fPackageJarsRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fPackageJarsRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new PackageLibraryHandler(); } }); fCopyJarFilesRadioButton= new Button(fLibraryHandlingGroup, SWT.RADIO | SWT.LEFT); fCopyJarFilesRadioButton.setText(FatJarPackagerMessages.FatJarPackageWizardPage_copyJarFiles_text); fCopyJarFilesRadioButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); fCopyJarFilesRadioButton.addListener(SWT.Selection, new Listener() { @Override public void handleEvent(Event event) { if (((Button)event.widget).getSelection()) fLibraryHandler= new CopyLibraryHandler(); } }); // set default for first selection (no previous widget settings to restore) setLibraryHandler(new ExtractLibraryHandler()); }
[ "protected", "void", "createLibraryHandlingGroup", "(", "Composite", "parent", ")", "{", "fLibraryHandlingGroup", "=", "new", "Composite", "(", "parent", ",", "SWT", ".", "NONE", ")", ";", "GridLayout", "layout", "=", "new", "GridLayout", "(", ")", ";", "fLibr...
Create the export options specification widgets. @param parent org.eclipse.swt.widgets.Composite
[ "Create", "the", "export", "options", "specification", "widgets", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L330-L373
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.updateModel
@Override protected void updateModel() { super.updateModel(); String comboText= fAntScriptNamesCombo.getText(); IPath path= Path.fromOSString(comboText); if (path.segmentCount() > 0 && ensureAntScriptFileIsValid(path.toFile()) && path.getFileExtension() == null) path= path.addFileExtension(ANTSCRIPT_EXTENSION); fAntScriptLocation= getAbsoluteLocation(path); }
java
@Override protected void updateModel() { super.updateModel(); String comboText= fAntScriptNamesCombo.getText(); IPath path= Path.fromOSString(comboText); if (path.segmentCount() > 0 && ensureAntScriptFileIsValid(path.toFile()) && path.getFileExtension() == null) path= path.addFileExtension(ANTSCRIPT_EXTENSION); fAntScriptLocation= getAbsoluteLocation(path); }
[ "@", "Override", "protected", "void", "updateModel", "(", ")", "{", "super", ".", "updateModel", "(", ")", ";", "String", "comboText", "=", "fAntScriptNamesCombo", ".", "getText", "(", ")", ";", "IPath", "path", "=", "Path", ".", "fromOSString", "(", "comb...
Stores the widget values in the JAR package.
[ "Stores", "the", "widget", "values", "in", "the", "JAR", "package", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L397-L407
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.getAbsoluteLocation
private IPath getAbsoluteLocation(IPath location) { if (location.isAbsolute()) return location; IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); if (location.segmentCount() >= 2 && !"..".equals(location.segment(0))) { //$NON-NLS-1$ IFile file= root.getFile(location); IPath absolutePath= file.getLocation(); if (absolutePath != null) { return absolutePath; } } // The path does not exist in the workspace (e.g. because there's no such project). // Fallback is to just append the path to the workspace root. return root.getLocation().append(location); }
java
private IPath getAbsoluteLocation(IPath location) { if (location.isAbsolute()) return location; IWorkspaceRoot root= ResourcesPlugin.getWorkspace().getRoot(); if (location.segmentCount() >= 2 && !"..".equals(location.segment(0))) { //$NON-NLS-1$ IFile file= root.getFile(location); IPath absolutePath= file.getLocation(); if (absolutePath != null) { return absolutePath; } } // The path does not exist in the workspace (e.g. because there's no such project). // Fallback is to just append the path to the workspace root. return root.getLocation().append(location); }
[ "private", "IPath", "getAbsoluteLocation", "(", "IPath", "location", ")", "{", "if", "(", "location", ".", "isAbsolute", "(", ")", ")", "return", "location", ";", "IWorkspaceRoot", "root", "=", "ResourcesPlugin", ".", "getWorkspace", "(", ")", ".", "getRoot", ...
Gets the absolute location relative to the workspace. @param location the location @return the absolute path for the location of the file @since 3.8
[ "Gets", "the", "absolute", "location", "relative", "to", "the", "workspace", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L472-L488
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.ensureAntScriptFileIsValid
private boolean ensureAntScriptFileIsValid(File antScriptFile) { if (antScriptFile.exists() && antScriptFile.isDirectory() && fAntScriptNamesCombo.getText().length() > 0) { setErrorMessage(FatJarPackagerMessages.FatJarPackageWizardPage_error_antScriptLocationIsDir); fAntScriptNamesCombo.setFocus(); return false; } if (antScriptFile.exists()) { if (!antScriptFile.canWrite()) { setErrorMessage(FatJarPackagerMessages.FatJarPackageWizardPage_error_antScriptLocationUnwritable); fAntScriptNamesCombo.setFocus(); return false; } } return true; }
java
private boolean ensureAntScriptFileIsValid(File antScriptFile) { if (antScriptFile.exists() && antScriptFile.isDirectory() && fAntScriptNamesCombo.getText().length() > 0) { setErrorMessage(FatJarPackagerMessages.FatJarPackageWizardPage_error_antScriptLocationIsDir); fAntScriptNamesCombo.setFocus(); return false; } if (antScriptFile.exists()) { if (!antScriptFile.canWrite()) { setErrorMessage(FatJarPackagerMessages.FatJarPackageWizardPage_error_antScriptLocationUnwritable); fAntScriptNamesCombo.setFocus(); return false; } } return true; }
[ "private", "boolean", "ensureAntScriptFileIsValid", "(", "File", "antScriptFile", ")", "{", "if", "(", "antScriptFile", ".", "exists", "(", ")", "&&", "antScriptFile", ".", "isDirectory", "(", ")", "&&", "fAntScriptNamesCombo", ".", "getText", "(", ")", ".", "...
Returns a boolean indicating whether the passed File handle is is valid and available for use. @param antScriptFile the ant script @return boolean
[ "Returns", "a", "boolean", "indicating", "whether", "the", "passed", "File", "handle", "is", "is", "valid", "and", "available", "for", "use", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L497-L511
train
sarl/sarl
main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java
FixedFatJarExportPage.getPathLabel
protected static String getPathLabel(IPath path, boolean isOSPath) { String label; if (isOSPath) { label= path.toOSString(); } else { label= path.makeRelative().toString(); } return label; }
java
protected static String getPathLabel(IPath path, boolean isOSPath) { String label; if (isOSPath) { label= path.toOSString(); } else { label= path.makeRelative().toString(); } return label; }
[ "protected", "static", "String", "getPathLabel", "(", "IPath", "path", ",", "boolean", "isOSPath", ")", "{", "String", "label", ";", "if", "(", "isOSPath", ")", "{", "label", "=", "path", ".", "toOSString", "(", ")", ";", "}", "else", "{", "label", "="...
Returns the label of a path. @param path the path @param isOSPath if <code>true</code>, the path represents an OS path, if <code>false</code> it is a workspace path. @return the label of the path to be used in the UI.
[ "Returns", "the", "label", "of", "a", "path", "." ]
ca00ff994598c730339972def4e19a60e0b8cace
https://github.com/sarl/sarl/blob/ca00ff994598c730339972def4e19a60e0b8cace/main/coreplugins/io.sarl.eclipse/src/io/sarl/eclipse/wizards/sarlapp/FixedFatJarExportPage.java#L711-L719
train