-
Notifications
You must be signed in to change notification settings - Fork 320
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow customizing the NodeModelUtils and the way to obtain an INode
Node lookup can be customized by implementing INodeReference on the EMF model. Node storage by means of specializing the NodeModelBuilder. Common operations on nodes by provding custom implementations of INode and overriding INode.utils(). Signed-off-by: Sebastian Zarnekow <sebastian.zarnekow@gmail.com>
- Loading branch information
Showing
5 changed files
with
419 additions
and
268 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
org.eclipse.xtext/src/org/eclipse/xtext/nodemodel/INodeReference.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
/******************************************************************************* | ||
* Copyright (c) 2024 Sebastian Zarnekow and others. | ||
* This program and the accompanying materials are made available under the | ||
* terms of the Eclipse Public License 2.0 which is available at | ||
* http://www.eclipse.org/legal/epl-2.0. | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
*******************************************************************************/ | ||
package org.eclipse.xtext.nodemodel; | ||
|
||
import org.eclipse.xtext.nodemodel.impl.NodeModelBuilder; | ||
import org.eclipse.xtext.nodemodel.util.NodeModelUtils; | ||
|
||
/** | ||
* An EMF object might store the node model information differently from the default adapter | ||
* based approach. If it implements {@link INodeReference}, it will be queried by | ||
* {@link NodeModelUtils#getNode(org.eclipse.emf.ecore.EObject)}. | ||
* | ||
* @since 2.34 | ||
* | ||
* @see NodeModelBuilder#associateWithSemanticElement(ICompositeNode, org.eclipse.emf.ecore.EObject) | ||
*/ | ||
public interface INodeReference { | ||
|
||
/** | ||
* Return the referenced node, if any. | ||
*/ | ||
/* @Nullable */ ICompositeNode getNode(); | ||
|
||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.