idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
148,900
public void setBackgroundColor ( float r , float g , float b , float a ) { setBackgroundColorR ( r ) ; setBackgroundColorG ( g ) ; setBackgroundColorB ( b ) ; setBackgroundColorA ( a ) ; }
Sets the background color of the scene rendered by this camera .
148,901
public void addPostEffect ( GVRMaterial postEffectData ) { GVRContext ctx = getGVRContext ( ) ; if ( mPostEffects == null ) { mPostEffects = new GVRRenderData ( ctx , postEffectData ) ; GVRMesh dummyMesh = new GVRMesh ( getGVRContext ( ) , "float3 a_position float2 a_texcoord" ) ; mPostEffects . setMesh ( dummyMesh ) ;...
Add a post - effect to this camera s render chain .
148,902
public int getBoneIndex ( GVRSceneObject bone ) { for ( int i = 0 ; i < getNumBones ( ) ; ++ i ) if ( mBones [ i ] == bone ) return i ; return - 1 ; }
Get the bone index for the given scene object .
148,903
public int getBoneIndex ( String bonename ) { for ( int i = 0 ; i < getNumBones ( ) ; ++ i ) if ( mBoneNames [ i ] . equals ( bonename ) ) return i ; return - 1 ; }
Get the bone index for the bone with the given name .
148,904
public void setBoneName ( int boneindex , String bonename ) { mBoneNames [ boneindex ] = bonename ; NativeSkeleton . setBoneName ( getNative ( ) , boneindex , bonename ) ; }
Sets the name of the designated bone .
148,905
public void poseFromBones ( ) { for ( int i = 0 ; i < getNumBones ( ) ; ++ i ) { GVRSceneObject bone = mBones [ i ] ; if ( bone == null ) { continue ; } if ( ( mBoneOptions [ i ] & BONE_LOCK_ROTATION ) != 0 ) { continue ; } GVRTransform trans = bone . getTransform ( ) ; mPose . setLocalMatrix ( i , trans . getLocalMode...
Applies the matrices computed from the scene object s linked to the skeleton bones to the current pose .
148,906
public void merge ( GVRSkeleton newSkel ) { int numBones = getNumBones ( ) ; List < Integer > parentBoneIds = new ArrayList < Integer > ( numBones + newSkel . getNumBones ( ) ) ; List < String > newBoneNames = new ArrayList < String > ( newSkel . getNumBones ( ) ) ; List < Matrix4f > newMatrices = new ArrayList < Matri...
Merge the source skeleton with this one . The result will be that this skeleton has all of its original bones and all the bones in the new skeleton .
148,907
public View getFullScreenView ( ) { if ( mFullScreenView != null ) { return mFullScreenView ; } final DisplayMetrics metrics = new DisplayMetrics ( ) ; mActivity . getWindowManager ( ) . getDefaultDisplay ( ) . getMetrics ( metrics ) ; final int screenWidthPixels = Math . max ( metrics . widthPixels , metrics . heightP...
Invalidating just the GVRView associated with the GVRViewSceneObject incorrectly set the clip rectangle to just that view . To fix this we have to create a full screen android View and invalidate this to restore the clip rectangle .
148,908
public final void unregisterView ( final View view ) { mActivity . runOnUiThread ( new Runnable ( ) { public void run ( ) { if ( null != mRenderableViewGroup && view . getParent ( ) == mRenderableViewGroup ) { mRenderableViewGroup . removeView ( view ) ; } } } ) ; }
Remove a child view of Android hierarchy view .
148,909
public void clear ( ) { List < Widget > children = getChildren ( ) ; Log . d ( TAG , "clear(%s): removing %d children" , getName ( ) , children . size ( ) ) ; for ( Widget child : children ) { removeChild ( child , true ) ; } requestLayout ( ) ; }
Removes all children
148,910
protected boolean inViewPort ( final int dataIndex ) { boolean inViewPort = true ; for ( Layout layout : mLayouts ) { inViewPort = inViewPort && ( layout . inViewPort ( dataIndex ) || ! layout . isClippingEnabled ( ) ) ; } return inViewPort ; }
Checks if the child is currently in ViewPort
148,911
public void setDataOffsets ( int [ ] offsets ) { assert ( mLevels == offsets . length ) ; NativeBitmapImage . updateCompressed ( getNative ( ) , mWidth , mHeight , mImageSize , mData , mLevels , offsets ) ; mData = null ; }
Set the offsets in the compressed data area for each mip - map level .
148,912
public static String getFilename ( String path ) throws IllegalArgumentException { if ( Pattern . matches ( sPatternUrl , path ) ) return getURLFilename ( path ) ; return new File ( path ) . getName ( ) ; }
Gets the filename from a path or URL .
148,913
public static String getParentDirectory ( String filePath ) throws IllegalArgumentException { if ( Pattern . matches ( sPatternUrl , filePath ) ) return getURLParentDirectory ( filePath ) ; return new File ( filePath ) . getParent ( ) ; }
Returns the directory of the file .
148,914
public static String getURLParentDirectory ( String urlString ) throws IllegalArgumentException { URL url = null ; try { url = new URL ( urlString ) ; } catch ( MalformedURLException e ) { throw Exceptions . IllegalArgument ( "Malformed URL: %s" , url ) ; } String path = url . getPath ( ) ; int lastSlashIndex = path . ...
Returns the directory of the URL .
148,915
protected void clearReference ( EObject obj , EReference ref ) { super . clearReference ( obj , ref ) ; if ( obj . eIsSet ( ref ) && ref . getEType ( ) . equals ( XtextPackage . Literals . TYPE_REF ) ) { INode node = NodeModelUtils . getNode ( ( EObject ) obj . eGet ( ref ) ) ; if ( node == null ) obj . eUnset ( ref ) ...
We add typeRefs without Nodes on the fly so we should remove them before relinking .
148,916
public CancelIndicator newCancelIndicator ( final ResourceSet rs ) { CancelIndicator _xifexpression = null ; if ( ( rs instanceof XtextResourceSet ) ) { final boolean cancelationAllowed = ( this . cancelationAllowed . get ( ) ) . booleanValue ( ) ; final int current = ( ( XtextResourceSet ) rs ) . getModificationStamp ...
Created a fresh CancelIndicator
148,917
public ContentAssistEntry createProposal ( final String proposal , final ContentAssistContext context ) { return this . createProposal ( proposal , context . getPrefix ( ) , context , ContentAssistEntry . KIND_UNKNOWN , null ) ; }
Returns an entry with the given proposal and the prefix from the context or null if the proposal is not valid .
148,918
public ContentAssistEntry createSnippet ( final String proposal , final String label , final ContentAssistContext context ) { final Procedure1 < ContentAssistEntry > _function = ( ContentAssistEntry it ) -> { it . setLabel ( label ) ; } ; return this . createProposal ( proposal , context . getPrefix ( ) , context , Con...
Returns an entry of kind snippet with the given proposal and label and the prefix from the context or null if the proposal is not valid .
148,919
public ContentAssistEntry createProposal ( final String proposal , final ContentAssistContext context , final Procedure1 < ? super ContentAssistEntry > init ) { return this . createProposal ( proposal , context . getPrefix ( ) , context , ContentAssistEntry . KIND_UNKNOWN , init ) ; }
Returns an entry with the given proposal and the prefix from the context or null if the proposal is not valid . If it is valid the initializer function is applied to it .
148,920
public ContentAssistEntry createProposal ( final String proposal , final String prefix , final ContentAssistContext context , final String kind , final Procedure1 < ? super ContentAssistEntry > init ) { boolean _isValidProposal = this . isValidProposal ( proposal , prefix , context ) ; if ( _isValidProposal ) { final C...
Returns an entry with the given proposal and prefix or null if the proposal is not valid . If it is valid the initializer function is applied to it .
148,921
public String toDecodedString ( final java . net . URI uri ) { final String scheme = uri . getScheme ( ) ; final String part = uri . getSchemeSpecificPart ( ) ; if ( ( scheme == null ) ) { return part ; } return ( ( scheme + ":" ) + part ) ; }
converts a java . net . URI to a decoded string
148,922
public URI withEmptyAuthority ( final URI uri ) { URI _xifexpression = null ; if ( ( uri . isFile ( ) && ( uri . authority ( ) == null ) ) ) { _xifexpression = URI . createHierarchicalURI ( uri . scheme ( ) , "" , uri . device ( ) , uri . segments ( ) , uri . query ( ) , uri . fragment ( ) ) ; } else { _xifexpression =...
converts the file URIs with an absent authority to one with an empty
148,923
public String [ ] [ ] getRequiredRuleNames ( Param param ) { if ( isFiltered ( param ) ) { return EMPTY_ARRAY ; } AbstractElement elementToParse = param . elementToParse ; String ruleName = param . ruleName ; if ( ruleName == null ) { return getRequiredRuleNames ( param , elementToParse ) ; } return getAdjustedRequired...
Returns the names of parser rules that should be called in order to obtain the follow elements for the parser call stack described by the given param .
148,924
protected boolean isFiltered ( Param param ) { AbstractElement elementToParse = param . elementToParse ; while ( elementToParse != null ) { if ( isFiltered ( elementToParse , param ) ) { return true ; } elementToParse = getEnclosingSingleElementGroup ( elementToParse ) ; } return false ; }
Returns true if the grammar element that is associated with the given param is filtered due to guard conditions of parameterized rules in the current call stack .
148,925
protected AbstractElement getEnclosingSingleElementGroup ( AbstractElement elementToParse ) { EObject container = elementToParse . eContainer ( ) ; if ( container instanceof Group ) { if ( ( ( Group ) container ) . getElements ( ) . size ( ) == 1 ) { return ( AbstractElement ) container ; } } return null ; }
Return the containing group if it contains exactly one element .
148,926
protected boolean isFiltered ( AbstractElement canddiate , Param param ) { if ( canddiate instanceof Group ) { Group group = ( Group ) canddiate ; if ( group . getGuardCondition ( ) != null ) { Set < Parameter > context = param . getAssignedParametes ( ) ; ConditionEvaluator evaluator = new ConditionEvaluator ( context...
Returns true if the given candidate is a group that is filtered due to rule parameters in the current call graph .
148,927
public static boolean isJavaLangType ( String s ) { return getJavaDefaultTypes ( ) . contains ( s ) && Character . isUpperCase ( s . charAt ( 0 ) ) ; }
Tests whether the given string is the name of a java . lang type .
148,928
public ContentAssistContext . Builder copy ( ) { Builder result = builderProvider . get ( ) ; result . copyFrom ( this ) ; return result ; }
Use this context as prototype for a new mutable builder . The new builder is pre - populated with the current settings of this context instance .
148,929
public ImmutableList < AbstractElement > getFirstSetGrammarElements ( ) { if ( firstSetGrammarElements == null ) { firstSetGrammarElements = ImmutableList . copyOf ( mutableFirstSetGrammarElements ) ; } return firstSetGrammarElements ; }
The grammar elements that may occur at the given offset .
148,930
public int getReplaceContextLength ( ) { if ( replaceContextLength == null ) { int replacementOffset = getReplaceRegion ( ) . getOffset ( ) ; ITextRegion currentRegion = getCurrentNode ( ) . getTextRegion ( ) ; int replaceContextLength = currentRegion . getLength ( ) - ( replacementOffset - currentRegion . getOffset ( ...
The length of the region left to the completion offset that is part of the replace region .
148,931
protected String getFormattedDatatypeValue ( ICompositeNode node , AbstractRule rule , String text ) throws ValueConverterException { Object value = valueConverter . toValue ( text , rule . getName ( ) , node ) ; text = valueConverter . toString ( value , rule . getName ( ) ) ; return text ; }
Create a canonical represenation of the data type value . Defaults to the value converter .
148,932
public String splitSpecialStateSwitch ( String specialStateTransition ) { Matcher transformedSpecialStateMatcher = TRANSORMED_SPECIAL_STATE_TRANSITION_METHOD . matcher ( specialStateTransition ) ; if ( ! transformedSpecialStateMatcher . find ( ) ) { return specialStateTransition ; } String specialStateSwitch = transfor...
Splits switch in specialStateTransition containing more than maxCasesPerSwitch cases into several methods each containing maximum of maxCasesPerSwitch cases or less .
148,933
public boolean merge ( final PluginXmlAccess other ) { boolean _xblockexpression = false ; { String _path = this . getPath ( ) ; String _path_1 = other . getPath ( ) ; boolean _notEquals = ( ! Objects . equal ( _path , _path_1 ) ) ; if ( _notEquals ) { String _path_2 = this . getPath ( ) ; String _plus = ( "Merging plu...
Merge the contents of the given plugin . xml into this one .
148,934
protected Iterable < URI > getTargetURIs ( final EObject primaryTarget ) { final TargetURIs result = targetURIsProvider . get ( ) ; uriCollector . add ( primaryTarget , result ) ; return result ; }
Returns with an iterable of URIs that points to all elements that are referenced by the argument or vice - versa .
148,935
public void setRegularExpression ( String regularExpression ) { if ( regularExpression != null ) this . regularExpression = Pattern . compile ( regularExpression ) ; else this . regularExpression = null ; }
Filter the URI based on a regular expression . Can be combined with an additional file - extension filter .
148,936
public void registerServices ( boolean force ) { Injector injector = Guice . createInjector ( getGuiceModule ( ) ) ; injector . injectMembers ( this ) ; registerInRegistry ( force ) ; }
Inject members into this instance and register the services afterwards .
148,937
public void register ( Delta delta ) { final IResourceDescription newDesc = delta . getNew ( ) ; if ( newDesc == null ) { removeDescription ( delta . getUri ( ) ) ; } else { addDescription ( delta . getUri ( ) , newDesc ) ; } }
Put a new resource description into the index or remove one if the delta has no new description . A delta for a particular URI may be registered more than once ; overwriting any earlier registration .
148,938
protected AbsoluteURI getGeneratedLocation ( PersistedTrace trace ) { AbsoluteURI path = trace . getPath ( ) ; String fileName = traceFileNameProvider . getJavaFromTrace ( path . getURI ( ) . toString ( ) ) ; return new AbsoluteURI ( fileName ) ; }
Compute the location of the generated file from the given trace file .
148,939
public static < T extends EObject > IScope scopeFor ( Iterable < ? extends T > elements , final Function < T , QualifiedName > nameComputation , IScope outer ) { return new SimpleScope ( outer , scopedElementsFor ( elements , nameComputation ) ) ; }
creates a scope using the passed function to compute the names and sets the passed scope as the parent scope
148,940
protected int compare ( MethodDesc o1 , MethodDesc o2 ) { final Class < ? > [ ] paramTypes1 = o1 . getParameterTypes ( ) ; final Class < ? > [ ] paramTypes2 = o2 . getParameterTypes ( ) ; for ( int i = 0 ; i < paramTypes1 . length ; i ++ ) { final Class < ? > class1 = paramTypes1 [ i ] ; final Class < ? > class2 = para...
returns &gt ; 0 when o1 is more specific than o2
148,941
protected void writeEntries ( final StorageAwareResource resource , final ZipOutputStream zipOut ) throws IOException { final BufferedOutputStream bufferedOutput = new BufferedOutputStream ( zipOut ) ; ZipEntry _zipEntry = new ZipEntry ( "emf-contents" ) ; zipOut . putNextEntry ( _zipEntry ) ; try { this . writeContent...
Write entries into the storage . Overriding methods should first delegate to super before adding their own entries .
148,942
public String getInputToParse ( String completeInput , int offset , int completionOffset ) { int fixedOffset = getOffsetIncludingWhitespace ( completeInput , offset , Math . min ( completeInput . length ( ) , completionOffset ) ) ; return super . getInputToParse ( completeInput , fixedOffset , completionOffset ) ; }
Returns the input to parse including the whitespace left to the cursor position since it may be relevant to the list of proposals for whitespace sensitive languages .
148,943
protected void doLinking ( ) { IParseResult parseResult = getParseResult ( ) ; if ( parseResult == null || parseResult . getRootASTElement ( ) == null ) return ; XtextLinker castedLinker = ( XtextLinker ) getLinker ( ) ; castedLinker . discardGeneratedPackages ( parseResult . getRootASTElement ( ) ) ; }
Overridden to do only the clean - part of the linking but not the actual linking . This is deferred until someone wants to access the content of the resource .
148,944
public static void setSourceLevelUrisWithoutCopy ( final ResourceSet resourceSet , final Set < URI > uris ) { final SourceLevelURIsAdapter adapter = SourceLevelURIsAdapter . findOrCreateAdapter ( resourceSet ) ; adapter . sourceLevelURIs = uris ; }
Installs the given set of URIs as the source level URIs . Does not copy the given set but uses it directly .
148,945
public void setFileExtensions ( final String fileExtensions ) { this . fileExtensions = IterableExtensions . < String > toList ( ( ( Iterable < String > ) Conversions . doWrapArray ( fileExtensions . trim ( ) . split ( "\\s*,\\s*" ) ) ) ) ; }
Either a single file extension or a comma - separated list of extensions for which the language shall be registered .
148,946
public static String compactDump ( INode node , boolean showHidden ) { StringBuilder result = new StringBuilder ( ) ; try { compactDump ( node , showHidden , "" , result ) ; } catch ( IOException e ) { return e . getMessage ( ) ; } return result . toString ( ) ; }
Creates a string representation of the given node . Useful for debugging .
148,947
public static String getTokenText ( INode node ) { if ( node instanceof ILeafNode ) return ( ( ILeafNode ) node ) . getText ( ) ; else { StringBuilder builder = new StringBuilder ( Math . max ( node . getTotalLength ( ) , 1 ) ) ; boolean hiddenSeen = false ; for ( ILeafNode leaf : node . getLeafNodes ( ) ) { if ( ! lea...
This method converts a node to text .
148,948
public List < List < String > > getAllScopes ( ) { this . checkInitialized ( ) ; final ImmutableList . Builder < List < String > > builder = ImmutableList . < List < String > > builder ( ) ; final Consumer < Integer > _function = ( Integer it ) -> { List < String > _get = this . scopes . get ( it ) ; StringConcatenatio...
Returns with a view of all scopes known by this manager .
148,949
public void addRequiredBundles ( Set < String > requiredBundles ) { addRequiredBundles ( requiredBundles . toArray ( new String [ requiredBundles . size ( ) ] ) ) ; }
Add the set with given bundles to the Require - Bundle main attribute .
148,950
public void addRequiredBundles ( String ... requiredBundles ) { String oldBundles = mainAttributes . get ( REQUIRE_BUNDLE ) ; if ( oldBundles == null ) oldBundles = "" ; BundleList oldResultList = BundleList . fromInput ( oldBundles , newline ) ; BundleList resultList = BundleList . fromInput ( oldBundles , newline ) ;...
Add the list with given bundles to the Require - Bundle main attribute .
148,951
public void addImportedPackages ( Set < String > importedPackages ) { addImportedPackages ( importedPackages . toArray ( new String [ importedPackages . size ( ) ] ) ) ; }
Add the set with given bundles to the Import - Package main attribute .
148,952
public void addImportedPackages ( String ... importedPackages ) { String oldBundles = mainAttributes . get ( IMPORT_PACKAGE ) ; if ( oldBundles == null ) oldBundles = "" ; BundleList oldResultList = BundleList . fromInput ( oldBundles , newline ) ; BundleList resultList = BundleList . fromInput ( oldBundles , newline )...
Add the list with given bundles to the Import - Package main attribute .
148,953
public void addExportedPackages ( Set < String > exportedPackages ) { addExportedPackages ( exportedPackages . toArray ( new String [ exportedPackages . size ( ) ] ) ) ; }
Add the set with given bundles to the Export - Package main attribute .
148,954
public void addExportedPackages ( String ... exportedPackages ) { String oldBundles = mainAttributes . get ( EXPORT_PACKAGE ) ; if ( oldBundles == null ) oldBundles = "" ; BundleList oldResultList = BundleList . fromInput ( oldBundles , newline ) ; BundleList resultList = BundleList . fromInput ( oldBundles , newline )...
Add the list with given bundles to the Export - Package main attribute .
148,955
public void setBREE ( String bree ) { String old = mainAttributes . get ( BUNDLE_REQUIREDEXECUTIONENVIRONMENT ) ; if ( ! bree . equals ( old ) ) { this . mainAttributes . put ( BUNDLE_REQUIREDEXECUTIONENVIRONMENT , bree ) ; this . modified = true ; this . bree = bree ; } }
Set the main attribute Bundle - RequiredExecutionEnvironment to the given value .
148,956
public void setBundleActivator ( String bundleActivator ) { String old = mainAttributes . get ( BUNDLE_ACTIVATOR ) ; if ( ! bundleActivator . equals ( old ) ) { this . mainAttributes . put ( BUNDLE_ACTIVATOR , bundleActivator ) ; this . modified = true ; this . bundleActivator = bundleActivator ; } }
Set the main attribute Bundle - Activator to the given value .
148,957
public static String make512Safe ( StringBuffer input , String newline ) { StringBuilder result = new StringBuilder ( ) ; String content = input . toString ( ) ; String rest = content ; while ( ! rest . isEmpty ( ) ) { if ( rest . contains ( "\n" ) ) { String line = rest . substring ( 0 , rest . indexOf ( "\n" ) ) ; re...
Return a string that ensures that no line is longer then 512 characters and lines are broken according to manifest specification .
148,958
protected void _format ( EObject obj , IFormattableDocument document ) { for ( EObject child : obj . eContents ( ) ) document . format ( child ) ; }
Fall - back for types that are not handled by a subclasse s dispatch method .
148,959
public < Result > Result process ( IUnitOfWork < Result , State > work ) { releaseReadLock ( ) ; acquireWriteLock ( ) ; try { if ( log . isTraceEnabled ( ) ) log . trace ( "process - " + Thread . currentThread ( ) . getName ( ) ) ; return modify ( work ) ; } finally { if ( log . isTraceEnabled ( ) ) log . trace ( "Down...
Upgrades a read transaction to a write transaction executes the work then downgrades to a read transaction again .
148,960
protected EObject forceCreateModelElementAndSet ( Action action , EObject value ) { EObject result = semanticModelBuilder . create ( action . getType ( ) . getClassifier ( ) ) ; semanticModelBuilder . set ( result , action . getFeature ( ) , value , null , currentNode ) ; insertCompositeNode ( action ) ; associateNodeW...
Assigned action code
148,961
public String stripUnnecessaryComments ( String javaContent , AntlrOptions options ) { if ( ! options . isOptimizeCodeQuality ( ) ) { return javaContent ; } javaContent = stripMachineDependentPaths ( javaContent ) ; if ( options . isStripAllComments ( ) ) { javaContent = stripAllComments ( javaContent ) ; } return java...
Remove all unnecessary comments from a lexer or parser file
148,962
public String getPrefix ( INode prefixNode ) { if ( prefixNode instanceof ILeafNode ) { if ( ( ( ILeafNode ) prefixNode ) . isHidden ( ) && prefixNode . getGrammarElement ( ) != null ) return "" ; return getNodeTextUpToCompletionOffset ( prefixNode ) ; } StringBuilder result = new StringBuilder ( prefixNode . getTotalL...
replace region length
148,963
public String toUriString ( final java . net . URI uri ) { return this . toUriString ( URI . createURI ( uri . normalize ( ) . toString ( ) ) ) ; }
converts a java . net . URI into a string representation with empty authority if absent and has file scheme .
148,964
public boolean hasCachedValue ( Key key ) { try { readLock . lock ( ) ; return content . containsKey ( key ) ; } finally { readLock . unlock ( ) ; } }
for testing purpose
148,965
protected void loadEntries ( final StorageAwareResource resource , final ZipInputStream zipIn ) throws IOException { zipIn . getNextEntry ( ) ; BufferedInputStream _bufferedInputStream = new BufferedInputStream ( zipIn ) ; this . readContents ( resource , _bufferedInputStream ) ; zipIn . getNextEntry ( ) ; BufferedInpu...
Load entries from the storage . Overriding methods should first delegate to super before adding their own entries .
148,966
public final Iterator < AbstractTraceRegion > leafIterator ( ) { if ( nestedRegions == null ) return Collections . < AbstractTraceRegion > singleton ( this ) . iterator ( ) ; return new LeafIterator ( this ) ; }
Returns an iterator that will only offer leaf trace regions . If the nested regions have gaps these will be filled with parent data . If this region is a leaf a singleton iterator will be returned .
148,967
public void generateTracedFile ( final IFileSystemAccess2 fsa , final String path , final EObject rootTrace , final StringConcatenationClient code ) { final CompositeGeneratorNode node = this . trace ( rootTrace , code ) ; this . generateTracedFile ( fsa , path , node ) ; }
Convenience extension to generate traced code .
148,968
public void generateTracedFile ( final IFileSystemAccess2 fsa , final String path , final CompositeGeneratorNode rootNode ) { final GeneratorNodeProcessor . Result result = this . processor . process ( rootNode ) ; fsa . generateFile ( path , result ) ; }
Use to generate a file based on generator node .
148,969
public void propagateAsErrorIfCancelException ( final Throwable t ) { if ( ( t instanceof OperationCanceledError ) ) { throw ( ( OperationCanceledError ) t ) ; } final RuntimeException opCanceledException = this . getPlatformOperationCanceledException ( t ) ; if ( ( opCanceledException != null ) ) { throw new Operation...
Rethrows OperationCanceledErrors and wraps platform specific OperationCanceledExceptions . Does nothing for any other type of Throwable .
148,970
public void propagateIfCancelException ( final Throwable t ) { final RuntimeException cancelException = this . getPlatformOperationCanceledException ( t ) ; if ( ( cancelException != null ) ) { throw cancelException ; } }
Rethrows platform specific OperationCanceledExceptions and unwraps OperationCanceledErrors . Does nothing for any other type of Throwable .
148,971
public Triple < EObject , EReference , INode > decode ( Resource res , String uriFragment ) { if ( isUseIndexFragment ( res ) ) { return getLazyProxyInformation ( res , uriFragment ) ; } List < String > split = Strings . split ( uriFragment , SEP ) ; EObject source = resolveShortFragment ( res , split . get ( 1 ) ) ; E...
decodes the uriFragment
148,972
public < T > T get ( Object key , Resource resource , Provider < T > provider ) { if ( resource == null ) { return provider . get ( ) ; } CacheAdapter adapter = getOrCreate ( resource ) ; T element = adapter . < T > internalGet ( key ) ; if ( element == null ) { element = provider . get ( ) ; cacheMiss ( adapter ) ; ad...
Try to obtain the value that is cached for the given key in the given resource . If no value is cached the provider is used to compute it and store it afterwards .
148,973
public < Result , Param extends Resource > Result execWithoutCacheClear ( Param resource , IUnitOfWork < Result , Param > transaction ) throws WrappedException { CacheAdapter cacheAdapter = getOrCreate ( resource ) ; try { cacheAdapter . ignoreNotifications ( ) ; return transaction . exec ( resource ) ; } catch ( Runti...
The transaction will be executed . While it is running any semantic state change in the given resource will be ignored and the cache will not be cleared .
148,974
public < Result , Param extends Resource > Result execWithTemporaryCaching ( Param resource , IUnitOfWork < Result , Param > transaction ) throws WrappedException { CacheAdapter cacheAdapter = getOrCreate ( resource ) ; IgnoreValuesMemento memento = cacheAdapter . ignoreNewValues ( ) ; try { return transaction . exec (...
The transaction will be executed with caching enabled . However all newly cached values will be discarded as soon as the transaction is over .
148,975
public void resolveLazyCrossReferences ( final CancelIndicator mon ) { final CancelIndicator monitor = mon == null ? CancelIndicator . NullImpl : mon ; TreeIterator < Object > iterator = EcoreUtil . getAllContents ( this , true ) ; while ( iterator . hasNext ( ) ) { operationCanceledManager . checkCanceled ( monitor ) ...
resolves any lazy cross references in this resource adding Issues for unresolvable elements to this resource . This resource might still contain resolvable proxies after this method has been called .
148,976
public Set < URI > collectOutgoingReferences ( IResourceDescription description ) { URI resourceURI = description . getURI ( ) ; Set < URI > result = null ; for ( IReferenceDescription reference : description . getReferenceDescriptions ( ) ) { URI targetResource = reference . getTargetEObjectUri ( ) . trimFragment ( ) ...
Collect the URIs of resources that are referenced by the given description .
148,977
public void write ( final char [ ] cbuf , final int off , final int len ) throws IOException { int offset = off ; int length = len ; while ( suppressLineCount > 0 && length > 0 ) { length = - 1 ; for ( int i = 0 ; i < len && suppressLineCount > 0 ; i ++ ) { if ( cbuf [ off + i ] == '\n' ) { offset = off + i + 1 ; lengt...
Filter everything until we found the first NL character .
148,978
@ Inject ( optional = true ) protected Pattern setEndTag ( @ Named ( AbstractMultiLineCommentProvider . END_TAG ) final String endTag ) { return this . endTagPattern = Pattern . compile ( ( endTag + "\\z" ) ) ; }
this method is not intended to be called by clients
148,979
public CompositeGeneratorNode indent ( final CompositeGeneratorNode parent , final String indentString ) { final IndentNode indent = new IndentNode ( indentString ) ; List < IGeneratorNode > _children = parent . getChildren ( ) ; _children . add ( indent ) ; return indent ; }
Appends the indentation string at the current position of the parent and adds a new composite node indicating the same indentation for subsequent lines .
148,980
public CompositeGeneratorNode appendNewLineIfNotEmpty ( final CompositeGeneratorNode parent ) { List < IGeneratorNode > _children = parent . getChildren ( ) ; String _lineDelimiter = this . wsConfig . getLineDelimiter ( ) ; NewLineNode _newLineNode = new NewLineNode ( _lineDelimiter , true ) ; _children . add ( _newLin...
Appends a line separator node that will only be effective if the current line contains non - whitespace text .
148,981
public CompositeGeneratorNode appendTemplate ( final CompositeGeneratorNode parent , final StringConcatenationClient templateString ) { final TemplateNode proc = new TemplateNode ( templateString , this ) ; List < IGeneratorNode > _children = parent . getChildren ( ) ; _children . add ( proc ) ; return parent ; }
Creates a template node for the given templateString and appends it to the given parent node .
148,982
protected void doSplitTokenImpl ( Token token , ITokenAcceptor result ) { String text = token . getText ( ) ; int indentation = computeIndentation ( text ) ; if ( indentation == - 1 || indentation == currentIndentation ) { result . accept ( token ) ; } else if ( indentation > currentIndentation ) { splitIntoBeginToken ...
The token was previously determined as potentially to - be - splitted thus we emit additional indentation or dedenting tokens .
148,983
public ResourceStorageLoadable getOrCreateResourceStorageLoadable ( final StorageAwareResource resource ) { try { final ResourceStorageProviderAdapter stateProvider = IterableExtensions . < ResourceStorageProviderAdapter > head ( Iterables . < ResourceStorageProviderAdapter > filter ( resource . getResourceSet ( ) . eA...
Finds or creates a ResourceStorageLoadable for the given resource . Clients should first call shouldLoadFromStorage to check whether there exists a storage version of the given resource .
148,984
public INode getLastCompleteNodeByOffset ( INode node , int offsetPosition , int completionOffset ) { return internalGetLastCompleteNodeByOffset ( node . getRootNode ( ) , offsetPosition ) ; }
Returns the last node that appears to be part of the prefix . This will be used to determine the current model object that ll be the most special context instance in the proposal provider .
148,985
public void addRequiredBundles ( Set < String > bundles ) { Set < String > bundlesToMerge ; String bundleName = ( String ) getMainAttributes ( ) . get ( BUNDLE_SYMBOLIC_NAME ) ; if ( bundleName != null ) { int idx = bundleName . indexOf ( ';' ) ; if ( idx >= 0 ) { bundleName = bundleName . substring ( 0 , idx ) ; } } i...
adds the qualified names to the require - bundle attribute if not already present .
148,986
public void addExportedPackages ( Set < String > packages ) { String s = ( String ) getMainAttributes ( ) . get ( EXPORT_PACKAGE ) ; Wrapper < Boolean > modified = Wrapper . wrap ( this . modified ) ; String result = mergeIntoCommaSeparatedList ( s , packages , modified , lineDelimiter ) ; this . modified = modified . ...
adds the qualified names to the export - package attribute if not already present .
148,987
public void createProposals ( final Collection < ContentAssistContext > contexts , final IIdeContentProposalAcceptor acceptor ) { Iterable < ContentAssistContext > _filteredContexts = this . getFilteredContexts ( contexts ) ; for ( final ContentAssistContext context : _filteredContexts ) { ImmutableList < AbstractEleme...
Create content assist proposals and pass them to the given acceptor .
148,988
public String convertFromJavaString ( String string , boolean useUnicode ) { int firstEscapeSequence = string . indexOf ( '\\' ) ; if ( firstEscapeSequence == - 1 ) { return string ; } int length = string . length ( ) ; StringBuilder result = new StringBuilder ( length ) ; appendRegion ( string , 0 , firstEscapeSequenc...
Resolve Java control character sequences to the actual character value . Optionally handle unicode escape sequences too .
148,989
public String convertToJavaString ( String input , boolean useUnicode ) { int length = input . length ( ) ; StringBuilder result = new StringBuilder ( length + 4 ) ; for ( int i = 0 ; i < length ; i ++ ) { escapeAndAppendTo ( input . charAt ( i ) , useUnicode , result ) ; } return result . toString ( ) ; }
Escapes control characters with a preceding backslash . Optionally encodes special chars as unicode escape sequence . The resulting string is safe to be put into a Java string literal between the quotes .
148,990
private void performDownload ( HttpResponse response , File destFile ) throws IOException { HttpEntity entity = response . getEntity ( ) ; if ( entity == null ) { return ; } long contentLength = entity . getContentLength ( ) ; if ( contentLength >= 0 ) { size = toLengthText ( contentLength ) ; } processedBytes = 0 ; lo...
Save an HTTP response to a file
148,991
private void stream ( InputStream is , File destFile ) throws IOException { try { startProgress ( ) ; OutputStream os = new FileOutputStream ( destFile ) ; boolean finished = false ; try { byte [ ] buf = new byte [ 1024 * 10 ] ; int read ; while ( ( read = is . read ( buf ) ) >= 0 ) { os . write ( buf , 0 , read ) ; pr...
Copy bytes from an input stream to a file and log progress
148,992
private String getCachedETag ( HttpHost host , String file ) { Map < String , Object > cachedETags = readCachedETags ( ) ; @ SuppressWarnings ( "unchecked" ) Map < String , Object > hostMap = ( Map < String , Object > ) cachedETags . get ( host . toURI ( ) ) ; if ( hostMap == null ) { return null ; } @ SuppressWarnings...
Get the cached ETag for the given host and file
148,993
private File makeDestFile ( URL src ) { if ( dest == null ) { throw new IllegalArgumentException ( "Please provide a download destination" ) ; } File destFile = dest ; if ( destFile . isDirectory ( ) ) { String name = src . toString ( ) ; if ( name . endsWith ( "/" ) ) { name = name . substring ( 0 , name . length ( ) ...
Generates the path to an output file for a given source URL . Creates all necessary parent directories for the destination file .
148,994
private void addAuthentication ( HttpHost host , Credentials credentials , AuthScheme authScheme , HttpClientContext context ) { AuthCache authCache = context . getAuthCache ( ) ; if ( authCache == null ) { authCache = new BasicAuthCache ( ) ; context . setAuthCache ( authCache ) ; } CredentialsProvider credsProvider =...
Add authentication information for the given host
148,995
private String toLengthText ( long bytes ) { if ( bytes < 1024 ) { return bytes + " B" ; } else if ( bytes < 1024 * 1024 ) { return ( bytes / 1024 ) + " KB" ; } else if ( bytes < 1024 * 1024 * 1024 ) { return String . format ( "%.2f MB" , bytes / ( 1024.0 * 1024.0 ) ) ; } else { return String . format ( "%.2f GB" , byt...
Converts a number of bytes to a human - readable string
148,996
public void close ( ) throws IOException { for ( CloseableHttpClient c : cachedClients . values ( ) ) { c . close ( ) ; } cachedClients . clear ( ) ; }
Close all HTTP clients created by this factory
148,997
public static Provider getCurrentProvider ( boolean useSwingEventQueue ) { Provider provider ; if ( Platform . isX11 ( ) ) { provider = new X11Provider ( ) ; } else if ( Platform . isWindows ( ) ) { provider = new WindowsProvider ( ) ; } else if ( Platform . isMac ( ) ) { provider = new CarbonProvider ( ) ; } else { LO...
Get global hotkey provider for current platform
148,998
protected void fireEvent ( HotKey hotKey ) { HotKeyEvent event = new HotKeyEvent ( hotKey ) ; if ( useSwingEventQueue ) { SwingUtilities . invokeLater ( event ) ; } else { if ( eventQueue == null ) { eventQueue = Executors . newSingleThreadExecutor ( ) ; } eventQueue . execute ( event ) ; } }
Helper method fro providers to fire hotkey event in a separate thread
148,999
public Object newInstance ( String resource ) { try { String name = resource . startsWith ( "/" ) ? resource : "/" + resource ; File file = new File ( this . getClass ( ) . getResource ( name ) . toURI ( ) ) ; return newInstance ( classLoader . parseClass ( new GroovyCodeSource ( file ) , true ) ) ; } catch ( Exception...
Creates an object instance from the Groovy resource