idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
34,300
private static String getXtextKey ( String preferenceContainerID , String preferenceName ) { return GENERATOR_PREFERENCE_TAG + PreferenceConstants . SEPARATOR + preferenceContainerID + PreferenceConstants . SEPARATOR + preferenceName ; }
Create a preference key according to the Xtext option block standards .
34,301
public static String getPrefixedKey ( String preferenceContainerID , String preferenceName ) { return getXtextKey ( getPropertyPrefix ( preferenceContainerID ) , preferenceName ) ; }
Create a preference key .
34,302
public boolean hasProjectSpecificOptions ( String preferenceContainerID , IProject project ) { final IPreferenceStore store = getWritablePreferenceStore ( project ) ; String key = IS_PROJECT_SPECIFIC ; if ( preferenceContainerID != null ) { key = getPropertyPrefix ( preferenceContainerID ) + "." + IS_PROJECT_SPECIFIC ; } final boolean oldSettingsUsed = store . getBoolean ( IS_PROJECT_SPECIFIC ) ; final boolean newSettingsValue = store . getBoolean ( key ) ; if ( oldSettingsUsed && ! newSettingsValue ) { store . setValue ( key , true ) ; return true ; } return newSettingsValue ; }
Replies if the project has specific configuration for extra language generation provided by the given container .
34,303
public IProject ifSpecificConfiguration ( String preferenceContainerID , IProject project ) { if ( project != null && hasProjectSpecificOptions ( preferenceContainerID , project ) ) { return project ; } return null ; }
Filter the project according to the specific configuration .
34,304
public static boolean parseConverterPreferenceValue ( String input , Procedure2 < ? super String , ? super String > output ) { final StringTokenizer tokenizer = new StringTokenizer ( input , PREFERENCE_SEPARATOR ) ; String key = null ; boolean foundValue = false ; while ( tokenizer . hasMoreTokens ( ) ) { final String token = tokenizer . nextToken ( ) ; if ( key != null ) { output . apply ( key , token ) ; foundValue = true ; key = null ; } else { key = token ; } } return foundValue ; }
Parse the given input which is the preference string representation .
34,305
private boolean markAsDeadCode ( XExpression expression ) { if ( expression instanceof XBlockExpression ) { final XBlockExpression block = ( XBlockExpression ) expression ; final EList < XExpression > expressions = block . getExpressions ( ) ; if ( ! expressions . isEmpty ( ) ) { markAsDeadCode ( expressions . get ( 0 ) ) ; return true ; } } if ( expression != null ) { error ( "Unreachable expression." , expression , null , IssueCodes . UNREACHABLE_CODE ) ; return true ; } return false ; }
This code is copied from the super type
34,306
public void addForbiddenInjectionPrefix ( String prefix ) { if ( ! Strings . isEmpty ( prefix ) ) { final String real = prefix . endsWith ( "." ) ? prefix . substring ( 0 , prefix . length ( ) - 1 ) : prefix ; this . forbiddenInjectionPrefixes . add ( real ) ; } }
Add a prefix of typenames that should not be considered for injection overriding .
34,307
public void addForbiddenInjectionPostfixes ( String postfix ) { if ( ! Strings . isEmpty ( postfix ) ) { final String real = postfix . startsWith ( "." ) ? postfix . substring ( 1 ) : postfix ; this . forbiddenInjectionPrefixes . add ( real ) ; } }
Add a postfix of typenames that should not be considered for injection overriding .
34,308
public void addModifier ( Modifier modifier ) { if ( modifier != null ) { final String ruleName = modifier . getType ( ) ; if ( ! Strings . isEmpty ( ruleName ) ) { List < String > modifiers = this . modifiers . get ( ruleName ) ; if ( modifiers == null ) { modifiers = new ArrayList < > ( ) ; this . modifiers . put ( ruleName , modifiers ) ; } modifiers . addAll ( modifier . getModifiers ( ) ) ; } } }
Add a modifier for a rule .
34,309
public void addDefaultSuper ( SuperTypeMapping mapping ) { if ( mapping != null ) { this . superTypeMapping . put ( mapping . getType ( ) , mapping . getSuper ( ) ) ; } }
Add a default super type .
34,310
public static < T > T getField ( Object obj , String string , Class < ? > clazz , Class < T > fieldType ) { try { final Field field = clazz . getDeclaredField ( string ) ; field . setAccessible ( true ) ; final Object value = field . get ( obj ) ; return fieldType . cast ( value ) ; } catch ( Exception exception ) { throw new Error ( exception ) ; } }
Replies the value of the field .
34,311
public static < T > void copyFields ( Class < T > type , T dest , T source ) { Class < ? > clazz = type ; while ( clazz != null && ! Object . class . equals ( clazz ) ) { for ( final Field field : clazz . getDeclaredFields ( ) ) { if ( ! Modifier . isStatic ( field . getModifiers ( ) ) ) { field . setAccessible ( true ) ; try { field . set ( dest , field . get ( source ) ) ; } catch ( IllegalArgumentException | IllegalAccessException e ) { throw new Error ( e ) ; } } } clazz = clazz . getSuperclass ( ) ; } }
Clone the fields .
34,312
public Control createControl ( Composite parent ) { this . control = SWTFactory . createComposite ( parent , parent . getFont ( ) , 1 , 1 , GridData . FILL_HORIZONTAL ) ; final int nbColumns = this . enableSystemWideSelector ? 3 : 2 ; final Group group = SWTFactory . createGroup ( this . control , MoreObjects . firstNonNull ( this . title , Messages . SREConfigurationBlock_7 ) , nbColumns , 1 , GridData . FILL_HORIZONTAL ) ; if ( this . enableSystemWideSelector || ! this . projectProviderFactories . isEmpty ( ) ) { createSystemWideSelector ( group ) ; createProjectSelector ( group ) ; this . specificSREButton = SWTFactory . createRadioButton ( group , Messages . SREConfigurationBlock_2 , 1 ) ; this . specificSREButton . addSelectionListener ( new SelectionAdapter ( ) { @ SuppressWarnings ( "synthetic-access" ) public void widgetSelected ( SelectionEvent event ) { if ( SREConfigurationBlock . this . specificSREButton . getSelection ( ) ) { handleSpecificConfigurationSelected ( ) ; } } } ) ; } else { this . systemSREButton = null ; this . projectSREButton = null ; this . specificSREButton = null ; } createSRESelector ( group ) ; return getControl ( ) ; }
Creates this block s control in the given control .
34,313
public void updateExternalSREButtonLabels ( ) { if ( this . enableSystemWideSelector ) { final ISREInstall wideSystemSRE = SARLRuntime . getDefaultSREInstall ( ) ; final String wideSystemSRELabel ; if ( wideSystemSRE == null ) { wideSystemSRELabel = Messages . SREConfigurationBlock_0 ; } else { wideSystemSRELabel = wideSystemSRE . getName ( ) ; } this . systemSREButton . setText ( MessageFormat . format ( Messages . SREConfigurationBlock_1 , wideSystemSRELabel ) ) ; } if ( ! this . projectProviderFactories . isEmpty ( ) ) { final ISREInstall projectSRE = retreiveProjectSRE ( ) ; final String projectSRELabel ; if ( projectSRE == null ) { projectSRELabel = Messages . SREConfigurationBlock_0 ; } else { projectSRELabel = projectSRE . getName ( ) ; } this . projectSREButton . setText ( MessageFormat . format ( Messages . SREConfigurationBlock_3 , projectSRELabel ) ) ; } }
Update the label of the system - wide and project configuration buttons .
34,314
@ SuppressWarnings ( "checkstyle:npathcomplexity" ) public boolean selectSpecificSRE ( ISREInstall sre ) { ISREInstall theSRE = sre ; if ( theSRE == null ) { theSRE = SARLRuntime . getDefaultSREInstall ( ) ; } if ( theSRE != null ) { boolean changed = false ; final boolean oldNotify = this . notify ; try { this . notify = false ; if ( isSystemWideDefaultSRE ( ) ) { doSpecificSREButtonClick ( ) ; changed = true ; } final ISREInstall oldSRE = getSelectedSRE ( ) ; if ( oldSRE != theSRE ) { final int index = indexOf ( theSRE ) ; if ( index >= 0 ) { this . runtimeEnvironmentCombo . select ( index ) ; changed = true ; } } if ( ! this . runtimeEnvironments . isEmpty ( ) ) { int selection = this . runtimeEnvironmentCombo . getSelectionIndex ( ) ; if ( selection < 0 || selection >= this . runtimeEnvironments . size ( ) ) { selection = indexOf ( theSRE ) ; this . runtimeEnvironmentCombo . select ( ( selection < 0 ) ? 0 : selection ) ; changed = true ; } } } finally { this . notify = oldNotify ; } if ( changed ) { firePropertyChange ( ) ; return true ; } } return false ; }
Select a specific SRE .
34,315
public ISREInstall getSelectedSRE ( ) { if ( this . enableSystemWideSelector && this . systemSREButton . getSelection ( ) ) { return SARLRuntime . getDefaultSREInstall ( ) ; } if ( ! this . projectProviderFactories . isEmpty ( ) && this . projectSREButton . getSelection ( ) ) { return retreiveProjectSRE ( ) ; } return getSpecificSRE ( ) ; }
Replies the selected SARL runtime environment .
34,316
public ISREInstall getSpecificSRE ( ) { final int index = this . runtimeEnvironmentCombo . getSelectionIndex ( ) ; if ( index >= 0 && index < this . runtimeEnvironments . size ( ) ) { return this . runtimeEnvironments . get ( index ) ; } return null ; }
Replies the specific SARL runtime environment .
34,317
public void updateEnableState ( ) { boolean comboEnabled = ! this . runtimeEnvironments . isEmpty ( ) ; boolean searchEnabled = true ; if ( isSystemWideDefaultSRE ( ) || isProjectSRE ( ) ) { comboEnabled = false ; searchEnabled = false ; } this . runtimeEnvironmentCombo . setEnabled ( comboEnabled ) ; this . runtimeEnvironmentSearchButton . setEnabled ( searchEnabled ) ; }
Update the enable state of the block .
34,318
public void initialize ( ) { this . runtimeEnvironments . clear ( ) ; final ISREInstall [ ] sres = SARLRuntime . getSREInstalls ( ) ; Arrays . sort ( sres , new Comparator < ISREInstall > ( ) { public int compare ( ISREInstall o1 , ISREInstall o2 ) { return o1 . getName ( ) . compareTo ( o2 . getName ( ) ) ; } } ) ; final List < String > labels = new ArrayList < > ( sres . length ) ; for ( int i = 0 ; i < sres . length ; ++ i ) { if ( sres [ i ] . getValidity ( ) . isOK ( ) ) { this . runtimeEnvironments . add ( sres [ i ] ) ; labels . add ( sres [ i ] . getName ( ) ) ; } } this . runtimeEnvironmentCombo . setItems ( labels . toArray ( new String [ labels . size ( ) ] ) ) ; updateExternalSREButtonLabels ( ) ; if ( this . enableSystemWideSelector ) { this . specificSREButton . setSelection ( false ) ; if ( ! this . projectProviderFactories . isEmpty ( ) ) { this . projectSREButton . setSelection ( false ) ; } this . systemSREButton . setSelection ( true ) ; } else if ( ! this . projectProviderFactories . isEmpty ( ) ) { this . specificSREButton . setSelection ( false ) ; if ( this . enableSystemWideSelector ) { this . systemSREButton . setSelection ( false ) ; } this . projectSREButton . setSelection ( true ) ; } this . sreListener = new InstallChange ( ) ; SARLRuntime . addSREInstallChangedListener ( this . sreListener ) ; updateEnableState ( ) ; }
Initialize the block with the installed JREs . The selection and the components states are not updated by this function .
34,319
protected void handleInstalledSREsButtonSelected ( ) { PreferencesUtil . createPreferenceDialogOn ( getControl ( ) . getShell ( ) , SREsPreferencePage . ID , new String [ ] { SREsPreferencePage . ID } , null ) . open ( ) ; }
Invoked when the user want to search for a SARL runtime environment .
34,320
public IStatus validate ( ISREInstall sre ) { final IStatus status ; if ( this . enableSystemWideSelector && this . systemSREButton . getSelection ( ) ) { if ( SARLRuntime . getDefaultSREInstall ( ) == null ) { status = SARLEclipsePlugin . getDefault ( ) . createStatus ( IStatus . ERROR , Messages . SREConfigurationBlock_5 ) ; } else { status = SARLEclipsePlugin . getDefault ( ) . createOkStatus ( ) ; } } else if ( ! this . projectProviderFactories . isEmpty ( ) && this . projectSREButton . getSelection ( ) ) { if ( retreiveProjectSRE ( ) == null ) { status = SARLEclipsePlugin . getDefault ( ) . createStatus ( IStatus . ERROR , Messages . SREConfigurationBlock_6 ) ; } else { status = SARLEclipsePlugin . getDefault ( ) . createOkStatus ( ) ; } } else if ( this . runtimeEnvironments . isEmpty ( ) ) { status = SARLEclipsePlugin . getDefault ( ) . createStatus ( IStatus . ERROR , Messages . SREConfigurationBlock_8 ) ; } else { status = sre . getValidity ( ) ; } return status ; }
Validate that the given SRE is valid in the context of the SRE configuration .
34,321
protected static void closeWelcomePage ( ) { final IIntroManager introManager = PlatformUI . getWorkbench ( ) . getIntroManager ( ) ; if ( introManager != null ) { final IIntroPart intro = introManager . getIntro ( ) ; if ( intro != null ) { introManager . closeIntro ( intro ) ; } } }
Close the welcome page .
34,322
public void destroy ( ) { synchronized ( getSpaceIDsMutex ( ) ) { if ( this . internalListener != null ) { this . spaceIDs . removeDMapListener ( this . internalListener ) ; } final List < SpaceID > ids = new ArrayList < > ( this . spaceIDs . keySet ( ) ) ; this . spaceIDs . clear ( ) ; for ( final SpaceID spaceId : ids ) { removeLocalSpaceDefinition ( spaceId , true ) ; } } }
Destroy this repository and releaqse all the resources .
34,323
@ SuppressWarnings ( { "unchecked" , "rawtypes" } ) protected void ensureLocalSpaceDefinition ( SpaceID id , Object [ ] initializationParameters ) { synchronized ( getSpaceRepositoryMutex ( ) ) { if ( ! this . spaces . containsKey ( id ) ) { createSpaceInstance ( ( Class ) id . getSpaceSpecification ( ) , id , false , initializationParameters ) ; } } }
Add the existing but not yet known spaces into this repository .
34,324
protected void removeLocalSpaceDefinition ( SpaceID id , boolean isLocalDestruction ) { final Space space ; synchronized ( getSpaceRepositoryMutex ( ) ) { space = this . spaces . remove ( id ) ; if ( space != null ) { this . spacesBySpec . remove ( id . getSpaceSpecification ( ) , id ) ; } } if ( space != null ) { fireSpaceRemoved ( space , isLocalDestruction ) ; } }
Remove a remote space .
34,325
protected void removeLocalSpaceDefinitions ( boolean isLocalDestruction ) { List < Space > removedSpaces = null ; synchronized ( getSpaceRepositoryMutex ( ) ) { if ( ! this . spaces . isEmpty ( ) ) { removedSpaces = new ArrayList < > ( this . spaces . size ( ) ) ; final Iterator < Entry < SpaceID , Space > > iterator = this . spaces . entrySet ( ) . iterator ( ) ; Space space ; SpaceID id ; while ( iterator . hasNext ( ) ) { final Entry < SpaceID , Space > entry = iterator . next ( ) ; id = entry . getKey ( ) ; space = entry . getValue ( ) ; iterator . remove ( ) ; this . spacesBySpec . remove ( id . getSpaceSpecification ( ) , id ) ; removedSpaces . add ( space ) ; } } } if ( removedSpaces != null ) { for ( final Space s : removedSpaces ) { fireSpaceRemoved ( s , isLocalDestruction ) ; } } }
Remove all the remote spaces .
34,326
public < S extends io . sarl . lang . core . Space > S createSpace ( SpaceID spaceID , Class < ? extends SpaceSpecification < S > > spec , Object ... creationParams ) { synchronized ( getSpaceRepositoryMutex ( ) ) { if ( ! this . spaces . containsKey ( spaceID ) ) { return createSpaceInstance ( spec , spaceID , true , creationParams ) ; } } return null ; }
Create a space .
34,327
@ SuppressWarnings ( "unchecked" ) public < S extends io . sarl . lang . core . Space > S getOrCreateSpaceWithSpec ( SpaceID spaceID , Class < ? extends SpaceSpecification < S > > spec , Object ... creationParams ) { synchronized ( getSpaceRepositoryMutex ( ) ) { final Collection < SpaceID > ispaces = this . spacesBySpec . get ( spec ) ; final S firstSpace ; if ( ispaces == null || ispaces . isEmpty ( ) ) { firstSpace = createSpaceInstance ( spec , spaceID , true , creationParams ) ; } else { firstSpace = ( S ) this . spaces . get ( ispaces . iterator ( ) . next ( ) ) ; } assert firstSpace != null ; return firstSpace ; } }
Retrieve the first space of the given specification or create a space if none .
34,328
@ SuppressWarnings ( "unchecked" ) public < S extends io . sarl . lang . core . Space > S getOrCreateSpaceWithID ( SpaceID spaceID , Class < ? extends SpaceSpecification < S > > spec , Object ... creationParams ) { synchronized ( getSpaceRepositoryMutex ( ) ) { Space space = this . spaces . get ( spaceID ) ; if ( space == null ) { space = createSpaceInstance ( spec , spaceID , true , creationParams ) ; } assert space != null ; return ( S ) space ; } }
Retrieve the first space of the given identifier or create a space if none .
34,329
public SynchronizedCollection < ? extends Space > getSpaces ( ) { synchronized ( getSpaceRepositoryMutex ( ) ) { return Collections3 . synchronizedCollection ( Collections . unmodifiableCollection ( this . spaces . values ( ) ) , getSpaceRepositoryMutex ( ) ) ; } }
Returns the collection of all spaces stored in this repository .
34,330
protected IStatus revalidate ( int ignoreCauses ) { try { setDirty ( false ) ; resolveDirtyFields ( false ) ; return getValidity ( ignoreCauses ) ; } catch ( Throwable e ) { if ( ( ignoreCauses & CODE_GENERAL ) == 0 ) { return SARLEclipsePlugin . getDefault ( ) . createStatus ( IStatus . ERROR , CODE_GENERAL , e ) ; } return SARLEclipsePlugin . getDefault ( ) . createOkStatus ( ) ; } }
Force the computation of the installation validity .
34,331
public void setClassPathEntries ( List < IRuntimeClasspathEntry > libraries ) { if ( isDirty ( ) ) { setDirty ( false ) ; resolveDirtyFields ( true ) ; } if ( ( libraries == null && this . classPathEntries != null ) || ( libraries != null && ( this . classPathEntries == null || libraries != this . classPathEntries ) ) ) { final PropertyChangeEvent event = new PropertyChangeEvent ( this , ISREInstallChangedListener . PROPERTY_LIBRARY_LOCATIONS , this . classPathEntries , libraries ) ; this . classPathEntries = libraries ; if ( this . notify ) { SARLRuntime . fireSREChanged ( event ) ; } } }
Change the library locations of this ISREInstall .
34,332
protected static String formatCommandLineOption ( String name , String value ) { final StringBuilder str = new StringBuilder ( ) ; str . append ( "--" ) ; if ( ! Strings . isNullOrEmpty ( name ) ) { str . append ( name ) ; if ( ! Strings . isNullOrEmpty ( value ) ) { str . append ( "=" ) ; str . append ( value ) ; } } return str . toString ( ) ; }
Replies the string representation of a command - line option .
34,333
public boolean isCastOperatorLinkingEnabled ( SarlCastedExpression cast ) { final LightweightTypeReference sourceType = getStackedResolvedTypes ( ) . getReturnType ( cast . getTarget ( ) ) ; final LightweightTypeReference destinationType = getReferenceOwner ( ) . toLightweightTypeReference ( cast . getType ( ) ) ; if ( sourceType . isPrimitiveVoid ( ) || destinationType . isPrimitiveVoid ( ) ) { return false ; } if ( sourceType . isPrimitive ( ) && destinationType . isPrimitive ( ) ) { return false ; } return ! sourceType . isSubtypeOf ( destinationType . getType ( ) ) ; }
Replies if the linking to the cast operator functions is enabled .
34,334
public List < ? extends ILinkingCandidate > getLinkingCandidates ( SarlCastedExpression cast ) { final StackedResolvedTypes demandComputedTypes = pushTypes ( ) ; final AbstractTypeComputationState forked = withNonVoidExpectation ( demandComputedTypes ) ; final ForwardingResolvedTypes demandResolvedTypes = new ForwardingResolvedTypes ( ) { protected IResolvedTypes delegate ( ) { return forked . getResolvedTypes ( ) ; } public LightweightTypeReference getActualType ( XExpression expression ) { final LightweightTypeReference type = super . getActualType ( expression ) ; if ( type == null ) { final ITypeComputationResult result = forked . computeTypes ( expression ) ; return result . getActualExpressionType ( ) ; } return type ; } } ; final IScope scope = getCastScopeSession ( ) . getScope ( cast , SarlPackage . Literals . SARL_CASTED_EXPRESSION__FEATURE , demandResolvedTypes ) ; final LightweightTypeReference targetType = getReferenceOwner ( ) . toLightweightTypeReference ( cast . getType ( ) ) ; final List < ILinkingCandidate > resultList = Lists . newArrayList ( ) ; final LightweightTypeReference expressionType = getStackedResolvedTypes ( ) . getActualType ( cast . getTarget ( ) ) ; final ISelector validator = this . candidateValidator . prepare ( getParent ( ) , targetType , expressionType ) ; for ( final IEObjectDescription description : scope . getAllElements ( ) ) { final IIdentifiableElementDescription idesc = toIdentifiableDescription ( description ) ; if ( validator . isCastOperatorCandidate ( idesc ) ) { final ExpressionAwareStackedResolvedTypes descriptionResolvedTypes = pushTypes ( cast ) ; final ExpressionTypeComputationState descriptionState = createExpressionComputationState ( cast , descriptionResolvedTypes ) ; final ILinkingCandidate candidate = createCandidate ( cast , descriptionState , idesc ) ; if ( candidate != null ) { resultList . add ( candidate ) ; } } } return resultList ; }
Compute the best candidates for the feature behind the cast operator .
34,335
protected ILinkingCandidate createCandidate ( SarlCastedExpression cast , ExpressionTypeComputationState state , IIdentifiableElementDescription description ) { return new CastOperatorLinkingCandidate ( cast , description , getSingleExpectation ( state ) , state ) ; }
Create a candidate from the given description .
34,336
@ SuppressWarnings ( "static-method" ) public void resetFeature ( SarlCastedExpression object ) { setStructuralFeature ( object , SarlPackage . Literals . SARL_CASTED_EXPRESSION__FEATURE , null ) ; setStructuralFeature ( object , SarlPackage . Literals . SARL_CASTED_EXPRESSION__RECEIVER , null ) ; setStructuralFeature ( object , SarlPackage . Literals . SARL_CASTED_EXPRESSION__ARGUMENT , null ) ; }
Reset the properties of the given feature in order to have casted expression that is not linked to an operation .
34,337
public IDocumentAutoFormatter getDocumentAutoFormatter ( ) { final IDocument document = getDocument ( ) ; if ( document instanceof IXtextDocument ) { final IDocumentAutoFormatter formatter = this . autoFormatterProvider . get ( ) ; formatter . bind ( ( IXtextDocument ) document , this . fContentFormatter ) ; return formatter ; } return new IDocumentAutoFormatter ( ) { } ; }
Replies the document auto - formatter .
34,338
public IExpressionBuilder getInitialValue ( ) { IExpressionBuilder exprBuilder = this . expressionProvider . get ( ) ; exprBuilder . eInit ( getSarlField ( ) , new Procedures . Procedure1 < XExpression > ( ) { public void apply ( XExpression expr ) { getSarlField ( ) . setInitialValue ( expr ) ; } } , getTypeResolutionContext ( ) ) ; return exprBuilder ; }
Change the initialValue .
34,339
public void setOutlineEntryFormat ( String formatWithoutNumbers , String formatWithNumbers ) { if ( ! Strings . isEmpty ( formatWithoutNumbers ) ) { this . outlineEntryWithoutNumberFormat = formatWithoutNumbers ; } if ( ! Strings . isEmpty ( formatWithNumbers ) ) { this . outlineEntryWithNumberFormat = formatWithNumbers ; } }
Change the formats to be applied to the outline entries .
34,340
public void setOutlineDepthRange ( IntegerRange level ) { if ( level == null ) { this . outlineDepthRange = new IntegerRange ( DEFAULT_OUTLINE_TOP_LEVEL , DEFAULT_OUTLINE_TOP_LEVEL ) ; } else { this . outlineDepthRange = level ; } }
Change the level at which the titles may appear in the outline .
34,341
@ SuppressWarnings ( "static-method" ) protected ReferenceContext extractReferencableElements ( String text ) { final ReferenceContext context = new ReferenceContext ( ) ; final MutableDataSet options = new MutableDataSet ( ) ; final Parser parser = Parser . builder ( options ) . build ( ) ; final Node document = parser . parse ( text ) ; final Pattern pattern = Pattern . compile ( SECTION_PATTERN_AUTONUMBERING ) ; NodeVisitor visitor = new NodeVisitor ( new VisitHandler < > ( Paragraph . class , it -> { final Matcher matcher = pattern . matcher ( it . getContentChars ( ) ) ; if ( matcher . find ( ) ) { final String number = matcher . group ( 2 ) ; final String title = matcher . group ( 3 ) ; final String key1 = computeHeaderId ( number , title ) ; final String key2 = computeHeaderId ( null , title ) ; context . registerSection ( key1 , key2 , title ) ; } } ) ) ; visitor . visitChildren ( document ) ; visitor = new NodeVisitor ( new VisitHandler < > ( Heading . class , it -> { String key = it . getAnchorRefId ( ) ; final String title = it . getAnchorRefText ( ) ; final String key2 = computeHeaderId ( null , title ) ; if ( Strings . isEmpty ( key ) ) { key = key2 ; } context . registerSection ( key , key2 , title ) ; } ) ) ; visitor . visitChildren ( document ) ; return context ; }
Extract all the referencable objects from the given content .
34,342
protected String transformHtmlLinks ( String content , ReferenceContext references ) { if ( ! isPureHtmlReferenceTransformation ( ) ) { return content ; } final Map < String , String > replacements = new TreeMap < > ( ) ; final org . jsoup . select . NodeVisitor visitor = new org . jsoup . select . NodeVisitor ( ) { public void tail ( org . jsoup . nodes . Node node , int index ) { } public void head ( org . jsoup . nodes . Node node , int index ) { if ( node instanceof Element ) { final Element tag = ( Element ) node ; if ( "a" . equals ( tag . nodeName ( ) ) && tag . hasAttr ( "href" ) ) { final String href = tag . attr ( "href" ) ; if ( ! Strings . isEmpty ( href ) ) { URL url = FileSystem . convertStringToURL ( href , true ) ; url = transformURL ( url , references ) ; if ( url != null ) { replacements . put ( href , convertURLToString ( url ) ) ; } } } } } } ; final Document htmlDocument = Jsoup . parse ( content ) ; htmlDocument . traverse ( visitor ) ; if ( ! replacements . isEmpty ( ) ) { String buffer = content ; for ( final Entry < String , String > entry : replacements . entrySet ( ) ) { final String source = entry . getKey ( ) ; final String dest = entry . getValue ( ) ; buffer = buffer . replaceAll ( Pattern . quote ( source ) , Matcher . quoteReplacement ( dest ) ) ; } return buffer ; } return content ; }
Apply link transformation on the HTML links .
34,343
protected String transformMardownLinks ( String content , ReferenceContext references ) { if ( ! isMarkdownToHtmlReferenceTransformation ( ) ) { return content ; } final Map < BasedSequence , String > replacements = new TreeMap < > ( ( cmp1 , cmp2 ) -> { final int cmp = Integer . compare ( cmp2 . getStartOffset ( ) , cmp1 . getStartOffset ( ) ) ; if ( cmp != 0 ) { return cmp ; } return Integer . compare ( cmp2 . getEndOffset ( ) , cmp1 . getEndOffset ( ) ) ; } ) ; final MutableDataSet options = new MutableDataSet ( ) ; final Parser parser = Parser . builder ( options ) . build ( ) ; final Node document = parser . parse ( content ) ; final NodeVisitor visitor = new NodeVisitor ( new VisitHandler < > ( Link . class , it -> { URL url = FileSystem . convertStringToURL ( it . getUrl ( ) . toString ( ) , true ) ; url = transformURL ( url , references ) ; if ( url != null ) { replacements . put ( it . getUrl ( ) , convertURLToString ( url ) ) ; } } ) ) ; visitor . visitChildren ( document ) ; if ( ! replacements . isEmpty ( ) ) { final StringBuilder buffer = new StringBuilder ( content ) ; for ( final Entry < BasedSequence , String > entry : replacements . entrySet ( ) ) { final BasedSequence seq = entry . getKey ( ) ; buffer . replace ( seq . getStartOffset ( ) , seq . getEndOffset ( ) , entry . getValue ( ) ) ; } return buffer . toString ( ) ; } return content ; }
Apply link transformation on the Markdown links .
34,344
static String convertURLToString ( URL url ) { if ( URISchemeType . FILE . isURL ( url ) ) { final StringBuilder externalForm = new StringBuilder ( ) ; externalForm . append ( url . getPath ( ) ) ; final String ref = url . getRef ( ) ; if ( ! Strings . isEmpty ( ref ) ) { externalForm . append ( "#" ) . append ( ref ) ; } return externalForm . toString ( ) ; } return url . toExternalForm ( ) ; }
Convert the given URL to its string representation that is compatible with Markdown document linking mechanism .
34,345
protected URL transformURL ( URL link , ReferenceContext references ) { if ( URISchemeType . FILE . isURL ( link ) ) { File filename = FileSystem . convertURLToFile ( link ) ; if ( Strings . isEmpty ( filename . getName ( ) ) ) { final String anchor = transformURLAnchor ( filename , link . getRef ( ) , references ) ; final URL url = FileSystemAddons . convertFileToURL ( filename , true ) ; if ( ! Strings . isEmpty ( anchor ) ) { try { return new URL ( url . toExternalForm ( ) + "#" + anchor ) ; } catch ( MalformedURLException e ) { } } return url ; } final String extension = FileSystem . extension ( filename ) ; if ( isMarkdownFileExtension ( extension ) ) { filename = FileSystem . replaceExtension ( filename , ".html" ) ; final String anchor = transformURLAnchor ( filename , link . getRef ( ) , null ) ; final URL url = FileSystemAddons . convertFileToURL ( filename , true ) ; if ( ! Strings . isEmpty ( anchor ) ) { try { return new URL ( url . toExternalForm ( ) + "#" + anchor ) ; } catch ( MalformedURLException e ) { } } return url ; } } return null ; }
Transform an URL from Markdown format to HTML format .
34,346
@ SuppressWarnings ( "static-method" ) protected String transformURLAnchor ( File file , String anchor , ReferenceContext references ) { String anc = anchor ; if ( references != null ) { anc = references . validateAnchor ( anc ) ; } return anc ; }
Transform the anchor of an URL from Markdown format to HTML format .
34,347
public static boolean isMarkdownFileExtension ( String extension ) { for ( final String ext : MARKDOWN_FILE_EXTENSIONS ) { if ( Strings . equal ( ext , extension ) ) { return true ; } } return false ; }
Replies if the given extension is for Markdown file .
34,348
protected void addOutlineEntry ( StringBuilder outline , int level , String sectionNumber , String title , String sectionId , boolean htmlOutput ) { if ( htmlOutput ) { indent ( outline , level - 1 , " " ) ; outline . append ( "<li><a href=\"#" ) ; outline . append ( sectionId ) ; outline . append ( "\">" ) ; if ( isAutoSectionNumbering ( ) && ! Strings . isEmpty ( sectionNumber ) ) { outline . append ( sectionNumber ) . append ( ". " ) ; } outline . append ( title ) ; outline . append ( "</a></li>" ) ; } else { final String prefix = "*" ; final String entry ; outline . append ( "> " ) ; indent ( outline , level - 1 , "\t" ) ; if ( isAutoSectionNumbering ( ) ) { entry = MessageFormat . format ( getOutlineEntryFormat ( ) , prefix , Strings . emptyIfNull ( sectionNumber ) , title , sectionId ) ; } else { entry = MessageFormat . format ( getOutlineEntryFormat ( ) , prefix , title , sectionId ) ; } outline . append ( entry ) ; } outline . append ( "\n" ) ; }
Update the outline entry .
34,349
protected String formatSectionTitle ( String prefix , String sectionNumber , String title , String sectionId ) { return MessageFormat . format ( getSectionTitleFormat ( ) , prefix , sectionNumber , title , sectionId ) + "\n" ; }
Format the section title .
34,350
protected static void indent ( StringBuilder buffer , int number , String character ) { for ( int i = 0 ; i < number ; ++ i ) { buffer . append ( character ) ; } }
Create indentation in the given buffer .
34,351
protected static int computeLineNo ( Node node ) { final int offset = node . getStartOffset ( ) ; final BasedSequence seq = node . getDocument ( ) . getChars ( ) ; int tmpOffset = seq . endOfLine ( 0 ) ; int lineno = 1 ; while ( tmpOffset < offset ) { ++ lineno ; tmpOffset = seq . endOfLineAnyEOL ( tmpOffset + seq . eolLength ( tmpOffset ) ) ; } return lineno ; }
Compute the number of lines for reaching the given node .
34,352
protected Iterable < DynamicValidationComponent > createValidatorComponents ( Image it , File currentFile , DynamicValidationContext context ) { final Collection < DynamicValidationComponent > components = new ArrayList < > ( ) ; if ( isLocalImageReferenceValidation ( ) ) { final int lineno = computeLineNo ( it ) ; final URL url = FileSystem . convertStringToURL ( it . getUrl ( ) . toString ( ) , true ) ; if ( URISchemeType . FILE . isURL ( url ) ) { final DynamicValidationComponent component = createLocalImageValidatorComponent ( it , url , lineno , currentFile , context ) ; if ( component != null ) { components . add ( component ) ; } } } return components ; }
Create a validation component for an image reference .
34,353
protected Iterable < DynamicValidationComponent > createValidatorComponents ( Link it , File currentFile , DynamicValidationContext context ) { final Collection < DynamicValidationComponent > components = new ArrayList < > ( ) ; if ( isLocalFileReferenceValidation ( ) || isRemoteReferenceValidation ( ) ) { final int lineno = computeLineNo ( it ) ; final URL url = FileSystem . convertStringToURL ( it . getUrl ( ) . toString ( ) , true ) ; if ( URISchemeType . HTTP . isURL ( url ) || URISchemeType . HTTPS . isURL ( url ) || URISchemeType . FTP . isURL ( url ) ) { if ( isRemoteReferenceValidation ( ) ) { final Collection < DynamicValidationComponent > newComponents = createRemoteReferenceValidatorComponents ( it , url , lineno , currentFile , context ) ; if ( newComponents != null && ! newComponents . isEmpty ( ) ) { components . addAll ( newComponents ) ; } } } else if ( URISchemeType . FILE . isURL ( url ) ) { if ( isLocalFileReferenceValidation ( ) ) { final Collection < DynamicValidationComponent > newComponents = createLocalFileValidatorComponents ( it , url , lineno , currentFile , context ) ; if ( newComponents != null && ! newComponents . isEmpty ( ) ) { components . addAll ( newComponents ) ; } } } } return components ; }
Create a validation component for an hyper reference .
34,354
@ SuppressWarnings ( "static-method" ) protected DynamicValidationComponent createLocalImageValidatorComponent ( Image it , URL url , int lineno , File currentFile , DynamicValidationContext context ) { File fn = FileSystem . convertURLToFile ( url ) ; if ( ! fn . isAbsolute ( ) ) { fn = FileSystem . join ( currentFile . getParentFile ( ) , fn ) ; } final File filename = fn ; return new DynamicValidationComponent ( ) { public String functionName ( ) { return "Image_reference_test_" + lineno + "_" ; } public void generateValidationCode ( ITreeAppendable it ) { context . appendFileExistenceTest ( it , filename , Messages . MarkdownParser_0 ) ; } } ; }
Create a validation component for a reference to a local image .
34,355
@ SuppressWarnings ( "static-method" ) protected Collection < DynamicValidationComponent > createLocalFileValidatorComponents ( Link it , URL url , int lineno , File currentFile , DynamicValidationContext context ) { File fn = FileSystem . convertURLToFile ( url ) ; if ( Strings . isEmpty ( fn . getName ( ) ) ) { final String linkRef = url . getRef ( ) ; if ( ! Strings . isEmpty ( linkRef ) ) { return Arrays . asList ( new DynamicValidationComponent ( ) { public String functionName ( ) { return "Documentation_reference_anchor_test_" + lineno + "_" ; } public void generateValidationCode ( ITreeAppendable it ) { context . setTempResourceRoots ( null ) ; context . appendTitleAnchorExistenceTest ( it , currentFile , url . getRef ( ) , SECTION_PATTERN_TITLE_EXTRACTOR , Iterables . concat ( Arrays . asList ( MARKDOWN_FILE_EXTENSIONS ) , Arrays . asList ( HTML_FILE_EXTENSIONS ) ) ) ; } } ) ; } return null ; } if ( ! fn . isAbsolute ( ) ) { fn = FileSystem . join ( currentFile . getParentFile ( ) , fn ) ; } final File filename = fn ; final String extension = FileSystem . extension ( filename ) ; if ( isMarkdownFileExtension ( extension ) || isHtmlFileExtension ( extension ) ) { final DynamicValidationComponent existence = new DynamicValidationComponent ( ) { public String functionName ( ) { return "Documentation_reference_test_" + lineno + "_" ; } public void generateValidationCode ( ITreeAppendable it ) { context . setTempResourceRoots ( context . getSourceRoots ( ) ) ; context . appendFileExistenceTest ( it , filename , Messages . MarkdownParser_1 , Iterables . concat ( Arrays . asList ( MARKDOWN_FILE_EXTENSIONS ) , Arrays . asList ( HTML_FILE_EXTENSIONS ) ) ) ; } } ; if ( ! Strings . isEmpty ( url . getRef ( ) ) ) { final DynamicValidationComponent refValidity = new DynamicValidationComponent ( ) { public String functionName ( ) { return "Documentation_reference_anchor_test_" + lineno + "_" ; } public void generateValidationCode ( ITreeAppendable it ) { context . setTempResourceRoots ( null ) ; context . appendTitleAnchorExistenceTest ( it , filename , url . getRef ( ) , SECTION_PATTERN_TITLE_EXTRACTOR , Iterables . concat ( Arrays . asList ( MARKDOWN_FILE_EXTENSIONS ) , Arrays . asList ( HTML_FILE_EXTENSIONS ) ) ) ; } } ; return Arrays . asList ( existence , refValidity ) ; } return Collections . singleton ( existence ) ; } return Arrays . asList ( new DynamicValidationComponent ( ) { public String functionName ( ) { return "File_reference_test_" + lineno + "_" ; } public void generateValidationCode ( ITreeAppendable it ) { context . appendFileExistenceTest ( it , filename , Messages . MarkdownParser_1 ) ; } } ) ; }
Create a validation component for an hyper reference to a local file .
34,356
@ SuppressWarnings ( "static-method" ) protected Collection < DynamicValidationComponent > createRemoteReferenceValidatorComponents ( Link it , URL url , int lineno , File currentFile , DynamicValidationContext context ) { return Collections . singleton ( new DynamicValidationComponent ( ) { public String functionName ( ) { return "Web_reference_test_" + lineno + "_" ; } public void generateValidationCode ( ITreeAppendable it ) { it . append ( "assertURLAccessibility(" ) . append ( Integer . toString ( lineno ) ) ; it . append ( ", new " ) ; it . append ( URL . class ) . append ( "(\"" ) ; it . append ( Strings . convertToJavaString ( url . toExternalForm ( ) ) ) ; it . append ( "\"));" ) ; } } ) ; }
Create a validation component for an hyper reference to a remote Internet page .
34,357
public JvmParameterizedTypeReference newTypeRef ( Notifier context , String typeName ) { JvmTypeReference typeReference ; try { typeReference = findType ( context , typeName ) ; getImportManager ( ) . addImportFor ( typeReference . getType ( ) ) ; return ( JvmParameterizedTypeReference ) typeReference ; } catch ( TypeNotPresentException exception ) { } final JvmParameterizedTypeReference pref = ExpressionBuilderImpl . parseType ( context , typeName , this ) ; final JvmTypeReference baseType = findType ( context , pref . getType ( ) . getIdentifier ( ) ) ; final int len = pref . getArguments ( ) . size ( ) ; final JvmTypeReference [ ] args = new JvmTypeReference [ len ] ; for ( int i = 0 ; i < len ; ++ i ) { final JvmTypeReference original = pref . getArguments ( ) . get ( i ) ; if ( original instanceof JvmAnyTypeReference ) { args [ i ] = EcoreUtil . copy ( original ) ; } else if ( original instanceof JvmWildcardTypeReference ) { final JvmWildcardTypeReference wc = EcoreUtil . copy ( ( JvmWildcardTypeReference ) original ) ; for ( final JvmTypeConstraint c : wc . getConstraints ( ) ) { c . setTypeReference ( newTypeRef ( context , c . getTypeReference ( ) . getIdentifier ( ) ) ) ; } args [ i ] = wc ; } else { args [ i ] = newTypeRef ( context , original . getIdentifier ( ) ) ; } } final TypeReferences typeRefs = getTypeReferences ( ) ; return typeRefs . createTypeRef ( baseType . getType ( ) , args ) ; }
Replies the type reference for the given name in the given context .
34,358
protected boolean isSubTypeOf ( EObject context , JvmTypeReference subType , JvmTypeReference superType ) { if ( isTypeReference ( superType ) && isTypeReference ( subType ) ) { StandardTypeReferenceOwner owner = new StandardTypeReferenceOwner ( services , context ) ; LightweightTypeReferenceFactory factory = new LightweightTypeReferenceFactory ( owner , false ) ; LightweightTypeReference reference = factory . toLightweightReference ( subType ) ; return reference . isSubtypeOf ( superType . getType ( ) ) ; } return false ; }
Replies if the first parameter is a subtype of the second parameter .
34,359
protected boolean isTypeReference ( JvmTypeReference typeReference ) { return ( typeReference != null && ! typeReference . eIsProxy ( ) && typeReference . getType ( ) != null && ! typeReference . getType ( ) . eIsProxy ( ) ) ; }
Replies if the given object is a valid type reference .
34,360
protected boolean isActionBodyAllowed ( XtendTypeDeclaration type ) { return ! ( type instanceof SarlAnnotationType || type instanceof SarlCapacity || type instanceof SarlEvent || type instanceof SarlInterface ) ; }
Replies if the type could contains functions with a body .
34,361
protected void recommendFrom ( String label , Set < BindingElement > source , Set < Binding > current ) { this . bindingFactory . setName ( getName ( ) ) ; boolean hasRecommend = false ; for ( final BindingElement sourceElement : source ) { final Binding wrapElement = this . bindingFactory . toBinding ( sourceElement ) ; if ( ! current . contains ( wrapElement ) ) { if ( ! hasRecommend ) { LOG . info ( MessageFormat . format ( "Begin recommendations for {0}" , label ) ) ; hasRecommend = true ; } LOG . warn ( MessageFormat . format ( "\t{1}" , label , sourceElement . getKeyString ( ) ) ) ; } } if ( hasRecommend ) { LOG . info ( MessageFormat . format ( "End recommendations for {0}" , label ) ) ; } else { LOG . info ( MessageFormat . format ( "No recommendation for {0}" , label ) ) ; } }
Provide the recommendations .
34,362
protected void recommend ( Class < ? > superModule , GuiceModuleAccess currentModuleAccess ) { LOG . info ( MessageFormat . format ( "Building injection configuration from {0}" , superModule . getName ( ) ) ) ; final Set < BindingElement > superBindings = new LinkedHashSet < > ( ) ; fillFrom ( superBindings , superModule . getSuperclass ( ) ) ; fillFrom ( superBindings , superModule ) ; final Set < Binding > currentBindings = currentModuleAccess . getBindings ( ) ; recommendFrom ( superModule . getName ( ) , superBindings , currentBindings ) ; }
Provide the recommendations for the given module .
34,363
public ConversionType getConversionTypeFor ( XAbstractFeatureCall featureCall ) { if ( this . conversions == null ) { this . conversions = initMapping ( ) ; } final List < Object > receiver = new ArrayList < > ( ) ; AbstractExpressionGenerator . buildCallReceiver ( featureCall , this . keywords . getThisKeywordLambda ( ) , this . referenceNameLambda , receiver ) ; final String simpleName = AbstractExpressionGenerator . getCallSimpleName ( featureCall , this . logicalContainerProvider , this . simpleNameProvider , this . keywords . getNullKeywordLambda ( ) , this . keywords . getThisKeywordLambda ( ) , this . keywords . getSuperKeywordLambda ( ) , this . referenceNameLambda2 ) ; final List < Pair < FeaturePattern , FeatureReplacement > > struct = this . conversions . get ( getKey ( simpleName ) ) ; if ( struct != null ) { final String replacementId = featureCall . getFeature ( ) . getIdentifier ( ) ; final FeatureReplacement replacement = matchFirstPattern ( struct , replacementId , simpleName , receiver ) ; if ( replacement != null ) { if ( replacement . hasReplacement ( ) ) { return ConversionType . EXPLICIT ; } return ConversionType . FORBIDDEN_CONVERSION ; } } return ConversionType . IMPLICIT ; }
Replies the type of conversion for the given feature call .
34,364
public ConversionResult convertFeatureCall ( String simpleName , JvmIdentifiableElement calledFeature , List < Object > leftOperand , List < Object > receiver , List < XExpression > arguments ) { if ( this . conversions == null ) { this . conversions = initMapping ( ) ; } final List < Pair < FeaturePattern , FeatureReplacement > > struct = this . conversions . get ( getKey ( simpleName ) ) ; if ( struct != null ) { final String replacementId = calledFeature . getIdentifier ( ) ; final FeatureReplacement replacement = matchFirstPattern ( struct , replacementId , simpleName , receiver ) ; if ( replacement != null ) { if ( replacement . hasReplacement ( ) ) { return replacement . replace ( calledFeature , leftOperand , receiver , arguments ) ; } return null ; } } return new ConversionResult ( simpleName ) ; }
Convert a full call to a feature .
34,365
public String convertDeclarationName ( String simpleName , SarlAction feature ) { assert simpleName != null ; assert feature != null ; final JvmOperation operation = this . associations . getDirectlyInferredOperation ( feature ) ; if ( operation != null ) { if ( this . conversions == null ) { this . conversions = initMapping ( ) ; } final List < Pair < FeaturePattern , FeatureReplacement > > struct = this . conversions . get ( getKey ( simpleName ) ) ; if ( struct == null ) { return simpleName ; } final FeatureReplacement replacement = matchFirstPattern ( struct , operation . getIdentifier ( ) ) ; if ( replacement != null ) { if ( replacement . hasReplacement ( ) ) { return replacement . getText ( ) ; } return null ; } return simpleName ; } return simpleName ; }
Convert the given name for the given feature to its equivalent in the extra language .
34,366
public static IExtraLanguageConversionInitializer getTypeConverterInitializer ( ) { return it -> { final List < Pair < String , String > > properties = loadPropertyFile ( TYPE_CONVERSION_FILENAME ) ; if ( ! properties . isEmpty ( ) ) { for ( final Pair < String , String > entry : properties ) { final String source = Objects . toString ( entry . getKey ( ) ) ; final String target = Objects . toString ( entry . getValue ( ) ) ; final String baseName ; final Matcher matcher = TYPE_NAME_PAT . matcher ( source ) ; if ( matcher . find ( ) ) { baseName = matcher . group ( 1 ) ; } else { baseName = source ; } it . apply ( baseName , source , target ) ; } } } ; }
Replies the initializer for the type converter .
34,367
public static IExtraLanguageConversionInitializer getFeatureNameConverterInitializer ( ) { return it -> { final List < Pair < String , String > > properties = loadPropertyFile ( FEATURE_CONVERSION_FILENAME ) ; if ( ! properties . isEmpty ( ) ) { for ( final Pair < String , String > entry : properties ) { final String source = Objects . toString ( entry . getKey ( ) ) ; final String target = Objects . toString ( entry . getValue ( ) ) ; final Matcher matcher = FEATURE_NAME_PAT . matcher ( source ) ; final String featureName ; if ( matcher . find ( ) ) { featureName = matcher . group ( 1 ) ; } else { featureName = source ; } it . apply ( featureName , source , target ) ; } } } ; }
Replies the initializer for the feature name converter .
34,368
public static void install ( ResourceSet rs , MavenProject project ) { final Iterator < Adapter > iterator = rs . eAdapters ( ) . iterator ( ) ; while ( iterator . hasNext ( ) ) { if ( iterator . next ( ) instanceof MavenProjectAdapter ) { iterator . remove ( ) ; } } rs . eAdapters ( ) . add ( new MavenProjectAdapter ( project ) ) ; }
Install the adapter .
34,369
public static ProgressBarConfig getConfiguration ( ConfigurationFactory configFactory ) { assert configFactory != null ; return configFactory . config ( ProgressBarConfig . class , PREFIX ) ; }
Replies the configuration factory for the logging .
34,370
@ SuppressWarnings ( "static-method" ) protected String getGeneratedTypeAccessor ( TypeReference generatedType ) { return "get" + Strings . toFirstUpper ( generatedType . getSimpleName ( ) ) + "()" ; }
Replies the accessor to the generated type .
34,371
protected List < StringConcatenationClient > generateMembers ( Collection < CodeElementExtractor . ElementDescription > grammarContainers , TopElementDescription description , boolean forInterface , boolean forAppender , boolean namedMembers ) { final List < StringConcatenationClient > clients = new ArrayList < > ( ) ; for ( final CodeElementExtractor . ElementDescription elementDescription : grammarContainers ) { clients . addAll ( generateMember ( elementDescription , description , forInterface , forAppender , namedMembers ) ) ; } return clients ; }
Generate the creators of members .
34,372
protected List < StringConcatenationClient > generateMember ( CodeElementExtractor . ElementDescription memberDescription , TopElementDescription topElementDescription , boolean forInterface , boolean forAppender , boolean namedMember ) { if ( namedMember ) { return generateNamedMember ( memberDescription , topElementDescription , forInterface , forAppender ) ; } return generateUnnamedMember ( memberDescription , topElementDescription , forInterface , forAppender ) ; }
Generate a member from the grammar .
34,373
@ SuppressWarnings ( "unlikely-arg-type" ) protected List < TopElementDescription > generateTopElements ( boolean forInterface , boolean forAppender ) { final Set < String > memberElements = determineMemberElements ( ) ; final Collection < EObject > topElementContainers = new ArrayList < > ( ) ; final List < TopElementDescription > topElements = new ArrayList < > ( ) ; for ( final CodeElementExtractor . ElementDescription description : getCodeElementExtractor ( ) . getTopElements ( getGrammar ( ) , getCodeBuilderConfig ( ) ) ) { final TopElementDescription topElementDescription = new TopElementDescription ( description , memberElements . contains ( description . getElementType ( ) . getName ( ) ) , getCodeBuilderConfig ( ) . isXtendSupportEnabled ( ) && description . isAnnotationInfo ( ) ) ; generateTopElement ( topElementDescription , forInterface , forAppender ) ; topElements . add ( topElementDescription ) ; topElementContainers . add ( topElementDescription . getElementDescription ( ) . getGrammarComponent ( ) ) ; } for ( final TopElementDescription description : topElements ) { description . getNamedMembers ( ) . removeAll ( topElementContainers ) ; } return topElements ; }
Generate top elements from the grammar .
34,374
@ SuppressWarnings ( "static-method" ) protected boolean isUnpureOperationPrototype ( XtendFunction operation ) { if ( operation == null || operation . isAbstract ( ) || operation . isDispatch ( ) || operation . isNative ( ) || operation . getExpression ( ) == null ) { return true ; } final XtendTypeDeclaration declaringType = operation . getDeclaringType ( ) ; return declaringType instanceof SarlCapacity ; }
Replies if the given function is purable according to its modifiers and prototype .
34,375
boolean isPurableOperation ( XtendFunction operation , ISideEffectContext context ) { if ( isUnpureOperationPrototype ( operation ) ) { return false ; } if ( this . nameValidator . isNamePatternForNotPureOperation ( operation ) ) { return false ; } if ( this . nameValidator . isNamePatternForPureOperation ( operation ) ) { return true ; } if ( context == null ) { return ! hasSideEffects ( getInferredPrototype ( operation ) , operation . getExpression ( ) ) ; } final Boolean result = internalHasSideEffects ( operation . getExpression ( ) , context ) ; return result == null || ! result . booleanValue ( ) ; }
Replies if the given is purable in the given context .
34,376
protected boolean isReassignmentOperator ( XBinaryOperation operator ) { if ( operator . isReassignFirstArgument ( ) ) { return true ; } final QualifiedName operatorName = this . operatorMapping . getOperator ( QualifiedName . create ( operator . getFeature ( ) . getSimpleName ( ) ) ) ; final QualifiedName compboundOperatorName = this . operatorMapping . getSimpleOperator ( operatorName ) ; return compboundOperatorName != null ; }
Replies if the given operator is a reassignment operator . A reassignment operator changes its left operand .
34,377
boolean evaluatePureAnnotationAdapters ( org . eclipse . xtext . common . types . JvmOperation operation , ISideEffectContext context ) { int index = - 1 ; int i = 0 ; for ( final Adapter adapter : operation . eAdapters ( ) ) { if ( adapter . isAdapterForType ( AnnotationJavaGenerationAdapter . class ) ) { index = i ; break ; } ++ i ; } if ( index >= 0 ) { final AnnotationJavaGenerationAdapter annotationAdapter = ( AnnotationJavaGenerationAdapter ) operation . eAdapters ( ) . get ( index ) ; assert annotationAdapter != null ; return annotationAdapter . applyAdaptations ( this , operation , context ) ; } return false ; }
Evalute the Pure annotatino adapters .
34,378
protected ImageDescriptor handleImageDescriptorError ( Object [ ] params , Throwable exception ) { if ( exception instanceof NullPointerException ) { final Object defaultImage = getDefaultImage ( ) ; if ( defaultImage instanceof ImageDescriptor ) { return ( ImageDescriptor ) defaultImage ; } if ( defaultImage instanceof Image ) { return ImageDescriptor . createFromImage ( ( Image ) defaultImage ) ; } return super . imageDescriptor ( params [ 0 ] ) ; } return Exceptions . throwUncheckedException ( exception ) ; }
Invoked when an image descriptor cannot be found .
34,379
protected StyledString signatureWithoutReturnType ( StyledString simpleName , JvmExecutable element ) { return simpleName . append ( this . uiStrings . styledParameters ( element ) ) ; }
Create a string representation of a signature without the return type .
34,380
protected StyledString getHumanReadableName ( JvmTypeReference reference ) { if ( reference == null ) { return new StyledString ( "Object" ) ; } final String name = this . uiStrings . referenceToString ( reference , "Object" ) ; return convertToStyledString ( name ) ; }
Create a string representation of the given element .
34,381
protected AbstractCreateMavenProjectsOperation createOperation ( ) { return new AbstractCreateMavenProjectsOperation ( ) { @ SuppressWarnings ( "synthetic-access" ) protected List < IProject > doCreateMavenProjects ( IProgressMonitor progressMonitor ) throws CoreException { final SubMonitor monitor = SubMonitor . convert ( progressMonitor , 101 ) ; try { final List < IMavenProjectImportResult > results = MavenImportUtils . runFixedImportJob ( true , getProjects ( ) , getImportConfiguration ( ) , new MavenProjectWorkspaceAssigner ( getWorkingSets ( ) ) , monitor . newChild ( 100 ) ) ; return toProjects ( results ) ; } finally { restorePom ( ) ; monitor . done ( ) ; } } } ; }
Create the operation for creating the projects .
34,382
protected void createSREArgsBlock ( Composite parent , Font font ) { final Group group = new Group ( parent , SWT . NONE ) ; group . setFont ( font ) ; final GridLayout layout = new GridLayout ( ) ; group . setLayout ( layout ) ; group . setLayoutData ( new GridData ( GridData . FILL_BOTH ) ) ; group . moveAbove ( this . fVMArgumentsBlock . getControl ( ) ) ; group . setText ( Messages . SARLArgumentsTab_1 ) ; createSREArgsText ( group , font ) ; createSREArgsVariableButton ( group ) ; }
Create the block for the SRE arguments .
34,383
private void resetPackageList ( ) { final Set < PackageDoc > set = new TreeSet < > ( ) ; for ( final PackageDoc pack : this . root . specifiedPackages ( ) ) { set . add ( pack ) ; } for ( final ClassDoc clazz : this . root . specifiedClasses ( ) ) { set . add ( clazz . containingPackage ( ) ) ; } this . packages = Utils . toArray ( this . packages , set ) ; }
Reset the list of packages for avoiding duplicates .
34,384
protected OutputConfiguration getOutputConfiguration ( ) { final Set < OutputConfiguration > outputConfigurations = this . configurationProvider . getOutputConfigurations ( getProject ( ) ) ; final String expectedName = ExtraLanguageOutputConfigurations . createOutputConfigurationName ( getPreferenceID ( ) ) ; return Iterables . find ( outputConfigurations , it -> expectedName . equals ( it . getName ( ) ) ) ; }
Replies the output configuration associated to the extra language generator .
34,385
protected void createTypeConversionSectionItems ( Composite parentComposite ) { final TypeConversionTable typeConversionTable = new TypeConversionTable ( this , getTargetLanguageImage ( ) , getPreferenceStore ( ) , getPreferenceID ( ) ) ; typeConversionTable . doCreate ( parentComposite , getDialogSettings ( ) ) ; makeScrollableCompositeAware ( typeConversionTable . getControl ( ) ) ; addExtraControl ( typeConversionTable ) ; }
Create the items for the Type Conversion section .
34,386
protected static void makeScrollableCompositeAware ( Control control ) { final ScrolledPageContent parentScrolledComposite = getParentScrolledComposite ( control ) ; if ( parentScrolledComposite != null ) { parentScrolledComposite . adaptChild ( control ) ; } }
Make the given control awaer of the scrolling events .
34,387
protected void createFeatureConversionSectionItems ( Composite parentComposite ) { final FeatureNameConversionTable typeConversionTable = new FeatureNameConversionTable ( this , getTargetLanguageImage ( ) , getPreferenceStore ( ) , getPreferenceID ( ) ) ; typeConversionTable . doCreate ( parentComposite , getDialogSettings ( ) ) ; makeScrollableCompositeAware ( typeConversionTable . getControl ( ) ) ; addExtraControl ( typeConversionTable ) ; }
Create the items for the Feature Conversion section .
34,388
protected void createExperimentalWarningMessage ( Composite composite ) { final Label dangerIcon = new Label ( composite , SWT . WRAP ) ; dangerIcon . setImage ( getImage ( IMAGE ) ) ; final GridData labelLayoutData = new GridData ( ) ; labelLayoutData . horizontalIndent = 0 ; dangerIcon . setLayoutData ( labelLayoutData ) ; }
Create the experimental warning message .
34,389
protected final Image getImage ( String imagePath ) { final ImageDescriptor descriptor = getImageDescriptor ( imagePath ) ; if ( descriptor == null ) { return null ; } return descriptor . createImage ( ) ; }
Replies the image .
34,390
@ SuppressWarnings ( "static-method" ) protected ImageDescriptor getImageDescriptor ( String imagePath ) { final LangActivator activator = LangActivator . getInstance ( ) ; final ImageRegistry registry = activator . getImageRegistry ( ) ; ImageDescriptor descriptor = registry . getDescriptor ( imagePath ) ; if ( descriptor == null ) { descriptor = AbstractUIPlugin . imageDescriptorFromPlugin ( activator . getBundle ( ) . getSymbolicName ( ) , imagePath ) ; if ( descriptor != null ) { registry . put ( imagePath , descriptor ) ; } } return descriptor ; }
Replies the image descriptor .
34,391
protected void createGeneralSectionItems ( Composite composite ) { addCheckBox ( composite , getActivationText ( ) , ExtraLanguagePreferenceAccess . getPrefixedKey ( getPreferenceID ( ) , ExtraLanguagePreferenceAccess . ENABLED_PROPERTY ) , BOOLEAN_VALUES , 0 ) ; }
Create the items for the General section .
34,392
protected void createOutputSectionItems ( Composite composite , OutputConfiguration outputConfiguration ) { final Text defaultDirectoryField = addTextField ( composite , org . eclipse . xtext . builder . preferences . Messages . OutputConfigurationPage_Directory , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . OUTPUT_DIRECTORY ) , 0 , 0 ) ; addCheckBox ( composite , org . eclipse . xtext . builder . preferences . Messages . OutputConfigurationPage_CreateDirectory , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . OUTPUT_CREATE_DIRECTORY ) , BOOLEAN_VALUES , 0 ) ; addCheckBox ( composite , org . eclipse . xtext . builder . preferences . Messages . OutputConfigurationPage_OverrideExistingResources , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . OUTPUT_OVERRIDE ) , BOOLEAN_VALUES , 0 ) ; addCheckBox ( composite , org . eclipse . xtext . builder . preferences . Messages . OutputConfigurationPage_CreatesDerivedResources , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . OUTPUT_DERIVED ) , BOOLEAN_VALUES , 0 ) ; addCheckBox ( composite , org . eclipse . xtext . builder . preferences . Messages . OutputConfigurationPage_CleanupDerivedResources , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . OUTPUT_CLEANUP_DERIVED ) , BOOLEAN_VALUES , 0 ) ; addCheckBox ( composite , org . eclipse . xtext . builder . preferences . Messages . OutputConfigurationPage_CleanDirectory , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . OUTPUT_CLEAN_DIRECTORY ) , BOOLEAN_VALUES , 0 ) ; final Button installAsPrimaryButton = addCheckBox ( composite , org . eclipse . xtext . builder . preferences . Messages . BuilderConfigurationBlock_InstallDslAsPrimarySource , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . INSTALL_DSL_AS_PRIMARY_SOURCE ) , BOOLEAN_VALUES , 0 ) ; final Button hideLocalButton = addCheckBox ( composite , org . eclipse . xtext . builder . preferences . Messages . BuilderConfigurationBlock_hideSyntheticLocalVariables , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . HIDE_LOCAL_SYNTHETIC_VARIABLES ) , BOOLEAN_VALUES , 0 ) ; hideLocalButton . setEnabled ( installAsPrimaryButton . getSelection ( ) ) ; installAsPrimaryButton . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent exception ) { hideLocalButton . setEnabled ( installAsPrimaryButton . getSelection ( ) ) ; } } ) ; final GridData hideLocalButtonData = new GridData ( ) ; hideLocalButtonData . horizontalIndent = INDENT_AMOUNT ; hideLocalButton . setLayoutData ( hideLocalButtonData ) ; addCheckBox ( composite , org . eclipse . xtext . builder . preferences . Messages . OutputConfigurationPage_KeepLocalHistory , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . OUTPUT_KEEP_LOCAL_HISTORY ) , BOOLEAN_VALUES , 0 ) ; if ( getProject ( ) != null && ! outputConfiguration . getSourceFolders ( ) . isEmpty ( ) ) { final Button outputPerSourceButton = addCheckBox ( composite , org . eclipse . xtext . builder . preferences . Messages . OutputConfigurationPage_UseOutputPerSourceFolder , BuilderPreferenceAccess . getKey ( outputConfiguration , EclipseOutputConfigurationProvider . USE_OUTPUT_PER_SOURCE_FOLDER ) , BOOLEAN_VALUES , 0 ) ; final Table table = createOutputFolderTable ( composite , outputConfiguration , defaultDirectoryField ) ; table . setVisible ( outputPerSourceButton . getSelection ( ) ) ; outputPerSourceButton . addSelectionListener ( new SelectionAdapter ( ) { public void widgetSelected ( SelectionEvent exception ) { table . setVisible ( outputPerSourceButton . getSelection ( ) ) ; } } ) ; } }
Create the items for the Output section .
34,393
protected IDialogSettings getDialogSettings ( ) { try { return ( IDialogSettings ) this . reflect . get ( this , "fDialogSettings" ) ; } catch ( SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e ) { throw new Error ( e ) ; } }
Replies the dialog settings for this view .
34,394
protected void restoreFilterAndSorter ( ) { final ProblemTreeViewer viewer = getViewer ( ) ; viewer . addFilter ( new EmptyInnerPackageFilter ( ) ) ; viewer . addFilter ( new HiddenFileFilter ( ) ) ; }
Restore the filters and sorters .
34,395
protected void internalResetLabelProvider ( ) { try { final PackageExplorerLabelProvider provider = createLabelProvider ( ) ; this . reflect . set ( this , "fLabelProvider" , provider ) ; provider . setIsFlatLayout ( isFlatLayout ( ) ) ; final DecoratingJavaLabelProvider decoratingProvider = new DecoratingJavaLabelProvider ( provider , false , isFlatLayout ( ) ) ; this . reflect . set ( this , "fDecoratingLabelProvider" , decoratingProvider ) ; getViewer ( ) . setLabelProvider ( decoratingProvider ) ; } catch ( SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e ) { throw new Error ( e ) ; } }
Reset the label provider for using the SARL one .
34,396
protected ProblemTreeViewer getViewer ( ) { try { return ( ProblemTreeViewer ) this . reflect . get ( this , "fViewer" ) ; } catch ( SecurityException | NoSuchFieldException | IllegalArgumentException | IllegalAccessException e ) { throw new Error ( e ) ; } }
Replies the viewer .
34,397
public ISarlEnumLiteralBuilder addSarlEnumLiteral ( String name ) { ISarlEnumLiteralBuilder builder = this . iSarlEnumLiteralBuilderProvider . get ( ) ; builder . eInit ( getSarlEnumeration ( ) , name , getTypeResolutionContext ( ) ) ; return builder ; }
Create a SarlEnumLiteral .
34,398
public ClassDoc wrap ( ClassDoc source ) { if ( source == null || source instanceof Proxy < ? > || ! ( source instanceof ClassDocImpl ) ) { return source ; } return new ClassDocWrapper ( ( ClassDocImpl ) source ) ; }
Wrap a class doc .
34,399
public FieldDoc wrap ( FieldDoc source ) { if ( source == null || source instanceof Proxy < ? > || ! ( source instanceof FieldDocImpl ) ) { return source ; } return new FieldDocWrapper ( ( FieldDocImpl ) source ) ; }
Wrap a field doc .