idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
33,800
@ SuppressWarnings ( "static-method" ) protected void safeRefresh ( IProject project , IProgressMonitor monitor ) { try { project . refreshLocal ( IResource . DEPTH_INFINITE , monitor ) ; } catch ( CoreException exception ) { SARLEclipsePlugin . getDefault ( ) . log ( exception ) ; } }
Refresh the project file hierarchy .
33,801
public static String [ ] getSARLProjectSourceFolders ( ) { return new String [ ] { SARLConfig . FOLDER_SOURCE_SARL , SARLConfig . FOLDER_SOURCE_JAVA , SARLConfig . FOLDER_RESOURCES , SARLConfig . FOLDER_TEST_SOURCE_SARL , SARLConfig . FOLDER_SOURCE_GENERATED , SARLConfig . FOLDER_TEST_SOURCE_GENERATED , } ; }
Replies the list of the standard source folders for a SARL project .
33,802
public static void configureSARLProject ( IProject project , boolean addNatures , boolean configureJavaNature , boolean createFolders , IProgressMonitor monitor ) { try { final SubMonitor subMonitor = SubMonitor . convert ( monitor , 11 ) ; final IStatus status = Status . OK_STATUS ; if ( addNatures ) { addSarlNatures ...
Configure the SARL project .
33,803
public static void configureSARLSourceFolders ( IProject project , boolean createFolders , IProgressMonitor monitor ) { try { final SubMonitor subMonitor = SubMonitor . convert ( monitor , 8 ) ; final OutParameter < IFolder [ ] > sourceFolders = new OutParameter < > ( ) ; final OutParameter < IFolder [ ] > testSourceFo...
Configure the source folders for a SARL project .
33,804
public static List < IClasspathEntry > getDefaultSourceClassPathEntries ( IPath projectFolder ) { final IPath srcJava = projectFolder . append ( Path . fromPortableString ( SARLConfig . FOLDER_SOURCE_JAVA ) ) ; final IClasspathEntry srcJavaEntry = JavaCore . newSourceEntry ( srcJava . makeAbsolute ( ) ) ; final IPath s...
Replies the default source entries for a SARL project .
33,805
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) protected void collectProjectFoldersFromDirectory ( Collection < File > folders , File directory , Set < String > directoriesVisited , boolean nestedProjects , IProgressMonitor monitor ) { if ( monitor . isCanceled ( ) ) { return ; } monitor . subTask ( NLS . bind ( M...
Collect the list of SARL project folders that are under directory into files .
33,806
public static IStatus addNatures ( IProject project , IProgressMonitor monitor , String ... natureIdentifiers ) { if ( project != null && natureIdentifiers != null && natureIdentifiers . length > 0 ) { try { final SubMonitor subMonitor = SubMonitor . convert ( monitor , natureIdentifiers . length + 2 ) ; final IProject...
Add the natures to the given project .
33,807
public static IStatus addSarlNatures ( IProject project , IProgressMonitor monitor ) { return addNatures ( project , monitor , getSarlNatures ( ) ) ; }
Add the SARL natures to the given project .
33,808
public IAnnotation getAnnotation ( IAnnotatable element , String qualifiedName ) { if ( element != null ) { try { final int separator = qualifiedName . lastIndexOf ( '.' ) ; final String simpleName ; if ( separator >= 0 && separator < ( qualifiedName . length ( ) - 1 ) ) { simpleName = qualifiedName . substring ( separ...
Replies the annotation with the given qualified name .
33,809
public JvmConstructor getJvmConstructor ( IMethod constructor , XtendTypeDeclaration context ) throws JavaModelException { if ( constructor . isConstructor ( ) ) { final JvmType type = this . typeReferences . findDeclaredType ( constructor . getDeclaringType ( ) . getFullyQualifiedName ( ) , context ) ; if ( type insta...
Create the JvmConstructor for the given JDT constructor .
33,810
protected IFormalParameterBuilder [ ] createFormalParametersWith ( ParameterBuilder parameterBuilder , IMethod operation ) throws JavaModelException , IllegalArgumentException { final boolean isVarargs = Flags . isVarargs ( operation . getFlags ( ) ) ; final ILocalVariable [ ] rawParameters = operation . getParameters ...
Create the formal parameters for the given operation .
33,811
public void createStandardConstructorsWith ( ConstructorBuilder codeBuilder , Collection < IMethod > superClassConstructors , XtendTypeDeclaration context ) throws JavaModelException { if ( superClassConstructors != null ) { for ( final IMethod constructor : superClassConstructors ) { if ( ! isGeneratedOperation ( cons...
Add the given constructors to the Ecore container .
33,812
public void createActionsWith ( ActionBuilder codeBuilder , Collection < IMethod > methods , XtendTypeDeclaration context ) throws JavaModelException , IllegalArgumentException { if ( methods != null ) { for ( final IMethod operation : methods ) { if ( ! isGeneratedOperation ( operation ) ) { final ISarlActionBuilder a...
Create the operations into the SARL feature container .
33,813
public boolean isSubClassOf ( TypeFinder typeFinder , String subClass , String superClass ) throws JavaModelException { final SuperTypeIterator typeIterator = new SuperTypeIterator ( typeFinder , false , subClass ) ; while ( typeIterator . hasNext ( ) ) { final IType type = typeIterator . next ( ) ; if ( Objects . equa...
Replies if the given type is a subclass of the second type .
33,814
public static int compare ( XExpression e1 , XExpression e2 ) { if ( e1 == e2 ) { return 0 ; } if ( e1 == null ) { return Integer . MIN_VALUE ; } if ( e2 == null ) { return Integer . MAX_VALUE ; } return e1 . toString ( ) . compareTo ( e2 . toString ( ) ) ; }
Compare two Xtext expressions .
33,815
protected static void setMainJavaClass ( ILaunchConfigurationWorkingCopy wc , String name ) { wc . setAttribute ( IJavaLaunchConfigurationConstants . ATTR_MAIN_TYPE_NAME , name ) ; }
Change the main java class within the given configuration .
33,816
protected ILaunchConfigurationWorkingCopy initLaunchConfiguration ( String configurationType , String projectName , String id , boolean resetJavaMainClass ) throws CoreException { final ILaunchManager launchManager = DebugPlugin . getDefault ( ) . getLaunchManager ( ) ; final ILaunchConfigurationType configType = launc...
initialize the launch configuration .
33,817
protected static String trimFileExtension ( String fileName ) { if ( fileName . lastIndexOf ( '.' ) == - 1 ) { return fileName ; } return fileName . substring ( 0 , fileName . lastIndexOf ( '.' ) ) ; }
Remove the file extension .
33,818
protected void generateMetadata ( IXmlStyleAppendable it ) { it . appendTagWithValue ( "property" , Strings . concat ( ";" , getMimeTypes ( ) ) , "name" , "mimetypes" ) ; final StringBuilder buffer = new StringBuilder ( ) ; for ( final String fileExtension : getLanguage ( ) . getFileExtensions ( ) ) { if ( buffer . len...
Generate the metadata section .
33,819
@ SuppressWarnings ( "static-method" ) protected void generateStyles ( IXmlStyleAppendable it ) { it . appendTag ( "style" , "id" , "comment" , "_name" , "Comment" , "map-to" , "def:comment" ) ; it . appendTag ( "style" , "id" , "error" , "_name" , "Error" , "map-to" , "def:error" ) ; it . appendTag ( "style" , "id" , ...
Generate the style section .
33,820
protected void selectSRE ( ) { final File file ; if ( StandardSREPage . this . workingCopy . getJarFile ( ) != null ) { file = StandardSREPage . this . workingCopy . getJarFile ( ) . toFile ( ) ; } else { file = null ; } final FileDialog dialog = new FileDialog ( getShell ( ) , SWT . OPEN ) ; dialog . setText ( Message...
Ask to the user to selected the SRE .
33,821
private void initializeFields ( ) { final IPath path = this . workingCopy . getJarFile ( ) ; String tooltip = null ; String basename = null ; if ( path != null ) { tooltip = path . toOSString ( ) ; final IPath tmpPath = path . removeTrailingSeparator ( ) ; if ( tmpPath != null ) { basename = tmpPath . lastSegment ( ) ;...
Initialize the dialogs fields .
33,822
public static IPath getSourceBundlePath ( Bundle bundle , IPath bundleLocation ) { IPath sourcesPath = null ; try { final IPath srcFolderPath = getSourceRootProjectFolderPath ( bundle ) ; if ( srcFolderPath == null ) { final IPath bundlesParentFolder = bundleLocation . removeLastSegments ( 1 ) ; final String binaryJarN...
Replies the source location for the given bundle .
33,823
public static IPath getBundlePath ( Bundle bundle ) { IPath path = getBinFolderPath ( bundle ) ; if ( path == null ) { try { path = new Path ( FileLocator . getBundleFile ( bundle ) . getAbsolutePath ( ) ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } return path ; }
Replies the path of the binary files of the given bundle .
33,824
public void setReferenceInto ( XFeatureCall container ) { JvmVoid jvmVoid = this . jvmTypesFactory . createJvmVoid ( ) ; if ( jvmVoid instanceof InternalEObject ) { final InternalEObject jvmVoidProxy = ( InternalEObject ) jvmVoid ; final EObject param = getSarlFormalParameter ( ) ; final Resource resource = param . eRe...
Replies the JvmIdentifiable that corresponds to the formal parameter .
33,825
public void setParameterType ( String type ) { String typeName ; if ( Strings . isEmpty ( type ) ) { typeName = Object . class . getName ( ) ; } else { typeName = type ; } this . parameter . setParameterType ( newTypeRef ( this . context , typeName ) ) ; }
Change the type .
33,826
public IExpressionBuilder getDefaultValue ( ) { if ( this . defaultValue == null ) { this . defaultValue = this . expressionProvider . get ( ) ; this . defaultValue . eInit ( this . parameter , new Procedures . Procedure1 < XExpression > ( ) { public void apply ( XExpression it ) { getSarlFormalParameter ( ) . setDefau...
Replies the default value of the parameter .
33,827
@ SuppressWarnings ( "static-method" ) public JvmAnnotationReference findAnnotation ( JvmAnnotationTarget annotationTarget , String lookupType ) { if ( annotationTarget . eIsSet ( TypesPackage . Literals . JVM_ANNOTATION_TARGET__ANNOTATIONS ) ) { for ( final JvmAnnotationReference annotation : annotationTarget . getAnn...
Find an annotation .
33,828
public List < String > getTempResourceRoots ( ) { final List < String > tmp = this . tmpResources == null ? Collections . emptyList ( ) : this . tmpResources ; this . tmpResources = null ; return tmp ; }
Replies the temprary root folders for resources .
33,829
@ SuppressWarnings ( "checkstyle:all" ) protected StringConcatenationClient generateTopElement ( CodeElementExtractor . ElementDescription description , boolean forInterface , boolean forAppender ) { final String topElementName = Strings . toFirstUpper ( description . getName ( ) ) ; final TypeReference builderType = g...
Extract a top element from the grammar .
33,830
protected List < StringConcatenationClient > generateTopElements ( boolean forInterface , boolean forAppender ) { final List < StringConcatenationClient > topElements = new ArrayList < > ( ) ; for ( final CodeElementExtractor . ElementDescription description : getCodeElementExtractor ( ) . getTopElements ( getGrammar (...
Extract top elements from the grammar .
33,831
protected void generateIScriptBuilder ( ) { final List < StringConcatenationClient > topElements = generateTopElements ( true , false ) ; final TypeReference builder = getScriptBuilderInterface ( ) ; final StringConcatenationClient content = new StringConcatenationClient ( ) { protected void appendTo ( TargetStringConc...
Generate the script builder interface .
33,832
protected void generateScriptSourceAppender ( ) { final List < StringConcatenationClient > topElements = generateTopElements ( false , true ) ; final TypeReference appender = getCodeElementExtractor ( ) . getElementAppenderImpl ( "Script" ) ; final StringConcatenationClient content = new StringConcatenationClient ( ) {...
Generate the script appender .
33,833
protected void generateScriptBuilderImpl ( ) { final List < StringConcatenationClient > topElements = generateTopElements ( false , false ) ; final TypeReference script = getScriptBuilderImpl ( ) ; final TypeReference scriptInterface = getScriptBuilderInterface ( ) ; final StringConcatenationClient content = new String...
Generate the script builder default implementation .
33,834
public static Class < ? > findClass ( String classname ) { Class < ? > type = null ; final ClassLoader loader = ClassLoaderFinder . findClassLoader ( ) ; if ( loader != null ) { try { type = loader . loadClass ( classname ) ; } catch ( ClassNotFoundException e ) { } } if ( type == null ) { try { type = ClassFinder . cl...
Find the class with a search policy .
33,835
protected void generatePreamble ( IStyleAppendable it ) { clearHilights ( ) ; final String nm = getLanguageSimpleName ( ) . toLowerCase ( ) ; final String cmd = Strings . toFirstUpper ( getLanguageSimpleName ( ) . toLowerCase ( ) ) + "HiLink" ; appendComment ( it , "Quit when a syntax file was already loaded" ) ; appen...
Generate the preamble of the Vim style .
33,836
protected void generatePostamble ( IStyleAppendable it ) { appendComment ( it , "catch errors caused by wrong parenthesis" ) ; appendCmd ( it , "syn region sarlParenT transparent matchgroup=sarlParen start=\"(\" end=\")\" contains=@sarlTop,sarlParenT1" ) ; appendCmd ( it , "syn region sarlParenT1 transparent matchgrou...
Generate the postamble of the Vim style .
33,837
protected void generatePrimitiveTypes ( IStyleAppendable it , Iterable < String > types ) { final Iterator < String > iterator = types . iterator ( ) ; if ( iterator . hasNext ( ) ) { appendComment ( it , "primitive types." ) ; appendMatch ( it , "sarlArrayDeclaration" , "\\(\\s*\\[\\s*\\]\\)*" , true ) ; it . append (...
Generate the keywords for the primitive types .
33,838
protected void generateComments ( IStyleAppendable it ) { appendComment ( it , "comments" ) ; appendRegion ( it , "sarlComment" , "/\\*" , "\\*/" , "@Spell" ) ; appendCmd ( it , "syn match sarlCommentStar contained \"^\\s*\\*[^/]\"me=e-1" ) ; appendMatch ( it , "sarlCommentStar" , "^\\s*\\*$" , true ) ; appendMatch ( i...
Generate the Vim comments .
33,839
protected void generateStrings ( IStyleAppendable it ) { appendComment ( it , "Strings constants" ) ; appendMatch ( it , "sarlSpecialError" , "\\\\." , true ) ; appendMatch ( it , "sarlSpecialCharError" , "[^']" , true ) ; appendMatch ( it , "sarlSpecialChar" , "\\\\\\([4-9]\\d\\|[0-3]\\d\\d\\|[\"\\\\'ntbrf]\\|u\\x\\{4...
Generate the Vim strings of characters .
33,840
protected void generateNumericConstants ( IStyleAppendable it ) { appendComment ( it , "numerical constants" ) ; appendMatch ( it , "sarlNumber" , "[0-9][0-9]*\\.[0-9]\\+([eE][0-9]\\+)\\?[fFdD]\\?" ) ; appendMatch ( it , "sarlNumber" , "0[xX][0-9a-fA-F]\\+" ) ; appendMatch ( it , "sarlNumber" , "[0-9]\\+[lL]\\?" ) ; ap...
Generate the Vim numeric constants .
33,841
protected void generateAnnotations ( IStyleAppendable it ) { appendComment ( it , "annnotation" ) ; appendMatch ( it , "sarlAnnotation" , "@[_a-zA-Z][_0-9a-zA-Z]*\\([.$][_a-zA-Z][_0-9a-zA-Z]*\\)*" ) ; appendCluster ( it , "sarlAnnotation" ) ; hilight ( "sarlAnnotation" , VimSyntaxGroup . PRE_PROCESSOR ) ; it . newLine ...
Generate the annotations .
33,842
protected void generateKeywords ( IStyleAppendable it , String family , VimSyntaxGroup color , Iterable < String > keywords ) { appendComment ( it , "keywords for the '" + family + "' family." ) ; final Iterator < String > iterator = keywords . iterator ( ) ; if ( iterator . hasNext ( ) ) { it . append ( "syn keyword "...
Generate the Vim keywords .
33,843
protected IStyleAppendable appendCmd ( IStyleAppendable it , String text ) { return appendCmd ( it , true , text ) ; }
Append a Vim command .
33,844
protected void generateFileTypeDetectionScript ( String basename ) { final CharSequence scriptContent = getFileTypeDetectionScript ( ) ; if ( scriptContent != null ) { final String textualContent = scriptContent . toString ( ) ; if ( ! Strings . isEmpty ( textualContent ) ) { final byte [ ] bytes = textualContent . get...
Generate the script for detecting the SARL files .
33,845
protected CharSequence getFileTypeDetectionScript ( ) { return concat ( "\" Vim filetype-detection file" , "\" Language: " + getLanguageSimpleName ( ) , "\" Version: " + getLanguageVersion ( ) , "" , "au BufRead,BufNewFile *." + getLanguage ( ) . getFileExtensions ( ) . get ( 0 ) + " set filetype=" + getLanguageSimpleN...
Replies the script for detecting the SARL files .
33,846
protected Set < OutputConfiguration > getOutputConfigurations ( IProject project ) { final Set < OutputConfiguration > original = this . configurationProvider . getOutputConfigurations ( getProject ( ) ) ; return Sets . filter ( original , it -> ! ExtraLanguageOutputConfigurations . isExtraLanguageOutputConfiguration (...
Replies the output configurations for the given project .
33,847
public static IntegerRange parseRange ( String stringRange , int minValue ) { final String sepPattern = "[,;\\-:]" ; try { final Matcher matcher = Pattern . compile ( "^\\s*" + "(?:(?<left>[0-9]+)\\s*(?:(?<sep1>" + sepPattern + ")\\s*(?<right1>[0-9]+)?)?)" + "|(?:(?<sep2>" + sepPattern + ")\\s*(?<right2>[0-9]+))" + "\\...
Parse a range of integers .
33,848
public static boolean isHtmlFileExtension ( String extension ) { for ( final String ext : HTML_FILE_EXTENSIONS ) { if ( Strings . equal ( ext , extension ) ) { return true ; } } return false ; }
Replies if the given extension is for HTML file .
33,849
public void setDocumentParser ( SarlDocumentationParser parser ) { assert parser != null ; this . parser = parser ; this . parser . reset ( ) ; }
Change the document parser .
33,850
public Iterable < ValidationComponent > getStandardValidationComponents ( File inputFile ) { final ValidationHandler handler = new ValidationHandler ( ) ; getDocumentParser ( ) . extractValidationComponents ( inputFile , handler ) ; return handler . getComponents ( ) ; }
Extract the validation components from the given file .
33,851
public final List < DynamicValidationComponent > getMarkerSpecificValidationComponents ( File inputFile , File rootFolder , DynamicValidationContext context ) { return getSpecificValidationComponents ( transform ( inputFile , false ) , inputFile , rootFolder , context ) ; }
Extract the validation components that are specific to the marker language .
33,852
public static IBundleDependencies getJanusPlatformClasspath ( ) { final Bundle bundle = Platform . getBundle ( JanusEclipsePlugin . JANUS_KERNEL_PLUGIN_ID ) ; return BundleUtil . resolveBundleDependencies ( bundle , new JanusBundleJavadocURLMappings ( ) , JANUS_ROOT_BUNDLE_NAMES ) ; }
Replies the standard classpath for running the Janus platform .
33,853
public static int compare ( XtendParameter p1 , XtendParameter p2 ) { if ( p1 != p2 ) { if ( p1 == null ) { return Integer . MIN_VALUE ; } if ( p2 == null ) { return Integer . MAX_VALUE ; } final JvmTypeReference t1 = p1 . getParameterType ( ) ; final JvmTypeReference t2 = p2 . getParameterType ( ) ; if ( t1 != t2 ) { ...
Compare the two formal parameters .
33,854
public ISarlBehaviorUnitBuilder addSarlBehaviorUnit ( String name ) { ISarlBehaviorUnitBuilder builder = this . iSarlBehaviorUnitBuilderProvider . get ( ) ; builder . eInit ( getSarlBehavior ( ) , name , getTypeResolutionContext ( ) ) ; return builder ; }
Create a SarlBehaviorUnit .
33,855
public ISarlFieldBuilder addVarSarlField ( String name ) { ISarlFieldBuilder builder = this . iSarlFieldBuilderProvider . get ( ) ; builder . eInit ( getSarlBehavior ( ) , name , "var" , getTypeResolutionContext ( ) ) ; return builder ; }
Create a SarlField .
33,856
public ISarlActionBuilder addDefSarlAction ( String name ) { ISarlActionBuilder builder = this . iSarlActionBuilderProvider . get ( ) ; builder . eInit ( getSarlBehavior ( ) , name , "def" , getTypeResolutionContext ( ) ) ; return builder ; }
Create a SarlAction .
33,857
public ISarlClassBuilder addSarlClass ( String name ) { ISarlClassBuilder builder = this . iSarlClassBuilderProvider . get ( ) ; builder . eInit ( getSarlBehavior ( ) , name , getTypeResolutionContext ( ) ) ; return builder ; }
Create a SarlClass .
33,858
public void addSarlCapacityUses ( String ... name ) { if ( name != null && name . length > 0 ) { SarlCapacityUses member = SarlFactory . eINSTANCE . createSarlCapacityUses ( ) ; this . sarlBehavior . getMembers ( ) . add ( member ) ; member . setAnnotationInfo ( XtendFactory . eINSTANCE . createXtendMember ( ) ) ; Coll...
Create a SarlCapacityUses .
33,859
public void addSarlRequiredCapacity ( String ... name ) { if ( name != null && name . length > 0 ) { SarlRequiredCapacity member = SarlFactory . eINSTANCE . createSarlRequiredCapacity ( ) ; this . sarlBehavior . getMembers ( ) . add ( member ) ; member . setAnnotationInfo ( XtendFactory . eINSTANCE . createXtendMember ...
Create a SarlRequiredCapacity .
33,860
@ SuppressWarnings ( "static-method" ) public SarlConfig getSarlcConfig ( ConfigurationFactory configFactory , Injector injector ) { final SarlConfig config = SarlConfig . getConfiguration ( configFactory ) ; injector . injectMembers ( config ) ; return config ; }
Replies the instance of the sarl configuration .
33,861
public static RefactoringStatus validatePackageName ( String newName ) { if ( ! PACKAGE_NAME_PATTERN . matcher ( newName ) . find ( ) ) { RefactoringStatus . createErrorStatus ( MessageFormat . format ( Messages . SARLJdtPackageRenameParticipant_0 , newName ) ) ; } return new RefactoringStatus ( ) ; }
Validate the package name .
33,862
protected void setPackageName ( String newName , ResourceSet resourceSet ) { final EObject object = resourceSet . getEObject ( this . uriProvider . apply ( resourceSet ) , true ) ; if ( object instanceof SarlScript ) { ( ( SarlScript ) object ) . setPackage ( newName ) ; } else { throw new RefactoringException ( "SARL ...
Change the package name .
33,863
protected TextEdit getDeclarationTextEdit ( String newName , ResourceSet resourceSet ) { final EObject object = resourceSet . getEObject ( this . uriProvider . apply ( resourceSet ) , true ) ; if ( object instanceof SarlScript ) { final ITextRegion region = getOriginalPackageRegion ( ( SarlScript ) object ) ; if ( regi...
Replies the text update for the rename .
33,864
protected ITextRegion getOriginalPackageRegion ( final SarlScript script ) { return this . locationInFileProvider . getFullTextRegion ( script , XtendPackage . Literals . XTEND_FILE__PACKAGE , 0 ) ; }
Replies the text region that is corresponding to the package name .
33,865
public void setOutputLanguage ( @ Named ( Constants . LANGUAGE_NAME ) String outputLanguage ) { if ( ! Strings . isNullOrEmpty ( outputLanguage ) ) { final String [ ] parts = outputLanguage . split ( "\\.+" ) ; if ( parts . length > 0 ) { final String simpleName = parts [ parts . length - 1 ] ; if ( ! Strings . isNullO...
Change the name of the language .
33,866
public static Function2 < String , String , String > getFencedCodeBlockFormatter ( ) { return ( languageName , content ) -> { return "```" + Strings . nullToEmpty ( languageName ) . toLowerCase ( ) + "\n" + content + "```\n" ; } ; }
Replies the fenced code block formatter .
33,867
public static Function2 < String , String , String > getBasicCodeBlockFormatter ( ) { return ( languageName , content ) -> { return Pattern . compile ( "^" , Pattern . MULTILINE ) . matcher ( content ) . replaceAll ( "\t" ) ; } ; }
Replies the basic code block formatter .
33,868
public void reset ( ) { this . rawPatterns . clear ( ) ; this . compiledPatterns . clear ( ) ; this . inlineFormat = DEFAULT_INLINE_FORMAT ; this . blockFormat = null ; this . outlineOutputTag = DEFAULT_OUTLINE_OUTPUT_TAG ; this . dynamicNameExtractionPattern = DEFAULT_TAG_NAME_PATTERN ; this . lineContinuation = DEFAU...
Reset to the default settings .
33,869
public void setPattern ( Tag tag , String regex ) { if ( Strings . isNullOrEmpty ( regex ) ) { this . rawPatterns . remove ( tag ) ; this . compiledPatterns . remove ( tag ) ; } else { this . rawPatterns . put ( tag , regex ) ; this . compiledPatterns . put ( tag , Pattern . compile ( "^\\s*" + regex , PATTERN_COMPILE_...
Change the pattern of the tag .
33,870
public String getPattern ( Tag tag ) { final String pattern = this . rawPatterns . get ( tag ) ; if ( pattern == null ) { return tag . getDefaultPattern ( ) ; } return pattern ; }
Replies the pattern of the tag .
33,871
public Tag getTagForPattern ( CharSequence text ) { for ( final Tag tag : Tag . values ( ) ) { Pattern pattern = this . compiledPatterns . get ( tag ) ; if ( pattern == null ) { pattern = Pattern . compile ( "^\\s*" + getPattern ( tag ) , Pattern . DOTALL ) ; this . compiledPatterns . put ( tag , pattern ) ; } final Ma...
Replies the tag that is matching the given text .
33,872
public String getLineSeparator ( ) { if ( Strings . isNullOrEmpty ( this . lineSeparator ) ) { final String nl = System . getProperty ( "line.separator" ) ; if ( Strings . isNullOrEmpty ( nl ) ) { return "\n" ; } return nl ; } return this . lineSeparator ; }
Replies the OS - dependent line separator .
33,873
protected void extractDynamicName ( Tag tag , CharSequence name , OutParameter < String > dynamicName ) { if ( tag . hasDynamicName ( ) ) { final Pattern pattern = Pattern . compile ( getDynamicNameExtractionPattern ( ) ) ; final Matcher matcher = pattern . matcher ( name ) ; if ( matcher . matches ( ) ) { dynamicName ...
Extract the dynamic name of that from the raw text .
33,874
public String transform ( File inputFile ) { final String content ; try ( FileReader reader = new FileReader ( inputFile ) ) { content = read ( reader ) ; } catch ( IOException exception ) { reportError ( Messages . SarlDocumentationParser_0 , exception ) ; return null ; } return transform ( content , inputFile ) ; }
Read the given file and transform its content in order to have a raw text .
33,875
protected String postProcessing ( CharSequence text ) { final String lineContinuation = getLineContinuation ( ) ; if ( lineContinuation != null ) { final Pattern pattern = Pattern . compile ( "\\s*\\\\[\\n\\r]+\\s*" , Pattern . DOTALL ) ; final Matcher matcher = pattern . matcher ( text . toString ( ) . trim ( ) ) ; re...
Do a post processing of the text .
33,876
protected static String formatBlockText ( String content , String languageName , Function2 < String , String , String > blockFormat ) { String replacement = Strings . nullToEmpty ( content ) ; final String [ ] lines = replacement . trim ( ) . split ( "[\n\r]+" ) ; int minIndent = Integer . MAX_VALUE ; final Pattern wpP...
Format the given text in order to be suitable for being output as a block .
33,877
protected void generateInnerDocumentationAdapter ( ) { final TypeReference adapter = getCodeElementExtractor ( ) . getInnerBlockDocumentationAdapter ( ) ; final StringConcatenationClient content = new StringConcatenationClient ( ) { protected void appendTo ( TargetStringConcatenation it ) { it . append ( "public class ...
Generate the adapter that supports the inner documentation .
33,878
public void setAutoFormattingEnabled ( Boolean enable ) { final IPreferenceStore store = getWritablePreferenceStore ( null ) ; if ( enable == null ) { store . setToDefault ( AUTOFORMATTING_PROPERTY ) ; } else { store . setValue ( AUTOFORMATTING_PROPERTY , enable . booleanValue ( ) ) ; } }
Enable or disable the auto - formatting feature into the SARL editor .
33,879
public void setReturnType ( String type ) { if ( ! Strings . isEmpty ( type ) && ! Objects . equals ( "void" , type ) && ! Objects . equals ( Void . class . getName ( ) , type ) ) { this . sarlAction . setReturnType ( newTypeRef ( container , type ) ) ; } else { this . sarlAction . setReturnType ( null ) ; } }
Change the return type .
33,880
public void addAnnotation ( String type ) { if ( ! Strings . isEmpty ( type ) ) { XAnnotation annotation = XAnnotationsFactory . eINSTANCE . createXAnnotation ( ) ; annotation . setAnnotationType ( newTypeRef ( getSarlAction ( ) , type ) . getType ( ) ) ; getSarlAction ( ) . getAnnotations ( ) . add ( annotation ) ; } ...
Add an annotation .
33,881
public static void useJanusMessageFormat ( ) { final String format = System . getProperty ( FORMAT_PROPERTY_KEY , null ) ; if ( format == null || format . isEmpty ( ) ) { System . setProperty ( FORMAT_PROPERTY_KEY , JANUS_FORMAT ) ; } }
Change the configuration of the root logger for using the Janus format for the messages .
33,882
public static Logger createPlatformLogger ( ) { final Logger logger = Logger . getAnonymousLogger ( ) ; for ( final Handler handler : logger . getHandlers ( ) ) { logger . removeHandler ( handler ) ; } final Handler stderr = new StandardErrorOutputConsoleHandler ( ) ; stderr . setLevel ( Level . ALL ) ; final Handler s...
Create a logger with the given name for the platform .
33,883
public static Level getLoggingLevelFromProperties ( ) { if ( levelFromProperties == null ) { final String verboseLevel = JanusConfig . getSystemProperty ( JanusConfig . VERBOSE_LEVEL_NAME , JanusConfig . VERBOSE_LEVEL_VALUE ) ; levelFromProperties = parseLoggingLevel ( verboseLevel ) ; } return levelFromProperties ; }
Extract the logging level from the system properties .
33,884
@ SuppressWarnings ( { "checkstyle:returncount" , "checkstyle:cyclomaticcomplexity" } ) public static Level parseLoggingLevel ( String level ) { if ( level == null ) { return Level . INFO ; } switch ( level . toLowerCase ( ) ) { case "none" : case "false" : case "0" : return Level . OFF ; case "severe" : case "error" :...
Extract the logging level from the given string .
33,885
@ SuppressWarnings ( { "checkstyle:magicnumber" , "checkstyle:returncount" } ) public static Level fromInt ( int num ) { switch ( num ) { case 0 : return Level . OFF ; case 1 : return Level . SEVERE ; case 2 : return Level . WARNING ; case 3 : return Level . INFO ; case 4 : return Level . FINE ; case 5 : return Level ....
Convert a numerical representation of logging level to the logging level .
33,886
@ SuppressWarnings ( { "checkstyle:magicnumber" , "checkstyle:returncount" , "checkstyle:npathcomplexity" } ) public static int toInt ( Level level ) { if ( level == Level . OFF ) { return 0 ; } if ( level == Level . SEVERE ) { return 1 ; } if ( level == Level . WARNING ) { return 2 ; } if ( level == Level . INFO ) { r...
Convert a logging level to its numerical equivalent .
33,887
public static void startServices ( IServiceManager manager ) { final List < Service > otherServices = new ArrayList < > ( ) ; final List < Service > infraServices = new ArrayList < > ( ) ; final LinkedList < DependencyNode > serviceQueue = new LinkedList < > ( ) ; final Accessors accessors = new StartingPhaseAccessors ...
Start the services associated to the given service manager .
33,888
public static void stopServices ( IServiceManager manager ) { final List < Service > otherServices = new ArrayList < > ( ) ; final List < Service > infraServices = new ArrayList < > ( ) ; final LinkedList < DependencyNode > serviceQueue = new LinkedList < > ( ) ; final Accessors accessors = new StoppingPhaseAccessors (...
Stop the services associated to the given service manager .
33,889
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) private static void runDependencyGraph ( Queue < DependencyNode > roots , List < Service > infraServices , List < Service > freeServices , Accessors accessors ) { final boolean async = accessors . isAsyncStateWaitingEnabled ( ) ; final Set < Class < ? extends Service ...
Run the dependency graph for the services .
33,890
public static SynchronizedIterable < AgentContext > getContextsOf ( Agent agent ) throws Exception { final ExternalContextAccess skill = SREutils . getInternalSkill ( agent , ExternalContextAccess . class ) ; assert skill != null ; return skill . getAllContexts ( ) ; }
Replies the contexts in which the agent is located .
33,891
public static AgentContext getContextIn ( Agent agent ) throws Exception { final InnerContextAccess skill = SREutils . getInternalSkill ( agent , InnerContextAccess . class ) ; if ( skill instanceof InnerContextSkill ) { final InnerContextSkill janusSkill = ( InnerContextSkill ) skill ; if ( janusSkill . hasInnerContex...
Replies the inner context of the agent if it was created .
33,892
@ SuppressWarnings ( "static-method" ) protected void _toJavaStatement ( SarlBreakExpression breakExpression , ITreeAppendable appendable , boolean isReferenced ) { appendable . newLine ( ) . append ( "break;" ) ; }
Generate the Java code related to the preparation statements for the break keyword .
33,893
@ SuppressWarnings ( "static-method" ) protected Map < XVariableDeclaration , XFeatureCall > getReferencedLocalVariable ( XExpression expression , boolean onlyWritable ) { final Map < XVariableDeclaration , XFeatureCall > localVariables = new TreeMap < > ( ( k1 , k2 ) -> { return k1 . getIdentifier ( ) . compareTo ( k2...
Replies all the variables that are referenced into the given expression .
33,894
protected boolean isAtLeastJava8 ( EObject context ) { return this . generatorConfigProvider . get ( EcoreUtil . getRootContainer ( context ) ) . getJavaSourceVersion ( ) . isAtLeast ( JavaVersion . JAVA8 ) ; }
Replies if the generation is for Java version 8 at least .
33,895
protected void _toJavaExpression ( SarlAssertExpression assertExpression , ITreeAppendable appendable ) { if ( ! assertExpression . isIsStatic ( ) && isAtLeastJava8 ( assertExpression ) ) { appendable . append ( "/* error - couldn't compile nested assert */" ) ; } }
Generate the Java code related to the expression for the assert keyword .
33,896
protected void jvmOperationCallToJavaExpression ( final XExpression sourceObject , final JvmOperation operation , XExpression receiver , List < XExpression > arguments , ITreeAppendable appendable ) { String name = null ; assert operation != null ; if ( appendable . hasName ( operation ) ) { name = appendable . getName...
Generate the Java expression for the given JVM operation .
33,897
@ SuppressWarnings ( "static-method" ) protected boolean canBeNotStaticAnonymousClass ( XClosure closure , LightweightTypeReference typeRef , JvmOperation operation ) { return ! typeRef . isSubtypeOf ( Serializable . class ) ; }
Replies if the given closure could be represented by an not static anonymous class .
33,898
Collection < V > wrapValues ( K key , Collection < V > values ) { final Object backEnd = DataViewDelegate . undelegate ( values ) ; if ( backEnd instanceof List < ? > ) { return new SingleKeyValueListView ( key , ( List < V > ) values ) ; } if ( backEnd instanceof Set < ? > ) { return new SingleKeyValueSetView ( key , ...
Wrap the given values into a dedicated view .
33,899
@ SuppressWarnings ( { "unchecked" , "checkstyle:illegaltype" } ) Collection < V > copyValues ( Collection < V > values ) { final Object backEnd = DataViewDelegate . undelegate ( values ) ; if ( backEnd instanceof List < ? > ) { return Lists . newArrayList ( values ) ; } if ( backEnd instanceof TreeSet < ? > ) { TreeSe...
Copy the given values .