-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Implemented syntax and validation * WIP * Implemented code gen * Fixed tests * Location fix * Relaxed errors * Fixed errors * Cleaned * Made metadata unmodifiable * Made metadata unmodifiable * Implemented autocompletion * Typos * Fix rule inheritance * Fixed * Auto-complete * Clean * Inherit deprecated annotation
- Loading branch information
1 parent
6bd6e67
commit 9b917aa
Showing
79 changed files
with
6,131 additions
and
4,050 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
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
48 changes: 48 additions & 0 deletions
48
.../src/main/java/com/regnosys/rosetta/ide/contentassist/RosettaContentProposalProvider.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,48 @@ | ||
package com.regnosys.rosetta.ide.contentassist; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.eclipse.emf.ecore.EObject; | ||
import org.eclipse.xtext.RuleCall; | ||
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistContext; | ||
import org.eclipse.xtext.ide.editor.contentassist.ContentAssistEntry; | ||
import org.eclipse.xtext.ide.editor.contentassist.IIdeContentProposalAcceptor; | ||
import org.eclipse.xtext.ide.editor.contentassist.IdeContentProposalProvider; | ||
import org.eclipse.xtext.resource.EObjectDescription; | ||
|
||
import com.regnosys.rosetta.RosettaEcoreUtil; | ||
import com.regnosys.rosetta.rosetta.simple.Attribute; | ||
import com.regnosys.rosetta.rosetta.simple.Data; | ||
import com.regnosys.rosetta.services.RosettaGrammarAccess; | ||
|
||
public class RosettaContentProposalProvider extends IdeContentProposalProvider { | ||
@Inject | ||
private RosettaGrammarAccess grammarAccess; | ||
@Inject | ||
private RosettaEcoreUtil ecoreUtil; | ||
|
||
@Override | ||
protected void _createProposals(RuleCall ruleCall, ContentAssistContext context, IIdeContentProposalAcceptor acceptor) { | ||
if (context.getCurrentModel() instanceof Attribute && ruleCall.equals(grammarAccess.getAttributeAccess().getRosettaNamedParserRuleCall_1())) { | ||
createProposalsForAttributeName((Attribute) context.getCurrentModel(), context, acceptor); | ||
} | ||
super._createProposals(ruleCall, context, acceptor); | ||
} | ||
|
||
private void createProposalsForAttributeName(Attribute attr, ContentAssistContext context, IIdeContentProposalAcceptor acceptor) { | ||
if (attr.isOverride()) { | ||
EObject container = attr.eContainer(); | ||
if (container instanceof Data) { | ||
Data data = (Data) container; | ||
if (data.getSuperType() != null) { | ||
ecoreUtil.getAllAttributes(data.getSuperType()) | ||
.forEach((superAttr) -> { | ||
ContentAssistEntry proposal = getProposalCreator().createProposal(superAttr.getName(), context); | ||
int priority = getProposalPriorities().getCrossRefPriority(EObjectDescription.create(superAttr.getName(), superAttr), proposal); | ||
acceptor.accept(proposal, priority); | ||
}); | ||
} | ||
} | ||
} | ||
} | ||
} |
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.