org.eclipse.emf.common.util.ECollections Java Examples
The following examples show how to use
org.eclipse.emf.common.util.ECollections.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VariableDeclarationOrBindingImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<VariableDeclaration> getVariableDeclarations() { EList<VariableDeclaration> _switchResult = null; boolean _matched = false; if (this instanceof VariableDeclaration) { _matched=true; _switchResult = ECollections.<VariableDeclaration>toEList(java.util.Collections.<VariableDeclaration>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<VariableDeclaration>newArrayList(((VariableDeclaration) this)))); } if (!_matched) { if (this instanceof VariableBinding) { _matched=true; _switchResult = ECollections.<VariableDeclaration>toEList(Iterators.<VariableDeclaration>filter(this.eAllContents(), VariableDeclaration.class)); } } if (!_matched) { _switchResult = ECollections.<VariableDeclaration>toEList(java.util.Collections.<VariableDeclaration>unmodifiableList(org.eclipse.xtext.xbase.lib.CollectionLiterals.<VariableDeclaration>newArrayList())); } return _switchResult; }
Example #2
Source File: CheckConfigurationPropertiesGenerator.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Generate properties for languages or legacy catalogs. * * @param section * the section * @param properties * the properties */ private void generatePropertiesForCatalogsInConfigurableSection(final ConfigurableSection section, final Properties properties) { String language = null; EList<ConfiguredCatalog> configuredCatalogs = ECollections.emptyEList(); if (section instanceof CheckConfiguration) { configuredCatalogs = ((CheckConfiguration) section).getLegacyCatalogConfigurations(); } else if (section instanceof ConfiguredLanguageValidator) { language = ((ConfiguredLanguageValidator) section).getLanguage(); configuredCatalogs = ((ConfiguredLanguageValidator) section).getCatalogConfigurations(); } for (ConfiguredCatalog catalog : configuredCatalogs) { Set<Check> configuredChecks = Sets.newHashSet(); for (ConfiguredCheck configuredCheck : catalog.getCheckConfigurations()) { generatePropertiesForConfiguredCheck(properties, language, configuredCheck); configuredChecks.add(configuredCheck.getCheck()); } for (Check unconfiguredCheck : Sets.difference(Sets.newHashSet(catalog.getCatalog().getAllChecks()), configuredChecks)) { putInheritedProperties(properties, language, unconfiguredCheck, catalog, ECollections.emptyEList()); } } }
Example #3
Source File: ELists.java From dsl-devkit with Eclipse Public License 1.0 | 6 votes |
/** * Filters an {@link EList} of type T to contain only elements matching the provided predicate. * * @param <T> * list element type * @param unfiltered * unfiltered list * @param predicate * to apply * @return filtered list */ public static <T> EList<T> filter(final EList<T> unfiltered, final Predicate<? super T> predicate) { if (unfiltered == null) { return ECollections.emptyEList(); } if (predicate == null) { throw new IllegalArgumentException("predicate must not be null"); //$NON-NLS-1$ } EList<T> filtered = new BasicEList<T>(unfiltered.size() / 2); // Initial guess: half the original size for (T t : unfiltered) { if (predicate.apply(t)) { filtered.add(t); } } return filtered; }
Example #4
Source File: JvmAnnotationReferenceImplCustom.java From xtext-extras with Eclipse Public License 2.0 | 6 votes |
@Override public EList<JvmAnnotationValue> getValues() { EList<JvmAnnotationValue> explicitValues = getExplicitValues(); List<JvmOperation> operations = Lists.newArrayList(getAnnotation().getDeclaredOperations()); if (operations.size() <= explicitValues.size()) { return ECollections.unmodifiableEList(explicitValues); } Set<JvmOperation> seenOperations = Sets.newHashSetWithExpectedSize(operations.size()); BasicEList<JvmAnnotationValue> result = new BasicEList<JvmAnnotationValue>(operations.size()); for(JvmAnnotationValue value: explicitValues) { seenOperations.add(value.getOperation()); result.add(value); } for(JvmOperation operation: operations) { if (seenOperations.add(operation)) { JvmAnnotationValue defaultValue = operation.getDefaultValue(); if (defaultValue != null) { result.add(defaultValue); } } } return ECollections.unmodifiableEList(result); }
Example #5
Source File: AbstractComponentItemCreator.java From neoscada with Eclipse Public License 1.0 | 6 votes |
protected <T extends Item> T addItem ( final T item, final CustomizationRequest customizationRequest, final Set<MasterListener<T>> masterListeners ) { final List<String> originalLocalTags = new ArrayList<> ( customizationRequest.getLocalTags () ); // we do need a copy customizeItem ( item, customizationRequest ); // set the name after customizing final List<String> hier = new LinkedList<> (); hier.addAll ( customizationRequest.getHierarchy () ); hier.addAll ( customizationRequest.getLocalTags () ); item.setName ( Names.makeHierarchy ( hier ) ); // FIXME: should allow a different naming scheme logger.debug ( "Setting item name: {}", item.getName () ); if ( item.getInformation () == null ) { item.setInformation ( OsgiFactory.eINSTANCE.createItemInformation () ); } // apply the hierarchy afterwards ... overriding! ECollections.setEList ( item.getInformation ().getHierarchy (), customizationRequest.getHierarchy () ); itemAdded ( item, customizationRequest, originalLocalTags, masterListeners ); return item; }
Example #6
Source File: TaintedValueAnalyser.java From n4js with Eclipse Public License 1.0 | 6 votes |
private boolean assignedSymbolIsAnnotatedWith(Symbol assignedSymbol, String annotationName) { EObject decl = SymbolDeclaration.get(assignedSymbol, ts); EList<Annotation> annotations = ECollections.emptyEList(); if (decl instanceof N4FieldDeclaration) { N4FieldDeclaration fieldDecl = (N4FieldDeclaration) decl; annotations = fieldDecl.getAnnotations(); } if (decl instanceof VariableDeclaration) { VariableDeclaration varDecl = (VariableDeclaration) decl; annotations = varDecl.getAnnotations(); } for (Annotation ann : annotations) { String name = ann.getName(); return annotationName.equals(name); } return false; }
Example #7
Source File: UpdateDataCommand.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override protected CommandResult doExecuteWithResult(IProgressMonitor monitor, IAdaptable info) throws ExecutionException { DataType t = searchDataType(); preHandleJavaObjectAndXMLData(t); data.setMultiple(multiplicity); data.setTransient(dataIsTransient); data.setDefaultValue(defaultValue); data.setDataType(t); data.setName(name); data.setDocumentation(description); data.setGenerated(generateData); ((List) element.eGet(feature)).add(data); ECollections.sort(((EList<?>) element.eGet(feature)),new Comparator<Object>() { public int compare(Object o1, Object o2) { return ((Element) o1).getName().compareTo(((Element) o2).getName()); } }); return CommandResult.newOKCommandResult(); }
Example #8
Source File: VersionedParameterizedTypeRefStructural_IMImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<TStructMember> getStructuralMembers() { EList<TStructMember> _xifexpression = null; TStructuralType _structuralType = this.getStructuralType(); boolean _tripleNotEquals = (_structuralType != null); if (_tripleNotEquals) { _xifexpression = this.getStructuralType().getOwnedMembers(); } else { EList<TStructMember> _xifexpression_1 = null; boolean _isEmpty = this.getAstStructuralMembers().isEmpty(); boolean _not = (!_isEmpty); if (_not) { _xifexpression_1 = this.getAstStructuralMembers(); } else { _xifexpression_1 = this.getGenStructuralMembers(); } _xifexpression = _xifexpression_1; } return ECollections.<TStructMember>unmodifiableEList(_xifexpression); }
Example #9
Source File: ParameterizedTypeRefStructural_IMImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<TStructMember> getStructuralMembers() { EList<TStructMember> _xifexpression = null; TStructuralType _structuralType = this.getStructuralType(); boolean _tripleNotEquals = (_structuralType != null); if (_tripleNotEquals) { _xifexpression = this.getStructuralType().getOwnedMembers(); } else { EList<TStructMember> _xifexpression_1 = null; boolean _isEmpty = this.getAstStructuralMembers().isEmpty(); boolean _not = (!_isEmpty); if (_not) { _xifexpression_1 = this.getAstStructuralMembers(); } else { _xifexpression_1 = this.getGenStructuralMembers(); } _xifexpression = _xifexpression_1; } return ECollections.<TStructMember>unmodifiableEList(_xifexpression); }
Example #10
Source File: BoundThisTypeRefImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<TStructMember> getStructuralMembers() { EList<TStructMember> _xifexpression = null; TStructuralType _structuralType = this.getStructuralType(); boolean _tripleNotEquals = (_structuralType != null); if (_tripleNotEquals) { _xifexpression = this.getStructuralType().getOwnedMembers(); } else { EList<TStructMember> _xifexpression_1 = null; boolean _isEmpty = this.getAstStructuralMembers().isEmpty(); boolean _not = (!_isEmpty); if (_not) { _xifexpression_1 = this.getAstStructuralMembers(); } else { _xifexpression_1 = this.getGenStructuralMembers(); } _xifexpression = _xifexpression_1; } return ECollections.<TStructMember>unmodifiableEList(_xifexpression); }
Example #11
Source File: ParameterizedTypeRefStructuralImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<TStructMember> getStructuralMembers() { EList<TStructMember> _xifexpression = null; TStructuralType _structuralType = this.getStructuralType(); boolean _tripleNotEquals = (_structuralType != null); if (_tripleNotEquals) { _xifexpression = this.getStructuralType().getOwnedMembers(); } else { EList<TStructMember> _xifexpression_1 = null; boolean _isEmpty = this.getAstStructuralMembers().isEmpty(); boolean _not = (!_isEmpty); if (_not) { _xifexpression_1 = this.getAstStructuralMembers(); } else { _xifexpression_1 = this.getGenStructuralMembers(); } _xifexpression = _xifexpression_1; } return ECollections.<TStructMember>unmodifiableEList(_xifexpression); }
Example #12
Source File: ThisTypeRefStructuralImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<TStructMember> getStructuralMembers() { EList<TStructMember> _xifexpression = null; TStructuralType _structuralType = this.getStructuralType(); boolean _tripleNotEquals = (_structuralType != null); if (_tripleNotEquals) { _xifexpression = this.getStructuralType().getOwnedMembers(); } else { EList<TStructMember> _xifexpression_1 = null; boolean _isEmpty = this.getAstStructuralMembers().isEmpty(); boolean _not = (!_isEmpty); if (_not) { _xifexpression_1 = this.getAstStructuralMembers(); } else { _xifexpression_1 = this.getGenStructuralMembers(); } _xifexpression = _xifexpression_1; } return ECollections.<TStructMember>unmodifiableEList(_xifexpression); }
Example #13
Source File: VersionedParameterizedTypeRefStructuralImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<TStructMember> getStructuralMembers() { EList<TStructMember> _xifexpression = null; TStructuralType _structuralType = this.getStructuralType(); boolean _tripleNotEquals = (_structuralType != null); if (_tripleNotEquals) { _xifexpression = this.getStructuralType().getOwnedMembers(); } else { EList<TStructMember> _xifexpression_1 = null; boolean _isEmpty = this.getAstStructuralMembers().isEmpty(); boolean _not = (!_isEmpty); if (_not) { _xifexpression_1 = this.getAstStructuralMembers(); } else { _xifexpression_1 = this.getGenStructuralMembers(); } _xifexpression = _xifexpression_1; } return ECollections.<TStructMember>unmodifiableEList(_xifexpression); }
Example #14
Source File: StructuralTypeRefImpl.java From n4js with Eclipse Public License 1.0 | 6 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<TStructMember> getStructuralMembers() { EList<TStructMember> _xifexpression = null; TStructuralType _structuralType = this.getStructuralType(); boolean _tripleNotEquals = (_structuralType != null); if (_tripleNotEquals) { _xifexpression = this.getStructuralType().getOwnedMembers(); } else { EList<TStructMember> _xifexpression_1 = null; boolean _isEmpty = this.getAstStructuralMembers().isEmpty(); boolean _not = (!_isEmpty); if (_not) { _xifexpression_1 = this.getAstStructuralMembers(); } else { _xifexpression_1 = this.getGenStructuralMembers(); } _xifexpression = _xifexpression_1; } return ECollections.<TStructMember>unmodifiableEList(_xifexpression); }
Example #15
Source File: VariableDefinitionImpl.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override public EList<Annotation> getAnnotations() { EList<Annotation> result = new BasicEList<Annotation>(); result.addAll(super.getAnnotations()); if(getAnnotationInfo() != null) { result.addAll(getAnnotationInfo().getAnnotations()); } return ECollections.unmodifiableEList(result); }
Example #16
Source File: DaveDriverImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public EList<Endpoint> getEndpoints () { final EList<Endpoint> result = ECollections.newBasicEList (); for ( final Exporter exporter : getExporter () ) { result.addAll ( exporter.getEndpoints () ); } return result; }
Example #17
Source File: ModbusDriverImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * * @generated NOT */ @Override public EList<Endpoint> getEndpoints () { final EList<Endpoint> result = ECollections.newBasicEList (); for ( final Exporter exporter : getExporter () ) { result.addAll ( exporter.getEndpoints () ); } return result; }
Example #18
Source File: AlarmsEventsConnectionImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public EList<Endpoint> getPossibleEndpoints ( final Exporter exporter ) { if ( ! ( exporter instanceof AlarmsEventsExporter ) ) { return ECollections.emptyEList (); } return exporter.getEndpoints (); }
Example #19
Source File: DataAccessConnectionImpl.java From neoscada with Eclipse Public License 1.0 | 5 votes |
@Override public EList<Endpoint> getPossibleEndpoints ( final Exporter exporter ) { if ( ! ( exporter instanceof DataAccessExporter ) ) { return ECollections.emptyEList (); } return exporter.getEndpoints (); }
Example #20
Source File: IfcModel.java From BIMserver with GNU Affero General Public License v3.0 | 5 votes |
private void sortPrimitiveList(EList<IdEObject> list) { ECollections.sort(list, new Comparator<IdEObject>() { @Override public int compare(IdEObject o1, IdEObject o2) { return comparePrimitives(o1, o2); } }); }
Example #21
Source File: EventDefinitionImpl.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override public EList<Annotation> getAnnotations() { EList<Annotation> result = new BasicEList<Annotation>(); result.addAll(super.getAnnotations()); if(getAnnotationInfo() != null) { result.addAll(getAnnotationInfo().getAnnotations()); } return ECollections.unmodifiableEList(result); }
Example #22
Source File: XAssignmentImplCustom.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
@Override public EList<XExpression> getActualArguments() { if (isStaticWithDeclaringType()) { return ECollections.singletonEList(getValue()); } return getActualArguments(getAssignable(), getValue()); }
Example #23
Source File: UsersWizardPage.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private EList<CustomUserInfoValue> sortCustomUserInfoValues(final User selectedUser) { final EList<CustomUserInfoValue> customUserInfoValueList = selectedUser.getCustomUserInfoValues() .getCustomUserInfoValue(); ECollections.sort(customUserInfoValueList, new Comparator<CustomUserInfoValue>() { @Override public int compare(final CustomUserInfoValue o1, final CustomUserInfoValue o2) { return o1.getName().compareToIgnoreCase(o2.getName()); } }); return customUserInfoValueList; }
Example #24
Source File: TypeAliasDefinitionImpl.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override public EList<Annotation> getAnnotations() { EList<Annotation> result = new BasicEList<Annotation>(); result.addAll(super.getAnnotations()); if(getAnnotationInfo() != null) { result.addAll(getAnnotationInfo().getAnnotations()); } return ECollections.unmodifiableEList(result); }
Example #25
Source File: OperationDefinitionImpl.java From statecharts with Eclipse Public License 1.0 | 5 votes |
@Override public EList<Annotation> getAnnotations() { EList<Annotation> result = new BasicEList<Annotation>(); result.addAll(super.getAnnotations()); if(getAnnotationInfo() != null) { result.addAll(getAnnotationInfo().getAnnotations()); } return ECollections.unmodifiableEList(result); }
Example #26
Source File: VariableStatementImpl.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<VariableDeclaration> getVarDecl() { final Function1<VariableDeclarationOrBinding, EList<VariableDeclaration>> _function = new Function1<VariableDeclarationOrBinding, EList<VariableDeclaration>>() { public EList<VariableDeclaration> apply(final VariableDeclarationOrBinding it) { return it.getVariableDeclarations(); } }; return ECollections.<VariableDeclaration>toEList(Iterables.<VariableDeclaration>concat(XcoreEListExtensions.<VariableDeclarationOrBinding, EList<VariableDeclaration>>map(this.getVarDeclsOrBindings(), _function))); }
Example #27
Source File: CodeActionService.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
private CodeAction fixUnsortedMembers(Diagnostic d, ICodeActionService2.Options options) { WorkspaceEdit wsEdit = recordWorkspaceEdit(options, (Resource copiedResource) -> { Model model = Iterables.getFirst(Iterables.filter(copiedResource.getContents(), Model.class), null); if (model != null) { for (TypeDeclaration type : Iterables.filter(model.getElements(), TypeDeclaration.class)) { ECollections.sort(type.getMembers(), (Member a, Member b) -> a.getName().compareTo(b.getName())); } } }); CodeAction codeAction = new CodeAction(); codeAction.setTitle("Sort Members"); codeAction.setDiagnostics(Lists.newArrayList(d)); codeAction.setEdit(wsEdit); return codeAction; }
Example #28
Source File: CheckCfgScopeProvider.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
@Override public IScope getScope(final EObject context, final EReference reference) { if (reference == CheckcfgPackage.Literals.CONFIGURED_CHECK__CHECK) { // Note that context object can be either a configured check (if 'optional' keyword has been provided // so that a new instance is created and the configured catalog does not contain any configured checks // yet) or a configured catalog (in all other cases) final ConfiguredCatalog configuredCatalog = EcoreUtil2.getContainerOfType(context, ConfiguredCatalog.class); if (configuredCatalog == null || configuredCatalog.getCatalog() == null) { return IScope.NULLSCOPE; } CheckCatalog catalog = configuredCatalog.getCatalog(); return Scopes.scopeFor(catalog.getAllChecks(), checkQualifiedNameProvider, IScope.NULLSCOPE); } else if (reference == CheckcfgPackage.Literals.CONFIGURED_PARAMETER__PARAMETER) { // a new list of FormalParameters to scope to EList<FormalParameter> parameters = ECollections.newBasicEList(); final ConfiguredCheck configuredCheck = EcoreUtil2.getContainerOfType(context, ConfiguredCheck.class); if (configuredCheck != null) { // add FormalParameter definitions from linked check parameters.addAll(configuredCheck.getCheck().getFormalParameters()); } // add inferred FormalParameters (properties) final CheckConfiguration checkConfiguration = EcoreUtil2.getContainerOfType(context, CheckConfiguration.class); parameters.addAll(checkConfiguration.getProperties()); return Scopes.scopeFor(parameters, checkQualifiedNameProvider, IScope.NULLSCOPE); } return super.getScope(context, reference); }
Example #29
Source File: VariableDeclarationContainerImpl.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<VariableDeclaration> getVarDecl() { final Function1<VariableDeclarationOrBinding, EList<VariableDeclaration>> _function = new Function1<VariableDeclarationOrBinding, EList<VariableDeclaration>>() { public EList<VariableDeclaration> apply(final VariableDeclarationOrBinding it) { return it.getVariableDeclarations(); } }; return ECollections.<VariableDeclaration>toEList(Iterables.<VariableDeclaration>concat(XcoreEListExtensions.<VariableDeclarationOrBinding, EList<VariableDeclaration>>map(this.getVarDeclsOrBindings(), _function))); }
Example #30
Source File: Items.java From neoscada with Eclipse Public License 1.0 | 5 votes |
public static void replaceDanglingReferences ( final GeneratorContext ctx, final MasterServer master, final EList<Item> sourceItems ) { final ArrayList<Item> items = new ArrayList<> (); for ( final Item item : sourceItems ) { items.add ( replaceDanglingReference ( ctx, master, item ) ); } // finally set the new item list ECollections.setEList ( sourceItems, items ); }