• R/O
  • SSH
  • HTTPS

rgss-lib: Commit


Commit MetaInfo

Revisão447 (tree)
Hora2012-07-27 00:12:49
Autoryf30

Mensagem de Log

グラマー作成中

Mudança Sumário

Diff

--- trunk/eclipse/projects/jp.sf.rgsslib.tools.rpgtkool.event.editor.ui/src/jp/sf/rgsslib/tools/rpgtkool/event/editor/ui/contentassist/EventDSLProposalProvider.java (revision 446)
+++ trunk/eclipse/projects/jp.sf.rgsslib.tools.rpgtkool.event.editor.ui/src/jp/sf/rgsslib/tools/rpgtkool/event/editor/ui/contentassist/EventDSLProposalProvider.java (revision 447)
@@ -3,21 +3,11 @@
33 */
44 package jp.sf.rgsslib.tools.rpgtkool.event.editor.ui.contentassist;
55
6-import java.util.ArrayList;
76 import java.util.List;
87
9-import jp.sf.rgsslib.tools.j2rlib.vxace.gamedata.rpg.System;
108 import jp.sf.rgsslib.tools.rgptkool.system.editor.generator.SystemDSLUtils;
11-import jp.sf.rgsslib.tools.rgptkool.system.editor.systemDSL.SystemDSLModel;
12-import jp.sf.rgsslib.tools.rgptkool.system.editor.systemDSL.VariableInfo;
139
14-import org.eclipse.core.resources.IProject;
15-import org.eclipse.core.resources.ResourcesPlugin;
16-import org.eclipse.core.runtime.Path;
17-import org.eclipse.emf.common.util.URI;
1810 import org.eclipse.emf.ecore.EObject;
19-import org.eclipse.emf.ecore.resource.Resource;
20-import org.eclipse.emf.ecore.resource.ResourceSet;
2111 import org.eclipse.jface.text.contentassist.ICompletionProposal;
2212 import org.eclipse.xtext.RuleCall;
2313 import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
@@ -30,50 +20,18 @@
3020 */
3121 public class EventDSLProposalProvider extends AbstractEventDSLProposalProvider {
3222
33- private static final String SYSTEM_DSL_PATH[] = new String[]{"src/system.sysinfo","system.sysinfo"};
34-
35- private SystemDSLModel getSystemDSLModel(ResourceSet resourceSet, String projectName) {
36- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
37- for (String path : SYSTEM_DSL_PATH) {
38- if (project.getFile(new Path(path)).exists()) {
39- URI uri = URI.createPlatformResourceURI(projectName+"/"+path,true);
40- Resource resource = resourceSet.getResource(uri,true);
41- EObject object = resource.getAllContents().next();
42- if (object instanceof SystemDSLModel) {
43- SystemDSLModel dsl = (SystemDSLModel) object;
44- return dsl;
45- }
46- }
23+ private void createVariableProposal(EObject model, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
24+ List<String> l = SystemDSLUtils.getVariables(model.eResource());
25+ for (String s : l) {
26+ String name = '"' + s + '"';
27+ ICompletionProposal proposal = createCompletionProposal(name, name, getImage(model), context);
28+ acceptor.accept(proposal);
4729 }
48- return null;
4930 }
50-
51- private List<String> getVariables(SystemDSLModel dsl, List<String> variables) {
52- for (VariableInfo variableInfo : dsl.getVariable().getVariables()){
53- variables.add(variableInfo.getName());
54- }
55- return variables;
56- }
57- private List<String> getVariables(String projectName, List<String> variables) {
58- System systemData = SystemDSLUtils.getSystemData(projectName);
59- for (String variable : systemData.getVariables()){
60- variables.add(variable);
61- }
62- return variables;
63- }
64-
65- private void createVariableProposal(EObject model, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
66- String projectName = model.eResource().getURI().segment(1);
67- ResourceSet resourceSet = model.eResource().getResourceSet();
68- SystemDSLModel dsl = getSystemDSLModel(resourceSet,projectName);
69- if (dsl == null) {
70- return;
71- }
72- List<String> variables = new ArrayList<String>();
73- getVariables(dsl, variables);
74- getVariables(projectName, variables);
75- for (String variable : variables) {
76- String name = '"' + variable + '"';
31+ private void createSwitchesProposal(EObject model, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
32+ List<String> l = SystemDSLUtils.getSwitches(model.eResource());
33+ for (String s : l) {
34+ String name = '"' + s + '"';
7735 ICompletionProposal proposal = createCompletionProposal(name, name, getImage(model), context);
7836 acceptor.accept(proposal);
7937 }
@@ -82,7 +40,6 @@
8240 @Override
8341 public void complete_EventCommandMessage(EObject model, RuleCall ruleCall, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
8442 super.complete_EventCommandMessage(model, ruleCall, context, acceptor);
85- acceptor.accept(createCompletionProposal("test", "Test", getImage(model), context));
8643 }
8744
8845 @Override
@@ -91,5 +48,12 @@
9148 super.complete_VariableReference(model, ruleCall, context, acceptor);
9249 createVariableProposal(model, context, acceptor);
9350 }
51+
52+ @Override
53+ public void complete_SwitchReference(EObject model, RuleCall ruleCall,
54+ ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
55+ super.complete_SwitchReference(model, ruleCall, context, acceptor);
56+ createSwitchesProposal(model, context, acceptor);
57+ }
9458
9559 }
--- trunk/eclipse/projects/jp.sf.rgsslib.tools.rpgtkool.event.editor/src/jp/sf/rgsslib/tools/rpgtkool/event/editor/generator/MoveRouteCommandKeyword.java (revision 446)
+++ trunk/eclipse/projects/jp.sf.rgsslib.tools.rpgtkool.event.editor/src/jp/sf/rgsslib/tools/rpgtkool/event/editor/generator/MoveRouteCommandKeyword.java (revision 447)
@@ -1,7 +1,7 @@
11 package jp.sf.rgsslib.tools.rpgtkool.event.editor.generator;
22
33 public enum MoveRouteCommandKeyword {
4- ROUTE_END (0, 0, "◇"),
4+ ROUTE_END (0, 1, "◇"),
55 ROUTE_MOVE_DOWN (1, 49, "◇下に移動"),
66 ROUTE_MOVE_LEFT (2, 48, "◇左に移動"),
77 ROUTE_MOVE_RIGHT (3, 47, "◇右に移動"),
@@ -28,20 +28,20 @@
2828 ROUTE_TURN_RANDOM (24, 26, "◇ランダムに方向転換"),
2929 ROUTE_TURN_TOWARD (25, 25, "◇プレイヤーの方を向く"),
3030 ROUTE_TURN_AWAY (26, 24, "◇プレイヤーの逆を向く"),
31- ROUTE_SWITCH_ON (27, 23, "◇スイッチON"),
32- ROUTE_SWITCH_OFF (28, 22, "◇スイッチOFF"),
31+ ROUTE_SWITCH_ON (27, 23, "◇スイッチ"),
32+ ROUTE_SWITCH_OFF (28, 22, "◇スイッチ"),
3333 ROUTE_CHANGE_SPEED (29, 21, "◇移動速度の変更"),
3434 ROUTE_CHANGE_FREQ (30, 20, "◇移動頻度の変更"),
35- ROUTE_WALK_ANIME_ON (31, 19, "◇歩行アニメON"),
36- ROUTE_WALK_ANIME_OFF (32, 18, "◇歩行アニメOFF"),
37- ROUTE_STEP_ANIME_ON (33, 17, "◇足踏みアニメON"),
38- ROUTE_STEP_ANIME_OFF (34, 16, "◇足踏みアニメOFF"),
39- ROUTE_DIR_FIX_ON (35, 15, "◇向き固定ON"),
40- ROUTE_DIR_FIX_OFF (36, 14, "◇向き固定OFF"),
41- ROUTE_THROUGH_ON (37, 13, "◇すり抜けON"),
42- ROUTE_THROUGH_OFF (38, 12, "◇すり抜けOFF"),
43- ROUTE_TRANSPARENT_ON (39, 11, "◇透明化ON"),
44- ROUTE_TRANSPARENT_OFF (40, 10, "◇透明化OFF"),
35+ ROUTE_WALK_ANIME_ON (31, 19, "◇歩行アニメ"),
36+ ROUTE_WALK_ANIME_OFF (32, 18, "◇歩行アニメ"),
37+ ROUTE_STEP_ANIME_ON (33, 17, "◇足踏みアニメ"),
38+ ROUTE_STEP_ANIME_OFF (34, 16, "◇足踏みアニメ"),
39+ ROUTE_DIR_FIX_ON (35, 15, "◇向き固定"),
40+ ROUTE_DIR_FIX_OFF (36, 14, "◇向き固定"),
41+ ROUTE_THROUGH_ON (37, 13, "◇すり抜け"),
42+ ROUTE_THROUGH_OFF (38, 12, "◇すり抜け"),
43+ ROUTE_TRANSPARENT_ON (39, 11, "◇透明化"),
44+ ROUTE_TRANSPARENT_OFF (40, 10, "◇透明化"),
4545 ROUTE_CHANGE_GRAPHIC (41, 9, "◇グラフィック変更"),
4646 ROUTE_CHANGE_OPACITY (42, 8, "◇不透明度の変更"),
4747 ROUTE_CHANGE_BLENDING (43, 7, "◇合成方法の変更"),
--- trunk/eclipse/projects/jp.sf.rgsslib.tools.rgptkool.system.editor/src/jp/sf/rgsslib/tools/rgptkool/system/editor/generator/SystemDSLUtils.java (revision 446)
+++ trunk/eclipse/projects/jp.sf.rgsslib.tools.rgptkool.system.editor/src/jp/sf/rgsslib/tools/rgptkool/system/editor/generator/SystemDSLUtils.java (revision 447)
@@ -2,27 +2,42 @@
22
33 import java.io.FileInputStream;
44 import java.io.IOException;
5+import java.util.ArrayList;
6+import java.util.List;
57
8+import jp.fs.rgsslib.tools.rpgtkool.common.CommonUtils;
69 import jp.sf.rgsslib.tools.j2rlib.vxace.RGSSProxyFacade;
710 import jp.sf.rgsslib.tools.j2rlib.vxace.gamedata.rpg.System;
11+import jp.sf.rgsslib.tools.rgptkool.system.editor.systemDSL.SwitchInfo;
12+import jp.sf.rgsslib.tools.rgptkool.system.editor.systemDSL.SystemDSLModel;
13+import jp.sf.rgsslib.tools.rgptkool.system.editor.systemDSL.VariableInfo;
814
915 import org.eclipse.core.resources.IProject;
1016 import org.eclipse.core.resources.ResourcesPlugin;
17+import org.eclipse.emf.ecore.EObject;
18+import org.eclipse.emf.ecore.resource.Resource;
1119
1220 public class SystemDSLUtils {
1321 public static final String SYSTEM_RVDATA2 = "System.rvdata2";
1422 public static final String SYSTEM_DATA[] = new String[] {
1523 "Data/" + SYSTEM_RVDATA2, SYSTEM_RVDATA2 };
16-
1724
18- public static jp.sf.rgsslib.tools.j2rlib.vxace.gamedata.rpg.System getSystemData(String projectName) {
25+ /**
26+ * システムデータ.
27+ *
28+ * @param projectName
29+ * @return
30+ */
31+ public static System getSystemData(String projectName) {
1932 RGSSProxyFacade proxyFacade = RGSSProxyFacade.getInstance();
20- IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(projectName);
21- for (String file: SYSTEM_DATA) {
33+ IProject project = ResourcesPlugin.getWorkspace().getRoot()
34+ .getProject(projectName);
35+ for (String file : SYSTEM_DATA) {
2236 if (project.getFile(file).exists()) {
2337 FileInputStream in;
2438 try {
25- in = new FileInputStream(project.getFile(file).getLocation().toFile());
39+ in = new FileInputStream(project.getFile(file)
40+ .getLocation().toFile());
2641 return (System) proxyFacade.load(in);
2742 } catch (IOException e) {
2843 e.printStackTrace();
@@ -31,4 +46,76 @@
3146 }
3247 return proxyFacade.createSystem();
3348 }
49+
50+ // 変数の情報
51+ private static List<String> getVariables(SystemDSLModel dsl,
52+ List<String> variables) {
53+ for (VariableInfo variableInfo : dsl.getVariable().getVariables()) {
54+ if (variableInfo.getName() != null)
55+ variables.add(variableInfo.getName());
56+ }
57+ return variables;
58+ }
59+
60+ private static List<String> getVariables(System systemData,
61+ List<String> variables) {
62+ for (String variable : systemData.getVariables()) {
63+ if (variable != null)
64+ variables.add(variable);
65+ }
66+ return variables;
67+ }
68+
69+ public static List<String> getVariables(Resource resource) {
70+ List<String> variables = new ArrayList<String>();
71+
72+ EObject object = CommonUtils.getSystemDSLModel(resource);
73+ if (object instanceof SystemDSLModel) {
74+ getVariables((SystemDSLModel) object, variables);
75+ }
76+
77+ if (resource.getURI().segmentCount() > 1) {
78+ String projectName = resource.getURI().segment(1);
79+ if (projectName != null) {
80+ getVariables(getSystemData(projectName), variables);
81+ }
82+ }
83+ return variables;
84+ }
85+
86+ // スイッチの情報
87+ private static List<String> getSwitches(SystemDSLModel dsl,
88+ List<String> switches) {
89+ for (SwitchInfo switchInfo : dsl.getSwitch().getSwitches()) {
90+ if (switchInfo.getName() != null)
91+ switches.add(switchInfo.getName());
92+ }
93+ return switches;
94+ }
95+
96+ private static List<String> getSwitches(System systemData,
97+ List<String> switches) {
98+ for (String _switch : systemData.getSwitches()) {
99+ if (_switch != null)
100+ switches.add(_switch);
101+ }
102+ return switches;
103+ }
104+
105+ public static List<String> getSwitches(Resource resource) {
106+ List<String> switches = new ArrayList<String>();
107+
108+ EObject object = CommonUtils.getSystemDSLModel(resource);
109+ if (object instanceof SystemDSLModel) {
110+ getSwitches((SystemDSLModel) object, switches);
111+ }
112+
113+ if (resource.getURI().segmentCount() > 1) {
114+ String projectName = resource.getURI().segment(1);
115+ if (projectName != null) {
116+ getSwitches(getSystemData(projectName), switches);
117+ }
118+ }
119+ return switches;
120+ }
34121 }
Show on old repository browser