org.eclipse.emf.ecore.EObject Java Examples
The following examples show how to use
org.eclipse.emf.ecore.EObject.
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: OperatorViewerFilter.java From bonita-studio with GNU General Public License v2.0 | 6 votes |
@Override public boolean select(final Viewer viewer, final Object parentElement, final Object element) { final Expression exp = operation.getLeftOperand(); if (isVariableType(exp)) { return selectFilterForVariableStorage(element, exp); } else if (isDocumentType(exp)) { final EObject referencedDocument = exp.getReferencedElements().get(0); if (referencedDocument instanceof Document) { if (((Document) referencedDocument).isMultiple()) { return ExpressionConstants.SET_LIST_DOCUMENT_OPERATOR.equals(element); } else { return ExpressionConstants.SET_DOCUMENT_OPERATOR.equals(element); } } } return ExpressionConstants.ASSIGNMENT_OPERATOR.equals(element); }
Example #2
Source File: HelpIntegrationTest.java From statecharts with Eclipse Public License 1.0 | 6 votes |
private List<String> getFeaturesWithoutDocumentation(String generatorId) { Iterable<IEObjectDescription> allElements = getAllElements(generatorId); List<String> missingDocumentation = Lists.newArrayList(); for (IEObjectDescription desc : allElements) { if (desc.getEClass() != SGenPackage.Literals.FEATURE_TYPE) continue; EObject eObjectOrProxy = desc.getEObjectOrProxy(); String documentation = documentationProvider .getDocumentation(eObjectOrProxy); if (documentation == null || SGenUserHelpDocumentationProvider.EMPTY_DOCUMENTATION .equals(documentation)) { missingDocumentation.add(desc.getName().toString()); } } return missingDocumentation; }
Example #3
Source File: Bug419429Test.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
protected void replaceAndReparse(String model, int offset, int length, String change, String expectedReparseRegion) throws Exception { IParseResult parseResult = getParseResultAndExpect(model, UNKNOWN_EXPECTATION); PartialParsingPointers parsingPointers = getPartialParser().calculatePartialParsingPointers(parseResult, offset, length); String reparseRegion = getPartialParser().insertChangeIntoReplaceRegion(parsingPointers .getDefaultReplaceRootNode(), new ReplaceRegion(offset, length, change)); assertEquals(expectedReparseRegion, reparseRegion); final Wrapper<Boolean> unloaded = Wrapper.wrap(Boolean.FALSE); getPartialParser().setUnloader(new IReferableElementsUnloader() { @Override public void unloadRoot(EObject root) { unloaded.set(Boolean.TRUE); } }); IParseResult partiallyReparse = reparse(parseResult, offset, length, change); assertTrue("unloaded", unloaded.get()); String expectedReparseModel = model.substring(0, offset) + change + model.substring(offset + length); assertEquals(expectedReparseModel, partiallyReparse.getRootNode().getText()); compareWithFullParse(model, offset, length, change); }
Example #4
Source File: AbstractXtextTests.java From xtext-core with Eclipse Public License 2.0 | 6 votes |
public final XtextResource getResourceAndExpect(InputStream in, URI uri, int expectedErrors) throws Exception { XtextResource resource = doGetResource(in, uri); checkNodeModel(resource); if (expectedErrors != UNKNOWN_EXPECTATION) { if (expectedErrors == EXPECT_ERRORS) assertFalse(Joiner.on('\n').join(resource.getErrors()), resource.getErrors().isEmpty()); else assertEquals(Joiner.on('\n').join(resource.getErrors()), expectedErrors, resource.getErrors().size()); } for(Diagnostic d: resource.getErrors()) { if (d instanceof ExceptionDiagnostic) fail(d.getMessage()); } if (expectedErrors == 0 && resource.getContents().size() > 0 && shouldTestSerializer(resource)) { SerializerTestHelper tester = get(SerializerTestHelper.class); EObject obj = resource.getContents().get(0); tester.assertSerializeWithNodeModel(obj); tester.assertSerializeWithoutNodeModel(obj); } return resource; }
Example #5
Source File: OrderedEmfFormatter.java From n4js with Eclipse Public License 1.0 | 6 votes |
private static void objPath(StringBuffer b, EObject obj) { if (obj.eContainer() != null) { objPath(b, obj.eContainer()); b.append("."); b.append(obj.eContainingFeature().getName()); if (obj.eContainingFeature().isMany()) { b.append("["); b.append(((List<?>) obj.eContainer().eGet(obj.eContainingFeature())).indexOf(obj)); b.append("]"); } b.append("->"); } b.append(obj.eClass().getName()); EStructuralFeature nameF = obj.eClass().getEStructuralFeature("name"); Object name = nameF != null ? obj.eGet(nameF) : null; if (name != null) { b.append("'"); b.append(name); b.append("'"); } }
Example #6
Source File: InternalValidParser.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
public final EObject entryRuleRangeRule() throws RecognitionException { EObject current = null; EObject iv_ruleRangeRule = null; try { // InternalValid.g:867:2: (iv_ruleRangeRule= ruleRangeRule EOF ) // InternalValid.g:868:2: iv_ruleRangeRule= ruleRangeRule EOF { newCompositeNode(grammarAccess.getRangeRuleRule()); pushFollow(FOLLOW_1); iv_ruleRangeRule=ruleRangeRule(); state._fsp--; current =iv_ruleRangeRule; match(input,EOF,FOLLOW_2); } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; }
Example #7
Source File: AbstractTypeProviderTest.java From xtext-extras with Eclipse Public License 2.0 | 5 votes |
protected void diagnose(EObject object, String... expectedUnresolvedProxies) { Resource resource = object.eResource(); for (EObject content : resource.getContents()) { Diagnostic diagnostic = diagnostician.validate(content); if (diagnostic.getSeverity() != Diagnostic.OK) { URI[] expectedUnresolvedProxyURIs = new URI[expectedUnresolvedProxies.length]; for (int i = 0; i < expectedUnresolvedProxies.length; i++) { expectedUnresolvedProxyURIs[i] = URI.createURI(expectedUnresolvedProxies[i]); } diagnose(diagnostic, expectedUnresolvedProxyURIs); } } }
Example #8
Source File: TraceAdapterFactory.java From kieker with Apache License 2.0 | 5 votes |
/** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. * <!-- end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
Example #9
Source File: WorldAdapterFactory.java From neoscada with Eclipse Public License 1.0 | 5 votes |
/** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the * model's package or is an instance object of the model. * <!-- end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType ( Object object ) { if ( object == modelPackage ) { return true; } if ( object instanceof EObject ) { return ( (EObject)object ).eClass ().getEPackage () == modelPackage; } return false; }
Example #10
Source File: HelloWorldAdapterFactory.java From dsl-devkit with Eclipse Public License 1.0 | 5 votes |
/** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. * <!-- end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
Example #11
Source File: InvisibleTypeOrVariableDescription.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public String getIssueCode() { EObject objectOrProxy = getEObjectOrProxy(); if (objectOrProxy instanceof TFunction) { return IssueCodes.VIS_ILLEGAL_FUN_ACCESS; } else if (objectOrProxy instanceof Type) { return IssueCodes.VIS_ILLEGAL_TYPE_ACCESS; } return IssueCodes.VIS_ILLEGAL_VARIABLE_ACCESS; }
Example #12
Source File: AbstractCleaningLinker.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * @since 2.7 */ @SuppressWarnings("serial") protected TreeIterator<EObject> getAllLinkableContents(EObject model) { return new AbstractTreeIterator<EObject>(model) { @Override public Iterator<EObject> getChildren(Object object) { return ((EObject) object).eContents().iterator(); } }; }
Example #13
Source File: EditorOverlay.java From n4js with Eclipse Public License 1.0 | 5 votes |
@Override public void paintControl(PaintEvent e) { for (EObject eo : selectedElements) { paintConture(e, eo, colorBlue); } if (hoveredElement != null) { paintConture(e, hoveredElement, colorGreen); } }
Example #14
Source File: AbstractRenameStrategy.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
protected EObject setName(URI targetElementURI, String newName, ResourceSet resourceSet) { EObject targetElement = resourceSet.getEObject(targetElementURI, false); if (targetElement == null) { throw new RefactoringException("Target element not loaded."); } targetElement.eSet(nameAttribute, newName); return targetElement; }
Example #15
Source File: IdentifierRefImpl.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public IdentifiableElement getTargetElement() { final IdentifiableElement targetRaw = this.getId(); if ((targetRaw instanceof ModuleNamespaceVirtualType)) { final EObject parent = this.eContainer(); if ((parent instanceof ParameterizedPropertyAccessExpression)) { return ((ParameterizedPropertyAccessExpression)parent).getProperty(); } } return targetRaw; }
Example #16
Source File: OperationReturnTypesValidator.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
private boolean isInvalidQueryExpression(final Operation operation) { if (leftOperandHasReferencedElement(operation)) { final EObject data = operation.getLeftOperand().getReferencedElements().get(0); return !(data instanceof BusinessObjectData) && Objects.equals(operation.getRightOperand().getType(), ExpressionConstants.QUERY_TYPE) && !isPrimitive(operation.getRightOperand().getReturnType()); } return false; }
Example #17
Source File: TFormalParameterImpl.java From n4js with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EObject getAstElement() { if (astElement != null && astElement.eIsProxy()) { InternalEObject oldAstElement = (InternalEObject)astElement; astElement = eResolveProxy(oldAstElement); if (astElement != oldAstElement) { if (eNotificationRequired()) eNotify(new ENotificationImpl(this, Notification.RESOLVE, TypesPackage.TFORMAL_PARAMETER__AST_ELEMENT, oldAstElement, astElement)); } } return astElement; }
Example #18
Source File: XtendExpressionUtil.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override protected ITextRegion getTotalTextRegion(EObject element, INode node) { if (element.eContainer() instanceof RichString) { return getRichStringPartTextRegion(element); } return super.getTotalTextRegion(element, node); }
Example #19
Source File: InternalSimpleExpressionsParser.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
public final EObject entryRuleExpression() throws RecognitionException { EObject current = null; EObject iv_ruleExpression = null; try { // InternalSimpleExpressions.g:138:2: (iv_ruleExpression= ruleExpression EOF ) // InternalSimpleExpressions.g:139:2: iv_ruleExpression= ruleExpression EOF { newCompositeNode(grammarAccess.getExpressionRule()); pushFollow(FOLLOW_1); iv_ruleExpression=ruleExpression(); state._fsp--; current =iv_ruleExpression; match(input,EOF,FOLLOW_2); } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; }
Example #20
Source File: InternalTwoParametersTestLanguageParser.java From xtext-eclipse with Eclipse Public License 2.0 | 5 votes |
public final EObject entryRuleScenario7() throws RecognitionException { EObject current = null; EObject iv_ruleScenario7 = null; try { // InternalTwoParametersTestLanguage.g:677:50: (iv_ruleScenario7= ruleScenario7 EOF ) // InternalTwoParametersTestLanguage.g:678:2: iv_ruleScenario7= ruleScenario7 EOF { if ( state.backtracking==0 ) { newCompositeNode(grammarAccess.getScenario7Rule()); } pushFollow(FollowSets000.FOLLOW_1); iv_ruleScenario7=ruleScenario7(); state._fsp--; if (state.failed) return current; if ( state.backtracking==0 ) { current =iv_ruleScenario7; } match(input,EOF,FollowSets000.FOLLOW_2); if (state.failed) return current; } } catch (RecognitionException re) { recover(input,re); appendSkippedTokens(); } finally { } return current; }
Example #21
Source File: PartialParserTestLanguageAdapterFactory.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
/** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. * <!-- end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
Example #22
Source File: XtendAdapterFactory.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
/** * Returns whether this factory is applicable for the type of the object. * <!-- begin-user-doc --> * This implementation returns <code>true</code> if the object is either the model's package or is an instance object of the model. * <!-- end-user-doc --> * @return whether this factory is applicable for the type of the object. * @generated */ @Override public boolean isFactoryForType(Object object) { if (object == modelPackage) { return true; } if (object instanceof EObject) { return ((EObject)object).eClass().getEPackage() == modelPackage; } return false; }
Example #23
Source File: TabbedPropertySynchronizerListener.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
@Override public void selectionChanged(final SelectionChangedEvent event) { final ISelection selection = event.getSelection(); if (selection.isEmpty()) { return; } final EObject element = unwrap(selection); final IEditorReference activeEditorReference = activeEditorReference(activePage); final IWorkbenchPart editorPart = activeEditorReference.getPart(false); if (editorPart instanceof DiagramEditor) { final DiagramEditor diagramEditor = (DiagramEditor) editorPart; try { final IGraphicalEditPart editPart = editPartResolver.findEditPart(diagramEditor.getDiagramEditPart(), element); final ITabbedPropertySelectionProvider defaultProvider = findDefaultProvider(editorPart, editPart); updateDiagramSelection(diagramEditor, editPart); final ITabbedPropertySelectionProvider selectionProvider = registry.findSelectionProvider(element, activeEditorReference, defaultProvider); IViewPart part = null; try { part = activePage.showView(selectionProvider.viewId()); } catch (final PartInitException e1) { return; } if (part != null) { updateSelectedTabInPage(element, selectionProvider, part); } } catch (final EditPartNotFoundException e) { BonitaStudioLog.debug("No edit part found for semantic element: " + element, Activator.PLUGIN_ID); } } }
Example #24
Source File: EnricherPropertiesEditionPartForm.java From eip-designer with Apache License 2.0 | 5 votes |
/** * */ protected void editFromChannels(EObject element) { EObjectPropertiesEditionContext context = new EObjectPropertiesEditionContext(propertiesEditionComponent.getEditingContext(), propertiesEditionComponent, element, adapterFactory); PropertiesEditingProvider provider = (PropertiesEditingProvider)adapterFactory.adapt(element, PropertiesEditingProvider.class); if (provider != null) { PropertiesEditingPolicy policy = provider.getPolicy(context); if (policy != null) { policy.execute(); fromChannels.refresh(); } } }
Example #25
Source File: IfcStepSerializer.java From IfcPlugins with GNU Affero General Public License v3.0 | 5 votes |
private void writeDoubleValue(double value, EObject object, EStructuralFeature feature) throws SerializerException, IOException { if (model.isUseDoubleStrings()) { Object stringValue = object.eGet(object.eClass().getEStructuralFeature(feature.getName() + "AsString")); if (stringValue != null) { print((String)stringValue); return; } } IfcParserWriterUtils.writePrimitive(value, outputStream); }
Example #26
Source File: InlineAssemblyBlockImpl.java From solidity-ide with Eclipse Public License 1.0 | 5 votes |
/** * <!-- begin-user-doc --> * <!-- end-user-doc --> * @generated */ @Override public EList<EObject> getItems() { if (items == null) { items = new EObjectContainmentEList<EObject>(EObject.class, this, SolidityPackage.INLINE_ASSEMBLY_BLOCK__ITEMS); } return items; }
Example #27
Source File: XtendProposalProvider.java From xtext-xtend with Eclipse Public License 2.0 | 5 votes |
@Override public void completeXbaseConstructorCall_Constructor(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) { completeJavaTypes( context, TypesPackage.Literals.JVM_PARAMETERIZED_TYPE_REFERENCE__TYPE, true, getQualifiedNameValueConverter(), createVisibilityFilter(context), acceptor); }
Example #28
Source File: DefaultResourceDescriptionTest.java From xtext-core with Eclipse Public License 2.0 | 5 votes |
private void assertContains(Iterable<IEObjectDescription> exportedObjects, EObject ...expectedContents) { Collection<IEObjectDescription> collection = Lists.newArrayList(exportedObjects); for (EObject obj : expectedContents) { boolean found = false; for (IEObjectDescription ieObjectDescription : collection) { found = found || ieObjectDescription.getEObjectOrProxy()==obj; } assertTrue(obj+" wasn't contained",found); } assertEquals(collection.size(),expectedContents.length); }
Example #29
Source File: ConditionModelSemanticSequencer.java From bonita-studio with GNU General Public License v2.0 | 5 votes |
/** * Constraint: * value=STRING */ protected void sequence_Expression_String(EObject context, Expression_String semanticObject) { if(errorAcceptor != null) { if(transientValues.isValueTransient(semanticObject, ConditionModelPackage.Literals.EXPRESSION_STRING__VALUE) == ValueTransient.YES) errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, ConditionModelPackage.Literals.EXPRESSION_STRING__VALUE)); } INodesForEObjectProvider nodes = createNodeProvider(semanticObject); SequenceFeeder feeder = createSequencerFeeder(semanticObject, nodes); feeder.accept(grammarAccess.getExpression_StringAccess().getValueSTRINGTerminalRuleCall_1_0(), semanticObject.getValue()); feeder.finish(); }
Example #30
Source File: ControlFlowGraphFactory.java From n4js with Eclipse Public License 1.0 | 5 votes |
private static FinallyBlock getEnteringFinallyBlock(Node catchNode) { if (catchNode.name.equals(NodeNames.FINALLY)) { ControlFlowElement cfe = catchNode.getDelegatedControlFlowElement(); EObject cfeContainer = cfe.eContainer(); return (FinallyBlock) cfeContainer; } return null; }