idx int64 0 41.2k | question stringlengths 74 4.04k | target stringlengths 7 750 |
|---|---|---|
33,900 | protected void generatePlistFile ( CombinedTmAppendable it ) { final String language = getLanguageSimpleName ( ) . toLowerCase ( ) ; final String newBasename = getBasename ( MessageFormat . format ( BASENAME_PATTERN_NEW , language ) ) ; writeFile ( newBasename , it . getNewSyntaxContent ( ) ) ; } | Generate the Plist file . |
33,901 | protected void generateLicenseFile ( ) { final CharSequence licenseText = getLicenseText ( ) ; if ( licenseText != null ) { final String text = licenseText . toString ( ) ; if ( ! Strings . isEmpty ( text ) ) { writeFile ( LICENSE_FILE , text . getBytes ( ) ) ; } } } | Generate the LICENSE file . |
33,902 | protected CharSequence getLicenseText ( ) { final URL url = getClass ( ) . getResource ( LICENSE_FILE ) ; if ( url != null ) { final File filename = new File ( url . getPath ( ) ) ; try { return Files . toString ( filename , Charset . defaultCharset ( ) ) ; } catch ( IOException exception ) { throw new RuntimeException ( exception ) ; } } return null ; } | Replies the text of the license to write to the generated output . |
33,903 | protected List < ? > createPatterns ( 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 List < Map < String , ? > > patterns = new ArrayList < > ( ) ; patterns . addAll ( generateComments ( ) ) ; patterns . addAll ( generateStrings ( ) ) ; patterns . addAll ( generateNumericConstants ( ) ) ; patterns . addAll ( generateAnnotations ( ) ) ; patterns . addAll ( generateLiterals ( literals ) ) ; patterns . addAll ( generatePrimitiveTypes ( primitiveTypes ) ) ; patterns . addAll ( generateSpecialKeywords ( specialKeywords ) ) ; patterns . addAll ( generateModifiers ( modifiers ) ) ; patterns . addAll ( generateTypeDeclarations ( typeDeclarationKeywords ) ) ; patterns . addAll ( generateStandardKeywords ( expressionKeywords ) ) ; patterns . addAll ( generatePunctuation ( punctuation ) ) ; return patterns ; } | Create the patterns . |
33,904 | protected List < Map < String , ? > > generateAnnotations ( ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; list . add ( pattern ( it -> { it . matches ( "\\@[_a-zA-Z$][_0-9a-zA-Z$]*" ) ; it . style ( ANNOTATION_STYLE ) ; it . comment ( "Annotations" ) ; } ) ) ; return list ; } | Generate the rules for the annotations . |
33,905 | protected List < Map < String , ? > > generateComments ( ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; list . add ( pattern ( it -> { it . delimiters ( "(/\\*+)" , "(\\*/)" ) ; it . style ( BLOCK_COMMENT_STYLE ) ; it . beginStyle ( BLOCK_COMMENT_DELIMITER_STYLE ) ; it . endStyle ( BLOCK_COMMENT_DELIMITER_STYLE ) ; it . pattern ( it2 -> { it2 . matches ( "^\\s*(\\*)(?!/)" ) ; it2 . style ( BLOCK_COMMENT_DELIMITER_STYLE ) ; } ) ; it . comment ( "Multiline comments" ) ; } ) ) ; list . add ( pattern ( it -> { it . matches ( "\\s*(//)(.*)$" ) ; it . substyle ( 1 , LINE_COMMENT_DELIMITER_STYLE ) ; it . substyle ( 2 , LINE_COMMENT_STYLE ) ; it . comment ( "Single-line comment" ) ; } ) ) ; return list ; } | Generate the rules for the comments . |
33,906 | protected List < Map < String , ? > > generateStrings ( ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; list . add ( pattern ( it -> { it . delimiters ( "\"" , "\"" ) ; it . style ( DOUBLE_QUOTE_STRING_STYLE ) ; it . beginStyle ( STRING_BEGIN_STYLE ) ; it . endStyle ( STRING_END_STYLE ) ; it . pattern ( it2 -> { it2 . matches ( "\\\\." ) ; it2 . style ( ESCAPE_CHARACTER_STYLE ) ; } ) ; it . comment ( "Double quoted strings of characters" ) ; } ) ) ; list . add ( pattern ( it -> { it . delimiters ( "'" , "'" ) ; it . style ( SINGLE_QUOTE_STRING_STYLE ) ; it . beginStyle ( STRING_BEGIN_STYLE ) ; it . endStyle ( STRING_END_STYLE ) ; it . pattern ( it2 -> { it2 . matches ( "\\\\." ) ; it2 . style ( ESCAPE_CHARACTER_STYLE ) ; } ) ; it . comment ( "Single quoted strings of characters" ) ; } ) ) ; return list ; } | Generates the rules for the strings of characters . |
33,907 | protected List < Map < String , ? > > generateNumericConstants ( ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; list . add ( pattern ( it -> { it . matches ( "(?:" + "[0-9][0-9]*\\.[0-9]+([eE][0-9]+)?[fFdD]?" + ")|(?:" + "0[xX][0-9a-fA-F]+" + ")|(?:" + "[0-9]+[lL]?" + ")" ) ; it . style ( NUMBER_STYLE ) ; it . comment ( "Numbers" ) ; } ) ) ; return list ; } | Generate the rules for the numeric constants . |
33,908 | protected List < Map < String , ? > > generatePrimitiveTypes ( Set < String > primitiveTypes ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! primitiveTypes . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( keywordRegex ( primitiveTypes ) + "(?:\\s*\\[\\s*\\])*" ) ; it . style ( PRIMITIVE_TYPE_STYLE ) ; it . comment ( "Primitive types" ) ; } ) ) ; } return list ; } | Generate the rules for the primitive types . |
33,909 | protected List < Map < String , ? > > generateLiterals ( Set < String > literals ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! literals . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( keywordRegex ( literals ) ) ; it . style ( LITERAL_STYLE ) ; it . comment ( "SARL Literals and Constants" ) ; } ) ) ; } return list ; } | Generate the rules for the literals . |
33,910 | protected List < Map < String , ? > > generatePunctuation ( Set < String > punctuation ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! punctuation . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( orRegex ( punctuation ) ) ; it . style ( PUNCTUATION_STYLE ) ; it . comment ( "Operators and Punctuations" ) ; } ) ) ; } return list ; } | Generate the rules for the punctuation symbols . |
33,911 | protected List < Map < String , ? > > generateModifiers ( Set < String > modifiers ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! modifiers . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( keywordRegex ( modifiers ) ) ; it . style ( MODIFIER_STYLE ) ; it . comment ( "Modifiers" ) ; } ) ) ; } return list ; } | Generate the rules for the modifier keywords . |
33,912 | protected List < Map < String , ? > > generateSpecialKeywords ( Set < String > keywords ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! keywords . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( keywordRegex ( keywords ) ) ; it . style ( SPECIAL_KEYWORD_STYLE ) ; it . comment ( "Special Keywords" ) ; } ) ) ; } return list ; } | Generate the rules for the special keywords . |
33,913 | protected List < Map < String , ? > > generateStandardKeywords ( Set < String > keywords ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! keywords . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( keywordRegex ( keywords ) ) ; it . style ( KEYWORD_STYLE ) ; it . comment ( "Standard Keywords" ) ; } ) ) ; } return list ; } | Generate the rules for the standard keywords . |
33,914 | protected List < Map < String , ? > > generateTypeDeclarations ( Set < String > declarators ) { final List < Map < String , ? > > list = new ArrayList < > ( ) ; if ( ! declarators . isEmpty ( ) ) { list . add ( pattern ( it -> { it . matches ( keywordRegex ( declarators ) ) ; it . style ( TYPE_DECLARATION_STYLE ) ; it . comment ( "Type Declarations" ) ; } ) ) ; } return list ; } | Generate the rules for the type declaration keywords . |
33,915 | protected Map < String , ? > pattern ( Procedure1 < ? super Pattern > proc ) { final Pattern patternDefinition = new Pattern ( ) ; proc . apply ( patternDefinition ) ; return patternDefinition . getDefinition ( ) ; } | Build a pattern definition . |
33,916 | @ SuppressWarnings ( "static-method" ) public ExtraLanguageListCommand provideExtraLanguageListCommand ( BootLogger bootLogger , Provider < IExtraLanguageContributions > contributions ) { return new ExtraLanguageListCommand ( bootLogger , contributions ) ; } | Provide the command for displaying the available extra - language generators . |
33,917 | protected void _format ( SarlEvent event , IFormattableDocument document ) { formatAnnotations ( event , document , XbaseFormatterPreferenceKeys . newLineAfterClassAnnotations ) ; formatModifiers ( event , document ) ; final ISemanticRegionsFinder regionFor = this . textRegionExtensions . regionFor ( event ) ; document . append ( regionFor . keyword ( this . keywords . getEventKeyword ( ) ) , ONE_SPACE ) ; document . surround ( regionFor . keyword ( this . keywords . getExtendsKeyword ( ) ) , ONE_SPACE ) ; document . format ( event . getExtends ( ) ) ; formatBody ( event , document ) ; } | Format the given SARL event . |
33,918 | protected void _format ( SarlCapacity capacity , IFormattableDocument document ) { formatAnnotations ( capacity , document , XbaseFormatterPreferenceKeys . newLineAfterClassAnnotations ) ; formatModifiers ( capacity , document ) ; final ISemanticRegionsFinder regionFor = this . textRegionExtensions . regionFor ( capacity ) ; document . append ( regionFor . keyword ( this . keywords . getCapacityKeyword ( ) ) , ONE_SPACE ) ; document . surround ( regionFor . keyword ( this . keywords . getExtendsKeyword ( ) ) , ONE_SPACE ) ; formatCommaSeparatedList ( capacity . getExtends ( ) , document ) ; formatBody ( capacity , document ) ; } | Format the given SARL capacity . |
33,919 | protected void _format ( SarlAgent agent , IFormattableDocument document ) { formatAnnotations ( agent , document , XbaseFormatterPreferenceKeys . newLineAfterClassAnnotations ) ; formatModifiers ( agent , document ) ; final ISemanticRegionsFinder regionFor = this . textRegionExtensions . regionFor ( agent ) ; document . append ( regionFor . keyword ( this . keywords . getAgentKeyword ( ) ) , ONE_SPACE ) ; document . surround ( regionFor . keyword ( this . keywords . getExtendsKeyword ( ) ) , ONE_SPACE ) ; document . format ( agent . getExtends ( ) ) ; formatBody ( agent , document ) ; } | Format the given SARL agent . |
33,920 | protected void _format ( SarlBehavior behavior , IFormattableDocument document ) { formatAnnotations ( behavior , document , XbaseFormatterPreferenceKeys . newLineAfterClassAnnotations ) ; formatModifiers ( behavior , document ) ; final ISemanticRegionsFinder regionFor = this . textRegionExtensions . regionFor ( behavior ) ; document . append ( regionFor . keyword ( this . keywords . getBehaviorKeyword ( ) ) , ONE_SPACE ) ; document . surround ( regionFor . keyword ( this . keywords . getExtendsKeyword ( ) ) , ONE_SPACE ) ; document . format ( behavior . getExtends ( ) ) ; formatBody ( behavior , document ) ; } | Format the given SARL behavior . |
33,921 | protected void _format ( SarlSkill skill , IFormattableDocument document ) { formatAnnotations ( skill , document , XbaseFormatterPreferenceKeys . newLineAfterClassAnnotations ) ; formatModifiers ( skill , document ) ; final ISemanticRegionsFinder regionFor = this . textRegionExtensions . regionFor ( skill ) ; document . append ( regionFor . keyword ( this . keywords . getSkillKeyword ( ) ) , ONE_SPACE ) ; document . surround ( regionFor . keyword ( this . keywords . getExtendsKeyword ( ) ) , ONE_SPACE ) ; document . format ( skill . getExtends ( ) ) ; document . surround ( regionFor . keyword ( this . keywords . getImplementsKeyword ( ) ) , ONE_SPACE ) ; formatCommaSeparatedList ( skill . getImplements ( ) , document ) ; formatBody ( skill , document ) ; } | Format the given SARL skill . |
33,922 | protected void _format ( SarlBehaviorUnit behaviorUnit , IFormattableDocument document ) { formatAnnotations ( behaviorUnit , document , XbaseFormatterPreferenceKeys . newLineAfterMethodAnnotations ) ; final ISemanticRegionsFinder regionFor = this . textRegionExtensions . regionFor ( behaviorUnit ) ; document . append ( regionFor . keyword ( this . keywords . getOnKeyword ( ) ) , ONE_SPACE ) ; if ( behaviorUnit . getGuard ( ) != null ) { ISemanticRegion keyword = this . textRegionExtensions . immediatelyPreceding ( behaviorUnit . getGuard ( ) ) . keyword ( this . keywords . getLeftSquareBracketKeyword ( ) ) ; document . prepend ( keyword , ONE_SPACE ) ; document . append ( keyword , NO_SPACE ) ; keyword = this . textRegionExtensions . immediatelyFollowing ( behaviorUnit . getGuard ( ) ) . keyword ( this . keywords . getRightSquareBracketKeyword ( ) ) ; document . prepend ( keyword , NO_SPACE ) ; } document . format ( behaviorUnit . getName ( ) ) ; document . format ( behaviorUnit . getGuard ( ) ) ; final XExpression expression = behaviorUnit . getExpression ( ) ; if ( expression != null ) { final ISemanticRegionFinder finder = this . textRegionExtensions . regionFor ( expression ) ; final ISemanticRegion brace = finder . keyword ( this . keywords . getLeftCurlyBracketKeyword ( ) ) ; document . prepend ( brace , XbaseFormatterPreferenceKeys . bracesInNewLine ) ; document . format ( expression ) ; } } | Format a behavior unit . |
33,923 | protected void _format ( SarlCapacityUses capacityUses , IFormattableDocument document ) { final ISemanticRegionsFinder regionFor = this . textRegionExtensions . regionFor ( capacityUses ) ; document . append ( regionFor . keyword ( this . keywords . getUsesKeyword ( ) ) , ONE_SPACE ) ; formatCommaSeparatedList ( capacityUses . getCapacities ( ) , document ) ; document . prepend ( regionFor . keyword ( this . keywords . getSemicolonKeyword ( ) ) , NO_SPACE ) ; } | Format a capacity use . |
33,924 | protected void _format ( SarlRequiredCapacity requiredCapacity , IFormattableDocument document ) { final ISemanticRegionsFinder regionFor = this . textRegionExtensions . regionFor ( requiredCapacity ) ; document . append ( regionFor . keyword ( this . keywords . getRequiresKeyword ( ) ) , ONE_SPACE ) ; formatCommaSeparatedList ( requiredCapacity . getCapacities ( ) , document ) ; document . prepend ( regionFor . keyword ( this . keywords . getSemicolonKeyword ( ) ) , NO_SPACE ) ; } | Format a required capacity . |
33,925 | protected void formatCommaSeparatedList ( Collection < ? extends EObject > elements , IFormattableDocument document ) { for ( final EObject element : elements ) { document . format ( element ) ; final ISemanticRegionFinder immediatelyFollowing = this . textRegionExtensions . immediatelyFollowing ( element ) ; final ISemanticRegion keyword = immediatelyFollowing . keyword ( this . keywords . getCommaKeyword ( ) ) ; document . prepend ( keyword , NO_SPACE ) ; document . append ( keyword , ONE_SPACE ) ; } } | Format a list of comma separated elements . |
33,926 | public StyledString styledParameters ( JvmIdentifiableElement element ) { final StyledString str = new StyledString ( ) ; if ( element instanceof JvmExecutable ) { final JvmExecutable executable = ( JvmExecutable ) element ; str . append ( this . keywords . getLeftParenthesisKeyword ( ) ) ; str . append ( parametersToStyledString ( executable . getParameters ( ) , executable . isVarArgs ( ) , false ) ) ; str . append ( this . keywords . getRightParenthesisKeyword ( ) ) ; } return str ; } | Replies the styled parameters . |
33,927 | protected StyledString parametersToStyledString ( Iterable < ? extends JvmFormalParameter > elements , boolean isVarArgs , boolean includeName ) { return getParameterStyledString ( elements , isVarArgs , includeName , this . keywords , this . annotationFinder , this ) ; } | Replies the styled string representation of the parameters . |
33,928 | public static String getParameterString ( Iterable < ? extends JvmFormalParameter > elements , boolean isVarArgs , boolean includeName , SARLGrammarKeywordAccess keywords , AnnotationLookup annotationFinder , UIStrings utils ) { final StringBuilder result = new StringBuilder ( ) ; boolean needsSeparator = false ; final Iterator < ? extends JvmFormalParameter > iterator = elements . iterator ( ) ; while ( iterator . hasNext ( ) ) { final JvmFormalParameter parameter = iterator . next ( ) ; if ( needsSeparator ) { result . append ( keywords . getCommaKeyword ( ) ) . append ( " " ) ; } needsSeparator = true ; final boolean isDefaultValued = annotationFinder . findAnnotation ( parameter , DefaultValue . class ) != null ; if ( isDefaultValued ) { result . append ( keywords . getLeftSquareBracketKeyword ( ) ) ; } if ( includeName ) { result . append ( parameter . getName ( ) ) . append ( " " ) ; result . append ( keywords . getColonKeyword ( ) ) . append ( " " ) ; } JvmTypeReference typeRef = parameter . getParameterType ( ) ; if ( isVarArgs && ! iterator . hasNext ( ) && typeRef instanceof JvmGenericArrayTypeReference ) { typeRef = ( ( JvmGenericArrayTypeReference ) typeRef ) . getComponentType ( ) ; result . append ( utils . referenceToString ( typeRef , NULL_TYPE ) ) ; result . append ( keywords . getWildcardAsteriskKeyword ( ) ) ; } else { result . append ( utils . referenceToString ( typeRef , NULL_TYPE ) ) ; } if ( isDefaultValued ) { result . append ( keywords . getRightSquareBracketKeyword ( ) ) ; } } return result . toString ( ) ; } | Format the parameters . |
33,929 | public void setFileExtensions ( @ Named ( Constants . FILE_EXTENSIONS ) String fileExtensions ) { this . fileExtensions . clear ( ) ; this . fileExtensions . addAll ( Arrays . asList ( fileExtensions . split ( "[,;: ]+" ) ) ) ; } | Set the file extensions . |
33,930 | @ SuppressWarnings ( "checkstyle:all" ) private ImageDescriptor getPackageFragmentIcon ( IPackageFragment fragment ) { boolean containsJavaElements = false ; try { containsJavaElements = fragment . hasChildren ( ) ; } catch ( JavaModelException e ) { } try { if ( ! containsJavaElements ) { final Object [ ] resources = fragment . getNonJavaResources ( ) ; if ( resources . length > 0 ) { for ( final Object child : resources ) { if ( isSarlResource ( child ) ) { return JavaPluginImages . DESC_OBJS_PACKAGE ; } } return JavaPluginImages . DESC_OBJS_EMPTY_PACKAGE_RESOURCES ; } } } catch ( JavaModelException exception ) { } if ( ! containsJavaElements ) { return JavaPluginImages . DESC_OBJS_EMPTY_PACKAGE ; } return JavaPluginImages . DESC_OBJS_PACKAGE ; } | Replies the image description of the package fragment . |
33,931 | protected boolean isSarlResource ( Object resource ) { if ( resource instanceof IFile ) { final IFile file = ( IFile ) resource ; return getFileExtensions ( ) . contains ( file . getFileExtension ( ) ) ; } return false ; } | Replies if the given resource is a SARL resource . |
33,932 | public void setJarFile ( IPath jarFile ) { if ( ! Objects . equal ( jarFile , this . jarFile ) ) { final PropertyChangeEvent event = new PropertyChangeEvent ( this , ISREInstallChangedListener . PROPERTY_JAR_FILE , this . jarFile , jarFile ) ; this . jarFile = jarFile ; setDirty ( true ) ; if ( getNotify ( ) ) { SARLRuntime . fireSREChanged ( event ) ; } } } | Change the path to the JAR file that is supporting this SRE installation . |
33,933 | private static IPath parsePath ( String path , IPath defaultPath , IPath rootPath ) { if ( ! Strings . isNullOrEmpty ( path ) ) { try { final IPath pathObject = Path . fromPortableString ( path ) ; if ( pathObject != null ) { if ( rootPath != null && ! pathObject . isAbsolute ( ) ) { return rootPath . append ( pathObject ) ; } return pathObject ; } } catch ( Throwable exception ) { } } return defaultPath ; } | Path the given string for extracting a path . |
33,934 | public static List < Pair < String , String > > loadPropertyFile ( String filename , Plugin bundledPlugin , Class < ? > readerClass , Function1 < IOException , IStatus > statusBuilder ) { final URL url ; if ( bundledPlugin != null ) { url = FileLocator . find ( bundledPlugin . getBundle ( ) , Path . fromPortableString ( filename ) , null ) ; } else { url = readerClass . getClassLoader ( ) . getResource ( filename ) ; } if ( url == null ) { return Lists . newArrayList ( ) ; } final OrderedProperties properties = new OrderedProperties ( ) ; try ( InputStream is = url . openStream ( ) ) { properties . load ( is ) ; } catch ( IOException exception ) { if ( bundledPlugin != null ) { bundledPlugin . getLog ( ) . log ( statusBuilder . apply ( exception ) ) ; } else { throw new RuntimeException ( exception ) ; } } return properties . getOrderedProperties ( ) ; } | Load a property file from the resources . This function is able to get the resource from an OSGi bundles if it is specified or from the application classpath . |
33,935 | protected XExpression getAssociatedExpression ( JvmMember object ) { final XExpression expr = getTypeBuilder ( ) . getExpression ( object ) ; if ( expr == null ) { final Procedure1 < ? super ITreeAppendable > strategy = getTypeExtensions ( ) . getCompilationStrategy ( object ) ; if ( strategy != null ) { } else { final StringConcatenationClient template = getTypeExtensions ( ) . getCompilationTemplate ( object ) ; if ( template != null ) { } } } return expr ; } | Replies the expression associated to the given object . Usually the expression is inside the given object . |
33,936 | protected String toFilename ( QualifiedName name , String separator ) { final List < String > segments = name . getSegments ( ) ; if ( segments . isEmpty ( ) ) { return "" ; } final StringBuilder builder = new StringBuilder ( ) ; builder . append ( name . toString ( separator ) ) ; builder . append ( getFilenameExtension ( ) ) ; return builder . toString ( ) ; } | Replies the filename for the qualified name . |
33,937 | protected boolean writeFile ( QualifiedName name , ExtraLanguageAppendable appendable , IExtraLanguageGeneratorContext context ) { final ExtraLanguageAppendable fileAppendable = createAppendable ( null , context ) ; generateFileHeader ( name , fileAppendable , context ) ; final ImportManager importManager = appendable . getImportManager ( ) ; if ( importManager != null && ! importManager . getImports ( ) . isEmpty ( ) ) { for ( final String imported : importManager . getImports ( ) ) { final QualifiedName qn = getQualifiedNameConverter ( ) . toQualifiedName ( imported ) ; generateImportStatement ( qn , fileAppendable , context ) ; } fileAppendable . newLine ( ) ; } fileAppendable . append ( appendable . getContent ( ) ) ; final String content = fileAppendable . getContent ( ) ; if ( ! Strings . isEmpty ( content ) ) { final String fileName = toFilename ( name , FILENAME_SEPARATOR ) ; final String outputConfiguration = getOutputConfigurationName ( ) ; if ( Strings . isEmpty ( outputConfiguration ) ) { context . getFileSystemAccess ( ) . generateFile ( fileName , content ) ; } else { context . getFileSystemAccess ( ) . generateFile ( fileName , outputConfiguration , content ) ; } return true ; } return false ; } | Write the given file . |
33,938 | protected IExtraLanguageGeneratorContext createGeneratorContext ( IFileSystemAccess2 fsa , IGeneratorContext context , Resource resource ) { if ( context instanceof IExtraLanguageGeneratorContext ) { return ( IExtraLanguageGeneratorContext ) context ; } return new ExtraLanguageGeneratorContext ( context , fsa , this , resource , getPreferenceID ( ) ) ; } | Create the generator context for this generator . |
33,939 | protected void _generate ( SarlScript script , IExtraLanguageGeneratorContext context ) { if ( script != null ) { for ( final XtendTypeDeclaration content : script . getXtendTypes ( ) ) { if ( context . getCancelIndicator ( ) . isCanceled ( ) ) { return ; } try { generate ( content , context ) ; } finally { context . clearData ( ) ; } } } } | Generate the given script . |
33,940 | protected static List < JvmTypeReference > getSuperTypes ( JvmTypeReference extension , List < ? extends JvmTypeReference > implemented ) { final List < JvmTypeReference > list = new ArrayList < > ( ) ; if ( extension != null ) { list . add ( extension ) ; } if ( implemented != null ) { list . addAll ( implemented ) ; } return list ; } | Replies the merged list with the extended and implemented types . |
33,941 | protected LightweightTypeReference getExpectedType ( XExpression expr ) { final IResolvedTypes resolvedTypes = getTypeResolver ( ) . resolveTypes ( expr ) ; final LightweightTypeReference actualType = resolvedTypes . getActualType ( expr ) ; return actualType ; } | Compute the expected type of the given expression . |
33,942 | protected LightweightTypeReference getExpectedType ( XtendExecutable executable , JvmTypeReference declaredReturnType ) { if ( declaredReturnType == null ) { if ( executable instanceof XtendFunction ) { final XtendFunction function = ( XtendFunction ) executable ; final JvmOperation operation = this . sarlAssociations . getDirectlyInferredOperation ( function ) ; if ( operation != null ) { return Utils . toLightweightTypeReference ( operation . getReturnType ( ) , this . services ) ; } } if ( ! getEarlyExitComputer ( ) . isEarlyExit ( executable . getExpression ( ) ) ) { return getExpectedType ( executable . getExpression ( ) ) ; } return null ; } if ( ! "void" . equals ( declaredReturnType . getIdentifier ( ) ) ) { return Utils . toLightweightTypeReference ( declaredReturnType , this . services ) ; } return null ; } | Replies the expected type of the given executable . |
33,943 | private Object readResolve ( ) throws ObjectStreamException { Constructor < ? > compatible = null ; for ( final Constructor < ? > candidate : this . proxyType . getDeclaredConstructors ( ) ) { if ( candidate != null && isCompatible ( candidate ) ) { if ( compatible != null ) { throw new IllegalStateException ( ) ; } compatible = candidate ; } } if ( compatible != null ) { if ( ! compatible . isAccessible ( ) ) { compatible . setAccessible ( true ) ; } try { final Object [ ] arguments = new Object [ this . values . length + 1 ] ; System . arraycopy ( this . values , 0 , arguments , 1 , this . values . length ) ; return compatible . newInstance ( arguments ) ; } catch ( Exception exception ) { throw new WriteAbortedException ( exception . getLocalizedMessage ( ) , exception ) ; } } throw new InvalidClassException ( "compatible constructor not found" ) ; } | This function enables to deserialize an instance of this proxy . |
33,944 | @ SuppressWarnings ( "static-method" ) protected void addPreferences ( IMavenProjectFacade facade , SARLConfiguration config , IProgressMonitor monitor ) throws CoreException { final IPath outputPath = makeProjectRelativePath ( facade , config . getOutput ( ) ) ; SARLPreferences . setSpecificSARLConfigurationFor ( facade . getProject ( ) , outputPath ) ; } | Invoked to add the preferences dedicated to SARL JRE etc . |
33,945 | @ SuppressWarnings ( { "checkstyle:magicnumber" , "checkstyle:npathcomplexity" } ) protected void addSourceFolders ( IMavenProjectFacade facade , SARLConfiguration config , IClasspathDescriptor classpath , IProgressMonitor monitor ) throws CoreException { assertHasNature ( facade . getProject ( ) , SARLEclipseConfig . NATURE_ID ) ; assertHasNature ( facade . getProject ( ) , SARLEclipseConfig . XTEXT_NATURE_ID ) ; assertHasNature ( facade . getProject ( ) , JavaCore . NATURE_ID ) ; final String encoding = config . getEncoding ( ) ; final SubMonitor subMonitor = SubMonitor . convert ( monitor , 4 ) ; final IPath inputPath = makeFullPath ( facade , config . getInput ( ) ) ; final IFolder inputFolder = ensureFolderExists ( facade , inputPath , false , subMonitor ) ; if ( encoding != null && inputFolder != null && inputFolder . exists ( ) ) { inputFolder . setDefaultCharset ( encoding , monitor ) ; } IClasspathEntryDescriptor descriptor = classpath . addSourceEntry ( inputPath , facade . getOutputLocation ( ) , false ) ; descriptor . setPomDerived ( true ) ; subMonitor . worked ( 1 ) ; final IPath outputPath = makeFullPath ( facade , config . getOutput ( ) ) ; final IFolder outputFolder = ensureFolderExists ( facade , outputPath , true , subMonitor ) ; if ( encoding != null && outputFolder != null && outputFolder . exists ( ) ) { outputFolder . setDefaultCharset ( encoding , monitor ) ; } descriptor = classpath . addSourceEntry ( outputPath , facade . getOutputLocation ( ) , false ) ; descriptor . setPomDerived ( true ) ; descriptor . setClasspathAttribute ( IClasspathAttribute . IGNORE_OPTIONAL_PROBLEMS , Boolean . TRUE . toString ( ) ) ; subMonitor . worked ( 1 ) ; final IPath testInputPath = makeFullPath ( facade , config . getTestInput ( ) ) ; final IFolder testInputFolder = ensureFolderExists ( facade , testInputPath , false , subMonitor ) ; if ( encoding != null && testInputFolder != null && testInputFolder . exists ( ) ) { testInputFolder . setDefaultCharset ( encoding , monitor ) ; } descriptor = classpath . addSourceEntry ( testInputPath , facade . getTestOutputLocation ( ) , true ) ; descriptor . setPomDerived ( true ) ; descriptor . setClasspathAttribute ( IClasspathAttribute . TEST , Boolean . TRUE . toString ( ) ) ; subMonitor . worked ( 1 ) ; final IPath testOutputPath = makeFullPath ( facade , config . getTestOutput ( ) ) ; final IFolder testOutputFolder = ensureFolderExists ( facade , testOutputPath , true , subMonitor ) ; if ( encoding != null && testOutputFolder != null && testOutputFolder . exists ( ) ) { testOutputFolder . setDefaultCharset ( encoding , monitor ) ; } descriptor = classpath . addSourceEntry ( testOutputPath , facade . getTestOutputLocation ( ) , true ) ; descriptor . setPomDerived ( true ) ; descriptor . setClasspathAttribute ( IClasspathAttribute . IGNORE_OPTIONAL_PROBLEMS , Boolean . TRUE . toString ( ) ) ; descriptor . setClasspathAttribute ( IClasspathAttribute . TEST , Boolean . TRUE . toString ( ) ) ; subMonitor . done ( ) ; } | Invoked to add the source folders . |
33,946 | protected < T > T getParameterValue ( MavenProject project , String parameter , Class < T > asType , MojoExecution mojoExecution , IProgressMonitor monitor , T defaultValue ) throws CoreException { T value = getParameterValue ( project , parameter , asType , mojoExecution , monitor ) ; if ( value == null ) { value = defaultValue ; } return value ; } | Replies the configuration value . |
33,947 | protected SARLConfiguration readConfiguration ( ProjectConfigurationRequest request , IProgressMonitor monitor ) throws CoreException { SARLConfiguration initConfig = null ; SARLConfiguration compileConfig = null ; final List < MojoExecution > mojos = getMojoExecutions ( request , monitor ) ; for ( final MojoExecution mojo : mojos ) { final String goal = mojo . getGoal ( ) ; switch ( goal ) { case "initialize" : initConfig = readInitializeConfiguration ( request , mojo , monitor ) ; break ; case "compile" : compileConfig = readCompileConfiguration ( request , mojo , monitor ) ; break ; default : } } if ( compileConfig != null && initConfig != null ) { compileConfig . setFrom ( initConfig ) ; } return compileConfig ; } | Read the SARL configuration . |
33,948 | private SARLConfiguration readInitializeConfiguration ( ProjectConfigurationRequest request , MojoExecution mojo , IProgressMonitor monitor ) throws CoreException { final SARLConfiguration config = new SARLConfiguration ( ) ; final MavenProject project = request . getMavenProject ( ) ; final File input = getParameterValue ( project , "input" , File . class , mojo , monitor , new File ( SARLConfig . FOLDER_SOURCE_SARL ) ) ; final File output = getParameterValue ( project , "output" , File . class , mojo , monitor , new File ( SARLConfig . FOLDER_SOURCE_GENERATED ) ) ; final File binOutput = getParameterValue ( project , "binOutput" , File . class , mojo , monitor , new File ( SARLConfig . FOLDER_BIN ) ) ; final File testInput = getParameterValue ( project , "testInput" , File . class , mojo , monitor , new File ( SARLConfig . FOLDER_TEST_SOURCE_SARL ) ) ; final File testOutput = getParameterValue ( project , "testOutput" , File . class , mojo , monitor , new File ( SARLConfig . FOLDER_TEST_SOURCE_GENERATED ) ) ; final File testBinOutput = getParameterValue ( project , "testBinOutput" , File . class , mojo , monitor , new File ( SARLConfig . FOLDER_TEST_BIN ) ) ; config . setInput ( input ) ; config . setOutput ( output ) ; config . setBinOutput ( binOutput ) ; config . setTestInput ( testInput ) ; config . setTestOutput ( testOutput ) ; config . setTestBinOutput ( testBinOutput ) ; return config ; } | Read the configuration for the Initialize mojo . |
33,949 | private SARLConfiguration readCompileConfiguration ( ProjectConfigurationRequest request , MojoExecution mojo , IProgressMonitor monitor ) throws CoreException { final SARLConfiguration config = new SARLConfiguration ( ) ; final MavenProject project = request . getMavenProject ( ) ; final File input = getParameterValue ( project , "input" , File . class , mojo , monitor ) ; final File output = getParameterValue ( project , "output" , File . class , mojo , monitor ) ; final File binOutput = getParameterValue ( project , "binOutput" , File . class , mojo , monitor ) ; final File testInput = getParameterValue ( project , "testInput" , File . class , mojo , monitor ) ; final File testOutput = getParameterValue ( project , "testOutput" , File . class , mojo , monitor ) ; final File testBinOutput = getParameterValue ( project , "testBinOutput" , File . class , mojo , monitor ) ; config . setInput ( input ) ; config . setOutput ( output ) ; config . setBinOutput ( binOutput ) ; config . setTestInput ( testInput ) ; config . setTestOutput ( testOutput ) ; config . setTestBinOutput ( testBinOutput ) ; final String inputCompliance = getParameterValue ( project , "source" , String . class , mojo , monitor ) ; final String outputCompliance = getParameterValue ( project , "target" , String . class , mojo , monitor ) ; config . setInputCompliance ( inputCompliance ) ; config . setOutputCompliance ( outputCompliance ) ; final String encoding = getParameterValue ( project , "encoding" , String . class , mojo , monitor ) ; config . setEncoding ( encoding ) ; return config ; } | Read the configuration for the Compilation mojo . |
33,950 | @ SuppressWarnings ( "static-method" ) protected void addSarlLibraries ( IClasspathDescriptor classpath ) { final IClasspathEntry entry = JavaCore . newContainerEntry ( SARLClasspathContainerInitializer . CONTAINER_ID ) ; classpath . addEntry ( entry ) ; } | Add the SARL libraries into the given classpath . |
33,951 | public boolean hasConversion ( String type ) { if ( ( isImplicitSarlTypes ( ) && type . startsWith ( IMPLICIT_PACKAGE ) ) || isImplicitJvmTypes ( ) ) { return true ; } if ( this . mapping == null ) { this . mapping = initMapping ( ) ; } return this . mapping . containsKey ( type ) ; } | Indicates if the given name has a mapping to the extra language . |
33,952 | public String convert ( String type ) { if ( isImplicitSarlTypes ( ) && type . startsWith ( IMPLICIT_PACKAGE ) ) { return type ; } if ( this . mapping == null ) { this . mapping = initMapping ( ) ; } final String map = this . mapping . get ( type ) ; if ( map != null ) { if ( map . isEmpty ( ) && ! isImplicitJvmTypes ( ) ) { return null ; } return map ; } if ( isImplicitJvmTypes ( ) ) { return type ; } return null ; } | Convert the given type to its equivalent in the extra language . |
33,953 | public boolean isSarlAgent ( LightweightTypeReference type ) { return ! type . isInterfaceType ( ) && ( getSarlElementEcoreType ( type ) == SarlPackage . SARL_AGENT || type . isSubtypeOf ( Agent . class ) ) ; } | Replies if the given JVM element is a SARL agent . |
33,954 | public boolean isSarlBehavior ( LightweightTypeReference type ) { return ! type . isInterfaceType ( ) && ( getSarlElementEcoreType ( type ) == SarlPackage . SARL_BEHAVIOR || type . isSubtypeOf ( Behavior . class ) ) ; } | Replies if the given JVM element is a SARL behavior . |
33,955 | public boolean isSarlCapacity ( LightweightTypeReference type ) { return type . isInterfaceType ( ) && ( getSarlElementEcoreType ( type ) == SarlPackage . SARL_CAPACITY || type . isSubtypeOf ( Capacity . class ) ) ; } | Replies if the given JVM element is a SARL capacity . |
33,956 | public boolean isSarlEvent ( LightweightTypeReference type ) { return ! type . isInterfaceType ( ) && ( getSarlElementEcoreType ( type ) == SarlPackage . SARL_EVENT || type . isSubtypeOf ( Event . class ) ) ; } | Replies if the given JVM element is a SARL event . |
33,957 | public boolean isSarlSkill ( LightweightTypeReference type ) { return ! type . isInterfaceType ( ) && ( getSarlElementEcoreType ( type ) == SarlPackage . SARL_SKILL || type . isSubtypeOf ( Skill . class ) ) ; } | Replies if the given JVM element is a SARL skill . |
33,958 | public ADDRESST unregisterParticipant ( ADDRESST address , EventListener entity ) { synchronized ( mutex ( ) ) { removeListener ( address ) ; this . participants . remove ( entity . getID ( ) , address ) ; } return address ; } | Remove a participant from this repository . |
33,959 | public SynchronizedCollection < ADDRESST > getAddresses ( UUID participant ) { final Object mutex = mutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedCollection ( this . participants . get ( participant ) , mutex ) ; } } | Replies all the addresses of the participant with the given identifier . |
33,960 | public boolean markAssignmentAccess ( EObject object ) { assert object != null ; if ( ! isAssigned ( object ) ) { return object . eAdapters ( ) . add ( ASSIGNMENT_MARKER ) ; } return false ; } | Mark the given object as an assigned object after its initialization . |
33,961 | @ SuppressWarnings ( "static-method" ) public boolean isAssigned ( final EObject object ) { assert object != null ; return object . eAdapters ( ) . contains ( ASSIGNMENT_MARKER ) ; } | Replies if the given object was marked as assigned within the current compilation unit . |
33,962 | protected ISourceAppender appendFiresClause ( ISourceAppender appendable ) { final List < LightweightTypeReference > types = getFires ( ) ; final Iterator < LightweightTypeReference > iterator = types . iterator ( ) ; if ( iterator . hasNext ( ) ) { appendable . append ( " " ) . append ( this . keywords . getFiresKeyword ( ) ) . append ( " " ) ; do { final LightweightTypeReference type = iterator . next ( ) ; appendable . append ( type ) ; if ( iterator . hasNext ( ) ) { appendable . append ( this . keywords . getCommaKeyword ( ) ) . append ( " " ) ; } } while ( iterator . hasNext ( ) ) ; } return appendable ; } | Append the fires clause . |
33,963 | public static IPreferenceStore getSARLPreferencesFor ( IProject project ) { if ( project != null ) { final Injector injector = LangActivator . getInstance ( ) . getInjector ( LangActivator . IO_SARL_LANG_SARL ) ; final IPreferenceStoreAccess preferenceStoreAccess = injector . getInstance ( IPreferenceStoreAccess . class ) ; return preferenceStoreAccess . getWritablePreferenceStore ( project ) ; } return null ; } | Replies the preference store for the given project . |
33,964 | public static Set < OutputConfiguration > getXtextConfigurationsFor ( IProject project ) { final Injector injector = LangActivator . getInstance ( ) . getInjector ( LangActivator . IO_SARL_LANG_SARL ) ; final EclipseOutputConfigurationProvider configurationProvider = injector . getInstance ( EclipseOutputConfigurationProvider . class ) ; return configurationProvider . getOutputConfigurations ( project ) ; } | Replies the Xtext output configurations related to the given project . |
33,965 | public static void setSystemSARLConfigurationFor ( IProject project ) { final IPreferenceStore preferenceStore = getSARLPreferencesFor ( project ) ; preferenceStore . setValue ( IS_PROJECT_SPECIFIC , false ) ; } | Configure the given project for using the system - wide configuration related to SARL . |
33,966 | public static void setSpecificSARLConfigurationFor ( IProject project , IPath outputPath ) { final IPreferenceStore preferenceStore = getSARLPreferencesFor ( project ) ; preferenceStore . setValue ( IS_PROJECT_SPECIFIC , true ) ; String key ; for ( final OutputConfiguration projectConfiguration : getXtextConfigurationsFor ( project ) ) { key = BuilderPreferenceAccess . getKey ( projectConfiguration , EclipseOutputConfigurationProvider . OUTPUT_DIRECTORY ) ; preferenceStore . setValue ( key , outputPath . toOSString ( ) ) ; key = BuilderPreferenceAccess . getKey ( projectConfiguration , EclipseOutputConfigurationProvider . OUTPUT_CREATE_DIRECTORY ) ; preferenceStore . setValue ( key , true ) ; key = BuilderPreferenceAccess . getKey ( projectConfiguration , EclipseOutputConfigurationProvider . OUTPUT_OVERRIDE ) ; preferenceStore . setValue ( key , true ) ; key = BuilderPreferenceAccess . getKey ( projectConfiguration , EclipseOutputConfigurationProvider . OUTPUT_DERIVED ) ; preferenceStore . setValue ( key , true ) ; key = BuilderPreferenceAccess . getKey ( projectConfiguration , EclipseOutputConfigurationProvider . OUTPUT_CLEANUP_DERIVED ) ; preferenceStore . setValue ( key , true ) ; key = BuilderPreferenceAccess . getKey ( projectConfiguration , EclipseOutputConfigurationProvider . OUTPUT_CLEAN_DIRECTORY ) ; preferenceStore . setValue ( key , true ) ; } } | Configure the given project for using a specific configuration related to SARL . |
33,967 | public static IPath getGlobalSARLOutputPath ( ) { final Injector injector = LangActivator . getInstance ( ) . getInjector ( LangActivator . IO_SARL_LANG_SARL ) ; final IOutputConfigurationProvider configurationProvider = injector . getInstance ( IOutputConfigurationProvider . class ) ; final OutputConfiguration config = Iterables . find ( configurationProvider . getOutputConfigurations ( ) , it -> Objects . equals ( it . getName ( ) , IFileSystemAccess . DEFAULT_OUTPUT ) ) ; if ( config != null ) { final String path = config . getOutputDirectory ( ) ; if ( ! Strings . isNullOrEmpty ( path ) ) { final IPath pathObject = Path . fromOSString ( path ) ; if ( pathObject != null ) { return pathObject ; } } } throw new IllegalStateException ( "No global preferences found for SARL." ) ; } | Replies the SARL output path in the global preferences . |
33,968 | protected String ensureMemberDeclarationKeyword ( CodeElementExtractor . ElementDescription memberDescription ) { final List < String > modifiers = getCodeBuilderConfig ( ) . getModifiers ( ) . get ( memberDescription . getName ( ) ) ; if ( modifiers != null && ! modifiers . isEmpty ( ) ) { return modifiers . get ( 0 ) ; } return null ; } | Replies a keyword for declaring a member . |
33,969 | protected BlockExpressionContextDescription getBlockExpressionContextDescription ( ) { for ( final CodeElementExtractor . ElementDescription containerDescription : getCodeElementExtractor ( ) . getTopElements ( getGrammar ( ) , getCodeBuilderConfig ( ) ) ) { if ( ! getCodeBuilderConfig ( ) . getNoActionBodyTypes ( ) . contains ( containerDescription . getName ( ) ) ) { final AbstractRule rule = getMemberRule ( containerDescription ) ; if ( rule != null ) { final BlockExpressionContextDescription description = getCodeElementExtractor ( ) . visitMemberElements ( containerDescription , rule , null , ( it , grammarContainer , memberContainer , classifier ) -> { final Assignment expressionAssignment = findAssignmentFromTerminalPattern ( memberContainer , getExpressionConfig ( ) . getBlockExpressionGrammarPattern ( ) ) ; final CodeElementExtractor . ElementDescription memberDescription = it . newElementDescription ( classifier . getName ( ) , memberContainer , classifier , XExpression . class ) ; final String keyword = ensureMemberDeclarationKeyword ( memberDescription ) ; if ( expressionAssignment != null && keyword != null ) { return new BlockExpressionContextDescription ( containerDescription , memberDescription , ensureContainerKeyword ( containerDescription . getGrammarComponent ( ) ) , keyword , expressionAssignment ) ; } return null ; } , null ) ; if ( description != null ) { return description ; } } } } return null ; } | Replies the description of the block expression context . |
33,970 | public < T > int getRegisteredEventListeners ( Class < T > type , Collection < ? super T > collection ) { synchronized ( this . behaviorGuardEvaluatorRegistry ) { return this . behaviorGuardEvaluatorRegistry . getRegisteredEventListeners ( type , collection ) ; } } | Extract the registered listeners with the given type . |
33,971 | private void executeBehaviorMethodsInParalellWithSynchroAtTheEnd ( Collection < Runnable > behaviorsMethodsToExecute ) throws InterruptedException , ExecutionException { final CountDownLatch doneSignal = new CountDownLatch ( behaviorsMethodsToExecute . size ( ) ) ; final OutputParameter < Throwable > runException = new OutputParameter < > ( ) ; for ( final Runnable runnable : behaviorsMethodsToExecute ) { this . executor . execute ( new JanusRunnable ( ) { public void run ( ) { try { runnable . run ( ) ; } catch ( EarlyExitException e ) { } catch ( RuntimeException e ) { runException . set ( e ) ; throw e ; } catch ( Exception e ) { runException . set ( e ) ; throw new RuntimeException ( e ) ; } finally { doneSignal . countDown ( ) ; } } } ) ; } try { doneSignal . await ( ) ; } catch ( InterruptedException ex ) { } if ( runException . get ( ) != null ) { throw new ExecutionException ( runException . get ( ) ) ; } } | Execute every single Behaviors runnable a dedicated thread will created by the executor local to this class and be used to execute each runnable in parallel and this method waits until its future has been completed before leaving . |
33,972 | private void executeAsynchronouslyBehaviorMethods ( Collection < Runnable > behaviorsMethodsToExecute ) { for ( final Runnable runnable : behaviorsMethodsToExecute ) { this . executor . execute ( runnable ) ; } } | Execute every single Behaviors runnable a dedicated thread will created by the executor local to this class and be used to execute each runnable in parallel . |
33,973 | protected void selectSREFromConfig ( ILaunchConfiguration config ) { final boolean notify = this . sreBlock . getNotify ( ) ; final boolean changed ; try { this . sreBlock . setNotify ( false ) ; if ( this . accessor . getUseSystemSREFlag ( config ) ) { changed = this . sreBlock . selectSystemWideSRE ( ) ; } else if ( this . accessor . getUseProjectSREFlag ( config ) ) { changed = this . sreBlock . selectProjectSRE ( ) ; } else { final String sreId = this . accessor . getSREId ( config ) ; final ISREInstall sre = SARLRuntime . getSREFromId ( Strings . nullToEmpty ( sreId ) ) ; changed = this . sreBlock . selectSpecificSRE ( sre ) ; } } finally { this . sreBlock . setNotify ( notify ) ; } if ( changed ) { updateLaunchConfigurationDialog ( ) ; } } | Loads the SARL runtime environment from the launch configuration s preference store . |
33,974 | protected boolean isValidJREVersion ( ILaunchConfiguration config ) { final IVMInstall install = this . fJREBlock . getJRE ( ) ; if ( install instanceof IVMInstall2 ) { final String version = ( ( IVMInstall2 ) install ) . getJavaVersion ( ) ; if ( version == null ) { setErrorMessage ( MessageFormat . format ( Messages . RuntimeEnvironmentTab_3 , install . getName ( ) ) ) ; return false ; } if ( ! Utils . isCompatibleJREVersion ( version ) ) { setErrorMessage ( MessageFormat . format ( Messages . RuntimeEnvironmentTab_4 , install . getName ( ) , version , SARLVersion . MINIMAL_JDK_VERSION , SARLVersion . MAXIMAL_JDK_VERSION ) ) ; return false ; } } return true ; } | Replies if the selected configuration has a valid version for a SARL application . |
33,975 | public ImageDescriptor image ( SarlAgent agent ) { final JvmDeclaredType jvmElement = this . jvmModelAssociations . getInferredType ( agent ) ; return this . images . forAgent ( agent . getVisibility ( ) , this . adornments . get ( jvmElement ) ) ; } | Replies the image for an agent . |
33,976 | public ImageDescriptor image ( SarlBehavior behavior ) { final JvmDeclaredType jvmElement = this . jvmModelAssociations . getInferredType ( behavior ) ; return this . images . forBehavior ( behavior . getVisibility ( ) , this . adornments . get ( jvmElement ) ) ; } | Replies the image for a behavior . |
33,977 | public ImageDescriptor image ( SarlCapacity capacity ) { final JvmDeclaredType jvmElement = this . jvmModelAssociations . getInferredType ( capacity ) ; return this . images . forCapacity ( capacity . getVisibility ( ) , this . adornments . get ( jvmElement ) ) ; } | Replies the image for a capacity . |
33,978 | public ImageDescriptor image ( SarlSkill skill ) { final JvmDeclaredType jvmElement = this . jvmModelAssociations . getInferredType ( skill ) ; return this . images . forSkill ( skill . getVisibility ( ) , this . adornments . get ( jvmElement ) ) ; } | Replies the image for a skill . |
33,979 | public ImageDescriptor image ( SarlEvent event ) { final JvmDeclaredType jvmElement = this . jvmModelAssociations . getInferredType ( event ) ; return this . images . forEvent ( event . getVisibility ( ) , this . adornments . get ( jvmElement ) ) ; } | Replies the image for an event . |
33,980 | public ImageDescriptor image ( SarlAction action ) { final JvmOperation jvmElement = this . jvmModelAssociations . getDirectlyInferredOperation ( action ) ; return this . images . forOperation ( action . getVisibility ( ) , this . adornments . get ( jvmElement ) ) ; } | Replies the image for an action . |
33,981 | public ImageDescriptor image ( SarlField attribute ) { return this . images . forField ( attribute . getVisibility ( ) , this . adornments . get ( this . jvmModelAssociations . getJvmField ( attribute ) ) ) ; } | Replies the image for an attribute . |
33,982 | public ImageDescriptor image ( SarlConstructor constructor ) { if ( constructor . isStatic ( ) ) { return this . images . forStaticConstructor ( ) ; } return this . images . forConstructor ( constructor . getVisibility ( ) , this . adornments . get ( this . jvmModelAssociations . getInferredConstructor ( constructor ) ) ) ; } | Replies the image for a constructor . |
33,983 | public static IJavaBatchCompiler newDefaultJavaBatchCompiler ( ) { try { synchronized ( SarlBatchCompiler . class ) { if ( defaultJavaBatchCompiler == null ) { final ImplementedBy annotation = IJavaBatchCompiler . class . getAnnotation ( ImplementedBy . class ) ; assert annotation != null ; final Class < ? > type = annotation . value ( ) ; assert type != null ; defaultJavaBatchCompiler = type . asSubclass ( IJavaBatchCompiler . class ) ; } return defaultJavaBatchCompiler . newInstance ( ) ; } } catch ( Exception exception ) { throw new RuntimeException ( exception ) ; } } | Create a default Java batch compiler without injection . |
33,984 | private void notifiesIssueMessageListeners ( Issue issue , org . eclipse . emf . common . util . URI uri , String message ) { for ( final IssueMessageListener listener : this . messageListeners ) { listener . onIssue ( issue , uri , message ) ; } } | Replies the message for the given issue . |
33,985 | public void setLogger ( Logger logger ) { this . logger = logger == null ? LoggerFactory . getLogger ( getClass ( ) ) : logger ; } | Set the logger . |
33,986 | public void setBaseURI ( org . eclipse . emf . common . util . URI basePath ) { this . baseUri = basePath ; } | Change the base URI . |
33,987 | public List < File > getBootClassPath ( ) { if ( this . bootClasspath == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( this . bootClasspath ) ; } | Replies the boot classpath . This option is only supported on JDK 8 and older and will be ignored when source level is 9 or newer . |
33,988 | public void setClassPath ( String classpath ) { this . classpath = new ArrayList < > ( ) ; for ( final String path : Strings . split ( classpath , Pattern . quote ( File . pathSeparator ) ) ) { this . classpath . add ( normalizeFile ( path ) ) ; } } | Change the classpath . |
33,989 | public List < File > getClassPath ( ) { if ( this . classpath == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( this . classpath ) ; } | Replies the classpath . |
33,990 | @ SuppressWarnings ( "static-method" ) protected File createTempDirectory ( ) { final File tmpPath = new File ( System . getProperty ( "java.io.tmpdir" ) ) ; int i = 0 ; File tmp = new File ( tmpPath , "sarlc" + i ) ; while ( tmp . exists ( ) ) { ++ i ; tmp = new File ( tmpPath , "sarlc" + i ) ; } return tmp ; } | Create the temp directory that should be used by the compiler . |
33,991 | public void setJavaSourceVersion ( String version ) { final JavaVersion javaVersion = JavaVersion . fromQualifier ( version ) ; if ( javaVersion == null ) { final List < String > qualifiers = new ArrayList < > ( ) ; for ( final JavaVersion vers : JavaVersion . values ( ) ) { qualifiers . addAll ( vers . getAllQualifiers ( ) ) ; } throw new RuntimeException ( MessageFormat . format ( Messages . SarlBatchCompiler_0 , version , Joiner . on ( Messages . SarlBatchCompiler_1 ) . join ( qualifiers ) ) ) ; } getGeneratorConfig ( ) . setJavaSourceVersion ( javaVersion ) ; } | Change the version of the Java source to be used for the generated Java files . |
33,992 | public void setSourcePath ( String sourcePath ) { this . sourcePath = new ArrayList < > ( ) ; for ( final String path : Strings . split ( sourcePath , Pattern . quote ( File . pathSeparator ) ) ) { this . sourcePath . add ( normalizeFile ( path ) ) ; } } | Change the source path . |
33,993 | public void addSourcePath ( File sourcePath ) { if ( this . sourcePath == null ) { this . sourcePath = new ArrayList < > ( ) ; } this . sourcePath . add ( sourcePath ) ; } | Add a folder to the source path . |
33,994 | public List < File > getSourcePaths ( ) { if ( this . sourcePath == null ) { return Collections . emptyList ( ) ; } return Collections . unmodifiableList ( this . sourcePath ) ; } | Replies the source path . |
33,995 | protected void overrideXtextInternalLoggers ( ) { final Logger logger = getLogger ( ) ; final org . apache . log4j . spi . LoggerFactory factory = new InternalXtextLoggerFactory ( logger ) ; final org . apache . log4j . Logger internalLogger = org . apache . log4j . Logger . getLogger ( MessageFormat . format ( Messages . SarlBatchCompiler_40 , logger . getName ( ) ) , factory ) ; setStaticField ( BatchLinkableResourceStorageWritable . class , "LOG" , internalLogger ) ; setStaticField ( BatchLinkableResource . class , "log" , internalLogger ) ; setStaticField ( ProcessorInstanceForJvmTypeProvider . class , "logger" , internalLogger ) ; } | Change the loggers that are internally used by Xtext . |
33,996 | protected String createIssueMessage ( Issue issue ) { final IssueMessageFormatter formatter = getIssueMessageFormatter ( ) ; final org . eclipse . emf . common . util . URI uriToProblem = issue . getUriToProblem ( ) ; if ( formatter != null ) { final String message = formatter . format ( issue , uriToProblem ) ; if ( message != null ) { return message ; } } if ( uriToProblem != null ) { final org . eclipse . emf . common . util . URI resourceUri = uriToProblem . trimFragment ( ) ; return MessageFormat . format ( Messages . SarlBatchCompiler_4 , issue . getSeverity ( ) , resourceUri . lastSegment ( ) , resourceUri . isFile ( ) ? resourceUri . toFileString ( ) : "" , issue . getLineNumber ( ) , issue . getColumn ( ) , issue . getCode ( ) , issue . getMessage ( ) ) ; } return MessageFormat . format ( Messages . SarlBatchCompiler_5 , issue . getSeverity ( ) , issue . getLineNumber ( ) , issue . getColumn ( ) , issue . getCode ( ) , issue . getMessage ( ) ) ; } | Create a message for the issue . |
33,997 | protected boolean reportCompilationIssues ( Iterable < Issue > issues ) { boolean hasError = false ; for ( final Issue issue : issues ) { final String issueMessage = createIssueMessage ( issue ) ; switch ( issue . getSeverity ( ) ) { case ERROR : hasError = true ; getLogger ( ) . error ( issueMessage ) ; break ; case WARNING : getLogger ( ) . warn ( issueMessage ) ; break ; case INFO : getLogger ( ) . info ( issueMessage ) ; break ; case IGNORE : default : break ; } notifiesIssueMessageListeners ( issue , issue . getUriToProblem ( ) , issueMessage ) ; } return hasError ; } | Output the given issues that result from the compilation of the SARL code . |
33,998 | protected void reportInternalError ( String message , Object ... parameters ) { getLogger ( ) . error ( message , parameters ) ; if ( getReportInternalProblemsAsIssues ( ) ) { final org . eclipse . emf . common . util . URI uri = null ; final Issue . IssueImpl issue = new Issue . IssueImpl ( ) ; issue . setCode ( INTERNAL_ERROR_CODE ) ; issue . setMessage ( message ) ; issue . setUriToProblem ( uri ) ; issue . setSeverity ( Severity . ERROR ) ; notifiesIssueMessageListeners ( issue , uri , message ) ; } } | Reports the given error message . |
33,999 | protected void generateJavaFiles ( Iterable < Resource > validatedResources , IProgressMonitor progress ) { assert progress != null ; progress . subTask ( Messages . SarlBatchCompiler_49 ) ; getLogger ( ) . info ( Messages . SarlBatchCompiler_28 , getOutputPath ( ) ) ; final JavaIoFileSystemAccess javaIoFileSystemAccess = this . javaIoFileSystemAccessProvider . get ( ) ; javaIoFileSystemAccess . setOutputConfigurations ( this . outputConfigurations ) ; javaIoFileSystemAccess . setWriteTrace ( isWriteTraceFiles ( ) ) ; if ( progress . isCanceled ( ) ) { return ; } final GeneratorContext context = new GeneratorContext ( ) ; context . setCancelIndicator ( ( ) -> progress . isCanceled ( ) ) ; for ( final Resource resource : validatedResources ) { if ( progress . isCanceled ( ) ) { return ; } if ( getLogger ( ) . isDebugEnabled ( ) ) { getLogger ( ) . debug ( Messages . SarlBatchCompiler_23 , resource . getURI ( ) . lastSegment ( ) ) ; } if ( isWriteStorageFiles ( ) && resource instanceof StorageAwareResource ) { final StorageAwareResource storageAwareResource = ( StorageAwareResource ) resource ; storageAwareResource . getResourceStorageFacade ( ) . saveResource ( storageAwareResource , javaIoFileSystemAccess ) ; } if ( progress . isCanceled ( ) ) { return ; } this . generator . generate ( resource , javaIoFileSystemAccess , context ) ; notifiesCompiledResourceReceiver ( resource ) ; } } | Generate the Java files from the SARL scripts . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.