Compare commits
403 Commits
release/5.
...
release/5.
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
30f730dc12 | ||
|
|
ec12e1b8f3 | ||
|
|
ca6ec37047 | ||
|
|
16bef143ef | ||
|
|
e004b50344 | ||
|
|
23c3dd6f1a | ||
|
|
d7760a1e65 | ||
|
|
7f35e06529 | ||
|
|
f6261c0b31 | ||
|
|
4315904b8f | ||
|
|
c3d6f66d7f | ||
|
|
889ae405cb | ||
|
|
e5b713a617 | ||
|
|
0d144c69fd | ||
|
|
450bd19224 | ||
|
|
c5fd628e2c | ||
|
|
0c4507aeed | ||
|
|
76837c24fc | ||
|
|
19639c740e | ||
|
|
7e522b3de5 | ||
|
|
aa69617dd6 | ||
|
|
14665bc5ff | ||
|
|
a67205fdca | ||
|
|
96d5c4e89e | ||
|
|
19a261cf49 | ||
|
|
288f223e76 | ||
|
|
e92168add6 | ||
|
|
22d767875b | ||
|
|
6c7553f6a7 | ||
|
|
3211737135 | ||
|
|
2e283fdbb0 | ||
|
|
76d36599b4 | ||
|
|
bfc1249eaf | ||
|
|
6f74f6115d | ||
|
|
bd09ae6534 | ||
|
|
e46cb7a80c | ||
|
|
95ea1029b1 | ||
|
|
e19a768f99 | ||
|
|
dc4d6e5571 | ||
|
|
a008296c50 | ||
|
|
16274341d9 | ||
|
|
9161a76733 | ||
|
|
779532aea4 | ||
|
|
e3e5208f33 | ||
|
|
f73b758804 | ||
|
|
7e1464b2c7 | ||
|
|
fd5baa5bef | ||
|
|
beca41bd89 | ||
|
|
033b425139 | ||
|
|
90ee4e7540 | ||
|
|
9564006ec2 | ||
|
|
4e59bdb673 | ||
|
|
28c7241060 | ||
|
|
71e4faa1c9 | ||
|
|
59db3706e8 | ||
|
|
6d6223ee3e | ||
|
|
30b5520f90 | ||
|
|
5eaab053a7 | ||
|
|
c1d4923344 | ||
|
|
ff04dc3bcc | ||
|
|
77935db447 | ||
|
|
c415a095b4 | ||
|
|
c09724abe7 | ||
|
|
988fb6da6c | ||
|
|
4300c4d41c | ||
|
|
5a6c6072c1 | ||
|
|
7bcdd11a95 | ||
|
|
d9190e286d | ||
|
|
5357cae659 | ||
|
|
c393b30499 | ||
|
|
d49c30d86d | ||
|
|
5c4eb11138 | ||
|
|
2063a0c1e5 | ||
|
|
a485cf01f4 | ||
|
|
7733eb3d66 | ||
|
|
09e33f6369 | ||
|
|
156c4a37d6 | ||
|
|
a25bcc87c9 | ||
|
|
24cbfb8de7 | ||
|
|
9ec2203619 | ||
|
|
7e34a9ca47 | ||
|
|
477e5ba4af | ||
|
|
500408acd6 | ||
|
|
a8a97c1305 | ||
|
|
bbba2c55d4 | ||
|
|
61fa77fc0f | ||
|
|
84efb1f2ca | ||
|
|
fca502a4d5 | ||
|
|
a8edfc3b17 | ||
|
|
54c71d17cb | ||
|
|
4b3e413cec | ||
|
|
81cd899ca6 | ||
|
|
40414c1ba0 | ||
|
|
e84482734e | ||
|
|
0ff78a3881 | ||
|
|
68a66dfb80 | ||
|
|
14c04b7b9a | ||
|
|
fc8fd2da58 | ||
|
|
ec713509ab | ||
|
|
09221be330 | ||
|
|
6e57f92420 | ||
|
|
777b350d90 | ||
|
|
01b93131ad | ||
|
|
89ea83eb2e | ||
|
|
1ce533dab9 | ||
|
|
dbe9777fdc | ||
|
|
e20dc3c79b | ||
|
|
78a485a285 | ||
|
|
c7943bd6ad | ||
|
|
97984897d8 | ||
|
|
4672a95715 | ||
|
|
14e8fa0f43 | ||
|
|
f4d0ad33db | ||
|
|
68eb193517 | ||
|
|
4cd1f5829f | ||
|
|
fe9b7789e6 | ||
|
|
eb749086e7 | ||
|
|
b43486faaf | ||
|
|
270561e557 | ||
|
|
bca8b423c3 | ||
|
|
94a835d56f | ||
|
|
c9ac76a205 | ||
|
|
dd821715b1 | ||
|
|
96387b653b | ||
|
|
6ec88eb7e6 | ||
|
|
3b60d2c709 | ||
|
|
437de8cae5 | ||
|
|
2f1d299600 | ||
|
|
fd3457c9b2 | ||
|
|
165b19a355 | ||
|
|
8a87a4732a | ||
|
|
f2d4e3047e | ||
|
|
25fedcb75c | ||
|
|
bd58d821dd | ||
|
|
1c4e716de8 | ||
|
|
51bf3acc75 | ||
|
|
ba3d68e090 | ||
|
|
aa35063c76 | ||
|
|
a83562a5b0 | ||
|
|
212d0126c3 | ||
|
|
24a7e10f62 | ||
|
|
975b6349f5 | ||
|
|
392d60591b | ||
|
|
af15c95f8f | ||
|
|
3f2a82fc21 | ||
|
|
ccdc296b8d | ||
|
|
340e197ff6 | ||
|
|
1438f7d6c5 | ||
|
|
82a200b384 | ||
|
|
ca0adfff8e | ||
|
|
c49b073479 | ||
|
|
53ceb690e7 | ||
|
|
e3b6894a64 | ||
|
|
b2929b4824 | ||
|
|
2212ea1021 | ||
|
|
db34be3de5 | ||
|
|
bba322e979 | ||
|
|
b5d76de144 | ||
|
|
1459a58f45 | ||
|
|
db2b9dc1d5 | ||
|
|
9d6895cddb | ||
|
|
efcc63d493 | ||
|
|
8eb04e6087 | ||
|
|
494ebd3f51 | ||
|
|
0e21f83fde | ||
|
|
f16723a7e3 | ||
|
|
ac7d4e23c4 | ||
|
|
78318f3a0d | ||
|
|
c09ad426e6 | ||
|
|
95f48cfe8e | ||
|
|
2c188a7a6c | ||
|
|
59b931f17d | ||
|
|
3108ff8744 | ||
|
|
041c21e403 | ||
|
|
8b4a2c662a | ||
|
|
7ef8c0d6e7 | ||
|
|
4d8b6cb445 | ||
|
|
ceeb51b2c4 | ||
|
|
7c7c42269a | ||
|
|
cf7022fd9f | ||
|
|
513e7673ef | ||
|
|
dd4487935e | ||
|
|
af3327e591 | ||
|
|
56f14cb4c3 | ||
|
|
1db27fee9c | ||
|
|
87f8fed993 | ||
|
|
c1dcd70826 | ||
|
|
b8b7544c5a | ||
|
|
5561025a1d | ||
|
|
a2cacc6819 | ||
|
|
7fc5523701 | ||
|
|
c43f3de71e | ||
|
|
e8e00ed307 | ||
|
|
af0deba9b0 | ||
|
|
321899411d | ||
|
|
9e5c89b7c9 | ||
|
|
e340ab9d99 | ||
|
|
403c2f8644 | ||
|
|
1ac31be0da | ||
|
|
4b89fa78e8 | ||
|
|
06da92ae35 | ||
|
|
aea0ab0080 | ||
|
|
f2828ffd83 | ||
|
|
d99e4d5d80 | ||
|
|
94141bdd8c | ||
|
|
f29930364b | ||
|
|
0632fc5435 | ||
|
|
5cdb723a1e | ||
|
|
11fae62f21 | ||
|
|
97144881de | ||
|
|
1e32a80420 | ||
|
|
15650f400d | ||
|
|
d36b9f2373 | ||
|
|
cd721a7aeb | ||
|
|
a5158d37a3 | ||
|
|
0e4c36d687 | ||
|
|
02584d8f98 | ||
|
|
a54b8e7b69 | ||
|
|
8ee6be3ded | ||
|
|
49fb57f772 | ||
|
|
1b5b9adeea | ||
|
|
ae4d977060 | ||
|
|
5a94e1c547 | ||
|
|
360269d91c | ||
|
|
d1a13a1237 | ||
|
|
eb131d292e | ||
|
|
498e78f282 | ||
|
|
d73f7993b3 | ||
|
|
6565a23962 | ||
|
|
e2f12f3f18 | ||
|
|
4b22423501 | ||
|
|
ac7d51f672 | ||
|
|
2bccdc3013 | ||
|
|
6d217d9136 | ||
|
|
45d4a673ea | ||
|
|
2afa0e0344 | ||
|
|
fbf3378db1 | ||
|
|
d1df2137e0 | ||
|
|
506ab841f7 | ||
|
|
3146730dbf | ||
|
|
10f94cd189 | ||
|
|
8df200d289 | ||
|
|
ea6ecbbc01 | ||
|
|
c5f1cdfb07 | ||
|
|
6d6685b2d7 | ||
|
|
31771e4962 | ||
|
|
5340af3267 | ||
|
|
5787e5cd24 | ||
|
|
7e89fe8401 | ||
|
|
7b6fc80cb4 | ||
|
|
d9b2fbf15f | ||
|
|
47ce108adb | ||
|
|
b6cd48c736 | ||
|
|
67aed7e2a6 | ||
|
|
79beddc636 | ||
|
|
32c1039d27 | ||
|
|
8b6a036f64 | ||
|
|
f7261c2bef | ||
|
|
d8ec005476 | ||
|
|
ccdd6b8ec9 | ||
|
|
b2e7cae844 | ||
|
|
129fbc1892 | ||
|
|
5a769ec51a | ||
|
|
e96f5e1235 | ||
|
|
615f9dadd1 | ||
|
|
dfdf08bef6 | ||
|
|
e96ded3ac5 | ||
|
|
a0f8225f6e | ||
|
|
586a340518 | ||
|
|
b1629b9720 | ||
|
|
df197e6433 | ||
|
|
037f218459 | ||
|
|
7b08106a47 | ||
|
|
e1cea9125a | ||
|
|
94304d8756 | ||
|
|
fed5addb5e | ||
|
|
4a0435f699 | ||
|
|
a4541ae55c | ||
|
|
7579f3e416 | ||
|
|
7dcc032b81 | ||
|
|
d546bdaae7 | ||
|
|
027163e58f | ||
|
|
d572f68919 | ||
|
|
c11f41bd13 | ||
|
|
9a556ea7aa | ||
|
|
3c93ce3236 | ||
|
|
abbb801232 | ||
|
|
4ca21e0240 | ||
|
|
b393d23bd5 | ||
|
|
ffad1c0d24 | ||
|
|
501ca24048 | ||
|
|
198dc0a9c9 | ||
|
|
2e3700fe1c | ||
|
|
068e836bf1 | ||
|
|
cd8bd1d00a | ||
|
|
be4d642c74 | ||
|
|
ad5e777f3b | ||
|
|
cf235a2e92 | ||
|
|
de4e67d41d | ||
|
|
0828f6e564 | ||
|
|
9a11a02f77 | ||
|
|
ebf9c85399 | ||
|
|
9be298640d | ||
|
|
c00db61cd5 | ||
|
|
34b612f7c9 | ||
|
|
777f4c6938 | ||
|
|
fe6751e140 | ||
|
|
07fd9e38f5 | ||
|
|
4ce6f5c3b4 | ||
|
|
66d5e750b3 | ||
|
|
b54d802c55 | ||
|
|
2c268d36f6 | ||
|
|
0aacd86dc4 | ||
|
|
39d521213c | ||
|
|
35359a1829 | ||
|
|
e7f73d768d | ||
|
|
4a70286a1f | ||
|
|
dfd3ffaf19 | ||
|
|
685e00024f | ||
|
|
bbc536d20b | ||
|
|
4c31bb473c | ||
|
|
845ec2d4aa | ||
|
|
4c1543c701 | ||
|
|
1005d9ef70 | ||
|
|
d3f1de8dfa | ||
|
|
8a5412e7bd | ||
|
|
759b6ce0d1 | ||
|
|
9b634206af | ||
|
|
8eb84b93b9 | ||
|
|
0d4bc055fe | ||
|
|
09c5da1a12 | ||
|
|
e5902875cc | ||
|
|
66a56f597c | ||
|
|
17de5c063a | ||
|
|
e208d3afbd | ||
|
|
f2334929c2 | ||
|
|
e5b8b1891a | ||
|
|
aa89b08d2d | ||
|
|
33dbb0e819 | ||
|
|
46a782d500 | ||
|
|
1ad958cb15 | ||
|
|
abe5464bb7 | ||
|
|
b96a2e92e8 | ||
|
|
e85c119849 | ||
|
|
fe6d6bc2b0 | ||
|
|
b60ef4289b | ||
|
|
8f85246efc | ||
|
|
6a36c03fdb | ||
|
|
1dd43b27f1 | ||
|
|
bab0c510ca | ||
|
|
ecc9a0727c | ||
|
|
78fbea7e81 | ||
|
|
50d604bcff | ||
|
|
3267b78adb | ||
|
|
25f3d2eca4 | ||
|
|
dbf3aefdf1 | ||
|
|
96fd269d81 | ||
|
|
80c6a471d2 | ||
|
|
d640d342dc | ||
|
|
38210f0f1e | ||
|
|
301319a164 | ||
|
|
9875bf9376 | ||
|
|
65a636d238 | ||
|
|
c6e01ce83b | ||
|
|
c3fc6dce4f | ||
|
|
eab20aba41 | ||
|
|
71515b9e25 | ||
|
|
1b6176032e | ||
|
|
7d982a270e | ||
|
|
679902633f | ||
|
|
ce915b858f | ||
|
|
ef6994d97f | ||
|
|
7c0903481d | ||
|
|
2758982bf4 | ||
|
|
36f183bf36 | ||
|
|
b7c3413f34 | ||
|
|
68e0292891 | ||
|
|
ca15ab80f0 | ||
|
|
3b00989b40 | ||
|
|
95f58c4cea | ||
|
|
f328a59944 | ||
|
|
f7ba5e4b09 | ||
|
|
a1b31112d1 | ||
|
|
7e7c602c6b | ||
|
|
7e4ce6d0e0 | ||
|
|
3354bdf435 | ||
|
|
8b54a419e8 | ||
|
|
018fa2d2fc | ||
|
|
240f060fa7 | ||
|
|
5dabcd9b6a | ||
|
|
a5413c81d0 | ||
|
|
c677b38293 | ||
|
|
62c4dd8434 | ||
|
|
64d27dccbd | ||
|
|
c23eecf940 | ||
|
|
0b7468f220 | ||
|
|
ea4e67ec05 | ||
|
|
1ae9aab21f | ||
|
|
9f21d1c750 | ||
|
|
dd3b8c7d96 | ||
|
|
eabbef55ee | ||
|
|
35537f2d19 | ||
|
|
dcc95787ed |
@@ -104,13 +104,13 @@ TableViewerCreator.CellModifier.ExError=\u73FE\u5728\u306E CellModifier \u306F\u
|
||||
TableViewerCreator.columnNoIBeanProperty=\u30AB\u30E9\u30E0 '{0}' ('{1}') \u306F CellEditor \u30BB\u30C3\u30C8\u3092\u6301\u3061\u307E\u3059\u304C\u3001 IBeanPropertyAccessors\u3092\u6301\u3061\u307E\u305B\u3093\u3002
|
||||
TableViewerCreator.columnNullId=\u30AB\u30E9\u30E0 '{0}' \u306FNULL\u5024\u306Eid\u3092\u6301\u3063\u3066\u3044\u307E\u3059\u3002
|
||||
TableViewerCreator.IdProperty.AssertMsg=\u30AB\u30E9\u30E0\u306EidProperty\u306E\u5909\u66F4\u304C\u5FC5\u8981\u3067\u3059\u3001idProperty\u306F\uFF11\u3064\u306E\u30C6\u30FC\u30D6\u30EB\u3067\u30E6\u30CB\u30FC\u30AF\u3067\u306A\u304F\u3066\u306F\u306A\u308A\u307E\u305B\u3093\u3002
|
||||
TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304CNULL\u5024\u3067\u3059
|
||||
TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304Cnull\u3067\u3059
|
||||
TableViewerCreator.TableColumn.AssertMsg=idProperty'{0}'\u304C\u3042\u308BTableEditorColumn\u306ETableColumn\u306F\u3001\u6B63\u3057\u3044\u89AATable\u3092\u6301\u3063\u3066\u3044\u307E\u305B\u3093\u3002
|
||||
TreeToTablesLinker.Type.Unsupported=\u3053\u306E\u30BF\u30A4\u30D7\u306EcurrentControl\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
|
||||
exception.errorOccured=\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F\uFF08{0}\uFF09\n\u8A73\u7D30\u306F\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
ModelSelectionDialog.Message=\u30AA\u30D7\u30B7\u30E7\u30F3\u3092\uFF11\u3064\u9078\u629E\u3059\u308B\u304B\u3001\u30AD\u30E3\u30F3\u30BB\u30EB\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
ModelSelectionDialog.Option=\u30AA\u30D7\u30B7\u30E7\u30F3
|
||||
ModelSelectionDialog.BuiltIn=\u7D44\u307F\u8FBC\u307F\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u5909\u66F4
|
||||
ModelSelectionDialog.BuiltIn=\u7D44\u8FBC\u307F\u30D7\u30ED\u30D1\u30C6\u30A3\u306B\u5909\u66F4
|
||||
ModelSelectionDialog.ViewSchema=\u30B9\u30AD\u30FC\u30DE\u306E\u8868\u793A\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09\u3002
|
||||
ModelSelectionDialog.ViewQuery=\u30AF\u30A8\u30EA\u306E\u8868\u793A\uFF08\u8AAD\u307F\u53D6\u308A\u5C02\u7528\uFF09\u3002
|
||||
ModelSelectionDialog.Update=\u30EA\u30DD\u30B8\u30C8\u30EA\u63A5\u7D9A\u306E\u66F4\u65B0\u3002
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
AddPushButton.AddButton.Tip=Toevoegen
|
||||
DateDialog.textContent=Selecteer datum & tijd
|
||||
DialogErrorForCellEditorListener.Error.MsgDialogTitle=Fout
|
||||
EventUtil.modify=Wijzigen
|
||||
EventUtil.move=Verplaatsen
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 952 B |
Binary file not shown.
|
Before Width: | Height: | Size: 528 B |
@@ -25,6 +25,7 @@ DefaultCellModifier.tableItemDispose=TableItem disposed
|
||||
DialogErrorForCellEditorListener.Error.MsgDialogTitle=Error
|
||||
ErrorDialogWidthDetailArea.ErrorMessage.Text=Error Message
|
||||
ErrorDialogWidthDetailArea.ErrorMessage.ColumnText=Column can not be empty
|
||||
ErrorDialogWidthDetailArea.ErrorMessage.ColumnText.NotValid=The input '{0}' is not valid, will use the original value '{1}' instead of it.
|
||||
ErrorDialogWithContinue.setParameter=Set parameters and continue
|
||||
EventUtil.activate=activate
|
||||
EventUtil.arm=arm
|
||||
|
||||
@@ -169,7 +169,7 @@ public enum ECoreImage implements IImage {
|
||||
PROGRESSGRAYBAR("/icons1/gray.gif"), //$NON-NLS-1$
|
||||
PROGRESSGRAYGEBAR("/icons1/graygeBar.gif"), //$NON-NLS-1$
|
||||
TRIANGLE("/icons1/triangle.gif"), // triangle.gif //$NON-NLS-1$
|
||||
COMPARE("/icons1/compare.gif"), //$NON-NLS-N$
|
||||
COMPARE("/icons1/compare.gif"),
|
||||
EXCHNAGETAB("/icons/exchangeTab.jpg"), // $NON-NLS-1$
|
||||
EXCHNAGEIMAGEMISSING("/icons/component_missing.gif"); // $NON-NLS-1$
|
||||
|
||||
@@ -188,6 +188,7 @@ public enum ECoreImage implements IImage {
|
||||
*
|
||||
* @return the path
|
||||
*/
|
||||
@Override
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
@@ -197,6 +198,7 @@ public enum ECoreImage implements IImage {
|
||||
*
|
||||
* @return the clazz
|
||||
*/
|
||||
@Override
|
||||
public Class getLocation() {
|
||||
return ECoreImage.class;
|
||||
// return CorePlugin.class;
|
||||
|
||||
@@ -115,9 +115,6 @@ public enum EImage implements IImage {
|
||||
FONT_COLOR_ICON("/icons/font_color.gif"), //$NON-NLS-1$
|
||||
FILL_COLOR_ICON("/icons/fill_color.gif"), //$NON-NLS-1$
|
||||
|
||||
OPEN_IN_BROWSER("/icons/open.gif"), //$NON-NLS-1$
|
||||
DOWNLOAD_MODULE("/icons/download.gif"), //$NON-NLS-1$
|
||||
|
||||
COMPONENT_MISSING("/icons/component_missing.gif"), //$NON-NLS-1$
|
||||
|
||||
FILTER_DEACTIVED_ICON("/icons/filter_deactivated.png"), //$NON-NLS-1$
|
||||
@@ -138,7 +135,6 @@ public enum EImage implements IImage {
|
||||
*
|
||||
* @return the path
|
||||
*/
|
||||
@Override
|
||||
public String getPath() {
|
||||
return this.path;
|
||||
}
|
||||
@@ -148,7 +144,6 @@ public enum EImage implements IImage {
|
||||
*
|
||||
* @return the clazz
|
||||
*/
|
||||
@Override
|
||||
public Class getLocation() {
|
||||
return EImage.class;
|
||||
}
|
||||
|
||||
@@ -103,7 +103,7 @@ public class ImageUtils {
|
||||
* RAP.
|
||||
*/
|
||||
public static Image scale(Image image, int percent) {
|
||||
float scale = (float) percent / 100f;
|
||||
float scale = percent / 100f;
|
||||
int newWidth = (int) (scale * image.getImageData().width);
|
||||
int newHeight = (int) (scale * image.getImageData().height);
|
||||
ImageData imageData = image.getImageData().scaledTo(newWidth, newHeight);
|
||||
@@ -201,8 +201,9 @@ public class ImageUtils {
|
||||
if (baos != null) {
|
||||
try {
|
||||
baos.close();
|
||||
if (img != null && !img.isDisposed())
|
||||
if (img != null && !img.isDisposed()) {
|
||||
img.dispose();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
@@ -283,11 +284,11 @@ public class ImageUtils {
|
||||
// if width is mort than height.
|
||||
if (w > h) {
|
||||
newSize.x = requiredSize.x;
|
||||
newSize.y = (int) (w >= 1 ? Math.round(originalSize.y / w) : Math.round(originalSize.y * w));
|
||||
newSize.y = (w >= 1 ? Math.round(originalSize.y / w) : Math.round(originalSize.y * w));
|
||||
}
|
||||
// if width is less than height.
|
||||
else if (w < h) {
|
||||
newSize.x = (int) (h >= 1 ? Math.round(originalSize.x / h) : Math.round(originalSize.x * h));
|
||||
newSize.x = (h >= 1 ? Math.round(originalSize.x / h) : Math.round(originalSize.x * h));
|
||||
newSize.y = requiredSize.y;
|
||||
}
|
||||
// if equal
|
||||
|
||||
@@ -38,6 +38,7 @@ public class DefaultTableLabelProvider implements ITableLabelProvider, ITableCol
|
||||
this.tableViewerCreator = tableViewerCreator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Image getColumnImage(Object element, int columnIndex) {
|
||||
TableViewerCreatorColumnNotModifiable column = (TableViewerCreatorColumnNotModifiable) this.tableViewerCreator
|
||||
.getColumns().get(columnIndex);
|
||||
@@ -47,6 +48,7 @@ public class DefaultTableLabelProvider implements ITableLabelProvider, ITableCol
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getColumnText(Object element, int columnIndex) {
|
||||
String returnValue = null;
|
||||
TableViewerCreatorColumnNotModifiable column = (TableViewerCreatorColumnNotModifiable) this.tableViewerCreator
|
||||
@@ -93,16 +95,20 @@ public class DefaultTableLabelProvider implements ITableLabelProvider, ITableCol
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addListener(ILabelProviderListener listener) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispose() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLabelProperty(Object element, String property) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeListener(ILabelProviderListener lpl) {
|
||||
}
|
||||
|
||||
@@ -111,6 +117,7 @@ public class DefaultTableLabelProvider implements ITableLabelProvider, ITableCol
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.ITableColorProvider#getBackground(java.lang.Object, int)
|
||||
*/
|
||||
@Override
|
||||
public Color getBackground(Object element, int columnIndex) {
|
||||
TableViewerCreatorColumnNotModifiable column = (TableViewerCreatorColumnNotModifiable) this.tableViewerCreator
|
||||
.getColumns().get(columnIndex);
|
||||
@@ -125,6 +132,7 @@ public class DefaultTableLabelProvider implements ITableLabelProvider, ITableCol
|
||||
*
|
||||
* @see org.eclipse.jface.viewers.ITableColorProvider#getForeground(java.lang.Object, int)
|
||||
*/
|
||||
@Override
|
||||
public Color getForeground(Object element, int columnIndex) {
|
||||
TableViewerCreatorColumnNotModifiable column = (TableViewerCreatorColumnNotModifiable) this.tableViewerCreator
|
||||
.getColumns().get(columnIndex);
|
||||
|
||||
@@ -406,7 +406,6 @@ public class TableEditorManager {
|
||||
} else {
|
||||
value = tableViewerCreator.getCellModifier().getValue(currentRowObject, idProperty);
|
||||
}
|
||||
|
||||
Control control = tableEditorContent.initialize(tableItem.getParent(), tableEditor, column, currentRowObject, value);
|
||||
|
||||
// control.addDisposeListener(new DisposeListener() {
|
||||
|
||||
@@ -1,36 +0,0 @@
|
||||
ReusableMultiKey.Keys.BeNull=\u4E3B\u952E\u6570\u7EC4\u4E0D\u80FD\u4E3A\u7A7A
|
||||
utils.workbench.extensions.noExtension=\u6269\u5C55\u70B9ID\u4E3A"{0}"\u7684Plug-in\u4E0D\u5B58\u5728
|
||||
resources.file.notGet=\u8981\u6C42\u7684\u6587\u4EF6"{0}"\u6CA1\u6709\u5728\u6587\u4EF6\u5939"{1}"\u4E2D
|
||||
ListenableList.IndexSameLength.Error=\u539F\u59CB\u7D22\u5F15\u548C\u76EE\u6807\u7D22\u5F15\u5FC5\u987B\u4E3A\u76F8\u540C\u7684\u957F\u5EA6
|
||||
resources.folder.notGet=\u8981\u6C42\u7684\u6587\u4EF6\u5939"{0}"\u6CA1\u6709\u5728\u5DE5\u7A0B"{1}"\u4E2D
|
||||
resources.resource.notMoved=\u8D44\u6E90"{0}"\u4E0D\u80FD\u79FB\u52A8\u5230"{1}"
|
||||
resources.file.notDeleted=\u6587\u4EF6"{0}"\u4E0D\u80FD\u88AB\u5220\u9664
|
||||
resources.folder.notDeleted=\u6587\u4EF6\u5939"{0}"\u4E0D\u80FD\u88AB\u5220\u9664
|
||||
resources.folder.notEmptied=\u6587\u4EF6\u5939"{0}"\u4E0D\u80FD\u4E3A\u7A7A
|
||||
utils.workbench.extensions.badNumberOfExtension=\u65E0\u6548\u7684\u6269\u5C55\u6570\u5B57\u88AB\u53D1\u73B0\u5728{0}\u4E2D\uFF0C\u5F53\u67E5\u627E{3}\u51FA\u73B0\u5728{1}\u548C{2}\u4E4B\u95F4
|
||||
ExtensionImplementationProviders.ExtensionPointError=\u6269\u5C55\u70B9\u5FC5\u987B\u4F7F\u7528\u5355\u5B9E\u4F8B\u6A21\u5F0F
|
||||
ExceptionHandler.Parameter.BeNull=\u53C2\u6570\u4E0D\u80FD\u4E3A\u7A7A\u5F02\u5E38
|
||||
resources.file.notCreated=\u6587\u4EF6"{0}"\u4E0D\u80FD\u88AB\u521B\u5EFA({1})
|
||||
resources.project.notGet=\u8981\u6C42\u7684\u5DE5\u7A0B"{0}"\u4E0D\u5B58\u5728
|
||||
resources.fileContent.notGet=\u6587\u4EF6"{0}"\u7684\u5185\u5BB9\u65E0\u6CD5\u8BFB\u53D6\u3002
|
||||
VersionUtils.Version.Error2=\u7578\u5F62\u5B57\u7B26\u4E32{0}(\u51FA\u73B0M{1}m)
|
||||
resources.members.notGet=\u5BB9\u5668\u7684\u6210\u5458\u4E0D\u80FD\u88AB\u8BFB\u53D6\u3002
|
||||
ReflectionPropertyException.Access.ErrorMsg3=\u5F53\u5F15\u7528\u7C7B{2}\u7684\u5C5E\u6027{1}\u503C{0}\u662F\u51FA\u9519
|
||||
resources.folder.notCreated=\u6587\u4EF6\u5939"{0}"\u4E0D\u80FD\u88AB\u521B\u5EFA
|
||||
utils.data.container=Id{0}\u5DF2\u7ECF\u88AB\u4F7F\u7528\u5728\u5BB9\u5668\u4E2D
|
||||
DB2ForZosResultSet.outofRange=\u8D8A\u754C
|
||||
DB2ForZosResultSet.parameterIndex=\u65E0\u6548\u7684\u53C2\u6570\uFF1A\u53C2\u6570\u6307\u6807
|
||||
DB2ForZosResultSet.unknowCloumn=\u65E0\u6548\u7684\u53C2\u6570\uFF1A\u672A\u77E5\u7684\u5217\u540D
|
||||
Locker.beanNull=Bean\u4E0D\u80FD\u4E3A\u7A7A
|
||||
Locker.keyContext=\u952E
|
||||
Locker.keyNull=\u952E\u503C\u4E0D\u80FD\u4E3A\u7A7A
|
||||
ResourceUtils.canMove1=\u53EF\u79FB\u52A8
|
||||
ResourceUtils.streamNull=\u6D41\u4E3A\u7A7A
|
||||
FilesUtils.operationCanceled=\u590D\u5236\u6587\u4EF6\u6216\u6587\u4EF6\u5939\u65F6\u64CD\u4F5C\u5DF2\u53D6\u6D88\u3002
|
||||
XmlNodeRetriever.countResult=\u8BA1\u6570\u7ED3\u679C\uFF1A
|
||||
XmlNodeRetriever.field2Node=field2\u8282\u70B9
|
||||
XmlNodeRetriever.filed1Node=field1\u8282\u70B9
|
||||
XmlNodeRetriever.mainExpression=\u4E3B\u8868\u8FBE\u5F0F
|
||||
XmlNodeRetriever.mainNode=\u4E3B\u8282\u70B9
|
||||
XmlNodeRetriever.singleQuotes=.
|
||||
XmlNodeRetriever.xPathExpression=xPath\u8868\u8FBE\u5F0F
|
||||
@@ -42,6 +42,3 @@ XmlNodeRetriever.proposal2Node=proposal2Nodes :
|
||||
XmlNodeRetriever.prposal1Node=proposal1Nodes :
|
||||
XmlNodeRetriever.singleQuotes='
|
||||
XmlNodeRetriever.xPathExpression=xPathExpression = '
|
||||
VersionUtils.readPropertyFileError=Error to read property in talend.properties file.
|
||||
DatabaseContentRetriever.PRODUCTNAME=Database Product Name:
|
||||
DatabaseContentRetriever.PRODUCTVERSION=Database Product Version:
|
||||
|
||||
@@ -37,4 +37,3 @@ XmlNodeRetriever.mainExpression=expression principale =
|
||||
XmlNodeRetriever.proposal2Node=proposal2Nodes :
|
||||
XmlNodeRetriever.prposal1Node=proposal1Nodes :
|
||||
XmlNodeRetriever.singleQuotes='
|
||||
VersionUtils.readPropertyFileError=Erreur de lecture de propriété dans le fichier talend.properties.
|
||||
|
||||
@@ -4,6 +4,5 @@
|
||||
<classpathentry kind="src" path="src"/>
|
||||
<classpathentry exported="true" kind="lib" path="data" sourcepath="data"/>
|
||||
<classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
|
||||
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
|
||||
<classpathentry kind="output" path="bin"/>
|
||||
</classpath>
|
||||
|
||||
@@ -5,8 +5,6 @@ Bundle-SymbolicName: org.talend.commons.runtime.test
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Fragment-Host: org.talend.commons.runtime
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.junit,
|
||||
org.talend.utils,
|
||||
org.talend.testutils;bundle-version="1.0.0"
|
||||
Require-Bundle: org.junit
|
||||
Bundle-ClassPath: data/,
|
||||
.
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils;
|
||||
|
||||
import junit.framework.Assert;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.talend.utils.ProductVersion;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class VersionUtilsTest {
|
||||
|
||||
/**
|
||||
* Test method for {@link org.talend.commons.utils.VersionUtils#getTalendVersion()}.
|
||||
*/
|
||||
@Test
|
||||
public void testGetTalendVersion() {
|
||||
ProductVersion talendVersion = ProductVersion.fromString(VersionUtils.getTalendVersion());
|
||||
ProductVersion studioVersion = ProductVersion.fromString(VersionUtils.getVersion());
|
||||
Assert.assertEquals(studioVersion, talendVersion);
|
||||
}
|
||||
}
|
||||
@@ -15,8 +15,8 @@ package org.talend.commons.utils.threading;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.talend.commons.utils.threading.Locker;
|
||||
import org.talend.commons.utils.threading.Locker.LockerValue;
|
||||
import org.talend.commons.utils.threading.locker.operators.AbstractLockerOperator;
|
||||
import org.talend.commons.utils.threading.locker.operators.LockOperator;
|
||||
@@ -355,7 +355,6 @@ public class LockerTest {
|
||||
}
|
||||
|
||||
@Test(timeout = 10000)
|
||||
@Ignore("Locker is not reliable, test fails at each time")
|
||||
public void testThreadSafetyWithWaitForLockThenUnlock_allowReentrantLockFromOtherThread() throws Exception {
|
||||
boolean allowReentrantLockFromOtherThread = true;
|
||||
final Locker locker = new Locker(allowReentrantLockFromOtherThread);
|
||||
@@ -365,7 +364,6 @@ public class LockerTest {
|
||||
}
|
||||
|
||||
@Test(timeout = 10000)
|
||||
@Ignore("Locker is not reliable, test fails at each time")
|
||||
public void testThreadSafetyWithWaitForLockThenUnlock_forbidReentrantLockFromOtherThread() throws Exception {
|
||||
boolean allowReentrantLockFromOtherThread = false;
|
||||
final Locker locker = new Locker(allowReentrantLockFromOtherThread);
|
||||
@@ -386,7 +384,6 @@ public class LockerTest {
|
||||
|
||||
@Test(timeout = 30000)
|
||||
// @Test
|
||||
@Ignore("Locker is not reliable, test fails at each time")
|
||||
public void testThreadSafetyWithWaitForLockThenUnlock() throws Exception {
|
||||
boolean allowReentrantLockFromOtherThread = true;
|
||||
final Locker locker = new Locker(allowReentrantLockFromOtherThread);
|
||||
|
||||
@@ -15,17 +15,18 @@ package org.talend.commons.utils.threading.lockerbykey;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.MethodRule;
|
||||
import org.junit.rules.Timeout;
|
||||
import org.talend.commons.utils.memory.MemoryMeasurer;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.AbstractLockerByKeyOperator;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.CleanOperator;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.LockThenUnlockOperator;
|
||||
@@ -34,12 +35,10 @@ import org.talend.commons.utils.threading.lockerbykey.operators.TryLockThenUnloc
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.TryLockWithTimeoutThenUnlockOperator;
|
||||
import org.talend.commons.utils.threading.threadsafetester.AbstractThreadSafetyTester;
|
||||
|
||||
import com.javamex.classmexer.MemoryUtil;
|
||||
|
||||
public class LockerByKeyTest {
|
||||
|
||||
// @Rule
|
||||
// public MethodRule globalTimeout = new Timeout(60000);
|
||||
@Rule
|
||||
public MethodRule globalTimeout = new Timeout(60000);
|
||||
|
||||
private static final int WAIT_THREAD_STARTED = 200;
|
||||
|
||||
@@ -47,10 +46,6 @@ public class LockerByKeyTest {
|
||||
|
||||
private static final boolean DEBUG = false;
|
||||
|
||||
// static {
|
||||
// MemoryUtilAgentLoader.loadAgent();
|
||||
// }
|
||||
|
||||
protected ILockerByKey createLockerInstance() {
|
||||
// default implementation when running this TestCase
|
||||
return new LockerByKey();
|
||||
@@ -635,7 +630,6 @@ public class LockerByKeyTest {
|
||||
assertThat(suspectLocks.size(), is(0));
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test(timeout = 20000)
|
||||
// @Test
|
||||
public void testThreadSafety_LockThenUnlock() throws Exception {
|
||||
@@ -643,13 +637,13 @@ public class LockerByKeyTest {
|
||||
final int nOperatorsByClassOperator = 30;
|
||||
final int nOperationsByOperator = 500;
|
||||
boolean assertEntriesLessThanCleanPeriod = true;
|
||||
boolean warmupRound = false;
|
||||
boolean shutdownAtEnd = true;
|
||||
launchThreadSafetyTest(locker, nOperatorsByClassOperator, nOperationsByOperator, assertEntriesLessThanCleanPeriod,
|
||||
shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
warmupRound, shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
TryLockThenUnlockOperator.class);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Test(timeout = 20000)
|
||||
// @Test
|
||||
public void testThreadSafety_LockThenUnlock_with_randomClean() throws Exception {
|
||||
@@ -657,9 +651,10 @@ public class LockerByKeyTest {
|
||||
final int nOperatorsByClassOperator = 30;
|
||||
final int nOperationsByOperator = 500;
|
||||
boolean assertEntriesLessThanCleanPeriod = true;
|
||||
boolean warmupRound = false;
|
||||
boolean shutdownAtEnd = true;
|
||||
launchThreadSafetyTest(locker, nOperatorsByClassOperator, nOperationsByOperator, assertEntriesLessThanCleanPeriod,
|
||||
shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
warmupRound, shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
TryLockThenUnlockOperator.class, CleanOperator.class);
|
||||
}
|
||||
|
||||
@@ -668,49 +663,68 @@ public class LockerByKeyTest {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test(timeout = 30000)
|
||||
// @Test
|
||||
@Ignore("Ignored while JUnit buils is not modified to allow measure of memory")
|
||||
public void testMemory() throws Exception {
|
||||
ILockerByKey locker = createLockerInstance();
|
||||
|
||||
public void testMemory_iterations() throws Exception {
|
||||
ILockerByKey locker = new LockerByKeyUnrestricted();
|
||||
final int nOperatorsByClassOperator = 30;
|
||||
final int nOperationsByOperator = 50;
|
||||
boolean assertEntriesLessThanCleanPeriod = true;
|
||||
boolean warmupRound = true;
|
||||
boolean shutdownAtEnd = false;
|
||||
int warmupRounds = 3;
|
||||
int mesureRounds = 3;
|
||||
|
||||
long previousDeepMemoryUsageOfLocker = MemoryUtil.deepMemoryUsageOf(locker);
|
||||
System.out.println("deepMemoryUsageOfLocker=" + previousDeepMemoryUsageOfLocker);
|
||||
Set<Long> memoryResults = new HashSet<Long>();
|
||||
|
||||
int maxMesureRounds = 10;
|
||||
for (int i = 0; i < maxMesureRounds; i++) {
|
||||
MemoryMeasurer globalMemoryMeasurer = new MemoryMeasurer();
|
||||
globalMemoryMeasurer.begin();
|
||||
for (int i = 0; i < warmupRounds; i++) {
|
||||
launchThreadSafetyTest(locker, nOperatorsByClassOperator, nOperationsByOperator, assertEntriesLessThanCleanPeriod,
|
||||
shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
warmupRound, shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
TryLockThenUnlockOperator.class);
|
||||
locker.clean();
|
||||
System.gc();
|
||||
Thread.sleep(500); // memory seems more stable when waiting a bit
|
||||
long deepMemoryUsageOfLocker = MemoryUtil.deepMemoryUsageOf(locker);
|
||||
System.out.println("deepMemoryUsageOfLocker=" + deepMemoryUsageOfLocker);
|
||||
if (memoryResults.contains(deepMemoryUsageOfLocker)) {
|
||||
break;
|
||||
} else if (i == maxMesureRounds - 1) {
|
||||
fail("Used memory is unstable after " + maxMesureRounds + " rounds");
|
||||
}
|
||||
memoryResults.add(deepMemoryUsageOfLocker);
|
||||
globalMemoryMeasurer.printUsedMemory("Global used memory mesure");
|
||||
}
|
||||
globalMemoryMeasurer.end();
|
||||
|
||||
warmupRound = false;
|
||||
|
||||
globalMemoryMeasurer = new MemoryMeasurer();
|
||||
globalMemoryMeasurer.begin();
|
||||
long usedMemory = 0;
|
||||
for (int i = 0; i < mesureRounds; i++) {
|
||||
launchThreadSafetyTest(locker, nOperatorsByClassOperator, nOperationsByOperator, assertEntriesLessThanCleanPeriod,
|
||||
warmupRound, shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
TryLockThenUnlockOperator.class);
|
||||
boolean useGCBeforeMeasure = true;
|
||||
usedMemory = globalMemoryMeasurer.step(useGCBeforeMeasure);
|
||||
globalMemoryMeasurer.printUsedMemory("Global used memory mesure");
|
||||
}
|
||||
|
||||
assertTrue("Used memory exceeds the expected", usedMemory < 200000);
|
||||
|
||||
locker.shutdown();
|
||||
|
||||
usedMemory = globalMemoryMeasurer.end();
|
||||
globalMemoryMeasurer.printUsedMemory("Global used memory mesure after shutdown");
|
||||
|
||||
assertTrue("Used memory exceeds the expected", usedMemory < 20000);
|
||||
|
||||
locker = null;
|
||||
|
||||
usedMemory = globalMemoryMeasurer.end();
|
||||
globalMemoryMeasurer.printUsedMemory("Global used memory mesure after set to null");
|
||||
assertTrue("Used memory exceeds the expected", usedMemory < 20000);
|
||||
|
||||
}
|
||||
|
||||
protected void launchThreadSafetyTest(final ILockerByKey locker, final int nOperatorsByClassOperator,
|
||||
final int nOperationsByOperator, boolean assertEntriesLessThanCleanPeriod, final boolean shutdownAtEnd,
|
||||
Class<? extends AbstractLockerByKeyOperator>... classOperators) throws Exception {
|
||||
private void launchThreadSafetyTest(final ILockerByKey locker, final int nOperatorsByClassOperator,
|
||||
final int nOperationsByOperator, boolean assertEntriesLessThanCleanPeriod, boolean warmupRound,
|
||||
final boolean shutdownAtEnd, Class<? extends AbstractLockerByKeyOperator>... classOperators) throws Exception {
|
||||
final ResultContainer resultContainer = new ResultContainer();
|
||||
|
||||
System.out.println("------------------------------------------------------------------------------------");
|
||||
System.out.println("####################################################################################");
|
||||
if (warmupRound) {
|
||||
System.out.println("!!! WARMUP ROUND !!! (don't take account the results of this round)");
|
||||
}
|
||||
|
||||
class LockerThreadSafetyTester extends AbstractThreadSafetyTester<AbstractLockerByKeyOperator> {
|
||||
|
||||
|
||||
@@ -15,29 +15,28 @@ package org.talend.commons.utils.threading.lockerbykey;
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.Callable;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.Future;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.MethodRule;
|
||||
import org.junit.rules.Timeout;
|
||||
import org.talend.commons.utils.memory.MemoryMeasurer;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.AbstractLockerByKeyOperator;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.CleanOperator;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.LockThenUnlockOperator;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.LockThenUnlockUnrestrictedOperator;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.ResultContainer;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.TryLockThenUnlockOperator;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.TryLockThenUnlockUnrestrictedOperator;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.TryLockWithTimeoutThenUnlockOperator;
|
||||
import org.talend.commons.utils.threading.lockerbykey.operators.TryLockWithTimeoutThenUnlockUnrestrictedOperator;
|
||||
|
||||
import com.javamex.classmexer.MemoryUtil;
|
||||
import org.talend.commons.utils.threading.threadsafetester.AbstractThreadSafetyTester;
|
||||
|
||||
public class LockerByKeyUnrestrictedTest extends LockerByKeyTest {
|
||||
|
||||
@@ -771,7 +770,7 @@ public class LockerByKeyUnrestrictedTest extends LockerByKeyTest {
|
||||
boolean shutdownAtEnd = true;
|
||||
boolean warmupRound = false;
|
||||
launchThreadSafetyTest(locker, nOperatorsByClassOperator, nOperationsByOperator, assertEntriesLessThanCleanPeriod,
|
||||
shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
warmupRound, shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
TryLockThenUnlockOperator.class);
|
||||
}
|
||||
|
||||
@@ -787,7 +786,7 @@ public class LockerByKeyUnrestrictedTest extends LockerByKeyTest {
|
||||
boolean shutdownAtEnd = true;
|
||||
boolean warmupRound = false;
|
||||
launchThreadSafetyTest(locker, nOperatorsByClassOperator, nOperationsByOperator, assertEntriesLessThanCleanPeriod,
|
||||
shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
warmupRound, shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
TryLockThenUnlockOperator.class, CleanOperator.class);
|
||||
}
|
||||
|
||||
@@ -803,7 +802,7 @@ public class LockerByKeyUnrestrictedTest extends LockerByKeyTest {
|
||||
boolean shutdownAtEnd = true;
|
||||
boolean warmupRound = false;
|
||||
launchThreadSafetyTest(locker, nOperatorsByClassOperator, nOperationsByOperator, assertEntriesLessThanCleanPeriod,
|
||||
shutdownAtEnd, LockThenUnlockOperator.class, LockThenUnlockUnrestrictedOperator.class,
|
||||
warmupRound, shutdownAtEnd, LockThenUnlockOperator.class, LockThenUnlockUnrestrictedOperator.class,
|
||||
TryLockWithTimeoutThenUnlockOperator.class, TryLockWithTimeoutThenUnlockUnrestrictedOperator.class,
|
||||
TryLockThenUnlockOperator.class, TryLockThenUnlockUnrestrictedOperator.class, CleanOperator.class);
|
||||
}
|
||||
@@ -813,42 +812,150 @@ public class LockerByKeyUnrestrictedTest extends LockerByKeyTest {
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test(timeout = 30000)
|
||||
// @Test
|
||||
@Ignore("Ignored while JUnit buils is not modified to allow measure of memory")
|
||||
public void testMemory() throws Exception {
|
||||
ILockerByKey locker = createLockerInstance();
|
||||
|
||||
public void testUnrestricted_Memory() throws Exception {
|
||||
LockerByKeyUnrestricted locker = createLockerUnrestrictedInstance();
|
||||
final int nOperatorsByClassOperator = 30;
|
||||
final int nOperationsByOperator = 50;
|
||||
boolean assertEntriesLessThanCleanPeriod = true;
|
||||
boolean warmupRound = true;
|
||||
boolean shutdownAtEnd = false;
|
||||
int warmupRounds = 3;
|
||||
int mesureRounds = 3;
|
||||
|
||||
long previousDeepMemoryUsageOfLocker = MemoryUtil.deepMemoryUsageOf(locker);
|
||||
System.out.println("deepMemoryUsageOfLocker=" + previousDeepMemoryUsageOfLocker);
|
||||
Set<Long> memoryResults = new HashSet<Long>();
|
||||
|
||||
int maxMesureRounds = 10;
|
||||
for (int i = 0; i < maxMesureRounds; i++) {
|
||||
MemoryMeasurer globalMemoryMeasurer = new MemoryMeasurer();
|
||||
globalMemoryMeasurer.begin();
|
||||
for (int i = 0; i < warmupRounds; i++) {
|
||||
launchThreadSafetyTest(locker, nOperatorsByClassOperator, nOperationsByOperator, assertEntriesLessThanCleanPeriod,
|
||||
shutdownAtEnd, LockThenUnlockOperator.class, LockThenUnlockUnrestrictedOperator.class,
|
||||
TryLockWithTimeoutThenUnlockOperator.class, TryLockWithTimeoutThenUnlockUnrestrictedOperator.class,
|
||||
TryLockThenUnlockOperator.class, TryLockThenUnlockUnrestrictedOperator.class);
|
||||
locker.clean();
|
||||
System.gc();
|
||||
Thread.sleep(500); // memory seems more stable when waiting a bit
|
||||
long deepMemoryUsageOfLocker = MemoryUtil.deepMemoryUsageOf(locker);
|
||||
System.out.println("deepMemoryUsageOfLocker=" + deepMemoryUsageOfLocker);
|
||||
if (memoryResults.contains(deepMemoryUsageOfLocker)) {
|
||||
break;
|
||||
} else if (i == maxMesureRounds - 1) {
|
||||
fail("Used memory exceeds the expected: deepMemoryUsageOfLocker > deepMemoryUsageOfLockerAtStart "
|
||||
+ deepMemoryUsageOfLocker + " > " + previousDeepMemoryUsageOfLocker);
|
||||
}
|
||||
memoryResults.add(deepMemoryUsageOfLocker);
|
||||
warmupRound, shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
TryLockThenUnlockOperator.class);
|
||||
globalMemoryMeasurer.printUsedMemory("Global used memory mesure");
|
||||
}
|
||||
globalMemoryMeasurer.end();
|
||||
|
||||
warmupRound = false;
|
||||
|
||||
globalMemoryMeasurer = new MemoryMeasurer();
|
||||
globalMemoryMeasurer.begin();
|
||||
long usedMemory = 0;
|
||||
for (int i = 0; i < mesureRounds; i++) {
|
||||
launchThreadSafetyTest(locker, nOperatorsByClassOperator, nOperationsByOperator, assertEntriesLessThanCleanPeriod,
|
||||
warmupRound, shutdownAtEnd, LockThenUnlockOperator.class, TryLockWithTimeoutThenUnlockOperator.class,
|
||||
TryLockThenUnlockOperator.class);
|
||||
boolean useGCBeforeMeasure = true;
|
||||
usedMemory = globalMemoryMeasurer.step(useGCBeforeMeasure);
|
||||
globalMemoryMeasurer.printUsedMemory("Global used memory mesure");
|
||||
}
|
||||
|
||||
assertTrue("Used memory exceeds the expected", usedMemory < 300000);
|
||||
|
||||
locker.shutdown();
|
||||
|
||||
usedMemory = globalMemoryMeasurer.end();
|
||||
globalMemoryMeasurer.printUsedMemory("Global used memory mesure after shutdown");
|
||||
|
||||
assertTrue("Used memory exceeds the expected", usedMemory < 50000);
|
||||
|
||||
locker = null;
|
||||
|
||||
usedMemory = globalMemoryMeasurer.end();
|
||||
globalMemoryMeasurer.printUsedMemory("Global used memory mesure after set to null");
|
||||
assertTrue("Used memory exceeds the expected", usedMemory < 50000);
|
||||
|
||||
}
|
||||
|
||||
private void launchThreadSafetyTest(final ILockerByKey locker, final int nOperatorsByClassOperator,
|
||||
final int nOperationsByOperator, boolean assertEntriesLessThanCleanPeriod, boolean warmupRound,
|
||||
final boolean shutdownAtEnd, Class<? extends AbstractLockerByKeyOperator>... classOperators) throws Exception {
|
||||
final ResultContainer resultContainer = new ResultContainer();
|
||||
|
||||
System.out.println("####################################################################################");
|
||||
if (warmupRound) {
|
||||
System.out.println("!!! WARMUP ROUND !!! (don't take account the results of this round)");
|
||||
}
|
||||
class LockerThreadSafetyTester extends AbstractThreadSafetyTester<AbstractLockerByKeyOperator> {
|
||||
|
||||
private boolean assertEntriesLessThanCleanPeriod;
|
||||
|
||||
public LockerThreadSafetyTester(int nOperatorsByClassOperator, boolean assertEntriesLessThanCleanPeriod,
|
||||
Class<? extends AbstractLockerByKeyOperator>... classOperators) {
|
||||
super(nOperatorsByClassOperator, classOperators);
|
||||
this.assertEntriesLessThanCleanPeriod = assertEntriesLessThanCleanPeriod;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see
|
||||
* org.talend.commons.utils.threading.AbstractThreadSafetyTester#initInstance(org.talend.commons.utils.threading
|
||||
* .IThreadSafetyOperator)
|
||||
*/
|
||||
protected void initInstance(AbstractLockerByKeyOperator operatorInstance) {
|
||||
operatorInstance.setDebug(DEBUG);
|
||||
operatorInstance.setLocker(locker);
|
||||
operatorInstance.setnOperationsByOperator(nOperationsByOperator);
|
||||
operatorInstance.setResultContainer(resultContainer);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.threading.AbstractThreadSafetyTester#assertFinal()
|
||||
*/
|
||||
@Override
|
||||
protected void assertFinal() {
|
||||
int actualSumLockedAtEnd = 0;
|
||||
int actualSumLockersAtEnd = 0;
|
||||
for (int i = 0; i < nOperationsByOperator; i++) {
|
||||
LockerValue lockerValue = locker.getLockerValue(i);
|
||||
if (lockerValue != null) {
|
||||
int queueLength = lockerValue.getLock().getQueueLength();
|
||||
if (lockerValue != null) {
|
||||
actualSumLockedAtEnd += queueLength;
|
||||
}
|
||||
actualSumLockersAtEnd++;
|
||||
}
|
||||
}
|
||||
assertThat(actualSumLockedAtEnd, is(0));
|
||||
if (assertEntriesLessThanCleanPeriod) {
|
||||
assertTrue("actualSumLockersAtEnd > locker.getCleanPeriod() where actualSumLockersAtEnd="
|
||||
+ actualSumLockersAtEnd + " and locker.getCleanPeriod()=" + locker.getCleanPeriod(),
|
||||
actualSumLockersAtEnd < locker.getCleanPeriod());
|
||||
}
|
||||
|
||||
if (shutdownAtEnd) {
|
||||
locker.shutdown();
|
||||
} else {
|
||||
locker.clean();
|
||||
}
|
||||
actualSumLockedAtEnd = 0;
|
||||
actualSumLockersAtEnd = 0;
|
||||
for (int i = 0; i < nOperationsByOperator; i++) {
|
||||
LockerValue lockerValue = locker.getLockerValue(i);
|
||||
if (lockerValue != null) {
|
||||
int queueLength = lockerValue.getLock().getQueueLength();
|
||||
if (lockerValue != null) {
|
||||
actualSumLockedAtEnd += queueLength;
|
||||
}
|
||||
actualSumLockersAtEnd++;
|
||||
}
|
||||
}
|
||||
assertThat(actualSumLockedAtEnd, is(0));
|
||||
assertThat(actualSumLockersAtEnd, is(0));
|
||||
|
||||
assertThat(AbstractLockerByKeyOperator.getNotThreadSafeCounter(),
|
||||
is(resultContainer.sumThreadSafeOperations.get()));
|
||||
System.out.println("Total of operations done: " + resultContainer.sumThreadSafeOperations.get());
|
||||
System.out.println("Average duration: "
|
||||
+ ((double) getDuration() / (double) resultContainer.sumThreadSafeOperations.get()) + " ms by operation");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
LockerThreadSafetyTester lockerThreadSafetyTester = new LockerThreadSafetyTester(nOperatorsByClassOperator,
|
||||
assertEntriesLessThanCleanPeriod, classOperators);
|
||||
lockerThreadSafetyTester.start();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,12 +22,9 @@ import java.util.concurrent.Future;
|
||||
|
||||
/**
|
||||
*
|
||||
* class AbstractThreadSafetyTester.
|
||||
* DOC amaumont class global comment. Detailled comment
|
||||
*
|
||||
* Abstract class to launch test with multiple operators. You can set several operators (<code>classOperators</code>).
|
||||
* Each operator may be launched by a given number of threads (<code>nOperatorsByClassOperator</code>).
|
||||
*
|
||||
* @param T must implement the interface <code>IThreadSafetyOperator.class</code>
|
||||
* @param T
|
||||
*/
|
||||
public abstract class AbstractThreadSafetyTester<T extends IThreadSafetyOperator> {
|
||||
|
||||
@@ -41,20 +38,12 @@ public abstract class AbstractThreadSafetyTester<T extends IThreadSafetyOperator
|
||||
|
||||
private long duration;
|
||||
|
||||
/**
|
||||
*
|
||||
* AbstractThreadSafetyTester constructor.
|
||||
*
|
||||
* @param nOperatorsByClassOperator it means number of threads by operator
|
||||
* @param classOperators variable arguments of the operators
|
||||
*/
|
||||
public AbstractThreadSafetyTester(int nOperatorsByClassOperator, Class<? extends T>... classOperators) {
|
||||
this.nOperatorsByClassOperator = nOperatorsByClassOperator;
|
||||
this.classOperators = classOperators;
|
||||
this.barrier = new CyclicBarrier(nOperatorsByClassOperator * classOperators.length + 1);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public void start() throws Exception {
|
||||
List<Future<Object>> operatorsHandlerList = new ArrayList<Future<Object>>();
|
||||
try {
|
||||
@@ -104,33 +93,10 @@ public abstract class AbstractThreadSafetyTester<T extends IThreadSafetyOperator
|
||||
return duration;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* Method "initInstance".
|
||||
*
|
||||
* Used to initialize the useful variables of the operator.
|
||||
*
|
||||
* @param operatorInstance
|
||||
*/
|
||||
protected abstract void initInstance(T operatorInstance);
|
||||
|
||||
/**
|
||||
*
|
||||
* Method "assertFinal".
|
||||
*
|
||||
* Method executed when all operators have ended their operations. Add assertions into to verify that your class is
|
||||
* ThreadSafe.
|
||||
*
|
||||
* @throws Exception
|
||||
*/
|
||||
protected abstract void assertFinal() throws Exception;
|
||||
protected abstract void assertFinal();
|
||||
|
||||
/**
|
||||
*
|
||||
* ThreadSafetyOperatorHandler class.
|
||||
*
|
||||
* Wrapper for operator which will be submitted in the internal thread pool.
|
||||
*/
|
||||
public class ThreadSafetyOperatorHandler<A extends IThreadSafetyOperator> implements Callable<Object> {
|
||||
|
||||
private A operatorInstance;
|
||||
|
||||
@@ -15,16 +15,16 @@ package org.talend.commons.utils.tracer;
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URISyntaxException;
|
||||
import java.net.URL;
|
||||
import java.util.concurrent.CyclicBarrier;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ThreadFactory;
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
/**
|
||||
* DOC amaumont class global comment. Detailled comment
|
||||
@@ -37,9 +37,6 @@ public class StatisticsTracerTest {
|
||||
|
||||
private static Logger log = Logger.getLogger(StatisticsTracerTest.class);
|
||||
|
||||
@Rule
|
||||
public TemporaryFolder testFolder = new TemporaryFolder();
|
||||
|
||||
@Test
|
||||
public void testStatisticTracer() throws InterruptedException {
|
||||
|
||||
@@ -99,28 +96,33 @@ public class StatisticsTracerTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testStatisticTracerAndTraceToFile() throws InterruptedException, IOException {
|
||||
public void testStatisticTracerAndTraceToFile() throws InterruptedException {
|
||||
|
||||
StatisticsTracer myTracerTest1 = StatisticsTracer.getTracer(MY_TRACER_TEST1);
|
||||
|
||||
testFolder.create();
|
||||
File newFile = testFolder.newFile("myTracerTest3");
|
||||
String pathFile = newFile.getPath();
|
||||
URL resource = StatisticsTracer.class.getResource(StatisticsTracer.class.getSimpleName() + ".class");
|
||||
File refClassFile = null;
|
||||
try {
|
||||
refClassFile = new File(new URI(resource.toString()));
|
||||
} catch (URISyntaxException e) {
|
||||
fail(e.getMessage());
|
||||
}
|
||||
File folder = refClassFile.getParentFile();
|
||||
|
||||
String pathFile = folder.getAbsolutePath() + "/myTracerTest3";
|
||||
myTracerTest1.traceToFile(pathFile, false);
|
||||
|
||||
int sleepTime = 100;
|
||||
int executionsCount = 10;
|
||||
String firstRowStr = "";
|
||||
firstRowStr = myTracerTest1.toDataRow();
|
||||
for (int i = 0; i < executionsCount; i++) {
|
||||
for (int i = 0; i < 10; i++) {
|
||||
long id = myTracerTest1.start();
|
||||
firstRowStr = myTracerTest1.toDataRow();
|
||||
Thread.sleep(sleepTime);
|
||||
myTracerTest1.stop(id);
|
||||
myTracerTest1.print();
|
||||
}
|
||||
|
||||
long elapsedTimeSinceFirstStart = myTracerTest1.getElapsedTimeSinceFirstStart();
|
||||
|
||||
long averageWorkTime = myTracerTest1.getAverageWorkTime();
|
||||
long totalTime = myTracerTest1.getElapsedTime();
|
||||
// Changed by Marvin Wang on Feb.15 for TDI-19166, refer to the method from
|
||||
@@ -129,8 +131,8 @@ public class StatisticsTracerTest {
|
||||
// assertTrue(averageWorkTime >= sleepTime && averageWorkTime < sleepTime + 10);
|
||||
|
||||
int exepectedElapsedTimeSinceFirstStart = sleepTime * executionsCount;
|
||||
assertTrue("elapsedTimeSinceFirstStart=" + elapsedTimeSinceFirstStart + ", exepectedElapsedTimeSinceFirstStart="
|
||||
+ exepectedElapsedTimeSinceFirstStart, elapsedTimeSinceFirstStart >= exepectedElapsedTimeSinceFirstStart
|
||||
long elapsedTimeSinceFirstStart = myTracerTest1.getElapsedTimeSinceFirstStart();
|
||||
assertTrue(elapsedTimeSinceFirstStart >= exepectedElapsedTimeSinceFirstStart
|
||||
&& elapsedTimeSinceFirstStart < exepectedElapsedTimeSinceFirstStart + 50);
|
||||
|
||||
long countExecutions = myTracerTest1.getCountExecutions();
|
||||
@@ -143,7 +145,6 @@ public class StatisticsTracerTest {
|
||||
int fistRowByteLength = firstRowStr.getBytes().length;
|
||||
assertTrue(file.length() > (fistRowByteLength + 1) * executionsCount);
|
||||
file.delete();
|
||||
testFolder.delete();
|
||||
|
||||
StatisticsTracer.removeTracer(MY_TRACER_TEST1);
|
||||
|
||||
|
||||
@@ -3,8 +3,7 @@ Bundle-ManifestVersion: 2
|
||||
Bundle-Name: runtime (low dependencies) for Talend common classes
|
||||
Bundle-SymbolicName: org.talend.commons.runtime
|
||||
Bundle-Version: 2.2.0.qualifier
|
||||
Require-Bundle: org.talend.libraries.apache,
|
||||
org.eclipse.core.runtime,
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.emf.ecore.xmi
|
||||
Export-Package: org.talend.commons,
|
||||
org.talend.commons.debug,
|
||||
@@ -16,6 +15,7 @@ Export-Package: org.talend.commons,
|
||||
org.talend.commons.utils,
|
||||
org.talend.commons.utils.data.bean,
|
||||
org.talend.commons.utils.data.container,
|
||||
org.talend.commons.utils.data.extractor,
|
||||
org.talend.commons.utils.data.list,
|
||||
org.talend.commons.utils.data.map,
|
||||
org.talend.commons.utils.data.reflection,
|
||||
@@ -33,7 +33,7 @@ Export-Package: org.talend.commons,
|
||||
org.talend.commons.utils.scalability,
|
||||
org.talend.commons.utils.system,
|
||||
org.talend.commons.utils.threading,
|
||||
org.talend.commons.utils.threading.lockerbykey,
|
||||
org.talend.commons.utils.threading.lockerbykey,
|
||||
org.talend.commons.utils.time,
|
||||
org.talend.commons.utils.tracer,
|
||||
org.talend.commons.utils.workbench.extensions,
|
||||
|
||||
@@ -4,5 +4,4 @@ bin.includes = META-INF/,\
|
||||
.,\
|
||||
fakejdbc_driver.jar,\
|
||||
modes/,\
|
||||
lib/talend_file_enhanced_20070724.jar,\
|
||||
talend.properties
|
||||
lib/talend_file_enhanced_20070724.jar
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
#Created by JInto - www.guh-software.de
|
||||
#Thu Nov 22 16:33:05 CST 2007
|
||||
DatabaseContentRetriever.PRODUCTNAME=Database Product Name:
|
||||
DatabaseContentRetriever.PRODUCTVERSION=Database Product Version:
|
||||
DB2ForZosResultSet.outofRange=\ is out of range.
|
||||
DB2ForZosResultSet.parameterIndex=Invalid argument\: parameter index
|
||||
DB2ForZosResultSet.unknowCloumn=Invalid argument\: unknown column name
|
||||
DB2ForZosResultSet.parameterIndex=Invalid argument: parameter index
|
||||
DB2ForZosResultSet.unknowCloumn=Invalid argument: unknown column name
|
||||
SybaseResultSet.outofRange=\ is out of range.
|
||||
SybaseResultSet.parameterIndex=Invalid argument\: parameter index
|
||||
SybaseResultSet.unknowCloumn=Invalid argument\: unknown column name
|
||||
EntryLocation.returnTableName={tableName={0}, columnName={1}}
|
||||
ExceptionHandler.Parameter.BeNull=ex param cannot be null
|
||||
ExtensionImplementationProviders.ExtensionPointError=Extension point must authoriez a single instance
|
||||
@@ -37,13 +38,12 @@ resources.resource.notMoved=Resource "{0}" cannot be moved to "{1}"
|
||||
utils.data.container=Id {0} already used in container
|
||||
utils.workbench.extensions.badNumberOfExtension=Bad number of extension found on {0}. Attending between {1} and {2} wile found {3}.
|
||||
utils.workbench.extensions.noExtension=No plug-in extending extension point ID "{0}" can be found.
|
||||
XmlNodeRetriever.countResult=Count result \:
|
||||
XmlNodeRetriever.countResult=Count result :
|
||||
XmlNodeRetriever.field2Node=field2Node=
|
||||
XmlNodeRetriever.filed1Node=field1Node=
|
||||
XmlNodeRetriever.mainExpression=main expression =
|
||||
XmlNodeRetriever.mainNode=mainNode=
|
||||
XmlNodeRetriever.proposal2Node=proposal2Nodes \:
|
||||
XmlNodeRetriever.prposal1Node=proposal1Nodes \:
|
||||
XmlNodeRetriever.proposal2Node=proposal2Nodes :
|
||||
XmlNodeRetriever.prposal1Node=proposal1Nodes :
|
||||
XmlNodeRetriever.singleQuotes='
|
||||
XmlNodeRetriever.xPathExpression=xPathExpression = '
|
||||
VersionUtils.readPropertyFileError=Error to read property in talend.properties file.
|
||||
|
||||
@@ -54,6 +54,10 @@ public final class CommonExceptionHandler {
|
||||
log.log(Level.INFO, message);
|
||||
}
|
||||
|
||||
public static void warn(String message) {
|
||||
log.log(Level.WARN, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return priority corresponding to the exception implementation.
|
||||
*
|
||||
|
||||
@@ -11,23 +11,17 @@
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils;
|
||||
|
||||
/**
|
||||
* This class store all the constant of SpecialValue.
|
||||
*
|
||||
*/
|
||||
public final class SpecialValueDisplay {
|
||||
public final class SpecialValueDisplay {
|
||||
|
||||
private SpecialValueDisplay() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
public static final String NULL_FIELD = "Null field"; //$NON-NLS-1$
|
||||
private SpecialValueDisplay() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
public static final String NULL_FIELD = "Null field"; //$NON-NLS-1$
|
||||
|
||||
public static final String EMPTY_FIELD = "Empty field"; //$NON-NLS-1$
|
||||
|
||||
public static final String ZREO_FIELD = "0"; //$NON-NLS-1$
|
||||
|
||||
public static final String INVALID_FIELD = "invalid"; //$NON-NLS-1$
|
||||
|
||||
}
|
||||
|
||||
@@ -12,17 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
import java.util.Properties;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.FileLocator;
|
||||
import org.eclipse.core.runtime.Path;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
|
||||
/**
|
||||
* Represents a version. Contents a major and a minor version.<br/>
|
||||
@@ -34,16 +25,6 @@ public class VersionUtils {
|
||||
|
||||
public static final String DEFAULT_VERSION = "0.1"; //$NON-NLS-1$
|
||||
|
||||
public static final String STUDIO_VERSION_PROP = "studio.version"; //$NON-NLS-1$
|
||||
|
||||
public static final String TALEND_VERSION_PROP = "talend.version"; //$NON-NLS-1$
|
||||
|
||||
private static final String COMMONS_PLUGIN_ID = "org.talend.commons.runtime"; //$NON-NLS-1$
|
||||
|
||||
private static final String TALEND_PROPERTIES_FILE = "/talend.properties"; //$NON-NLS-1$
|
||||
|
||||
private static Logger log = Logger.getLogger(VersionUtils.class);
|
||||
|
||||
public static int compareTo(String arg0, String arg1) {
|
||||
return new Version(arg0).compareTo(new Version(arg1));
|
||||
}
|
||||
@@ -60,61 +41,14 @@ public class VersionUtils {
|
||||
return toReturn.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "getVersion".
|
||||
*
|
||||
* @return the studio version.
|
||||
*/
|
||||
public static String getVersion() {
|
||||
String version = System.getProperty(STUDIO_VERSION_PROP);
|
||||
String version = System.getProperty("talend.studio.version"); //$NON-NLS-1$
|
||||
if (version == null || "".equals(version.trim())) { //$NON-NLS-1$
|
||||
Bundle bundle = Platform.getBundle(COMMONS_PLUGIN_ID);
|
||||
Bundle bundle = Platform.getBundle("org.talend.commons.runtime"); //$NON-NLS-1$
|
||||
if (bundle != null) {
|
||||
version = (String) bundle.getHeaders().get(org.osgi.framework.Constants.BUNDLE_VERSION);
|
||||
}
|
||||
}
|
||||
return version;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "getTalendVersion".
|
||||
*
|
||||
* return the internal version of the studio that may be different from the Studio version in OEM distribution. look
|
||||
* for version in org.talend.commons.runtime/talend.properties with the key talend.version if none found then return
|
||||
* the Studio version.
|
||||
*
|
||||
* @return the talend version or the Studio version or null if none found.
|
||||
*
|
||||
*/
|
||||
public static String getTalendVersion() {
|
||||
String version = null;
|
||||
|
||||
Bundle b = Platform.getBundle(COMMONS_PLUGIN_ID);
|
||||
if (b != null) {
|
||||
try {
|
||||
URL fileUrl = FileLocator.find(b, new Path(TALEND_PROPERTIES_FILE), null);
|
||||
if (fileUrl != null) {
|
||||
URL url = FileLocator.toFileURL(fileUrl);
|
||||
if (url != null) {
|
||||
FileInputStream in = new FileInputStream(url.getPath());
|
||||
try {
|
||||
Properties props = new Properties();
|
||||
props.load(in);
|
||||
version = props.getProperty(TALEND_VERSION_PROP);
|
||||
} finally {
|
||||
in.close();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error(Messages.getString("VersionUtils.readPropertyFileError"), e);
|
||||
}
|
||||
}
|
||||
if (version == null) {
|
||||
version = getVersion();
|
||||
}
|
||||
|
||||
return version;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.data.extractor;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* DOC marvin class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id: talend.epf 55206 2011-02-15 17:32:14Z mhirt $
|
||||
*
|
||||
*/
|
||||
public class ModuleNameExtractor {
|
||||
|
||||
/**
|
||||
* Extracts all file names from the given collection. This method is suitable the case that collection includes not
|
||||
* only file names but also paths. And you just need a set only including file names. So this method cuts the
|
||||
* directory of a file only the file name remaining. Added by Marvin Wang on Nov 8, 2012.
|
||||
*
|
||||
* @param collection must not be <code>null<code>, otherwise, it will throw NPE.
|
||||
* @return a set that only includes file name.
|
||||
*/
|
||||
public static Set<String> extractFileName(Collection<String> collection) {
|
||||
Set<String> moduleNameSet = new HashSet<String>();
|
||||
if (!collection.isEmpty()) {
|
||||
for (String module : collection) {
|
||||
if (module != null) {
|
||||
File moduleFile = new File(module);
|
||||
moduleNameSet.add(moduleFile.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return moduleNameSet;
|
||||
}
|
||||
}
|
||||
@@ -55,6 +55,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#add(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public boolean add(T o) {
|
||||
int index = this.list.size();
|
||||
fireAddedEvent(index, o, true);
|
||||
@@ -84,6 +85,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#add(int, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public void add(int index, T element) {
|
||||
fireAddedEvent(index, element, true);
|
||||
this.list.add(index, element);
|
||||
@@ -95,11 +97,18 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#addAll(java.util.Collection)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean addAll(Collection<? extends T> c) {
|
||||
fireAddedEvent(this.list.size(), (Collection<T>) c, null, true);
|
||||
return addAll(c, true, true);
|
||||
}
|
||||
|
||||
public boolean addAll(Collection<? extends T> c, boolean fireBefore, boolean fireAfter) {
|
||||
if (fireBefore) {
|
||||
fireAddedEvent(this.list.size(), (Collection<T>) c, null, true);
|
||||
}
|
||||
boolean returnValue = this.list.addAll(c);
|
||||
if (returnValue) {
|
||||
if (returnValue && fireAfter) {
|
||||
fireAddedEvent(this.list.size() - c.size(), (Collection<T>) c, null, false);
|
||||
}
|
||||
return returnValue;
|
||||
@@ -110,11 +119,18 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#addAll(int, java.util.Collection)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean addAll(int index, Collection<? extends T> c) {
|
||||
fireAddedEvent(index, (Collection<T>) c, null, true);
|
||||
return addAll(index, c, true, true);
|
||||
}
|
||||
|
||||
public boolean addAll(int index, Collection<? extends T> c, boolean fireBefore, boolean fireAfter) {
|
||||
if (fireBefore) {
|
||||
fireAddedEvent(index, (Collection<T>) c, null, true);
|
||||
}
|
||||
boolean returnValue = this.list.addAll(index, c);
|
||||
if (returnValue) {
|
||||
if (returnValue && fireAfter) {
|
||||
fireAddedEvent(index, (Collection<T>) c, null, false);
|
||||
}
|
||||
return returnValue;
|
||||
@@ -124,6 +140,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public void addAll(List<Integer> indices, Collection<? extends T> c) {
|
||||
|
||||
@@ -149,6 +166,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#clear()
|
||||
*/
|
||||
@Override
|
||||
public void clear() {
|
||||
fireClearedEvent(true);
|
||||
this.list.clear();
|
||||
@@ -172,6 +190,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
* @return whether the list contains the object.
|
||||
* @see #useEquals
|
||||
*/
|
||||
@Override
|
||||
public boolean contains(Object object) {
|
||||
|
||||
int size = list.size();
|
||||
@@ -205,6 +224,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
* @param object the object in question.
|
||||
* @return the position of the first occurrence of the object in the list.
|
||||
*/
|
||||
@Override
|
||||
public int indexOf(Object object) {
|
||||
int size = list.size();
|
||||
if (useEquals && object != null) {
|
||||
@@ -228,6 +248,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#containsAll(java.util.Collection)
|
||||
*/
|
||||
@Override
|
||||
public boolean containsAll(Collection<?> c) {
|
||||
return this.list.containsAll(c);
|
||||
}
|
||||
@@ -237,6 +258,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#get(int)
|
||||
*/
|
||||
@Override
|
||||
public T get(int index) {
|
||||
return this.list.get(index);
|
||||
}
|
||||
@@ -246,6 +268,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#isEmpty()
|
||||
*/
|
||||
@Override
|
||||
public boolean isEmpty() {
|
||||
return this.list.isEmpty();
|
||||
}
|
||||
@@ -255,6 +278,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#iterator()
|
||||
*/
|
||||
@Override
|
||||
public Iterator<T> iterator() {
|
||||
return new Iterator<T>() {
|
||||
|
||||
@@ -262,15 +286,18 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
|
||||
private T current = null;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return internalIterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
current = internalIterator.next();
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
Integer indexBeforeRemove = indexOf(current);
|
||||
fireBeforeRemovedEvent(indexBeforeRemove);
|
||||
@@ -286,6 +313,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#lastIndexOf(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int lastIndexOf(Object o) {
|
||||
return this.list.lastIndexOf(o);
|
||||
}
|
||||
@@ -295,6 +323,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#listIterator()
|
||||
*/
|
||||
@Override
|
||||
public ListIterator<T> listIterator() {
|
||||
return new ListIterator<T>() {
|
||||
|
||||
@@ -302,43 +331,52 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
|
||||
private T current = null;
|
||||
|
||||
@Override
|
||||
public void add(T o) {
|
||||
internalListIterator.add(o);
|
||||
fireAddedEvent(internalListIterator.previousIndex(), o, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasPrevious() {
|
||||
return internalListIterator.hasPrevious();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int nextIndex() {
|
||||
return internalListIterator.nextIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T previous() {
|
||||
current = internalListIterator.previous();
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int previousIndex() {
|
||||
return internalListIterator.previousIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void set(T o) {
|
||||
fireReplacedEvent(internalListIterator.previousIndex() + 1, current, o, true);
|
||||
internalListIterator.set(o);
|
||||
fireReplacedEvent(internalListIterator.previousIndex() + 1, current, o, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
return internalListIterator.hasNext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T next() {
|
||||
current = internalListIterator.next();
|
||||
return current;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
Integer indexBeforeRemove = internalListIterator.previousIndex() + 1;
|
||||
fireBeforeRemovedEvent(indexBeforeRemove);
|
||||
@@ -354,6 +392,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#listIterator(int)
|
||||
*/
|
||||
@Override
|
||||
public ListIterator<T> listIterator(int index) {
|
||||
return this.list.listIterator(index);
|
||||
}
|
||||
@@ -363,6 +402,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#remove(java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean remove(Object o) {
|
||||
int index = indexOf(o);
|
||||
@@ -378,6 +418,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#remove(int)
|
||||
*/
|
||||
@Override
|
||||
public T remove(int index) {
|
||||
fireBeforeRemovedEvent(index);
|
||||
T removedObject = this.list.remove(index);
|
||||
@@ -394,7 +435,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
private void fireRemovedEvent(int index, T removedObject) {
|
||||
if (afterListeners.size() != 0) {
|
||||
List<T> currentList = new ArrayList<T>(1);
|
||||
currentList.add((T) removedObject);
|
||||
currentList.add(removedObject);
|
||||
fireRemovedEvent(index, currentList, null, false);
|
||||
}
|
||||
}
|
||||
@@ -403,7 +444,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
if (beforeListeners.size() != 0) {
|
||||
T removingObject = this.list.get(index);
|
||||
List<T> currentList = new ArrayList<T>(1);
|
||||
currentList.add((T) removingObject);
|
||||
currentList.add(removingObject);
|
||||
fireRemovedEvent(index, currentList, null, true);
|
||||
}
|
||||
}
|
||||
@@ -415,12 +456,19 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
* @param collection the collection of objects to be removed.
|
||||
* @return whether any object was actually contained by the list.
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public boolean removeAll(Collection<?> collection) {
|
||||
return removeAll(collection, true, true);
|
||||
}
|
||||
|
||||
public boolean removeAll(Collection<?> collection, boolean fireBefore, boolean fireAfter) {
|
||||
|
||||
List<Integer> indices = getIndices(collection);
|
||||
|
||||
fireRemovedEvent(null, new ArrayList(collection), indices, true);
|
||||
if (fireBefore) {
|
||||
fireRemovedEvent(null, new ArrayList(collection), indices, true);
|
||||
}
|
||||
if (this.list == null) {
|
||||
return false;
|
||||
}
|
||||
@@ -429,7 +477,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
this.list.remove((int) indices.get(i));
|
||||
modified = true;
|
||||
}
|
||||
if (modified) {
|
||||
if (modified && fireAfter) {
|
||||
fireRemovedEvent(null, new ArrayList(collection), indices, false);
|
||||
}
|
||||
return modified;
|
||||
@@ -458,6 +506,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#retainAll(java.util.Collection)
|
||||
*/
|
||||
@Override
|
||||
public boolean retainAll(Collection<?> c) {
|
||||
List<T> all = new ArrayList<T>();
|
||||
all.addAll(this.list);
|
||||
@@ -481,6 +530,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#set(int, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public T set(int index, T element) {
|
||||
fireReplacedEvent(index, null, element, true);
|
||||
T replacedObject = this.list.set(index, element);
|
||||
@@ -493,6 +543,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#size()
|
||||
*/
|
||||
@Override
|
||||
public int size() {
|
||||
if (this.list != null) {
|
||||
return this.list.size();
|
||||
@@ -507,6 +558,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#subList(int, int)
|
||||
*/
|
||||
@Override
|
||||
public List<T> subList(int fromIndex, int toIndex) {
|
||||
if (this.list != null) {
|
||||
return this.list.subList(fromIndex, toIndex);
|
||||
@@ -520,6 +572,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#toArray()
|
||||
*/
|
||||
@Override
|
||||
public Object[] toArray() {
|
||||
if (this.list != null) {
|
||||
return this.list.toArray();
|
||||
@@ -533,6 +586,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @see java.util.List#toArray(T[])
|
||||
*/
|
||||
@Override
|
||||
@SuppressWarnings("hiding")
|
||||
public <T> T[] toArray(T[] a) {
|
||||
if (this.list != null) {
|
||||
@@ -542,6 +596,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swap(int index1, int index2) {
|
||||
|
||||
ArrayList<Integer> indexList1 = new ArrayList<Integer>(1);
|
||||
@@ -579,6 +634,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swapElements(List<Integer> indicesOrigin, List<Integer> indicesTarget) {
|
||||
if (indicesOrigin.size() != indicesTarget.size()) {
|
||||
throw new IllegalArgumentException(Messages.getString("ListenableList.IndexSameLength.Error")); //$NON-NLS-1$
|
||||
@@ -596,6 +652,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
fireSwapedEvent(indicesOrigin, indicesTarget, swapedObjects.toArray(), false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void swapElement(T object1, T object2) {
|
||||
swap(indexOf(object1), indexOf(object2));
|
||||
}
|
||||
@@ -825,6 +882,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @return the useEquals
|
||||
*/
|
||||
@Override
|
||||
public boolean isUseEquals() {
|
||||
return this.useEquals;
|
||||
}
|
||||
@@ -834,6 +892,7 @@ public class ListenableList<T> implements IExtendedList<T> {
|
||||
*
|
||||
* @param useEquals the useEquals to set
|
||||
*/
|
||||
@Override
|
||||
public void setUseEquals(boolean useEquals) {
|
||||
this.useEquals = useEquals;
|
||||
}
|
||||
|
||||
@@ -1,263 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.data.reflection;
|
||||
|
||||
import java.lang.reflect.Array;
|
||||
import java.lang.reflect.Constructor;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*
|
||||
* General reflection utils.
|
||||
*
|
||||
*/
|
||||
public class ReflectionUtils {
|
||||
|
||||
private static Logger log = Logger.getLogger(ReflectionUtils.class.getName());
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "getPublicField".
|
||||
*
|
||||
* Returns the value of a public field.
|
||||
*
|
||||
* @param owner
|
||||
* @param fieldName
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Object getPublicField(Object owner, String fieldName) {
|
||||
Object fieldValue = null;
|
||||
Class ownerClass = owner.getClass();
|
||||
try {
|
||||
Field field = ownerClass.getField(fieldName);
|
||||
fieldValue = field.get(owner);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "getPrivateField".
|
||||
*
|
||||
* Returns the value of a private field.
|
||||
*
|
||||
* @param owner
|
||||
* @param fieldName
|
||||
* @return
|
||||
*/
|
||||
public static Object getPrivateField(Object owner, String fieldName) {
|
||||
Object fieldValue = null;
|
||||
Class ownerClass = owner.getClass();
|
||||
try {
|
||||
Field f = ownerClass.getDeclaredField(fieldName);
|
||||
f.setAccessible(true);
|
||||
fieldValue = f.get(owner);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "getStaticField".
|
||||
*
|
||||
* Returns the value of a static field.
|
||||
*
|
||||
* @param className
|
||||
* @param loader
|
||||
* @param fieldName
|
||||
* @return
|
||||
*/
|
||||
public static Object getStaticField(String className, ClassLoader loader, String fieldName) {
|
||||
Object fieldValue = null;
|
||||
try {
|
||||
Class ownerClass = null;
|
||||
if (loader != null) {
|
||||
ownerClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
ownerClass = Class.forName(className);
|
||||
}
|
||||
Field field = ownerClass.getField(fieldName);
|
||||
fieldValue = field.get(ownerClass);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return fieldValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* To set the field using the given <code>value</code>.
|
||||
* Added by Marvin Wang on Oct 19, 2012.
|
||||
*/
|
||||
public static void setStaticFieldValue(String className, ClassLoader loader, String fieldName, Object value){
|
||||
try {
|
||||
Class ownerClass = null;
|
||||
if (loader != null) {
|
||||
ownerClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
ownerClass = Class.forName(className);
|
||||
}
|
||||
Field field = ownerClass.getDeclaredField(fieldName);
|
||||
field.setAccessible(true);
|
||||
field.set(null, value);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public static Object getStaticField(String className, String fieldName) {
|
||||
return getStaticField(className, null, fieldName);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "invokeMethod".
|
||||
*
|
||||
* Returns the value of a method.
|
||||
*
|
||||
* @param owner
|
||||
* @param methodName
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
public static Object invokeMethod(Object owner, String methodName, Object[] args) {
|
||||
Object returnValue = null;
|
||||
Class ownerClass = owner.getClass();
|
||||
Class[] argsClass = new Class[args.length];
|
||||
for (int i = 0, j = args.length; i < j; i++) {
|
||||
argsClass[i] = args[i].getClass();
|
||||
}
|
||||
try {
|
||||
Method method = ownerClass.getMethod(methodName, argsClass);
|
||||
returnValue = method.invoke(owner, args);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "invokeStaticMethod".
|
||||
*
|
||||
* Returns the value of a static method.
|
||||
*
|
||||
* @param className
|
||||
* @param loader
|
||||
* @param methodName
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
public static Object invokeStaticMethod(String className, ClassLoader loader, String methodName, Object[] args) {
|
||||
Object returnValue = null;
|
||||
try {
|
||||
Class ownerClass = null;
|
||||
if (loader != null) {
|
||||
ownerClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
ownerClass = Class.forName(className);
|
||||
}
|
||||
Class[] argsClass = new Class[args.length];
|
||||
for (int i = 0, j = args.length; i < j; i++) {
|
||||
argsClass[i] = args[i].getClass();
|
||||
}
|
||||
Method method = ownerClass.getMethod(methodName, argsClass);
|
||||
returnValue = method.invoke(null, args);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return returnValue;
|
||||
}
|
||||
|
||||
public static Object invokeStaticMethod(String className, String methodName, Object[] args) {
|
||||
return invokeStaticMethod(className, null, methodName, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "newInstance".
|
||||
*
|
||||
* Create a new instance of a class.
|
||||
*
|
||||
* @param className
|
||||
* @param initialize
|
||||
* @param loader
|
||||
* @param args
|
||||
* @return
|
||||
*/
|
||||
public static Object newInstance(String className, ClassLoader loader, Object[] args) {
|
||||
Object instance = null;
|
||||
try {
|
||||
Class newClass = null;
|
||||
if (loader != null) {
|
||||
newClass = Class.forName(className, true, loader);
|
||||
} else {
|
||||
newClass = Class.forName(className);
|
||||
}
|
||||
Class[] argsClass = new Class[args.length];
|
||||
for (int i = 0, j = args.length; i < j; i++) {
|
||||
argsClass[i] = args[i].getClass();
|
||||
}
|
||||
Constructor cons = newClass.getConstructor(argsClass);
|
||||
instance = cons.newInstance(args);
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
public static Object newInstance(String className, Object[] args) {
|
||||
return newInstance(className, null, args);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "isInstance".
|
||||
*
|
||||
* Whether or not the object is the instance of the class.
|
||||
*
|
||||
* @param obj
|
||||
* @param cls
|
||||
* @return
|
||||
*/
|
||||
public static boolean isInstance(Object obj, Class cls) {
|
||||
return cls.isInstance(obj);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "getByArray".
|
||||
*
|
||||
* Returns the value of a element of a array by the index.
|
||||
*
|
||||
* @param array
|
||||
* @param index
|
||||
* @return
|
||||
*/
|
||||
public static Object getByArray(Object array, int index) {
|
||||
return Array.get(array, index);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,141 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.database;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
import org.talend.commons.utils.TalendDBUtils;
|
||||
import org.talend.fakejdbc.FakeResultSet;
|
||||
|
||||
/**
|
||||
* created by xqliu on Oct 26, 2012 Detailled comment
|
||||
*
|
||||
*/
|
||||
public class SybaseResultSet extends FakeResultSet {
|
||||
|
||||
private String[] tableMeta = null;
|
||||
|
||||
private List<String[]> data;
|
||||
|
||||
int index = -1;
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#next()
|
||||
*/
|
||||
@Override
|
||||
public boolean next() throws SQLException {
|
||||
if (data == null || data.size() == 0 || index >= data.size() - 1) {
|
||||
return false;
|
||||
}
|
||||
index++;
|
||||
return true;
|
||||
}
|
||||
|
||||
public static int indexOf(String string, String[] search) {
|
||||
for (int i = 0; i < search.length; i++) {
|
||||
if (search[i].equals(string)) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getString(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public String getString(String columnLabel) throws SQLException {
|
||||
int columnIndex = indexOf(columnLabel, tableMeta);
|
||||
|
||||
if (columnIndex == -1) {
|
||||
throw new SQLException(Messages.getString("SybaseResultSet.unknowCloumn") + columnLabel); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
return getString(columnIndex + 1);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getInt(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public int getInt(String columnLabel) throws SQLException {
|
||||
int value = 0;
|
||||
String str = getString(columnLabel);
|
||||
if (columnLabel.equals("TYPE_NAME")) { //$NON-NLS-1$
|
||||
value = TalendDBUtils.convertToJDBCType(str);
|
||||
} else if (columnLabel.equals("IS_NULLABLE")) { //$NON-NLS-1$
|
||||
if (str.equals("N")) { //$NON-NLS-1$
|
||||
value = 1;
|
||||
} else {
|
||||
value = 0;
|
||||
}
|
||||
} else {
|
||||
value = Integer.parseInt(str);
|
||||
}
|
||||
return value;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getBoolean(java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public boolean getBoolean(String columnLabel) throws SQLException {
|
||||
String str = getString(columnLabel);
|
||||
return Boolean.parseBoolean(str);
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeResultSet#getString(int)
|
||||
*/
|
||||
@Override
|
||||
public String getString(int columnIndex) throws SQLException {
|
||||
String[] row = data.get(index);
|
||||
columnIndex--;
|
||||
|
||||
if (columnIndex < 0 || columnIndex > row.length) {
|
||||
throw new SQLException(
|
||||
Messages.getString("SybaseResultSet.parameterIndex") + columnIndex + Messages.getString("SybaseResultSet.outofRange")); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
}
|
||||
return row[columnIndex];
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC bqian Comment method "setMetadata".
|
||||
*
|
||||
* @param table_meta
|
||||
*/
|
||||
public void setMetadata(String[] tableMeta) {
|
||||
this.tableMeta = tableMeta;
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC bqian Comment method "setData".
|
||||
*
|
||||
* @param tables
|
||||
*/
|
||||
public void setData(List<String[]> data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
@@ -61,7 +61,7 @@ public class MemoryMeasurer {
|
||||
* @return the difference between the used memory at beginning and at end of measure
|
||||
*/
|
||||
public long step() {
|
||||
boolean useGCBeforeMeasure = true;
|
||||
boolean useGCBeforeMeasure = false;
|
||||
return step(useGCBeforeMeasure);
|
||||
}
|
||||
|
||||
@@ -129,7 +129,7 @@ public class MemoryMeasurer {
|
||||
*
|
||||
*/
|
||||
public void printUsedMemory(String contextInfo) {
|
||||
callGC();
|
||||
callMultipleGC();
|
||||
String formated = String.format("%,d", getUsedMemoryFromBeginToCurrent(false));
|
||||
System.out.println((contextInfo != null ? contextInfo + " : " : "") + formated + " bytes");
|
||||
}
|
||||
@@ -146,9 +146,19 @@ public class MemoryMeasurer {
|
||||
return usedMemory - usedMemoryAtBeginning;
|
||||
}
|
||||
|
||||
private void callGC() {
|
||||
private void callMultipleGC() {
|
||||
Runtime runtime = Runtime.getRuntime();
|
||||
runtime.gc();
|
||||
// runtime.gc();
|
||||
// runtime.gc();
|
||||
// runtime.gc();
|
||||
// runtime.gc();
|
||||
// runtime.gc();
|
||||
// runtime.gc();
|
||||
// runtime.gc();
|
||||
// runtime.gc();
|
||||
// runtime.gc();
|
||||
// runtime.gc();
|
||||
}
|
||||
|
||||
public void printInformations() {
|
||||
|
||||
@@ -73,5 +73,4 @@ public final class PluginChecker {
|
||||
public static boolean isOnlyTopLoaded() {
|
||||
return isPluginLoaded(TOP_BRANDING) && !isTDCPLoaded() && !isTDQLoaded();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -66,9 +66,8 @@ public class EclipseCommandLine {
|
||||
* the command with value, except if value is null then the command shall be removed.
|
||||
*
|
||||
* @param command the command to add or update or remove (if value is null) (usually starts with a -)
|
||||
* @param value the value of the command,if the value is null,will only update the commmand
|
||||
* @param value the value of the command,if the value is null,will only update the commmanden
|
||||
* @param delete the flag used to trigger delete or insert/update the command
|
||||
* @param isOption this flag used to trigger for the option command without any arguments.
|
||||
*/
|
||||
static public void updateOrCreateExitDataPropertyWithCommand(String command, String value, boolean delete, boolean isOption) {
|
||||
boolean isValueNull = false;
|
||||
@@ -76,21 +75,19 @@ public class EclipseCommandLine {
|
||||
isValueNull = true;
|
||||
}
|
||||
StringBuffer result = new StringBuffer(512);
|
||||
|
||||
String currentProperty = System.getProperty(org.eclipse.equinox.app.IApplicationContext.EXIT_DATA_PROPERTY);
|
||||
String patternStr = "\\s+.+\\s"; //$NON-NLS-1$
|
||||
String patternStr = "\\s+.+\\s"; //$NON-NLS-1$
|
||||
// if the command is only one option. should only process the command without arguments.
|
||||
if (isOption) {
|
||||
patternStr = "\\s+"; //$NON-NLS-1$
|
||||
patternStr = "\\s+"; //$NON-NLS-1$
|
||||
}
|
||||
|
||||
String currentProperty = System.getProperty(org.eclipse.equinox.app.IApplicationContext.EXIT_DATA_PROPERTY);
|
||||
if (currentProperty != null) {// update the property
|
||||
Pattern commandPattern = Pattern.compile(command + patternStr);// -talendRestart\s+.+\s
|
||||
Matcher restartMatcher = commandPattern.matcher(currentProperty);
|
||||
|
||||
if (delete) {// if delete,no matter the value is null or not,remove the command directly
|
||||
if (restartMatcher.find()) {// match found so remove it
|
||||
currentProperty = restartMatcher.replaceAll(""); //$NON-NLS-1$
|
||||
currentProperty = restartMatcher.replaceAll("");//$NON-NLS-1$
|
||||
} // else no match so do nothing
|
||||
} else {// else add or update the command
|
||||
// try to find existing commands to update them
|
||||
@@ -101,7 +98,7 @@ public class EclipseCommandLine {
|
||||
// because no arguments, if have been existed, so ignore.
|
||||
} else {
|
||||
currentProperty = restartMatcher.replaceAll(command + EclipseCommandLine.NEW_LINE
|
||||
+ (isValueNull ? "" : value + EclipseCommandLine.NEW_LINE));
|
||||
+ (isValueNull ? "" : value + EclipseCommandLine.NEW_LINE));//$NON-NLS-1$
|
||||
}
|
||||
} else {// no match so insert it before the CMD_VMARGS
|
||||
int indexOfVmArgs = currentProperty.indexOf(CMD_VMARGS);
|
||||
|
||||
@@ -14,9 +14,7 @@ package org.talend.commons.utils.threading.lockerbykey;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
@@ -42,7 +40,7 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
|
||||
|
||||
private static Logger log = Logger.getLogger(LockerByKey.class);
|
||||
|
||||
private ConcurrentHashMap<InternalKeyLock<KP>, LockerValue<KP>> mapKeyLockToValueLock = new ConcurrentHashMap<InternalKeyLock<KP>, LockerValue<KP>>();
|
||||
ConcurrentHashMap<InternalKeyLock<KP>, LockerValue<KP>> mapKeyLockToValueLock = new ConcurrentHashMap<InternalKeyLock<KP>, LockerValue<KP>>();
|
||||
|
||||
private final Object lockAllOperations = new Object();
|
||||
|
||||
@@ -589,13 +587,4 @@ public class LockerByKey<KP> implements ILockerByKey<KP> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for mapKeyLockToValueLock.
|
||||
*
|
||||
* @return the mapKeyLockToValueLock
|
||||
*/
|
||||
Map<InternalKeyLock<KP>, LockerValue<KP>> getMapKeyLockToValueLock() {
|
||||
return new HashMap<InternalKeyLock<KP>, LockerValue<KP>>(mapKeyLockToValueLock);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -572,7 +572,7 @@ public class LockerByKeyUnrestricted<KP> implements ILockerByKey<KP> {
|
||||
blockAllOperations();
|
||||
boolean breakAtNext = false;
|
||||
while (true) {
|
||||
Collection<LockerValue<KP>> values = locker.getMapKeyLockToValueLock().values();
|
||||
Collection<LockerValue<KP>> values = locker.mapKeyLockToValueLock.values();
|
||||
int waitingThreads = 0;
|
||||
for (LockerValue<KP> lockerValue : values) {
|
||||
waitingThreads += lockerValue.getLock().getQueueLength();
|
||||
|
||||
@@ -46,7 +46,7 @@ public class TimeMeasure {
|
||||
|
||||
public static boolean isLogToFile = false;
|
||||
|
||||
public static boolean printMemoryUsed = false;
|
||||
public static boolean printMemoryUsed = true;
|
||||
|
||||
public static ITimeMeasureLogger logger;
|
||||
|
||||
@@ -107,18 +107,7 @@ public class TimeMeasure {
|
||||
}
|
||||
long totalElapsedTime = timeStack.getTotalElapsedTime();
|
||||
if (display) {
|
||||
if (printMemoryUsed) {
|
||||
// GC must be forced when check memory, or we can't mesure the difference
|
||||
Runtime.getRuntime().gc();
|
||||
long usedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
|
||||
System.out.println(indent(indent)
|
||||
+ "End '" + idTimer + "', total elapsed time: " + totalElapsedTime + " ms, " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ " current memory [" + usedMemory + "] bytes"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} else {
|
||||
System.out
|
||||
.println(indent(indent) + "End '" + idTimer + "', total elapsed time: " + totalElapsedTime + " ms "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
System.out.println(indent(indent) + "End '" + idTimer + "', total elapsed time: " + totalElapsedTime + " ms "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
indent--;
|
||||
if (isLogToFile && logger != null) {
|
||||
@@ -149,16 +138,7 @@ public class TimeMeasure {
|
||||
} else {
|
||||
long time = timers.get(idTimer).getTotalElapsedTime();
|
||||
if (display) {
|
||||
if (printMemoryUsed) {
|
||||
// GC must be forced when check memory, or we can't mesure the difference
|
||||
Runtime.getRuntime().gc();
|
||||
long usedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
|
||||
System.out.println(indent(indent) + "-> '" + idTimer + "', elapsed time since start: " + time + " ms," //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ " current memory [" + usedMemory + "] bytes"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} else {
|
||||
System.out.println(indent(indent) + "-> '" + idTimer + "', elapsed time since start: " + time + " ms "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
System.out.println(indent(indent) + "-> '" + idTimer + "', elapsed time since start: " + time + " ms "); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
return time;
|
||||
}
|
||||
@@ -192,21 +172,9 @@ public class TimeMeasure {
|
||||
Date now = ca.getTime();
|
||||
long time = timeStack.getLastStepElapsedTime();
|
||||
if (display && displaySteps) {
|
||||
long usedMemory = 0;
|
||||
if (printMemoryUsed) {
|
||||
// GC must be forced when check memory, or we can't mesure the difference
|
||||
Runtime.getRuntime().gc();
|
||||
usedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
}
|
||||
String timerStepName = idTimer + "', step name '" + stepName; //$NON-NLS-1$
|
||||
if (printMemoryUsed) {
|
||||
System.out.println(indent(indent)
|
||||
+ "-> '" + timerStepName + "', elapsed time since previous step: " + time + " ms," + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
" current memory [" + usedMemory + "] bytes"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
} else {
|
||||
System.out.println(indent(indent)
|
||||
+ "-> '" + timerStepName + "', elapsed time since previous step: " + time + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
String timerStepName = idTimer + "', step name '" + stepName;
|
||||
System.out.println(indent(indent)
|
||||
+ "-> '" + timerStepName + "', elapsed time since previous step: " + time + " ms "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||
if (isLogToFile) {
|
||||
boolean foundTimerKey = false;
|
||||
for (String keyTimer : logValue.keySet()) {
|
||||
@@ -221,6 +189,9 @@ public class TimeMeasure {
|
||||
newRowValue.put(ELogFileColumnConstant.TIME_USED.locationY, time);
|
||||
// memory used
|
||||
if (printMemoryUsed) {
|
||||
// GC must be forced when check memory, or we can't mesure the difference
|
||||
Runtime.getRuntime().gc();
|
||||
long usedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
newRowValue.put(ELogFileColumnConstant.MEMO_USED.locationY, usedMemory);
|
||||
}
|
||||
// current time
|
||||
@@ -240,6 +211,9 @@ public class TimeMeasure {
|
||||
newRowValue.put(ELogFileColumnConstant.TIME_USED.locationY, time);
|
||||
// memory used
|
||||
if (printMemoryUsed) {
|
||||
// GC must be forced when check memory, or we can't mesure the difference
|
||||
Runtime.getRuntime().gc();
|
||||
long usedMemory = Runtime.getRuntime().totalMemory() - Runtime.getRuntime().freeMemory();
|
||||
newRowValue.put(ELogFileColumnConstant.MEMO_USED.locationY, usedMemory);
|
||||
}
|
||||
// current time
|
||||
@@ -268,7 +242,6 @@ public class TimeMeasure {
|
||||
// long time = times.getElapsedTimeSinceLastRequest();
|
||||
time.pause();
|
||||
if (display) {
|
||||
// do nothing... yet
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -286,10 +259,9 @@ public class TimeMeasure {
|
||||
return;
|
||||
} else {
|
||||
TimeStack times = timers.get(idTimer);
|
||||
// long time = times.getLastStepElapsedTime();
|
||||
long time = times.getLastStepElapsedTime();
|
||||
times.resume();
|
||||
if (display) {
|
||||
// do nothing... yet
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,11 +286,11 @@ public class TimeMeasure {
|
||||
/* this enum define the attributes of columns in a log file */
|
||||
public enum ELogFileColumnConstant {
|
||||
|
||||
TITLE(0, 0, "Welcome to CommandLine performance test"), //$NON-NLS-1$
|
||||
STEP(0, 1, "Step"), //$NON-NLS-1$
|
||||
TIME_USED(1, 1, "TimeUsed(ms)"), //$NON-NLS-1$
|
||||
MEMO_USED(2, 1, "memoryUsed(bytes)"), //$NON-NLS-1$
|
||||
TIMETRACE(3, 1, "timeLine"); //$NON-NLS-1$
|
||||
TITLE(0, 0, "Welcome to CommandLine performance test"), //$NON-NLS-N$
|
||||
STEP(0, 1, "Step"), //$NON-NLS-N$
|
||||
TIME_USED(1, 1, "TimeUsed(ms)"), //$NON-NLS-N$
|
||||
MEMO_USED(2, 1, "memoryUsed(bytes)"), //$NON-NLS-N$
|
||||
TIMETRACE(3, 1, "timeLine");//$NON-NLS-N$
|
||||
|
||||
public int locationY;
|
||||
|
||||
|
||||
@@ -1 +0,0 @@
|
||||
talend.version=5.2.0
|
||||
@@ -1,79 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.help;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* DOC xqliu class global comment. Detailled comment
|
||||
*/
|
||||
public class UnitTestBuildCommonHelper {
|
||||
|
||||
/**
|
||||
* create a new file under the parent.
|
||||
*
|
||||
* @param parentPath parent path, if it is null create a new file under the default location
|
||||
* @param fileName file name with extension (don't include the path)
|
||||
* @param createIt create it if it is not exists
|
||||
* @return
|
||||
*/
|
||||
public static File createRealFile(String parentPath, String fileName, boolean createIt) {
|
||||
String path = parentPath == null ? System.getProperty("user.dir") : parentPath; //$NON-NLS-1$
|
||||
if (!path.endsWith(File.separator)) {
|
||||
path += File.separator;
|
||||
}
|
||||
File file = new File(path + fileName);
|
||||
if (createIt) {
|
||||
if (!file.exists()) {
|
||||
File folder = new File(path);
|
||||
if (folder.exists()) {
|
||||
if (!folder.isDirectory()) {
|
||||
folder.delete();
|
||||
folder.mkdirs();
|
||||
}
|
||||
} else {
|
||||
folder.mkdirs();
|
||||
}
|
||||
try {
|
||||
file.createNewFile();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
|
||||
/**
|
||||
* create a new folder under the parent.
|
||||
*
|
||||
* @param parentPath parent path, if it is null create a new folder under the default location
|
||||
* @param folderName file name (don't include the path)
|
||||
* @param createIt create it if it is not exists
|
||||
* @return
|
||||
*/
|
||||
public static File createRealFolder(String parentPath, String folderName, boolean createIt) {
|
||||
String path = parentPath == null ? System.getProperty("user.dir") : parentPath; //$NON-NLS-1$
|
||||
if (!path.endsWith(File.separator)) {
|
||||
path += File.separator;
|
||||
}
|
||||
File file = new File(path + folderName);
|
||||
if (createIt) {
|
||||
if (!file.exists()) {
|
||||
file.mkdirs();
|
||||
}
|
||||
}
|
||||
return file;
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.commons.utils.io;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.talend.commons.utils.help.UnitTestBuildCommonHelper;
|
||||
|
||||
/**
|
||||
* DOC xqliu class global comment. Detailled comment
|
||||
*/
|
||||
public class FilesUtilsRealTest {
|
||||
|
||||
/**
|
||||
* Test method for {@link org.talend.commons.utils.io.FilesUtils#renameFolder(java.io.File, java.io.File)}
|
||||
*/
|
||||
@Test
|
||||
public void testRenameFolder() {
|
||||
String folderName1 = "test_folder_name"; //$NON-NLS-1$
|
||||
String folderName2 = "test_folder_name_rename"; //$NON-NLS-1$
|
||||
String fileName = "test_file_name.tdq"; //$NON-NLS-1$
|
||||
|
||||
File folder1 = UnitTestBuildCommonHelper.createRealFolder(null, folderName1, true);
|
||||
File file = UnitTestBuildCommonHelper.createRealFile(folder1.getAbsolutePath(), fileName, true);
|
||||
|
||||
File[] listFiles = folder1.listFiles();
|
||||
boolean b = false;
|
||||
for (File f : listFiles) {
|
||||
if (f.getAbsolutePath().equals(file.getAbsolutePath())) {
|
||||
b = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue(b);
|
||||
|
||||
String folder1Path = folder1.getAbsolutePath();
|
||||
int i = folder1Path.lastIndexOf(File.separator);
|
||||
File folder2 = new File(folder1Path.substring(0, i) + File.separator + folderName2);
|
||||
|
||||
FilesUtils.renameFolder(folder1, folder2);
|
||||
|
||||
assertFalse(folder1.exists());
|
||||
assertTrue(folder2.exists());
|
||||
|
||||
File[] listFiles2 = folder2.listFiles();
|
||||
boolean b2 = false;
|
||||
for (File f : listFiles2) {
|
||||
if (f.getName().equals(file.getName())) {
|
||||
b2 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
assertTrue(b2);
|
||||
|
||||
FilesUtils.deleteFile(folder2, true);
|
||||
assertFalse(folder2.exists());
|
||||
}
|
||||
}
|
||||
@@ -15,7 +15,7 @@ ImportPushButton.ImportButton.Tip=\u3059\u3079\u3066\u306e\u884c\u3092xml\u30d5\
|
||||
LabelledFileField.FileDialog.Text=\u9078\u629E
|
||||
ModelSelectionDialog.Option=\u30AA\u30D7\u30B7\u30E7\u30F3
|
||||
ModelSelectionDialog.Update=\u30EA\u30DD\u30B8\u30C8\u30EA\u63A5\u7D9A\u306E\u66F4\u65B0\u3002
|
||||
TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304CNULL\u5024\u3067\u3059
|
||||
TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304Cnull\u3067\u3059
|
||||
ModelSelectionDialog.Title=\u30EA\u30DD\u30B8\u30C8\u30EA\u3092\u4F7F\u7528\u3057\u3066\u30D1\u30E9\u30E1\u30FC\u30BF\u306E\u7DE8\u96C6
|
||||
AddAllPushButton.AddAllButton.Tip=\u3059\u3079\u3066\u8ffd\u52a0
|
||||
ExtendedTableRemoveCommand.Romve.Label=\u30C6\u30FC\u30D6\u30EB\u30A8\u30F3\u30C8\u30EA\u306E\u524A\u9664
|
||||
|
||||
@@ -2,6 +2,7 @@ commons.error=Fout
|
||||
AddPushButton.AddButton.Tip=Toevoegen
|
||||
LabelledFileField.BrowseButton.Text=Blader...
|
||||
DialogErrorForCellEditorListener.Error.MsgDialogTitle=Fout
|
||||
DateDialog.textContent=Selecteer datum & tijd
|
||||
EventUtil.modify=Wijzigen
|
||||
EventUtil.move=Verplaatsen
|
||||
EventUtil.show=Toon
|
||||
|
||||
@@ -56,7 +56,7 @@ public abstract class ExtendedTablePasteCommand extends Command implements IExte
|
||||
*
|
||||
* @see org.eclipse.gef.commands.Command#execute()
|
||||
*/
|
||||
@SuppressWarnings("unchecked")//$NON-NLS-1$
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public void execute() {
|
||||
|
||||
|
||||
@@ -20,7 +20,6 @@ import org.eclipse.swt.widgets.Button;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.commands.ExtendedTableCopyCommand;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedControlModel;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedControlViewer;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedButtonEvent;
|
||||
|
||||
@@ -47,17 +47,20 @@ public class ErrorDialogWidthDetailArea {
|
||||
* @param detailMessage (\n an \t are interpreted ; \r are deleted)
|
||||
*/
|
||||
public ErrorDialogWidthDetailArea(Shell shell, String pid, String mainMessage, String detailMessage) {
|
||||
this(shell, pid, mainMessage, detailMessage, IStatus.INFO);
|
||||
}
|
||||
|
||||
public ErrorDialogWidthDetailArea(Shell shell, String pid, String mainMessage, String detailMessage, int status) {
|
||||
MultiStatus info = new MultiStatus(pid, 1, mainMessage, null);
|
||||
if (detailMessage != null) {
|
||||
String[] lines = detailMessage.split("\n"); //$NON-NLS-1$
|
||||
for (int i = 0; i < lines.length; i++) {
|
||||
info
|
||||
.add(new Status(IStatus.INFO, pid, 1, lines[i].replaceAll("\t", " ").replaceAll("\r", ""), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
null));
|
||||
for (String line : lines) {
|
||||
info.add(new Status(status, pid, 1, line.replaceAll("\t", " ").replaceAll("\r", ""), //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
null));
|
||||
}
|
||||
}
|
||||
codeOfButton = ErrorDialog.openError(shell, Messages.getString("ErrorDialogWidthDetailArea.ErrorMessage.Text"), //$NON-NLS-1$
|
||||
null, info); //$NON-NLS-1$
|
||||
null, info);
|
||||
}
|
||||
|
||||
public int getCodeOfButton() {
|
||||
|
||||
@@ -115,11 +115,15 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
|
||||
* @param index can be null
|
||||
*/
|
||||
public void addAll(final Integer index, List<B> beans) {
|
||||
addAll(index, beans, true, true);
|
||||
}
|
||||
|
||||
public void addAll(final Integer index, List<B> beans, boolean fireBefore, boolean fireAfter) {
|
||||
if (index == null || index < 0 || index > this.beansList.size() - 1) {
|
||||
if (tableViewer != null && !tableViewer.getTable().isDisposed()) {
|
||||
tableViewer.add(beans.toArray(new Object[beans.size()]));
|
||||
}
|
||||
this.beansList.addAll(beans);
|
||||
this.beansList.addAll(beans, fireBefore, fireAfter);
|
||||
} else {
|
||||
if (tableViewer != null && !tableViewer.getTable().isDisposed()) {
|
||||
int localIndex = index;
|
||||
@@ -128,7 +132,7 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
|
||||
tableViewer.insert(beans.get(i), localIndex++);
|
||||
}
|
||||
}
|
||||
this.beansList.addAll(index, beans);
|
||||
this.beansList.addAll(index, beans, fireBefore, fireAfter);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,6 +156,10 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
|
||||
addAll((Integer) null, beans);
|
||||
}
|
||||
|
||||
public void addAll(List<B> beans, boolean fireBefore, boolean fireAfter) {
|
||||
addAll((Integer) null, beans, fireBefore, fireAfter);
|
||||
}
|
||||
|
||||
public void registerDataList(List<B> list) {
|
||||
this.beansList.registerList(list);
|
||||
}
|
||||
@@ -162,8 +170,9 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
|
||||
|
||||
public void addBeans(B b) {
|
||||
if (this.beansList.contains(b)) {
|
||||
} else
|
||||
} else {
|
||||
this.beansList.add(b);
|
||||
}
|
||||
}
|
||||
|
||||
public void setUseEquals(boolean useEquals) {
|
||||
@@ -200,10 +209,14 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
|
||||
* @see org.talend.commons.utils.data.list.ListenableList#removeAll(java.util.Collection)
|
||||
*/
|
||||
public boolean removeAll(Collection<B> c) {
|
||||
return removeAll(c, true, true);
|
||||
}
|
||||
|
||||
public boolean removeAll(Collection<B> c, boolean fireBefor, boolean fireAfter) {
|
||||
if (tableViewer != null && !tableViewer.getTable().isDisposed()) {
|
||||
tableViewer.remove(c.toArray(new Object[c.size()]));
|
||||
}
|
||||
return this.beansList.removeAll(c);
|
||||
return this.beansList.removeAll(c, fireBefor, fireAfter);
|
||||
}
|
||||
|
||||
public void removeAll() {
|
||||
@@ -277,8 +290,8 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
|
||||
*/
|
||||
public List<B> remove(int[] indexArray) {
|
||||
ArrayList<B> objectsToRemove = new ArrayList<B>(indexArray.length);
|
||||
for (int i = 0; i < indexArray.length; i++) {
|
||||
objectsToRemove.add(beansList.get(indexArray[i]));
|
||||
for (int element : indexArray) {
|
||||
objectsToRemove.add(beansList.get(element));
|
||||
}
|
||||
removeAll(objectsToRemove);
|
||||
return objectsToRemove;
|
||||
@@ -344,6 +357,7 @@ public class ExtendedTableModel<B> extends AbstractExtendedControlModel {
|
||||
this.modifiedBeanListenable = modifiedBeanListenable;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDataRegistered() {
|
||||
return beansList.isListRegistered();
|
||||
}
|
||||
|
||||
@@ -349,10 +349,6 @@ public class LabelledText {
|
||||
return text.getEditable();
|
||||
}
|
||||
|
||||
public boolean getEnable() {
|
||||
return text.isEnabled();
|
||||
}
|
||||
|
||||
/**
|
||||
* getCharCount to Text Object.
|
||||
*
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.GC;
|
||||
@@ -99,7 +100,7 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
LinkableTree linkableTree = new LinkableTree(this, backgroundRefresher, targetTree, this, false);
|
||||
targetTree.removeSelectionListener(linkableTree.getSelectionListener());
|
||||
|
||||
new LinkableTable(this, backgroundRefresher, sourceTable, (BgDrawableComposite) this, true);
|
||||
new LinkableTable(this, backgroundRefresher, sourceTable, this, true);
|
||||
this.target = targetTree;
|
||||
this.source = sourceTable;
|
||||
|
||||
@@ -227,7 +228,7 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
IExtremityLink<Tree, D2> extremity2 = link.getExtremity2();
|
||||
// see bug 7360
|
||||
dataToTableItemCache.clear();
|
||||
TableItem tableItem = dataToTableItemCache.getTableItem((Object) extremity1.getDataItem());
|
||||
TableItem tableItem = dataToTableItemCache.getTableItem(extremity1.getDataItem());
|
||||
TableItem firstExpandedAscTableItem = tableItem;
|
||||
|
||||
Rectangle tableItemBounds = firstExpandedAscTableItem.getBounds();
|
||||
@@ -302,6 +303,12 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
pointEndCentralCurve.x += offset.x - 6;
|
||||
pointEndCentralCurve.y += offset.y;
|
||||
|
||||
// Added by Marvin Wang on Nov. 28, 2012 for bug TDI-23378. This is not the best way to fix this issue,
|
||||
// but till now I have not found the root cause.
|
||||
if (Platform.OS_LINUX.equals(Platform.getOS())) {
|
||||
pointEndCentralCurve.y = pointEndCentralCurve.y - tableItem.getBounds().height;
|
||||
}
|
||||
|
||||
drawableLink.setPoint1(pointEndStraight);
|
||||
drawableLink.setPoint2(pointEndCentralCurve);
|
||||
|
||||
@@ -326,8 +333,8 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
* @return
|
||||
*/
|
||||
private int findXRightStartBezierLink(TableItem[] items, int maxWidth) {
|
||||
for (int i = 0; i < items.length; i++) {
|
||||
TableItem item = items[i];
|
||||
for (TableItem item2 : items) {
|
||||
TableItem item = item2;
|
||||
if (!item.isDisposed()) {
|
||||
Rectangle bounds = item.getBounds();
|
||||
maxWidth = Math.max(maxWidth, bounds.x + bounds.width);
|
||||
@@ -353,8 +360,7 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
getTarget().deselectAll();
|
||||
|
||||
TreeItem[] selection = getTarget().getSelection();
|
||||
for (int i = 0; i < selection.length; i++) {
|
||||
TreeItem tableItem = selection[i];
|
||||
for (TreeItem tableItem : selection) {
|
||||
selectedItems.add(tableItem.getData());
|
||||
}
|
||||
|
||||
@@ -362,8 +368,7 @@ public class TableToTreeLinker<D1, D2> extends BgDrawableComposite implements IB
|
||||
getSource().deselectAll();
|
||||
|
||||
TableItem[] selection = getSource().getSelection();
|
||||
for (int i = 0; i < selection.length; i++) {
|
||||
TableItem treeItem = selection[i];
|
||||
for (TableItem treeItem : selection) {
|
||||
selectedItems.add(treeItem.getData());
|
||||
}
|
||||
|
||||
|
||||
@@ -82,7 +82,7 @@ public abstract class DialogErrorForCellEditorListener implements ICellEditorLis
|
||||
CELL_EDITOR_STATE state) {
|
||||
final Text text = (Text) cellEditor.getControl();
|
||||
final ModifiedObjectInfo modifiedObjectInfo = tableViewerCreator.getModifiedObjectInfo();
|
||||
Object originalValue = modifiedObjectInfo.getOriginalPropertyBeanValue();
|
||||
final Object originalValue = modifiedObjectInfo.getOriginalPropertyBeanValue();
|
||||
lastValidValue = lastValidValue != null && state == CELL_EDITOR_STATE.EDITING ? lastValidValue : originalValue;
|
||||
|
||||
int beanPosition = tableViewerCreator.getInputList().indexOf(currentModifiedBean);
|
||||
@@ -101,19 +101,22 @@ public abstract class DialogErrorForCellEditorListener implements ICellEditorLis
|
||||
|
||||
public void run() {
|
||||
if (errorMessage.equals("")) {
|
||||
MessageDialog.openError(
|
||||
text.getShell(),
|
||||
Messages.getString("DialogErrorForCellEditorListener.Error.MsgDialogTitle"), Messages.getString("ErrorDialogWidthDetailArea.ErrorMessage.ColumnText")); //$NON-NLS-1$
|
||||
MessageDialog.openError(text.getShell(),
|
||||
Messages.getString("DialogErrorForCellEditorListener.Error.MsgDialogTitle"), //$NON-NLS-1$
|
||||
Messages.getString("ErrorDialogWidthDetailArea.ErrorMessage.ColumnText.NotValid", //$NON-NLS-1$
|
||||
newValue, originalValue == null ? "" : originalValue.toString())); //$NON-NLS-1$
|
||||
final int columnPosition = tableViewerCreator.getColumns().indexOf(column);
|
||||
tableViewerCreator.getTableViewer().editElement(currentModifiedBean, columnPosition);
|
||||
text.setText(newValue);
|
||||
// Added by Marvin Wang on Dec. 12, 2012 for bug TDI-24174 and it also replaces the bug
|
||||
// TDI-23253.
|
||||
text.setText(originalValue == null ? "" : originalValue.toString()); //$NON-NLS-1$
|
||||
text.setSelection(selection.x, selection.y);
|
||||
} else {
|
||||
MessageDialog.openError(text.getShell(),
|
||||
Messages.getString("DialogErrorForCellEditorListener.Error.MsgDialogTitle"), errorMessage); //$NON-NLS-1$
|
||||
final int columnPosition = tableViewerCreator.getColumns().indexOf(column);
|
||||
tableViewerCreator.getTableViewer().editElement(currentModifiedBean, columnPosition);
|
||||
text.setText(newValue);
|
||||
text.setText("");
|
||||
text.setSelection(selection.x, selection.y);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,6 +44,7 @@ import java.util.zip.ZipFile;
|
||||
import javax.xml.parsers.DocumentBuilder;
|
||||
import javax.xml.parsers.DocumentBuilderFactory;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.resources.IFile;
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
@@ -57,7 +58,6 @@ import org.eclipse.core.runtime.Path;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.talend.commons.exception.CommonExceptionHandler;
|
||||
import org.talend.commons.i18n.internal.Messages;
|
||||
import org.talend.commons.utils.StringUtils;
|
||||
import org.w3c.dom.Document;
|
||||
import org.w3c.dom.Node;
|
||||
import org.w3c.dom.NodeList;
|
||||
@@ -468,6 +468,10 @@ public class FilesUtils {
|
||||
return getFilesFromFolderByName(file, fileName, new String[] { ".jar", ".zip", ".bar" }, null, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
}
|
||||
|
||||
public static List<File> getDllFilesFromFolder(File file, String fileName) throws MalformedURLException {
|
||||
return getFilesFromFolderByName(file, fileName, new String[] { ".dll" }, null, true); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
public static FileFilter getExcludeSystemFilesFilter() {
|
||||
FileFilter filter = new FileFilter() {
|
||||
|
||||
@@ -913,6 +917,36 @@ public class FilesUtils {
|
||||
}
|
||||
}
|
||||
|
||||
public static void copyDirectoryWithoutSvnFolder(File source, File target) {
|
||||
File tarpath = new File(target, source.getName());
|
||||
if (source.isDirectory()) {
|
||||
tarpath.mkdir();
|
||||
File[] dir = source.listFiles();
|
||||
for (File element : dir) {
|
||||
if (element.getName().equals(".svn")) { //$NON-NLS-1$
|
||||
continue;
|
||||
}
|
||||
copyDirectoryWithoutSvnFolder(element, tarpath);
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
InputStream is = new FileInputStream(source);
|
||||
OutputStream os = new FileOutputStream(tarpath);
|
||||
byte[] buf = new byte[1024];
|
||||
int len = 0;
|
||||
while ((len = is.read(buf)) != -1) {
|
||||
os.write(buf, 0, len);
|
||||
}
|
||||
is.close();
|
||||
os.close();
|
||||
} catch (FileNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void deleteFile(File file, boolean delete) {
|
||||
if (file.exists()) {
|
||||
if (file.isFile() && delete) {
|
||||
@@ -1035,7 +1069,7 @@ public class FilesUtils {
|
||||
if (file.isDirectory()) {
|
||||
copyDirectory(file, targetfolder);
|
||||
} else if (file.isFile()) {
|
||||
copyFile(file, new File(targetfolder.getAbsolutePath() + File.separator + file.getName()));
|
||||
copyFile(file, targetfolder);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
@@ -1044,17 +1078,4 @@ public class FilesUtils {
|
||||
deleteFile(srcfolder, true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC xqliu Comment method "getAllFilesFromFolder".
|
||||
*
|
||||
* @param aFolder
|
||||
* @param filenameFilter
|
||||
* @return
|
||||
*/
|
||||
public static List<File> getAllFilesFromFolder(File aFolder, FilenameFilter filenameFilter) {
|
||||
List<File> files = new ArrayList<File>();
|
||||
getAllFilesFromFolder(aFolder, files, filenameFilter);
|
||||
return files;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,7 @@ ColorsCodeViewerPreferencePage.keyword2Color=\u30AD\u30FC\u30EF\u30FC\u30C92\u82
|
||||
MetadataDialog.Message=\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u306E\u3059\u3079\u3066\u306E\u30AB\u30E9\u30E0\u304C\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u79FB\u884C\u3055\u308C\u307E\u3059
|
||||
MetadataDialog.TransferMessage=\u51FA\u30B9\u30AD\u30FC\u30DE\u306E\u3059\u3079\u3066\u306E\u30AB\u30E9\u30E0\u304C\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u79FB\u884C\u3055\u308C\u307E\u3059
|
||||
EMetadataEncoding.Cyrillic=\u30AD\u30EA\u30EB\u8A9E
|
||||
EUpdateResult.BuiltIn=\u30D3\u30EB\u30C9\u30A4\u30F3\u30E2\u30FC\u30C9\u3078\u5909\u66F4
|
||||
EUpdateResult.BuiltIn=\u7D44\u8FBC\u307F\u30E2\u30FC\u30C9\u3078\u5909\u66F4
|
||||
EUpdateResult.Rename=\u540D\u524D\u3092\u5909\u66F4
|
||||
MetadataTypeLengthConstants.DOUBLE_LENGTH=Double
|
||||
ContextProcessSection.ParameterNameIsNotValid=\u5F15\u6570\u540D\u304C\u6B63\u3057\u304F\u3042\u308A\u307E\u305B\u3093\u3002
|
||||
@@ -185,7 +185,9 @@ PaletteContentDialog.lable=\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u30E9\u30D9\u30E
|
||||
MetadataDialog.CopySelectionToInput.toolTipText=\u9078\u629E\u3055\u308C\u305F\u30AB\u30E9\u30E0\u3092\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u304B\u3089\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u30B3\u30D4\u30FC
|
||||
MetadataDialog.CopyToOutput=\u3059\u3079\u3066\u306E\u30AB\u30E9\u30E0\u3092\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u304B\u3089\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u30B3\u30D4\u30FC
|
||||
MetadataDialog.CopySelectionToOutput=\u9078\u629E\u3055\u308C\u305F\u30AB\u30E9\u30E0\u3092\u5165\u529B\u30B9\u30AD\u30FC\u30DE\u304B\u3089\u51FA\u529B\u30B9\u30AD\u30FC\u30DE\u3078\u30B3\u30D4\u30FC
|
||||
MetadataTalendType.dbIdNotFound=DBMS Id : {0} \u306F\u898B\u3064\u304B\u308A\u307E\u305B\u3093!
|
||||
PaletteContentDialog.connection=\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u63A5\u7D9A\u30C7\u30D5\u30A9\u30EB\u30C8\uFF1A
|
||||
PaletteContentDialog.hint=\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u30D2\u30F3\u30C8\u30C7\u30D5\u30A9\u30EB\u30C8\uFF1A
|
||||
PaletteContentDialog.lable=\u30D5\u30A9\u30FC\u30DE\u30C3\u30C8\u30E9\u30D9\u30EB\u30C7\u30D5\u30A9\u30EB\u30C8:
|
||||
ProcessorUtilities.finalizeBuild=\u30D3\u30EB\u30C9\u3092\u7D42\u4E86\u4E2D...
|
||||
ProcessorUtilities.generatingJob=\u30B8\u30E7\u30D6\u751F\u6210\u4E2D...
|
||||
@@ -241,6 +243,8 @@ MetadataTool.schemaNull=\u30B9\u30AD\u30FC\u30DE\u540D\u304CNULL\u3067\u3059\u30
|
||||
MetadataTool.invalidChar=\u7121\u52B9\u306A\u6587\u5B57
|
||||
MetadataTool.nameNull=\u30B9\u30AD\u30FC\u30DE\u540D\u3092\u6307\u5B9A\u3057\u3066\u4E0B\u3055\u3044\u3002
|
||||
MetadataTool.nullValue=Null\u5024
|
||||
MetadataTool.schemaExist=\u30B9\u30AD\u30FC\u30DE\u540D\u306F\u5B58\u5728\u3057\u307E\u3059\u3002
|
||||
MetadataTool.schemaIn=\u30B9\u30AD\u30FC\u30DE\u540D\u304C\u4E0D\u6B63\u3067\u3059\u3002
|
||||
MetadataTool.schemaInvalid=\u30B9\u30AD\u30FC\u30DE\u540D\u304C\u4E0D\u6B63\u3067\u3059\u3002
|
||||
MetadataTool.schemaNull=\u30B9\u30AD\u30FC\u30DE\u540D\u304CNULL\u3067\u3059\u3002
|
||||
RepositoryUpdateManager.NotFoundTitle=\u898B\u3064\u304B\u308A\u307E\u305B\u3093
|
||||
|
||||
@@ -152,23 +152,3 @@ ItemReferenceDialog.nodeTotalsTip=The totals of node reference
|
||||
ItemReferenceDialog.project=Project
|
||||
ItemReferenceDialog.deletedInfor=In Recycle Bin
|
||||
ItemReferenceDialog.messages=Some items cannot be deleted because they are referenced from other items.
|
||||
ProxyRepositoryFactory.projectIsNotCompatible=The project {0} had been opend by a more recent studio so cannot open it.
|
||||
ContextReferenceDialog.kindMessages=The context group of {0} {1} is referred by the following list, if you really want to delete it, the context group is used in job will be changed to built-in when job is opened again. Would you still like to delete it?
|
||||
ContextReferenceDialog.kindMessages1=The context group of {0} {1} is referred by the following list, Would you still like to delete it?
|
||||
NewFolderWizard.description=Create a new folder in repository
|
||||
NewFolderWizard.failureText=An error occurs. Folder cannot be created. See log for more details.
|
||||
NewFolderWizard.failureTitle=Error
|
||||
NewFolderWizard.label=Label
|
||||
NewFolderWizard.nameEmpty=Label is required
|
||||
NewFolderWizard.nameIncorrect=Label contains incorrect characters.
|
||||
NewFolderWizard.nameInvalid=Label {0} is forbidden
|
||||
NewFolderWizard.title=Folder
|
||||
NewFolderWizard.windowTitle=New folder
|
||||
CreateFolderAction.action.title=Create folder
|
||||
CreateFolderAction.action.toolTipText=Create folder
|
||||
RenameFolderAction.action.title=Rename folder
|
||||
RenameFolderAction.action.toolTipText=Rename folder
|
||||
RenameFolderAction.warning.editorOpen.message=Cannot rename "{1}" folder because an item ({0}) contained in this folder is currently open.\nClose it and retry.
|
||||
RenameFolderAction.warning.editorOpen.title=Action not available
|
||||
RenameFolderAction.warning.cannotFind.message=Cannot rename folder, it may have been moved or deleted. Click refresh button to update.the repository.
|
||||
RenameFolderAction.warning.cannotFind.title=Action not available
|
||||
|
||||
@@ -118,4 +118,3 @@ ItemReferenceDialog.nodeTotals=Totaux
|
||||
ItemReferenceDialog.project=Projet
|
||||
ItemReferenceDialog.deletedInfor=Dans la Corbeille
|
||||
ItemReferenceDialog.messages=Des éléments ne peuvent être supprimés car ils sont référencés par d'autres.
|
||||
ProxyRepositoryFactory.projectIsNotCompatible=Le projet {0} a été ouvert par un studio plus récent. Impossible de l'ouvrir.
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
ProxyRepositoryFactory.Label=Labela
|
||||
CreateSandboxProjectDialog.ProjectLabel=Labela
|
||||
PropertiesWizardPage.Select=SELECT
|
||||
DeleteAction.action.logicalTitle=DELETE
|
||||
|
||||
@@ -5,5 +5,4 @@ Bundle-SymbolicName: org.talend.core.repository.test
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Fragment-Host: org.talend.core.repository
|
||||
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
|
||||
Require-Bundle: org.junit4,
|
||||
org.talend.testutils
|
||||
Require-Bundle: org.junit4
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.repository.model.actions;
|
||||
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.mockito.Mockito.mock;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.RepositoryViewObject;
|
||||
import org.talend.repository.model.ERepositoryStatus;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
|
||||
/**
|
||||
*
|
||||
* DOC hcyi class global comment. Detailled comment
|
||||
*/
|
||||
public class MoveObjectActionTest {
|
||||
|
||||
@Test
|
||||
public void testValidateAction() {
|
||||
// mock
|
||||
RepositoryNode sourceNode = mock(RepositoryNode.class);
|
||||
RepositoryViewObject object = mock(RepositoryViewObject.class);
|
||||
Property property = mock(Property.class);
|
||||
Item item = mock(Item.class);
|
||||
// when
|
||||
when(sourceNode.getObject()).thenReturn(object);
|
||||
when(object.getRepositoryObjectType()).thenReturn(ERepositoryObjectType.SERVICESOPERATION);
|
||||
when(object.getProperty()).thenReturn(property);
|
||||
when(object.getRepositoryStatus()).thenReturn(ERepositoryStatus.DEFAULT);
|
||||
when(property.getItem()).thenReturn(item);
|
||||
//
|
||||
MoveObjectAction moveObjectAction = MoveObjectAction.getInstance();
|
||||
assertFalse(moveObjectAction.validateAction(sourceNode, null, true));
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.repository.utils;
|
||||
|
||||
import static org.junit.Assert.assertTrue;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
@@ -54,8 +56,6 @@ import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.TalendFileFactory;
|
||||
import org.talend.repository.ProjectManager;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* DOC nrousseau class global comment. Detailled comment
|
||||
*/
|
||||
@@ -104,7 +104,7 @@ public class XmiResourceManagerTest {
|
||||
if (prj.exists()) {
|
||||
prj.delete(true, null); // always delete to avoid conflicts between 2 tests
|
||||
}
|
||||
desc = workspace.newProjectDescription(technicalLabel);
|
||||
desc = workspace.newProjectDescription(projectInfor.getLabel());
|
||||
desc.setNatureIds(new String[] { TalendNature.ID });
|
||||
desc.setComment(projectInfor.getDescription());
|
||||
|
||||
@@ -653,7 +653,7 @@ public class XmiResourceManagerTest {
|
||||
* .
|
||||
*
|
||||
* @throws PersistenceException
|
||||
* @throws CoreException
|
||||
* @throws CoreException
|
||||
*/
|
||||
@Test
|
||||
public void testMoveResource() throws PersistenceException, CoreException {
|
||||
@@ -680,7 +680,7 @@ public class XmiResourceManagerTest {
|
||||
xrm.saveResource(processItemResource);
|
||||
xrm.saveResource(propertyResource);
|
||||
xrm.saveResource(screenshotsResource);
|
||||
|
||||
|
||||
IFolder folder = project.getFolder("/temp");
|
||||
if (!folder.exists()) {
|
||||
folder.create(false, true, null);
|
||||
@@ -1159,8 +1159,7 @@ public class XmiResourceManagerTest {
|
||||
assertTrue(emfProject.eResource().isLoaded());
|
||||
xrm.unloadResources();
|
||||
assertTrue(emfProject.eResource() == null);
|
||||
assertTrue(sampleProject.getEmfProject().eResource() != null); // not same instance so emf should be loaded
|
||||
// still
|
||||
assertTrue(sampleProject.getEmfProject().eResource() != null); // not same instance so emf should be loaded still
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -4,7 +4,6 @@ Bundle-Name: Core Repository
|
||||
Bundle-SymbolicName: org.talend.core.repository;singleton:=true
|
||||
Bundle-Version: 1.0.0.qualifier
|
||||
Require-Bundle: org.eclipse.ui,
|
||||
org.eclipse.ui.ide,
|
||||
org.eclipse.core.runtime,
|
||||
org.talend.commons,
|
||||
org.eclipse.emf.ecore.xmi,
|
||||
@@ -14,7 +13,8 @@ Require-Bundle: org.eclipse.ui,
|
||||
org.talend.commons.ui,
|
||||
org.apache.log4j,
|
||||
org.talend.libraries.apache,
|
||||
org.eclipse.osgi.services
|
||||
org.eclipse.osgi.services,
|
||||
org.eclipse.ui.ide
|
||||
Export-Package: org.talend.core.ldap,
|
||||
org.talend.core.model.genhtml,
|
||||
org.talend.core.model.metadata,
|
||||
|
||||
@@ -577,11 +577,10 @@
|
||||
<extension
|
||||
point="org.talend.core.repository.login.task">
|
||||
<loginTask
|
||||
class="org.talend.core.repository.GeneratedJetEmitersLoginTask"
|
||||
priority="highest">
|
||||
class="org.talend.core.repository.GeneratedJetEmitersLoginTask">
|
||||
</loginTask>
|
||||
</extension>
|
||||
<extension
|
||||
<extension
|
||||
point="org.talend.core.repository.checkDeleteItemReference">
|
||||
<check
|
||||
class="org.talend.core.repository.model.CheckJobletDeleteReference"
|
||||
@@ -592,13 +591,5 @@
|
||||
priority="high">
|
||||
</check>
|
||||
</extension>
|
||||
<extension
|
||||
point="org.talend.core.repository.login.task">
|
||||
<loginTask
|
||||
class="org.talend.core.repository.ReadOnlyProjectConfirm"
|
||||
priority="high">
|
||||
</loginTask>
|
||||
</extension>
|
||||
|
||||
|
||||
</plugin>
|
||||
|
||||
@@ -1,123 +1,123 @@
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.talend.core.repository" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.talend.core.repository" id="checkDeleteItemReference" name="Check Delete Item Reference"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="check" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="check">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.talend.core.repository.ICheckDeleteItemReference"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="priority">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
<simpleType>
|
||||
<restriction base="string">
|
||||
<enumeration value="lowest">
|
||||
</enumeration>
|
||||
<enumeration value="low">
|
||||
</enumeration>
|
||||
<enumeration value="normal">
|
||||
</enumeration>
|
||||
<enumeration value="high">
|
||||
</enumeration>
|
||||
<enumeration value="highest">
|
||||
</enumeration>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
||||
<?xml version='1.0' encoding='UTF-8'?>
|
||||
<!-- Schema file written by PDE -->
|
||||
<schema targetNamespace="org.talend.core.repository" xmlns="http://www.w3.org/2001/XMLSchema">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.schema plugin="org.talend.core.repository" id="checkDeleteItemReference" name="Check Delete Item Reference"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter description of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<element name="extension">
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.element />
|
||||
</appinfo>
|
||||
</annotation>
|
||||
<complexType>
|
||||
<sequence>
|
||||
<element ref="check" minOccurs="1" maxOccurs="unbounded"/>
|
||||
</sequence>
|
||||
<attribute name="point" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="id" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute translatable="true"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<element name="check">
|
||||
<complexType>
|
||||
<attribute name="class" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
<appinfo>
|
||||
<meta.attribute kind="java" basedOn=":org.talend.core.repository.ICheckDeleteItemReference"/>
|
||||
</appinfo>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="priority">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
<simpleType>
|
||||
<restriction base="string">
|
||||
<enumeration value="lowest">
|
||||
</enumeration>
|
||||
<enumeration value="low">
|
||||
</enumeration>
|
||||
<enumeration value="normal">
|
||||
</enumeration>
|
||||
<enumeration value="high">
|
||||
</enumeration>
|
||||
<enumeration value="highest">
|
||||
</enumeration>
|
||||
</restriction>
|
||||
</simpleType>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="since"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter the first release in which this extension point appears.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="examples"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter extension point usage example here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="apiinfo"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter API information here.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
<annotation>
|
||||
<appinfo>
|
||||
<meta.section type="implementation"/>
|
||||
</appinfo>
|
||||
<documentation>
|
||||
[Enter information about supplied implementation of this extension point.]
|
||||
</documentation>
|
||||
</annotation>
|
||||
|
||||
|
||||
</schema>
|
||||
|
||||
@@ -76,13 +76,6 @@ just set the value Metadata
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="alias" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
It is the alias of this type.
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="type" type="string" use="required">
|
||||
<annotation>
|
||||
<documentation>
|
||||
@@ -123,13 +116,6 @@ like this: DI|DQ ....
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
<attribute name="name_pattern" type="string">
|
||||
<annotation>
|
||||
<documentation>
|
||||
|
||||
</documentation>
|
||||
</annotation>
|
||||
</attribute>
|
||||
</complexType>
|
||||
</element>
|
||||
|
||||
|
||||
@@ -93,6 +93,8 @@ DeleteAction.dialog.messageAllElements=All the elements will be deleted forever
|
||||
DeleteAction.dialog.title=Delete forever
|
||||
DeleteAction.error.lockedOrOpenedObject.newMessage=The {0} is locked, so you can't delete it.\n If this object is opened ,you must close it before deletion.
|
||||
DeleteAction.error.title=Deletion forbidden
|
||||
DeleteAction.warning.message1=can not delete the folder because at least one item contained in this folder is currently open. Close any open item and try again.
|
||||
DeleteAction.warning.title=Warning
|
||||
DuplicateAction.cannotGenerateItem=Cannot generate pasted item label.
|
||||
DuplicateAction.dialog.message=Give name to new job
|
||||
DuplicateAction.dialog.title=Please input job name
|
||||
@@ -110,18 +112,18 @@ EmptyRecycleBinAction.dialog.allDependencies=You can't empty the Recycle Bin.\nO
|
||||
PasteObjectAction.error.labelAlreadyExists=An object with this label already exists at this path
|
||||
PasteObjectAction.error.title=Paste impossible
|
||||
JobletReferenceDialog.DeletedInfor=in Recycle Bin
|
||||
JobletReferenceDialog.Messages=Some joblets cannot be deleted because they are referenced from jobs.
|
||||
JobletReferenceDialog.Messages=Joblet({0} {1}) is referenced from\:\n
|
||||
JobletReferenceDialog.NodeTotals=Totals
|
||||
JobletReferenceDialog.NodeTotalsTip=The totals of node reference
|
||||
JobletReferenceDialog.project=Project
|
||||
JobletReferenceDialog.ReferenceJob=Reference Job
|
||||
JobletReferenceDialog.Title=Delete the joblet failure
|
||||
ContextReferenceDialog.Title=Delete Context Group
|
||||
ContextReferenceDialog.Title=Delete Context Group
|
||||
ContextReferenceDialog.Recycle=in Recycle Bin
|
||||
ContextReferenceDialog.ReferenceJob=Reference Objects
|
||||
ContextReferenceDialog.Types=Type
|
||||
ContextReferenceDialog.NodeTypeTip=The type of node reference
|
||||
ContextReferenceDialog.Messages=Context({0} {1}) is referenced from\:\n
|
||||
ContextReferenceDialog.Messages=Context({0} {1}) is referenced from\:\n
|
||||
ContextReferenceDialog.kindMessages=The context group of {0} {1} is referred by the following list, if you really want to delete it, the context group is used in job will be changed to built-in when job is opened again. Would you still like to delete it?
|
||||
ContextReferenceDialog.kindMessages1=The context group of {0} {1} is referred by the following list, Would you still like to delete it?
|
||||
CopyToGenericSchemaHelper.cannotGenarateItem=Cannot generate pasted item label.
|
||||
|
||||
@@ -68,7 +68,6 @@ public class MetadataColumnRepositoryObject extends MetadataColumn implements IS
|
||||
setTdColumn(column);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getProperty() {
|
||||
Property property = viewObject.getProperty();
|
||||
// update column
|
||||
@@ -77,131 +76,98 @@ public class MetadataColumnRepositoryObject extends MetadataColumn implements IS
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return viewObject.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return getTdColumn().getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLabel(String label) {
|
||||
this.getTdColumn().setLabel(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return getTdColumn().getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setId(String id) {
|
||||
getTdColumn().setId(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMetadataObject getAbstractMetadataObject() {
|
||||
return getTdColumn();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromParent() {
|
||||
}
|
||||
|
||||
private void updateColumn(Property property) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getAuthor() {
|
||||
return viewObject.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getChildren() {
|
||||
return viewObject.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreationDate() {
|
||||
return viewObject.getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return viewObject.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getInformationStatus() {
|
||||
return viewObject.getInformationStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getModificationDate() {
|
||||
return viewObject.getModificationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return viewObject.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectLabel() {
|
||||
return viewObject.getProjectLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPurpose() {
|
||||
return viewObject.getPurpose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRepositoryNode getRepositoryNode() {
|
||||
return this.repositoryNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getRepositoryStatus() {
|
||||
return viewObject.getRepositoryStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusCode() {
|
||||
return viewObject.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryObjectType getRepositoryObjectType() {
|
||||
return ERepositoryObjectType.METADATA_CON_COLUMN;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return SubItemHelper.isDeleted(getTdColumn());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepositoryNode(IRepositoryNode node) {
|
||||
this.repositoryNode = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelElement getModelElement() {
|
||||
return this.tdColumn;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.model.repository.IRepositoryViewObject#isModified()
|
||||
*/
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return viewObject.isModified();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.ItemReferenceBean;
|
||||
import org.talend.repository.ui.actions.DeleteActionCache;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public interface ICheckDeleteItemReference {
|
||||
|
||||
public Set<ItemReferenceBean> getItemReferenceBeans(List<? extends IRepositoryNode> deleteNodes,
|
||||
DeleteActionCache deleteActionCache);
|
||||
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.ItemReferenceBean;
|
||||
import org.talend.repository.ui.actions.DeleteActionCache;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public interface ICheckDeleteItemReference {
|
||||
|
||||
public Set<ItemReferenceBean> getItemReferenceBeans(List<? extends IRepositoryNode> deleteNodes,
|
||||
DeleteActionCache deleteActionCache);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
package org.talend.core.repository;
|
||||
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.SubMonitor;
|
||||
import org.eclipse.jface.operation.IRunnableWithProgress;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.repository.model.IRepositoryService;
|
||||
|
||||
public class ReadOnlyProjectConfirm implements IRunnableWithProgress {
|
||||
|
||||
private static Logger log = Logger.getLogger(ReadOnlyProjectConfirm.class);
|
||||
|
||||
@Override
|
||||
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
|
||||
log.info("ReadOnly confirm"); //$NON-NLS-1$
|
||||
SubMonitor subMonitor = SubMonitor.convert(monitor, 1);
|
||||
subMonitor.setTaskName("ReadOnly confirm.");
|
||||
IRepositoryService service = (IRepositoryService) GlobalServiceRegister.getDefault().getService(IRepositoryService.class);
|
||||
service.openReadOnlyDialog(new Shell());
|
||||
|
||||
subMonitor.done();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,54 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.constants;
|
||||
|
||||
/**
|
||||
* Constants related to repostiory <br/>
|
||||
*
|
||||
*/
|
||||
public final class Constant {
|
||||
|
||||
/**
|
||||
* constant used for OSGI event bus notification for repository Items
|
||||
*/
|
||||
public static final String REPOSITORY_ITEM_EVENT_PREFIX = "org/talend/repository/item/"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* suffix used when issuing an event on the OSGI event bus when an lock is done
|
||||
*/
|
||||
public static final String ITEM_LOCK_EVENT_SUFFIX = "lock"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* suffix used when issuing an event on the OSGI event bus when an unlock is done
|
||||
*/
|
||||
public static final String ITEM_UNLOCK_EVENT_SUFFIX = "unlock"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* key used to get/set the property of an event related to an item (REPOSITORY_ITEM_EVENT_PREFIX). The value is the
|
||||
* Item instance.
|
||||
*/
|
||||
public static final String ITEM_EVENT_PROPERTY_KEY = "item"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* key used to get/set the property of an event related to a list of files modified in the repository
|
||||
* (REPOSITORY_ITEM_EVENT_PREFIX). The value is the Collection of String (list of all files modified).
|
||||
*/
|
||||
public static final String FILE_LIST_EVENT_SUFFIX = "fileList"; //$NON-NLS-1$
|
||||
|
||||
/**
|
||||
* key used to get/set the property of an event related to a list of files modified in the repository
|
||||
* (REPOSITORY_ITEM_EVENT_PREFIX). The value is the Collection of String (list of all files modified).
|
||||
*/
|
||||
public static final String FILE_LIST_EVENT_PROPERTY_KEY = "fileList"; //$NON-NLS-1$
|
||||
|
||||
}
|
||||
@@ -16,8 +16,6 @@ package org.talend.core.repository.constants;
|
||||
*/
|
||||
public class FileConstants {
|
||||
|
||||
public static final String OLD_TALEND_PROJECT_FILENAME = "talendProject"; //$NON-NLS-1$
|
||||
|
||||
public static final String LOCAL_PROJECT_FILENAME = "talend.project"; //$NON-NLS-1$
|
||||
|
||||
public static final String PROPERTIES_EXTENSION = "properties"; //$NON-NLS-1$
|
||||
@@ -46,25 +44,11 @@ public class FileConstants {
|
||||
// MOD klliu 2010-11-26
|
||||
public static final String JRXML_EXTENSION = "jrxml"; //$NON-NLS-1$
|
||||
|
||||
public static final String PROPERTIES_FILE_SUFFIX = '.' + PROPERTIES_EXTENSION;
|
||||
|
||||
public static final String ITEM_FILE_SUFFIX = '.' + ITEM_EXTENSION;
|
||||
|
||||
public static final String SCREENSHOT_FILE_SUFFIX = '.' + SCREENSHOT_EXTENSION;
|
||||
|
||||
public static final String ZIP_FILE_SUFFIX = ".zip"; //$NON-NLS-1$
|
||||
|
||||
public static final String TAR_FILE_SUFFIX = ".tar"; //$NON-NLS-1$
|
||||
|
||||
public static final String TAR_GZ_FILE_SUFFIX = ".tar.gz"; //$NON-NLS-1$
|
||||
|
||||
public static final String JAR_FILE_SUFFIX = ".jar"; //$NON-NLS-1$
|
||||
|
||||
public static final String WAR_FILE_SUFFIX = ".war"; //$NON-NLS-1$
|
||||
|
||||
public static final String ESB_FILE_SUFFIX = ".esb"; //$NON-NLS-1$
|
||||
|
||||
public static final String SH_FILE_SUFFIX = ".sh"; //$NON-NLS-1$
|
||||
|
||||
public static final String BAT_FILE_SUFFIX = ".bat"; //$NON-NLS-1$
|
||||
public static final String PROPERTIES_FILE_SUFFIX = '.' + PROPERTIES_EXTENSION;
|
||||
}
|
||||
|
||||
@@ -1,88 +1,88 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.ICheckDeleteItemReference;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.ItemReferenceBean;
|
||||
import org.talend.repository.ui.actions.DeleteActionCache;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbstractCheckDeleteItemReference implements ICheckDeleteItemReference {
|
||||
|
||||
protected IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
|
||||
protected List<? extends IRepositoryNode> deleteNodes;
|
||||
|
||||
public Set<ItemReferenceBean> getItemReferenceBeans(List<? extends IRepositoryNode> deleteNodes,
|
||||
DeleteActionCache deleteActionCache) {
|
||||
this.deleteNodes = deleteNodes;
|
||||
Set<ItemReferenceBean> refBeans = new HashSet<ItemReferenceBean>();
|
||||
|
||||
if (deleteActionCache == null) {
|
||||
deleteActionCache = DeleteActionCache.getInstance();
|
||||
deleteActionCache.createRecords();
|
||||
}
|
||||
|
||||
for (IRepositoryNode repositoryNode : deleteNodes) {
|
||||
refBeans.addAll(checkItemReferenceBeans(factory, deleteActionCache, repositoryNode));
|
||||
}
|
||||
|
||||
return refBeans;
|
||||
}
|
||||
|
||||
protected abstract Set<ItemReferenceBean> checkItemReferenceBeans(IProxyRepositoryFactory factory,
|
||||
DeleteActionCache deleteActionCache, IRepositoryNode currentJobNode);
|
||||
|
||||
protected boolean isItemInDeleteList(ItemReferenceBean bean, boolean isRefer) {
|
||||
if (deleteNodes == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String itemName;
|
||||
String itemVersion;
|
||||
ERepositoryObjectType itemType;
|
||||
for (IRepositoryNode node : deleteNodes) {
|
||||
IRepositoryViewObject repObj = node.getObject();
|
||||
Property property = repObj.getProperty();
|
||||
String label = property.getLabel();
|
||||
String version = property.getVersion();
|
||||
ERepositoryObjectType type = repObj.getRepositoryObjectType();
|
||||
if (isRefer) {
|
||||
itemName = bean.getReferenceItemName();
|
||||
itemVersion = bean.getReferenceItemVersion();
|
||||
itemType = bean.getReferenceItemType();
|
||||
} else {
|
||||
itemName = bean.getItemName();
|
||||
itemVersion = bean.getItemVersion();
|
||||
itemType = bean.getItemType();
|
||||
}
|
||||
if (label.equals(itemName) && version.equals(itemVersion) && type == itemType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.ICheckDeleteItemReference;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.ItemReferenceBean;
|
||||
import org.talend.repository.ui.actions.DeleteActionCache;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbstractCheckDeleteItemReference implements ICheckDeleteItemReference {
|
||||
|
||||
protected IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
|
||||
protected List<? extends IRepositoryNode> deleteNodes;
|
||||
|
||||
public Set<ItemReferenceBean> getItemReferenceBeans(List<? extends IRepositoryNode> deleteNodes,
|
||||
DeleteActionCache deleteActionCache) {
|
||||
this.deleteNodes = deleteNodes;
|
||||
Set<ItemReferenceBean> refBeans = new HashSet<ItemReferenceBean>();
|
||||
|
||||
if (deleteActionCache == null) {
|
||||
deleteActionCache = DeleteActionCache.getInstance();
|
||||
deleteActionCache.createRecords();
|
||||
}
|
||||
|
||||
for (IRepositoryNode repositoryNode : deleteNodes) {
|
||||
refBeans.addAll(checkItemReferenceBeans(factory, deleteActionCache, repositoryNode));
|
||||
}
|
||||
|
||||
return refBeans;
|
||||
}
|
||||
|
||||
protected abstract Set<ItemReferenceBean> checkItemReferenceBeans(IProxyRepositoryFactory factory,
|
||||
DeleteActionCache deleteActionCache, IRepositoryNode currentJobNode);
|
||||
|
||||
protected boolean isItemInDeleteList(ItemReferenceBean bean, boolean isRefer) {
|
||||
if (deleteNodes == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
String itemName;
|
||||
String itemVersion;
|
||||
ERepositoryObjectType itemType;
|
||||
for (IRepositoryNode node : deleteNodes) {
|
||||
IRepositoryViewObject repObj = node.getObject();
|
||||
Property property = repObj.getProperty();
|
||||
String label = property.getLabel();
|
||||
String version = property.getVersion();
|
||||
ERepositoryObjectType type = repObj.getRepositoryObjectType();
|
||||
if (isRefer) {
|
||||
itemName = bean.getReferenceItemName();
|
||||
itemVersion = bean.getReferenceItemVersion();
|
||||
itemType = bean.getReferenceItemType();
|
||||
} else {
|
||||
itemName = bean.getItemName();
|
||||
itemVersion = bean.getItemVersion();
|
||||
itemType = bean.getItemType();
|
||||
}
|
||||
if (label.equals(itemName) && version.equals(itemVersion) && type == itemType) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.IStatusPreferenceInitService;
|
||||
import org.talend.core.model.general.ILibrariesService;
|
||||
import org.talend.core.model.general.LibraryInfo;
|
||||
import org.talend.core.model.general.ModuleNeeded;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.EParameterFieldType;
|
||||
@@ -69,7 +70,6 @@ import org.talend.designer.core.model.utils.emf.component.ComponentFactory;
|
||||
import org.talend.designer.core.model.utils.emf.component.IMPORTType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ElementParameterType;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
|
||||
@@ -400,7 +400,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
}
|
||||
|
||||
List<IRepositoryViewObject> repositoryObjects = getAll(project, ERepositoryObjectType.ROUTINES, false, false);
|
||||
Map<String, List<String>> routineAndJars = coreSerivce.getRoutineAndJars();
|
||||
Map<String, List<LibraryInfo>> routineAndJars = coreSerivce.getRoutineAndJars();
|
||||
for (URL url : routines) {
|
||||
String[] fragments = url.toString().split("/"); //$NON-NLS-1$
|
||||
String label = fragments[fragments.length - 1];
|
||||
@@ -508,7 +508,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
* @param url
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
private void createRoutine(URL url, IPath path, String label, List<String> neededJars) throws PersistenceException {
|
||||
private void createRoutine(URL url, IPath path, String label, List<LibraryInfo> neededJars) throws PersistenceException {
|
||||
if (url == null) {
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
@@ -532,12 +532,13 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
routineItem.setContent(byteArray);
|
||||
routineItem.setBuiltIn(true);
|
||||
if (neededJars != null) {
|
||||
for (String jar : neededJars) {
|
||||
for (LibraryInfo jar : neededJars) {
|
||||
IMPORTType type = ComponentFactory.eINSTANCE.createIMPORTType();
|
||||
type.setMESSAGE("");
|
||||
type.setNAME(label);
|
||||
type.setREQUIRED(true);
|
||||
type.setMODULE(jar);
|
||||
type.setMODULE(jar.getLibName());
|
||||
type.setBundleID(jar.getBundleId());
|
||||
routineItem.getImports().add(type);
|
||||
}
|
||||
}
|
||||
@@ -862,7 +863,8 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
allVersion.addAll(getAllVersion(project, property.getId(), false));
|
||||
}
|
||||
if (allVersion.size() == 0 && project.getEmfProject().getReferencedProjects().size() > 0) {
|
||||
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(project);
|
||||
String parentBranch = getRepositoryContext().getFields().get(
|
||||
IProxyRepositoryFactory.BRANCH_SELECTION + "_" + project.getTechnicalLabel());
|
||||
|
||||
for (ProjectReference refProject : (List<ProjectReference>) project.getEmfProject().getReferencedProjects()) {
|
||||
if (refProject.getBranch() != null && !parentBranch.equals(refProject.getBranch())) {
|
||||
|
||||
@@ -1,183 +1,183 @@
|
||||
package org.talend.core.repository.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.map.MultiKeyMap;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.ICheckDeleteItemReference;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.ERepositoryStatus;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.ItemReferenceBean;
|
||||
import org.talend.repository.ui.actions.DeleteActionCache;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class CheckJobletDeleteReference extends AbstractCheckDeleteItemReference implements ICheckDeleteItemReference {
|
||||
|
||||
// almost move from the method checkRepositoryNodeFromProcess of DeleteAction class.
|
||||
public Set<ItemReferenceBean> checkItemReferenceBeans(IProxyRepositoryFactory factory, DeleteActionCache deleteActionCache,
|
||||
IRepositoryNode currentJobNode) {
|
||||
IRepositoryViewObject object = currentJobNode.getObject();
|
||||
Item nodeItem = object.getProperty().getItem(); // hywang add
|
||||
boolean needCheckJobletIfUsedInProcess = false;
|
||||
if (nodeItem instanceof JobletProcessItem) {
|
||||
needCheckJobletIfUsedInProcess = true;
|
||||
}
|
||||
Set<ItemReferenceBean> list = new HashSet<ItemReferenceBean>();
|
||||
if (object != null && needCheckJobletIfUsedInProcess) {
|
||||
Property property = object.getProperty();
|
||||
if (property != null) {
|
||||
String label = property.getLabel();
|
||||
String version = property.getVersion();
|
||||
ERepositoryObjectType type = object.getRepositoryObjectType();
|
||||
boolean isItemDeleted = factory.getStatus(object) == ERepositoryStatus.DELETED;
|
||||
Item item = property.getItem();
|
||||
if (!(item instanceof JobletProcessItem)) {
|
||||
return list;
|
||||
}
|
||||
EList nodesList = null;
|
||||
// wzhang added to fix bug 10050
|
||||
Set<Project> refParentProjects = new HashSet<Project>();
|
||||
try {
|
||||
refParentProjects.add(ProjectManager.getInstance().getCurrentProject());
|
||||
refParentProjects.addAll(ProjectManager.getInstance().getReferencedProjects());
|
||||
for (Project refP : refParentProjects) {
|
||||
List<IRepositoryViewObject> processes = factory.getAll(refP, ERepositoryObjectType.PROCESS, true);
|
||||
List<IRepositoryViewObject> jobletes = factory.getAll(refP, ERepositoryObjectType.JOBLET, true);
|
||||
processes.addAll(jobletes);
|
||||
deleteActionCache.setProcessList(processes);
|
||||
for (IRepositoryViewObject process : deleteActionCache.getProcessList()) {
|
||||
Property property2 = process.getProperty();
|
||||
boolean isDelete = factory.getStatus(process) == ERepositoryStatus.DELETED;
|
||||
Item item2 = property2.getItem();
|
||||
if (item == item2) {
|
||||
continue;
|
||||
}
|
||||
if (!isOpenedItem(item2, deleteActionCache.getOpenProcessMap())) {
|
||||
if (item2 instanceof ProcessItem) {
|
||||
nodesList = ((ProcessItem) item2).getProcess().getNode();
|
||||
} else if (item2 instanceof JobletProcessItem) {
|
||||
nodesList = ((JobletProcessItem) item2).getJobletProcess().getNode();
|
||||
}
|
||||
}
|
||||
if (nodesList != null) {
|
||||
for (Object object2 : nodesList) {
|
||||
if (object2 instanceof NodeType) {
|
||||
NodeType nodeType = (NodeType) object2;
|
||||
nodeType.getElementParameter();
|
||||
boolean equals = nodeType.getComponentName().equals(label);
|
||||
if (equals) {
|
||||
String path = item2.getState().getPath();
|
||||
boolean found = false;
|
||||
ItemReferenceBean bean = new ItemReferenceBean();
|
||||
bean.setItemName(label);
|
||||
bean.setItemVersion(version);
|
||||
bean.setItemType(type);
|
||||
bean.setItemDeleted(isItemDeleted);
|
||||
bean.setReferenceItemName(property2.getLabel());
|
||||
bean.setReferenceItemVersion(property2.getVersion());
|
||||
bean.setReferenceItemType(process.getRepositoryObjectType());
|
||||
bean.setReferenceItemPath(path);
|
||||
bean.setReferenceProjectName(refP.getLabel());
|
||||
bean.setReferenceItemDeleted(isDelete);
|
||||
for (ItemReferenceBean b : list) {
|
||||
if (b.equals(bean)) {
|
||||
found = true;
|
||||
b.addNodeNum();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
list.add(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (IProcess2 openedProcess : deleteActionCache.getOpenedProcessList()) {
|
||||
for (INode node : openedProcess.getGraphicalNodes()) {
|
||||
boolean equals = node.getComponent().getName().equals(label);
|
||||
boolean isDelete = factory.getStatus(openedProcess) == ERepositoryStatus.DELETED;
|
||||
Property property2 = openedProcess.getProperty();
|
||||
Item item2 = property2.getItem();
|
||||
String path = item2.getState().getPath();
|
||||
if (equals) {
|
||||
boolean found = false;
|
||||
ItemReferenceBean bean = new ItemReferenceBean();
|
||||
bean.setItemName(label);
|
||||
bean.setItemVersion(version);
|
||||
bean.setItemType(type);
|
||||
bean.setItemDeleted(isItemDeleted);
|
||||
bean.setReferenceItemName(property2.getLabel());
|
||||
bean.setReferenceItemVersion(property2.getVersion());
|
||||
bean.setReferenceItemType(ERepositoryObjectType.getItemType(item2));
|
||||
bean.setReferenceItemPath(path);
|
||||
bean.setReferenceProjectName(refP.getLabel());
|
||||
bean.setReferenceItemDeleted(isDelete);
|
||||
for (ItemReferenceBean b : list) {
|
||||
if (b.equals(bean)) {
|
||||
found = true;
|
||||
b.addNodeNum();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
list.add(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the reference job or joblet is in the recycle bin but the joblet is not then no need to check; If both the
|
||||
* joblet and the reference job or joblet are all in the recycle bin and they are all in the delete list then no
|
||||
* need to check them; If both the joblet and the reference job or joblet are all not in the recycle bin and
|
||||
* they are all in the delete list then no need to check them too.
|
||||
*/
|
||||
Iterator<ItemReferenceBean> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
ItemReferenceBean bean = it.next();
|
||||
if ((!bean.isItemDeleted() && bean.isReferenceItemDeleted())
|
||||
|| (bean.isItemDeleted() && bean.isReferenceItemDeleted() && isItemInDeleteList(bean, true))
|
||||
|| (!bean.isItemDeleted() && !bean.isReferenceItemDeleted() && isItemInDeleteList(bean, true))) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static boolean isOpenedItem(Item openedItem, MultiKeyMap openProcessMap) {
|
||||
if (openedItem == null) {
|
||||
return false;
|
||||
}
|
||||
Property property = openedItem.getProperty();
|
||||
return (openProcessMap.get(property.getId(), property.getLabel(), property.getVersion()) != null);
|
||||
}
|
||||
|
||||
}
|
||||
package org.talend.core.repository.model;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.map.MultiKeyMap;
|
||||
import org.eclipse.emf.common.util.EList;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.process.INode;
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.ICheckDeleteItemReference;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.ERepositoryStatus;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.ItemReferenceBean;
|
||||
import org.talend.repository.ui.actions.DeleteActionCache;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class CheckJobletDeleteReference extends AbstractCheckDeleteItemReference implements ICheckDeleteItemReference {
|
||||
|
||||
// almost move from the method checkRepositoryNodeFromProcess of DeleteAction class.
|
||||
public Set<ItemReferenceBean> checkItemReferenceBeans(IProxyRepositoryFactory factory, DeleteActionCache deleteActionCache,
|
||||
IRepositoryNode currentJobNode) {
|
||||
IRepositoryViewObject object = currentJobNode.getObject();
|
||||
Item nodeItem = object.getProperty().getItem(); // hywang add
|
||||
boolean needCheckJobletIfUsedInProcess = false;
|
||||
if (nodeItem instanceof JobletProcessItem) {
|
||||
needCheckJobletIfUsedInProcess = true;
|
||||
}
|
||||
Set<ItemReferenceBean> list = new HashSet<ItemReferenceBean>();
|
||||
if (object != null && needCheckJobletIfUsedInProcess) {
|
||||
Property property = object.getProperty();
|
||||
if (property != null) {
|
||||
String label = property.getLabel();
|
||||
String version = property.getVersion();
|
||||
ERepositoryObjectType type = object.getRepositoryObjectType();
|
||||
boolean isItemDeleted = factory.getStatus(object) == ERepositoryStatus.DELETED;
|
||||
Item item = property.getItem();
|
||||
if (!(item instanceof JobletProcessItem)) {
|
||||
return list;
|
||||
}
|
||||
EList nodesList = null;
|
||||
// wzhang added to fix bug 10050
|
||||
Set<Project> refParentProjects = new HashSet<Project>();
|
||||
try {
|
||||
refParentProjects.add(ProjectManager.getInstance().getCurrentProject());
|
||||
refParentProjects.addAll(ProjectManager.getInstance().getReferencedProjects());
|
||||
for (Project refP : refParentProjects) {
|
||||
List<IRepositoryViewObject> processes = factory.getAll(refP, ERepositoryObjectType.PROCESS, true);
|
||||
List<IRepositoryViewObject> jobletes = factory.getAll(refP, ERepositoryObjectType.JOBLET, true);
|
||||
processes.addAll(jobletes);
|
||||
deleteActionCache.setProcessList(processes);
|
||||
for (IRepositoryViewObject process : deleteActionCache.getProcessList()) {
|
||||
Property property2 = process.getProperty();
|
||||
boolean isDelete = factory.getStatus(process) == ERepositoryStatus.DELETED;
|
||||
Item item2 = property2.getItem();
|
||||
if (item == item2) {
|
||||
continue;
|
||||
}
|
||||
if (!isOpenedItem(item2, deleteActionCache.getOpenProcessMap())) {
|
||||
if (item2 instanceof ProcessItem) {
|
||||
nodesList = ((ProcessItem) item2).getProcess().getNode();
|
||||
} else if (item2 instanceof JobletProcessItem) {
|
||||
nodesList = ((JobletProcessItem) item2).getJobletProcess().getNode();
|
||||
}
|
||||
}
|
||||
if (nodesList != null) {
|
||||
for (Object object2 : nodesList) {
|
||||
if (object2 instanceof NodeType) {
|
||||
NodeType nodeType = (NodeType) object2;
|
||||
nodeType.getElementParameter();
|
||||
boolean equals = nodeType.getComponentName().equals(label);
|
||||
if (equals) {
|
||||
String path = item2.getState().getPath();
|
||||
boolean found = false;
|
||||
ItemReferenceBean bean = new ItemReferenceBean();
|
||||
bean.setItemName(label);
|
||||
bean.setItemVersion(version);
|
||||
bean.setItemType(type);
|
||||
bean.setItemDeleted(isItemDeleted);
|
||||
bean.setReferenceItemName(property2.getLabel());
|
||||
bean.setReferenceItemVersion(property2.getVersion());
|
||||
bean.setReferenceItemType(process.getRepositoryObjectType());
|
||||
bean.setReferenceItemPath(path);
|
||||
bean.setReferenceProjectName(refP.getLabel());
|
||||
bean.setReferenceItemDeleted(isDelete);
|
||||
for (ItemReferenceBean b : list) {
|
||||
if (b.equals(bean)) {
|
||||
found = true;
|
||||
b.addNodeNum();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
list.add(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
for (IProcess2 openedProcess : deleteActionCache.getOpenedProcessList()) {
|
||||
for (INode node : openedProcess.getGraphicalNodes()) {
|
||||
boolean equals = node.getComponent().getName().equals(label);
|
||||
boolean isDelete = factory.getStatus(openedProcess) == ERepositoryStatus.DELETED;
|
||||
Property property2 = openedProcess.getProperty();
|
||||
Item item2 = property2.getItem();
|
||||
String path = item2.getState().getPath();
|
||||
if (equals) {
|
||||
boolean found = false;
|
||||
ItemReferenceBean bean = new ItemReferenceBean();
|
||||
bean.setItemName(label);
|
||||
bean.setItemVersion(version);
|
||||
bean.setItemType(type);
|
||||
bean.setItemDeleted(isItemDeleted);
|
||||
bean.setReferenceItemName(property2.getLabel());
|
||||
bean.setReferenceItemVersion(property2.getVersion());
|
||||
bean.setReferenceItemType(ERepositoryObjectType.getItemType(item2));
|
||||
bean.setReferenceItemPath(path);
|
||||
bean.setReferenceProjectName(refP.getLabel());
|
||||
bean.setReferenceItemDeleted(isDelete);
|
||||
for (ItemReferenceBean b : list) {
|
||||
if (b.equals(bean)) {
|
||||
found = true;
|
||||
b.addNodeNum();
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!found) {
|
||||
list.add(bean);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* If the reference job or joblet is in the recycle bin but the joblet is not then no need to check; If both the
|
||||
* joblet and the reference job or joblet are all in the recycle bin and they are all in the delete list then no
|
||||
* need to check them; If both the joblet and the reference job or joblet are all not in the recycle bin and
|
||||
* they are all in the delete list then no need to check them too.
|
||||
*/
|
||||
Iterator<ItemReferenceBean> it = list.iterator();
|
||||
while (it.hasNext()) {
|
||||
ItemReferenceBean bean = it.next();
|
||||
if ((!bean.isItemDeleted() && bean.isReferenceItemDeleted())
|
||||
|| (bean.isItemDeleted() && bean.isReferenceItemDeleted() && isItemInDeleteList(bean, true))
|
||||
|| (!bean.isItemDeleted() && !bean.isReferenceItemDeleted() && isItemInDeleteList(bean, true))) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
private static boolean isOpenedItem(Item openedItem, MultiKeyMap openProcessMap) {
|
||||
if (openedItem == null) {
|
||||
return false;
|
||||
}
|
||||
Property property = openedItem.getProperty();
|
||||
return (openProcessMap.get(property.getId(), property.getLabel(), property.getVersion()) != null);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,7 +26,6 @@ import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.ContextItem;
|
||||
import org.talend.core.model.properties.FolderItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.MigrationTask;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.SpagoBiServer;
|
||||
import org.talend.core.model.properties.Status;
|
||||
@@ -228,7 +227,7 @@ public interface IRepositoryFactory {
|
||||
|
||||
void setSpagoBiServer(List<SpagoBiServer> list) throws PersistenceException;
|
||||
|
||||
void setMigrationTasksDone(Project project, List<MigrationTask> list) throws PersistenceException;
|
||||
void setMigrationTasksDone(Project project, List<String> list) throws PersistenceException;
|
||||
|
||||
public String isServerValid() throws BusinessException;
|
||||
|
||||
@@ -380,6 +379,4 @@ public interface IRepositoryFactory {
|
||||
* update the lock status
|
||||
*/
|
||||
public void updateLockStatus() throws PersistenceException;
|
||||
|
||||
public boolean isModified(Property property);
|
||||
}
|
||||
|
||||
@@ -84,7 +84,7 @@ import org.talend.core.model.properties.InformationLevel;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.JobDocumentationItem;
|
||||
import org.talend.core.model.properties.JobletDocumentationItem;
|
||||
import org.talend.core.model.properties.MigrationTask;
|
||||
import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.PropertiesPackage;
|
||||
import org.talend.core.model.properties.Property;
|
||||
@@ -101,7 +101,6 @@ import org.talend.core.model.repository.RepositoryContentManager;
|
||||
import org.talend.core.model.repository.RepositoryObject;
|
||||
import org.talend.core.model.repository.RepositoryViewObject;
|
||||
import org.talend.core.repository.CoreRepositoryPlugin;
|
||||
import org.talend.core.repository.constants.Constant;
|
||||
import org.talend.core.repository.constants.FileConstants;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
import org.talend.core.repository.utils.RepositoryPathProvider;
|
||||
@@ -144,7 +143,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
private boolean fullLogonFinished;
|
||||
|
||||
private final ProjectManager projectManager;
|
||||
private ProjectManager projectManager;
|
||||
|
||||
@Override
|
||||
public synchronized void addPropertyChangeListener(PropertyChangeListener l) {
|
||||
@@ -261,23 +260,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
this.repositoryFactoryFromProvider.executeMigrations(mainProject, beforeLogon, monitorWrap);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC ycbai Comment method "checkProjectCompatibility".
|
||||
*
|
||||
* @param project
|
||||
* @throws LoginException
|
||||
*/
|
||||
private void checkProjectCompatibility(Project project) throws LoginException {
|
||||
IMigrationToolService migrationToolService = (IMigrationToolService) GlobalServiceRegister.getDefault().getService(
|
||||
IMigrationToolService.class);
|
||||
// update migration system.
|
||||
migrationToolService.updateMigrationSystem(project.getEmfProject(), false);
|
||||
boolean isProjectCompatibility = migrationToolService.checkMigrationTasks(project.getEmfProject());
|
||||
if (!isProjectCompatibility) {
|
||||
throw new LoginException(Messages.getString("ProxyRepositoryFactory.projectIsNotCompatible", project.getLabel())); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkFileNameAndPath(Project project, Item item, String pattern, IPath path, boolean folder,
|
||||
boolean... isImportItem) throws PersistenceException {
|
||||
String fileName = item.getProperty().getLabel();
|
||||
@@ -535,17 +517,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// TUP-202 sizhaoliu 2012-10-3 recursively check lock status of items in sub folders
|
||||
FolderItem folderItem = repositoryFactoryFromProvider.getFolderItem(baseProject, type, path);
|
||||
if (folderItem != null) {
|
||||
for (Object child : folderItem.getChildren()) {
|
||||
if (child instanceof FolderItem) {
|
||||
if (hasLockedItems(type, path.append(((FolderItem) child).getProperty().getLabel()))) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -836,8 +807,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
// TODO SML Renommer et finir la m<>thode et la plugger dans toutes les m<>thodes
|
||||
private void checkAvailability(IRepositoryViewObject objToMove) throws BusinessException {
|
||||
if (!getRepositoryContext().isEditableAsReadOnly()
|
||||
&& (!isPotentiallyEditable(objToMove) || ProxyRepositoryFactory.getInstance().isUserReadOnlyOnCurrentProject())) {
|
||||
if (!isPotentiallyEditable(objToMove) || ProxyRepositoryFactory.getInstance().isUserReadOnlyOnCurrentProject()) {
|
||||
throw new BusinessException(Messages.getString("ProxyRepositoryFactory.bussinessException.itemNonModifiable")); //$NON-NLS-1$
|
||||
}
|
||||
}
|
||||
@@ -898,10 +868,9 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
EventAdmin eventAdmin = (EventAdmin) bundleContext.getService(ref);
|
||||
|
||||
Dictionary<String, Object> properties = new Hashtable<String, Object>();
|
||||
properties.put(Constant.ITEM_EVENT_PROPERTY_KEY, item);
|
||||
properties.put("item", item);
|
||||
|
||||
Event lockEvent = new Event(Constant.REPOSITORY_ITEM_EVENT_PREFIX
|
||||
+ (lock ? Constant.ITEM_LOCK_EVENT_SUFFIX : Constant.ITEM_UNLOCK_EVENT_SUFFIX), properties);
|
||||
Event lockEvent = new Event("org/talend/repository/item/" + (lock ? "lock" : "unlock"), properties);
|
||||
|
||||
eventAdmin.postEvent(lockEvent);
|
||||
}
|
||||
@@ -1184,7 +1153,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setMigrationTasksDone(Project project, List<MigrationTask> list) throws PersistenceException {
|
||||
public void setMigrationTasksDone(Project project, List<String> list) throws PersistenceException {
|
||||
this.repositoryFactoryFromProvider.setMigrationTasksDone(project, list);
|
||||
}
|
||||
|
||||
@@ -1365,10 +1334,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
*/
|
||||
@Override
|
||||
public void unlock(Item obj) throws PersistenceException, LoginException {
|
||||
if (!(obj instanceof FolderItem) && (obj.eResource() == null || obj.getProperty().eResource() == null)) {
|
||||
// item has been unloaded
|
||||
obj = getUptodateProperty(obj.getProperty()).getItem();
|
||||
}
|
||||
if (getStatus(obj) == ERepositoryStatus.LOCK_BY_USER || obj instanceof JobletDocumentationItem
|
||||
|| obj instanceof JobDocumentationItem) {
|
||||
Date commitDate = obj.getState().getCommitDate();
|
||||
@@ -1530,9 +1495,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
if (!projectManager.isInCurrentMainProject(item)) {
|
||||
return false;
|
||||
}
|
||||
if (getRepositoryContext().isEditableAsReadOnly()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
ERepositoryStatus status = getStatus(item);
|
||||
if (status.isPotentiallyEditable()) {
|
||||
@@ -1705,9 +1667,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
LanguageManager.reset();
|
||||
getRepositoryContext().setProject(project);
|
||||
|
||||
// Check project compatibility
|
||||
checkProjectCompatibility(project);
|
||||
|
||||
currentMonitor = subMonitor.newChild(1, SubMonitor.SUPPRESS_NONE);
|
||||
currentMonitor.beginTask(Messages.getString("ProxyRepositoryFactory.initializeProjectConnection"), 1); //$NON-NLS-1$
|
||||
this.repositoryFactoryFromProvider.beforeLogon(project);
|
||||
@@ -2056,9 +2015,4 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
this.repositoryFactoryFromProvider.updateLockStatus();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModified(Property property) {
|
||||
return repositoryFactoryFromProvider.isModified(property);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,8 +27,9 @@ import org.talend.repository.model.IRepositoryNode;
|
||||
import orgomg.cwm.objectmodel.core.ModelElement;
|
||||
import orgomg.cwm.resource.relational.Catalog;
|
||||
|
||||
|
||||
/**
|
||||
* DOC klliu class global comment. Detailled comment
|
||||
* DOC klliu class global comment. Detailled comment
|
||||
*/
|
||||
public class MetadataCatalogRepositoryObject extends MetadataCatalog implements ISubRepositoryObject {
|
||||
|
||||
@@ -62,7 +63,6 @@ public class MetadataCatalogRepositoryObject extends MetadataCatalog implements
|
||||
this.catalog = catalog;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getProperty() {
|
||||
Property property = viewObject.getProperty();
|
||||
// update table
|
||||
@@ -71,27 +71,22 @@ public class MetadataCatalogRepositoryObject extends MetadataCatalog implements
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return viewObject.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return getCatalog().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return getCatalog().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMetadataObject getAbstractMetadataObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromParent() {
|
||||
}
|
||||
|
||||
@@ -99,94 +94,68 @@ public class MetadataCatalogRepositoryObject extends MetadataCatalog implements
|
||||
// FIXME empty method ?
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getAuthor() {
|
||||
return viewObject.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getChildren() {
|
||||
return this.viewObject.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreationDate() {
|
||||
return viewObject.getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return viewObject.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getInformationStatus() {
|
||||
return viewObject.getInformationStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getModificationDate() {
|
||||
return viewObject.getModificationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return viewObject.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectLabel() {
|
||||
return viewObject.getProjectLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPurpose() {
|
||||
return viewObject.getPurpose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRepositoryNode getRepositoryNode() {
|
||||
return this.repositoryNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getRepositoryStatus() {
|
||||
return viewObject.getRepositoryStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusCode() {
|
||||
return viewObject.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryObjectType getRepositoryObjectType() {
|
||||
return ERepositoryObjectType.METADATA_CON_CATALOG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepositoryNode(IRepositoryNode node) {
|
||||
this.repositoryNode = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelElement getModelElement() {
|
||||
return this.catalog;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.model.repository.IRepositoryViewObject#isModified()
|
||||
*/
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return viewObject.isModified();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,9 @@ import org.talend.repository.model.IRepositoryNode;
|
||||
import orgomg.cwm.objectmodel.core.ModelElement;
|
||||
import orgomg.cwm.resource.relational.Schema;
|
||||
|
||||
|
||||
/**
|
||||
* DOC klliu class global comment. Detailled comment
|
||||
* DOC klliu class global comment. Detailled comment
|
||||
*/
|
||||
public class MetadataSchemaRepositoryObject extends MetadataSchema implements ISubRepositoryObject {
|
||||
|
||||
@@ -57,7 +58,6 @@ public class MetadataSchemaRepositoryObject extends MetadataSchema implements IS
|
||||
this.schema = schema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getProperty() {
|
||||
Property property = viewObject.getProperty();
|
||||
// update table
|
||||
@@ -66,121 +66,90 @@ public class MetadataSchemaRepositoryObject extends MetadataSchema implements IS
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return viewObject.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return getSchema().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return getSchema().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMetadataObject getAbstractMetadataObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromParent() {
|
||||
}
|
||||
|
||||
private void updateCatalog(Property property) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getAuthor() {
|
||||
return viewObject.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getChildren() {
|
||||
return this.viewObject.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreationDate() {
|
||||
return viewObject.getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return viewObject.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getInformationStatus() {
|
||||
return viewObject.getInformationStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getModificationDate() {
|
||||
return viewObject.getModificationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return viewObject.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectLabel() {
|
||||
return viewObject.getProjectLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPurpose() {
|
||||
return viewObject.getPurpose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRepositoryNode getRepositoryNode() {
|
||||
return this.repositoryNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getRepositoryStatus() {
|
||||
return viewObject.getRepositoryStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusCode() {
|
||||
return viewObject.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryObjectType getRepositoryObjectType() {
|
||||
return ERepositoryObjectType.METADATA_CON_SCHEMA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepositoryNode(IRepositoryNode node) {
|
||||
this.repositoryNode = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelElement getModelElement() {
|
||||
return this.schema;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.model.repository.IRepositoryViewObject#isModified()
|
||||
*/
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return viewObject.isModified();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -62,7 +62,6 @@ public class MetadataTableRepositoryObject extends MetadataTable implements ISub
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getProperty() {
|
||||
Property property = viewObject.getProperty();
|
||||
// update table
|
||||
@@ -71,7 +70,6 @@ public class MetadataTableRepositoryObject extends MetadataTable implements ISub
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return viewObject.getVersion();
|
||||
}
|
||||
@@ -94,12 +92,10 @@ public class MetadataTableRepositoryObject extends MetadataTable implements ISub
|
||||
return this.table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMetadataObject getAbstractMetadataObject() {
|
||||
return getTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromParent() {
|
||||
|
||||
if (table.eContainer() instanceof SAPFunctionUnit) {
|
||||
@@ -205,94 +201,68 @@ public class MetadataTableRepositoryObject extends MetadataTable implements ISub
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getAuthor() {
|
||||
return viewObject.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getChildren() {
|
||||
return viewObject.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreationDate() {
|
||||
return viewObject.getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return viewObject.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getInformationStatus() {
|
||||
return viewObject.getInformationStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getModificationDate() {
|
||||
return viewObject.getModificationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return viewObject.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectLabel() {
|
||||
return viewObject.getProjectLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPurpose() {
|
||||
return viewObject.getPurpose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRepositoryNode getRepositoryNode() {
|
||||
return this.repositoryNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getRepositoryStatus() {
|
||||
return viewObject.getRepositoryStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusCode() {
|
||||
return viewObject.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryObjectType getRepositoryObjectType() {
|
||||
return ERepositoryObjectType.METADATA_CON_TABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return SubItemHelper.isDeleted(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepositoryNode(IRepositoryNode node) {
|
||||
this.repositoryNode = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelElement getModelElement() {
|
||||
return this.table;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.model.repository.IRepositoryViewObject#isModified()
|
||||
*/
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return viewObject.isModified();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,9 @@ import org.talend.repository.model.ERepositoryStatus;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import orgomg.cwm.objectmodel.core.ModelElement;
|
||||
|
||||
|
||||
/**
|
||||
* DOC klliu class global comment. Detailled comment
|
||||
* DOC klliu class global comment. Detailled comment
|
||||
*/
|
||||
public class MetadataXmlElementTypeRepositoryObject extends MetadataXmlElementType implements ISubRepositoryObject {
|
||||
|
||||
@@ -46,7 +47,6 @@ public class MetadataXmlElementTypeRepositoryObject extends MetadataXmlElementTy
|
||||
return this.tdXmlElementType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getChildren() {
|
||||
return this.viewObject.getChildren();
|
||||
}
|
||||
@@ -62,7 +62,6 @@ public class MetadataXmlElementTypeRepositoryObject extends MetadataXmlElementTy
|
||||
this.tdXmlElementType = tdElementType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getProperty() {
|
||||
Property property = viewObject.getProperty();
|
||||
updateCatalog(property);
|
||||
@@ -70,116 +69,86 @@ public class MetadataXmlElementTypeRepositoryObject extends MetadataXmlElementTy
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return viewObject.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return getTdXmlElementType().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return getTdXmlElementType().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMetadataObject getAbstractMetadataObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromParent() {
|
||||
}
|
||||
|
||||
private void updateCatalog(Property property) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getAuthor() {
|
||||
return viewObject.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreationDate() {
|
||||
return viewObject.getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return viewObject.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getInformationStatus() {
|
||||
return viewObject.getInformationStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getModificationDate() {
|
||||
return viewObject.getModificationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return viewObject.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectLabel() {
|
||||
return viewObject.getProjectLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPurpose() {
|
||||
return viewObject.getPurpose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRepositoryNode getRepositoryNode() {
|
||||
return this.repositoryNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getRepositoryStatus() {
|
||||
return viewObject.getRepositoryStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusCode() {
|
||||
return viewObject.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryObjectType getRepositoryObjectType() {
|
||||
return ERepositoryObjectType.MDM_ELEMENT_TYPE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepositoryNode(IRepositoryNode node) {
|
||||
this.repositoryNode = node;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelElement getModelElement() {
|
||||
return this.tdXmlElementType;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.model.repository.IRepositoryViewObject#isModified()
|
||||
*/
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return viewObject.isModified();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -27,8 +27,9 @@ import org.talend.repository.model.ERepositoryStatus;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import orgomg.cwm.objectmodel.core.ModelElement;
|
||||
|
||||
|
||||
/**
|
||||
* DOC klliu class global comment. Detailled comment
|
||||
* DOC klliu class global comment. Detailled comment
|
||||
*/
|
||||
public class MetadataXmlSchemaRepositoryObject extends MetadataXmlSchema implements ISubRepositoryObject {
|
||||
|
||||
@@ -42,12 +43,10 @@ public class MetadataXmlSchemaRepositoryObject extends MetadataXmlSchema impleme
|
||||
return this.viewObject;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRepositoryNode getRepositoryNode() {
|
||||
return this.repositoryNode;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
public void setRepositoryNode(IRepositoryNode repositoryNode) {
|
||||
this.repositoryNode = repositoryNode;
|
||||
}
|
||||
@@ -56,7 +55,6 @@ public class MetadataXmlSchemaRepositoryObject extends MetadataXmlSchema impleme
|
||||
return this.tdXmlSchema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getChildren() {
|
||||
return this.viewObject.getChildren();
|
||||
}
|
||||
@@ -72,32 +70,26 @@ public class MetadataXmlSchemaRepositoryObject extends MetadataXmlSchema impleme
|
||||
this.tdXmlSchema = tdXmlSchema;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return getTdXmlSchema().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return getTdXmlSchema().getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMetadataObject getAbstractMetadataObject() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryObjectType getRepositoryObjectType() {
|
||||
return ERepositoryObjectType.MDM_SCHEMA;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromParent() {
|
||||
}
|
||||
|
||||
@@ -105,81 +97,58 @@ public class MetadataXmlSchemaRepositoryObject extends MetadataXmlSchema impleme
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public Property getProperty() {
|
||||
Property property = viewObject.getProperty();
|
||||
updateCatalog(property);
|
||||
return property;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return viewObject.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getAuthor() {
|
||||
return viewObject.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreationDate() {
|
||||
return viewObject.getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return viewObject.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getInformationStatus() {
|
||||
return viewObject.getInformationStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getModificationDate() {
|
||||
return viewObject.getModificationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return viewObject.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectLabel() {
|
||||
return viewObject.getProjectLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPurpose() {
|
||||
return viewObject.getPurpose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getRepositoryStatus() {
|
||||
return viewObject.getRepositoryStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusCode() {
|
||||
return viewObject.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelElement getModelElement() {
|
||||
return this.tdXmlSchema;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.model.repository.IRepositoryViewObject#isModified()
|
||||
*/
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return viewObject.isModified();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -22,8 +22,6 @@ import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.MetadataColumnRepositoryObject;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.repository.IRepositoryContentHandler;
|
||||
import org.talend.core.model.repository.RepositoryContentManager;
|
||||
import org.talend.core.model.repository.RepositoryObject;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.repository.ProjectManager;
|
||||
@@ -59,13 +57,6 @@ public abstract class AbstractCreateAction extends AContextualAction {
|
||||
if (repNode.getObject() instanceof MetadataColumnRepositoryObject) {
|
||||
repNode = repNode.getParent().getParent();
|
||||
}
|
||||
|
||||
for (IRepositoryContentHandler handler : RepositoryContentManager.getHandlers()) {
|
||||
if (handler.hideAction(repNode, this.getClass())) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
init(repNode);
|
||||
repositoryNode = repNode;
|
||||
}
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.List;
|
||||
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.emf.ecore.resource.Resource;
|
||||
@@ -20,8 +23,8 @@ import org.talend.core.IService;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.properties.Property;
|
||||
|
||||
import orgomg.cwm.objectmodel.core.ModelElement;
|
||||
import org.talend.core.model.properties.TDQItem;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
|
||||
/**
|
||||
* DOC mzhao Abstract unload resource service which can be extended by client.
|
||||
@@ -31,11 +34,6 @@ public class AbstractResourceChangesService implements IService {
|
||||
public void handleUnload(Resource toBeUnloadedResource) {
|
||||
}
|
||||
|
||||
// Add new elements to resource, remove elements from resource, delete resource
|
||||
public boolean handleResourceChange(ModelElement modelElement) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void handleLogicalDelete(Property prop) {
|
||||
}
|
||||
|
||||
@@ -76,8 +74,26 @@ public class AbstractResourceChangesService implements IService {
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
public void saveResourceByEMFShared(Resource toSave) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* if move TDQReportItem, need to move the generated doc of it also.
|
||||
*
|
||||
* @param tdqItem
|
||||
* @param tarFolder
|
||||
*/
|
||||
public void moveReportGeneratedDocFolder(TDQItem tdqItem, File tarFolder) {
|
||||
}
|
||||
|
||||
public List<IRepositoryNode> getDependentNodes(IRepositoryNode currentNode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<IRepositoryNode> getDependentConnNodesInRecycleBin(List<IRepositoryNode> children) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void openDependcesDialog(List<IRepositoryNode> nodes) {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,201 +1,201 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.keyvalue.MultiKey;
|
||||
import org.apache.commons.collections.map.MultiKeyMap;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.repository.ICheckDeleteItemReference;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.IRepositoryNode.EProperties;
|
||||
import org.talend.repository.model.ItemReferenceBean;
|
||||
import org.talend.repository.ui.actions.DeleteActionCache;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class RepositoryNodeDeleteManager {
|
||||
|
||||
private static RepositoryNodeDeleteManager instance;
|
||||
|
||||
public static final String EXTENTION_ID = "org.talend.core.repository.checkDeleteItemReference"; //$NON-NLS-1$
|
||||
|
||||
private static final String ATT_CLASS = "class"; //$NON-NLS-1$
|
||||
|
||||
private static final String ATT_PRIORITY = "priority"; //$NON-NLS-1$
|
||||
|
||||
private static IConfigurationElement[] configurationElements;
|
||||
|
||||
private RepositoryNodeDeleteManager() {
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
configurationElements = registry.getConfigurationElementsFor(EXTENTION_ID);
|
||||
}
|
||||
|
||||
public static synchronized RepositoryNodeDeleteManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new RepositoryNodeDeleteManager();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
static class DeleteCheck {
|
||||
|
||||
public final ICheckDeleteItemReference checkDeleteItemReference;
|
||||
|
||||
public final Priority priority;
|
||||
|
||||
enum Priority {
|
||||
LOWEST,
|
||||
LOW,
|
||||
NORMAL,
|
||||
HIGH,
|
||||
HIGHEST
|
||||
}
|
||||
|
||||
public DeleteCheck(ICheckDeleteItemReference checkDeleteItemReference, Priority priority) {
|
||||
this.checkDeleteItemReference = checkDeleteItemReference;
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<ItemReferenceBean> getUnDeleteItems(List<? extends IRepositoryNode> deleteObjs,
|
||||
DeleteActionCache deleteActionCache) {
|
||||
return getUnDeleteItems(deleteObjs, deleteActionCache, true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ItemReferenceBean> getUnDeleteItems(List<? extends IRepositoryNode> deleteNodes,
|
||||
DeleteActionCache deleteActionCache, boolean updateDelList) {
|
||||
List<ItemReferenceBean> beans = new ArrayList<ItemReferenceBean>();
|
||||
Set<ItemReferenceBean> refBeans = new HashSet<ItemReferenceBean>();
|
||||
List<DeleteCheck> deleteChecks = new ArrayList<DeleteCheck>();
|
||||
|
||||
if (deleteNodes == null || deleteNodes.size() == 0) {
|
||||
return beans;
|
||||
}
|
||||
|
||||
try {
|
||||
for (IConfigurationElement element : configurationElements) {
|
||||
ICheckDeleteItemReference checkDeleteItemReference = (ICheckDeleteItemReference) element
|
||||
.createExecutableExtension(ATT_CLASS);
|
||||
String priorityStr = element.getAttribute(ATT_PRIORITY);
|
||||
DeleteCheck.Priority priority = (priorityStr != null && priorityStr.length() > 0) ? DeleteCheck.Priority
|
||||
.valueOf(priorityStr.toUpperCase()) : DeleteCheck.Priority.NORMAL;
|
||||
DeleteCheck deleteCheck = new DeleteCheck(checkDeleteItemReference, priority);
|
||||
if (!deleteChecks.contains(deleteCheck)) {
|
||||
deleteChecks.add(deleteCheck);
|
||||
}
|
||||
}
|
||||
sortDeleteChecks(deleteChecks);
|
||||
for (DeleteCheck deleteCheck : deleteChecks) {
|
||||
refBeans.addAll(deleteCheck.checkDeleteItemReference.getItemReferenceBeans(deleteNodes, deleteActionCache));
|
||||
}
|
||||
|
||||
MultiKeyMap item2beansMap = new MultiKeyMap();
|
||||
for (ItemReferenceBean refBean : refBeans) {
|
||||
List<ItemReferenceBean> beansList = (List<ItemReferenceBean>) item2beansMap.get(refBean.getItemName(),
|
||||
refBean.getItemVersion(), refBean.getItemType());
|
||||
if (beansList == null) {
|
||||
beansList = new ArrayList<ItemReferenceBean>();
|
||||
item2beansMap.put(refBean.getItemName(), refBean.getItemVersion(), refBean.getItemType(), beansList);
|
||||
}
|
||||
if (!beansList.contains(refBean)) {
|
||||
beansList.add(refBean);
|
||||
}
|
||||
}
|
||||
|
||||
Iterator it = item2beansMap.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Object obj = it.next();
|
||||
if (obj instanceof MultiKey) {
|
||||
Object[] keys = ((MultiKey) obj).getKeys();
|
||||
if (keys.length >= 3) {
|
||||
String itemName = String.valueOf(keys[0]);
|
||||
String itemVersion = String.valueOf(keys[1]);
|
||||
ERepositoryObjectType itemType = (ERepositoryObjectType) keys[2];
|
||||
ItemReferenceBean parentBean = new ItemReferenceBean();
|
||||
parentBean.setItemName(itemName);
|
||||
parentBean.setItemVersion(itemVersion);
|
||||
parentBean.setItemType(itemType);
|
||||
parentBean.setHost(true);
|
||||
parentBean.addChildren((List<ItemReferenceBean>) item2beansMap.get(obj));
|
||||
beans.add(parentBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
sortReferenceBeans(beans);
|
||||
|
||||
if (updateDelList) {
|
||||
List<String> unDeleteItemNames = new ArrayList<String>();
|
||||
for (ItemReferenceBean bean : beans) {
|
||||
unDeleteItemNames.add(bean.getItemName());
|
||||
}
|
||||
Iterator<? extends IRepositoryNode> nodeIter = deleteNodes.iterator();
|
||||
while (nodeIter.hasNext()) {
|
||||
IRepositoryNode node = nodeIter.next();
|
||||
Object label = node.getProperties(EProperties.LABEL);
|
||||
if (unDeleteItemNames.contains(label)) {
|
||||
nodeIter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
return beans;
|
||||
}
|
||||
|
||||
private void sortDeleteChecks(List<DeleteCheck> deleteChecks) {
|
||||
Collections.sort(deleteChecks, new Comparator<DeleteCheck>() {
|
||||
|
||||
@Override
|
||||
public int compare(DeleteCheck check1, DeleteCheck check2) {
|
||||
return check1.priority.compareTo(check2.priority);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sortReferenceBeans(List<ItemReferenceBean> beans) {
|
||||
Collections.sort(beans, new Comparator<ItemReferenceBean>() {
|
||||
|
||||
@Override
|
||||
public int compare(ItemReferenceBean bean1, ItemReferenceBean bean2) {
|
||||
int ordinal1 = bean1.getItemType().ordinal();
|
||||
int ordinal2 = bean2.getItemType().ordinal();
|
||||
if (ordinal1 > ordinal2) {
|
||||
return 1;
|
||||
} else if (ordinal1 < ordinal2) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.collections.keyvalue.MultiKey;
|
||||
import org.apache.commons.collections.map.MultiKeyMap;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.core.runtime.IExtensionRegistry;
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.repository.ICheckDeleteItemReference;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.IRepositoryNode.EProperties;
|
||||
import org.talend.repository.model.ItemReferenceBean;
|
||||
import org.talend.repository.ui.actions.DeleteActionCache;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class RepositoryNodeDeleteManager {
|
||||
|
||||
private static RepositoryNodeDeleteManager instance;
|
||||
|
||||
public static final String EXTENTION_ID = "org.talend.core.repository.checkDeleteItemReference"; //$NON-NLS-1$
|
||||
|
||||
private static final String ATT_CLASS = "class"; //$NON-NLS-1$
|
||||
|
||||
private static final String ATT_PRIORITY = "priority"; //$NON-NLS-1$
|
||||
|
||||
private static IConfigurationElement[] configurationElements;
|
||||
|
||||
private RepositoryNodeDeleteManager() {
|
||||
IExtensionRegistry registry = Platform.getExtensionRegistry();
|
||||
configurationElements = registry.getConfigurationElementsFor(EXTENTION_ID);
|
||||
}
|
||||
|
||||
public static synchronized RepositoryNodeDeleteManager getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new RepositoryNodeDeleteManager();
|
||||
}
|
||||
|
||||
return instance;
|
||||
}
|
||||
|
||||
static class DeleteCheck {
|
||||
|
||||
public final ICheckDeleteItemReference checkDeleteItemReference;
|
||||
|
||||
public final Priority priority;
|
||||
|
||||
enum Priority {
|
||||
LOWEST,
|
||||
LOW,
|
||||
NORMAL,
|
||||
HIGH,
|
||||
HIGHEST
|
||||
}
|
||||
|
||||
public DeleteCheck(ICheckDeleteItemReference checkDeleteItemReference, Priority priority) {
|
||||
this.checkDeleteItemReference = checkDeleteItemReference;
|
||||
this.priority = priority;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public List<ItemReferenceBean> getUnDeleteItems(List<? extends IRepositoryNode> deleteObjs,
|
||||
DeleteActionCache deleteActionCache) {
|
||||
return getUnDeleteItems(deleteObjs, deleteActionCache, true);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public List<ItemReferenceBean> getUnDeleteItems(List<? extends IRepositoryNode> deleteNodes,
|
||||
DeleteActionCache deleteActionCache, boolean updateDelList) {
|
||||
List<ItemReferenceBean> beans = new ArrayList<ItemReferenceBean>();
|
||||
Set<ItemReferenceBean> refBeans = new HashSet<ItemReferenceBean>();
|
||||
List<DeleteCheck> deleteChecks = new ArrayList<DeleteCheck>();
|
||||
|
||||
if (deleteNodes == null || deleteNodes.size() == 0) {
|
||||
return beans;
|
||||
}
|
||||
|
||||
try {
|
||||
for (IConfigurationElement element : configurationElements) {
|
||||
ICheckDeleteItemReference checkDeleteItemReference = (ICheckDeleteItemReference) element
|
||||
.createExecutableExtension(ATT_CLASS);
|
||||
String priorityStr = element.getAttribute(ATT_PRIORITY);
|
||||
DeleteCheck.Priority priority = (priorityStr != null && priorityStr.length() > 0) ? DeleteCheck.Priority
|
||||
.valueOf(priorityStr.toUpperCase()) : DeleteCheck.Priority.NORMAL;
|
||||
DeleteCheck deleteCheck = new DeleteCheck(checkDeleteItemReference, priority);
|
||||
if (!deleteChecks.contains(deleteCheck)) {
|
||||
deleteChecks.add(deleteCheck);
|
||||
}
|
||||
}
|
||||
sortDeleteChecks(deleteChecks);
|
||||
for (DeleteCheck deleteCheck : deleteChecks) {
|
||||
refBeans.addAll(deleteCheck.checkDeleteItemReference.getItemReferenceBeans(deleteNodes, deleteActionCache));
|
||||
}
|
||||
|
||||
MultiKeyMap item2beansMap = new MultiKeyMap();
|
||||
for (ItemReferenceBean refBean : refBeans) {
|
||||
List<ItemReferenceBean> beansList = (List<ItemReferenceBean>) item2beansMap.get(refBean.getItemName(),
|
||||
refBean.getItemVersion(), refBean.getItemType());
|
||||
if (beansList == null) {
|
||||
beansList = new ArrayList<ItemReferenceBean>();
|
||||
item2beansMap.put(refBean.getItemName(), refBean.getItemVersion(), refBean.getItemType(), beansList);
|
||||
}
|
||||
if (!beansList.contains(refBean)) {
|
||||
beansList.add(refBean);
|
||||
}
|
||||
}
|
||||
|
||||
Iterator it = item2beansMap.keySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Object obj = it.next();
|
||||
if (obj instanceof MultiKey) {
|
||||
Object[] keys = ((MultiKey) obj).getKeys();
|
||||
if (keys.length >= 3) {
|
||||
String itemName = String.valueOf(keys[0]);
|
||||
String itemVersion = String.valueOf(keys[1]);
|
||||
ERepositoryObjectType itemType = (ERepositoryObjectType) keys[2];
|
||||
ItemReferenceBean parentBean = new ItemReferenceBean();
|
||||
parentBean.setItemName(itemName);
|
||||
parentBean.setItemVersion(itemVersion);
|
||||
parentBean.setItemType(itemType);
|
||||
parentBean.setHost(true);
|
||||
parentBean.addChildren((List<ItemReferenceBean>) item2beansMap.get(obj));
|
||||
beans.add(parentBean);
|
||||
}
|
||||
}
|
||||
}
|
||||
sortReferenceBeans(beans);
|
||||
|
||||
if (updateDelList) {
|
||||
List<String> unDeleteItemNames = new ArrayList<String>();
|
||||
for (ItemReferenceBean bean : beans) {
|
||||
unDeleteItemNames.add(bean.getItemName());
|
||||
}
|
||||
Iterator<? extends IRepositoryNode> nodeIter = deleteNodes.iterator();
|
||||
while (nodeIter.hasNext()) {
|
||||
IRepositoryNode node = nodeIter.next();
|
||||
Object label = node.getProperties(EProperties.LABEL);
|
||||
if (unDeleteItemNames.contains(label)) {
|
||||
nodeIter.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
return beans;
|
||||
}
|
||||
|
||||
private void sortDeleteChecks(List<DeleteCheck> deleteChecks) {
|
||||
Collections.sort(deleteChecks, new Comparator<DeleteCheck>() {
|
||||
|
||||
@Override
|
||||
public int compare(DeleteCheck check1, DeleteCheck check2) {
|
||||
return check1.priority.compareTo(check2.priority);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void sortReferenceBeans(List<ItemReferenceBean> beans) {
|
||||
Collections.sort(beans, new Comparator<ItemReferenceBean>() {
|
||||
|
||||
@Override
|
||||
public int compare(ItemReferenceBean bean1, ItemReferenceBean bean2) {
|
||||
int ordinal1 = bean1.getItemType().ordinal();
|
||||
int ordinal2 = bean2.getItemType().ordinal();
|
||||
if (ordinal1 > ordinal2) {
|
||||
return 1;
|
||||
} else if (ordinal1 < ordinal2) {
|
||||
return -1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,123 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
import org.talend.commons.ui.runtime.image.ECoreImage;
|
||||
import org.talend.core.model.metadata.MetadataColumnRepositoryObject;
|
||||
import org.talend.core.model.metadata.builder.connection.Connection;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataColumn;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
import org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject;
|
||||
import org.talend.cwm.helper.ConnectionHelper;
|
||||
import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.repository.model.IRepositoryNode.ENodeType;
|
||||
import org.talend.repository.model.IRepositoryNode.EProperties;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
import org.talend.repository.model.StableRepositoryNode;
|
||||
|
||||
/**
|
||||
* DOC ycbai class global comment. Detailled comment
|
||||
*/
|
||||
public class RepositoryNodeManager {
|
||||
|
||||
public static void createTables(RepositoryNode node, IRepositoryViewObject repObj, Connection metadataConnection) {
|
||||
createTables(node, repObj, metadataConnection, ERepositoryObjectType.METADATA_CON_TABLE);
|
||||
}
|
||||
|
||||
public static void createTables(RepositoryNode node, final IRepositoryViewObject repObj, Connection metadataConnection,
|
||||
ERepositoryObjectType repositoryObjectType) {
|
||||
Set<MetadataTable> tableset = ConnectionHelper.getTables(metadataConnection);
|
||||
for (MetadataTable currentTable : tableset) {
|
||||
if (currentTable == null) {
|
||||
continue;
|
||||
}
|
||||
RepositoryNode tableNode = createMetatableNode(node, repObj, currentTable, repositoryObjectType);
|
||||
if (!SubItemHelper.isDeleted(currentTable)) {
|
||||
node.getChildren().add(tableNode);
|
||||
}
|
||||
if (currentTable.getColumns().size() > 0) {
|
||||
createColumns(tableNode, repObj, currentTable);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static RepositoryNode createMetatableNode(RepositoryNode node, IRepositoryViewObject repObj, MetadataTable table) {
|
||||
return createMetatableNode(node, repObj, table, ERepositoryObjectType.METADATA_CON_TABLE);
|
||||
}
|
||||
|
||||
public static RepositoryNode createMetatableNode(RepositoryNode node, IRepositoryViewObject repObj, MetadataTable table,
|
||||
ERepositoryObjectType repositoryObjectType) {
|
||||
MetadataTableRepositoryObject modelObj = new MetadataTableRepositoryObject(repObj, table);
|
||||
RepositoryNode tableNode = new RepositoryNode(modelObj, node, ENodeType.REPOSITORY_ELEMENT);
|
||||
tableNode.setProperties(EProperties.LABEL, modelObj.getLabel());
|
||||
tableNode.setProperties(EProperties.CONTENT_TYPE, repositoryObjectType);
|
||||
return tableNode;
|
||||
}
|
||||
|
||||
public static void createColumns(RepositoryNode tableNode, IRepositoryViewObject repObj, MetadataTable metadataTable) {
|
||||
createColumns(tableNode, repObj, metadataTable, ERepositoryObjectType.METADATA_CON_COLUMN);
|
||||
}
|
||||
|
||||
public static void createColumns(RepositoryNode tableNode, IRepositoryViewObject repObj, MetadataTable metadataTable,
|
||||
String columnsFolderName) {
|
||||
createColumns(tableNode, repObj, metadataTable, ERepositoryObjectType.METADATA_CON_COLUMN, columnsFolderName);
|
||||
}
|
||||
|
||||
public static void createColumns(RepositoryNode tableNode, IRepositoryViewObject repObj, MetadataTable metadataTable,
|
||||
ERepositoryObjectType repositoryObjectType) {
|
||||
createColumns(tableNode, repObj, metadataTable, repositoryObjectType, Messages.getString("ProjectRepositoryNode.columns"));
|
||||
}
|
||||
|
||||
public static void createColumns(RepositoryNode tableNode, IRepositoryViewObject repObj, MetadataTable metadataTable,
|
||||
ERepositoryObjectType repositoryObjectType, String columnsFolderName) {
|
||||
List<MetadataColumn> columnList = new ArrayList<MetadataColumn>();
|
||||
columnList.addAll(metadataTable.getColumns());
|
||||
int num = columnList.size();
|
||||
StringBuffer floderName = new StringBuffer();
|
||||
floderName.append(columnsFolderName);//$NON-NLS-1$
|
||||
floderName.append("(");//$NON-NLS-1$
|
||||
floderName.append(num);
|
||||
floderName.append(")");//$NON-NLS-1$
|
||||
RepositoryNode columnsNode = new StableRepositoryNode(tableNode, floderName.toString(), ECoreImage.FOLDER_CLOSE_ICON);
|
||||
tableNode.getChildren().add(columnsNode);
|
||||
|
||||
for (MetadataColumn column : columnList) {
|
||||
if (column == null) {
|
||||
continue;
|
||||
}
|
||||
RepositoryNode columnNode = createMataColumnNode(columnsNode, repObj, column);
|
||||
columnsNode.getChildren().add(columnNode);
|
||||
}
|
||||
}
|
||||
|
||||
public static RepositoryNode createMataColumnNode(RepositoryNode node, IRepositoryViewObject repObj, MetadataColumn column) {
|
||||
return createMataColumnNode(node, repObj, column, ERepositoryObjectType.METADATA_CON_COLUMN);
|
||||
}
|
||||
|
||||
public static RepositoryNode createMataColumnNode(RepositoryNode node, IRepositoryViewObject repObj, MetadataColumn column,
|
||||
ERepositoryObjectType repositoryObjectType) {
|
||||
MetadataColumnRepositoryObject columnObj = new MetadataColumnRepositoryObject(repObj, column);
|
||||
RepositoryNode columnNode = new RepositoryNode(columnObj, node, ENodeType.REPOSITORY_ELEMENT);
|
||||
columnNode.setProperties(EProperties.LABEL, columnObj.getLabel());
|
||||
columnNode.setProperties(EProperties.CONTENT_TYPE, repositoryObjectType);
|
||||
return columnNode;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,63 +1,64 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.utils.RepositoryManagerHelper;
|
||||
import org.talend.repository.model.ContextReferenceBean;
|
||||
|
||||
/**
|
||||
* @author Marvin Wang
|
||||
* @version 1.0 jdk1.6
|
||||
* @date Sep 14, 2012
|
||||
*/
|
||||
public class RepositoryReferenceBeanUtils {
|
||||
|
||||
public static boolean hasReferenceBean(List<ContextReferenceBean> list, String beanName, String beanVersion) {
|
||||
boolean has = false;
|
||||
|
||||
if (list == null) {
|
||||
list = new ArrayList<ContextReferenceBean>();
|
||||
has = false;
|
||||
} else {
|
||||
for (ContextReferenceBean loopBean : list) {
|
||||
String loopBeanName = loopBean.getRelateName();
|
||||
String loopBeanVersion = loopBean.getRelateVersion();
|
||||
if (loopBeanName != null && !"".equals(loopBeanName) && loopBeanName.equals(beanName) && loopBeanVersion != null
|
||||
&& !"".equals(loopBeanVersion) && loopBeanVersion.equals(beanVersion)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return has;
|
||||
}
|
||||
|
||||
public static boolean isOpenedProcess(IProcess2 process){
|
||||
List<IProcess2> openedProcesses = RepositoryManagerHelper.getOpenedProcess();
|
||||
boolean isOpenedProcess = false;
|
||||
if (openedProcesses != null && openedProcesses.size() > 0) {
|
||||
for (IProcess2 tempPro : openedProcesses) {
|
||||
if (process.getId().equals(tempPro.getId())) {
|
||||
isOpenedProcess = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isOpenedProcess;
|
||||
}
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.talend.core.model.process.IProcess2;
|
||||
import org.talend.core.model.utils.RepositoryManagerHelper;
|
||||
import org.talend.repository.model.ContextReferenceBean;
|
||||
|
||||
/**
|
||||
* DOC Marvin class global comment. Detailled comment <br/>
|
||||
*
|
||||
* $Id: talend.epf 55206 2011-02-15 17:32:14Z mhirt $
|
||||
*
|
||||
*/
|
||||
public class RepositoryReferenceBeanUtils {
|
||||
|
||||
public static boolean hasReferenceBean(List<ContextReferenceBean> list, String beanName, String beanVersion) {
|
||||
boolean has = false;
|
||||
|
||||
if (list == null) {
|
||||
list = new ArrayList<ContextReferenceBean>();
|
||||
has = false;
|
||||
} else {
|
||||
for (ContextReferenceBean loopBean : list) {
|
||||
String loopBeanName = loopBean.getRelateName();
|
||||
String loopBeanVersion = loopBean.getRelateVersion();
|
||||
if (loopBeanName != null && !"".equals(loopBeanName) && loopBeanName.equals(beanName) && loopBeanVersion != null
|
||||
&& !"".equals(loopBeanVersion) && loopBeanVersion.equals(beanVersion)) {
|
||||
has = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return has;
|
||||
}
|
||||
|
||||
public static boolean isOpenedProcess(IProcess2 process) {
|
||||
List<IProcess2> openedProcesses = RepositoryManagerHelper.getOpenedProcess();
|
||||
boolean isOpenedProcess = false;
|
||||
if (openedProcesses != null && openedProcesses.size() > 0) {
|
||||
for (IProcess2 tempPro : openedProcesses) {
|
||||
if (process.getId().equals(tempPro.getId())) {
|
||||
isOpenedProcess = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return isOpenedProcess;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,10 @@
|
||||
// ============================================================================
|
||||
package org.talend.core.repository.utils;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.net.URISyntaxException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
@@ -37,8 +36,6 @@ import org.eclipse.emf.ecore.resource.ResourceSet;
|
||||
import org.eclipse.emf.ecore.resource.URIConverter;
|
||||
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
|
||||
import org.eclipse.emf.ecore.util.EcoreUtil;
|
||||
import org.eclipse.emf.ecore.xmi.XMLResource;
|
||||
import org.eclipse.emf.ecore.xmi.impl.XMLParserPoolImpl;
|
||||
import org.talend.commons.emf.EmfHelper;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
@@ -76,6 +73,8 @@ import org.talend.repository.ProjectManager;
|
||||
*/
|
||||
public class XmiResourceManager {
|
||||
|
||||
private static final String OLD_PROJECT_FILENAME = "talendProject"; //$NON-NLS-1$
|
||||
|
||||
// PTODO mhelleboid should use a custom ResourceFactory
|
||||
// PTODO mhelleboid test duplicate resourcesUri in resourceSet !
|
||||
|
||||
@@ -87,20 +86,14 @@ public class XmiResourceManager {
|
||||
|
||||
public XmiResourceManager() {
|
||||
setUseOldProjectFile(false);
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_ATTACHMENT, Boolean.TRUE);
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, Boolean.TRUE);
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl());
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap<Object, Object>());
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.FALSE);
|
||||
resourceSet.getLoadOptions().put("OPTION_DEFER_IDREF_RESOLUTION", Boolean.TRUE);
|
||||
resourceSet.getLoadOptions().put("OPTION_USE_PARSER_POOL", Boolean.TRUE);
|
||||
}
|
||||
|
||||
public void resetResourceSet() {
|
||||
resourceSet = new ResourceSetImpl();
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_ATTACHMENT, Boolean.TRUE);
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_DEFER_IDREF_RESOLUTION, Boolean.TRUE);
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_USE_PARSER_POOL, new XMLParserPoolImpl());
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_USE_XML_NAME_TO_FEATURE_MAP, new HashMap<Object, Object>());
|
||||
resourceSet.getLoadOptions().put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.FALSE);
|
||||
resourceSet.getLoadOptions().put("OPTION_DEFER_IDREF_RESOLUTION", Boolean.TRUE);
|
||||
resourceSet.getLoadOptions().put("OPTION_USE_PARSER_POOL", Boolean.TRUE);
|
||||
}
|
||||
|
||||
public Project loadProject(IProject project) throws PersistenceException {
|
||||
@@ -129,11 +122,12 @@ public class XmiResourceManager {
|
||||
|
||||
public void loadScreenshots(Property property, ProcessType processType) {
|
||||
Resource screenshotResource = getScreenshotResource(property.getItem());
|
||||
processType.getScreenshots().addAll(screenshotResource.getContents());
|
||||
|
||||
if (screenshotResource != null) { // if no screenshot, we will try to add later when save
|
||||
processType.getScreenshots().addAll(screenshotResource.getContents());
|
||||
}
|
||||
}
|
||||
|
||||
public Property loadProperty(IResource iResource) {
|
||||
public synchronized Property loadProperty(IResource iResource) {
|
||||
// force unload old version, or the UI won't be synchronized all the time to the current file.
|
||||
// this is only if a user update itself a .item or .properties, or for SVN repository.
|
||||
//
|
||||
@@ -199,8 +193,8 @@ public class XmiResourceManager {
|
||||
public Resource createTempProjectResource() {
|
||||
URI uri = null;
|
||||
try {
|
||||
uri = URI.createPlatformResourceURI(Platform.getInstallLocation().getURL().toURI().toString());
|
||||
} catch (URISyntaxException e) {
|
||||
uri = URI.createPlatformResourceURI(Platform.getInstallLocation().getURL().getFile(), true);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return resourceSet.createResource(uri);
|
||||
@@ -221,36 +215,41 @@ public class XmiResourceManager {
|
||||
return resourceSet.createResource(propertyResourceURI);
|
||||
}
|
||||
|
||||
public Resource getReferenceFileResource(Resource itemResource, String extension, boolean needLoad) {
|
||||
URI referenceFileURI = getReferenceFileURI(itemResource.getURI(), extension);
|
||||
public Resource getReferenceFileResource(Resource itemResource, ReferenceFileItem refFile, boolean needLoad) {
|
||||
URI referenceFileURI = getReferenceFileURI(itemResource.getURI(), refFile.getExtension());
|
||||
URIConverter converter = resourceSet.getURIConverter();
|
||||
Resource referenceResource = new ByteArrayResource(referenceFileURI);
|
||||
InputStream inputStream = null;
|
||||
|
||||
List<Resource> resources = new ArrayList<Resource>(resourceSet.getResources());
|
||||
for (Resource res : resources) {
|
||||
if (res != null && referenceFileURI.toString().equals(res.getURI().toString())) {
|
||||
res.unload();
|
||||
resourceSet.getResources().remove(res);
|
||||
// in case ESB load reference file from the physcial file,but DI need reference from the EMF,so add this flag
|
||||
if (refFile.isReloadFromFile()) {
|
||||
for (Resource res : resources) {
|
||||
if (res != null && referenceFileURI.toString().equals(res.getURI().toString())) {
|
||||
res.unload();
|
||||
resourceSet.getResources().remove(res);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
resourceSet.getResources().add(referenceResource);
|
||||
try {
|
||||
if (needLoad) {
|
||||
inputStream = converter.createInputStream(referenceFileURI);
|
||||
referenceResource.load(inputStream, null);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
resourceSet.getResources().add(referenceResource);
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
if (needLoad) {
|
||||
inputStream = converter.createInputStream(referenceFileURI);
|
||||
referenceResource.load(inputStream, null);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
try {
|
||||
if (inputStream != null) {
|
||||
inputStream.close();
|
||||
}
|
||||
} catch (IOException e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
referenceResource = resourceSet.getResource(referenceFileURI, true);
|
||||
}
|
||||
return referenceResource;
|
||||
}
|
||||
@@ -342,17 +341,41 @@ public class XmiResourceManager {
|
||||
return itemResource;
|
||||
}
|
||||
|
||||
public Resource getScreenshotResource(Item item) {
|
||||
return getScreenshotResource(item, false);
|
||||
}
|
||||
|
||||
/*
|
||||
* Get a resource obj from Item resource file. if the resouce file does not exist ,will create it first.
|
||||
*/
|
||||
public Resource getScreenshotResource(Item item) {
|
||||
public Resource getScreenshotResource(Item item, boolean createIfNotExist) {
|
||||
URI itemResourceURI = null;
|
||||
itemResourceURI = getScreenshotResourceURI(getItemURI(item));
|
||||
Resource itemResource;
|
||||
try {
|
||||
// judge whether the physical file exists or not
|
||||
itemResource = resourceSet.getResource(itemResourceURI, true);
|
||||
} catch (Exception e) {
|
||||
boolean fileExist = false;
|
||||
if (itemResourceURI.isFile()) {
|
||||
fileExist = new File(itemResourceURI.toFileString()).exists();
|
||||
} else {
|
||||
IPath path = URIHelper.convert(itemResourceURI);
|
||||
if (path != null) {
|
||||
IFile file = ResourcesPlugin.getWorkspace().getRoot().getFile(path);
|
||||
if (file.exists()) {
|
||||
fileExist = true;
|
||||
}
|
||||
} else {
|
||||
fileExist = false;
|
||||
}
|
||||
}
|
||||
Resource itemResource = null;
|
||||
if (fileExist) {
|
||||
try {
|
||||
// judge whether the physical file exists or not
|
||||
itemResource = resourceSet.getResource(itemResourceURI, true);
|
||||
} catch (Exception e) {
|
||||
// do nothing, consider the file don't exist
|
||||
itemResource = null;
|
||||
}
|
||||
}
|
||||
if (itemResource == null && createIfNotExist) {
|
||||
itemResource = resourceSet.createResource(itemResourceURI);
|
||||
}
|
||||
return itemResource;
|
||||
@@ -661,7 +684,7 @@ public class XmiResourceManager {
|
||||
|
||||
public String getProjectFilename() {
|
||||
if (useOldProjectFile) {
|
||||
return FileConstants.OLD_TALEND_PROJECT_FILENAME;
|
||||
return OLD_PROJECT_FILENAME;
|
||||
} else {
|
||||
return FileConstants.LOCAL_PROJECT_FILENAME;
|
||||
}
|
||||
|
||||
@@ -49,10 +49,12 @@ public class RepositoryEditorInput extends FileEditorInput implements IRepositor
|
||||
return name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItem() {
|
||||
return this.item;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setItem(Item item) {
|
||||
this.item = item;
|
||||
if (item != null) {
|
||||
@@ -62,14 +64,17 @@ public class RepositoryEditorInput extends FileEditorInput implements IRepositor
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isReadOnly() {
|
||||
return this.readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setReadOnly(boolean readOnly) {
|
||||
this.readOnly = readOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(final Object obj) {
|
||||
if (this == obj) {
|
||||
return true;
|
||||
@@ -89,6 +94,7 @@ public class RepositoryEditorInput extends FileEditorInput implements IRepositor
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
if (getItem() != null) {
|
||||
return super.hashCode() & getItem().hashCode();
|
||||
@@ -98,6 +104,7 @@ public class RepositoryEditorInput extends FileEditorInput implements IRepositor
|
||||
|
||||
protected RepositoryNode repositoryNode;
|
||||
|
||||
@Override
|
||||
public RepositoryNode getRepositoryNode() {
|
||||
return this.repositoryNode;
|
||||
}
|
||||
@@ -107,6 +114,7 @@ public class RepositoryEditorInput extends FileEditorInput implements IRepositor
|
||||
*
|
||||
* @param node
|
||||
*/
|
||||
@Override
|
||||
public void setRepositoryNode(IRepositoryNode repositoryNode) {
|
||||
if (repositoryNode != null) {
|
||||
this.repositoryNode = (RepositoryNode) repositoryNode;
|
||||
|
||||
@@ -55,7 +55,6 @@ public class MetadataTableRepositoryObject extends MetadataTable implements ISub
|
||||
this.table = table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getProperty() {
|
||||
Property property = viewObject.getProperty();
|
||||
// update table
|
||||
@@ -64,7 +63,6 @@ public class MetadataTableRepositoryObject extends MetadataTable implements ISub
|
||||
}
|
||||
|
||||
// @Override
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return viewObject.getVersion();
|
||||
}
|
||||
@@ -87,12 +85,10 @@ public class MetadataTableRepositoryObject extends MetadataTable implements ISub
|
||||
return this.table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMetadataObject getAbstractMetadataObject() {
|
||||
return getTable();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromParent() {
|
||||
|
||||
if (table.eContainer() instanceof SAPFunctionUnit) {
|
||||
@@ -167,94 +163,68 @@ public class MetadataTableRepositoryObject extends MetadataTable implements ISub
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getAuthor() {
|
||||
return viewObject.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getChildren() {
|
||||
return viewObject.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreationDate() {
|
||||
return viewObject.getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return viewObject.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getInformationStatus() {
|
||||
return viewObject.getInformationStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getModificationDate() {
|
||||
return viewObject.getModificationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return viewObject.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectLabel() {
|
||||
return viewObject.getProjectLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPurpose() {
|
||||
return viewObject.getPurpose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRepositoryNode getRepositoryNode() {
|
||||
return viewObject.getRepositoryNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getRepositoryStatus() {
|
||||
return viewObject.getRepositoryStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusCode() {
|
||||
return viewObject.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryObjectType getRepositoryObjectType() {
|
||||
return ERepositoryObjectType.METADATA_CON_TABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return SubItemHelper.isDeleted(table);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepositoryNode(IRepositoryNode node) {
|
||||
viewObject.setRepositoryNode(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelElement getModelElement() {
|
||||
return this.table;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.model.repository.IRepositoryViewObject#isModified()
|
||||
*/
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return viewObject.isModified();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -464,6 +464,8 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
refProject.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.REFERENCED_PROJECTS);
|
||||
nodes.add(refProject);
|
||||
}
|
||||
// delete the hidden nodes
|
||||
deleteHiddenNodes(nodes);
|
||||
// *init the repository node from extension
|
||||
initExtensionRepositoryNodes(curParentNode);
|
||||
|
||||
@@ -476,6 +478,31 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
collectRepositoryNodes(curParentNode);
|
||||
}
|
||||
|
||||
private void deleteHiddenNodes(List<IRepositoryNode> nodes) {
|
||||
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IBrandingService.class)) {
|
||||
IBrandingService service = (IBrandingService) GlobalServiceRegister.getDefault().getService(IBrandingService.class);
|
||||
List<IRepositoryNode> hiddens = service.getBrandingConfiguration().getHiddenRepositoryCategory(this, "DI");
|
||||
for (IRepositoryNode node : hiddens) {
|
||||
Iterator<IRepositoryNode> it = nodes.iterator();
|
||||
while (it.hasNext()) {
|
||||
IRepositoryNode curNode = it.next();
|
||||
if (curNode.getContentType() != null && curNode.getContentType().equals(ERepositoryObjectType.METADATA)) {
|
||||
for (IRepositoryNode curNode2 : curNode.getChildren()) {
|
||||
if (curNode2.equals(node)) {
|
||||
curNode.getChildren().remove(curNode2);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (curNode.equals(node)) {
|
||||
it.remove();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void collectRepositoryNodes(IRepositoryNode curParentNode) {
|
||||
if (repositoryNodeMap == null) {
|
||||
repositoryNodeMap = new HashMap<String, RepositoryNode>();
|
||||
@@ -645,7 +672,8 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
private void intitializeRefProject(Project project, Object parent) {
|
||||
for (ProjectReference refProject : (List<ProjectReference>) project.getReferencedProjects()) {
|
||||
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(project);
|
||||
String parentBranch = ProxyRepositoryFactory.getInstance().getRepositoryContext().getFields()
|
||||
.get(IProxyRepositoryFactory.BRANCH_SELECTION + "_" + project.getTechnicalLabel()); //$NON-NLS-1$
|
||||
if (refProject.getBranch() == null || parentBranch.equals(refProject.getBranch())) {
|
||||
Project p = refProject.getReferencedProject();
|
||||
List<Project> list = nodeAndProject.get(parent);
|
||||
@@ -887,11 +915,8 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
} else if (item.getState() != null && item.getState().isDeleted()) {
|
||||
try {
|
||||
if (ProxyRepositoryFactory.getInstance().getLastVersion(item.getProperty().getId()) != null
|
||||
&& item.getProperty()
|
||||
.getVersion()
|
||||
.equals(ProxyRepositoryFactory.getInstance().getLastVersion(item.getProperty().getId())
|
||||
.getVersion())) {
|
||||
if (item.getProperty().getVersion()
|
||||
.equals(ProxyRepositoryFactory.getInstance().getLastVersion(item.getProperty().getId()).getVersion())) {
|
||||
RepositoryNode repNode = new RepositoryNode(new RepositoryViewObject(item.getProperty()), currentParentNode,
|
||||
ENodeType.REPOSITORY_ELEMENT);
|
||||
repNode.setProperties(EProperties.CONTENT_TYPE, itemType);
|
||||
@@ -957,18 +982,18 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
|
||||
if (connection != null) {
|
||||
QueriesConnection queriesConnection = connection.getQueries();
|
||||
if (queriesConnection != null) {
|
||||
for (Query query : queriesConnection.getQuery()) {
|
||||
if (SubItemHelper.isDeleted(query)) {
|
||||
RepositoryNode queryNode = createQueryNode(currentParentNode,
|
||||
new RepositoryViewObject(item.getProperty()), query);
|
||||
currentParentNode.getChildren().add(queryNode);
|
||||
queryNode.setParent(currentParentNode);
|
||||
}
|
||||
QueriesConnection queriesConnection = connection.getQueries();
|
||||
if (queriesConnection != null) {
|
||||
for (Query query : queriesConnection.getQuery()) {
|
||||
if (SubItemHelper.isDeleted(query)) {
|
||||
RepositoryNode queryNode = createQueryNode(currentParentNode,
|
||||
new RepositoryViewObject(item.getProperty()), query);
|
||||
currentParentNode.getChildren().add(queryNode);
|
||||
queryNode.setParent(currentParentNode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1147,7 +1172,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
"ProjectRepositoryNode.itemInvalid", repositoryObject.getRepositoryObjectType(), //$NON-NLS-1$,
|
||||
repositoryObject.getLabel()));
|
||||
|
||||
if (repositoryObject.getProperty().getInformations().isEmpty()) {
|
||||
if (repositoryObject.getProperty() != null && repositoryObject.getProperty().getInformations().isEmpty()) {
|
||||
Information info = PropertiesFactory.eINSTANCE.createInformation();
|
||||
info.setLevel(InformationLevel.ERROR_LITERAL);
|
||||
info.setText(Messages.getString("ProjectRepositoryNode.invalidItem")); //$NON-NLS-1$
|
||||
@@ -1184,7 +1209,8 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
private void handleReferenced(RepositoryNode parent) {
|
||||
if (parent.getType().equals(ENodeType.SYSTEM_FOLDER)) {
|
||||
for (ProjectReference refProject : (List<ProjectReference>) project.getEmfProject().getReferencedProjects()) {
|
||||
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(project);
|
||||
String parentBranch = ProxyRepositoryFactory.getInstance().getRepositoryContext().getFields()
|
||||
.get(IProxyRepositoryFactory.BRANCH_SELECTION + "_" + project.getTechnicalLabel()); //$NON-NLS-1$
|
||||
// if not a DB ref project, modified by nma, order 12519
|
||||
if (refProject.getReferencedProject().getUrl() != null
|
||||
&& refProject.getReferencedProject().getUrl().startsWith("teneo") //$NON-NLS-1$
|
||||
@@ -1813,7 +1839,7 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
|
||||
public boolean getMergeRefProject() {
|
||||
IPreferenceStore preferenceStore = RepositoryManager.getPreferenceStore();
|
||||
IPreferenceStore preferenceStore = RepositoryManager.getRepositoryPreferenceStore();
|
||||
return preferenceStore.getBoolean(IRepositoryPrefConstants.MERGE_REFERENCE_PROJECT);
|
||||
}
|
||||
|
||||
@@ -1901,9 +1927,4 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
}
|
||||
super.dispose();
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
// reset it
|
||||
defaultProjRepoNode = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,24 +44,20 @@ public class QueryRepositoryObject extends org.talend.core.model.metadata.Query
|
||||
this.query = table;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Property getProperty() {
|
||||
Property property = repObj.getProperty();
|
||||
updateQuery(property);
|
||||
return property;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getVersion() {
|
||||
return repObj.getVersion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getLabel() {
|
||||
return query.getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return query.getId();
|
||||
}
|
||||
@@ -70,12 +66,10 @@ public class QueryRepositoryObject extends org.talend.core.model.metadata.Query
|
||||
return query;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AbstractMetadataObject getAbstractMetadataObject() {
|
||||
return getQuery();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeFromParent() {
|
||||
query.getQueries().getQuery().remove(query);
|
||||
}
|
||||
@@ -104,94 +98,68 @@ public class QueryRepositoryObject extends org.talend.core.model.metadata.Query
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getAuthor() {
|
||||
return repObj.getAuthor();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IRepositoryViewObject> getChildren() {
|
||||
return repObj.getChildren();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getCreationDate() {
|
||||
return repObj.getCreationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescription() {
|
||||
return repObj.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getInformationStatus() {
|
||||
return repObj.getInformationStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Date getModificationDate() {
|
||||
return repObj.getModificationDate();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPath() {
|
||||
return repObj.getPath();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProjectLabel() {
|
||||
return repObj.getProjectLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getPurpose() {
|
||||
return repObj.getPurpose();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IRepositoryNode getRepositoryNode() {
|
||||
return repObj.getRepositoryNode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryStatus getRepositoryStatus() {
|
||||
return repObj.getRepositoryStatus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getStatusCode() {
|
||||
return repObj.getStatusCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ERepositoryObjectType getRepositoryObjectType() {
|
||||
return ERepositoryObjectType.METADATA_CON_QUERY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDeleted() {
|
||||
return repObj.isDeleted();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRepositoryNode(IRepositoryNode node) {
|
||||
repObj.setRepositoryNode(node);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ModelElement getModelElement() {
|
||||
return this.query;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.core.model.repository.IRepositoryViewObject#isModified()
|
||||
*/
|
||||
@Override
|
||||
public boolean isModified() {
|
||||
return repObj.isModified();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ public class CopyObjectAction {
|
||||
}
|
||||
|
||||
private void copySingleVersionItem(final Item item, final IPath path) {
|
||||
final RepositoryWorkUnit<Object> workUnit = new RepositoryWorkUnit<Object>("", this) {//$NON-NLS-1$
|
||||
final RepositoryWorkUnit<Object> workUnit = new RepositoryWorkUnit<Object>("", this) {//$NON-NLS-1$
|
||||
|
||||
@Override
|
||||
protected void run() throws LoginException, PersistenceException {
|
||||
|
||||
@@ -21,8 +21,6 @@ import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.exception.PersistenceException;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.resources.ResourceUtils;
|
||||
import org.talend.core.model.properties.ConnectionItem;
|
||||
import org.talend.core.model.properties.Item;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.repository.RepositoryManager;
|
||||
@@ -34,6 +32,7 @@ import org.talend.core.repository.utils.AbstractResourceChangesService;
|
||||
import org.talend.core.repository.utils.TDQServiceRegister;
|
||||
import org.talend.repository.model.ERepositoryStatus;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode;
|
||||
import org.talend.repository.model.IRepositoryNode.ENodeType;
|
||||
import org.talend.repository.model.IRepositoryNode.EProperties;
|
||||
import org.talend.repository.model.JobletReferenceBean;
|
||||
@@ -291,11 +290,10 @@ public class MoveObjectAction {
|
||||
|| repositoryObjectType == ERepositoryObjectType.METADATA_MDMCONNECTION) {
|
||||
AbstractResourceChangesService resourceChangeService = TDQServiceRegister.getInstance()
|
||||
.getResourceChangeService(AbstractResourceChangesService.class);
|
||||
Item item = objectToMove.getProperty() == null ? null : objectToMove.getProperty().getItem();
|
||||
if (null != resourceChangeService && null != item) {
|
||||
boolean handleResourceChange = resourceChangeService.handleResourceChange(((ConnectionItem) item)
|
||||
.getConnection());
|
||||
if (!handleResourceChange) {
|
||||
if (null != resourceChangeService) {
|
||||
List<IRepositoryNode> dependentNodes = resourceChangeService.getDependentNodes(sourceNode);
|
||||
if (dependentNodes != null && !dependentNodes.isEmpty()) {
|
||||
resourceChangeService.openDependcesDialog(dependentNodes);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -68,9 +68,15 @@ public class CopyAction extends AContextualAction {
|
||||
|
||||
LocalSelectionTransfer.getTransfer().setSelection(selection);
|
||||
LocalSelectionTransfer.getTransfer().setSelectionSetTime(System.currentTimeMillis());
|
||||
// init paste action
|
||||
PasteAction pasteActionInstance = PasteAction.getInstance();
|
||||
if (pasteActionInstance != null) {
|
||||
pasteActionInstance.init(null, selection);
|
||||
}
|
||||
// refresh();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(TreeViewer viewer, IStructuredSelection selection) {
|
||||
boolean canWork = true;
|
||||
RepositoryNode node = (RepositoryNode) selection.getFirstElement();
|
||||
|
||||
@@ -1,133 +0,0 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2012 Talend Inc. - www.talend.com
|
||||
//
|
||||
// This source code is available under agreement available at
|
||||
// %InstallDIR%\features\org.talend.rcp.branding.%PRODUCTNAME%\%PRODUCTNAME%license.txt
|
||||
//
|
||||
// You should have received a copy of the agreement
|
||||
// along with this program; if not, write to Talend SA
|
||||
// 9 rue Pages 92150 Suresnes, France
|
||||
//
|
||||
// ============================================================================
|
||||
package org.talend.repository.ui.actions;
|
||||
|
||||
import org.eclipse.core.runtime.IPath;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.jface.viewers.IStructuredSelection;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.jface.wizard.WizardDialog;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.talend.commons.ui.runtime.image.ECoreImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.repository.i18n.Messages;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.ui.images.OverlayImageProvider;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.IProxyRepositoryFactory;
|
||||
import org.talend.repository.model.IRepositoryNode.EProperties;
|
||||
import org.talend.repository.model.RepositoryConstants;
|
||||
import org.talend.repository.model.RepositoryNode;
|
||||
import org.talend.repository.model.RepositoryNodeUtilities;
|
||||
import org.talend.repository.ui.wizards.folder.FolderWizard;
|
||||
|
||||
/**
|
||||
* Action used to create a new folder in repository.<br/>
|
||||
*
|
||||
* $Id: CreateFolderAction.java 82396 2012-04-24 09:28:34Z zwzhao $
|
||||
*
|
||||
*/
|
||||
public class CreateFolderAction extends AContextualAction {
|
||||
|
||||
public CreateFolderAction() {
|
||||
super();
|
||||
this.setText(Messages.getString("CreateFolderAction.action.title")); //$NON-NLS-1$
|
||||
this.setToolTipText(Messages.getString("CreateFolderAction.action.toolTipText")); //$NON-NLS-1$
|
||||
|
||||
Image folderImg = ImageProvider.getImage(ECoreImage.FOLDER_CLOSE_ICON);
|
||||
this.setImageDescriptor(OverlayImageProvider.getImageWithNew(folderImg));
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction)
|
||||
*/
|
||||
@Override
|
||||
protected void doRun() {
|
||||
ISelection selection = getSelection();
|
||||
Object obj = ((IStructuredSelection) selection).getFirstElement();
|
||||
RepositoryNode node = (RepositoryNode) obj;
|
||||
|
||||
ERepositoryObjectType objectType = null;
|
||||
IPath path = null;
|
||||
|
||||
path = RepositoryNodeUtilities.getPath(node);
|
||||
if (RepositoryConstants.isSystemFolder(path.toString())) {
|
||||
return;
|
||||
}
|
||||
objectType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
|
||||
|
||||
if (objectType != null) {
|
||||
FolderWizard processWizard = new FolderWizard(path, objectType, null);
|
||||
Shell activeShell = Display.getCurrent().getActiveShell();
|
||||
WizardDialog dialog = new WizardDialog(activeShell, processWizard);
|
||||
dialog.setPageSize(400, 60);
|
||||
dialog.create();
|
||||
dialog.open();
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.repository.ui.actions.ITreeContextualAction#init(org.eclipse.jface.viewers.TreeViewer,
|
||||
* org.eclipse.jface.viewers.IStructuredSelection)
|
||||
*/
|
||||
public void init(TreeViewer viewer, IStructuredSelection selection) {
|
||||
boolean canWork = !selection.isEmpty() && selection.size() == 1;
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
if (factory.isUserReadOnlyOnCurrentProject()) {
|
||||
canWork = false;
|
||||
}
|
||||
if (canWork) {
|
||||
Object o = selection.getFirstElement();
|
||||
RepositoryNode node = (RepositoryNode) o;
|
||||
Object property = node.getProperties(EProperties.CONTENT_TYPE);
|
||||
switch (node.getType()) {
|
||||
case REPOSITORY_ELEMENT:
|
||||
case STABLE_SYSTEM_FOLDER:
|
||||
canWork = false;
|
||||
break;
|
||||
case SYSTEM_FOLDER:
|
||||
if (ERepositoryObjectType.GENERATED.equals(property) || ERepositoryObjectType.JOBS.equals(property)
|
||||
|| ERepositoryObjectType.JOBLETS.equals(property) || ERepositoryObjectType.SQLPATTERNS.equals(property)
|
||||
|| ERepositoryObjectType.REFERENCED_PROJECTS.equals(property)
|
||||
|| ERepositoryObjectType.SVN_ROOT.equals(property)) {
|
||||
canWork = false;
|
||||
}
|
||||
break;
|
||||
case SIMPLE_FOLDER:
|
||||
if (ERepositoryObjectType.JOB_DOC.equals(property) || ERepositoryObjectType.JOBLET_DOC.equals(property)
|
||||
|| (ERepositoryObjectType.SQLPATTERNS.equals(property) && !isUnderUserDefined(node))) {
|
||||
canWork = false;
|
||||
}
|
||||
if (node.getObject().getProperty().getItem().getState().isDeleted()) {
|
||||
canWork = false;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
// Nothing to do
|
||||
}
|
||||
|
||||
if (canWork && !ProjectManager.getInstance().isInCurrentMainProject(node)) {
|
||||
canWork = false;
|
||||
}
|
||||
}
|
||||
setEnabled(canWork);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,6 +54,7 @@ import org.talend.core.ICoreService;
|
||||
import org.talend.core.IESBService;
|
||||
import org.talend.core.ITDQRepositoryService;
|
||||
import org.talend.core.context.Context;
|
||||
import org.talend.core.context.RepositoryContext;
|
||||
import org.talend.core.model.general.Project;
|
||||
import org.talend.core.model.metadata.builder.connection.MetadataTable;
|
||||
import org.talend.core.model.metadata.builder.connection.SubscriberTable;
|
||||
@@ -72,7 +73,6 @@ import org.talend.core.model.properties.JobletProcessItem;
|
||||
import org.talend.core.model.properties.ProcessItem;
|
||||
import org.talend.core.model.properties.ProjectReference;
|
||||
import org.talend.core.model.properties.Property;
|
||||
import org.talend.core.model.properties.TDQItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.Folder;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
@@ -214,6 +214,7 @@ public class DeleteAction extends AContextualAction {
|
||||
if (isInDeletedFolder(deletedFolder, node.getParent())) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// TDI-22550
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IDesignerCoreService.class)) {
|
||||
IDesignerCoreService coreService = (IDesignerCoreService) GlobalServiceRegister.getDefault()
|
||||
@@ -228,7 +229,6 @@ public class DeleteAction extends AContextualAction {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
boolean needReturn = deleteElements(factory, deleteActionCache, node);
|
||||
if (node.getProperties(EProperties.CONTENT_TYPE) == ERepositoryObjectType.JOBLET) {
|
||||
needToUpdataPalette = true;
|
||||
@@ -428,14 +428,21 @@ public class DeleteAction extends AContextualAction {
|
||||
ERepositoryObjectType objectType = (ERepositoryObjectType) node.getProperties(EProperties.CONTENT_TYPE);
|
||||
List<IRepositoryNode> repositoryList = node.getChildren();
|
||||
boolean success = true;
|
||||
Exception bex = null;
|
||||
for (IRepositoryNode repositoryNode : repositoryList) {
|
||||
try {
|
||||
deleteRepositoryNode(repositoryNode, factory);
|
||||
} catch (Exception e) {
|
||||
bex = e;
|
||||
ExceptionHandler.process(e);
|
||||
success = false;
|
||||
}
|
||||
}
|
||||
if (bex != null) {
|
||||
final Shell shell = getShell();
|
||||
MessageDialog.openWarning(shell, Messages.getString("DeleteAction.warning.title"),
|
||||
Messages.getString("DeleteAction.warning.message1"));
|
||||
}
|
||||
if (!success) {
|
||||
return;
|
||||
}
|
||||
@@ -649,7 +656,9 @@ public class DeleteAction extends AContextualAction {
|
||||
if (ctx == null) {
|
||||
return false;
|
||||
}
|
||||
String parentBranch = ProjectManager.getInstance().getMainProjectBranch(parentProject);
|
||||
RepositoryContext repositoryContext = (RepositoryContext) ctx.getProperty(Context.REPOSITORY_CONTEXT_KEY);
|
||||
String parentBranch = repositoryContext.getFields().get(
|
||||
IProxyRepositoryFactory.BRANCH_SELECTION + "_" + parentProject.getTechnicalLabel()); //$NON-NLS-1$
|
||||
|
||||
EList referencedProjects = parentProject.getEmfProject().getReferencedProjects();
|
||||
for (ProjectReference pRef : (List<ProjectReference>) referencedProjects) {
|
||||
@@ -723,6 +732,7 @@ public class DeleteAction extends AContextualAction {
|
||||
allJobVersions.addAll(factory.getAllVersion(process.getId()));
|
||||
}
|
||||
}
|
||||
|
||||
List<IRepositoryViewObject> jobletes = factory.getAll(refP, ERepositoryObjectType.JOBLET);
|
||||
allJobVersions.addAll(jobletes);
|
||||
deleteActionCache.setProcessList(allJobVersions);
|
||||
@@ -802,7 +812,6 @@ public class DeleteAction extends AContextualAction {
|
||||
contextList = service.getProcessFromProcessItem((ProcessItem) item2).getContextManager()
|
||||
.getListContext();
|
||||
}
|
||||
|
||||
}
|
||||
if (item2 instanceof JobletProcessItem) {
|
||||
contextList = service.getProcessFromJobletProcessItem((JobletProcessItem) item2)
|
||||
@@ -810,6 +819,7 @@ public class DeleteAction extends AContextualAction {
|
||||
} else if (item2 instanceof ConnectionItem) {
|
||||
contextID = ((ConnectionItem) item2).getConnection().getContextId();
|
||||
}
|
||||
|
||||
if (contextList != null) {
|
||||
// Added by Marvin Wang on Sep.14, 2012 for bug TDI-21878. It just needs to check the
|
||||
// first IContext, normally it is named "default". In order to add the different version
|
||||
@@ -862,12 +872,12 @@ public class DeleteAction extends AContextualAction {
|
||||
Property property2 = openedProcess.getProperty();
|
||||
Item item2 = property2.getItem();
|
||||
String path = item2.getState().getPath();
|
||||
|
||||
String processName = openedProcess.getLabel();
|
||||
String processVersion = openedProcess.getVersion();
|
||||
// Added by Marvin Wang on Sep. 24, 2012 for bug TDI-21878 to filter the bean that
|
||||
// has been added in the list.
|
||||
if (!RepositoryReferenceBeanUtils.hasReferenceBean(list, processName, processVersion)) {
|
||||
|
||||
ContextReferenceBean bean = new ContextReferenceBean(property2.getLabel(), openedProcess
|
||||
.getRepositoryObjectType().getType(), property2.getVersion(), path,
|
||||
refP.getLabel());
|
||||
@@ -1039,26 +1049,15 @@ public class DeleteAction extends AContextualAction {
|
||||
* @return
|
||||
*/
|
||||
private boolean isForbidNode(RepositoryNode node) {
|
||||
IProxyRepositoryFactory factory = ProxyRepositoryFactory.getInstance();
|
||||
|
||||
IRepositoryViewObject nodeObject = node.getObject();
|
||||
|
||||
if (nodeObject == null || nodeObject.getProperty() == null || nodeObject.getProperty().getItem() == null) {
|
||||
// invalid item, but allow the delete
|
||||
// to review later, but normally we should be able to delete even invalid items.
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean locked = false;
|
||||
|
||||
if (!factory.getRepositoryContext().isEditableAsReadOnly()) {
|
||||
if (nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_OTHER
|
||||
|| nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_USER) {
|
||||
locked = true;
|
||||
}
|
||||
}
|
||||
// Avoid to delete node which is locked.
|
||||
if ((locked || RepositoryManager.isOpenedItemInEditor(nodeObject)) && !(DELETE_FOREVER_TITLE.equals(getText()))) {
|
||||
if (nodeObject != null
|
||||
&& nodeObject.getProperty() != null
|
||||
&& nodeObject.getProperty().getItem() != null
|
||||
&& (nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_OTHER
|
||||
|| nodeObject.getRepositoryStatus() == ERepositoryStatus.LOCK_BY_USER || RepositoryManager
|
||||
.isOpenedItemInEditor(nodeObject)) && !(DELETE_FOREVER_TITLE.equals(getText()))) {
|
||||
|
||||
final String title = Messages.getString("DeleteAction.error.title"); //$NON-NLS-1$
|
||||
String nodeName = ERepositoryObjectType.getDeleteFolderName(nodeObject.getRepositoryObjectType());
|
||||
@@ -1152,18 +1151,8 @@ public class DeleteAction extends AContextualAction {
|
||||
return true;
|
||||
}
|
||||
|
||||
Item item = null;
|
||||
if (objToDelete != null && objToDelete.getProperty() != null) {
|
||||
item = objToDelete.getProperty().getItem();
|
||||
}
|
||||
AbstractResourceChangesService resChangeService = TDQServiceRegister.getInstance().getResourceChangeService(
|
||||
AbstractResourceChangesService.class);
|
||||
if (resChangeService != null && item != null && item instanceof ConnectionItem && item.getState().isDeleted()) {
|
||||
if (!resChangeService.handleResourceChange(((ConnectionItem) item).getConnection())) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// To manage case of we have a subitem. This is possible using 'DEL' shortcut:
|
||||
ERepositoryObjectType nodeType = (ERepositoryObjectType) currentJobNode.getProperties(EProperties.CONTENT_TYPE);
|
||||
if (nodeType != null && nodeType.isSubItem()) {
|
||||
@@ -1179,6 +1168,13 @@ public class DeleteAction extends AContextualAction {
|
||||
needReturn = true;
|
||||
} else {
|
||||
if (factory.getStatus(objToDelete) == ERepositoryStatus.DELETED) {
|
||||
if (resChangeService != null) {
|
||||
List<IRepositoryNode> dependentNodes = resChangeService.getDependentNodes(currentJobNode);
|
||||
if (dependentNodes != null && !dependentNodes.isEmpty()) {
|
||||
resChangeService.openDependcesDialog(dependentNodes);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
if (confirm == null) {
|
||||
Display.getDefault().syncExec(new Runnable() {
|
||||
|
||||
@@ -1230,8 +1226,11 @@ public class DeleteAction extends AContextualAction {
|
||||
} else {
|
||||
// MOD qiongli 2011-5-10,bug 21189.should remove dependency after showing the question dialog of
|
||||
// physical delete.
|
||||
if (resChangeService != null && (item instanceof TDQItem || item instanceof ConnectionItem)) {
|
||||
resChangeService.removeAllDependecies(item);
|
||||
if (resChangeService != null && objToDelete != null && objToDelete.getProperty() != null) {
|
||||
Item item = objToDelete.getProperty().getItem();
|
||||
if (item != null) {
|
||||
resChangeService.removeAllDependecies(item);
|
||||
}
|
||||
}
|
||||
factory.deleteObjectPhysical(objToDelete);
|
||||
ExpressionPersistance.getInstance().jobDeleted(objToDelete.getLabel());
|
||||
@@ -1268,8 +1267,7 @@ public class DeleteAction extends AContextualAction {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
/* *
|
||||
* Remove the dbconnection in sql explorer after logical delete.
|
||||
*
|
||||
* @param node
|
||||
@@ -1312,10 +1310,6 @@ public class DeleteAction extends AContextualAction {
|
||||
if (factory.isUserReadOnlyOnCurrentProject()) {
|
||||
visible = false;
|
||||
}
|
||||
// TDI-23105:only for read-only(tag) project
|
||||
if (!factory.getRepositoryContext().isOffline() && factory.getRepositoryContext().isEditableAsReadOnly()) {
|
||||
visible = false;
|
||||
}
|
||||
for (Object o : (selection).toArray()) {
|
||||
if (visible) {
|
||||
RepositoryNode node = (RepositoryNode) o;
|
||||
@@ -1390,6 +1384,12 @@ public class DeleteAction extends AContextualAction {
|
||||
break;
|
||||
}
|
||||
|
||||
if (contentType == ERepositoryObjectType.METADATA_CON_TABLE) {
|
||||
enabled = false;
|
||||
visible = false;
|
||||
break;
|
||||
}
|
||||
|
||||
IRepositoryViewObject repObj = node.getObject();
|
||||
|
||||
ERepositoryStatus status = repObj.getRepositoryStatus();
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user