idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
33,600
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 .
95
10
33,601
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 .
58
10
33,602
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 .
72
9
33,603
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 . createFileForOutput ( configuration , path ) ; if ( toFile . isSameFile ( fromfile ) ) { return ; } configuration . message . notice ( ( SourcePosition ) null , "doclet.Copying_File_0_To_File_1" , //$NON-NLS-1$ fromfile . toString ( ) , path . getPath ( ) ) ; toFile . copyFile ( fromfile ) ; } catch ( IOException exc ) { configuration . message . error ( ( SourcePosition ) null , "doclet.perform_copy_exception_encountered" , //$NON-NLS-1$ exc . toString ( ) ) ; throw new DocletAbortException ( exc ) ; } }
Copy the given file .
238
5
33,604
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 .
52
6
33,605
@ 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 , element ) ; ++ i ; } return ( T [ ] ) array ; }
Convert to an array .
107
6
33,606
protected IPreferenceStoreAccess getPreferenceStoreAccess ( ) { if ( this . preferenceStoreAccess == null ) { final Injector injector = LangActivator . getInstance ( ) . getInjector ( LangActivator . IO_SARL_LANG_SARL ) ; this . preferenceStoreAccess = injector . getInstance ( IPreferenceStoreAccess . class ) ; } return this . preferenceStoreAccess ; }
Replies the preference accessor .
92
7
33,607
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 .
56
16
33,608
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 .
67
9
33,609
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 .
66
10
33,610
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 .
64
14
33,611
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 .
45
11
33,612
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 = packageFragment . getElementName ( ) ; for ( final IPackageFragmentRoot root : project . getPackageFragmentRoots ( ) ) { final IPackageFragment fragment = root . getPackageFragment ( packageName ) ; if ( isFileExists ( fragment , filename , JAVA_FILE_EXTENSION ) ) { return true ; } } } catch ( JavaModelException exception ) { // silent error } } return false ; }
Replies if the given filename is a SARL script or a generated Java file .
179
17
33,613
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 ( filename + "." + extension ) . exists ( ) ) { //$NON-NLS-1$ return true ; } } } return false ; }
Replies if the given filename is a SARL script in the given package .
107
16
33,614
protected void init ( IStructuredSelection selection ) { final IJavaElement elem = this . fieldInitializer . getSelectedResource ( selection ) ; initContainerPage ( elem ) ; initTypePage ( elem ) ; // try { getRootSuperType ( ) ; reinitSuperClass ( ) ; } catch ( Throwable exception ) { // } // try { getRootSuperInterface ( ) ; reinitSuperInterfaces ( ) ; } catch ( Throwable exception ) { // } // doStatusUpdate ( ) ; }
Invoked by the wizard for initializing the page with the given selection .
112
15
33,615
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 , COLUMNS ) ; createSeparator ( composite , COLUMNS ) ; createTypeNameControls ( composite , COLUMNS ) ; return composite ; }
Create the components that are common to the creation of all the SARL elements .
113
16
33,616
protected final int asyncCreateType ( ) { final int [ ] size = { 0 } ; final IRunnableWithProgress op = new WorkspaceModifyOperation ( ) { @ Override protected void execute ( IProgressMonitor monitor ) throws CoreException , InvocationTargetException , InterruptedException { size [ 0 ] = createSARLType ( monitor ) ; } } ; try { getContainer ( ) . run ( true , false , op ) ; } catch ( InterruptedException e ) { // canceled by user return 0 ; } catch ( InvocationTargetException e ) { final Throwable realException = e . getTargetException ( ) ; SARLEclipsePlugin . getDefault ( ) . openError ( getShell ( ) , getTitle ( ) , realException . getMessage ( ) , realException ) ; } return size [ 0 ] ; }
Create the type from the data gathered in the wizard .
178
11
33,617
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 = dialogSettings . getSection ( getName ( ) ) ; if ( section != null ) { createConstructors = section . getBoolean ( SETTINGS_CREATECONSTR ) ; createUnimplemented = section . getBoolean ( SETTINGS_CREATEUNIMPLEMENTED ) ; createEventHandlers = section . getBoolean ( SETTINGS_GENERATEEVENTHANDLERS ) ; createLifecycleFunctions = section . getBoolean ( SETTINGS_GENERATELIFECYCLEFUNCTIONS ) ; } } setMethodStubSelection ( createConstructors , createUnimplemented , createEventHandlers , createLifecycleFunctions , true ) ; }
Read the settings of the dialog box .
226
8
33,618
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_CREATECONSTR , isCreateConstructors ( ) ) ; section . put ( SETTINGS_CREATEUNIMPLEMENTED , isCreateInherited ( ) ) ; section . put ( SETTINGS_GENERATEEVENTHANDLERS , isCreateStandardEventHandlers ( ) ) ; section . put ( SETTINGS_GENERATELIFECYCLEFUNCTIONS , isCreateStandardLifecycleFunctions ( ) ) ; } }
Save the settings of the dialog box .
179
8
33,619
protected void createMethodStubControls ( Composite composite , int columns , boolean enableConstructors , boolean enableInherited , boolean defaultEvents , boolean lifecycleFunctions ) { this . isConstructorCreationEnabled = enableConstructors ; this . isInheritedCreationEnabled = enableInherited ; this . isDefaultEventGenerated = defaultEvents ; this . isDefaultLifecycleFunctionsGenerated = lifecycleFunctions ; final List < String > nameList = new ArrayList <> ( 4 ) ; if ( enableConstructors ) { nameList . add ( Messages . AbstractNewSarlElementWizardPage_0 ) ; } if ( enableInherited ) { nameList . add ( Messages . AbstractNewSarlElementWizardPage_1 ) ; } if ( defaultEvents ) { nameList . add ( Messages . AbstractNewSarlElementWizardPage_17 ) ; } if ( lifecycleFunctions ) { nameList . add ( Messages . AbstractNewSarlElementWizardPage_18 ) ; } if ( nameList . isEmpty ( ) ) { return ; } final String [ ] buttonNames = new String [ nameList . size ( ) ] ; nameList . toArray ( buttonNames ) ; this . methodStubsButtons = new SelectionButtonDialogFieldGroup ( SWT . CHECK , buttonNames , 1 ) ; this . methodStubsButtons . setLabelText ( Messages . AbstractNewSarlElementWizardPage_2 ) ; final Control labelControl = this . methodStubsButtons . getLabelControl ( composite ) ; LayoutUtil . setHorizontalSpan ( labelControl , columns ) ; DialogField . createEmptySpace ( composite ) ; final Control buttonGroup = this . methodStubsButtons . getSelectionButtonsGroup ( composite ) ; LayoutUtil . setHorizontalSpan ( buttonGroup , columns - 1 ) ; }
Create the controls related to the behavior units to generate .
403
11
33,620
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 .
78
14
33,621
protected boolean isCreateStandardLifecycleFunctions ( ) { int idx = 0 ; if ( this . isConstructorCreationEnabled ) { ++ idx ; } if ( this . isInheritedCreationEnabled ) { ++ idx ; } if ( this . isDefaultEventGenerated ) { ++ idx ; } return this . isDefaultLifecycleFunctionsGenerated && this . methodStubsButtons . isSelected ( idx ) ; }
Returns the current selection state of the Create standard lifecycle functions checkbox .
100
15
33,622
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 . setSelection ( idx , createConstructors ) ; ++ idx ; } if ( this . isInheritedCreationEnabled ) { this . methodStubsButtons . setSelection ( idx , createInherited ) ; ++ idx ; } if ( this . isDefaultEventGenerated ) { this . methodStubsButtons . setSelection ( idx , createEventHandlers ) ; ++ idx ; } if ( this . isDefaultLifecycleFunctionsGenerated ) { this . methodStubsButtons . setSelection ( idx , createLifecycleFunctions ) ; ++ idx ; } this . methodStubsButtons . setEnabled ( canBeModified ) ; } }
Sets the selection state of the method stub checkboxes .
235
12
33,623
@ 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 .
63
11
33,624
protected boolean createStandardSARLEventTemplates ( String elementTypeName , Function1 < ? super String , ? extends ISarlBehaviorUnitBuilder > behaviorUnitAdder , Procedure1 < ? super String > usesAdder ) { if ( ! isCreateStandardEventHandlers ( ) ) { return false ; } Object type ; try { type = getTypeFinder ( ) . findType ( INITIALIZE_EVENT_NAME ) ; } catch ( JavaModelException e ) { type = null ; } if ( type != null ) { // SARL Libraries are on the classpath usesAdder . apply ( LOGGING_CAPACITY_NAME ) ; ISarlBehaviorUnitBuilder unit = behaviorUnitAdder . apply ( INITIALIZE_EVENT_NAME ) ; IBlockExpressionBuilder block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_9 , elementTypeName ) ) ; IExpressionBuilder expr = block . addExpression ( ) ; createInfoCall ( expr , "The " + elementTypeName + " was started." ) ; //$NON-NLS-1$ //$NON-NLS-2$ unit = behaviorUnitAdder . apply ( DESTROY_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_10 , elementTypeName ) ) ; expr = block . addExpression ( ) ; createInfoCall ( expr , "The " + elementTypeName + " was stopped." ) ; //$NON-NLS-1$ //$NON-NLS-2$ unit = behaviorUnitAdder . apply ( AGENTSPAWNED_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_11 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( AGENTKILLED_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_12 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( CONTEXTJOINED_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_13 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( CONTEXTLEFT_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_14 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( MEMBERJOINED_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_15 , elementTypeName ) ) ; unit = behaviorUnitAdder . apply ( MEMBERLEFT_EVENT_NAME ) ; block = unit . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_16 , elementTypeName ) ) ; return true ; } return false ; }
Create the default standard SARL event templates .
764
9
33,625
protected boolean createStandardSARLLifecycleFunctionTemplates ( String elementTypeName , Function1 < ? super String , ? extends ISarlActionBuilder > actionAdder , Procedure1 < ? super String > usesAdder ) { if ( ! isCreateStandardLifecycleFunctions ( ) ) { return false ; } usesAdder . apply ( LOGGING_CAPACITY_NAME ) ; ISarlActionBuilder action = actionAdder . apply ( INSTALL_SKILL_NAME ) ; IBlockExpressionBuilder block = action . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_19 , elementTypeName ) ) ; IExpressionBuilder expr = block . addExpression ( ) ; createInfoCall ( expr , "Installing the " + elementTypeName ) ; //$NON-NLS-1$ action = actionAdder . apply ( UNINSTALL_SKILL_NAME ) ; block = action . getExpression ( ) ; block . setInnerDocumentation ( MessageFormat . format ( Messages . AbstractNewSarlElementWizardPage_20 , elementTypeName ) ) ; expr = block . addExpression ( ) ; createInfoCall ( expr , "Uninstalling the " + elementTypeName ) ; //$NON-NLS-1$ return true ; }
Create the default standard lifecycle function templates .
295
9
33,626
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 IProject project = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getFile ( new Path ( platformString ) ) . getProject ( ) ; adapter = new ProjectAdapter ( project ) ; resource . getResourceSet ( ) . eAdapters ( ) . add ( adapter ) ; } return adapter . getProject ( ) ; }
Get the project associated to the resource .
146
8
33,627
protected MavenImportWizardPage getMavenImportWizardPage ( ) { if ( this . mainPageBuffer == null ) { try { final Field field = MavenImportWizard . class . getDeclaredField ( "page" ) ; //$NON-NLS-1$ field . setAccessible ( true ) ; this . mainPageBuffer = ( MavenImportWizardPage ) field . get ( this ) ; } catch ( Exception exception ) { throw new RuntimeException ( exception ) ; } } return this . mainPageBuffer ; }
Replies the main configuration page .
117
7
33,628
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 .
74
5
33,629
public static Version parseVersion ( String version ) { if ( ! Strings . isNullOrEmpty ( version ) ) { try { return Version . parseVersion ( version ) ; } catch ( Throwable exception ) { // } } return null ; }
Null - safe version parser .
51
6
33,630
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 , minVersion ) < 0 ) { return - 1 ; } if ( maxVersion != null && compareVersionsNoQualifier ( version , maxVersion ) >= 0 ) { return 1 ; } return 0 ; }
Null - safe compare a version number to a range of version numbers .
115
14
33,631
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 .
90
5
33,632
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 ( ) ; if ( typeParameters != null && typeParameters . length > 0 ) { final StringBuffer buf = new StringBuffer ( superName ) ; buf . append ( ' ' ) ; for ( int k = 0 ; k < typeParameters . length ; ++ k ) { if ( k != 0 ) { buf . append ( ' ' ) . append ( ' ' ) ; } buf . append ( typeParameters [ k ] . getElementName ( ) ) ; } buf . append ( ' ' ) ; return buf . toString ( ) ; } } catch ( JavaModelException e ) { // ignore } return superName ; }
Replies the fully qualified name with generic parameters .
212
10
33,633
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 ; } final IPath sourceBundlePath = BundleUtil . getSourceBundlePath ( bundle , bundlePath ) ; final IPath javadocPath = BundleUtil . getJavadocBundlePath ( bundle , bundlePath ) ; final IClasspathAttribute [ ] extraAttributes ; if ( javadocPath == null ) { if ( javadocURLs != null ) { final String url = javadocURLs . getURLForBundle ( bundle ) ; if ( ! Strings . isNullOrEmpty ( url ) ) { final IClasspathAttribute attr = JavaCore . newClasspathAttribute ( IClasspathAttribute . JAVADOC_LOCATION_ATTRIBUTE_NAME , url ) ; extraAttributes = new IClasspathAttribute [ ] { attr } ; } else { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } } else { extraAttributes = ClasspathEntry . NO_EXTRA_ATTRIBUTES ; } } else { final IClasspathAttribute attr = JavaCore . newClasspathAttribute ( IClasspathAttribute . JAVADOC_LOCATION_ATTRIBUTE_NAME , javadocPath . makeAbsolute ( ) . toOSString ( ) ) ; extraAttributes = new IClasspathAttribute [ ] { attr } ; } return JavaCore . newLibraryEntry ( bundlePath , sourceBundlePath , null , null , extraAttributes , false ) ; }
Create the classpath library linked to the bundle with the given name .
405
14
33,634
@ 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 runtime ; }
Create the compiler runtime .
92
5
33,635
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 ( ) ) ; } return outcome . getExitCode ( ) ; } catch ( ProvisionException exception ) { final Throwable ex = Throwables . getRootCause ( exception ) ; if ( ex != null ) { Logger . getRootLogger ( ) . error ( ex . getLocalizedMessage ( ) ) ; } else { Logger . getRootLogger ( ) . error ( exception . getLocalizedMessage ( ) ) ; } } catch ( Throwable exception ) { Logger . getRootLogger ( ) . error ( exception . getLocalizedMessage ( ) ) ; } return Constants . ERROR_CODE ; }
Run the batch compiler .
213
5
33,636
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 . asOption ( ) ) ; c . getOptions ( ) . forEach ( o -> helpOptions . add ( o ) ) ; } ) ; application . getOptions ( ) . forEach ( o -> helpOptions . add ( o ) ) ; return helpOptions . getOptions ( ) ; }
Replies the options of the program .
134
8
33,637
protected void addAnnotations ( ExecutableMemberDoc member , Content htmlTree ) { WriterUtils . addAnnotations ( member , htmlTree , this . configuration , this . writer ) ; }
Add annotations except the reserved annotations .
40
7
33,638
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 .
63
15
33,639
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 .
54
14
33,640
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 .
54
16
33,641
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 .
55
16
33,642
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 .
76
10
33,643
@ 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 ( ) ) ; initializeSREs ( ) ; final String oldDefaultId ; String newDefaultId ; final List < ISREInstall > newElements = new ArrayList <> ( ) ; final Map < String , ISREInstall > allKeys ; LOCK . lock ( ) ; try { oldDefaultId = getDefaultSREId ( ) ; newDefaultId = oldDefaultId ; allKeys = new TreeMap <> ( ALL_SRE_INSTALLS ) ; for ( final ISREInstall sre : sres ) { if ( allKeys . remove ( sre . getId ( ) ) == null ) { newElements . add ( sre ) ; ALL_SRE_INSTALLS . put ( sre . getId ( ) , sre ) ; } mon . worked ( 1 ) ; } for ( final ISREInstall sre : allKeys . values ( ) ) { ALL_SRE_INSTALLS . remove ( sre . getId ( ) ) ; platformSREInstalls . remove ( sre . getId ( ) ) ; mon . worked ( 1 ) ; } if ( oldDefaultId != null && ! ALL_SRE_INSTALLS . containsKey ( oldDefaultId ) ) { newDefaultId = null ; } } finally { LOCK . unlock ( ) ; } boolean changed = false ; mon . subTask ( io . sarl . eclipse . runtime . Messages . SARLRuntime_1 ) ; if ( oldDefaultId != null && newDefaultId == null ) { changed = true ; setDefaultSREInstall ( null , monitor ) ; } mon . worked ( 1 ) ; mon . subTask ( io . sarl . eclipse . runtime . Messages . SARLRuntime_2 ) ; for ( final ISREInstall sre : allKeys . values ( ) ) { changed = true ; fireSRERemoved ( sre ) ; } for ( final ISREInstall sre : newElements ) { changed = true ; fireSREAdded ( sre ) ; } mon . worked ( 1 ) ; if ( changed ) { saveSREConfiguration ( mon . newChild ( sres . length - 2 ) ) ; } }
Sets the installed SREs .
553
8
33,644
private static void fireDefaultSREChanged ( ISREInstall previous , ISREInstall current ) { for ( final Object listener : SRE_LISTENERS . getListeners ( ) ) { ( ( ISREInstallChangedListener ) listener ) . defaultSREInstallChanged ( previous , current ) ; } }
Notifies registered listeners that the default SRE has changed .
64
12
33,645
public static boolean isPlatformSRE ( ISREInstall sre ) { if ( sre != null ) { LOCK . lock ( ) ; try { return platformSREInstalls . contains ( sre . getId ( ) ) ; } finally { LOCK . unlock ( ) ; } } return false ; }
Replies if the given SRE is provided by the Eclipse platform through an extension point .
66
18
33,646
public static void clearSREConfiguration ( ) throws CoreException { final SARLEclipsePlugin plugin = SARLEclipsePlugin . getDefault ( ) ; plugin . getPreferences ( ) . remove ( getCurrentPreferenceKey ( ) ) ; plugin . savePreferences ( ) ; }
Remove the SRE configuration information from the preferences .
58
10
33,647
private static void initializeSREExtensions ( ) { final MultiStatus status = new MultiStatus ( SARLEclipsePlugin . PLUGIN_ID , IStatus . OK , "Exceptions occurred" , null ) ; //$NON-NLS-1$ final IExtensionPoint extensionPoint = Platform . getExtensionRegistry ( ) . getExtensionPoint ( SARLEclipsePlugin . PLUGIN_ID , SARLEclipseConfig . EXTENSION_POINT_SARL_RUNTIME_ENVIRONMENT ) ; if ( extensionPoint != null ) { Object obj ; for ( final IConfigurationElement element : extensionPoint . getConfigurationElements ( ) ) { try { obj = element . createExecutableExtension ( "class" ) ; //$NON-NLS-1$ if ( obj instanceof ISREInstall ) { final ISREInstall sre = ( ISREInstall ) obj ; platformSREInstalls . add ( sre . getId ( ) ) ; ALL_SRE_INSTALLS . put ( sre . getId ( ) , sre ) ; } else { SARLEclipsePlugin . getDefault ( ) . logErrorMessage ( "Cannot instance extension point: " + element . getName ( ) ) ; //$NON-NLS-1$ } } catch ( CoreException e ) { status . add ( e . getStatus ( ) ) ; } } if ( ! status . isOK ( ) ) { //only happens on a CoreException SARLEclipsePlugin . getDefault ( ) . getLog ( ) . log ( status ) ; } } }
Initializes SRE extensions .
345
6
33,648
public static String getSREsAsXML ( IProgressMonitor monitor ) throws CoreException { initializeSREs ( ) ; try { final DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; final DocumentBuilder builder = factory . newDocumentBuilder ( ) ; final Document xmldocument = builder . newDocument ( ) ; final Element rootElement = getXml ( xmldocument ) ; xmldocument . appendChild ( rootElement ) ; final TransformerFactory transFactory = TransformerFactory . newInstance ( ) ; final Transformer trans = transFactory . newTransformer ( ) ; try ( ByteArrayOutputStream baos = new ByteArrayOutputStream ( ) ) { final DOMSource source = new DOMSource ( xmldocument ) ; final PrintWriter flot = new PrintWriter ( baos ) ; final StreamResult xmlStream = new StreamResult ( flot ) ; trans . transform ( source , xmlStream ) ; return new String ( baos . toByteArray ( ) ) ; } } catch ( Throwable e ) { throw new CoreException ( SARLEclipsePlugin . getDefault ( ) . createStatus ( IStatus . ERROR , e ) ) ; } }
Returns the listing of currently installed SREs as a single XML file .
251
15
33,649
@ SuppressWarnings ( "checkstyle:cyclomaticcomplexity" ) private static String initializePersistedSREs ( ) { // // FOR DEBUG // try { // clearSREConfiguration(); // } catch (CoreException e1) { // e1.printStackTrace(); // } final String rawXml = SARLEclipsePlugin . getDefault ( ) . getPreferences ( ) . get ( getCurrentPreferenceKey ( ) , "" ) ; //$NON-NLS-1$ try { Element config = null ; // If the preference was found, load SREs from it into memory if ( ! Strings . isNullOrEmpty ( rawXml ) ) { config = parseXML ( rawXml , true ) ; } else { // Otherwise, look for the old file that previously held the SRE definitions final SARLEclipsePlugin plugin = SARLEclipsePlugin . getDefault ( ) ; if ( plugin . getBundle ( ) != null ) { final IPath stateLocation = plugin . getStateLocation ( ) ; final IPath stateFile = stateLocation . append ( "sreConfiguration.xml" ) ; //$NON-NLS-1$ final File file = stateFile . toFile ( ) ; if ( file . exists ( ) ) { // If file exists, load SRE definitions from it into memory and // write the definitions to the preference store WITHOUT triggering // any processing of the new value try ( InputStream fileInputStream = new BufferedInputStream ( new FileInputStream ( file ) ) ) { config = parseXML ( fileInputStream , true ) ; } catch ( IOException e ) { SARLEclipsePlugin . getDefault ( ) . log ( e ) ; } } } } if ( config != null ) { final String defaultId = config . getAttribute ( "defaultSRE" ) ; //$NON-NLS-1$ final NodeList children = config . getChildNodes ( ) ; for ( int i = 0 ; i < children . getLength ( ) ; ++ i ) { try { final Node child = children . item ( i ) ; if ( "SRE" . equalsIgnoreCase ( child . getNodeName ( ) ) //$NON-NLS-1$ && child instanceof Element ) { final Element element = ( Element ) child ; final boolean isPlatform = Boolean . parseBoolean ( element . getAttribute ( "platform" ) ) ; //$NON-NLS-1$ final String id = element . getAttribute ( "id" ) ; //$NON-NLS-1$ if ( ! isPlatform || ! ( ALL_SRE_INSTALLS . containsKey ( id ) ) ) { final ISREInstall sre = createSRE ( element . getAttribute ( "class" ) , //$NON-NLS-1$ id ) ; if ( sre == null ) { throw new IOException ( "Invalid XML format of the SRE preferences of " + id ) ; //$NON-NLS-1$ } try { sre . setFromXML ( element ) ; } catch ( IOException e ) { SARLEclipsePlugin . getDefault ( ) . log ( e ) ; } ALL_SRE_INSTALLS . put ( id , sre ) ; if ( isPlatform ) { platformSREInstalls . add ( id ) ; } } else { final ISREInstall sre = ALL_SRE_INSTALLS . get ( id ) ; if ( sre != null ) { try { sre . setFromXML ( element ) ; } catch ( IOException e ) { SARLEclipsePlugin . getDefault ( ) . log ( e ) ; } } } } } catch ( IOException e ) { SARLEclipsePlugin . getDefault ( ) . log ( e ) ; } } return defaultId ; } } catch ( IOException e ) { SARLEclipsePlugin . getDefault ( ) . log ( e ) ; } return null ; }
This method loads installed SREs based an existing user preference or old SRE configurations file .
851
19
33,650
@ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:variabledeclarationusagedistance" , "checkstyle:npathcomplexity" } ) private static void initializeSREs ( ) { ISREInstall [ ] newSREs = new ISREInstall [ 0 ] ; boolean savePrefs = false ; LOCK . lock ( ) ; final String previousDefault = defaultSREId ; try { if ( platformSREInstalls == null ) { platformSREInstalls = new HashSet <> ( ) ; ALL_SRE_INSTALLS . clear ( ) ; // Install the SREs from the Eclipse extension points if ( enableSreExtensionPoints ) { initializeSREExtensions ( ) ; } // install the SREs from the user-defined preferences. final String predefinedDefaultId = Strings . nullToEmpty ( initializePersistedSREs ( ) ) ; newSREs = new ISREInstall [ ALL_SRE_INSTALLS . size ( ) ] ; // Verify default SRE is valid ISREInstall initDefaultSRE = null ; final Iterator < ISREInstall > iterator = ALL_SRE_INSTALLS . values ( ) . iterator ( ) ; for ( int i = 0 ; iterator . hasNext ( ) ; ++ i ) { final ISREInstall sre = iterator . next ( ) ; newSREs [ i ] = sre ; if ( sre . getValidity ( ) . isOK ( ) ) { if ( initDefaultSRE == null && sre . getId ( ) . equals ( predefinedDefaultId ) ) { initDefaultSRE = sre ; } } } final String oldDefaultId = initDefaultSRE == null ? null : initDefaultSRE . getId ( ) ; defaultSREId = oldDefaultId ; savePrefs = true ; } if ( Strings . isNullOrEmpty ( defaultSREId ) ) { ISREInstall firstSRE = null ; ISREInstall firstValidSRE = null ; final Iterator < ISREInstall > iterator = ALL_SRE_INSTALLS . values ( ) . iterator ( ) ; while ( firstValidSRE == null && iterator . hasNext ( ) ) { final ISREInstall sre = iterator . next ( ) ; if ( firstSRE == null ) { firstSRE = sre ; } if ( sre . getValidity ( ) . isOK ( ) ) { firstValidSRE = sre ; } } if ( firstValidSRE == null ) { firstValidSRE = firstSRE ; } if ( firstValidSRE != null ) { savePrefs = true ; defaultSREId = firstValidSRE . getId ( ) ; } } } finally { LOCK . unlock ( ) ; } // Save the preferences. if ( savePrefs ) { safeSaveSREConfiguration ( ) ; } if ( newSREs . length > 0 ) { for ( final ISREInstall sre : newSREs ) { fireSREAdded ( sre ) ; } } if ( ! Objects . equal ( previousDefault , defaultSREId ) ) { fireDefaultSREChanged ( getSREFromId ( previousDefault ) , getSREFromId ( defaultSREId ) ) ; } }
Perform SRE install initialization . Does not hold locks while performing change notification .
715
16
33,651
public static String createUniqueIdentifier ( ) { String id ; do { id = UUID . randomUUID ( ) . toString ( ) ; } while ( getSREFromId ( id ) != null ) ; return id ; }
Replies an unique identifier .
50
6
33,652
public static boolean isUnpackedSRE ( File directory ) { File manifestFile = new File ( directory , "META-INF" ) ; //$NON-NLS-1$ manifestFile = new File ( manifestFile , "MANIFEST.MF" ) ; //$NON-NLS-1$ if ( manifestFile . canRead ( ) ) { try ( InputStream manifestStream = new FileInputStream ( manifestFile ) ) { final Manifest manifest = new Manifest ( manifestStream ) ; final Attributes sarlSection = manifest . getAttributes ( SREConstants . MANIFEST_SECTION_SRE ) ; if ( sarlSection == null ) { return false ; } final String sarlVersion = sarlSection . getValue ( SREConstants . MANIFEST_SARL_SPEC_VERSION ) ; if ( sarlVersion == null || sarlVersion . isEmpty ( ) ) { return false ; } final Version sarlVer = Version . parseVersion ( sarlVersion ) ; return sarlVer != null ; } catch ( IOException exception ) { return false ; } } return false ; }
Replies if the given directory contains a SRE .
241
11
33,653
public static boolean isPackedSRE ( File jarFile ) { try ( JarFile jFile = new JarFile ( jarFile ) ) { final Manifest manifest = jFile . getManifest ( ) ; if ( manifest == null ) { return false ; } final Attributes sarlSection = manifest . getAttributes ( SREConstants . MANIFEST_SECTION_SRE ) ; if ( sarlSection == null ) { return false ; } final String sarlVersion = sarlSection . getValue ( SREConstants . MANIFEST_SARL_SPEC_VERSION ) ; if ( sarlVersion == null || sarlVersion . isEmpty ( ) ) { return false ; } final Version sarlVer = Version . parseVersion ( sarlVersion ) ; return sarlVer != null ; } catch ( IOException exception ) { return false ; } }
Replies if the given JAR file contains a SRE .
183
13
33,654
public static String getDeclaredBootstrap ( IPath path ) { try { final IFile location = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getFile ( path ) ; if ( location != null ) { final IPath pathLocation = location . getLocation ( ) ; if ( pathLocation != null ) { final File file = pathLocation . toFile ( ) ; if ( file . exists ( ) ) { if ( file . isDirectory ( ) ) { return getDeclaredBootstrapInFolder ( file ) ; } if ( file . isFile ( ) ) { return getDeclaredBootstrapInJar ( file ) ; } return null ; } } } final File file = path . makeAbsolute ( ) . toFile ( ) ; if ( file . exists ( ) ) { if ( file . isDirectory ( ) ) { return getDeclaredBootstrapInJar ( file ) ; } if ( file . isFile ( ) ) { return getDeclaredBootstrapInFolder ( file ) ; } } } catch ( Exception exception ) { // } return null ; }
Replies the bootstrap name declared within the given path corresponding to a JAR file or a folder .
228
21
33,655
protected Object processElement ( Object obj , Class < ? > expectedType ) { if ( obj == null || obj instanceof Proxy ) { return obj ; } if ( obj instanceof Doc ) { return wrap ( obj ) ; } else if ( expectedType != null && expectedType . isArray ( ) ) { final Class < ? > componentType = expectedType . getComponentType ( ) ; if ( Doc . class . isAssignableFrom ( componentType ) ) { final int len = Array . getLength ( obj ) ; final List < Object > list = new ArrayList <> ( len ) ; final ApidocExcluder excluder = this . configuration . get ( ) . getApidocExcluder ( ) ; for ( int i = 0 ; i < len ; ++ i ) { final Object entry = Array . get ( obj , i ) ; if ( ! ( entry instanceof Doc ) ) { list . add ( processElement ( entry , componentType ) ) ; } else if ( excluder . isExcluded ( ( Doc ) entry ) ) { if ( excluder . isTranslatableToTag ( ( Doc ) entry ) ) { // } } else { list . add ( processElement ( entry , componentType ) ) ; } } final Object newArray = Array . newInstance ( componentType , list . size ( ) ) ; int i = 0 ; for ( final Object element : list ) { Array . set ( newArray , i , element ) ; ++ i ; } return newArray ; } } return obj ; }
Filter the given document .
327
5
33,656
protected Object wrap ( Object object ) { if ( object == null || object instanceof Proxy ) { return object ; } final Class < ? > type = object . getClass ( ) ; return Proxy . newProxyInstance ( type . getClassLoader ( ) , type . getInterfaces ( ) , new ProxyHandler ( object ) ) ; }
Unwrap the given object .
70
6
33,657
protected void writePackageFiles ( QualifiedName name , String lineSeparator , IExtraLanguageGeneratorContext context ) { final IFileSystemAccess2 fsa = context . getFileSystemAccess ( ) ; final String outputConfiguration = getOutputConfigurationName ( ) ; QualifiedName libraryName = null ; for ( final String segment : name . skipLast ( 1 ) . getSegments ( ) ) { if ( libraryName == null ) { libraryName = QualifiedName . create ( segment , LIBRARY_FILENAME ) ; } else { libraryName = libraryName . append ( segment ) . append ( LIBRARY_FILENAME ) ; } final String fileName = toFilename ( libraryName ) ; if ( ! fsa . isFile ( fileName ) ) { final String content = PYTHON_FILE_HEADER + lineSeparator + getGenerationComment ( context ) + lineSeparator + LIBRARY_CONTENT ; if ( Strings . isEmpty ( outputConfiguration ) ) { fsa . generateFile ( fileName , content ) ; } else { fsa . generateFile ( fileName , outputConfiguration , content ) ; } } libraryName = libraryName . skipLast ( 1 ) ; } }
Generate the Python package files .
263
7
33,658
@ SuppressWarnings ( "static-method" ) protected boolean generatePythonClassDeclaration ( String typeName , boolean isAbstract , List < ? extends JvmTypeReference > superTypes , String comment , boolean ignoreObjectType , PyAppendable it , IExtraLanguageGeneratorContext context ) { if ( ! Strings . isEmpty ( typeName ) ) { it . append ( "class " ) . append ( typeName ) . append ( "(" ) ; //$NON-NLS-1$ //$NON-NLS-2$ boolean isOtherSuperType = false ; boolean first = true ; for ( final JvmTypeReference reference : superTypes ) { if ( ! ignoreObjectType || ! Strings . equal ( reference . getQualifiedName ( ) , Object . class . getCanonicalName ( ) ) ) { isOtherSuperType = true ; if ( first ) { first = false ; } else { it . append ( "," ) ; //$NON-NLS-1$ } it . append ( reference . getType ( ) ) ; } } if ( isOtherSuperType ) { it . append ( "," ) ; //$NON-NLS-1$ } // Add "object to avoid a bug within the Python interpreter. it . append ( "object):" ) ; //$NON-NLS-1$ it . increaseIndentation ( ) . newLine ( ) ; generateDocString ( comment , it ) ; return true ; } return false ; }
Generate the type declaration for a Python class .
324
10
33,659
protected static boolean generateDocString ( String comment , PyAppendable it ) { final String cmt = comment == null ? null : comment . trim ( ) ; if ( ! Strings . isEmpty ( cmt ) ) { assert cmt != null ; it . append ( "\"\"\"" ) . increaseIndentation ( ) ; //$NON-NLS-1$ for ( final String line : cmt . split ( "[\n\r\f]+" ) ) { //$NON-NLS-1$ it . newLine ( ) . append ( line ) ; } it . decreaseIndentation ( ) . newLine ( ) ; it . append ( "\"\"\"" ) . newLine ( ) ; //$NON-NLS-1$ return true ; } return false ; }
Generate a Python docstring with the given comment .
176
11
33,660
protected static boolean generateBlockComment ( String comment , PyAppendable it ) { final String cmt = comment == null ? null : comment . trim ( ) ; if ( ! Strings . isEmpty ( cmt ) ) { assert cmt != null ; for ( final String line : cmt . split ( "[\n\r\f]+" ) ) { //$NON-NLS-1$ it . append ( "# " ) . append ( line ) . newLine ( ) ; //$NON-NLS-1$ } return true ; } return false ; }
Generate a Python block comment with the given comment .
124
11
33,661
@ SuppressWarnings ( { "checkstyle:parameternumber" } ) protected boolean generateTypeDeclaration ( String fullyQualifiedName , String name , boolean isAbstract , List < ? extends JvmTypeReference > superTypes , String comment , boolean ignoreObjectType , List < ? extends XtendMember > members , PyAppendable it , IExtraLanguageGeneratorContext context , Procedure2 < ? super PyAppendable , ? super IExtraLanguageGeneratorContext > memberGenerator ) { if ( ! Strings . isEmpty ( name ) ) { if ( ! generatePythonClassDeclaration ( name , isAbstract , superTypes , comment , ignoreObjectType , it , context ) || context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; } // it . openScope ( ) ; // if ( ! generateSarlMembers ( members , it , context ) || context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; } // if ( memberGenerator != null ) { memberGenerator . apply ( it , context ) ; } // if ( ! generatePythonConstructors ( fullyQualifiedName , members , it , context ) || context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; } // it . decreaseIndentation ( ) . newLine ( ) . newLine ( ) ; // it . closeScope ( ) ; // if ( context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; } return true ; } return false ; }
Generate the given type .
343
6
33,662
protected boolean generateEnumerationDeclaration ( SarlEnumeration enumeration , PyAppendable it , IExtraLanguageGeneratorContext context ) { if ( ! Strings . isEmpty ( enumeration . getName ( ) ) ) { it . append ( "class " ) . append ( enumeration . getName ( ) ) ; //$NON-NLS-1$ it . append ( "(Enum" ) ; //$NON-NLS-1$ it . append ( newType ( "enum.Enum" ) ) ; //$NON-NLS-1$ it . append ( "):" ) ; //$NON-NLS-1$ it . increaseIndentation ( ) . newLine ( ) ; generateDocString ( getTypeBuilder ( ) . getDocumentation ( enumeration ) , it ) ; int i = 0 ; for ( final XtendMember item : enumeration . getMembers ( ) ) { if ( context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; } if ( item instanceof XtendEnumLiteral ) { final XtendEnumLiteral literal = ( XtendEnumLiteral ) item ; it . append ( literal . getName ( ) ) . append ( " = " ) ; //$NON-NLS-1$ it . append ( Integer . toString ( i ) ) ; it . newLine ( ) ; ++ i ; } } // it . decreaseIndentation ( ) . newLine ( ) . newLine ( ) ; return true ; } return false ; }
Generate the given enumeration declaration .
348
8
33,663
protected boolean generatePythonConstructors ( String container , List < ? extends XtendMember > members , PyAppendable it , IExtraLanguageGeneratorContext context ) { // Prepare field initialization boolean hasConstructor = false ; for ( final XtendMember member : members ) { if ( context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; } if ( member instanceof SarlConstructor ) { hasConstructor = true ; generate ( member , it , context ) ; it . newLine ( ) ; } } if ( context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; } if ( ! hasConstructor ) { it . append ( "def __init__(self):" ) ; //$NON-NLS-1$ it . increaseIndentation ( ) . newLine ( ) ; final List < SarlField > fields = context . getMultimapValues ( INSTANCE_VARIABLES_MEMENTO , container ) ; if ( fields . isEmpty ( ) ) { it . append ( "pass" ) ; //$NON-NLS-1$ } else { for ( final SarlField field : fields ) { generatePythonField ( field , it , context ) ; } } it . decreaseIndentation ( ) . newLine ( ) ; } return true ; }
Generate the constructors for a Python class .
297
10
33,664
@ SuppressWarnings ( "static-method" ) protected JvmType newType ( String pythonName ) { final JvmGenericType type = TypesFactory . eINSTANCE . createJvmGenericType ( ) ; final int index = pythonName . indexOf ( "." ) ; //$NON-NLS-1$ if ( index <= 0 ) { type . setSimpleName ( pythonName ) ; } else { type . setPackageName ( pythonName . substring ( 0 , index - 1 ) ) ; type . setSimpleName ( pythonName . substring ( index + 1 ) ) ; } return type ; }
Create a JvmType for a Python type .
134
10
33,665
protected void generatePythonField ( SarlField field , PyAppendable it , IExtraLanguageGeneratorContext context ) { generateBlockComment ( getTypeBuilder ( ) . getDocumentation ( field ) , it ) ; if ( ! field . isStatic ( ) ) { it . append ( "self." ) ; //$NON-NLS-1$ } final String fieldName = it . declareUniqueNameVariable ( field , field . getName ( ) ) ; it . append ( fieldName ) ; it . append ( " = " ) ; //$NON-NLS-1$ if ( field . getInitialValue ( ) != null ) { generate ( field . getInitialValue ( ) , null , it , context ) ; } else { it . append ( PyExpressionGenerator . toDefaultValue ( field . getType ( ) ) ) ; } it . newLine ( ) ; }
Create a field declaration .
191
5
33,666
protected void generateGuardEvaluators ( String container , PyAppendable it , IExtraLanguageGeneratorContext context ) { final Map < String , Map < String , List < Pair < XExpression , String > > > > allGuardEvaluators = context . getMapData ( EVENT_GUARDS_MEMENTO ) ; final Map < String , List < Pair < XExpression , String > > > guardEvaluators = allGuardEvaluators . get ( container ) ; if ( guardEvaluators == null ) { return ; } boolean first = true ; for ( final Entry < String , List < Pair < XExpression , String > > > entry : guardEvaluators . entrySet ( ) ) { if ( first ) { first = false ; } else { it . newLine ( ) ; } it . append ( "def __guard_" ) ; //$NON-NLS-1$ it . append ( entry . getKey ( ) . replaceAll ( "[^a-zA-Z0-9_]+" , "_" ) ) ; //$NON-NLS-1$ //$NON-NLS-2$ it . append ( "__(self, occurrence):" ) ; //$NON-NLS-1$ it . increaseIndentation ( ) . newLine ( ) ; it . append ( "it = occurrence" ) . newLine ( ) ; //$NON-NLS-1$ final String eventHandleName = it . declareUniqueNameVariable ( new Object ( ) , "__event_handles" ) ; //$NON-NLS-1$ it . append ( eventHandleName ) . append ( " = list" ) ; //$NON-NLS-1$ for ( final Pair < XExpression , String > guardDesc : entry . getValue ( ) ) { it . newLine ( ) ; if ( guardDesc . getKey ( ) == null ) { it . append ( eventHandleName ) . append ( ".add(" ) . append ( guardDesc . getValue ( ) ) . append ( ")" ) ; //$NON-NLS-1$ //$NON-NLS-2$ } else { it . append ( "if " ) ; //$NON-NLS-1$ generate ( guardDesc . getKey ( ) , null , it , context ) ; it . append ( ":" ) . increaseIndentation ( ) . newLine ( ) ; //$NON-NLS-1$ it . append ( eventHandleName ) . append ( ".add(" ) . append ( guardDesc . getValue ( ) ) . append ( ")" ) ; //$NON-NLS-1$ //$NON-NLS-2$ it . decreaseIndentation ( ) ; } } it . newLine ( ) . append ( "return " ) . append ( eventHandleName ) ; //$NON-NLS-1$ it . decreaseIndentation ( ) . newLine ( ) ; } }
Generate the memorized guard evaluators .
658
10
33,667
protected void _before ( SarlCapacityUses uses , IExtraLanguageGeneratorContext context ) { // Rename the function in order to produce the good features at the calls. for ( final JvmTypeReference capacity : uses . getCapacities ( ) ) { final JvmType type = capacity . getType ( ) ; if ( type instanceof JvmDeclaredType ) { computeCapacityFunctionMarkers ( ( JvmDeclaredType ) type ) ; } } }
Mark the functions of the used capacities in order to have a valid feature call within the code .
102
19
33,668
@ Check ( CheckType . NORMAL ) public void checkExtraLanguageRules ( EObject currentObject ) { final List < AbstractExtraLanguageValidator > validators = this . validatorProvider . getValidators ( currentObject . eResource ( ) ) ; if ( ! validators . isEmpty ( ) ) { for ( final AbstractExtraLanguageValidator validator : validators ) { final ValidationMessageAcceptor acceptor = getMessageAcceptor ( ) ; final StateAccess stateAccess = setMessageAcceptor ( acceptor ) ; validator . validate ( stateAccess , acceptor ) ; } } }
Check the rules for the activated extra languages .
126
9
33,669
public void setComment ( String comment ) { this . comment = comment ; if ( ! Strings . isEmpty ( comment ) ) { this . name = MessageFormat . format ( "{0} [{1}]" , getClass ( ) . getName ( ) , comment ) ; //$NON-NLS-1$ } else { this . name = getClass ( ) . getName ( ) ; } }
Change the comment for the injection fragment .
88
8
33,670
protected GeneratorConfig createDefaultGeneratorConfig ( ) { final GeneratorConfig config = new GeneratorConfig ( ) ; if ( this . defaultVersion == null ) { this . defaultVersion = JavaVersion . fromQualifier ( System . getProperty ( "java.specification.version" ) ) ; //$NON-NLS-1$ if ( this . defaultVersion != null ) { config . setJavaSourceVersion ( this . defaultVersion ) ; } } else { config . setJavaSourceVersion ( this . defaultVersion ) ; } return config ; }
Invoked for creating the default generator configuration .
115
9
33,671
protected InferredPrototype createPrototype ( QualifiedActionName id , boolean isVarargs , FormalParameterProvider parameters ) { assert parameters != null ; final ActionParameterTypes key = new ActionParameterTypes ( isVarargs , parameters . getFormalParameterCount ( ) ) ; final Map < ActionParameterTypes , List < InferredStandardParameter > > ip = buildSignaturesForArgDefaultValues ( id . getDeclaringType ( ) , key . toActionPrototype ( id . getActionName ( ) ) . toActionId ( ) , parameters , key ) ; final List < InferredStandardParameter > op = ip . remove ( key ) ; final InferredPrototype proto = new DefaultInferredPrototype ( id , parameters , key , op , ip ) ; final String containerID = id . getContainerID ( ) ; Map < String , Map < ActionParameterTypes , InferredPrototype > > c = this . prototypes . get ( containerID ) ; if ( c == null ) { c = new TreeMap <> ( ) ; this . prototypes . put ( containerID , c ) ; } Map < ActionParameterTypes , InferredPrototype > list = c . get ( id . getActionName ( ) ) ; if ( list == null ) { list = new TreeMap <> ( ) ; c . put ( id . getActionName ( ) , list ) ; } list . put ( key , proto ) ; return proto ; }
Build and replies the inferred action signature for the element with the given ID . This function creates the different signatures according to the definition or not of default values for the formal parameters .
304
35
33,672
@ SuppressWarnings ( "static-method" ) public ITextReplacerContext fix ( final ITextReplacerContext context , IComment comment ) { final IHiddenRegion hiddenRegion = comment . getHiddenRegion ( ) ; if ( detectBugSituation ( hiddenRegion ) && fixBug ( hiddenRegion ) ) { // Indentation of the first comment line final ITextRegionAccess access = comment . getTextRegionAccess ( ) ; final ITextSegment target = access . regionForOffset ( comment . getOffset ( ) , 0 ) ; context . addReplacement ( target . replaceWith ( context . getIndentationString ( 1 ) ) ) ; // Indentation of the comment's lines return new FixedReplacementContext ( context ) ; } return context ; }
Fixing the bug .
164
5
33,673
public void putDefaultClasspathEntriesIn ( Collection < IClasspathEntry > classpathEntries ) { final IPath newPath = this . jreGroup . getJREContainerPath ( ) ; if ( newPath != null ) { classpathEntries . add ( JavaCore . newContainerEntry ( newPath ) ) ; } else { final IClasspathEntry [ ] entries = PreferenceConstants . getDefaultJRELibrary ( ) ; classpathEntries . addAll ( Arrays . asList ( entries ) ) ; } final IClasspathEntry sarlClasspathEntry = JavaCore . newContainerEntry ( SARLClasspathContainerInitializer . CONTAINER_ID , new IAccessRule [ 0 ] , new IClasspathAttribute [ 0 ] , true ) ; classpathEntries . add ( sarlClasspathEntry ) ; }
Returns the default class path entries to be added on new projects . By default this is the JRE container as selected by the user .
181
27
33,674
public IPath getOutputLocation ( ) { IPath outputLocationPath = new Path ( getProjectName ( ) ) . makeAbsolute ( ) ; outputLocationPath = outputLocationPath . append ( Path . fromPortableString ( SARLConfig . FOLDER_BIN ) ) ; return outputLocationPath ; }
Returns the source class path entries to be added on new projects . The underlying resource may not exist .
67
20
33,675
protected static Action findAction ( EObject grammarComponent , String assignmentName ) { for ( final Action action : GrammarUtil . containedActions ( grammarComponent ) ) { if ( GrammarUtil . isAssignedAction ( action ) ) { if ( Objects . equals ( assignmentName , action . getFeature ( ) ) ) { return action ; } } } return null ; }
Replies the assignment component with the given nazme in the given grammar component .
80
17
33,676
protected EObject getContainerInRule ( EObject root , EObject content ) { EObject container = content ; do { final EClassifier classifier = getGeneratedTypeFor ( container ) ; if ( classifier != null ) { return container ; } container = container . eContainer ( ) ; } while ( container != root ) ; final EClassifier classifier = getGeneratedTypeFor ( root ) ; if ( classifier != null ) { return root ; } return null ; }
Replies the container in the grammar rule for the given content element .
102
14
33,677
protected CellEditor createClassCellEditor ( ) { return new DialogCellEditor ( getControl ( ) ) { @ Override protected Object openDialogBox ( Control cellEditorWindow ) { final OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog ( getControl ( ) . getShell ( ) , false , PlatformUI . getWorkbench ( ) . getProgressService ( ) , null , IJavaSearchConstants . TYPE ) ; dialog . setTitle ( JavaUIMessages . OpenTypeAction_dialogTitle ) ; dialog . setMessage ( JavaUIMessages . OpenTypeAction_dialogMessage ) ; final int result = dialog . open ( ) ; if ( result != IDialogConstants . OK_ID ) { return null ; } final Object [ ] types = dialog . getResult ( ) ; if ( types == null || types . length != 1 || ! ( types [ 0 ] instanceof IType ) ) { return null ; } final IType type = ( IType ) types [ 0 ] ; final String name = type . getFullyQualifiedName ( ) ; return Strings . emptyIfNull ( name ) ; } } ; }
Create a cell editor that enables to select a class .
246
11
33,678
private void enableButtons ( ) { final int itemCount = this . list . getTable ( ) . getItemCount ( ) ; final boolean hasElement = itemCount > 0 ; IStructuredSelection selection ; if ( hasElement ) { selection = this . list . getStructuredSelection ( ) ; final int selectionCount = selection . size ( ) ; if ( selectionCount <= 0 || selectionCount > itemCount ) { selection = null ; } } else { selection = null ; } this . removeButton . setEnabled ( selection != null ) ; this . clearButton . setEnabled ( hasElement ) ; if ( this . isSortedElements ) { final Object firstElement = selection != null ? this . list . getTable ( ) . getItem ( 0 ) . getData ( ) : null ; final Object lastElement = selection != null ? this . list . getTable ( ) . getItem ( this . list . getTable ( ) . getItemCount ( ) - 1 ) . getData ( ) : null ; final boolean isNotFirst = firstElement != null && selection != null && firstElement != selection . getFirstElement ( ) ; final boolean isNotLast = lastElement != null && selection != null && lastElement != selection . getFirstElement ( ) ; this . moveTopButton . setEnabled ( isNotFirst ) ; this . moveUpButton . setEnabled ( isNotFirst ) ; this . moveDownButton . setEnabled ( isNotLast ) ; this . moveBottomButton . setEnabled ( isNotLast ) ; } }
Enables the type conversion buttons based on selected items counts in the viewer .
326
15
33,679
protected void setTypeConversions ( List < Pair < String , String > > typeConversions , boolean notifyController ) { this . conversions . clear ( ) ; if ( typeConversions != null ) { for ( final Pair < String , String > entry : typeConversions ) { this . conversions . add ( new ConversionMapping ( entry . getKey ( ) , entry . getValue ( ) ) ) ; } } this . list . setInput ( this . conversions ) ; refreshListUI ( ) ; if ( notifyController ) { preferenceValueChanged ( ) ; } }
Sets the type conversions to be displayed in this block .
119
12
33,680
protected void addTypeConversion ( String javaType , String targetType , boolean updateSelection ) { final ConversionMapping entry = new ConversionMapping ( javaType , targetType ) ; this . conversions . add ( entry ) ; //refresh from model refreshListUI ( ) ; if ( updateSelection ) { this . list . setSelection ( new StructuredSelection ( entry ) ) ; } //ensure labels are updated if ( ! this . list . isBusy ( ) ) { this . list . refresh ( true ) ; } enableButtons ( ) ; preferenceValueChanged ( ) ; }
Add a type conversion .
128
5
33,681
@ SuppressWarnings ( "unchecked" ) protected void removeCurrentTypeConversion ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final String [ ] types = new String [ selection . size ( ) ] ; final Iterator < ConversionMapping > iter = selection . iterator ( ) ; int i = 0 ; while ( iter . hasNext ( ) ) { types [ i ] = iter . next ( ) . getSource ( ) ; i ++ ; } removeTypeConversions ( types ) ; }
Remove the current type conversion .
118
6
33,682
protected void moveSelectionTop ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final int index = this . conversions . indexOf ( selection . getFirstElement ( ) ) ; if ( index > 0 ) { final int endIndex = index + selection . size ( ) - 1 ; for ( int i = 0 ; i < selection . size ( ) ; ++ i ) { final ConversionMapping next = this . conversions . remove ( endIndex ) ; this . conversions . addFirst ( next ) ; } refreshListUI ( ) ; this . list . refresh ( true ) ; enableButtons ( ) ; preferenceValueChanged ( ) ; } }
Move the selection at the top .
146
7
33,683
protected void moveSelectionUp ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final int index = this . conversions . indexOf ( selection . getFirstElement ( ) ) ; if ( index > 0 ) { final ConversionMapping previous = this . conversions . remove ( index - 1 ) ; this . conversions . add ( index + selection . size ( ) - 1 , previous ) ; refreshListUI ( ) ; this . list . refresh ( true ) ; enableButtons ( ) ; preferenceValueChanged ( ) ; } }
Move the selection up .
121
5
33,684
protected void moveSelectionDown ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final int index = this . conversions . indexOf ( selection . getFirstElement ( ) ) ; if ( index >= 0 && ( index + selection . size ( ) ) < this . conversions . size ( ) ) { final ConversionMapping next = this . conversions . remove ( index + selection . size ( ) ) ; this . conversions . add ( index , next ) ; refreshListUI ( ) ; this . list . refresh ( true ) ; enableButtons ( ) ; preferenceValueChanged ( ) ; } }
Move the selection down .
135
5
33,685
protected void moveSelectionBottom ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final int index = this . conversions . indexOf ( selection . getFirstElement ( ) ) ; if ( index >= 0 && ( index + selection . size ( ) ) < this . conversions . size ( ) ) { for ( int i = 0 ; i < selection . size ( ) ; ++ i ) { final ConversionMapping previous = this . conversions . remove ( index ) ; this . conversions . addLast ( previous ) ; } refreshListUI ( ) ; this . list . refresh ( true ) ; enableButtons ( ) ; preferenceValueChanged ( ) ; } }
Move the selection at the bottom .
148
7
33,686
protected void removeTypeConversions ( String ... types ) { for ( final String type : types ) { final Iterator < ConversionMapping > iterator = this . conversions . iterator ( ) ; while ( iterator . hasNext ( ) ) { final ConversionMapping pair = iterator . next ( ) ; if ( Strings . equal ( pair . getSource ( ) , type ) ) { iterator . remove ( ) ; break ; } } } refreshListUI ( ) ; this . list . refresh ( true ) ; enableButtons ( ) ; preferenceValueChanged ( ) ; }
Remove the given type conversions .
118
6
33,687
protected void refreshListUI ( ) { final Display display = Display . getDefault ( ) ; if ( display . getThread ( ) . equals ( Thread . currentThread ( ) ) ) { if ( ! this . list . isBusy ( ) ) { this . list . refresh ( ) ; } } else { display . syncExec ( new Runnable ( ) { @ SuppressWarnings ( "synthetic-access" ) @ Override public void run ( ) { if ( ! AbstractConversionTable . this . list . isBusy ( ) ) { AbstractConversionTable . this . list . refresh ( ) ; } } } ) ; } }
Refresh the UI list of type conversions .
140
9
33,688
private void sortByTargetColumn ( ) { this . list . setComparator ( new ViewerComparator ( ) { @ Override public int compare ( Viewer viewer , Object e1 , Object e2 ) { if ( e1 != null && e2 != null ) { return e1 . toString ( ) . compareToIgnoreCase ( e2 . toString ( ) ) ; } return super . compare ( viewer , e1 , e2 ) ; } @ Override public boolean isSorterProperty ( Object element , String property ) { return true ; } } ) ; this . sort = Column . TARGET ; }
Sorts the type conversions by target type .
132
9
33,689
private void updateStatus ( Throwable event ) { Throwable cause = event ; while ( cause != null && ( ! ( cause instanceof CoreException ) ) && cause . getCause ( ) != null && cause . getCause ( ) != cause ) { cause = cause . getCause ( ) ; } if ( cause instanceof CoreException ) { updateStatus ( ( ( CoreException ) cause ) . getStatus ( ) ) ; } else { final String message ; if ( cause != null ) { message = cause . getLocalizedMessage ( ) ; } else { message = event . getLocalizedMessage ( ) ; } final IStatus status = new StatusInfo ( IStatus . ERROR , message ) ; updateStatus ( status ) ; } }
Update the status of this page according to the given exception .
153
12
33,690
public void performFinish ( IProgressMonitor monitor ) throws CoreException , InterruptedException { final SubMonitor subMonitor = SubMonitor . convert ( monitor , 4 ) ; try { monitor . beginTask ( NewWizardMessages . NewJavaProjectWizardPageTwo_operation_create , 3 ) ; if ( this . currProject == null ) { updateProject ( subMonitor . newChild ( 1 ) ) ; } final String newProjectCompliance = this . keepContent ? null : this . firstPage . getCompilerCompliance ( ) ; configureJavaProject ( newProjectCompliance , subMonitor . newChild ( 1 ) ) ; } catch ( Throwable e ) { if ( this . currProject != null ) { removeProvisonalProject ( ) ; } throw e ; } finally { subMonitor . done ( ) ; this . currProject = null ; if ( this . isAutobuild != null ) { CoreUtility . setAutoBuilding ( this . isAutobuild . booleanValue ( ) ) ; this . isAutobuild = null ; } } }
Called from the wizard on finish .
227
8
33,691
protected IProject createProvisonalProject ( ) { final IStatus status = changeToNewProject ( ) ; if ( status != null ) { updateStatus ( status ) ; if ( ! status . isOK ( ) ) { ErrorDialog . openError ( getShell ( ) , NewWizardMessages . NewJavaProjectWizardPageTwo_error_title , null , status ) ; } } return this . currProject ; }
Creates the provisional project on which the wizard is working on . The provisional project is typically created when the page is entered the first time . The early project creation is required to configure linked folders .
91
39
33,692
protected void removeProvisonalProject ( ) { if ( ! this . currProject . exists ( ) ) { this . currProject = null ; return ; } final IRunnableWithProgress op = new IRunnableWithProgress ( ) { @ SuppressWarnings ( "synthetic-access" ) @ Override public void run ( IProgressMonitor monitor ) throws InvocationTargetException , InterruptedException { doRemoveProject ( monitor ) ; } } ; try { getContainer ( ) . run ( true , true , new WorkspaceModifyDelegatingOperation ( op ) ) ; } catch ( InvocationTargetException e ) { final String title = NewWizardMessages . NewJavaProjectWizardPageTwo_error_remove_title ; final String message = NewWizardMessages . NewJavaProjectWizardPageTwo_error_remove_message ; ExceptionHandler . handle ( e , getShell ( ) , title , message ) ; } catch ( InterruptedException e ) { // cancel pressed } }
Removes the provisional project . The provisional project is typically removed when the user cancels the wizard or goes back to the first page .
217
27
33,693
public ADDRESST registerParticipant ( ADDRESST address , EventListener entity ) { synchronized ( mutex ( ) ) { addListener ( address , entity ) ; this . participants . put ( entity . getID ( ) , address ) ; } return address ; }
Registers a new participant in this repository .
57
9
33,694
public ADDRESST unregisterParticipant ( UUID entityID ) { synchronized ( mutex ( ) ) { removeListener ( this . participants . get ( entityID ) ) ; return this . participants . remove ( entityID ) ; } }
Remove a participant with the given ID from this repository .
51
11
33,695
public SynchronizedCollection < ADDRESST > getParticipantAddresses ( ) { final Object mutex = mutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedCollection ( this . participants . values ( ) , mutex ) ; } }
Replies all the addresses of the participants that ar einside this repository .
56
15
33,696
public SynchronizedSet < UUID > getParticipantIDs ( ) { final Object mutex = mutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedSet ( this . participants . keySet ( ) , mutex ) ; } }
Replies the identifiers of all the participants in this repository .
54
12
33,697
protected void addSourceFolder ( String path ) { final List < String > existingFolders1 = this . project . getCompileSourceRoots ( ) ; final List < String > existingFolders2 = this . project . getTestCompileSourceRoots ( ) ; if ( ! existingFolders1 . contains ( path ) && ! existingFolders2 . contains ( path ) ) { getLog ( ) . info ( MessageFormat . format ( Messages . InitializeMojo_0 , path ) ) ; this . session . getCurrentProject ( ) . addCompileSourceRoot ( path ) ; } else { getLog ( ) . info ( MessageFormat . format ( Messages . InitializeMojo_1 , path ) ) ; } }
Add a source folder in the current projecT .
160
12
33,698
private List < LightweightTypeReference > cloneTypeReferences ( List < JvmTypeReference > types , Map < String , JvmTypeReference > typeParameterMap ) { final List < LightweightTypeReference > newList = new ArrayList <> ( types . size ( ) ) ; for ( final JvmTypeReference type : types ) { newList . add ( cloneTypeReference ( type , typeParameterMap ) ) ; } return newList ; }
Clone the given types by applying the type parameter mapping when necessary .
94
14
33,699
@ BQConfigProperty ( "Specify the levels of specific warnings" ) public void setWarningLevels ( Map < String , Severity > levels ) { if ( levels == null ) { this . warningLevels = new HashMap <> ( ) ; } else { this . warningLevels = levels ; } }
Change the specific warning levels .
67
6