idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
33,600
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) private void createImplicitActionReturnType ( XtextResource resource , IAcceptor < ? super ICodeMining > acceptor ) { final List < XtendFunction > actions = EcoreUtil2 . eAllOfType ( resource . getContents ( ) . get ( 0 ) , XtendFunction . class ) ; for ( final XtendF...
Add an annotation when the action s return type is implicit and inferred by the SARL compiler .
33,601
public Set < String > getPureKeywords ( ) { Set < String > kws = this . pureSarlKeywords == null ? null : this . pureSarlKeywords . get ( ) ; if ( kws == null ) { kws = new HashSet < > ( ) ; kws . add ( getAsKeyword ( ) ) ; kws . add ( getRequiresKeyword ( ) ) ; kws . add ( getWithKeyword ( ) ) ; kws . add ( getItKeywo...
Replies the pure SARL keywords . Pure SARL keywords are SARL keywords that are not Java keywords .
33,602
public String protectKeyword ( String text ) { if ( ! Strings . isEmpty ( text ) && isKeyword ( text ) ) { return "^" + text ; } return text ; }
Protect the given text if it is a keyword .
33,603
public void checkImportsMapping ( XImportDeclaration importDeclaration ) { final JvmDeclaredType type = importDeclaration . getImportedType ( ) ; doTypeMappingCheck ( importDeclaration , type , this . typeErrorHandler1 ) ; }
Check that import mapping are known .
33,604
public static void importMavenProject ( IWorkspaceRoot workspaceRoot , String projectName , boolean addSarlSpecificSourceFolders , IProgressMonitor monitor ) { final WorkspaceJob bugFixJob = new WorkspaceJob ( "Creating Simple Maven project" ) { @ SuppressWarnings ( "synthetic-access" ) public IStatus runInWorkspace ( ...
Create a fresh Maven project from existing files assuming a pom file exists .
33,605
static List < IMavenProjectImportResult > runFixedImportJob ( boolean addSarlSpecificSourceFolders , Collection < MavenProjectInfo > projectInfos , ProjectImportConfiguration importConfiguration , IProjectCreationListener projectCreationListener , IProgressMonitor monitor ) throws CoreException { final List < IMavenPro...
Run the job that execute a fixed import of a Maven project .
33,606
static void forceSimplePom ( File projectDir , IProgressMonitor monitor ) throws IOException { final File pomFile = new File ( projectDir , POM_FILE ) ; if ( pomFile . exists ( ) ) { final SubMonitor submon = SubMonitor . convert ( monitor , 4 ) ; final File savedPomFile = new File ( projectDir , POM_BACKUP_FILE ) ; if...
Force the pom file of a project to be simple .
33,607
public final Set < String > getBundleDependencies ( ) { final Set < String > bundles = new TreeSet < > ( ) ; updateBundleList ( bundles ) ; return bundles ; }
Replies the list of the symbolic names of the bundle dependencies .
33,608
@ SuppressWarnings ( "static-method" ) @ Inline ( value = "$1.getCaller()" , imported = Capacities . class , constantExpression = true ) protected AgentTrait getCaller ( ) { return Capacities . getCaller ( ) ; }
Replies the caller of the capacity functions .
33,609
void unregisterUse ( ) { final int value = this . uses . decrementAndGet ( ) ; if ( value == 0 ) { uninstall ( UninstallationStage . PRE_DESTROY_EVENT ) ; uninstall ( UninstallationStage . POST_DESTROY_EVENT ) ; } }
Mark this skill as release by one user .
33,610
protected void generateIFormalParameterBuilder ( ) { final TypeReference builder = getFormalParameterBuilderInterface ( ) ; final StringConcatenationClient content = new StringConcatenationClient ( ) { protected void appendTo ( TargetStringConcatenation it ) { it . append ( "/** Builder of a " + getLanguageName ( ) + "...
Generate the formal parameter builder interface .
33,611
protected void generateFormalParameterAppender ( ) { final CodeElementExtractor . ElementDescription parameter = getCodeElementExtractor ( ) . getFormalParameter ( ) ; final String accessor = "get" + Strings . toFirstUpper ( parameter . getElementType ( ) . getSimpleName ( ) ) + "()" ; final TypeReference builderInterf...
Generate the formal parameter appender .
33,612
protected void fireContextCreated ( AgentContext context ) { final ContextRepositoryListener [ ] ilisteners = this . listeners . getListeners ( ContextRepositoryListener . class ) ; this . logger . getKernelLogger ( ) . info ( MessageFormat . format ( Messages . StandardContextSpaceService_0 , context . getID ( ) ) ) ;...
Notifies the listeners about a context creation .
33,613
protected void fireContextDestroyed ( AgentContext context ) { final ContextRepositoryListener [ ] ilisteners = this . listeners . getListeners ( ContextRepositoryListener . class ) ; this . logger . getKernelLogger ( ) . info ( MessageFormat . format ( Messages . StandardContextSpaceService_1 , context . getID ( ) ) )...
Notifies the listeners about a context destruction .
33,614
protected void removeDefaultSpaceDefinition ( SpaceID spaceID ) { AgentContext context = null ; synchronized ( mutex ( ) ) { context = this . contexts . remove ( spaceID . getContextID ( ) ) ; } if ( context != null ) { fireContextDestroyed ( context ) ; } }
Update the internal data structure when a default space was removed .
33,615
public void addRequirement ( String requirement ) { if ( ! Strings . isEmpty ( requirement ) ) { if ( this . requirements == null ) { this . requirements = new ArrayList < > ( ) ; } this . requirements . add ( requirement ) ; } }
Add a TeX requirement .
33,616
@ SuppressWarnings ( "static-method" ) protected boolean generateOptions ( IStyleAppendable it ) { it . appendNl ( "\\newif\\ifusesarlcolors\\usesarlcolorstrue" ) ; it . appendNl ( "\\DeclareOption{sarlcolors}{\\global\\usesarlcolorstrue}" ) ; it . appendNl ( "\\DeclareOption{nosarlcolors}{\\global\\usesarlcolorsfalse}...
Generate the optional extensions .
33,617
public void setKey ( @ Named ( NetworkConfig . AES_KEY ) String key ) throws Exception { final byte [ ] raw = key . getBytes ( NetworkConfig . getStringEncodingCharset ( ) ) ; final int keySize = raw . length ; if ( ( keySize % 16 ) == 0 || ( keySize % 24 ) == 0 || ( keySize % 32 ) == 0 ) { this . skeySpec = new Secret...
Change the encryption key .
33,618
@ SuppressWarnings ( "static-method" ) protected void getLinkForPrimitive ( Content link , LinkInfo linkInfo , Type type ) { link . addContent ( type . typeName ( ) ) ; }
Build the link for the primitive .
33,619
protected void getLinkForAnnotationType ( Content link , LinkInfo linkInfo , Type type ) { link . addContent ( getTypeAnnotationLinks ( linkInfo ) ) ; linkInfo . type = type . asAnnotatedType ( ) . underlyingType ( ) ; link . addContent ( getLink ( linkInfo ) ) ; }
Build the link for the annotation type .
33,620
protected void getLinkForWildcard ( Content link , LinkInfo linkInfo , Type type ) { linkInfo . isTypeBound = true ; link . addContent ( "?" ) ; final WildcardType wildcardType = type . asWildcardType ( ) ; final Type [ ] extendsBounds = wildcardType . extendsBounds ( ) ; final SARLFeatureAccess kw = Utils . getKeyword...
Build the link for the wildcard .
33,621
protected void getLinkForTypeVariable ( Content link , LinkInfo linkInfo , Type type ) { link . addContent ( getTypeAnnotationLinks ( linkInfo ) ) ; linkInfo . isTypeBound = true ; final Doc owner = type . asTypeVariable ( ) . owner ( ) ; if ( ( ! linkInfo . excludeTypeParameterLinks ) && owner instanceof ClassDoc ) { ...
Build the link for the type variable .
33,622
protected void setBoundsLinkInfo ( LinkInfo linkInfo , Type bound ) { Reflect . callProc ( this , LinkFactory . class , "setBoundsLinkInfo" , new Class < ? > [ ] { LinkInfo . class , Type . class } , linkInfo , bound ) ; }
Change the bounds into the link info .
33,623
protected Content getLinkForClass ( Content link , LinkInfo linkInfo , Type type ) { if ( linkInfo . isTypeBound && linkInfo . excludeTypeBoundsLinks ) { link . addContent ( type . typeName ( ) ) ; link . addContent ( getTypeParameterLinks ( linkInfo ) ) ; return null ; } linkInfo . classDoc = type . asClassDoc ( ) ; f...
Build the link for the class .
33,624
protected void updateLinkLabel ( LinkInfo linkInfo ) { if ( linkInfo . type != null && linkInfo instanceof LinkInfoImpl ) { final LinkInfoImpl impl = ( LinkInfoImpl ) linkInfo ; final ClassDoc classdoc = linkInfo . type . asClassDoc ( ) ; if ( classdoc != null ) { final SARLFeatureAccess kw = Utils . getKeywords ( ) ; ...
Update the label of the given link with the SARL notation for lambdas .
33,625
protected Content createProcedureLambdaLabel ( LinkInfoImpl linkInfo ) { final ParameterizedType type = linkInfo . type . asParameterizedType ( ) ; if ( type != null ) { final Type [ ] arguments = type . typeArguments ( ) ; if ( arguments != null && arguments . length > 0 ) { return createLambdaLabel ( linkInfo , argum...
Create the label for a procedure lambda .
33,626
@ SuppressWarnings ( "static-method" ) public CompilerCommand provideSarlcCompilerCommand ( Provider < SarlBatchCompiler > compiler , Provider < SarlConfig > configuration , Provider < PathDetector > pathDetector , Provider < ProgressBarConfig > commandConfig ) { return new CompilerCommand ( compiler , configuration , ...
Provide the command for running the compiler .
33,627
@ SuppressWarnings ( "static-method" ) public ProgressBarConfig getProgressBarConfig ( ConfigurationFactory configFactory , Injector injector ) { final ProgressBarConfig config = ProgressBarConfig . getConfiguration ( configFactory ) ; injector . injectMembers ( config ) ; return config ; }
Replies the instance of the compiler command configuration .
33,628
public static JvmType filterActiveProcessorType ( JvmType type , CommonTypeComputationServices services ) { if ( AccessorsProcessor . class . getName ( ) . equals ( type . getQualifiedName ( ) ) ) { return services . getTypeReferences ( ) . findDeclaredType ( SarlAccessorsProcessor . class , type ) ; } return type ; }
Filter the type in order to create the correct processor .
33,629
public ImageDescriptor forAgent ( JvmVisibility visibility , int flags ) { return getDecorated ( getTypeImageDescriptor ( SarlElementType . AGENT , false , false , toFlags ( visibility ) , USE_LIGHT_ICONS ) , flags ) ; }
Replies the image descriptor for the agents .
33,630
public ImageDescriptor forBehavior ( JvmVisibility visibility , int flags ) { return getDecorated ( getTypeImageDescriptor ( SarlElementType . BEHAVIOR , false , false , toFlags ( visibility ) , USE_LIGHT_ICONS ) , flags ) ; }
Replies the image descriptor for the behaviors .
33,631
public ImageDescriptor forCapacity ( JvmVisibility visibility , int flags ) { return getDecorated ( getTypeImageDescriptor ( SarlElementType . CAPACITY , false , false , toFlags ( visibility ) , USE_LIGHT_ICONS ) , flags ) ; }
Replies the image descriptor for the capacities .
33,632
public ImageDescriptor forSkill ( JvmVisibility visibility , int flags ) { return getDecorated ( getTypeImageDescriptor ( SarlElementType . SKILL , false , false , toFlags ( visibility ) , USE_LIGHT_ICONS ) , flags ) ; }
Replies the image descriptor for the skills .
33,633
public ImageDescriptor forEvent ( JvmVisibility visibility , int flags ) { return getDecorated ( getTypeImageDescriptor ( SarlElementType . EVENT , false , false , toFlags ( visibility ) , USE_LIGHT_ICONS ) , flags ) ; }
Replies the image descriptor for the events .
33,634
public ImageDescriptor forBehaviorUnit ( ) { return getDecorated ( getTypeImageDescriptor ( SarlElementType . BEHAVIOR_UNIT , false , false , toFlags ( JvmVisibility . PUBLIC ) , USE_LIGHT_ICONS ) , 0 ) ; }
Replies the image descriptor for the behavior units .
33,635
public ImageDescriptor forStaticConstructor ( ) { return getDecorated ( getMethodImageDescriptor ( false , toFlags ( JvmVisibility . PUBLIC ) ) , JavaElementImageDescriptor . CONSTRUCTOR | JavaElementImageDescriptor . STATIC ) ; }
Replies the image descriptor for the static constructors .
33,636
public static URL getPomTemplateLocation ( ) { final URL url = Resources . getResource ( NewSarlProjectWizard . class , POM_TEMPLATE_BASENAME ) ; assert url != null ; return url ; }
Replies the location of a template for the pom files .
33,637
protected boolean validateSARLSpecificElements ( IJavaProject javaProject ) { final IPath outputPath = SARLPreferences . getSARLOutputPathFor ( javaProject . getProject ( ) ) ; if ( outputPath == null ) { final String message = MessageFormat . format ( Messages . BuildSettingWizardPage_0 , SARLConfig . FOLDER_SOURCE_GE...
Validate the SARL properties of the new projects .
33,638
protected void createDefaultMavenPom ( IJavaProject project , String compilerCompliance ) { final URL templateUrl = getPomTemplateLocation ( ) ; if ( templateUrl != null ) { final String compliance = Strings . isNullOrEmpty ( compilerCompliance ) ? SARLVersion . MINIMAL_JDK_VERSION : compilerCompliance ; final String g...
Create the default Maven pom file for the project .
33,639
@ SuppressWarnings ( "static-method" ) protected String getDefaultMavenGroupId ( ) { final String userdomain = System . getenv ( "userdomain" ) ; if ( Strings . isNullOrEmpty ( userdomain ) ) { return "com.foo" ; } final String [ ] elements = userdomain . split ( Pattern . quote ( "." ) ) ; final StringBuilder groupId ...
Replies the default group id for a maven project .
33,640
IWorkbenchPart getActivePart ( ) { final IWorkbenchWindow activeWindow = getWorkbench ( ) . getActiveWorkbenchWindow ( ) ; if ( activeWindow != null ) { final IWorkbenchPage activePage = activeWindow . getActivePage ( ) ; if ( activePage != null ) { return activePage . getActivePart ( ) ; } } return null ; }
Replies the active part in the workbench .
33,641
public static String getCurrentClasspath ( ) { final StringBuilder path = new StringBuilder ( ) ; for ( final URL url : getCurrentClassLoader ( ) . getURLs ( ) ) { if ( path . length ( ) > 0 ) { path . append ( File . pathSeparator ) ; } final File file = FileSystem . convertURLToFile ( url ) ; if ( file != null ) { pa...
Replies the current class path .
33,642
private static URLClassLoader getCurrentClassLoader ( ) { synchronized ( Boot . class ) { if ( dynamicClassLoader == null ) { final ClassLoader cl = ClassLoader . getSystemClassLoader ( ) ; if ( cl instanceof URLClassLoader ) { dynamicClassLoader = ( URLClassLoader ) cl ; } else { dynamicClassLoader = URLClassLoader . ...
Replies the current class loader .
33,643
@ SuppressWarnings ( "checkstyle:nestedifdepth" ) public static void addToSystemClasspath ( String entries ) { if ( ! Strings . isNullOrEmpty ( entries ) ) { final List < URL > cp = new ArrayList < > ( ) ; final String [ ] individualEntries = entries . split ( Pattern . quote ( File . pathSeparator ) ) ; for ( final St...
Add the given entries to the system classpath .
33,644
public static void main ( String [ ] args ) { try { Object [ ] freeArgs = parseCommandLine ( args ) ; if ( JanusConfig . getSystemPropertyAsBoolean ( JanusConfig . JANUS_LOGO_SHOW_NAME , JanusConfig . JANUS_LOGO_SHOW . booleanValue ( ) ) ) { showJanusLogo ( ) ; } if ( freeArgs . length == 0 ) { showError ( Messages . B...
Main function that is parsing the command line and launching the first agent .
33,645
public static Options getOptions ( ) { final Options options = new Options ( ) ; options . addOption ( CLI_OPTION_CLASSPATH_SHORT , CLI_OPTION_CLASSPATH_LONG , true , Messages . Boot_24 ) ; options . addOption ( CLI_OPTION_EMBEDDED_SHORT , CLI_OPTION_EMBEDDED_LONG , false , Messages . Boot_5 ) ; options . addOption ( C...
Replies the command line options supported by this boot class .
33,646
@ SuppressWarnings ( "checkstyle:regexp" ) public static void showError ( String message , Throwable exception ) { try ( PrintWriter logger = new PrintWriter ( getConsoleLogger ( ) ) ) { if ( message != null && ! message . isEmpty ( ) ) { logger . println ( message ) ; } else if ( exception != null ) { exception . prin...
Show an error message and exit .
33,647
public static String getProgramName ( ) { String programName = JanusConfig . getSystemProperty ( JanusConfig . JANUS_PROGRAM_NAME , null ) ; if ( Strings . isNullOrEmpty ( programName ) ) { programName = JanusConfig . JANUS_PROGRAM_NAME_VALUE ; } return programName ; }
Replies the name of the program .
33,648
@ SuppressWarnings ( "checkstyle:regexp" ) public static void showDefaults ( ) { final Properties defaultValues = new Properties ( ) ; JanusConfig . getDefaultValues ( defaultValues ) ; NetworkConfig . getDefaultValues ( defaultValues ) ; try ( OutputStream os = getConsoleLogger ( ) ) { defaultValues . storeToXML ( os ...
Show the default values of the system properties . This function never returns .
33,649
@ SuppressWarnings ( { "resource" } ) public static void showClasspath ( ) { final String cp = getCurrentClasspath ( ) ; if ( ! Strings . isNullOrEmpty ( cp ) ) { final PrintStream ps = getConsoleLogger ( ) ; for ( final String entry : cp . split ( Pattern . quote ( File . pathSeparator ) ) ) { ps . println ( entry ) ;...
Show the classpath of the system properties . This function never returns .
33,650
public static void showVersion ( boolean exit ) { try ( PrintWriter logger = new PrintWriter ( getConsoleLogger ( ) ) ) { logger . println ( MessageFormat . format ( Messages . Boot_26 , JanusVersion . JANUS_RELEASE_VERSION ) ) ; logger . println ( MessageFormat . format ( Messages . Boot_27 , SARLVersion . SPECIFICATI...
Show the version of Janus .
33,651
@ SuppressWarnings ( "checkstyle:regexp" ) public static void showCommandLineArguments ( String [ ] args ) { try ( PrintStream os = getConsoleLogger ( ) ) { for ( int i = 0 ; i < args . length ; ++ i ) { os . println ( i + ": " + args [ i ] ) ; } os . flush ( ) ; } catch ( Throwable e ) { e . printStackTrace ( ) ; } ge...
Show the command line arguments . This function never returns .
33,652
public static void setBootAgentTypeContextUUID ( ) { System . setProperty ( JanusConfig . BOOT_DEFAULT_CONTEXT_ID_NAME , Boolean . TRUE . toString ( ) ) ; System . setProperty ( JanusConfig . RANDOM_DEFAULT_CONTEXT_ID_NAME , Boolean . FALSE . toString ( ) ) ; }
Force the Janus platform to use a default context identifier that tis build upon the classname of the boot agent . It means that the UUID is always the same for a given classname .
33,653
public static void setDefaultContextUUID ( ) { System . setProperty ( JanusConfig . BOOT_DEFAULT_CONTEXT_ID_NAME , Boolean . FALSE . toString ( ) ) ; System . setProperty ( JanusConfig . RANDOM_DEFAULT_CONTEXT_ID_NAME , Boolean . FALSE . toString ( ) ) ; }
Force the Janus platform to use the identifier hard - coded in the source code for its default context .
33,654
public static Integer getSarlClassification ( ProgramElementDoc type ) { final AnnotationDesc annotation = Utils . findFirst ( type . annotations ( ) , it -> qualifiedNameEquals ( it . annotationType ( ) . qualifiedTypeName ( ) , getKeywords ( ) . getSarlElementTypeAnnotationName ( ) ) ) ; if ( annotation != null ) { f...
Replies the SARL element type of the given type .
33,655
public static String fixHiddenMember ( String name ) { return name . replaceAll ( Pattern . quote ( HIDDEN_MEMBER_CHARACTER ) , Matcher . quoteReplacement ( HIDDEN_MEMBER_REPLACEMENT_CHARACTER ) ) ; }
Replies a fixed version of the given name assuming that it is an hidden action and reformating the reserved text .
33,656
public static boolean qualifiedNameEquals ( String s1 , String s2 ) { if ( isNullOrEmpty ( s1 ) ) { return isNullOrEmpty ( s2 ) ; } if ( ! s1 . equals ( s2 ) ) { final String simple1 = simpleName ( s1 ) ; final String simple2 = simpleName ( s2 ) ; return simpleNameEquals ( simple1 , simple2 ) ; } return true ; }
Replies if the given qualified names are equal .
33,657
public static String simpleName ( String name ) { if ( name == null ) { return null ; } final int index = name . lastIndexOf ( '.' ) ; if ( index > 0 ) { return name . substring ( index + 1 ) ; } return name ; }
Replies the simple name for the given name .
33,658
public static Throwable getCause ( Throwable thr ) { Throwable cause = thr . getCause ( ) ; while ( cause != null && cause != thr && cause != cause . getCause ( ) && cause . getCause ( ) != null ) { cause = cause . getCause ( ) ; } return cause == null ? thr : cause ; }
Replies the cause of the given exception .
33,659
public static void performCopy ( String filename , SarlConfiguration configuration ) { if ( filename . isEmpty ( ) ) { return ; } try { final DocFile fromfile = DocFile . createFileForInput ( configuration , filename ) ; final DocPath path = DocPath . create ( fromfile . getName ( ) ) ; final DocFile toFile = DocFile ....
Copy the given file .
33,660
public static < T > com . sun . tools . javac . util . List < T > emptyList ( ) { return com . sun . tools . javac . util . List . from ( Collections . emptyList ( ) ) ; }
Create an empty Java list .
33,661
@ SuppressWarnings ( "unchecked" ) public static < T > T [ ] toArray ( T [ ] source , Collection < ? extends T > newContent ) { final Object array = Array . newInstance ( source . getClass ( ) . getComponentType ( ) , newContent . size ( ) ) ; int i = 0 ; for ( final T element : newContent ) { Array . set ( array , i ,...
Convert to an array .
33,662
protected IPreferenceStoreAccess getPreferenceStoreAccess ( ) { if ( this . preferenceStoreAccess == null ) { final Injector injector = LangActivator . getInstance ( ) . getInjector ( LangActivator . IO_SARL_LANG_SARL ) ; this . preferenceStoreAccess = injector . getInstance ( IPreferenceStoreAccess . class ) ; } retur...
Replies the preference accessor .
33,663
public IPreferenceStore getWritablePreferenceStore ( Object context ) { if ( this . preferenceStore == null ) { this . preferenceStore = getPreferenceStoreAccess ( ) . getWritablePreferenceStore ( context ) ; } return this . preferenceStore ; }
Replies the writable preference store to be used for the SARL editor .
33,664
public static String getSystemProperty ( String name , String defaultValue ) { String value ; value = System . getProperty ( name , null ) ; if ( value != null ) { return value ; } value = System . getenv ( name ) ; if ( value != null ) { return value ; } return defaultValue ; }
Replies the value of the system property .
33,665
public static boolean getSystemPropertyAsBoolean ( String name , boolean defaultValue ) { final String value = getSystemProperty ( name , null ) ; if ( value != null ) { try { return Boolean . parseBoolean ( value ) ; } catch ( Throwable exception ) { } } return defaultValue ; }
Replies the value of the boolean system property .
33,666
public static float getSystemPropertyAsFloat ( String name , float defaultValue ) { final String value = getSystemProperty ( name , null ) ; if ( value != null ) { try { return Float . parseFloat ( value ) ; } catch ( Throwable exception ) { } } return defaultValue ; }
Replies the value of the single precision floating point value system property .
33,667
public static < S extends Enum < S > > S getSystemPropertyAsEnum ( Class < S > type , String name ) { return getSystemPropertyAsEnum ( type , name , null ) ; }
Replies the value of the enumeration system property .
33,668
protected boolean isSarlFile ( IPackageFragment packageFragment , String filename ) { if ( isFileExists ( packageFragment , filename , this . sarlFileExtension ) ) { return true ; } final IJavaProject project = getPackageFragmentRoot ( ) . getJavaProject ( ) ; if ( project != null ) { try { final String packageName = p...
Replies if the given filename is a SARL script or a generated Java file .
33,669
protected static boolean isFileExists ( IPackageFragment packageFragment , String filename , String extension ) { if ( packageFragment != null ) { final IResource resource = packageFragment . getResource ( ) ; if ( resource instanceof IFolder ) { final IFolder folder = ( IFolder ) resource ; if ( folder . getFile ( fil...
Replies if the given filename is a SARL script in the given package .
33,670
protected void init ( IStructuredSelection selection ) { final IJavaElement elem = this . fieldInitializer . getSelectedResource ( selection ) ; initContainerPage ( elem ) ; initTypePage ( elem ) ; try { getRootSuperType ( ) ; reinitSuperClass ( ) ; } catch ( Throwable exception ) { } try { getRootSuperInterface ( ) ; ...
Invoked by the wizard for initializing the page with the given selection .
33,671
protected Composite createCommonControls ( Composite parent ) { initializeDialogUnits ( parent ) ; final Composite composite = SWTFactory . createComposite ( parent , parent . getFont ( ) , COLUMNS , 1 , GridData . FILL_HORIZONTAL ) ; createContainerControls ( composite , COLUMNS ) ; createPackageControls ( composite ,...
Create the components that are common to the creation of all the SARL elements .
33,672
protected final int asyncCreateType ( ) { final int [ ] size = { 0 } ; final IRunnableWithProgress op = new WorkspaceModifyOperation ( ) { protected void execute ( IProgressMonitor monitor ) throws CoreException , InvocationTargetException , InterruptedException { size [ 0 ] = createSARLType ( monitor ) ; } } ; try { g...
Create the type from the data gathered in the wizard .
33,673
protected void readSettings ( ) { boolean createConstructors = false ; boolean createUnimplemented = true ; boolean createEventHandlers = true ; boolean createLifecycleFunctions = true ; final IDialogSettings dialogSettings = getDialogSettings ( ) ; if ( dialogSettings != null ) { final IDialogSettings section = dialog...
Read the settings of the dialog box .
33,674
protected void saveSettings ( ) { final IDialogSettings dialogSettings = getDialogSettings ( ) ; if ( dialogSettings != null ) { IDialogSettings section = dialogSettings . getSection ( getName ( ) ) ; if ( section == null ) { section = dialogSettings . addNewSection ( getName ( ) ) ; } section . put ( SETTINGS_CREATECO...
Save the settings of the dialog box .
33,675
protected void createMethodStubControls ( Composite composite , int columns , boolean enableConstructors , boolean enableInherited , boolean defaultEvents , boolean lifecycleFunctions ) { this . isConstructorCreationEnabled = enableConstructors ; this . isInheritedCreationEnabled = enableInherited ; this . isDefaultEve...
Create the controls related to the behavior units to generate .
33,676
protected boolean isCreateStandardEventHandlers ( ) { int idx = 0 ; if ( this . isConstructorCreationEnabled ) { ++ idx ; } if ( this . isInheritedCreationEnabled ) { ++ idx ; } return this . isDefaultEventGenerated && this . methodStubsButtons . isSelected ( idx ) ; }
Returns the current selection state of the Create standard event handlers checkbox .
33,677
protected boolean isCreateStandardLifecycleFunctions ( ) { int idx = 0 ; if ( this . isConstructorCreationEnabled ) { ++ idx ; } if ( this . isInheritedCreationEnabled ) { ++ idx ; } if ( this . isDefaultEventGenerated ) { ++ idx ; } return this . isDefaultLifecycleFunctionsGenerated && this . methodStubsButtons . isSe...
Returns the current selection state of the Create standard lifecycle functions checkbox .
33,678
protected void setMethodStubSelection ( boolean createConstructors , boolean createInherited , boolean createEventHandlers , boolean createLifecycleFunctions , boolean canBeModified ) { if ( this . methodStubsButtons != null ) { int idx = 0 ; if ( this . isConstructorCreationEnabled ) { this . methodStubsButtons . setS...
Sets the selection state of the method stub checkboxes .
33,679
@ SuppressWarnings ( "static-method" ) protected AbstractSuperTypeSelectionDialog < ? > createSuperClassSelectionDialog ( Shell parent , IRunnableContext context , IJavaProject project , SarlSpecificTypeSelectionExtension extension , boolean multi ) { return null ; }
Create an instanceof the super - class selection dialog .
33,680
protected boolean createStandardSARLEventTemplates ( String elementTypeName , Function1 < ? super String , ? extends ISarlBehaviorUnitBuilder > behaviorUnitAdder , Procedure1 < ? super String > usesAdder ) { if ( ! isCreateStandardEventHandlers ( ) ) { return false ; } Object type ; try { type = getTypeFinder ( ) . fin...
Create the default standard SARL event templates .
33,681
protected boolean createStandardSARLLifecycleFunctionTemplates ( String elementTypeName , Function1 < ? super String , ? extends ISarlActionBuilder > actionAdder , Procedure1 < ? super String > usesAdder ) { if ( ! isCreateStandardLifecycleFunctions ( ) ) { return false ; } usesAdder . apply ( LOGGING_CAPACITY_NAME ) ;...
Create the default standard lifecycle function templates .
33,682
public static IProject getProject ( Resource resource ) { ProjectAdapter adapter = ( ProjectAdapter ) EcoreUtil . getAdapter ( resource . getResourceSet ( ) . eAdapters ( ) , ProjectAdapter . class ) ; if ( adapter == null ) { final String platformString = resource . getURI ( ) . toPlatformString ( true ) ; final IProj...
Get the project associated to the resource .
33,683
protected MavenImportWizardPage getMavenImportWizardPage ( ) { if ( this . mainPageBuffer == null ) { try { final Field field = MavenImportWizard . class . getDeclaredField ( "page" ) ; field . setAccessible ( true ) ; this . mainPageBuffer = ( MavenImportWizardPage ) field . get ( this ) ; } catch ( Exception exceptio...
Replies the main configuration page .
33,684
protected WorkspaceJob createImportJob ( Collection < MavenProjectInfo > projects ) { final WorkspaceJob job = new ImportMavenSarlProjectsJob ( projects , this . workingSets , this . importConfiguration ) ; job . setRule ( MavenPlugin . getProjectConfigurationManager ( ) . getRule ( ) ) ; return job ; }
Create the import job .
33,685
public static Version parseVersion ( String version ) { if ( ! Strings . isNullOrEmpty ( version ) ) { try { return Version . parseVersion ( version ) ; } catch ( Throwable exception ) { } } return null ; }
Null - safe version parser .
33,686
public static int compareVersionToRange ( Version version , Version minVersion , Version maxVersion ) { assert minVersion == null || maxVersion == null || minVersion . compareTo ( maxVersion ) < 0 ; if ( version == null ) { return Integer . MIN_VALUE ; } if ( minVersion != null && compareVersionsNoQualifier ( version ,...
Null - safe compare a version number to a range of version numbers .
33,687
public static < T > int compareTo ( Comparable < T > object1 , T object2 ) { if ( object1 == object2 ) { return 0 ; } if ( object1 == null ) { return Integer . MIN_VALUE ; } if ( object2 == null ) { return Integer . MAX_VALUE ; } assert object1 != null && object2 != null ; return object1 . compareTo ( object2 ) ; }
Null - safe comparison .
33,688
public static String getNameWithTypeParameters ( IType type ) { assert type != null ; final String superName = type . getFullyQualifiedName ( '.' ) ; if ( ! JavaModelUtil . is50OrHigher ( type . getJavaProject ( ) ) ) { return superName ; } try { final ITypeParameter [ ] typeParameters = type . getTypeParameters ( ) ; ...
Replies the fully qualified name with generic parameters .
33,689
public static IClasspathEntry newLibraryEntry ( Bundle bundle , IPath precomputedBundlePath , BundleURLMappings javadocURLs ) { assert bundle != null ; final IPath bundlePath ; if ( precomputedBundlePath == null ) { bundlePath = BundleUtil . getBundlePath ( bundle ) ; } else { bundlePath = precomputedBundlePath ; } fin...
Create the classpath library linked to the bundle with the given name .
33,690
@ SuppressWarnings ( "static-method" ) protected BQRuntime createRuntime ( String ... args ) { SARLStandaloneSetup . doPreSetup ( ) ; final BQRuntime runtime = Bootique . app ( args ) . autoLoadModules ( ) . createRuntime ( ) ; SARLStandaloneSetup . doPostSetup ( runtime . getInstance ( Injector . class ) ) ; return ru...
Create the compiler runtime .
33,691
public int runCompiler ( String ... args ) { try { final BQRuntime runtime = createRuntime ( args ) ; final CommandOutcome outcome = runtime . run ( ) ; if ( ! outcome . isSuccess ( ) && outcome . getException ( ) != null ) { Logger . getRootLogger ( ) . error ( outcome . getMessage ( ) , outcome . getException ( ) ) ;...
Run the batch compiler .
33,692
public List < HelpOption > getOptions ( ) { final BQRuntime runtime = createRuntime ( ) ; final ApplicationMetadata application = runtime . getInstance ( ApplicationMetadata . class ) ; final HelpOptions helpOptions = new HelpOptions ( ) ; application . getCommands ( ) . forEach ( c -> { helpOptions . add ( c . asOptio...
Replies the options of the program .
33,693
protected void addAnnotations ( ExecutableMemberDoc member , Content htmlTree ) { WriterUtils . addAnnotations ( member , htmlTree , this . configuration , this . writer ) ; }
Add annotations except the reserved annotations .
33,694
public static void setCurrentPreferenceKey ( String key ) { LOCK . lock ( ) ; try { currentPreferenceKey = ( Strings . isNullOrEmpty ( key ) ) ? DEFAULT_PREFERENCE_KEY : key ; } finally { LOCK . unlock ( ) ; } }
Change the key used for storing the SARL runtime configuration into the preferences .
33,695
public static void fireSREChanged ( PropertyChangeEvent event ) { for ( final Object listener : SRE_LISTENERS . getListeners ( ) ) { ( ( ISREInstallChangedListener ) listener ) . sreChanged ( event ) ; } }
Notifies all SRE install changed listeners of the given property change .
33,696
public static void fireSREAdded ( ISREInstall installation ) { for ( final Object listener : SRE_LISTENERS . getListeners ( ) ) { ( ( ISREInstallChangedListener ) listener ) . sreAdded ( installation ) ; } }
Notifies all SRE install changed listeners of the addition of a SRE .
33,697
public static void fireSRERemoved ( ISREInstall installation ) { for ( final Object listener : SRE_LISTENERS . getListeners ( ) ) { ( ( ISREInstallChangedListener ) listener ) . sreRemoved ( installation ) ; } }
Notifies all SRE install changed listeners of the removed of a SRE .
33,698
public static ISREInstall getSREFromId ( String id ) { if ( Strings . isNullOrEmpty ( id ) ) { return null ; } initializeSREs ( ) ; LOCK . lock ( ) ; try { return ALL_SRE_INSTALLS . get ( id ) ; } finally { LOCK . unlock ( ) ; } }
Return the SRE corresponding to the specified Id .
33,699
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) public static void setSREInstalls ( ISREInstall [ ] sres , IProgressMonitor monitor ) throws CoreException { final SubMonitor mon = SubMonitor . convert ( monitor , io . sarl . eclipse . runtime . Messages . SARLRuntime_0 , sres . length * 2 + ALL_SRE_INSTALLS . size ...
Sets the installed SREs .