Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
White Collar
BAPIDE
Commits
d0f6efe2
Commit
d0f6efe2
authored
Mar 26, 2025
by
王业明
Browse files
BAPIDE生成的python代码,需要能同时支持python2和python3的
parent
f155fcbc
Changes
5
Show whitespace changes
Inline
Side-by-side
cn.com.bankit.ide.bap.compile/src/cn/com/bankit/ide/bap/compile/cgc/CGC.java
View file @
d0f6efe2
...
@@ -33,6 +33,7 @@ import cn.com.bankit.ide.bap.compile.cgc.gen.CodeGen;
...
@@ -33,6 +33,7 @@ import cn.com.bankit.ide.bap.compile.cgc.gen.CodeGen;
import
cn.com.bankit.ide.bap.constants.IBapConstants
;
import
cn.com.bankit.ide.bap.constants.IBapConstants
;
import
cn.com.bankit.ide.bap.constants.INavigatorConstants
;
import
cn.com.bankit.ide.bap.constants.INavigatorConstants
;
import
cn.com.bankit.ide.bap.constants.IWorkflowConstants
;
import
cn.com.bankit.ide.bap.constants.IWorkflowConstants
;
import
cn.com.bankit.ide.bap.preferences.BapPreActivator
;
import
cn.com.bankit.ide.bap.util.file.BapConsole
;
import
cn.com.bankit.ide.bap.util.file.BapConsole
;
import
cn.com.bankit.ide.toolkit.file.CastorTools
;
import
cn.com.bankit.ide.toolkit.file.CastorTools
;
import
cn.com.bankit.ide.toolkit.file.FileUtil
;
import
cn.com.bankit.ide.toolkit.file.FileUtil
;
...
@@ -109,7 +110,9 @@ public class CGC extends BapCompile
...
@@ -109,7 +110,9 @@ public class CGC extends BapCompile
File
objdir
=
((
IFolder
)
wfFile
.
getParent
()).
getFolder
(
INavigatorConstants
.
NV_NODE_RESCPL
).
getLocation
()
File
objdir
=
((
IFolder
)
wfFile
.
getParent
()).
getFolder
(
INavigatorConstants
.
NV_NODE_RESCPL
).
getLocation
()
.
toFile
();
.
toFile
();
File
pyFile
=
new
File
(
objdir
,
"T"
+
name
.
replace
(
IWorkflowConstants
.
WF_FILE_SUFFIX
,
"py"
));
File
pyFile
=
new
File
(
objdir
,
"T"
+
name
.
replace
(
IWorkflowConstants
.
WF_FILE_SUFFIX
,
"py"
));
FileUtil
.
createFile
(
pyFile
,
content
,
IBapConstants
.
ENCODING_GBK
);
String
cgcVer
=
BapPreActivator
.
getDefault
().
getPreferenceStore
().
getString
(
IBapConstants
.
BAP_PREF_CPL_CGC_VER
);
FileUtil
.
createFile
(
pyFile
,
content
,
IBapConstants
.
BAP_PREF_CPL_CGC_VER_V1_0_0
.
equals
(
cgcVer
)
?
IBapConstants
.
ENCODING_GBK
:
IBapConstants
.
ENCODING_UTF_8
);
isError
=
false
;
isError
=
false
;
}
}
...
...
cn.com.bankit.ide.bap.compile/src/cn/com/bankit/ide/bap/compile/cgc/template/TemplateUtil.java
View file @
d0f6efe2
...
@@ -28,7 +28,7 @@ import java.util.Locale;
...
@@ -28,7 +28,7 @@ import java.util.Locale;
import
java.util.Map
;
import
java.util.Map
;
import
cn.com.bankit.ide.bap.constants.IBapConstants
;
import
cn.com.bankit.ide.bap.constants.IBapConstants
;
import
cn.com.bankit.ide.bap.preferences.BapPreActivator
;
import
freemarker.template.Configuration
;
import
freemarker.template.Configuration
;
import
freemarker.template.Template
;
import
freemarker.template.Template
;
import
freemarker.template.TemplateException
;
import
freemarker.template.TemplateException
;
...
@@ -42,7 +42,12 @@ public class TemplateUtil
...
@@ -42,7 +42,12 @@ public class TemplateUtil
{
{
Configuration
cfg
=
new
Configuration
();
Configuration
cfg
=
new
Configuration
();
// cfg.setClassForTemplateLoading(TemplateUtil.class, "/cgc_v1");
// cfg.setClassForTemplateLoading(TemplateUtil.class, "/cgc_v1");
cfg
.
setClassForTemplateLoading
(
TemplateUtil
.
class
,
"/cgc_v3"
);
String
cgcVer
=
BapPreActivator
.
getDefault
().
getPreferenceStore
().
getString
(
IBapConstants
.
BAP_PREF_CPL_CGC_VER
);
String
pathPrefix
=
"/cgc_v3"
;
if
(
IBapConstants
.
BAP_PREF_CPL_CGC_VER_V3_PY3
.
equals
(
cgcVer
)){
pathPrefix
=
"/cgc_v3_py3"
;
}
cfg
.
setClassForTemplateLoading
(
TemplateUtil
.
class
,
pathPrefix
);
cfg
.
setEncoding
(
Locale
.
getDefault
(),
IBapConstants
.
ENCODING_UTF_8
);
cfg
.
setEncoding
(
Locale
.
getDefault
(),
IBapConstants
.
ENCODING_UTF_8
);
Template
temp
=
cfg
.
getTemplate
(
templateName
);
Template
temp
=
cfg
.
getTemplate
(
templateName
);
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
ByteArrayOutputStream
bos
=
new
ByteArrayOutputStream
();
...
...
cn.com.bankit.ide.bap.constants/plugin_zh_CN.properties
View file @
d0f6efe2
...
@@ -227,6 +227,7 @@ bap.pref.cpl.type.cgc=CGC
...
@@ -227,6 +227,7 @@ bap.pref.cpl.type.cgc=CGC
bap.pref.cpl.type.bapc
=
BAPC
bap.pref.cpl.type.bapc
=
BAPC
bap.pref.cpl.cgc.version
=
CGC
\u
4f7f
\u7528\u7248\u
672c:
bap.pref.cpl.cgc.version
=
CGC
\u
4f7f
\u7528\u7248\u
672c:
bap.pref.cpl.cgc.version.v1_0_0
=
V1.0.0
bap.pref.cpl.cgc.version.v1_0_0
=
V1.0.0
bap.pref.cpl.cgc.version.v3_py3
=
V3-PY3
bap.pref.cpl.bamc.version
=
\u
4f7f
\u7528
BAPC
\u
4f5c
\u
4e3a
\u
7f16
\u
8bd1
\u5668
bap.pref.cpl.bamc.version
=
\u
4f7f
\u7528
BAPC
\u
4f5c
\u
4e3a
\u
7f16
\u
8bd1
\u5668
bap.pref.cpl.bapc.use.alias
=
\u
4f7f
\u7528\u8282\u
70b9
\u
522b
\u
540d
\u
505a
\u
4e3a
\u
7f16
\u
8bd1
\u
540epy
\u
51fd
\u6570\u7684\u
529f
\u
80fd
\u
8bf4
\u
660e
bap.pref.cpl.bapc.use.alias
=
\u
4f7f
\u7528\u8282\u
70b9
\u
522b
\u
540d
\u
505a
\u
4e3a
\u
7f16
\u
8bd1
\u
540epy
\u
51fd
\u6570\u7684\u
529f
\u
80fd
\u
8bf4
\u
660e
bap.pref.cpl.xml.file.remove
=
\u5220\u9664\u
7f16
\u
8bd1XML
\u6587\u
4ef6
bap.pref.cpl.xml.file.remove
=
\u5220\u9664\u
7f16
\u
8bd1XML
\u6587\u
4ef6
...
...
cn.com.bankit.ide.bap.constants/src/cn/com/bankit/ide/bap/constants/BapResource.java
View file @
d0f6efe2
...
@@ -410,6 +410,10 @@ public class BapResource
...
@@ -410,6 +410,10 @@ public class BapResource
//v1.0.0版本
//v1.0.0版本
public
static
final
String
BAP_PREF_CPL_CGC_VER_V1_0_0
=
"bap.pref.cpl.cgc.version.v1_0_0"
;
public
static
final
String
BAP_PREF_CPL_CGC_VER_V1_0_0
=
"bap.pref.cpl.cgc.version.v1_0_0"
;
public
static
final
String
BAP_PREF_CPL_CGC_VER_V3_0_0
=
"bap.pref.cpl.cgc.version.v3_0_0"
;
public
static
final
String
BAP_PREF_CPL_CGC_VER_V3_PY3
=
"bap.pref.cpl.cgc.version.v3_py3"
;
public
static
final
String
BAP_PREF_CPL_NAME
=
"bap.pref.cpl.name"
;
public
static
final
String
BAP_PREF_CPL_NAME
=
"bap.pref.cpl.name"
;
public
static
final
String
BAP_PREF_CPL_FILTER_NAME
=
"bap.pref.cpl.filter.name"
;
public
static
final
String
BAP_PREF_CPL_FILTER_NAME
=
"bap.pref.cpl.filter.name"
;
...
...
cn.com.bankit.ide.bap.constants/src/cn/com/bankit/ide/bap/constants/IBapConstants.java
View file @
d0f6efe2
...
@@ -123,6 +123,10 @@ public interface IBapConstants
...
@@ -123,6 +123,10 @@ public interface IBapConstants
//v1.0.0版本
//v1.0.0版本
public
static
final
String
BAP_PREF_CPL_CGC_VER_V1_0_0
=
"bap.cpl.cgc.version.v1_0_0"
;
public
static
final
String
BAP_PREF_CPL_CGC_VER_V1_0_0
=
"bap.cpl.cgc.version.v1_0_0"
;
public
static
final
String
BAP_PREF_CPL_CGC_VER_V3_0_0
=
"bap.cpl.cgc.version.v3_0_0"
;
public
static
final
String
BAP_PREF_CPL_CGC_VER_V3_PY3
=
"bap.cpl.cgc.version.v3_py3"
;
String
BAP_PREF_EDITOR_MOUSE_HELPER
=
"bap.editor.mouse.helper"
;
String
BAP_PREF_EDITOR_MOUSE_HELPER
=
"bap.editor.mouse.helper"
;
String
BAP_PREF_EDITOR_COMP_RECOVERY
=
"bap.editor.comp.recovery"
;
String
BAP_PREF_EDITOR_COMP_RECOVERY
=
"bap.editor.comp.recovery"
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment