- Timestamp:
- 10/18/15 23:05:09 (9 years ago)
- Location:
- java/Framclipse
- Files:
-
- 1 added
- 3 deleted
- 12 edited
Legend:
- Unmodified
- Added
- Removed
-
java/Framclipse/com.framsticks.framclipse.ui/META-INF/MANIFEST.MF
r437 r438 17 17 Bundle-RequiredExecutionEnvironment: JavaSE-1.6 18 18 Export-Package: com.framsticks.framclipse.ui.contentassist, 19 com.framsticks.framclipse.ui.contentassist.antlr 19 com.framsticks.framclipse.ui.contentassist.antlr, 20 com.framsticks.framclipse.ui.quickfix 20 21 Bundle-Activator: com.framsticks.framclipse.ui.internal.FramScriptActivator -
java/Framclipse/com.framsticks.framclipse.ui/src/com/framsticks/framclipse/ui/FramScriptSourceViewerConfiguration.java
r437 r438 12 12 import org.eclipse.jface.text.source.ISourceViewer; 13 13 import org.eclipse.swt.widgets.Shell; 14 import org.eclipse.xtext.parsetree.AbstractNode; 15 import org.eclipse.xtext.parsetree.CompositeNode; 16 import org.eclipse.xtext.parsetree.NodeUtil; 17 import org.eclipse.xtext.parsetree.ParseTreeUtil; 14 import org.eclipse.xtext.nodemodel.ICompositeNode; 15 import org.eclipse.xtext.nodemodel.ILeafNode; 16 import org.eclipse.xtext.nodemodel.util.NodeModelUtils; 18 17 import org.eclipse.xtext.resource.XtextResource; 19 18 import org.eclipse.xtext.ui.editor.XtextSourceViewerConfiguration; … … 62 61 @Override 63 62 public String exec(XtextResource state) throws Exception { 64 CompositeNode root = state.getParseResult().getRootNode(); 65 AbstractNode current = ParseTreeUtil.getCurrentOrFollowingNodeByOffset(root, offset); 66 EObject semantic = NodeUtil.getNearestSemanticObject(current); 63 ICompositeNode root = state.getParseResult().getRootNode(); 64 // AbstractNode current = ParseTreeUtil.getCurrentOrFollowingNodeByOffset(root, offset); 65 ILeafNode current = NodeModelUtils.findLeafNodeAtOffset(root, offset); 66 // EObject semantic = NodeUtil.getNearestSemanticObject(current); 67 EObject semantic = current.getSemanticElement(); 67 68 68 69 if (semantic instanceof QualifiedExpression) { -
java/Framclipse/com.framsticks.framclipse.ui/src/com/framsticks/framclipse/ui/contentassist/FramScriptProposalProvider.java
r437 r438 35 35 36 36 protected FramScriptProposalCreator(ContentAssistContext contentAssistContext, String ruleName) { 37 super(contentAssistContext, ruleName );37 super(contentAssistContext, ruleName, getQualifiedNameConverter()); 38 38 this.cac = contentAssistContext; 39 39 } -
java/Framclipse/com.framsticks.framclipse/META-INF/MANIFEST.MF
r437 r438 14 14 org.eclipse.emf.mwe2.launch;resolution:=optional, 15 15 com.ibm.icu;resolution:=optional, 16 org.eclipse.xtext.xtend;resolution:=optional,17 16 org.eclipse.xtext.util, 18 17 org.eclipse.emf.ecore, 19 18 org.eclipse.emf.common, 20 19 org.antlr.runtime, 21 org.eclipse.core.runtime 20 org.eclipse.core.runtime, 21 org.eclipse.xtext.xbase.lib 22 22 Import-Package: org.apache.log4j 23 23 Bundle-RequiredExecutionEnvironment: JavaSE-1.6 24 24 Export-Package: com.framsticks.framclipse, 25 com.framsticks.framclipse.formatting, 25 26 com.framsticks.framclipse.framScript, 26 27 com.framsticks.framclipse.framScript.impl, 27 28 com.framsticks.framclipse.framScript.util, 28 com.framsticks.framclipse.parseTreeConstruction,29 29 com.framsticks.framclipse.parser.antlr, 30 30 com.framsticks.framclipse.parser.antlr.internal, 31 com.framsticks.framclipse.scoping, 31 32 com.framsticks.framclipse.script, 32 33 com.framsticks.framclipse.script.model, 34 com.framsticks.framclipse.serializer, 33 35 com.framsticks.framclipse.services, 34 36 com.framsticks.framclipse.validation 35 Bundle-ClassPath: lib/commons-io-1.4.jar, 36 lib/xpp3_min-1.1.4c.jar, 37 lib/xstream-1.3.1.jar, 38 . 37 Bundle-ClassPath: lib/commons-io-1.4.jar,lib/xpp3_min-1.1.4c.jar,lib/xstream-1.3.1.jar,. -
java/Framclipse/com.framsticks.framclipse/build.properties
r437 r438 2 2 res/,\ 3 3 src-gen/ 4 bin.includes = META-INF/,\ 4 bin.includes = model/,\ 5 META-INF/,\ 5 6 plugin.xml,\ 6 7 lib/commons-io-1.4.jar,\ -
java/Framclipse/com.framsticks.framclipse/plugin.xml
r437 r438 8 8 uri = "http://www.framsticks.com/framclipse/FramScript" 9 9 class = "com.framsticks.framclipse.framScript.FramScriptPackage" 10 genModel = " com/framsticks/framclipse/FramScript.genmodel" />10 genModel = "model/generated/FramScript.genmodel" /> 11 11 12 12 </extension> -
java/Framclipse/com.framsticks.framclipse/src/com/framsticks/framclipse/FramScriptValueConverterService.java
r437 r438 6 6 import org.eclipse.xtext.conversion.ValueConverterException; 7 7 import org.eclipse.xtext.conversion.impl.AbstractToStringConverter; 8 import org.eclipse.xtext. parsetree.AbstractNode;8 import org.eclipse.xtext.nodemodel.INode; 9 9 10 10 public class FramScriptValueConverterService extends DefaultTerminalConverters { … … 16 16 17 17 @Override 18 protected String internalToValue(String s, AbstractNode node)18 protected String internalToValue(String s, INode node) 19 19 throws ValueConverterException { 20 20 if (s.startsWith(":~")) { -
java/Framclipse/com.framsticks.framclipse/src/com/framsticks/framclipse/GenerateFramScript.mwe2
r437 r438 6 6 7 7 var grammarURI = "classpath:/com/framsticks/framclipse/FramScript.xtext" 8 var file .extensions = "neuro, expdef, style, show, script, inc"8 var fileExtensions = "neuro, expdef, style, show, script, inc" 9 9 var projectName = "com.framsticks.framclipse" 10 10 var runtimeProject = "../${projectName}" 11 //var generateXtendStub = true 12 var encoding = "UTF-8" 11 13 12 14 Workflow { 13 15 bean = StandaloneSetup { 16 scanClassPath = true 14 17 platformUri = "${runtimeProject}/.." 18 // The following two lines can be removed, if Xbase is not used. 19 // registerGeneratedEPackage = "org.eclipse.xtext.xbase.XbasePackage" 20 // registerGenModelFile = "platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel" 15 21 } 16 22 … … 20 26 21 27 component = DirectoryCleaner { 28 directory = "${runtimeProject}/model/generated" 29 } 30 31 component = DirectoryCleaner { 22 32 directory = "${runtimeProject}.ui/src-gen" 23 33 } 24 34 /* 35 component = DirectoryCleaner { 36 directory = "${runtimeProject}.tests/src-gen" 37 } 38 */ 25 39 component = Generator { 26 40 pathRtProject = runtimeProject 27 41 pathUiProject = "${runtimeProject}.ui" 42 // pathTestProject = "${runtimeProject}.tests" 28 43 projectNameRt = projectName 29 44 projectNameUi = "${projectName}.ui" 30 31 language = {45 encoding = encoding 46 language = auto-inject { 32 47 uri = grammarURI 33 fileExtensions = file.extensions34 48 35 49 // Java API to access grammar elements (required by several other fragments) 36 fragment = grammarAccess.GrammarAccessFragment {}50 fragment = grammarAccess.GrammarAccessFragment auto-inject {} 37 51 38 // generates Java API for the generated EPackages 39 fragment = ecore.EcoreGeneratorFragment { 52 // generates Java API for the generated EPackages 53 fragment = ecore.EMFGeneratorFragment auto-inject {} 54 /* fragment = ecore.EcoreGeneratorFragment { 40 55 // referencedGenModels = "uri to genmodel, uri to next genmodel" 41 56 } 57 */ 42 58 43 // the serialization component44 fragment = parseTreeConstructor.ParseTreeConstructorFragment {}59 // the old serialization component 60 // fragment = parseTreeConstructor.ParseTreeConstructorFragment auto-inject {} 45 61 46 // a custom ResourceFactory for use with EMF 47 fragment = resourceFactory.ResourceFactoryFragment { 48 fileExtensions = file.extensions 49 } 50 51 // the following fragment tries to use the Antlr Generator fragment which can be installed via update manager from http://download.itemis.com/updates/ 52 fragment = AntlrDelegatingFragment {} 53 54 // java-based API for validation 55 fragment = validation.JavaValidatorFragment { 56 composedCheck = "org.eclipse.xtext.validation.ImportUriValidator" 57 composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" 58 // registerForImportedPackages = true 59 } 60 61 // scoping and exporting API 62 /* 63 fragment = scoping.ImportURIScopingFragment {} 64 fragment = exporting.SimpleNamesFragment {} 65 */ 66 67 // scoping and exporting API 68 fragment = scoping.ImportURIScopingFragment {} 69 fragment = exporting.QualifiedNamesFragment {} 70 71 // formatter API 72 fragment = formatting.FormatterFragment {} 73 74 // labeling API 75 fragment = labeling.LabelProviderFragment {} 76 77 // outline API 78 fragment = outline.TransformerFragment {} 79 fragment = outline.OutlineNodeAdapterFactoryFragment {} 80 fragment = outline.QuickOutlineFragment {} 81 82 // java-based API for content assistance 83 fragment = contentAssist.JavaBasedContentAssistFragment {} 84 85 // the following fragment tries to use the Antlr based content assist 86 // fragment which can be downloaded from http://www.itemis.com 87 // and will be ignored if it's not available. 88 fragment = DelegatingGeneratorFragment { 89 delegate = "de.itemis.xtext.antlr.XtextAntlrUiGeneratorFragment" 90 message="You are generating without ANTLR. It is highly recommended to download and use the plugin \'de.itemis.xtext.antlr\' \n\t using the update site http:\//download.itemis.com/updates/." 62 // serializer 2.0 63 fragment = serializer.SerializerFragment auto-inject { 64 generateStub = false 91 65 } 92 66 93 fragment = builder.BuilderIntegrationFragment {} 67 // a custom ResourceFactory for use with EMF 68 fragment = resourceFactory.ResourceFactoryFragment auto-inject {} 69 70 // The antlr parser generator fragment. 71 fragment = parser.antlr.XtextAntlrGeneratorFragment auto-inject { 72 // options = { 73 // backtrack = true 74 // } 75 } 76 /* 77 // Xtend-based API for validation 78 fragment = validation.ValidatorFragment auto-inject { 79 */ 80 // Java-based API for validation 81 fragment = validation.JavaValidatorFragment auto-inject { 82 // composedCheck = "org.eclipse.xtext.validation.ImportUriValidator" 83 // composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator" 84 } 94 85 95 // project wizard (optional) 96 /* 97 fragment = projectWizard.SimpleProjectWizardFragment { 98 generatorProjectName = "${projectName}.generator" 99 modelFileExtension = file.extensions 100 } 101 */ 86 // old scoping and exporting API 87 fragment = scoping.ImportURIScopingFragment auto-inject {} 88 fragment = exporting.SimpleNamesFragment auto-inject {} 89 90 // scoping and exporting API 91 // fragment = scoping.ImportNamespacesScopingFragment auto-inject {} 92 // fragment = exporting.QualifiedNamesFragment auto-inject {} 93 // fragment = builder.BuilderIntegrationFragment auto-inject {} 94 95 // generator API 96 // fragment = generator.GeneratorFragment auto-inject {} 102 97 103 // quickfix API 104 fragment = quickfix.QuickfixProviderFragment {} 98 // formatter API 99 fragment = formatting.FormatterFragment auto-inject {} 100 101 // labeling API 102 fragment = labeling.LabelProviderFragment auto-inject {} 103 104 // outline API 105 // fragment = outline.TransformerFragment {} 106 // fragment = outline.OutlineNodeAdapterFactoryFragment {} 107 fragment = outline.OutlineTreeProviderFragment auto-inject {} 108 fragment = outline.QuickOutlineFragment auto-inject {} 109 110 // java-based API for content assistance 111 fragment = contentAssist.JavaBasedContentAssistFragment {} 112 /* 113 // content assist API 114 fragment = contentAssist.ContentAssistFragment auto-inject {} 115 */ 116 // generates a more lightweight Antlr parser and lexer tailored for content assist 117 fragment = parser.antlr.XtextAntlrUiGeneratorFragment auto-inject {} 118 /* 119 // generates junit test support classes into Generator#pathTestProject 120 fragment = junit.Junit4Fragment auto-inject {} 121 122 // rename refactoring 123 fragment = refactoring.RefactorElementNameFragment auto-inject {} 124 125 // provides the necessary bindings for java types integration 126 fragment = types.TypesGeneratorFragment auto-inject {} 127 128 // generates the required bindings only if the grammar inherits from Xbase 129 fragment = xbase.XbaseGeneratorFragment auto-inject {} 130 131 // generates the required bindings only if the grammar inherits from Xtype 132 fragment = xbase.XtypeGeneratorFragment auto-inject {} 133 134 // provides a preference page for template proposals 135 fragment = templates.CodetemplatesGeneratorFragment auto-inject {} 136 137 // provides a compare view 138 fragment = compare.CompareFragment auto-inject {} 139 */ 140 // quickfix API 141 fragment = quickfix.QuickfixProviderFragment auto-inject {} 105 142 } 106 143 } -
java/Framclipse/com.framsticks.framclipse/src/com/framsticks/framclipse/resource/FramScriptResourceDescription.java
r437 r438 5 5 import org.eclipse.emf.ecore.EObject; 6 6 import org.eclipse.emf.ecore.resource.Resource; 7 import org.eclipse.xtext. naming.IQualifiedNameProvider;7 import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy; 8 8 import org.eclipse.xtext.resource.IEObjectDescription; 9 9 import org.eclipse.xtext.resource.impl.DefaultResourceDescription; … … 20 20 21 21 public FramScriptResourceDescription(Resource resource, 22 I QualifiedNameProvider nameProvider) {23 super(resource, nameProvider);22 IDefaultResourceDescriptionStrategy resourceDescriptionStrategy) { 23 super(resource, resourceDescriptionStrategy); 24 24 } 25 25 -
java/Framclipse/com.framsticks.framclipse/src/com/framsticks/framclipse/resource/FramScriptResourceDescriptionManager.java
r437 r438 2 2 3 3 import org.eclipse.emf.ecore.resource.Resource; 4 import org.eclipse.xtext.resource.IDefaultResourceDescriptionStrategy; 4 5 import org.eclipse.xtext.resource.IResourceDescription; 5 6 import org.eclipse.xtext.resource.impl.DefaultResourceDescriptionManager; 6 7 import com.google.inject.Inject; 7 8 import com.google.inject.Provider; 8 9 9 10 public class FramScriptResourceDescriptionManager extends 10 11 DefaultResourceDescriptionManager { 12 13 @Inject 14 private IDefaultResourceDescriptionStrategy strategy; 11 15 12 16 private static final String CACHE_KEY = FramScriptResourceDescriptionManager.class.getName() + "#getResourceDescription"; … … 15 19 return getCache().get(CACHE_KEY, resource, new Provider<IResourceDescription>(){ 16 20 public IResourceDescription get() { 17 return new FramScriptResourceDescription(resource, getNameProvider());21 return new FramScriptResourceDescription(resource, strategy); 18 22 }}); 19 23 } -
java/Framclipse/com.framsticks.framclipse/src/com/framsticks/framclipse/scoping/FramScriptScopeProvider.java
r437 r438 134 134 private IScope filterByArgumentsCount(IScope scope, int size) { 135 135 List<IEObjectDescription> filtered = Lists.newArrayList(); 136 for (IEObjectDescription desc : scope.get Contents()) {136 for (IEObjectDescription desc : scope.getAllElements()) { 137 137 Function function = (Function) desc.getEObjectOrProxy(); 138 138 if (function.getParams().size() == size) { … … 140 140 } 141 141 } 142 return new SimpleScope( scope.getOuterScope(),filtered);142 return new SimpleScope(filtered); 143 143 } 144 144 145 145 private IScope addAliases(IScope scope) { 146 Iterable<IEObjectDescription> contents = scope.get Contents();146 Iterable<IEObjectDescription> contents = scope.getAllElements(); 147 147 List<IEObjectDescription> withAliases = Lists.newArrayList(contents); 148 148 for (IEObjectDescription desc : contents) { … … 152 152 } 153 153 } 154 return new SimpleScope( scope.getOuterScope(),withAliases);154 return new SimpleScope(withAliases); 155 155 } 156 156 … … 195 195 196 196 protected IScope scope_VariableRef_var(Model model, EReference ref) { 197 IScope outerScope = delegateGetScope(model, ref).getOuterScope();197 // IScope outerScope = delegateGetScope(model, ref).getOuterScope(); 198 198 IScope types = typesScopes.get(getExtension(model)); 199 return new SimpleScope( outerScope, types.getContents());199 return new SimpleScope(types.getAllElements()); 200 200 } 201 201 -
java/Framclipse/com.framsticks.framclipse/src/com/framsticks/framclipse/script/XMLConstantProvider.java
r437 r438 7 7 import java.util.Map; 8 8 9 import org.antlr.misc.MultiMap; 9 10 import org.apache.commons.io.IOUtils; 10 11 import org.eclipse.core.runtime.ILog; … … 20 21 import com.framsticks.framclipse.script.model.Type; 21 22 import com.google.common.collect.Maps; 22 import com.google.common.collect.Multimap;23 import com.google.common.collect.Multimaps;24 23 import com.google.inject.Inject; 25 24 import com.thoughtworks.xstream.XStream; … … 68 67 private Map<String, Map<String, Type>> createTypeMappings(Framscontext framscontext, Framscript framscript) { 69 68 Map<String, Map<String, Type>> types = Maps.newHashMap(); 70 Multi map<String, String> ext2ctx = ext2Ctx(framscontext);71 Multi map<String, Type> ctx2type = ctx2Type(framscript);69 MultiMap<String, String> ext2ctx = ext2Ctx(framscontext); 70 MultiMap<String, Type> ctx2type = ctx2Type(framscript); 72 71 for (String ext : ext2ctx.keySet()) { 73 72 HashMap<String, Type> map = new HashMap<String, Type>(); … … 82 81 } 83 82 84 private Multi map<String, String> ext2Ctx(Framscontext framscontext) {85 Multi map<String, String> ext2ctx = Multimaps.newHashMultimap();83 private MultiMap<String, String> ext2Ctx(Framscontext framscontext) { 84 MultiMap<String, String> ext2ctx = new MultiMap<String, String>(); 86 85 for (File file : framscontext.getFiles()) { 87 86 String ext = file.getPattern(); … … 89 88 if (file.getCode() != null) { 90 89 for (Context context : file.getCode().getContexts()) { 91 ext2ctx. put(ext, context.getName());90 ext2ctx.map(ext, context.getName()); 92 91 } 93 92 } … … 96 95 } 97 96 98 private Multi map<String, Type> ctx2Type(Framscript framscript) {99 Multi map<String, Type> ctx2type = Multimaps.newHashMultimap();97 private MultiMap<String, Type> ctx2Type(Framscript framscript) { 98 MultiMap<String, Type> ctx2type = new MultiMap<String, Type>(); 100 99 for (Type type : framscript.getTypes()) { 101 ctx2type. put(type.getContext(), type);100 ctx2type.map(type.getContext(), type); 102 101 } 103 102 return ctx2type;
Note: See TracChangeset
for help on using the changeset viewer.