idx
int64
0
41.2k
question
stringlengths
74
4.04k
target
stringlengths
7
750
33,700
private static void fireDefaultSREChanged ( ISREInstall previous , ISREInstall current ) { for ( final Object listener : SRE_LISTENERS . getListeners ( ) ) { ( ( ISREInstallChangedListener ) listener ) . defaultSREInstallChanged ( previous , current ) ; } }
Notifies registered listeners that the default SRE has changed .
33,701
public static boolean isPlatformSRE ( ISREInstall sre ) { if ( sre != null ) { LOCK . lock ( ) ; try { return platformSREInstalls . contains ( sre . getId ( ) ) ; } finally { LOCK . unlock ( ) ; } } return false ; }
Replies if the given SRE is provided by the Eclipse platform through an extension point .
33,702
public static void clearSREConfiguration ( ) throws CoreException { final SARLEclipsePlugin plugin = SARLEclipsePlugin . getDefault ( ) ; plugin . getPreferences ( ) . remove ( getCurrentPreferenceKey ( ) ) ; plugin . savePreferences ( ) ; }
Remove the SRE configuration information from the preferences .
33,703
private static void initializeSREExtensions ( ) { final MultiStatus status = new MultiStatus ( SARLEclipsePlugin . PLUGIN_ID , IStatus . OK , "Exceptions occurred" , null ) ; final IExtensionPoint extensionPoint = Platform . getExtensionRegistry ( ) . getExtensionPoint ( SARLEclipsePlugin . PLUGIN_ID , SARLEclipseConfi...
Initializes SRE extensions .
33,704
public static String getSREsAsXML ( IProgressMonitor monitor ) throws CoreException { initializeSREs ( ) ; try { final DocumentBuilderFactory factory = DocumentBuilderFactory . newInstance ( ) ; final DocumentBuilder builder = factory . newDocumentBuilder ( ) ; final Document xmldocument = builder . newDocument ( ) ; f...
Returns the listing of currently installed SREs as a single XML file .
33,705
@ SuppressWarnings ( "checkstyle:cyclomaticcomplexity" ) private static String initializePersistedSREs ( ) { final String rawXml = SARLEclipsePlugin . getDefault ( ) . getPreferences ( ) . get ( getCurrentPreferenceKey ( ) , "" ) ; try { Element config = null ; if ( ! Strings . isNullOrEmpty ( rawXml ) ) { config = par...
This method loads installed SREs based an existing user preference or old SRE configurations file .
33,706
@ SuppressWarnings ( { "checkstyle:cyclomaticcomplexity" , "checkstyle:variabledeclarationusagedistance" , "checkstyle:npathcomplexity" } ) private static void initializeSREs ( ) { ISREInstall [ ] newSREs = new ISREInstall [ 0 ] ; boolean savePrefs = false ; LOCK . lock ( ) ; final String previousDefault = defaultSREId...
Perform SRE install initialization . Does not hold locks while performing change notification .
33,707
public static String createUniqueIdentifier ( ) { String id ; do { id = UUID . randomUUID ( ) . toString ( ) ; } while ( getSREFromId ( id ) != null ) ; return id ; }
Replies an unique identifier .
33,708
public static boolean isUnpackedSRE ( File directory ) { File manifestFile = new File ( directory , "META-INF" ) ; manifestFile = new File ( manifestFile , "MANIFEST.MF" ) ; if ( manifestFile . canRead ( ) ) { try ( InputStream manifestStream = new FileInputStream ( manifestFile ) ) { final Manifest manifest = new Mani...
Replies if the given directory contains a SRE .
33,709
public static boolean isPackedSRE ( File jarFile ) { try ( JarFile jFile = new JarFile ( jarFile ) ) { final Manifest manifest = jFile . getManifest ( ) ; if ( manifest == null ) { return false ; } final Attributes sarlSection = manifest . getAttributes ( SREConstants . MANIFEST_SECTION_SRE ) ; if ( sarlSection == null...
Replies if the given JAR file contains a SRE .
33,710
public static String getDeclaredBootstrap ( IPath path ) { try { final IFile location = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) . getFile ( path ) ; if ( location != null ) { final IPath pathLocation = location . getLocation ( ) ; if ( pathLocation != null ) { final File file = pathLocation . toFile ( ) ; if (...
Replies the bootstrap name declared within the given path corresponding to a JAR file or a folder .
33,711
protected Object processElement ( Object obj , Class < ? > expectedType ) { if ( obj == null || obj instanceof Proxy ) { return obj ; } if ( obj instanceof Doc ) { return wrap ( obj ) ; } else if ( expectedType != null && expectedType . isArray ( ) ) { final Class < ? > componentType = expectedType . getComponentType (...
Filter the given document .
33,712
protected Object wrap ( Object object ) { if ( object == null || object instanceof Proxy ) { return object ; } final Class < ? > type = object . getClass ( ) ; return Proxy . newProxyInstance ( type . getClassLoader ( ) , type . getInterfaces ( ) , new ProxyHandler ( object ) ) ; }
Unwrap the given object .
33,713
protected void writePackageFiles ( QualifiedName name , String lineSeparator , IExtraLanguageGeneratorContext context ) { final IFileSystemAccess2 fsa = context . getFileSystemAccess ( ) ; final String outputConfiguration = getOutputConfigurationName ( ) ; QualifiedName libraryName = null ; for ( final String segment :...
Generate the Python package files .
33,714
@ SuppressWarnings ( "static-method" ) protected boolean generatePythonClassDeclaration ( String typeName , boolean isAbstract , List < ? extends JvmTypeReference > superTypes , String comment , boolean ignoreObjectType , PyAppendable it , IExtraLanguageGeneratorContext context ) { if ( ! Strings . isEmpty ( typeName )...
Generate the type declaration for a Python class .
33,715
protected static boolean generateDocString ( String comment , PyAppendable it ) { final String cmt = comment == null ? null : comment . trim ( ) ; if ( ! Strings . isEmpty ( cmt ) ) { assert cmt != null ; it . append ( "\"\"\"" ) . increaseIndentation ( ) ; for ( final String line : cmt . split ( "[\n\r\f]+" ) ) { it ....
Generate a Python docstring with the given comment .
33,716
protected static boolean generateBlockComment ( String comment , PyAppendable it ) { final String cmt = comment == null ? null : comment . trim ( ) ; if ( ! Strings . isEmpty ( cmt ) ) { assert cmt != null ; for ( final String line : cmt . split ( "[\n\r\f]+" ) ) { it . append ( "# " ) . append ( line ) . newLine ( ) ;...
Generate a Python block comment with the given comment .
33,717
@ SuppressWarnings ( { "checkstyle:parameternumber" } ) protected boolean generateTypeDeclaration ( String fullyQualifiedName , String name , boolean isAbstract , List < ? extends JvmTypeReference > superTypes , String comment , boolean ignoreObjectType , List < ? extends XtendMember > members , PyAppendable it , IExtr...
Generate the given type .
33,718
protected boolean generateEnumerationDeclaration ( SarlEnumeration enumeration , PyAppendable it , IExtraLanguageGeneratorContext context ) { if ( ! Strings . isEmpty ( enumeration . getName ( ) ) ) { it . append ( "class " ) . append ( enumeration . getName ( ) ) ; it . append ( "(Enum" ) ; it . append ( newType ( "en...
Generate the given enumeration declaration .
33,719
protected boolean generatePythonConstructors ( String container , List < ? extends XtendMember > members , PyAppendable it , IExtraLanguageGeneratorContext context ) { boolean hasConstructor = false ; for ( final XtendMember member : members ) { if ( context . getCancelIndicator ( ) . isCanceled ( ) ) { return false ; ...
Generate the constructors for a Python class .
33,720
@ SuppressWarnings ( "static-method" ) protected JvmType newType ( String pythonName ) { final JvmGenericType type = TypesFactory . eINSTANCE . createJvmGenericType ( ) ; final int index = pythonName . indexOf ( "." ) ; if ( index <= 0 ) { type . setSimpleName ( pythonName ) ; } else { type . setPackageName ( pythonNam...
Create a JvmType for a Python type .
33,721
protected void generatePythonField ( SarlField field , PyAppendable it , IExtraLanguageGeneratorContext context ) { generateBlockComment ( getTypeBuilder ( ) . getDocumentation ( field ) , it ) ; if ( ! field . isStatic ( ) ) { it . append ( "self." ) ; } final String fieldName = it . declareUniqueNameVariable ( field ...
Create a field declaration .
33,722
protected void generateGuardEvaluators ( String container , PyAppendable it , IExtraLanguageGeneratorContext context ) { final Map < String , Map < String , List < Pair < XExpression , String > > > > allGuardEvaluators = context . getMapData ( EVENT_GUARDS_MEMENTO ) ; final Map < String , List < Pair < XExpression , St...
Generate the memorized guard evaluators .
33,723
protected void _before ( SarlCapacityUses uses , IExtraLanguageGeneratorContext context ) { for ( final JvmTypeReference capacity : uses . getCapacities ( ) ) { final JvmType type = capacity . getType ( ) ; if ( type instanceof JvmDeclaredType ) { computeCapacityFunctionMarkers ( ( JvmDeclaredType ) type ) ; } } }
Mark the functions of the used capacities in order to have a valid feature call within the code .
33,724
@ Check ( CheckType . NORMAL ) public void checkExtraLanguageRules ( EObject currentObject ) { final List < AbstractExtraLanguageValidator > validators = this . validatorProvider . getValidators ( currentObject . eResource ( ) ) ; if ( ! validators . isEmpty ( ) ) { for ( final AbstractExtraLanguageValidator validator ...
Check the rules for the activated extra languages .
33,725
public void setComment ( String comment ) { this . comment = comment ; if ( ! Strings . isEmpty ( comment ) ) { this . name = MessageFormat . format ( "{0} [{1}]" , getClass ( ) . getName ( ) , comment ) ; } else { this . name = getClass ( ) . getName ( ) ; } }
Change the comment for the injection fragment .
33,726
protected GeneratorConfig createDefaultGeneratorConfig ( ) { final GeneratorConfig config = new GeneratorConfig ( ) ; if ( this . defaultVersion == null ) { this . defaultVersion = JavaVersion . fromQualifier ( System . getProperty ( "java.specification.version" ) ) ; if ( this . defaultVersion != null ) { config . set...
Invoked for creating the default generator configuration .
33,727
protected InferredPrototype createPrototype ( QualifiedActionName id , boolean isVarargs , FormalParameterProvider parameters ) { assert parameters != null ; final ActionParameterTypes key = new ActionParameterTypes ( isVarargs , parameters . getFormalParameterCount ( ) ) ; final Map < ActionParameterTypes , List < Inf...
Build and replies the inferred action signature for the element with the given ID . This function creates the different signatures according to the definition or not of default values for the formal parameters .
33,728
@ SuppressWarnings ( "static-method" ) public ITextReplacerContext fix ( final ITextReplacerContext context , IComment comment ) { final IHiddenRegion hiddenRegion = comment . getHiddenRegion ( ) ; if ( detectBugSituation ( hiddenRegion ) && fixBug ( hiddenRegion ) ) { final ITextRegionAccess access = comment . getText...
Fixing the bug .
33,729
public void putDefaultClasspathEntriesIn ( Collection < IClasspathEntry > classpathEntries ) { final IPath newPath = this . jreGroup . getJREContainerPath ( ) ; if ( newPath != null ) { classpathEntries . add ( JavaCore . newContainerEntry ( newPath ) ) ; } else { final IClasspathEntry [ ] entries = PreferenceConstants...
Returns the default class path entries to be added on new projects . By default this is the JRE container as selected by the user .
33,730
public IPath getOutputLocation ( ) { IPath outputLocationPath = new Path ( getProjectName ( ) ) . makeAbsolute ( ) ; outputLocationPath = outputLocationPath . append ( Path . fromPortableString ( SARLConfig . FOLDER_BIN ) ) ; return outputLocationPath ; }
Returns the source class path entries to be added on new projects . The underlying resource may not exist .
33,731
protected static Action findAction ( EObject grammarComponent , String assignmentName ) { for ( final Action action : GrammarUtil . containedActions ( grammarComponent ) ) { if ( GrammarUtil . isAssignedAction ( action ) ) { if ( Objects . equals ( assignmentName , action . getFeature ( ) ) ) { return action ; } } } re...
Replies the assignment component with the given nazme in the given grammar component .
33,732
protected EObject getContainerInRule ( EObject root , EObject content ) { EObject container = content ; do { final EClassifier classifier = getGeneratedTypeFor ( container ) ; if ( classifier != null ) { return container ; } container = container . eContainer ( ) ; } while ( container != root ) ; final EClassifier clas...
Replies the container in the grammar rule for the given content element .
33,733
protected CellEditor createClassCellEditor ( ) { return new DialogCellEditor ( getControl ( ) ) { protected Object openDialogBox ( Control cellEditorWindow ) { final OpenTypeSelectionDialog dialog = new OpenTypeSelectionDialog ( getControl ( ) . getShell ( ) , false , PlatformUI . getWorkbench ( ) . getProgressService ...
Create a cell editor that enables to select a class .
33,734
private void enableButtons ( ) { final int itemCount = this . list . getTable ( ) . getItemCount ( ) ; final boolean hasElement = itemCount > 0 ; IStructuredSelection selection ; if ( hasElement ) { selection = this . list . getStructuredSelection ( ) ; final int selectionCount = selection . size ( ) ; if ( selectionCo...
Enables the type conversion buttons based on selected items counts in the viewer .
33,735
protected void setTypeConversions ( List < Pair < String , String > > typeConversions , boolean notifyController ) { this . conversions . clear ( ) ; if ( typeConversions != null ) { for ( final Pair < String , String > entry : typeConversions ) { this . conversions . add ( new ConversionMapping ( entry . getKey ( ) , ...
Sets the type conversions to be displayed in this block .
33,736
protected void addTypeConversion ( String javaType , String targetType , boolean updateSelection ) { final ConversionMapping entry = new ConversionMapping ( javaType , targetType ) ; this . conversions . add ( entry ) ; refreshListUI ( ) ; if ( updateSelection ) { this . list . setSelection ( new StructuredSelection ( ...
Add a type conversion .
33,737
@ SuppressWarnings ( "unchecked" ) protected void removeCurrentTypeConversion ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final String [ ] types = new String [ selection . size ( ) ] ; final Iterator < ConversionMapping > iter = selection . iterator ( ) ; int i = 0 ; while ( ...
Remove the current type conversion .
33,738
protected void moveSelectionTop ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final int index = this . conversions . indexOf ( selection . getFirstElement ( ) ) ; if ( index > 0 ) { final int endIndex = index + selection . size ( ) - 1 ; for ( int i = 0 ; i < selection . size (...
Move the selection at the top .
33,739
protected void moveSelectionUp ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final int index = this . conversions . indexOf ( selection . getFirstElement ( ) ) ; if ( index > 0 ) { final ConversionMapping previous = this . conversions . remove ( index - 1 ) ; this . conversions...
Move the selection up .
33,740
protected void moveSelectionDown ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final int index = this . conversions . indexOf ( selection . getFirstElement ( ) ) ; if ( index >= 0 && ( index + selection . size ( ) ) < this . conversions . size ( ) ) { final ConversionMapping ne...
Move the selection down .
33,741
protected void moveSelectionBottom ( ) { final IStructuredSelection selection = this . list . getStructuredSelection ( ) ; final int index = this . conversions . indexOf ( selection . getFirstElement ( ) ) ; if ( index >= 0 && ( index + selection . size ( ) ) < this . conversions . size ( ) ) { for ( int i = 0 ; i < se...
Move the selection at the bottom .
33,742
protected void removeTypeConversions ( String ... types ) { for ( final String type : types ) { final Iterator < ConversionMapping > iterator = this . conversions . iterator ( ) ; while ( iterator . hasNext ( ) ) { final ConversionMapping pair = iterator . next ( ) ; if ( Strings . equal ( pair . getSource ( ) , type )...
Remove the given type conversions .
33,743
protected void refreshListUI ( ) { final Display display = Display . getDefault ( ) ; if ( display . getThread ( ) . equals ( Thread . currentThread ( ) ) ) { if ( ! this . list . isBusy ( ) ) { this . list . refresh ( ) ; } } else { display . syncExec ( new Runnable ( ) { @ SuppressWarnings ( "synthetic-access" ) publ...
Refresh the UI list of type conversions .
33,744
private void sortByTargetColumn ( ) { this . list . setComparator ( new ViewerComparator ( ) { public int compare ( Viewer viewer , Object e1 , Object e2 ) { if ( e1 != null && e2 != null ) { return e1 . toString ( ) . compareToIgnoreCase ( e2 . toString ( ) ) ; } return super . compare ( viewer , e1 , e2 ) ; } public ...
Sorts the type conversions by target type .
33,745
private void updateStatus ( Throwable event ) { Throwable cause = event ; while ( cause != null && ( ! ( cause instanceof CoreException ) ) && cause . getCause ( ) != null && cause . getCause ( ) != cause ) { cause = cause . getCause ( ) ; } if ( cause instanceof CoreException ) { updateStatus ( ( ( CoreException ) cau...
Update the status of this page according to the given exception .
33,746
public void performFinish ( IProgressMonitor monitor ) throws CoreException , InterruptedException { final SubMonitor subMonitor = SubMonitor . convert ( monitor , 4 ) ; try { monitor . beginTask ( NewWizardMessages . NewJavaProjectWizardPageTwo_operation_create , 3 ) ; if ( this . currProject == null ) { updateProject...
Called from the wizard on finish .
33,747
protected IProject createProvisonalProject ( ) { final IStatus status = changeToNewProject ( ) ; if ( status != null ) { updateStatus ( status ) ; if ( ! status . isOK ( ) ) { ErrorDialog . openError ( getShell ( ) , NewWizardMessages . NewJavaProjectWizardPageTwo_error_title , null , status ) ; } } return this . currP...
Creates the provisional project on which the wizard is working on . The provisional project is typically created when the page is entered the first time . The early project creation is required to configure linked folders .
33,748
protected void removeProvisonalProject ( ) { if ( ! this . currProject . exists ( ) ) { this . currProject = null ; return ; } final IRunnableWithProgress op = new IRunnableWithProgress ( ) { @ SuppressWarnings ( "synthetic-access" ) public void run ( IProgressMonitor monitor ) throws InvocationTargetException , Interr...
Removes the provisional project . The provisional project is typically removed when the user cancels the wizard or goes back to the first page .
33,749
public ADDRESST registerParticipant ( ADDRESST address , EventListener entity ) { synchronized ( mutex ( ) ) { addListener ( address , entity ) ; this . participants . put ( entity . getID ( ) , address ) ; } return address ; }
Registers a new participant in this repository .
33,750
public ADDRESST unregisterParticipant ( UUID entityID ) { synchronized ( mutex ( ) ) { removeListener ( this . participants . get ( entityID ) ) ; return this . participants . remove ( entityID ) ; } }
Remove a participant with the given ID from this repository .
33,751
public SynchronizedCollection < ADDRESST > getParticipantAddresses ( ) { final Object mutex = mutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedCollection ( this . participants . values ( ) , mutex ) ; } }
Replies all the addresses of the participants that ar einside this repository .
33,752
public SynchronizedSet < UUID > getParticipantIDs ( ) { final Object mutex = mutex ( ) ; synchronized ( mutex ) { return Collections3 . synchronizedSet ( this . participants . keySet ( ) , mutex ) ; } }
Replies the identifiers of all the participants in this repository .
33,753
protected void addSourceFolder ( String path ) { final List < String > existingFolders1 = this . project . getCompileSourceRoots ( ) ; final List < String > existingFolders2 = this . project . getTestCompileSourceRoots ( ) ; if ( ! existingFolders1 . contains ( path ) && ! existingFolders2 . contains ( path ) ) { getLo...
Add a source folder in the current projecT .
33,754
private List < LightweightTypeReference > cloneTypeReferences ( List < JvmTypeReference > types , Map < String , JvmTypeReference > typeParameterMap ) { final List < LightweightTypeReference > newList = new ArrayList < > ( types . size ( ) ) ; for ( final JvmTypeReference type : types ) { newList . add ( cloneTypeRefer...
Clone the given types by applying the type parameter mapping when necessary .
33,755
@ BQConfigProperty ( "Specify the levels of specific warnings" ) public void setWarningLevels ( Map < String , Severity > levels ) { if ( levels == null ) { this . warningLevels = new HashMap < > ( ) ; } else { this . warningLevels = levels ; } }
Change the specific warning levels .
33,756
protected static String quoteRegex ( String regex ) { if ( regex == null ) { return "" ; } return regex . replaceAll ( REGEX_SPECIAL_CHARS , REGEX_SPECIAL_CHARS_PROTECT ) ; }
Protect the given regular expression .
33,757
protected static String orRegex ( Iterable < String > elements ) { final StringBuilder regex = new StringBuilder ( ) ; for ( final String element : elements ) { if ( regex . length ( ) > 0 ) { regex . append ( "|" ) ; } regex . append ( "(?:" ) ; regex . append ( quoteRegex ( element ) ) ; regex . append ( ")" ) ; } re...
Build a regular expression that is matching one of the given elements .
33,758
protected static Set < String > sortedConcat ( Iterable < String > ... iterables ) { final Set < String > set = new TreeSet < > ( ) ; for ( final Iterable < String > iterable : iterables ) { for ( final String obj : iterable ) { set . add ( obj ) ; } } return set ; }
Concat the given iterables .
33,759
public void addMimeType ( String mimeType ) { if ( ! Strings . isEmpty ( mimeType ) ) { for ( final String mtype : mimeType . split ( "[:;,]" ) ) { this . mimeTypes . add ( mtype ) ; } } }
Add a mime type for the SARL source code .
33,760
public List < String > getMimeTypes ( ) { if ( this . mimeTypes . isEmpty ( ) ) { return Arrays . asList ( "text/x-" + getLanguageSimpleName ( ) . toLowerCase ( ) ) ; } return this . mimeTypes ; }
Replies the mime types for the SARL source code .
33,761
public String getBasename ( String defaultName ) { if ( Strings . isEmpty ( this . basename ) ) { return defaultName ; } return this . basename ; }
Replies the basename of the XML file to generate .
33,762
@ SuppressWarnings ( "checkstyle:nestedifdepth" ) private static void exploreGrammar ( Grammar grammar , Set < String > expressionKeywords , Set < String > modifiers , Set < String > primitiveTypes , Set < String > punctuation , Set < String > literals , Set < String > excludedKeywords , Set < String > ignored ) { for ...
Explore the grammar for extracting the key elements .
33,763
protected final void generate ( Set < String > literals , Set < String > expressionKeywords , Set < String > modifiers , Set < String > primitiveTypes , Set < String > punctuation , Set < String > ignored , Set < String > specialKeywords , Set < String > typeDeclarationKeywords ) { final T appendable = newStyleAppendab...
Generate the external specification .
33,764
public static CharSequence concat ( CharSequence ... lines ) { return new CharSequence ( ) { private final StringBuilder content = new StringBuilder ( ) ; private int next ; private int length = - 1 ; public String toString ( ) { ensure ( length ( ) ) ; return this . content . toString ( ) ; } private void ensure ( int...
Contact the given strings of characters .
33,765
protected void generateReadme ( String basename ) { final Object content = getReadmeFileContent ( basename ) ; if ( content != null ) { final String textualContent = content . toString ( ) ; if ( ! Strings . isEmpty ( textualContent ) ) { final byte [ ] bytes = textualContent . getBytes ( ) ; for ( final String output ...
Generate the README file .
33,766
protected String getLanguageSimpleName ( ) { final String name = getGrammar ( ) . getName ( ) ; final int index = name . lastIndexOf ( '.' ) ; if ( index > 0 ) { return name . substring ( index + 1 ) ; } return name ; }
Replies the simple name of the language .
33,767
protected String lines ( String prefix , String ... lines ) { final String delimiter = getCodeConfig ( ) . getLineDelimiter ( ) ; final StringBuilder buffer = new StringBuilder ( ) ; for ( final String line : lines ) { buffer . append ( prefix ) ; buffer . append ( line ) ; buffer . append ( delimiter ) ; } return buff...
Merge the given lines with prefix .
33,768
@ SuppressWarnings ( "static-method" ) protected OutputConfiguration createStandardOutputConfiguration ( ) { final OutputConfiguration defaultOutput = new OutputConfiguration ( IFileSystemAccess . DEFAULT_OUTPUT ) ; defaultOutput . setDescription ( Messages . SarlOutputConfigurationProvider_0 ) ; defaultOutput . setOut...
Create the standard output configuration .
33,769
public static AgentContext getKernel ( ContextSpaceService contextService , @ Named ( JanusConfig . DEFAULT_CONTEXT_ID_NAME ) UUID janusContextID , @ Named ( JanusConfig . DEFAULT_SPACE_ID_NAME ) UUID defaultJanusSpaceId ) { return contextService . createContext ( janusContextID , defaultJanusSpaceId ) ; }
Construct the root agent context within the Janus platform .
33,770
public static AgentInternalEventsDispatcher createAgentInternalEventsDispatcher ( Injector injector ) { final AgentInternalEventsDispatcher aeb = new AgentInternalEventsDispatcher ( injector . getInstance ( ExecutorService . class ) ) ; injector . injectMembers ( aeb ) ; return aeb ; }
Create an instance of the event dispatcher for an agent .
33,771
protected LightweightTypeReference getSarlCapacityFieldType ( IResolvedTypes resolvedTypes , JvmField field ) { LightweightTypeReference fieldType = resolvedTypes . getActualType ( field ) ; final JvmAnnotationReference capacityAnnotation = this . annotationLookup . findAnnotation ( field , ImportedCapacityFeature . cl...
Replies the type of the field that represents a SARL capacity buffer .
33,772
protected XAbstractFeatureCall createSarlCapacityExtensionProvider ( JvmIdentifiableElement thisFeature , JvmField field ) { if ( thisFeature instanceof JvmDeclaredType ) { final JvmAnnotationReference capacityAnnotation = this . annotationLookup . findAnnotation ( field , ImportedCapacityFeature . class ) ; if ( capac...
Create the extension provider dedicated to the access to the used capacity functions .
33,773
protected static boolean runRejectedTask ( Runnable runnable , ThreadPoolExecutor executor ) { if ( ! executor . isShutdown ( ) ) { runnable . run ( ) ; return true ; } return false ; }
Run the given task within the current thread if the executor is not shut down . The task is not run by the given executor . The executor is used for checking if the executor service is shut down .
33,774
public static < C extends Capacity > C createSkillDelegator ( Skill originalSkill , Class < C > capacity , AgentTrait capacityCaller ) throws Exception { final String name = capacity . getName ( ) + CAPACITY_WRAPPER_NAME ; final Class < ? > type = Class . forName ( name , true , capacity . getClassLoader ( ) ) ; final ...
Create a delegator for the given skill .
33,775
public static < C extends Capacity > C createSkillDelegatorIfPossible ( Skill originalSkill , Class < C > capacity , AgentTrait capacityCaller ) throws ClassCastException { try { return Capacities . createSkillDelegator ( originalSkill , capacity , capacityCaller ) ; } catch ( Exception e ) { return capacity . cast ( o...
Create a delegator for the given skill when it is possible .
33,776
protected void build ( EObject object , ISourceAppender appender ) throws IOException { final IJvmTypeProvider provider = getTypeResolutionContext ( ) ; if ( provider != null ) { final Map < Key < ? > , Binding < ? > > bindings = this . originalInjector . getBindings ( ) ; Injector localInjector = CodeBuilderFactory . ...
Build the source code and put it into the given appender .
33,777
protected boolean isEarlyExitSARLStatement ( XExpression expression ) { if ( expression instanceof XAbstractFeatureCall ) { final Object element = expression . eGet ( XbasePackage . Literals . XABSTRACT_FEATURE_CALL__FEATURE , false ) ; return this . originalComputer . isEarlyExitAnnotatedElement ( element ) ; } return...
Replies if the given expression is a early - exit SARL statement .
33,778
public void addUpperConstraint ( String type ) { final JvmUpperBound constraint = this . jvmTypesFactory . createJvmUpperBound ( ) ; constraint . setTypeReference ( newTypeRef ( this . context , type ) ) ; getJvmTypeParameter ( ) . getConstraints ( ) . add ( constraint ) ; }
Add upper type bounds .
33,779
public void addLowerConstraint ( String type ) { final JvmLowerBound constraint = this . jvmTypesFactory . createJvmLowerBound ( ) ; constraint . setTypeReference ( newTypeRef ( this . context , type ) ) ; getJvmTypeParameter ( ) . getConstraints ( ) . add ( constraint ) ; }
Add lower type bounds .
33,780
public ImageDescriptor getImageDescriptor ( String imagePath ) { ImageDescriptor descriptor = getImageRegistry ( ) . getDescriptor ( imagePath ) ; if ( descriptor == null ) { descriptor = AbstractUIPlugin . imageDescriptorFromPlugin ( SARLEclipsePlugin . PLUGIN_ID , imagePath ) ; if ( descriptor != null ) { getImageReg...
Replies the image descriptor for the given image path .
33,781
@ SuppressWarnings ( "static-method" ) public IStatus createMultiStatus ( Iterable < ? extends IStatus > status ) { final IStatus max = findMax ( status ) ; final MultiStatus multiStatus ; if ( max == null ) { multiStatus = new MultiStatus ( PLUGIN_ID , 0 , null , null ) ; } else { multiStatus = new MultiStatus ( PLUGI...
Create a multistatus .
33,782
public void logErrorMessage ( String message ) { getILog ( ) . log ( new Status ( IStatus . ERROR , PLUGIN_ID , message , null ) ) ; }
Logs an internal error with the specified message .
33,783
@ SuppressWarnings ( { "static-method" , "checkstyle:regexp" } ) public void logDebugMessage ( String message , Throwable cause ) { Debug . println ( message ) ; if ( cause != null ) { Debug . printStackTrace ( cause ) ; } }
Logs an internal debug message with the specified message .
33,784
public void savePreferences ( ) { final IEclipsePreferences prefs = getPreferences ( ) ; try { prefs . flush ( ) ; } catch ( BackingStoreException e ) { getILog ( ) . log ( createStatus ( IStatus . ERROR , e ) ) ; } }
Saves the preferences for the plug - in .
33,785
public void openError ( Shell shell , String title , String message , Throwable exception ) { final Throwable ex = ( exception != null ) ? Throwables . getRootCause ( exception ) : null ; if ( ex != null ) { log ( ex ) ; final IStatus status = createStatus ( IStatus . ERROR , message , ex ) ; ErrorDialog . openError ( ...
Display an error dialog and log the error .
33,786
public static IJavaSearchScope createSearchScope ( IJavaProject project , Class < ? > type , boolean onlySubTypes ) { try { final IType superType = project . findType ( type . getName ( ) ) ; return SearchEngine . createStrictHierarchyScope ( project , superType , onlySubTypes , true , null ) ; } catch ( JavaModelExcep...
Creates a searching scope including only one project .
33,787
private void fillWizardPageWithSelectedTypes ( ) { final StructuredSelection selection = getSelectedItems ( ) ; if ( selection == null ) { return ; } for ( final Iterator < ? > iter = selection . iterator ( ) ; iter . hasNext ( ) ; ) { final Object obj = iter . next ( ) ; if ( obj instanceof TypeNameMatch ) { accessedH...
Adds selected interfaces to the list .
33,788
protected IScope createCastOperatorScope ( EObject context , EReference reference , IResolvedTypes resolvedTypes ) { if ( ! ( context instanceof SarlCastedExpression ) ) { return IScope . NULLSCOPE ; } final SarlCastedExpression call = ( SarlCastedExpression ) context ; final XExpression receiver = call . getTarget ( )...
create a scope for cast operator .
33,789
public void eInit ( IJvmTypeProvider context ) { setTypeResolutionContext ( context ) ; if ( this . block == null ) { this . block = XbaseFactory . eINSTANCE . createXBlockExpression ( ) ; } }
Create the XBlockExpression .
33,790
public String getAutoGeneratedActionString ( Resource resource ) { TaskTags tags = getTaskTagProvider ( ) . getTaskTags ( resource ) ; String taskTag ; if ( tags != null && tags . getTaskTags ( ) != null && ! tags . getTaskTags ( ) . isEmpty ( ) ) { taskTag = tags . getTaskTags ( ) . get ( 0 ) . getName ( ) ; } else { ...
Replies the string for auto - generated comments .
33,791
public IExpressionBuilder addExpression ( ) { final IExpressionBuilder builder = this . expressionProvider . get ( ) ; builder . eInit ( getXBlockExpression ( ) , new Procedures . Procedure1 < XExpression > ( ) { private int index = - 1 ; public void apply ( XExpression it ) { if ( this . index >= 0 ) { getXBlockExpres...
Add an expression inside the block .
33,792
private void handleAntScriptBrowseButtonPressed ( ) { FileDialog dialog = new FileDialog ( getContainer ( ) . getShell ( ) , SWT . SAVE ) ; dialog . setFilterExtensions ( new String [ ] { "*." + ANTSCRIPT_EXTENSION } ) ; String currentSourceString = getAntScriptValue ( ) ; int lastSeparatorIndex = currentSourceString ....
Open an appropriate ant script browser so that the user can specify a source to import from
33,793
private String getAntScriptValue ( ) { String antScriptText = fAntScriptNamesCombo . getText ( ) . trim ( ) ; if ( antScriptText . indexOf ( '.' ) < 0 ) antScriptText += "." + ANTSCRIPT_EXTENSION ; return antScriptText ; }
Answer the contents of the ant script specification widget . If this value does not have the required suffix then add it first .
33,794
protected Label createLabel ( Composite parent , String text , boolean bold ) { Label label = new Label ( parent , SWT . NONE ) ; if ( bold ) label . setFont ( JFaceResources . getBannerFont ( ) ) ; label . setText ( text ) ; GridData gridData = new GridData ( SWT . BEGINNING , SWT . CENTER , false , false ) ; label . ...
Creates a new label with an optional bold font .
33,795
protected void createLibraryHandlingGroup ( Composite parent ) { fLibraryHandlingGroup = new Composite ( parent , SWT . NONE ) ; GridLayout layout = new GridLayout ( ) ; fLibraryHandlingGroup . setLayout ( layout ) ; fLibraryHandlingGroup . setLayoutData ( new GridData ( GridData . HORIZONTAL_ALIGN_FILL | GridData . VE...
Create the export options specification widgets .
33,796
protected void updateModel ( ) { super . updateModel ( ) ; String comboText = fAntScriptNamesCombo . getText ( ) ; IPath path = Path . fromOSString ( comboText ) ; if ( path . segmentCount ( ) > 0 && ensureAntScriptFileIsValid ( path . toFile ( ) ) && path . getFileExtension ( ) == null ) path = path . addFileExtension...
Stores the widget values in the JAR package .
33,797
private IPath getAbsoluteLocation ( IPath location ) { if ( location . isAbsolute ( ) ) return location ; IWorkspaceRoot root = ResourcesPlugin . getWorkspace ( ) . getRoot ( ) ; if ( location . segmentCount ( ) >= 2 && ! ".." . equals ( location . segment ( 0 ) ) ) { IFile file = root . getFile ( location ) ; IPath ab...
Gets the absolute location relative to the workspace .
33,798
private boolean ensureAntScriptFileIsValid ( File antScriptFile ) { if ( antScriptFile . exists ( ) && antScriptFile . isDirectory ( ) && fAntScriptNamesCombo . getText ( ) . length ( ) > 0 ) { setErrorMessage ( FatJarPackagerMessages . FatJarPackageWizardPage_error_antScriptLocationIsDir ) ; fAntScriptNamesCombo . set...
Returns a boolean indicating whether the passed File handle is is valid and available for use .
33,799
protected static String getPathLabel ( IPath path , boolean isOSPath ) { String label ; if ( isOSPath ) { label = path . toOSString ( ) ; } else { label = path . makeRelative ( ) . toString ( ) ; } return label ; }
Returns the label of a path .