Compare commits
316 Commits
cmeng/stig
...
test/maste
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0094815c78 | ||
|
|
3c68f3f13c | ||
|
|
e2355b208c | ||
|
|
5310fce82a | ||
|
|
63262a3947 | ||
|
|
4c1ff62d7e | ||
|
|
d418edf1c1 | ||
|
|
d473c7d161 | ||
|
|
1fca355bd7 | ||
|
|
450c1bed45 | ||
|
|
8466cd9969 | ||
|
|
515e10de01 | ||
|
|
929d6b724c | ||
|
|
543a3fb5e1 | ||
|
|
ad3f36e2a2 | ||
|
|
d2fb640b69 | ||
|
|
34aa93dd7b | ||
|
|
e120a57110 | ||
|
|
1862605d4a | ||
|
|
82976d598e | ||
|
|
db2c99bb76 | ||
|
|
784ad75dac | ||
|
|
a190d723c7 | ||
|
|
5dcb4ed39f | ||
|
|
61426594f4 | ||
|
|
cedd7a8994 | ||
|
|
71178a9f15 | ||
|
|
ef468af7ca | ||
|
|
933a2495a4 | ||
|
|
3c13721c44 | ||
|
|
e108f814c9 | ||
|
|
93fc3c175e | ||
|
|
12582eaadf | ||
|
|
2b208a1d57 | ||
|
|
7222e1e0eb | ||
|
|
db6dd66e41 | ||
|
|
670767b0e1 | ||
|
|
9b4681afbd | ||
|
|
746eedf8a0 | ||
|
|
1ae10f496a | ||
|
|
8ab307ba9b | ||
|
|
27ba81ba3d | ||
|
|
79672cce8e | ||
|
|
3c2624a5ea | ||
|
|
e1ac2b85d5 | ||
|
|
72b988fe76 | ||
|
|
319bbda1c9 | ||
|
|
d197a0c194 | ||
|
|
0a7093fb66 | ||
|
|
e8453bab5e | ||
|
|
e2d67b5d64 | ||
|
|
e6d1c55d7e | ||
|
|
3fcd368b7b | ||
|
|
b3e1404884 | ||
|
|
e75c49fffd | ||
|
|
906a50dfa7 | ||
|
|
f5288a6a98 | ||
|
|
6681a1e987 | ||
|
|
1f4ccc0111 | ||
|
|
7d5646942f | ||
|
|
d2036f9561 | ||
|
|
0f4e9a5a1b | ||
|
|
18a72d530d | ||
|
|
b18e21d351 | ||
|
|
93eec79c74 | ||
|
|
1864cf5278 | ||
|
|
a1c433d0b4 | ||
|
|
c0a9f38b85 | ||
|
|
af6dc4fc88 | ||
|
|
fd0f9d6c12 | ||
|
|
ccf0931aa0 | ||
|
|
843fcc5b9a | ||
|
|
aeb0031a66 | ||
|
|
20d4fae588 | ||
|
|
faea680b47 | ||
|
|
6382138c82 | ||
|
|
9a1da2268f | ||
|
|
baa7e72aa9 | ||
|
|
619c013edc | ||
|
|
a44534dbdc | ||
|
|
83d59da63d | ||
|
|
2f087d46b4 | ||
|
|
a25c92866c | ||
|
|
55797ec1d1 | ||
|
|
6e90dde408 | ||
|
|
e954b269ec | ||
|
|
76f4e82710 | ||
|
|
a63e5f9db8 | ||
|
|
8adfc1f968 | ||
|
|
201bcef955 | ||
|
|
6c1691669a | ||
|
|
fd3d1af7b9 | ||
|
|
a5894125b1 | ||
|
|
e16d7a560a | ||
|
|
3ee7c825fd | ||
|
|
6962a0cf8c | ||
|
|
8799c1f0ce | ||
|
|
a78f6a4427 | ||
|
|
6950959063 | ||
|
|
a267e8118c | ||
|
|
b413507fbe | ||
|
|
cd7c9dfe78 | ||
|
|
bd3875a74d | ||
|
|
15513dc4a0 | ||
|
|
e6b72f1424 | ||
|
|
2c5f048f7f | ||
|
|
58f30bae87 | ||
|
|
0d02e6f3ab | ||
|
|
8e7da3b6bd | ||
|
|
8299007eac | ||
|
|
fb67412953 | ||
|
|
faf9b905f4 | ||
|
|
ea6940d222 | ||
|
|
5039c74452 | ||
|
|
0e3c5f2456 | ||
|
|
b8cf81efb1 | ||
|
|
83ff043a43 | ||
|
|
ba64ae6bfb | ||
|
|
d872479d63 | ||
|
|
3fdaf9da69 | ||
|
|
21ec8bac77 | ||
|
|
582227a8c7 | ||
|
|
098ff85b12 | ||
|
|
db7512fd06 | ||
|
|
acf9b10765 | ||
|
|
023a726abc | ||
|
|
374c31e4cb | ||
|
|
4b5e727c5f | ||
|
|
ffb65403ef | ||
|
|
7306f314e4 | ||
|
|
d5be5e8fa4 | ||
|
|
cc0f6f3e5e | ||
|
|
bdc6c1930b | ||
|
|
59a68d2b7f | ||
|
|
e2885aeb37 | ||
|
|
f8065a7641 | ||
|
|
115309e1c7 | ||
|
|
b7eaf61cbf | ||
|
|
24dad16fb6 | ||
|
|
2b074aace2 | ||
|
|
13d4e68b7c | ||
|
|
d43b53e1c9 | ||
|
|
13d102128b | ||
|
|
bcbcf0bc1f | ||
|
|
d31f227ab3 | ||
|
|
94c911534d | ||
|
|
e335b7b469 | ||
|
|
4c4526f799 | ||
|
|
48e8282d3f | ||
|
|
22a6f0e575 | ||
|
|
5428caa7c8 | ||
|
|
31a84fd47e | ||
|
|
35c5eb898d | ||
|
|
932b2296b9 | ||
|
|
3d061f5555 | ||
|
|
c1aee61eba | ||
|
|
8ea979ab1f | ||
|
|
b97c858e0e | ||
|
|
0e23deccdf | ||
|
|
4f92562f8b | ||
|
|
5851599ffb | ||
|
|
f926918412 | ||
|
|
a978782e05 | ||
|
|
10dd7847f6 | ||
|
|
5b8f69df64 | ||
|
|
2478ab7f88 | ||
|
|
6ff693078b | ||
|
|
13c6b15800 | ||
|
|
2dc20555b7 | ||
|
|
33582b9fa4 | ||
|
|
3de58da430 | ||
|
|
b584695f56 | ||
|
|
6219a2ae06 | ||
|
|
c2f8bed1aa | ||
|
|
f74e95599c | ||
|
|
3d3e504a00 | ||
|
|
4fbc92dbbb | ||
|
|
0901d8d199 | ||
|
|
63d094aa2f | ||
|
|
cf0f4eae4b | ||
|
|
43c0dce77e | ||
|
|
15862ae4c2 | ||
|
|
fb13ca9748 | ||
|
|
92ca0fd483 | ||
|
|
889a0cab07 | ||
|
|
415f325f14 | ||
|
|
72f0cc1354 | ||
|
|
7297529066 | ||
|
|
f7ce9d76f3 | ||
|
|
a6829ba4c0 | ||
|
|
339d5109cf | ||
|
|
d02825a315 | ||
|
|
8d44e904ca | ||
|
|
65c6eb9bd9 | ||
|
|
1905631d9a | ||
|
|
ca95e4c6be | ||
|
|
b8f861bbf4 | ||
|
|
c8bfa813f3 | ||
|
|
2098d64d9c | ||
|
|
2e6322e2ad | ||
|
|
6426d95b5a | ||
|
|
9dd71e6383 | ||
|
|
599f27ef30 | ||
|
|
b1327c65db | ||
|
|
ed2cb56b2c | ||
|
|
b71c4bbcca | ||
|
|
f870735ed7 | ||
|
|
1f6fa1f902 | ||
|
|
8cfc715857 | ||
|
|
231d51146c | ||
|
|
68e7f5b479 | ||
|
|
666d67d388 | ||
|
|
288972c540 | ||
|
|
06b45c7623 | ||
|
|
2694abd02e | ||
|
|
9a3d6a2610 | ||
|
|
b53d3b1623 | ||
|
|
c1bfc598d2 | ||
|
|
6b0dbfd4e4 | ||
|
|
2010dfe2e7 | ||
|
|
f69c0a46ea | ||
|
|
6a21ad37cc | ||
|
|
72142eec40 | ||
|
|
a389190399 | ||
|
|
db7056de82 | ||
|
|
4cf27d8822 | ||
|
|
03b4bc0a3b | ||
|
|
ae3958ab88 | ||
|
|
d2c27d7f71 | ||
|
|
8d5f634157 | ||
|
|
495dfc9a51 | ||
|
|
434d4c7285 | ||
|
|
b5870ee132 | ||
|
|
988c2d0a66 | ||
|
|
16407eb6e7 | ||
|
|
7101e9c0d6 | ||
|
|
6db5ccb7b2 | ||
|
|
5009b20e3b | ||
|
|
3112c8c52d | ||
|
|
bca16388d7 | ||
|
|
e53771e745 | ||
|
|
c8a54b7b09 | ||
|
|
46654820c1 | ||
|
|
3e7649e7b4 | ||
|
|
0f7f8fa097 | ||
|
|
c136b2a2fa | ||
|
|
70561b3423 | ||
|
|
53aa1bcc20 | ||
|
|
f034239fe3 | ||
|
|
8acc1f8deb | ||
|
|
33491a30fa | ||
|
|
f900a98066 | ||
|
|
53837d58a9 | ||
|
|
9c4dcf7244 | ||
|
|
e66fb656da | ||
|
|
edce5f68d2 | ||
|
|
3da58ccf1b | ||
|
|
c5b2b1381f | ||
|
|
e5f98e1323 | ||
|
|
31a91312f7 | ||
|
|
148a95b917 | ||
|
|
8f19d0318f | ||
|
|
6384e95a23 | ||
|
|
e27917ce53 | ||
|
|
e46c839b87 | ||
|
|
f78a644f2d | ||
|
|
edd6f96bf5 | ||
|
|
3e7b4174f9 | ||
|
|
39a3e0f384 | ||
|
|
9f60910eb7 | ||
|
|
90246cf7b0 | ||
|
|
22fc826956 | ||
|
|
9246668001 | ||
|
|
30fca3bae0 | ||
|
|
35d3ebc21c | ||
|
|
6fad79dfbb | ||
|
|
c662e5886d | ||
|
|
61f21c1658 | ||
|
|
fb61a6cc08 | ||
|
|
746ff4aff7 | ||
|
|
720c10ffab | ||
|
|
eac4d46b9e | ||
|
|
1e521b64c0 | ||
|
|
c85260c0b5 | ||
|
|
7727289673 | ||
|
|
cc56f55c46 | ||
|
|
109199da03 | ||
|
|
d21695dfae | ||
|
|
f31f58c945 | ||
|
|
54fbf241cd | ||
|
|
b4859e59d1 | ||
|
|
f9348709de | ||
|
|
bc88a7f4d8 | ||
|
|
a86c54fc71 | ||
|
|
bd6673d7e6 | ||
|
|
e044933297 | ||
|
|
54446d79dc | ||
|
|
a7bafcabd3 | ||
|
|
c5656cb59d | ||
|
|
fcd01e14c0 | ||
|
|
6fae597691 | ||
|
|
1fc638f09b | ||
|
|
3a0b1d48cb | ||
|
|
6ef54dc38e | ||
|
|
ce2c8478a0 | ||
|
|
93d76e62bd | ||
|
|
4b36a57b07 | ||
|
|
0784f2db5f | ||
|
|
1bc2417f2d | ||
|
|
e1e57b4629 | ||
|
|
857f4dca9a | ||
|
|
dd51ba9623 | ||
|
|
e7dc81d3e2 | ||
|
|
d013b64aa3 | ||
|
|
94538f8b82 | ||
|
|
88bb49e6ba |
@@ -2,7 +2,7 @@
|
||||
http://www.talend.com
|
||||
|
||||
|
||||

|
||||

|
||||
|
||||
|
||||
## Contents
|
||||
|
||||
14
SECURITY.md
Normal file
14
SECURITY.md
Normal file
@@ -0,0 +1,14 @@
|
||||
# Security Policy
|
||||
|
||||
## Supported Versions
|
||||
|
||||
| Version | Supported |
|
||||
| ------- | ------------------ |
|
||||
| 8.0.x | :white_check_mark: |
|
||||
| 7.3.x | :white_check_mark: |
|
||||
| < 7.3.x | :x: |
|
||||
|
||||
## Reporting a Vulnerability
|
||||
|
||||
For information on how to report a new security problem please see [here](https://www.talend.com/security/vulnerability-disclosure/).
|
||||
Our existing security advisories are published [here](https://www.talend.com/security/incident-response/).
|
||||
@@ -54,7 +54,13 @@
|
||||
id="org.talend.libraries.apache.lucene8"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"/>
|
||||
|
||||
<plugin
|
||||
id="org.talend.signon.util"
|
||||
download-size="0"
|
||||
install-size="0"
|
||||
version="0.0.0"
|
||||
unpack="true"/>
|
||||
unpack="false"/>
|
||||
|
||||
</feature>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
<copyright url="http://www.example.com/copyright">[Enter Copyright Description here.]</copyright>
|
||||
<license url="http://www.example.com/license">[Enter License Description here.]</license>
|
||||
<requires>
|
||||
<import plugin="org.bouncycastle.bcprov" version="1.70.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.cedarsoftware.json-io" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-annotations" version="2.9.0" match="greaterOrEqual"/>
|
||||
<import plugin="com.fasterxml.jackson.core.jackson-core" version="2.9.8" match="greaterOrEqual"/>
|
||||
@@ -17,7 +16,7 @@
|
||||
<import plugin="org.apache.commons.lang" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.commons.lang3" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.log4j" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.apache.servicemix.bundles.avro" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="avro" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.junit" version="4.13.2" match="greaterOrEqual"/>
|
||||
<import plugin="org.slf4j.api" version="0.0.0" match="greaterOrEqual"/>
|
||||
<import plugin="org.slf4j.binding.log4j12" version="0.0.0" match="greaterOrEqual"/>
|
||||
|
||||
@@ -9,4 +9,7 @@
|
||||
</parent>
|
||||
<artifactId>org.talend.utils.feature</artifactId>
|
||||
<packaging>eclipse-feature</packaging>
|
||||
<properties>
|
||||
<tycho.buildtimestamp.format>${timestamp}</tycho.buildtimestamp.format>
|
||||
</properties>
|
||||
</project>
|
||||
|
||||
@@ -11,9 +11,12 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||
org.talend.libraries.apache,
|
||||
org.talend.commons.runtime,
|
||||
org.talend.libraries.ui,
|
||||
org.apache.ant
|
||||
org.apache.ant,
|
||||
org.eclipse.jface,
|
||||
org.apache.commons.lang3
|
||||
Export-Package:
|
||||
org.talend.commons.ui.runtime,
|
||||
org.talend.commons.ui.runtime.custom,
|
||||
org.talend.commons.ui.runtime.exception,
|
||||
org.talend.commons.ui.runtime.expressionbuilder,
|
||||
org.talend.commons.ui.runtime.geometry,
|
||||
@@ -34,7 +37,8 @@ Export-Package:
|
||||
org.talend.commons.ui.runtime.update,
|
||||
org.talend.commons.ui.runtime.utils,
|
||||
org.talend.commons.ui.runtime.ws
|
||||
Import-Package: org.eclipse.jface.bindings.keys,
|
||||
Import-Package: org.eclipse.gef.commands,
|
||||
org.eclipse.jface.bindings.keys,
|
||||
org.eclipse.jface.dialogs,
|
||||
org.eclipse.jface.fieldassist,
|
||||
org.eclipse.jface.resource,
|
||||
|
||||
@@ -4,4 +4,6 @@ bin.includes = META-INF/,\
|
||||
plugin.xml,\
|
||||
icons/,\
|
||||
icons1/,\
|
||||
.
|
||||
.,\
|
||||
resources/
|
||||
|
||||
|
||||
BIN
main/plugins/org.talend.common.ui.runtime/icons/moreInfo.png
Normal file
BIN
main/plugins/org.talend.common.ui.runtime/icons/moreInfo.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 288 B |
Binary file not shown.
|
After Width: | Height: | Size: 627 B |
@@ -1,5 +1,17 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<?eclipse version="3.4"?>
|
||||
<plugin>
|
||||
|
||||
<extension
|
||||
point="org.eclipse.e4.ui.css.swt.theme">
|
||||
<stylesheet
|
||||
uri="resources/theme/light_preferencestyle.css">
|
||||
<themeid
|
||||
refid="org.talend.themes.css.talend.default"></themeid>
|
||||
</stylesheet>
|
||||
<stylesheet
|
||||
uri="resources/theme/dark_preferencestyle.css">
|
||||
<themeid
|
||||
refid="org.eclipse.e4.ui.css.theme.e4_dark"></themeid>
|
||||
</stylesheet>
|
||||
</extension>
|
||||
</plugin>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/* ############################## Eclipse UI properties ############################## */
|
||||
|
||||
IEclipsePreferences#org-talend-common-ui-runtime:org-talend-common-ui-runtime { /* pseudo attribute added to allow contributions without replacing this node, see Bug 466075 */
|
||||
preferences:
|
||||
'table.background=#org-eclipse-ui-workbench-DARK_BACKGROUND'
|
||||
'table.foreground=#org-eclipse-ui-workbench-DARK_FOREGROUND'
|
||||
}
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
/* ############################## Eclipse UI properties ############################## */
|
||||
|
||||
|
||||
IEclipsePreferences#org-talend-common-ui-runtime:org-talend-common-ui-runtime { /* pseudo attribute added to allow contributions without replacing this node, see Bug 466075 */
|
||||
preferences:
|
||||
'table.background=COLOR-LIST-BACKGROUND'
|
||||
'table.foreground=COLOR_LIST_FOREGROUND'
|
||||
}
|
||||
@@ -12,14 +12,22 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.runtime;
|
||||
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface ColorConstants {
|
||||
|
||||
static final String BUNDLE_ID_COMMON_UI_RUNTIME = "org.talend.common.ui.runtime";
|
||||
|
||||
static final String KEY_TABLE_BACKGROUND = "table.background";
|
||||
|
||||
static final String KEY_TABLE_FOREGROUND = "table.foreground";
|
||||
|
||||
static final Color WHITE_COLOR = new Color(null, 255, 255, 255);
|
||||
|
||||
static final Color GREY_COLOR = new Color(null, 215, 215, 215);
|
||||
@@ -29,6 +37,8 @@ public interface ColorConstants {
|
||||
static final Color YELLOW_COLOR = new Color(null, 255, 173, 37);// 254, 182, 84
|
||||
|
||||
static final Color RED_COLOR = new Color(null, new RGB(204, 87, 89));// 255
|
||||
|
||||
static final Color ERROR_FONT_COLOR = new Color(null, new RGB(255, 0, 0));// 255
|
||||
|
||||
static final Color VERTICAL_SEPERATOR_LINE_COLOR = new Color(null, 162, 179, 195);
|
||||
|
||||
@@ -45,4 +55,19 @@ public interface ColorConstants {
|
||||
|
||||
static final Color SUCCEED_COLOR = new Color(null, 221, 242, 217);
|
||||
|
||||
static Color getTableBackgroundColor() {
|
||||
return ITalendThemeService.getColor(ColorConstants.BUNDLE_ID_COMMON_UI_RUNTIME, ColorConstants.KEY_TABLE_BACKGROUND)
|
||||
.orElse(Display.getDefault().getSystemColor(SWT.COLOR_LIST_BACKGROUND));
|
||||
}
|
||||
|
||||
static Color getTableForegroundColor() {
|
||||
return ITalendThemeService.getColor(ColorConstants.BUNDLE_ID_COMMON_UI_RUNTIME, ColorConstants.KEY_TABLE_FOREGROUND)
|
||||
.orElse(Display.getDefault().getSystemColor(SWT.COLOR_LIST_FOREGROUND));
|
||||
}
|
||||
|
||||
static Color getTableReadOnlyForegroundColor() {
|
||||
return ITalendThemeService.getColor("CONTEXT_TABLE_READONLY_FOREGROUND")
|
||||
.orElse(Display.getDefault().getSystemColor(SWT.COLOR_WIDGET_DARK_SHADOW));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -23,6 +23,8 @@ import org.talend.commons.ui.runtime.exception.ExceptionServiceImpl;
|
||||
|
||||
public class CommonUIPlugin implements BundleActivator {
|
||||
|
||||
public static String BUNDLE_ID = "org.talend.common.ui.runtime";
|
||||
|
||||
private static Boolean fullyHeadless = null;
|
||||
|
||||
/*
|
||||
|
||||
@@ -0,0 +1,154 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime;
|
||||
|
||||
import java.util.Optional;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface ITalendThemeService {
|
||||
|
||||
public static String DEFAULT_PREFERENCE_ID = "org.eclipse.ui.workbench";
|
||||
|
||||
public static String THEME_PREFERENCE_ID = "org.eclipse.e4.ui.css.swt.theme";
|
||||
|
||||
/**
|
||||
* Get color from instance scope preference of default bundleId, which managed by theme; the standard way eclipse
|
||||
* uses
|
||||
*
|
||||
* @param prop
|
||||
* @return the Color, <font color="red">please <b>DON'T</b> dispose it, it is managed by JFaceResources</font>
|
||||
*/
|
||||
static Optional<Color> getColor(String prop) {
|
||||
return getColor(DEFAULT_PREFERENCE_ID, prop);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get color from instance scope preference of bundleId, which managed by theme; the standard way eclipse uses
|
||||
*
|
||||
* @param bundleId the instance scope preference which stores the prop
|
||||
* @param prop
|
||||
* @return the Color, <font color="red">please <b>DON'T</b> dispose it, it is managed by JFaceResources</font>
|
||||
*/
|
||||
static Optional<Color> getColor(String bundleId, String prop) {
|
||||
ITalendThemeService theme = get();
|
||||
if (theme != null) {
|
||||
return Optional.ofNullable(theme.getColorForTheme(bundleId, prop));
|
||||
}
|
||||
return Optional.ofNullable(null);
|
||||
}
|
||||
|
||||
Color getColorForTheme(String bundleId, String prop);
|
||||
|
||||
/**
|
||||
* Get property from instance scope preference of default bundleId, which managed by theme; the standard way eclipse
|
||||
* uses
|
||||
*
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
static Optional<String> getProperty(String key) {
|
||||
return getProperty(DEFAULT_PREFERENCE_ID, key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get property from instance scope preference of bundleId, which managed by theme; the standard way eclipse uses
|
||||
*
|
||||
* @param bundleId the instance scope preference which stores the key
|
||||
* @param key
|
||||
* @return
|
||||
*/
|
||||
static Optional<String> getProperty(String bundleId, String key) {
|
||||
ITalendThemeService theme = get();
|
||||
String value = null;
|
||||
if (theme != null) {
|
||||
value = theme.getPropertyForTheme(bundleId, key);
|
||||
}
|
||||
if (StringUtils.isBlank(value)) {
|
||||
return Optional.ofNullable(null);
|
||||
} else {
|
||||
return Optional.ofNullable(value);
|
||||
}
|
||||
}
|
||||
|
||||
String getPropertyForTheme(String bundleId, String key);
|
||||
|
||||
static void addPropertyChangeListener(IPropertyChangeListener listener) {
|
||||
ITalendThemeService theme = get();
|
||||
if (theme != null) {
|
||||
theme.addPropertyChangeListenerFor(DEFAULT_PREFERENCE_ID, listener);
|
||||
}
|
||||
}
|
||||
|
||||
static void addPropertyChangeListener(String bundleId, IPropertyChangeListener listener) {
|
||||
ITalendThemeService theme = get();
|
||||
if (theme != null) {
|
||||
theme.addPropertyChangeListenerFor(bundleId, listener);
|
||||
}
|
||||
}
|
||||
|
||||
void addPropertyChangeListenerFor(String bundleId, IPropertyChangeListener listener);
|
||||
|
||||
static boolean containsPropertyChangeListener(String bundleId, IPropertyChangeListener listener) {
|
||||
ITalendThemeService theme = get();
|
||||
if (theme != null) {
|
||||
return theme.containsPropertyChangeListenerFor(bundleId, listener);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean containsPropertyChangeListenerFor(String bundleId, IPropertyChangeListener listener);
|
||||
|
||||
static void removePropertyChangeListener(IPropertyChangeListener listener) {
|
||||
ITalendThemeService theme = get();
|
||||
if (theme != null) {
|
||||
theme.removePropertyChangeListenerFor(DEFAULT_PREFERENCE_ID, listener);
|
||||
}
|
||||
}
|
||||
|
||||
static void removePropertyChangeListener(String bundleId, IPropertyChangeListener listener) {
|
||||
ITalendThemeService theme = get();
|
||||
if (theme != null) {
|
||||
theme.removePropertyChangeListenerFor(bundleId, listener);
|
||||
}
|
||||
}
|
||||
|
||||
void removePropertyChangeListenerFor(String bundleId, IPropertyChangeListener listener);
|
||||
|
||||
IPreferenceStore getThemePreferenceStore();
|
||||
|
||||
static ITalendThemeService get() {
|
||||
try {
|
||||
BundleContext bc = FrameworkUtil.getBundle(ITalendThemeService.class).getBundleContext();
|
||||
ServiceReference<ITalendThemeService> serviceReference = bc.getServiceReference(ITalendThemeService.class);
|
||||
if (serviceReference == null) {
|
||||
return null;
|
||||
}
|
||||
return bc.getService(serviceReference);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,108 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime;
|
||||
|
||||
import org.talend.commons.ui.runtime.custom.IBusinessHandler;
|
||||
import org.talend.commons.ui.runtime.custom.ICustomUI;
|
||||
import org.talend.commons.ui.runtime.custom.ICustomUIEngine;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class TalendUI {
|
||||
|
||||
private static TalendUI inst;
|
||||
|
||||
private static Object lock = new Object();
|
||||
|
||||
private boolean isStudio = true;
|
||||
|
||||
private ICustomUIEngine stigmaUIEngine;
|
||||
|
||||
private TalendUI() {
|
||||
}
|
||||
|
||||
public static TalendUI get() {
|
||||
if (inst == null) {
|
||||
synchronized (lock) {
|
||||
if (inst == null) {
|
||||
inst = new TalendUI();
|
||||
}
|
||||
}
|
||||
}
|
||||
return inst;
|
||||
}
|
||||
|
||||
public void setStudio(boolean isStudio) {
|
||||
this.isStudio = isStudio;
|
||||
}
|
||||
|
||||
public boolean isStudio() {
|
||||
return this.isStudio;
|
||||
}
|
||||
|
||||
public ICustomUIEngine getStigmaUIEngine() {
|
||||
return this.stigmaUIEngine;
|
||||
}
|
||||
|
||||
public void setStigmaUIEngine(ICustomUIEngine engine) {
|
||||
this.stigmaUIEngine = engine;
|
||||
}
|
||||
|
||||
/**
|
||||
* should try to refactor them to different fragment
|
||||
*/
|
||||
@Deprecated
|
||||
public <T extends IBusinessHandler> T run(IStudioRunnable<T> studioRun, ICustomUI<T> stigmaRun) {
|
||||
if (isStudio()) {
|
||||
return run(studioRun);
|
||||
} else {
|
||||
return run(stigmaRun);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* should try to refactor them to different fragment
|
||||
*/
|
||||
@Deprecated
|
||||
public <T extends IBusinessHandler> T run(IStudioRunnable<T> run) {
|
||||
return run.run();
|
||||
}
|
||||
|
||||
public <T extends IBusinessHandler> T run(ICustomUI<T> ui) {
|
||||
if (ui == null) {
|
||||
throw new RuntimeException("Custom ui is not defined!");
|
||||
}
|
||||
return stigmaUIEngine.run(ui);
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static interface IStudioRunnable<T extends IBusinessHandler> {
|
||||
|
||||
T run();
|
||||
|
||||
}
|
||||
|
||||
@Deprecated
|
||||
public static abstract class AbsStudioRunnable<T extends IBusinessHandler> implements IStudioRunnable<T> {
|
||||
|
||||
@Override
|
||||
public T run() {
|
||||
return doRun();
|
||||
}
|
||||
|
||||
abstract public T doRun();
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import org.eclipse.jface.dialogs.Dialog;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbsBusinessHandler implements IBusinessHandler {
|
||||
|
||||
private Object openResult = Dialog.CANCEL;
|
||||
|
||||
public AbsBusinessHandler() {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModalDialog() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getOpenResult() {
|
||||
return openResult;
|
||||
}
|
||||
|
||||
public void setOpenResult(Object openResult) {
|
||||
this.openResult = openResult;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbsUIData extends AbsUIEvent implements IUIData {
|
||||
|
||||
public AbsUIData(String key, String id, String type) {
|
||||
super(key, id, type);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbsUIEvent implements IUIEvent {
|
||||
|
||||
private String type;
|
||||
|
||||
private String id;
|
||||
|
||||
private String key;
|
||||
|
||||
private Map<String, Object> params = new HashMap<>();
|
||||
|
||||
public AbsUIEvent(String key, String id, String type) {
|
||||
this.key = key;
|
||||
this.id = id;
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUIId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setUIId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getParams() {
|
||||
return params;
|
||||
}
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbsUIHandler implements IUIHandler {
|
||||
|
||||
/**
|
||||
* DOC cmeng AbsUIHandler constructor comment.
|
||||
*/
|
||||
public AbsUIHandler() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbsUIHandlerFactory implements IUIHandlerFactory {
|
||||
|
||||
/**
|
||||
* DOC cmeng AbsUIHandlerFactory constructor comment.
|
||||
*/
|
||||
public AbsUIHandlerFactory() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,258 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Semaphore;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.ui.runtime.TalendUI;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbstractCustomUI<T extends IBusinessHandler> implements ICustomUI<T> {
|
||||
|
||||
public static final String NONE = "none";
|
||||
|
||||
public static final String UI_OK = "ok";
|
||||
|
||||
public static final String UI_APPLY = "apply";
|
||||
|
||||
public static final String UI_CANCEL = "cancel";
|
||||
|
||||
public static final String UI_CLOSE = "close";
|
||||
|
||||
private Semaphore modalLock = new Semaphore(1);
|
||||
|
||||
private boolean isModalDialog = true;
|
||||
|
||||
private String uiId;
|
||||
|
||||
private String uiKey;
|
||||
|
||||
private ICustomUIEngine uiEngine;
|
||||
|
||||
private T businessHandler;
|
||||
|
||||
private Map<String, IUIEventHandler> eventMap = new HashMap<>();
|
||||
|
||||
private String selectedButton = NONE;
|
||||
|
||||
public AbstractCustomUI(T businessHandler) {
|
||||
this.businessHandler = businessHandler;
|
||||
this.uiId = UUID.randomUUID().toString();
|
||||
this.uiKey = this.businessHandler.getUiKey();
|
||||
this.isModalDialog = this.businessHandler.isModalDialog();
|
||||
this.uiEngine = TalendUI.get().getStigmaUIEngine();
|
||||
registerEventHandlers();
|
||||
}
|
||||
|
||||
protected IUIEvent createOpenEvent() {
|
||||
DefaultUIEvent openEvent = new DefaultUIEvent(BuiltinEvent.open.name(), uiId, IUIEvent.TYPE_GLOBAL);
|
||||
openEvent.getParams().put(BuiltinParams.uiKey.name(), getUiKey());
|
||||
return openEvent;
|
||||
}
|
||||
|
||||
protected DefaultUIEvent createUIEvent(String key) {
|
||||
DefaultUIEvent event = new DefaultUIEvent(key, uiId);
|
||||
return event;
|
||||
}
|
||||
|
||||
protected DefaultUIData createUIDataEvent(String key) {
|
||||
DefaultUIData uiData = new DefaultUIData(key, uiId);
|
||||
return uiData;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canHandle(IUIEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleUIEvent(IUIEvent event) {
|
||||
String eventKey = event.getKey();
|
||||
boolean closeDialog = false;
|
||||
if (BuiltinEvent.ok.name().equals(eventKey)) {
|
||||
setSelectedButton(UI_OK);
|
||||
closeDialog = onOk(event);
|
||||
} else if (BuiltinEvent.apply.name().equals(eventKey)) {
|
||||
setSelectedButton(UI_APPLY);
|
||||
closeDialog = onApply(event);
|
||||
} else if (BuiltinEvent.close.name().equals(eventKey)) {
|
||||
setSelectedButton(UI_CLOSE);
|
||||
closeDialog = onClose(event);
|
||||
} else if (BuiltinEvent.cancel.name().equals(eventKey)) {
|
||||
setSelectedButton(UI_CANCEL);
|
||||
closeDialog = onCancel(event);
|
||||
} else {
|
||||
IUIEventHandler eventListener = eventMap.get(eventKey);
|
||||
if (eventListener != null) {
|
||||
eventListener.handleUIEvent(event);
|
||||
} else {
|
||||
ExceptionHandler.process(new Exception("Can't handle event: " + eventKey));
|
||||
}
|
||||
}
|
||||
if (closeDialog) {
|
||||
closeDialog();
|
||||
} else {
|
||||
setSelectedButton(NONE);
|
||||
}
|
||||
}
|
||||
|
||||
protected int getOpenResult() {
|
||||
if (isCancelled()) {
|
||||
return CANCEL;
|
||||
} else {
|
||||
return OK;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object provideUIData(IUIData uiData) {
|
||||
return getUIEngine().provideUIData(uiData);
|
||||
}
|
||||
|
||||
protected void closeDialog() {
|
||||
collectDialogData();
|
||||
try {
|
||||
dispatchUIEvent(new DefaultUIEvent(BuiltinEvent.close.name(), uiId));
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
this.uiEngine.unregisterUIEventHandler(uiId);
|
||||
modalLock.release();
|
||||
onDialogClosed();
|
||||
}
|
||||
|
||||
@Override
|
||||
public T run() {
|
||||
try {
|
||||
modalLock.acquire();
|
||||
} catch (InterruptedException e) {
|
||||
throw new RuntimeException("Can't open dialog", e);
|
||||
}
|
||||
try {
|
||||
this.uiEngine.registerUIEventHandler(uiId, this);
|
||||
doRun();
|
||||
if (isModalDialog()) {
|
||||
try {
|
||||
while (true) {
|
||||
boolean succeed = modalLock.tryAcquire(5, TimeUnit.MINUTES);
|
||||
if (succeed) {
|
||||
break;
|
||||
}
|
||||
if (Thread.currentThread().isInterrupted()) {
|
||||
throw new InterruptedException();
|
||||
}
|
||||
if (this.uiEngine == null || !this.uiEngine.isClientAlive()) {
|
||||
throw new Exception("Lose connection with client");
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException("Dialog is closed unexpected", e);
|
||||
}
|
||||
}
|
||||
return businessHandler;
|
||||
} finally {
|
||||
modalLock.release();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public T getBusinessHandler() {
|
||||
return this.businessHandler;
|
||||
}
|
||||
|
||||
abstract protected T collectDialogData();
|
||||
|
||||
protected void onDialogClosed() {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
protected void doRun() {
|
||||
IUIEvent openEvent = createOpenEvent();
|
||||
dispatchUIEvent(openEvent);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void dispatchUIEvent(IUIEvent event) {
|
||||
event.setUIId(uiId);
|
||||
this.uiEngine.dispatchUIEvent(this, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompletableFuture<Object> requestUIData(IUIData uiData) {
|
||||
uiData.setUIId(uiId);
|
||||
return this.uiEngine.requestUIData(this, uiData);
|
||||
}
|
||||
|
||||
protected void registerEventListener(String key, IUIEventHandler listener) {
|
||||
eventMap.put(key, listener);
|
||||
}
|
||||
|
||||
public boolean isModalDialog() {
|
||||
// currently don't support to change modal, if do it, need to update logic of run
|
||||
return isModalDialog;
|
||||
}
|
||||
|
||||
protected ICustomUIEngine getUIEngine() {
|
||||
return this.uiEngine;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
return this.uiId;
|
||||
}
|
||||
|
||||
public String getUiKey() {
|
||||
return uiKey;
|
||||
}
|
||||
|
||||
protected void registerEventHandlers() {
|
||||
}
|
||||
|
||||
public String getSelectedButton() {
|
||||
return selectedButton;
|
||||
}
|
||||
|
||||
public void setSelectedButton(String selectedButton) {
|
||||
this.selectedButton = selectedButton;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return Arrays.asList(UI_CANCEL, UI_CLOSE).contains(getSelectedButton());
|
||||
}
|
||||
|
||||
protected boolean onOk(IUIEvent event) {
|
||||
return onApply(event);
|
||||
}
|
||||
|
||||
protected boolean onApply(IUIEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected boolean onClose(IUIEvent event) {
|
||||
return onCancel(event);
|
||||
}
|
||||
|
||||
protected boolean onCancel(IUIEvent event) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,128 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public abstract class AbstractCustomUIEngine implements ICustomUIEngine {
|
||||
|
||||
private static final Logger log = Logger.getLogger(AbstractCustomUIEngine.class);
|
||||
|
||||
private Map<String, IUIEventHandler> uiEventHandlers = Collections.synchronizedMap(new HashMap<>());
|
||||
|
||||
private Map<String, Set<IUIEventHandler>> globalUIEventHandlers = Collections.synchronizedMap(new HashMap<>());
|
||||
|
||||
public AbstractCustomUIEngine() {
|
||||
// nothing to do
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IBusinessHandler> T run(ICustomUI<T> ui) {
|
||||
return doRun(ui);
|
||||
}
|
||||
|
||||
protected <T extends IBusinessHandler> T doRun(ICustomUI<T> ui) {
|
||||
return ui.run();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleUIEvent(IUIEvent event) {
|
||||
if (StringUtils.equals(event.getType(), IUIEvent.TYPE_GLOBAL)) {
|
||||
Set<IUIEventHandler> handlers = globalUIEventHandlers.get(event.getKey());
|
||||
if (handlers != null) {
|
||||
new Thread(() -> {
|
||||
for (IUIEventHandler handler : handlers) {
|
||||
if (handler.canHandle(event)) {
|
||||
handler.handleUIEvent(event);
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
} else {
|
||||
IUIEventHandler handler = uiEventHandlers.get(event.getUIId());
|
||||
if (handler != null) {
|
||||
new Thread(() -> {
|
||||
handler.handleUIEvent(event);
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object provideUIData(IUIData uiData) {
|
||||
if (StringUtils.equals(uiData.getType(), IUIEvent.TYPE_GLOBAL)) {
|
||||
Set<IUIEventHandler> handlers = globalUIEventHandlers.get(uiData.getKey());
|
||||
if (handlers != null) {
|
||||
for (IUIEventHandler handler : handlers) {
|
||||
if (handler.canHandle(uiData)) {
|
||||
return handler.provideUIData(uiData);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
String uiId = uiData.getUIId();
|
||||
IUIEventHandler handler = uiEventHandlers.get(uiId);
|
||||
if (handler != null) {
|
||||
return handler.provideUIData(uiData);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerUIEventHandler(String uiId, IUIEventHandler handler) {
|
||||
IUIEventHandler existing = uiEventHandlers.put(uiId, handler);
|
||||
if (existing != null) {
|
||||
log.warn("duplicated register for UI id: " + uiId);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterUIEventHandler(String uiId) {
|
||||
uiEventHandlers.remove(uiId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerGlobalUIEventHandler(String eventId, IUIEventHandler handler) {
|
||||
Set<IUIEventHandler> handlers = globalUIEventHandlers.get(eventId);
|
||||
if (handlers == null) {
|
||||
synchronized (globalUIEventHandlers) {
|
||||
handlers = globalUIEventHandlers.get(eventId);
|
||||
if (handlers == null) {
|
||||
handlers = Collections.synchronizedSet(new LinkedHashSet<>());
|
||||
globalUIEventHandlers.put(eventId, handlers);
|
||||
}
|
||||
}
|
||||
}
|
||||
handlers.add(handler);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterGlobalUIEventHandler(String eventId, IUIEventHandler handler) {
|
||||
Set<IUIEventHandler> handlers = globalUIEventHandlers.get(eventId);
|
||||
if (handlers != null) {
|
||||
handlers.remove(handler);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class DefaultUIData extends AbsUIData {
|
||||
|
||||
public DefaultUIData(String key, String id) {
|
||||
// type is null, means it is an event inside custom ui, which id is 'id'
|
||||
super(key, id, null);
|
||||
}
|
||||
|
||||
public DefaultUIData(String key, String id, String type) {
|
||||
super(key, id, type);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class DefaultUIEvent extends AbsUIEvent {
|
||||
|
||||
public DefaultUIEvent(String key, String id) {
|
||||
// type is null, means it is an event side the custom ui, which id is 'id'
|
||||
super(key, id, null);
|
||||
}
|
||||
|
||||
public DefaultUIEvent(String key, String id, String type) {
|
||||
super(key, id, type);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface IBusinessHandler {
|
||||
|
||||
String getUiKey();
|
||||
|
||||
boolean isModalDialog();
|
||||
|
||||
Object getOpenResult();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
import org.eclipse.gef.commands.Command;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface ICommonUIHandler extends IUIHandler {
|
||||
|
||||
/**
|
||||
* Constant for no image (value 0).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
*/
|
||||
static final int NONE = 0;
|
||||
|
||||
/**
|
||||
* Constant for the error image, or a simple dialog with the error image and
|
||||
* a single OK button (value 1).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
*/
|
||||
static final int ERROR = 1;
|
||||
|
||||
/**
|
||||
* Constant for the info image, or a simple dialog with the info image and a
|
||||
* single OK button (value 2).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
*/
|
||||
static final int INFORMATION = 2;
|
||||
|
||||
/**
|
||||
* Constant for the question image, or a simple dialog with the question
|
||||
* image and Yes/No buttons (value 3).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
*/
|
||||
static final int QUESTION = 3;
|
||||
|
||||
/**
|
||||
* Constant for the warning image, or a simple dialog with the warning image
|
||||
* and a single OK button (value 4).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
*/
|
||||
static final int WARNING = 4;
|
||||
|
||||
/**
|
||||
* Constant for a simple dialog with the question image and OK/Cancel buttons (value 5).
|
||||
*
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
* @since 3.5
|
||||
*/
|
||||
static final int CONFIRM = 5;
|
||||
|
||||
/**
|
||||
* Constant for a simple dialog with the question image and Yes/No/Cancel buttons (value 6).
|
||||
*
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
* @since 3.5
|
||||
*/
|
||||
static final int QUESTION_WITH_CANCEL = 6;
|
||||
|
||||
static final String CONTEXT_COMMAND_STACK = "COMMAND_STACK";
|
||||
|
||||
boolean execute(Command cmd);
|
||||
|
||||
boolean openQuestion(String title, String msg);
|
||||
|
||||
boolean openConfirm(String title, String msg);
|
||||
|
||||
void openWarning(String title, String msg);
|
||||
|
||||
MessageDialogWithToggleBusinessHandler openToggle(MessageDialogWithToggleBusinessHandler bh);
|
||||
|
||||
void openError(String title, String msg);
|
||||
|
||||
static ICommonUIHandler get() {
|
||||
return UIHandlerFactories.inst().getUIHandler(ICommonUIHandler.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
|
||||
public interface ICrossPlatformPreferenceStore {
|
||||
|
||||
boolean getBoolean(String key);
|
||||
|
||||
boolean getDefaultBoolean(String key);
|
||||
|
||||
void setValue(String key, boolean value);
|
||||
|
||||
void setValue(String key, String value);
|
||||
|
||||
Object getOriginStore();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,63 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.talend.commons.ui.runtime.TalendUI;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface ICustomUI<T extends IBusinessHandler> extends IUIEventHandler {
|
||||
|
||||
public static final int OK = 0;
|
||||
|
||||
public static final int CANCEL = 1;
|
||||
|
||||
String getId();
|
||||
|
||||
T getBusinessHandler();
|
||||
|
||||
T run();
|
||||
|
||||
default T open() {
|
||||
return TalendUI.get().run(this);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send event to stigma
|
||||
*/
|
||||
void dispatchUIEvent(IUIEvent event);
|
||||
|
||||
/**
|
||||
* Request data from stigma
|
||||
*/
|
||||
CompletableFuture<Object> requestUIData(IUIData uiData);
|
||||
|
||||
static enum BuiltinEvent {
|
||||
open,
|
||||
ok,
|
||||
apply,
|
||||
close,
|
||||
cancel;
|
||||
}
|
||||
|
||||
static enum BuiltinParams {
|
||||
uiKey,
|
||||
name,
|
||||
title,
|
||||
message;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface ICustomUIDialog {
|
||||
|
||||
int open();
|
||||
|
||||
int getOpenResult();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface ICustomUIEngine {
|
||||
|
||||
static final String CONTEXT_PROCESS = "PROCESS";
|
||||
|
||||
<T extends IBusinessHandler> T run(ICustomUI<T> ui);
|
||||
|
||||
/**
|
||||
* Handle event from stigma
|
||||
*/
|
||||
void handleUIEvent(IUIEvent event);
|
||||
|
||||
/**
|
||||
* Provide UI data to stigma
|
||||
*/
|
||||
Object provideUIData(IUIData uiData);
|
||||
|
||||
/**
|
||||
* Send event to stigma
|
||||
*/
|
||||
<T extends IBusinessHandler> void dispatchUIEvent(ICustomUI<T> ui, IUIEvent event);
|
||||
|
||||
/**
|
||||
* Request data from stigma
|
||||
*/
|
||||
<T extends IBusinessHandler> CompletableFuture<Object> requestUIData(ICustomUI<T> ui, IUIData uiData);
|
||||
|
||||
<M> M convertValue(Object value, Class<M> clz);
|
||||
|
||||
Object readJson(String value) throws Exception;
|
||||
|
||||
void registerThreadLocalContext(String key, Object value);
|
||||
|
||||
Object getThreadLocalContext(String key);
|
||||
|
||||
void registerUIEventHandler(String uiId, IUIEventHandler handler);
|
||||
|
||||
void unregisterUIEventHandler(String uiId);
|
||||
|
||||
void registerGlobalUIEventHandler(String eventId, IUIEventHandler handler);
|
||||
|
||||
void unregisterGlobalUIEventHandler(String eventId, IUIEventHandler handler);
|
||||
|
||||
boolean isClientAlive();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface IUIData extends IUIEvent {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface IUIEvent {
|
||||
|
||||
static final String TYPE_GLOBAL = "global";
|
||||
|
||||
String getType();
|
||||
|
||||
String getUIId();
|
||||
|
||||
void setUIId(String id);
|
||||
|
||||
String getKey();
|
||||
|
||||
Map<String, Object> getParams();
|
||||
|
||||
}
|
||||
@@ -0,0 +1,30 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface IUIEventHandler {
|
||||
|
||||
boolean canHandle(IUIEvent event);
|
||||
|
||||
void handleUIEvent(IUIEvent event);
|
||||
|
||||
/**
|
||||
* Provide UIData to frontend
|
||||
*/
|
||||
Object provideUIData(IUIData uiData);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface IUIHandler {
|
||||
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public interface IUIHandlerFactory {
|
||||
|
||||
<T extends IUIHandler> T getUIHandler(Class<T> clz);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,77 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
|
||||
public class InputDialogBusinessCustomUI extends AbstractCustomUI<InputDialogBusinessHandler> {
|
||||
|
||||
public InputDialogBusinessCustomUI(InputDialogBusinessHandler businessHandler) {
|
||||
super(businessHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IUIEvent createOpenEvent() {
|
||||
IUIEvent openEvent = super.createOpenEvent();
|
||||
Map<String, Object> params = openEvent.getParams();
|
||||
InputDialogBusinessHandler bh = getBusinessHandler();
|
||||
params.put(BuiltinParams.title.name(), bh.getTitle());
|
||||
params.put(BuiltinParams.message.name(), bh.getMessage());
|
||||
params.put("defaultValue", bh.getDefaultValue());
|
||||
return openEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean onApply(IUIEvent event) {
|
||||
DefaultUIData valueEvent = createUIDataEvent("value");
|
||||
String errMsg = null;
|
||||
try {
|
||||
Object value = requestUIData(valueEvent).get();
|
||||
InputDialogBusinessHandler bh = getBusinessHandler();
|
||||
if (value == null) {
|
||||
value = "";
|
||||
}
|
||||
errMsg = bh.getValidator().isValid((String) value);
|
||||
if (StringUtils.isBlank(errMsg)) {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
errMsg = e.getLocalizedMessage();
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
DefaultUIEvent errorEvent = new DefaultUIEvent("error", getId());
|
||||
errorEvent.getParams().put("message", errMsg);
|
||||
dispatchUIEvent(errorEvent);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected InputDialogBusinessHandler collectDialogData() {
|
||||
DefaultUIData valueEvent = createUIDataEvent("value");
|
||||
InputDialogBusinessHandler businessHandler = getBusinessHandler();
|
||||
try {
|
||||
Object value = requestUIData(valueEvent).get();
|
||||
businessHandler.setOpenResult(getOpenResult());
|
||||
if (value != null) {
|
||||
businessHandler.setResult(value.toString());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return businessHandler;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
public class InputDialogBusinessHandler extends AbsBusinessHandler {
|
||||
|
||||
private static final String UI_KEY = "InputDialog";
|
||||
|
||||
private String title;
|
||||
|
||||
private String message;
|
||||
|
||||
private String defaultValue;
|
||||
|
||||
private String result;
|
||||
|
||||
private IInputDialogInputValidator validator;
|
||||
|
||||
public InputDialogBusinessHandler(String title, String message, String defaultValue, IInputDialogInputValidator validator) {
|
||||
super();
|
||||
this.title = title;
|
||||
this.message = message;
|
||||
this.defaultValue = defaultValue;
|
||||
this.validator = validator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUiKey() {
|
||||
return UI_KEY;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public String getDefaultValue() {
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public String getResult() {
|
||||
return result;
|
||||
}
|
||||
|
||||
public void setResult(String result) {
|
||||
this.result = result;
|
||||
}
|
||||
|
||||
public IInputDialogInputValidator getValidator() {
|
||||
return validator;
|
||||
}
|
||||
|
||||
public interface IInputDialogInputValidator {
|
||||
|
||||
public String isValid(String newText);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,134 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class MessageDialogBusinessHandler extends AbsBusinessHandler {
|
||||
|
||||
/**
|
||||
* Constant for no image (value 0).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
*/
|
||||
public static final int NONE = ICommonUIHandler.NONE;
|
||||
|
||||
/**
|
||||
* Constant for the error image, or a simple dialog with the error image and
|
||||
* a single OK button (value 1).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
*/
|
||||
public static final int ERROR = ICommonUIHandler.ERROR;
|
||||
|
||||
/**
|
||||
* Constant for the info image, or a simple dialog with the info image and a
|
||||
* single OK button (value 2).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
*/
|
||||
public static final int INFORMATION = ICommonUIHandler.INFORMATION;
|
||||
|
||||
/**
|
||||
* Constant for the question image, or a simple dialog with the question
|
||||
* image and Yes/No buttons (value 3).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
*/
|
||||
public static final int QUESTION = ICommonUIHandler.QUESTION;
|
||||
|
||||
/**
|
||||
* Constant for the warning image, or a simple dialog with the warning image
|
||||
* and a single OK button (value 4).
|
||||
*
|
||||
* @see #MessageDialog(Shell, String, Image, String, int, int, String...)
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
*/
|
||||
public static final int WARNING = ICommonUIHandler.WARNING;
|
||||
|
||||
/**
|
||||
* Constant for a simple dialog with the question image and OK/Cancel buttons (value 5).
|
||||
*
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
* @since 3.5
|
||||
*/
|
||||
public static final int CONFIRM = ICommonUIHandler.CONFIRM;
|
||||
|
||||
/**
|
||||
* Constant for a simple dialog with the question image and Yes/No/Cancel buttons (value 6).
|
||||
*
|
||||
* @see #open(int, Shell, String, String, int)
|
||||
* @since 3.5
|
||||
*/
|
||||
public static final int QUESTION_WITH_CANCEL = ICommonUIHandler.QUESTION_WITH_CANCEL;
|
||||
|
||||
private static final String UI_KEY = "MessageDialog";
|
||||
|
||||
private String title;
|
||||
|
||||
private String message;
|
||||
|
||||
private int dialogType;
|
||||
|
||||
private boolean isModalDialog = true;
|
||||
|
||||
public MessageDialogBusinessHandler(int dialogType) {
|
||||
super();
|
||||
this.dialogType = dialogType;
|
||||
}
|
||||
|
||||
public int getDialogType() {
|
||||
return dialogType;
|
||||
}
|
||||
|
||||
public void setDialogType(int dialogType) {
|
||||
this.dialogType = dialogType;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUiKey() {
|
||||
return UI_KEY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isModalDialog() {
|
||||
return this.isModalDialog;
|
||||
}
|
||||
|
||||
public void setModalDialog(boolean modal) {
|
||||
this.isModalDialog = modal;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class MessageDialogCustomUI extends AbstractCustomUI<MessageDialogBusinessHandler> {
|
||||
|
||||
public MessageDialogCustomUI(MessageDialogBusinessHandler businessHandler) {
|
||||
super(businessHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IUIEvent createOpenEvent() {
|
||||
IUIEvent openEvent = super.createOpenEvent();
|
||||
Map<String, Object> params = openEvent.getParams();
|
||||
MessageDialogBusinessHandler bh = getBusinessHandler();
|
||||
params.put(BuiltinParams.title.name(), bh.getTitle());
|
||||
params.put(BuiltinParams.message.name(), bh.getMessage());
|
||||
params.put("dialogType", mapDialogType(bh.getDialogType()));
|
||||
return openEvent;
|
||||
}
|
||||
|
||||
private String mapDialogType(int type) {
|
||||
switch (type) {
|
||||
case MessageDialog.CONFIRM:
|
||||
return "confirm";
|
||||
case MessageDialog.ERROR:
|
||||
return "error";
|
||||
case MessageDialog.INFORMATION:
|
||||
return "info";
|
||||
case MessageDialog.QUESTION:
|
||||
return "question";
|
||||
case MessageDialog.QUESTION_WITH_CANCEL:
|
||||
return "questionWithCancel";
|
||||
case MessageDialog.WARNING:
|
||||
return "warning";
|
||||
default:
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MessageDialogBusinessHandler collectDialogData() {
|
||||
MessageDialogBusinessHandler businessHandler = getBusinessHandler();
|
||||
try {
|
||||
businessHandler.setOpenResult(getDialogOpenResult());
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return businessHandler;
|
||||
}
|
||||
|
||||
private Object getDialogOpenResult() {
|
||||
Object result = null;
|
||||
boolean isCancelled = isCancelled();
|
||||
switch (getBusinessHandler().getDialogType()) {
|
||||
case MessageDialog.CONFIRM:
|
||||
case MessageDialog.ERROR:
|
||||
case MessageDialog.INFORMATION:
|
||||
case MessageDialog.WARNING:
|
||||
if (isCancelled) {
|
||||
result = Boolean.FALSE;
|
||||
} else {
|
||||
result = Boolean.TRUE;
|
||||
}
|
||||
break;
|
||||
case MessageDialog.QUESTION:
|
||||
if (isCancelled) {
|
||||
result = Boolean.FALSE;
|
||||
} else {
|
||||
result = Boolean.TRUE;
|
||||
}
|
||||
break;
|
||||
case MessageDialog.QUESTION_WITH_CANCEL:
|
||||
if (isCancelled) {
|
||||
result = Boolean.FALSE;
|
||||
} else {
|
||||
result = Boolean.TRUE;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
result = getOpenResult();
|
||||
break;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,95 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
public class MessageDialogWithToggleBusinessHandler extends MessageDialogBusinessHandler {
|
||||
|
||||
private static final String UI_KEY = "MessageDialogWithToggle";
|
||||
|
||||
private String toggleMessage;
|
||||
|
||||
private boolean toggleState;
|
||||
|
||||
private ICrossPlatformPreferenceStore preferenceStore;
|
||||
|
||||
private String prefKey;
|
||||
|
||||
private String[] buttonLabels;
|
||||
|
||||
private int defaultBtnIndex = 0;
|
||||
|
||||
public MessageDialogWithToggleBusinessHandler(int dialogType, String title, String message, String[] buttonLabels,
|
||||
int defaultBtnIndex, String toggleMessage, boolean toggleState) {
|
||||
super(dialogType);
|
||||
this.setTitle(title);
|
||||
this.setMessage(message);
|
||||
this.buttonLabels = buttonLabels;
|
||||
this.defaultBtnIndex = defaultBtnIndex;
|
||||
this.toggleMessage = toggleMessage;
|
||||
this.toggleState = toggleState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUiKey() {
|
||||
return UI_KEY;
|
||||
}
|
||||
|
||||
public String getToggleMessage() {
|
||||
return toggleMessage;
|
||||
}
|
||||
|
||||
public void setToggleMessage(String toggleMessage) {
|
||||
this.toggleMessage = toggleMessage;
|
||||
}
|
||||
|
||||
public boolean getToggleState() {
|
||||
return toggleState;
|
||||
}
|
||||
|
||||
public void setToggleState(boolean toggleState) {
|
||||
this.toggleState = toggleState;
|
||||
}
|
||||
|
||||
public ICrossPlatformPreferenceStore getPreferenceStore() {
|
||||
return preferenceStore;
|
||||
}
|
||||
|
||||
public void setPreferenceStore(ICrossPlatformPreferenceStore preferenceStore) {
|
||||
this.preferenceStore = preferenceStore;
|
||||
}
|
||||
|
||||
public String getPrefKey() {
|
||||
return prefKey;
|
||||
}
|
||||
|
||||
public void setPrefKey(String prefKey) {
|
||||
this.prefKey = prefKey;
|
||||
}
|
||||
|
||||
public String[] getButtonLabels() {
|
||||
return buttonLabels;
|
||||
}
|
||||
|
||||
public void setButtonLabels(String[] buttonLabels) {
|
||||
this.buttonLabels = buttonLabels;
|
||||
}
|
||||
|
||||
public int getDefaultBtnIndex() {
|
||||
return defaultBtnIndex;
|
||||
}
|
||||
|
||||
public void setDefaultBtnIndex(int defaultBtnIndex) {
|
||||
this.defaultBtnIndex = defaultBtnIndex;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,78 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
|
||||
public class MessageDialogWithToggleCustomUI extends AbstractCustomUI<MessageDialogWithToggleBusinessHandler> {
|
||||
|
||||
public MessageDialogWithToggleCustomUI(MessageDialogWithToggleBusinessHandler businessHandler) {
|
||||
super(businessHandler);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IUIEvent createOpenEvent() {
|
||||
IUIEvent openEvent = super.createOpenEvent();
|
||||
Map<String, Object> params = openEvent.getParams();
|
||||
MessageDialogWithToggleBusinessHandler bh = getBusinessHandler();
|
||||
params.put(BuiltinParams.title.name(), bh.getTitle());
|
||||
params.put(BuiltinParams.message.name(), bh.getMessage());
|
||||
params.put("toggleMsg", bh.getToggleMessage());
|
||||
params.put("toggleState", bh.getToggleState());
|
||||
params.put("dialogImageType", mapDialogImageType(bh.getDialogType()));
|
||||
params.put("buttons", bh.getButtonLabels());
|
||||
params.put("defaultBtnIndex", bh.getDefaultBtnIndex());
|
||||
return openEvent;
|
||||
}
|
||||
|
||||
private String mapDialogImageType(int type) {
|
||||
switch (type) {
|
||||
case MessageDialog.CONFIRM:
|
||||
return "confirm";
|
||||
case MessageDialog.ERROR:
|
||||
return "error";
|
||||
case MessageDialog.INFORMATION:
|
||||
return "info";
|
||||
case MessageDialog.QUESTION:
|
||||
return "question";
|
||||
case MessageDialog.QUESTION_WITH_CANCEL:
|
||||
return "questionWithCancel";
|
||||
case MessageDialog.WARNING:
|
||||
return "warning";
|
||||
default:
|
||||
return "none";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MessageDialogWithToggleBusinessHandler collectDialogData() {
|
||||
DefaultUIData toggleStateReq = createUIDataEvent("toggleState");
|
||||
MessageDialogWithToggleBusinessHandler businessHandler = getBusinessHandler();
|
||||
try {
|
||||
CompletableFuture<Object> toggleStateResp = requestUIData(toggleStateReq);
|
||||
businessHandler.setOpenResult(getOpenResult());
|
||||
boolean toggleState = Boolean.valueOf(toggleStateResp.get().toString());
|
||||
if (toggleState != businessHandler.getToggleState()) {
|
||||
businessHandler.setToggleState(toggleState);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return businessHandler;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,73 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.runtime.custom;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class UIHandlerFactories implements IUIHandlerFactory {
|
||||
|
||||
private static UIHandlerFactories inst;
|
||||
|
||||
private Collection<IUIHandlerFactory> factories;
|
||||
|
||||
public static UIHandlerFactories inst() {
|
||||
if (inst == null) {
|
||||
inst = new UIHandlerFactories();
|
||||
}
|
||||
return inst;
|
||||
}
|
||||
|
||||
private UIHandlerFactories() {
|
||||
factories = new HashSet<>();
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
try {
|
||||
BundleContext bc = FrameworkUtil.getBundle(UIHandlerFactories.class).getBundleContext();
|
||||
Collection<ServiceReference<IUIHandlerFactory>> serviceReferences = bc.getServiceReferences(IUIHandlerFactory.class,
|
||||
null);
|
||||
for (ServiceReference<IUIHandlerFactory> sr : serviceReferences) {
|
||||
IUIHandlerFactory impl = bc.getService(sr);
|
||||
factories.add(impl);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T extends IUIHandler> T getUIHandler(Class<T> clz) {
|
||||
for (IUIHandlerFactory factory : factories) {
|
||||
T ui = factory.getUIHandler(clz);
|
||||
if (ui != null) {
|
||||
return ui;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public ICommonUIHandler getCommonUIHandler() {
|
||||
return getUIHandler(ICommonUIHandler.class);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2022 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.ui.runtime.custom;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class UnsupportedCustomUI<T extends IBusinessHandler> extends AbstractCustomUI<T> {
|
||||
|
||||
UnsupportedBusinessHandler realHandler;
|
||||
|
||||
public UnsupportedCustomUI(T bh, String name) {
|
||||
super(bh);
|
||||
realHandler = new UnsupportedBusinessHandler(name);
|
||||
}
|
||||
|
||||
public UnsupportedCustomUI(T bh, String name, String message) {
|
||||
super(bh);
|
||||
realHandler = new UnsupportedBusinessHandler(name, message);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IUIEvent createOpenEvent() {
|
||||
IUIEvent openEvent = super.createOpenEvent();
|
||||
Map<String, Object> params = openEvent.getParams();
|
||||
params.put(BuiltinParams.name.name(), realHandler.getDialogName());
|
||||
params.put(BuiltinParams.message.name(), realHandler.getDialogName());
|
||||
return openEvent;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected T collectDialogData() {
|
||||
return getBusinessHandler();
|
||||
}
|
||||
|
||||
public static class UnsupportedBusinessHandler extends AbsBusinessHandler {
|
||||
|
||||
private static final String UI_KEY = "UnsupportedDialog";
|
||||
|
||||
private String dialogName;
|
||||
|
||||
private String message;
|
||||
|
||||
public UnsupportedBusinessHandler(String name) {
|
||||
super();
|
||||
this.dialogName = name;
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
new Exception().printStackTrace(pw);
|
||||
this.message = sw.toString();
|
||||
}
|
||||
|
||||
public UnsupportedBusinessHandler(String name, String message) {
|
||||
super();
|
||||
this.dialogName = name;
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUiKey() {
|
||||
return UI_KEY;
|
||||
}
|
||||
|
||||
public String getDialogName() {
|
||||
return dialogName;
|
||||
}
|
||||
|
||||
public void setDialogName(String dialogName) {
|
||||
this.dialogName = dialogName;
|
||||
}
|
||||
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -72,12 +72,27 @@ public final class MessageBoxExceptionHandler {
|
||||
}
|
||||
}
|
||||
|
||||
public static void process(Throwable ex, Shell shell, boolean wrapMessage) {
|
||||
CommonExceptionHandler.process(ex);
|
||||
|
||||
if (CommonsPlugin.isHeadless() || CommonsPlugin.isJUnitTest()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (shell != null) {
|
||||
showMessage(ex, shell, wrapMessage);
|
||||
}
|
||||
}
|
||||
|
||||
public static void showMessage(Throwable ex, Shell shell) {
|
||||
showMessage(ex, shell, true);
|
||||
}
|
||||
/**
|
||||
* Open a message box showing a generic message and exception message.
|
||||
*
|
||||
* @param ex - exception to show
|
||||
*/
|
||||
public static void showMessage(Throwable ex, Shell shell) {
|
||||
public static void showMessage(Throwable ex, Shell shell, boolean wrapMessage) {
|
||||
if (ex.equals(lastShowedAction)) {
|
||||
return;
|
||||
}
|
||||
@@ -85,10 +100,14 @@ public final class MessageBoxExceptionHandler {
|
||||
|
||||
// TODO smallet use ErrorDialogWidthDetailArea ?
|
||||
String title = Messages.getString("commons.error"); //$NON-NLS-1$
|
||||
String msg = Messages.getString("exception.errorOccured", ex.getMessage()); //$NON-NLS-1$
|
||||
String excepMsg = ex.getMessage();
|
||||
//add for tup-19726/19790, as for exception detailMessage will show more details on log area.
|
||||
if(ex.getCause()!=null) {
|
||||
msg = Messages.getString("exception.errorOccured", ex.getCause().getMessage()); //$NON-NLS-1$
|
||||
excepMsg = ex.getCause().getMessage();
|
||||
}
|
||||
String msg = Messages.getString("exception.errorOccured", excepMsg); //$NON-NLS-1$
|
||||
if (!wrapMessage) {
|
||||
msg = Messages.getString("exception.message", excepMsg); //$NON-NLS-1$
|
||||
}
|
||||
Priority priority = CommonExceptionHandler.getPriority(ex);
|
||||
|
||||
|
||||
@@ -114,6 +114,7 @@ TableViewerCreator.Table.BeNull=table is null
|
||||
TableViewerCreator.TableColumn.AssertMsg=The TableColumn of TableEditorColumn with idProperty '{0}' has not the correct Table parent
|
||||
TreeToTablesLinker.Type.Unsupported=This type of currentControl is unsupported
|
||||
commons.error=Error
|
||||
exception.message={0}\nSee log for more details.
|
||||
exception.errorOccured=An error occured ({0}).\nSee log for more details.
|
||||
ModelSelectionDialog.Message=Please choose one option, or cancel.
|
||||
ModelSelectionDialog.Option=option
|
||||
|
||||
@@ -114,6 +114,7 @@ TableViewerCreator.Table.BeNull=la table est null.
|
||||
TableViewerCreator.TableColumn.AssertMsg=La TableColumn de TableEditorColumn avec idProperty '{0}' n'a pas la bonne Table parente
|
||||
TreeToTablesLinker.Type.Unsupported=Ce type de currentControl n'est pas support\u00E9
|
||||
commons.error=Erreur
|
||||
exception.message={0}\nConsultez le log pour plus de d\u00E9tails.
|
||||
exception.errorOccured=Une erreur est survenue ({0}).\nConsultez le log pour plus de d\u00E9tails.
|
||||
ModelSelectionDialog.Message=S\u00E9lectionnez une option ou annulez.
|
||||
ModelSelectionDialog.Option=Option
|
||||
|
||||
@@ -96,7 +96,7 @@ ProposalUtils.CtrlProposal.ErrorMsg=\u3053\u306E\u30BF\u30A4\u30D7\u306E\u5236\u
|
||||
RemovePushButton.RemoveButton.Tip=\u9078\u629E\u3057\u305F\u30A2\u30A4\u30C6\u30E0\u3092\u524A\u9664
|
||||
ResetDBTypesButton.ResetDBTypesButton.Tip=DB\u30BF\u30A4\u30D7\u3092\u30EA\u30BB\u30C3\u30C8
|
||||
Rule.rule=\u30EB\u30FC\u30EB[{0}]
|
||||
SaveAsGenericSchemaPushButton.saveAsSchema=\u6C4E\u7528\u30B9\u30AD\u30FC\u30DE\u3068\u3057\u3066\u4FDD\u5B58
|
||||
SaveAsGenericSchemaPushButton.saveAsSchema=\u30B8\u30A7\u30CD\u30EA\u30C3\u30AF\u30B9\u30AD\u30FC\u30DE\u3068\u3057\u3066\u4FDD\u5B58
|
||||
SelectContextVariablesPushButton.Label=\u30B3\u30F3\u30C6\u30AF\u30B9\u30C8\u5909\u6570\u3092\u9078\u629E
|
||||
SWTCalendarWithTime.contentEvening=\u5915\u65B9
|
||||
SWTCalendarWithTime.contentHr=\u6642:
|
||||
@@ -114,6 +114,7 @@ TableViewerCreator.Table.BeNull=\u30C6\u30FC\u30D6\u30EB\u304CNULL\u3067\u3059
|
||||
TableViewerCreator.TableColumn.AssertMsg=idProperty'{0}'\u304C\u3042\u308BTableEditorColumn\u306ETableColumn\u306B\u306F\u3001\u6B63\u3057\u3044\u89AA\u30C6\u30FC\u30D6\u30EB\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u305B\u3093
|
||||
TreeToTablesLinker.Type.Unsupported=currentControl\u306E\u3053\u306E\u30BF\u30A4\u30D7\u306F\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093
|
||||
commons.error=\u30A8\u30E9\u30FC
|
||||
exception.message={0}\n\u8A73\u7D30\u306F\u30ED\u30B0\u3092\u53C2\u7167\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
exception.errorOccured=\u30A8\u30E9\u30FC\u304C\u767A\u751F\u3057\u307E\u3057\u305F({0})\u3002\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
|
||||
|
||||
@@ -114,6 +114,7 @@ TableViewerCreator.Table.BeNull=\u8868\u4E3A null
|
||||
TableViewerCreator.TableColumn.AssertMsg=TableEditorColumn \u7684 idProperty \u4E3A '{0}' \u7684 TableColumn \u6CA1\u6709\u6B63\u786E\u7684 Table \u7236\u9879
|
||||
TreeToTablesLinker.Type.Unsupported=\u4E0D\u652F\u6301\u8FD9\u79CD\u7C7B\u578B\u7684 currentControl
|
||||
commons.error=\u9519\u8BEF
|
||||
exception.message={0}\n\u8BF7\u67E5\u770B\u65E5\u5FD7\u4EE5\u83B7\u53D6\u66F4\u591A\u8BE6\u7EC6\u4FE1\u606F\u3002
|
||||
exception.errorOccured=\u51FA\u73B0\u9519\u8BEF ({0})\u3002\n\u8BF7\u67E5\u770B\u65E5\u5FD7\u4EE5\u83B7\u53D6\u66F4\u591A\u8BE6\u7EC6\u4FE1\u606F\u3002
|
||||
ModelSelectionDialog.Message=\u8BF7\u9009\u62E9\u4E00\u4E2A\u9009\u9879\u6216\u53D6\u6D88\u3002
|
||||
ModelSelectionDialog.Option=\u9009\u9879
|
||||
|
||||
@@ -115,6 +115,8 @@ public enum ECoreImage implements IImage {
|
||||
|
||||
METADATA_SAPCONNECTION_ICON("/icons1/sapconnection.png"), //$NON-NLS-1$
|
||||
METADATA_SAPCONNECTION_WIZ("/icons1/connection_wiz.gif"), //$NON-NLS-1$
|
||||
|
||||
METADATA_BIGQUERYCONNECTION_ICON("/icons1/bigqueryconnection.png"), //$NON-NLS-1$
|
||||
|
||||
METADATA_HEADERFOOTER_ICON("/icons1/headerfooter_icon32.png"), //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -40,8 +40,8 @@ public enum EImage implements IImage {
|
||||
READ_ICON("/icons/read_obj.gif"), //$NON-NLS-1$
|
||||
|
||||
QUESTION_ICON("/icons/question.gif"), //$NON-NLS-1$
|
||||
|
||||
HELP_ICON("/icons/help.png"), //$NON-NLS-1$
|
||||
MOREINFO_ICON("/icons/moreInfo.png"), //$NON-NLS-1$
|
||||
|
||||
CREATE_CONNECTION_ICON("/icons/connection.gif"), //$NON-NLS-1$
|
||||
|
||||
|
||||
@@ -16,8 +16,14 @@ import java.io.BufferedOutputStream;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import java.util.Optional;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.swt.SWT;
|
||||
@@ -158,8 +164,35 @@ public class ImageUtils {
|
||||
return imageDes;
|
||||
}
|
||||
|
||||
private static Map<byte[], ImageDataProvider> imageFromDataCachedImages = new HashMap<byte[], ImageDataProvider>();
|
||||
private static Map<byte[], ImageDataProvider> imageFromDataCachedImages = Collections.synchronizedMap(new HashMap<byte[], ImageDataProvider>());
|
||||
private static Map<Long, byte[]> cachedImagesTimeKeeping = Collections.synchronizedMap(new HashMap<Long, byte[]>());
|
||||
|
||||
private static Thread clearImageFromDataCachedImages = new Thread() {
|
||||
@SuppressWarnings("static-access")
|
||||
public void run() {
|
||||
long timeout = 5 * 60 * 1000;
|
||||
while(true) {//remove older than 5 mins
|
||||
Set<Entry<Long, byte[]>> collect = cachedImagesTimeKeeping.entrySet().stream()
|
||||
.filter(entry -> (System.currentTimeMillis() - entry.getKey()) > timeout).collect(Collectors.toSet());
|
||||
for(Entry<Long, byte[]> entry: collect) {
|
||||
Long key = entry.getKey();
|
||||
cachedImagesTimeKeeping.remove(key);
|
||||
imageFromDataCachedImages.remove(entry.getValue());
|
||||
}
|
||||
|
||||
try {
|
||||
sleep(timeout);
|
||||
} catch (InterruptedException e) {//
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
static {
|
||||
clearImageFromDataCachedImages.setDaemon(true);
|
||||
clearImageFromDataCachedImages.start();
|
||||
}
|
||||
|
||||
/**
|
||||
* By default, keep in memory the .
|
||||
*
|
||||
@@ -169,12 +202,17 @@ public class ImageUtils {
|
||||
*/
|
||||
public static ImageDescriptor createImageFromData(byte[] data, boolean... keepInMemory) {
|
||||
if (data != null) {
|
||||
ImageDataProvider imageProvider = imageFromDataCachedImages.get(data);
|
||||
ImageDataProvider imageProvider = null;
|
||||
Optional<byte[]> findKey = imageFromDataCachedImages.keySet().stream().filter(key->Arrays.equals(key, data)).findAny();
|
||||
if(findKey.isPresent()) {
|
||||
imageProvider = imageFromDataCachedImages.get(findKey.get());
|
||||
}
|
||||
if (imageProvider == null) {
|
||||
ByteArrayInputStream bais = new ByteArrayInputStream(data);
|
||||
ImageData img = new ImageData(bais);
|
||||
imageProvider = new TalendImageProvider(img);
|
||||
imageFromDataCachedImages.put(data, imageProvider);
|
||||
cachedImagesTimeKeeping.put(System.currentTimeMillis(), data);
|
||||
}
|
||||
return ImageDescriptor.createFromImageDataProvider(imageProvider);
|
||||
}
|
||||
@@ -183,8 +221,9 @@ public class ImageUtils {
|
||||
|
||||
public static void disposeImages(byte[] data) {
|
||||
if (data != null) {
|
||||
if (imageFromDataCachedImages.get(data) != null) {
|
||||
imageFromDataCachedImages.remove(data);
|
||||
Optional<byte[]> findKey = imageFromDataCachedImages.keySet().stream().filter(key->Arrays.equals(key, data)).findAny();
|
||||
if(findKey.isPresent()) {
|
||||
imageFromDataCachedImages.remove(findKey.get());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,6 +57,8 @@ import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.eclipse.swt.widgets.TableColumn;
|
||||
import org.eclipse.swt.widgets.TableItem;
|
||||
import org.talend.commons.ui.runtime.ColorConstants;
|
||||
import org.talend.commons.ui.runtime.ITalendThemeService;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.swt.proposal.IShowInvisibleCellEditorMethods;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.behavior.DefaultHeaderColumnSelectionListener;
|
||||
@@ -291,7 +293,8 @@ public class TableViewerCreatorNotModifiable<B> {
|
||||
public TableViewerCreatorNotModifiable(Composite compositeParent) {
|
||||
super();
|
||||
this.compositeParent = compositeParent;
|
||||
this.emptyZoneColor = compositeParent.getDisplay().getSystemColor(SWT.COLOR_WHITE);
|
||||
this.emptyZoneColor = ITalendThemeService.getColor("org.talend.commons.ui.BgColorForEmptyArea")
|
||||
.orElse(compositeParent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
|
||||
|
||||
}
|
||||
|
||||
@@ -669,8 +672,22 @@ public class TableViewerCreatorNotModifiable<B> {
|
||||
table.addListener(SWTFacade.Paint, paintListener);
|
||||
}
|
||||
|
||||
setBackgroundColor(backgroundColor != null ? backgroundColor : table.getDisplay().getSystemColor(SWT.COLOR_WHITE));
|
||||
setForegroundColor(foregroundColor != null ? foregroundColor : table.getDisplay().getSystemColor(SWT.COLOR_BLACK));
|
||||
Color prefBackgroundColor = backgroundColor;
|
||||
if (prefBackgroundColor == null) {
|
||||
prefBackgroundColor = ColorConstants.getTableBackgroundColor();
|
||||
if (prefBackgroundColor == null) {
|
||||
prefBackgroundColor = table.getDisplay().getSystemColor(SWT.COLOR_WHITE);
|
||||
}
|
||||
}
|
||||
Color prefForegroundColor = foregroundColor;
|
||||
if (prefForegroundColor == null) {
|
||||
prefForegroundColor = ColorConstants.getTableForegroundColor();
|
||||
if (prefForegroundColor == null) {
|
||||
prefForegroundColor = table.getDisplay().getSystemColor(SWT.COLOR_BLACK);
|
||||
}
|
||||
}
|
||||
setBackgroundColor(prefBackgroundColor);
|
||||
setForegroundColor(prefForegroundColor);
|
||||
|
||||
if (useCustomItemColoring) {
|
||||
setUseCustomItemColoring(true);
|
||||
|
||||
@@ -12,9 +12,14 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.runtime.utils;
|
||||
|
||||
import org.eclipse.jface.resource.ColorRegistry;
|
||||
import org.eclipse.jface.resource.DataFormatException;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.jface.resource.StringConverter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Device;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
|
||||
/**
|
||||
@@ -102,4 +107,16 @@ public class TalendColorPalette {
|
||||
public static final java.awt.Color TERTIARY_ORANGE_AWT = new java.awt.Color(244, 175, 128);
|
||||
|
||||
public static final java.awt.Color TERTIARY_YELLOW_AWT = new java.awt.Color(255, 217, 143);
|
||||
|
||||
public static Color convertToColor(String rgbStr) throws DataFormatException {
|
||||
ColorRegistry colorRegistry = JFaceResources.getColorRegistry();
|
||||
Color color = colorRegistry.get(rgbStr);
|
||||
if (color != null) {
|
||||
return color;
|
||||
}
|
||||
RGB rgb = StringConverter.asRGB(rgbStr);
|
||||
colorRegistry.put(rgbStr, rgb);
|
||||
return colorRegistry.get(rgbStr);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.util.Enumeration;
|
||||
import java.util.jar.JarEntry;
|
||||
import java.util.jar.JarFile;
|
||||
import java.util.jar.JarOutputStream;
|
||||
|
||||
import org.apache.tools.zip.ZipEntry;
|
||||
@@ -169,8 +170,52 @@ public class ZipFileUtils {
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
public static void unZipFileEntry(File destFile, java.util.zip.ZipFile zipFile, java.util.zip.ZipEntry entry) throws IOException {
|
||||
InputStream inputStream;
|
||||
FileOutputStream fileOut;
|
||||
if (entry.isDirectory()) {
|
||||
destFile.mkdirs();
|
||||
} else {
|
||||
File parent = destFile.getParentFile();
|
||||
if (parent != null && !parent.exists()) {
|
||||
parent.mkdirs();
|
||||
}
|
||||
|
||||
inputStream = zipFile.getInputStream(entry);
|
||||
|
||||
fileOut = new FileOutputStream(destFile);
|
||||
byte[] buf = new byte[bufSize];
|
||||
int readedBytes;
|
||||
while ((readedBytes = inputStream.read(buf)) > 0) {
|
||||
fileOut.write(buf, 0, readedBytes);
|
||||
}
|
||||
fileOut.close();
|
||||
|
||||
inputStream.close();
|
||||
}
|
||||
}
|
||||
|
||||
public void setBufSize(int bufSize) {
|
||||
ZipFileUtils.bufSize = bufSize;
|
||||
}
|
||||
|
||||
public static boolean isValidJarFile(String moduleFilePath) {
|
||||
if (moduleFilePath == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!new File(moduleFilePath).exists()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
try (JarFile zip = new JarFile(moduleFilePath)) {
|
||||
zip.getManifest();
|
||||
} catch (IOException e) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -2,12 +2,13 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Common Runtime Plug-in
|
||||
Bundle-SymbolicName: org.talend.commons.runtime;singleton:=true
|
||||
Automatic-Module-Name: org.talend.commons.runtime
|
||||
Bundle-Version: 8.8.8.qualifier
|
||||
Require-Bundle: org.apache.log4j;visibility:=reexport,
|
||||
Require-Bundle: org.apache.log4j,
|
||||
org.apache.commons.commons-beanutils,
|
||||
org.apache.commons.collections,
|
||||
org.apache.commons.httpclient,
|
||||
org.apache.commons.lang;visibility:=reexport,
|
||||
org.apache.commons.lang,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.emf.ecore.xmi,
|
||||
org.talend.libraries.apache,
|
||||
@@ -17,7 +18,11 @@ Require-Bundle: org.apache.log4j;visibility:=reexport,
|
||||
org.eclipse.core.net,
|
||||
org.eclipse.m2e.core,
|
||||
org.eclipse.m2e.maven.runtime,
|
||||
org.eclipse.core.resources
|
||||
org.eclipse.core.resources,
|
||||
org.talend.studio.studio-utils,
|
||||
org.talend.daikon,
|
||||
org.apache.commons.codec,
|
||||
org.apache.commons.lang3
|
||||
Export-Package: org.talend.commons,
|
||||
org.talend.commons.exception,
|
||||
org.talend.commons.i18n,
|
||||
|
||||
@@ -283,6 +283,7 @@
|
||||
<KEYWORD1>smallint</KEYWORD1>
|
||||
<KEYWORD1>smallmoney</KEYWORD1>
|
||||
<KEYWORD1>text</KEYWORD1>
|
||||
<KEYWORD1>TIME</KEYWORD1>
|
||||
<KEYWORD1>timestamp</KEYWORD1>
|
||||
<KEYWORD1>tinyint</KEYWORD1>
|
||||
<KEYWORD1>uniqueidentifier</KEYWORD1>
|
||||
|
||||
@@ -92,12 +92,12 @@
|
||||
<dependency>
|
||||
<groupId>xerces</groupId>
|
||||
<artifactId>xercesImpl</artifactId>
|
||||
<version>2.12.0</version>
|
||||
<version>2.12.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>ch.qos.reload4j</groupId>
|
||||
<artifactId>reload4j</artifactId>
|
||||
<version>1.2.19</version>
|
||||
<version>1.2.22</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
@@ -125,7 +125,7 @@
|
||||
<dependency>
|
||||
<groupId>com.google.guava</groupId>
|
||||
<artifactId>guava</artifactId>
|
||||
<version>30.0-jre</version>
|
||||
<version>32.0.1-jre</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<configuration>
|
||||
|
||||
@@ -36,6 +36,11 @@ public final class CommonExceptionHandler {
|
||||
Priority priority = getPriority(ex);
|
||||
process(ex, priority);
|
||||
}
|
||||
|
||||
public static void process(Throwable ex, String msg) {
|
||||
Priority priority = getPriority(ex);
|
||||
process(ex, msg, priority);
|
||||
}
|
||||
|
||||
public static void process(Throwable ex, Priority priority) {
|
||||
String message = ex.getMessage();
|
||||
@@ -43,6 +48,13 @@ public final class CommonExceptionHandler {
|
||||
log.log(priority, message, ex);
|
||||
|
||||
}
|
||||
|
||||
public static void process(Throwable ex, String msg, Priority priority) {
|
||||
String message = ex.getMessage() + ": " + msg;
|
||||
|
||||
log.log(priority, message, ex);
|
||||
|
||||
}
|
||||
|
||||
public static void log(String message) {
|
||||
log.log(Level.INFO, message);
|
||||
|
||||
@@ -0,0 +1,85 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.runtime.model.emf;
|
||||
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.StringJoiner;
|
||||
|
||||
import org.eclipse.emf.common.util.URI;
|
||||
import org.eclipse.emf.ecore.xmi.XMLHelper;
|
||||
import org.eclipse.emf.ecore.xmi.XMLResource;
|
||||
import org.eclipse.emf.ecore.xmi.XMLSave;
|
||||
import org.eclipse.emf.ecore.xmi.impl.XMISaveImpl;
|
||||
import org.eclipse.emf.ecore.xmi.impl.XMLString;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class CustomXMIResource extends TalendXMIResource {
|
||||
|
||||
public static final String ENCODING = "UTF-8"; //$NON-NLS-1$
|
||||
|
||||
CustomXMISave xmiSave;
|
||||
|
||||
public CustomXMIResource() {
|
||||
super();
|
||||
}
|
||||
|
||||
public CustomXMIResource(URI uri) {
|
||||
super(uri);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
encoding = ENCODING;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected XMLSave createXMLSave() {
|
||||
xmiSave = new CustomXMISave(createXMLHelper());
|
||||
return xmiSave;
|
||||
}
|
||||
|
||||
public String getResourceContent(Map<?, ?> options) {
|
||||
if (xmiSave == null) {
|
||||
createXMLSave();
|
||||
}
|
||||
return xmiSave.getXMLContent(this, options);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class CustomXMISave extends XMISaveImpl {
|
||||
|
||||
public CustomXMISave(XMLHelper helper) {
|
||||
super(helper);
|
||||
}
|
||||
|
||||
public String getXMLContent(XMLResource resource, Map<?, ?> options) {
|
||||
StringJoiner strJoin = new StringJoiner("");
|
||||
super.init(resource, options);
|
||||
super.traverse(resource.getContents());
|
||||
XMLString xmlString = this.doc;
|
||||
Iterator<String> iterator = xmlString.stringIterator();
|
||||
while (iterator.hasNext()) {
|
||||
String string = (String) iterator.next();
|
||||
if (string != null) {
|
||||
strJoin.add(string);
|
||||
}
|
||||
}
|
||||
return strJoin.toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.HashSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
@@ -263,4 +264,12 @@ public class EmfHelper {
|
||||
return result;
|
||||
}
|
||||
|
||||
public static String getEmfModelContent(EObject model) throws Exception {
|
||||
String content = "";
|
||||
CustomXMIResource xmiResource = new CustomXMIResource();
|
||||
xmiResource.getContents().add(model);
|
||||
content = xmiResource.getResourceContent(Collections.EMPTY_MAP);
|
||||
return content;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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 org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.FrameworkUtil;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
|
||||
public class OsgiServices {
|
||||
|
||||
public static <T> T get(Class<T> clz) {
|
||||
try {
|
||||
BundleContext bc = FrameworkUtil.getBundle(OsgiServices.class).getBundleContext();
|
||||
ServiceReference<T> serviceReference = bc.getServiceReference(clz);
|
||||
if (serviceReference != null) {
|
||||
return bc.getService(serviceReference);
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -145,7 +145,30 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
|
||||
*/
|
||||
@Override
|
||||
public ResultSet getPrimaryKeys(String catalog, String schema, String table) throws SQLException {
|
||||
return new DB2ForZosResultSet();
|
||||
ResultSet rs = super.getPrimaryKeys(catalog, schema, table);
|
||||
if (rs == null) {
|
||||
rs = new DB2ForZosResultSet();
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeDatabaseMetaData#getExportedKeys(java.lang.String, java.lang.String,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException {
|
||||
ResultSet rs = super.getExportedKeys(catalog, schema, table);
|
||||
if (rs == null) {
|
||||
if (this.metaData != null) {
|
||||
rs = this.metaData.getExportedKeys(catalog, schema, table);
|
||||
} else {
|
||||
rs = new DB2ForZosResultSet();
|
||||
}
|
||||
}
|
||||
return rs;
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -174,17 +197,6 @@ public class DB2ForZosDataBaseMetadata extends PackageFakeDatabaseMetadata {
|
||||
return tableResultSet;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.talend.commons.utils.database.FakeDatabaseMetaData#getExportedKeys(java.lang.String, java.lang.String,
|
||||
* java.lang.String)
|
||||
*/
|
||||
@Override
|
||||
public ResultSet getExportedKeys(String catalog, String schema, String table) throws SQLException {
|
||||
return new DB2ForZosResultSet();
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
|
||||
@@ -33,6 +33,7 @@ import java.util.regex.Pattern;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
|
||||
import org.eclipse.core.runtime.preferences.InstanceScope;
|
||||
import org.talend.commons.exception.CommonExceptionHandler;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.commons.runtime.utils.io.FileCopyUtils;
|
||||
|
||||
@@ -108,6 +109,7 @@ public class NetworkUtil {
|
||||
return true;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
CommonExceptionHandler.process(e, getCheckUrl());
|
||||
return false;
|
||||
} finally {
|
||||
conn.disconnect();
|
||||
@@ -120,7 +122,7 @@ public class NetworkUtil {
|
||||
if (StringUtils.isNotBlank(customUrl)) {
|
||||
return customUrl;
|
||||
} else {
|
||||
return "https://talend-update.talend.com/nexus/content/repositories/libraries/";
|
||||
return "https://talend-update.talend.com/nexus/content/groups/studio-libraries/";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -144,6 +146,7 @@ public class NetworkUtil {
|
||||
conn.setRequestMethod("HEAD"); //$NON-NLS-1$
|
||||
conn.getResponseMessage();
|
||||
} catch (Exception e) {
|
||||
CommonExceptionHandler.process(e, urlString);
|
||||
// if not reachable , will throw exception(time out/unknown host) .So if catched exception, make it a
|
||||
// invalid server
|
||||
return false;
|
||||
|
||||
@@ -96,7 +96,9 @@ public class EclipseCommandLine {
|
||||
static public final String PROP_KEY_PROFILE_ID = "eclipse.p2.profile";
|
||||
|
||||
static public final String ARG_BRANCH = "-branch";
|
||||
|
||||
|
||||
static public final String ARG_PROJECT = "-project";
|
||||
|
||||
static public final String LOGIN_ONLINE_UPDATE = "--loginOnlineUpdate";
|
||||
|
||||
static public final String ARG_TALEND_BUNDLES_CLEANED = "-talend.studio.bundles.cleaned"; //$NON-NLS-1$
|
||||
|
||||
@@ -2,6 +2,7 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Common UI Plug-in
|
||||
Bundle-SymbolicName: org.talend.commons.ui;singleton:=true
|
||||
Automatic-Module-Name: org.talend.commons.ui
|
||||
Bundle-Version: 8.8.8.qualifier
|
||||
Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.core.resources,
|
||||
@@ -10,7 +11,7 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||
org.eclipse.ui.intro,
|
||||
org.eclipse.ui.ide,
|
||||
org.eclipse.gef,
|
||||
org.eclipse.jface;visibility:=reexport,
|
||||
org.eclipse.jface,
|
||||
org.apache.log4j,
|
||||
org.apache.xalan,
|
||||
org.apache.commons.lang,
|
||||
@@ -18,9 +19,11 @@ Require-Bundle: org.eclipse.core.runtime,
|
||||
org.talend.libraries.dom4j-jaxen,
|
||||
org.talend.utils,
|
||||
org.talend.commons.runtime,
|
||||
org.talend.common.ui.runtime;visibility:=reexport,
|
||||
org.talend.libraries.ui;visibility:=reexport,
|
||||
org.eclipse.ui.workbench
|
||||
org.talend.common.ui.runtime,
|
||||
org.talend.libraries.ui,
|
||||
org.eclipse.ui.workbench,
|
||||
org.talend.studio.studio-utils,
|
||||
org.apache.commons.lang3
|
||||
Eclipse-LazyStart: true
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Export-Package: org.talend.commons.ui.command,
|
||||
|
||||
@@ -92,7 +92,7 @@ ProposalUtils.CtrlProposal.ErrorMsg=\u3053\u306E\u30BF\u30A4\u30D7\u306E\u5236\u
|
||||
RemovePushButton.RemoveButton.Tip=\u9078\u629E\u3057\u305F\u30A2\u30A4\u30C6\u30E0\u3092\u524A\u9664
|
||||
ResetDBTypesButton.ResetDBTypesButton.Tip=DB\u30BF\u30A4\u30D7\u3092\u30EA\u30BB\u30C3\u30C8
|
||||
Rule.rule=\u30EB\u30FC\u30EB[{0}]
|
||||
SaveAsGenericSchemaPushButton.saveAsSchema=\u6C4E\u7528\u30B9\u30AD\u30FC\u30DE\u3068\u3057\u3066\u4FDD\u5B58
|
||||
SaveAsGenericSchemaPushButton.saveAsSchema=\u30B8\u30A7\u30CD\u30EA\u30C3\u30AF\u30B9\u30AD\u30FC\u30DE\u3068\u3057\u3066\u4FDD\u5B58
|
||||
SelectContextVariablesPushButton.Label=\u30B3\u30F3\u30C6\u30AF\u30B9\u30C8\u5909\u6570\u3092\u9078\u629E
|
||||
SWTCalendarWithTime.contentEvening=\u5915\u65B9
|
||||
SWTCalendarWithTime.contentHr=\u6642:
|
||||
|
||||
@@ -130,11 +130,10 @@ public abstract class ExportPushButtonForExtendedTable extends ExportPushButton
|
||||
AbstractExtendedTableViewer extendedTableViewer = (AbstractExtendedTableViewer) extendedControlViewer;
|
||||
ExtendedTableModel extendedTableModel = extendedTableViewer.getExtendedTableModel();
|
||||
boolean enabled = false;
|
||||
if (extendedTableModel != null && extendedTableModel.isDataRegistered()
|
||||
&& extendedTableModel.getBeansList().size() > 0) {
|
||||
if (extendedTableModel != null && extendedTableModel.isDataRegistered() && extendedTableModel.getBeansList().size() > 0) {
|
||||
enabled = true;
|
||||
}
|
||||
return super.getEnabledState() && enabled;
|
||||
return extendedTableModel != null || enabled;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -19,6 +19,7 @@ import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.advanced.dataeditor.control.ExtendedPushButton;
|
||||
import org.talend.commons.ui.swt.extended.table.AbstractExtendedTableViewer;
|
||||
import org.talend.commons.ui.swt.extended.table.ExtendedTableModel;
|
||||
|
||||
/**
|
||||
* DOC Administrator class global comment. Detailled comment <br/>
|
||||
@@ -33,4 +34,11 @@ public abstract class SaveAsGenericSchemaPushButton extends ExtendedPushButton {
|
||||
|
||||
@Override
|
||||
protected abstract Command getCommandToExecute();
|
||||
|
||||
@Override
|
||||
public boolean getEnabledState() {
|
||||
AbstractExtendedTableViewer extendedTableViewer = (AbstractExtendedTableViewer) extendedControlViewer;
|
||||
ExtendedTableModel extendedTableModel = extendedTableViewer.getExtendedTableModel();
|
||||
return extendedTableModel != null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,12 +18,12 @@ import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.preference.PreferenceConverter;
|
||||
import org.eclipse.jface.resource.StringConverter;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.talend.commons.ui.runtime.ITalendThemeService;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.scanner.ColoringScanner;
|
||||
|
||||
/**
|
||||
@@ -33,7 +33,7 @@ import org.talend.commons.ui.swt.colorstyledtext.scanner.ColoringScanner;
|
||||
*
|
||||
*/
|
||||
public class ColorManager {
|
||||
|
||||
|
||||
public static final RGB DEFAULT_STRING_COLOR = new RGB(0, 0, 0);
|
||||
|
||||
public static final RGB DEFAULT_KEYWORD1_COLOR = new RGB(50, 32, 160);
|
||||
@@ -106,15 +106,19 @@ public class ColorManager {
|
||||
}
|
||||
|
||||
public Color getColor(String colorName) {
|
||||
RGB prefColor = PreferenceConverter.getColor(store, colorName);
|
||||
Color color = null;
|
||||
if (colorMap.containsKey(colorName) && (colorMap.get(colorName)).getRGB().equals(prefColor)) {
|
||||
color = (Color) colorMap.get(colorName);
|
||||
Color prefColor = getThemeColor(colorName);
|
||||
if (colorMap.containsKey(colorName) && (colorMap.get(colorName)).equals(prefColor)) {
|
||||
return colorMap.get(colorName);
|
||||
} else {
|
||||
color = new Color(Display.getDefault(), prefColor);
|
||||
colorMap.put(colorName, color);
|
||||
colorMap.put(colorName, prefColor);
|
||||
}
|
||||
return color;
|
||||
return prefColor;
|
||||
}
|
||||
|
||||
private static Color getThemeColor(String colorName) {
|
||||
Color c = ITalendThemeService.getColor(colorName)
|
||||
.orElse(Display.getDefault().getSystemColor(SWT.COLOR_INFO_FOREGROUND));
|
||||
return c;
|
||||
}
|
||||
|
||||
public void dispose() {
|
||||
@@ -164,20 +168,20 @@ public class ColorManager {
|
||||
}
|
||||
|
||||
public static void initDefaultColors(IPreferenceStore store) {
|
||||
store.setDefault(NULL_COLOR, StringConverter.asString(DEFAULT_STRING_COLOR));
|
||||
store.setDefault(COMMENT1_COLOR, StringConverter.asString(DEFAULT_COMMENT1_COLOR));
|
||||
store.setDefault(COMMENT2_COLOR, StringConverter.asString(DEFAULT_COMMENT2_COLOR));
|
||||
store.setDefault(LITERAL1_COLOR, StringConverter.asString(DEFAULT_LITERAL1_COLOR));
|
||||
store.setDefault(LITERAL2_COLOR, StringConverter.asString(DEFAULT_LITERAL2_COLOR));
|
||||
store.setDefault(LABEL_COLOR, StringConverter.asString(DEFAULT_LABEL_COLOR));
|
||||
store.setDefault(KEYWORD1_COLOR, StringConverter.asString(DEFAULT_KEYWORD1_COLOR));
|
||||
store.setDefault(KEYWORD2_COLOR, StringConverter.asString(DEFAULT_KEYWORD2_COLOR));
|
||||
store.setDefault(KEYWORD3_COLOR, StringConverter.asString(DEFAULT_KEYWORD3_COLOR));
|
||||
store.setDefault(FUNCTION_COLOR, StringConverter.asString(DEFAULT_FUNCTION_COLOR));
|
||||
store.setDefault(MARKUP_COLOR, StringConverter.asString(DEFAULT_MARKUP_COLOR));
|
||||
store.setDefault(OPERATOR_COLOR, StringConverter.asString(DEFAULT_OPERATOR_COLOR));
|
||||
store.setDefault(DIGIT_COLOR, StringConverter.asString(DEFAULT_DIGIT_COLOR));
|
||||
store.setDefault(INVALID_COLOR, StringConverter.asString(DEFAULT_INVALID_COLOR));
|
||||
store.setDefault(NULL_COLOR, StringConverter.asString(getThemeColor(NULL_COLOR).getRGB()));
|
||||
store.setDefault(COMMENT1_COLOR, StringConverter.asString(getThemeColor(COMMENT1_COLOR).getRGB()));
|
||||
store.setDefault(COMMENT2_COLOR, StringConverter.asString(getThemeColor(COMMENT2_COLOR).getRGB()));
|
||||
store.setDefault(LITERAL1_COLOR, StringConverter.asString(getThemeColor(LITERAL1_COLOR).getRGB()));
|
||||
store.setDefault(LITERAL2_COLOR, StringConverter.asString(getThemeColor(LITERAL2_COLOR).getRGB()));
|
||||
store.setDefault(LABEL_COLOR, StringConverter.asString(getThemeColor(LABEL_COLOR).getRGB()));
|
||||
store.setDefault(KEYWORD1_COLOR, StringConverter.asString(getThemeColor(KEYWORD1_COLOR).getRGB()));
|
||||
store.setDefault(KEYWORD2_COLOR, StringConverter.asString(getThemeColor(KEYWORD2_COLOR).getRGB()));
|
||||
store.setDefault(KEYWORD3_COLOR, StringConverter.asString(getThemeColor(KEYWORD3_COLOR).getRGB()));
|
||||
store.setDefault(FUNCTION_COLOR, StringConverter.asString(getThemeColor(FUNCTION_COLOR).getRGB()));
|
||||
store.setDefault(MARKUP_COLOR, StringConverter.asString(getThemeColor(MARKUP_COLOR).getRGB()));
|
||||
store.setDefault(OPERATOR_COLOR, StringConverter.asString(getThemeColor(OPERATOR_COLOR).getRGB()));
|
||||
store.setDefault(DIGIT_COLOR, StringConverter.asString(getThemeColor(DIGIT_COLOR).getRGB()));
|
||||
store.setDefault(INVALID_COLOR, StringConverter.asString(getThemeColor(INVALID_COLOR).getRGB()));
|
||||
|
||||
String bold = BOLD_SUFFIX;
|
||||
store.setDefault(COMMENT1_COLOR + bold, false);
|
||||
|
||||
@@ -1,368 +1,384 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 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.ui.swt.colorstyledtext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.text.rules.IToken;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ExtendedModifyEvent;
|
||||
import org.eclipse.swt.custom.ExtendedModifyListener;
|
||||
import org.eclipse.swt.custom.StyleRange;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.ui.ISharedImages;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.runtime.xml.XmlUtil;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.jedit.Mode;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.jedit.Modes;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.rules.CToken;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.scanner.ColoringScanner;
|
||||
import org.talend.commons.utils.threading.ExecutionLimiter;
|
||||
|
||||
/**
|
||||
* This component is an adaptation of a Color Editor for a StyledText.
|
||||
*
|
||||
* The original editor can be found on http://www.gstaff.org/colorEditor/ <br/>
|
||||
*
|
||||
* <b>How to use it, example :</b> <br/>
|
||||
* ColorStyledText text = new ColorStyledText(parent, SWT.H_SCROLL | SWT.V_SCROLL,
|
||||
* CorePlugin.getDefault().getPreferenceStore(), ECodeLanguage.PERL.getName());</i> <br/>
|
||||
* <br/>
|
||||
*
|
||||
* $Id: ColorStyledText.java 7183 2007-11-23 11:03:36Z amaumont $
|
||||
*
|
||||
*/
|
||||
public class ColorStyledText extends StyledText {
|
||||
|
||||
private final static int MAXIMUM_CHARACTERS_BEFORE_USE_TIMER = 1000;
|
||||
|
||||
private final ColorManager colorManager;
|
||||
|
||||
private final ColoringScanner scanner;
|
||||
|
||||
private final String languageMode;
|
||||
|
||||
private final MenuItem pasteItem;
|
||||
|
||||
private boolean coloring = true;
|
||||
|
||||
private UndoRedoManager undoRedoManager;
|
||||
|
||||
public ColorStyledText(Composite parent, int style, IPreferenceStore store, String languageMode) {
|
||||
super(parent, style);
|
||||
this.languageMode = languageMode;
|
||||
this.colorManager = new ColorManager(store);
|
||||
|
||||
/*
|
||||
* set the Shortcuts of the undo/redo
|
||||
*/
|
||||
this.setKeyBinding('Z' | SWT.CTRL, ActionCode.UNDO);
|
||||
this.setKeyBinding('Y' | SWT.CTRL, ActionCode.REDO);
|
||||
UndoRedoManager undoManager = new UndoRedoManager(50);
|
||||
undoManager.connect(this);
|
||||
this.setUndoManager(undoManager);
|
||||
|
||||
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
|
||||
Menu popupMenu = new Menu(this);
|
||||
|
||||
MenuItem redoItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
redoItem.setText(Messages.getString("ColorStyledText.RedoItem.Text")); //$NON-NLS-1$
|
||||
redoItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
redo();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem undoItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
undoItem.setText(Messages.getString("ColorStyledText.UndoItem.Text")); //$NON-NLS-1$
|
||||
undoItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
undo();
|
||||
}
|
||||
});
|
||||
|
||||
Image image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
|
||||
MenuItem copyItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
copyItem.setText(Messages.getString("ColorStyledText.CopyItem.Text")); //$NON-NLS-1$
|
||||
copyItem.setImage(image);
|
||||
copyItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
copy();
|
||||
}
|
||||
});
|
||||
|
||||
image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
|
||||
pasteItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
pasteItem.setText(Messages.getString("ColorStyledText.PasteItem.Text")); //$NON-NLS-1$
|
||||
pasteItem.setData(this);
|
||||
pasteItem.setImage(image);
|
||||
pasteItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
paste();
|
||||
}
|
||||
});
|
||||
pasteItem.setEnabled(getEditable());
|
||||
|
||||
this.setMenu(popupMenu);
|
||||
MenuItem selectAllItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
selectAllItem.setText(Messages.getString("ColorStyledText.SelectAllItem.Text")); //$NON-NLS-1$
|
||||
selectAllItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
selectAll();
|
||||
}
|
||||
});
|
||||
this.setMenu(popupMenu);
|
||||
|
||||
Listener selectAllListener = new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
if (event.character == '\u0001') { // CTRL + A
|
||||
selectAll();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
addListener(SWT.KeyDown, selectAllListener);
|
||||
|
||||
Mode mode = Modes.getMode(languageMode + XmlUtil.FILE_XML_SUFFIX);
|
||||
scanner = new ColoringScanner(mode, colorManager);
|
||||
|
||||
addExtendedModifyListener(modifyListener);
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC qli Comment method "invokeAction".
|
||||
*
|
||||
* @param action
|
||||
*
|
||||
* */
|
||||
public void invokeAction(int action) {
|
||||
super.invokeAction(action);
|
||||
|
||||
switch (action) {
|
||||
case ActionCode.UNDO:
|
||||
undo(); // ctrl+Z
|
||||
break;
|
||||
case ActionCode.REDO:
|
||||
redo(); // ctrl+Y
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for undoRedoManager.
|
||||
*
|
||||
* @return the undoRedoManager
|
||||
*/
|
||||
public UndoRedoManager getUndoManager() {
|
||||
return this.undoRedoManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the undoRedoManager.
|
||||
*
|
||||
* @param undoRedoManager the undoRedoManager to set
|
||||
*/
|
||||
public void setUndoManager(UndoRedoManager undoRedoManager) {
|
||||
this.undoRedoManager = undoRedoManager;
|
||||
}
|
||||
|
||||
public static class ActionCode {
|
||||
|
||||
public static final int UNDO = Integer.MAX_VALUE;
|
||||
|
||||
public static final int REDO = UNDO - 1;
|
||||
|
||||
}
|
||||
|
||||
private void undo() {
|
||||
if (undoRedoManager != null) {
|
||||
undoRedoManager.undo();
|
||||
}
|
||||
}
|
||||
|
||||
private void redo() {
|
||||
if (undoRedoManager != null) {
|
||||
undoRedoManager.redo();
|
||||
}
|
||||
}
|
||||
|
||||
protected void colorize(final ColoringScanner scanner) {
|
||||
final ArrayList<StyleRange> styles = new ArrayList<StyleRange>();
|
||||
if (this.coloring) {
|
||||
IToken token;
|
||||
if (this.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
scanner.parse(this.getText().replaceAll("\"", " ").replaceAll("'", " ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
|
||||
do {
|
||||
token = scanner.nextToken();
|
||||
if (!token.isEOF()) {
|
||||
if (token instanceof CToken) {
|
||||
CToken ctoken = (CToken) token;
|
||||
StyleRange styleRange;
|
||||
styleRange = new StyleRange();
|
||||
styleRange.start = scanner.getTokenOffset();
|
||||
styleRange.length = scanner.getTokenLength();
|
||||
if (ctoken.getType() == null) {
|
||||
styleRange.fontStyle = colorManager.getStyleFor(ctoken.getColor());
|
||||
styleRange.foreground = colorManager.getColor(ctoken.getColor());
|
||||
} else {
|
||||
styleRange.fontStyle = colorManager.getStyleForType(ctoken.getColor());
|
||||
styleRange.foreground = colorManager.getColorForType(ctoken.getColor());
|
||||
}
|
||||
styles.add(styleRange);
|
||||
}
|
||||
}
|
||||
} while (!token.isEOF());
|
||||
setStyles(styles);
|
||||
} else {
|
||||
StyleRange styleRange = new StyleRange();
|
||||
styles.add(styleRange);
|
||||
styleRange.start = 0;
|
||||
styleRange.length = this.getText().getBytes().length;
|
||||
styleRange.foreground = null;
|
||||
setStyles(styles);
|
||||
}
|
||||
}
|
||||
|
||||
public void setStyles(final ArrayList<StyleRange> styles) {
|
||||
if (ColorStyledText.this.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
int countChars = getCharCount();
|
||||
|
||||
for (int i = 0; i < styles.size(); i++) {
|
||||
StyleRange styleRange = styles.get(i);
|
||||
// System.out.println("styleRange.start=" + styleRange.start);
|
||||
// System.out.println("styleRange.length=" + styleRange.length);
|
||||
if (!(0 <= styleRange.start && styleRange.start + styleRange.length <= countChars)) {
|
||||
continue;
|
||||
}
|
||||
setStyleRange(styleRange);
|
||||
}
|
||||
}
|
||||
|
||||
ExtendedModifyListener modifyListener = new ExtendedModifyListener() {
|
||||
|
||||
public void modifyText(ExtendedModifyEvent event) {
|
||||
if (ColorStyledText.this.getCharCount() > MAXIMUM_CHARACTERS_BEFORE_USE_TIMER) {
|
||||
colorizeLimiter.resetTimer();
|
||||
colorizeLimiter.startIfExecutable(true, null);
|
||||
} else {
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
colorize(scanner);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public ColorManager getColorManager() {
|
||||
return this.colorManager;
|
||||
}
|
||||
|
||||
public String getLanguageMode() {
|
||||
return this.languageMode;
|
||||
}
|
||||
|
||||
public ColoringScanner getScanner() {
|
||||
return this.scanner;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.swt.custom.StyledText#setEditable(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setEditable(boolean editable) {
|
||||
super.setEditable(editable);
|
||||
if (pasteItem != null) {
|
||||
pasteItem.setEnabled(editable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for coloring.
|
||||
*
|
||||
* @return the coloring
|
||||
*/
|
||||
public boolean isColoring() {
|
||||
return this.coloring;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the coloring.
|
||||
*
|
||||
* @param coloring the coloring to set
|
||||
*/
|
||||
public void setColoring(boolean coloring) {
|
||||
boolean wasDifferent = this.coloring != coloring;
|
||||
this.coloring = coloring;
|
||||
if (!coloring) {
|
||||
removeExtendedModifyListener(modifyListener);
|
||||
} else if (wasDifferent) {
|
||||
colorizeLimiter.resetTimer();
|
||||
colorizeLimiter.startIfExecutable(true, null);
|
||||
addExtendedModifyListener(modifyListener);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.swt.widgets.Widget#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
colorManager.dispose();
|
||||
}
|
||||
|
||||
private final ExecutionLimiter colorizeLimiter = new ExecutionLimiter(1000, true) {
|
||||
|
||||
@Override
|
||||
public void execute(final boolean isFinalExecution, Object data) {
|
||||
if (!isDisposed()) {
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
colorize(scanner);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 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.ui.swt.colorstyledtext;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
import org.eclipse.jface.preference.IPreferenceStore;
|
||||
import org.eclipse.jface.text.rules.IToken;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.custom.ExtendedModifyEvent;
|
||||
import org.eclipse.swt.custom.ExtendedModifyListener;
|
||||
import org.eclipse.swt.custom.StyleRange;
|
||||
import org.eclipse.swt.custom.StyledText;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Menu;
|
||||
import org.eclipse.swt.widgets.MenuItem;
|
||||
import org.eclipse.ui.ISharedImages;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.talend.commons.runtime.xml.XmlUtil;
|
||||
import org.talend.commons.ui.runtime.ITalendThemeService;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.image.ImageProvider;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.jedit.Mode;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.jedit.Modes;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.rules.CToken;
|
||||
import org.talend.commons.ui.swt.colorstyledtext.scanner.ColoringScanner;
|
||||
import org.talend.commons.utils.threading.ExecutionLimiter;
|
||||
|
||||
/**
|
||||
* This component is an adaptation of a Color Editor for a StyledText.
|
||||
*
|
||||
* The original editor can be found on http://www.gstaff.org/colorEditor/ <br/>
|
||||
*
|
||||
* <b>How to use it, example :</b> <br/>
|
||||
* ColorStyledText text = new ColorStyledText(parent, SWT.H_SCROLL | SWT.V_SCROLL,
|
||||
* CorePlugin.getDefault().getPreferenceStore(), ECodeLanguage.PERL.getName());</i> <br/>
|
||||
* <br/>
|
||||
*
|
||||
* $Id: ColorStyledText.java 7183 2007-11-23 11:03:36Z amaumont $
|
||||
*
|
||||
*/
|
||||
public class ColorStyledText extends StyledText {
|
||||
|
||||
|
||||
public static final String PREFERENCE_COLOR_FOREGROUND= "ColorStyledText.Color.Foreground"; //$NON-NLS-1$
|
||||
public static final String PREFERENCE_COLOR_BACKGROUND= "ColorStyledText.Color.Background"; //$NON-NLS-1$
|
||||
public static final String PREFERENCE_COLOR_SELECTION_FOREGROUND= "ColorStyledText.Color.SelectionForeground"; //$NON-NLS-1$
|
||||
public static final String PREFERENCE_COLOR_SELECTION_BACKGROUND= "ColorStyledText.Color.SelectionBackground"; //$NON-NLS-1$
|
||||
|
||||
private final static int MAXIMUM_CHARACTERS_BEFORE_USE_TIMER = 1000;
|
||||
|
||||
private final ColorManager colorManager;
|
||||
|
||||
private final ColoringScanner scanner;
|
||||
|
||||
private final String languageMode;
|
||||
|
||||
private final MenuItem pasteItem;
|
||||
|
||||
private boolean coloring = true;
|
||||
|
||||
private UndoRedoManager undoRedoManager;
|
||||
|
||||
public ColorStyledText(Composite parent, int style, IPreferenceStore store, String languageMode) {
|
||||
super(parent, style);
|
||||
this.languageMode = languageMode;
|
||||
this.colorManager = new ColorManager(store);
|
||||
|
||||
/*
|
||||
* set the Shortcuts of the undo/redo
|
||||
*/
|
||||
this.setKeyBinding('Z' | SWT.CTRL, ActionCode.UNDO);
|
||||
this.setKeyBinding('Y' | SWT.CTRL, ActionCode.REDO);
|
||||
UndoRedoManager undoManager = new UndoRedoManager(50);
|
||||
undoManager.connect(this);
|
||||
this.setUndoManager(undoManager);
|
||||
|
||||
ISharedImages sharedImages = PlatformUI.getWorkbench().getSharedImages();
|
||||
Menu popupMenu = new Menu(this);
|
||||
|
||||
MenuItem redoItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
redoItem.setText(Messages.getString("ColorStyledText.RedoItem.Text")); //$NON-NLS-1$
|
||||
redoItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
redo();
|
||||
}
|
||||
});
|
||||
|
||||
MenuItem undoItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
undoItem.setText(Messages.getString("ColorStyledText.UndoItem.Text")); //$NON-NLS-1$
|
||||
undoItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
undo();
|
||||
}
|
||||
});
|
||||
|
||||
Image image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_COPY));
|
||||
MenuItem copyItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
copyItem.setText(Messages.getString("ColorStyledText.CopyItem.Text")); //$NON-NLS-1$
|
||||
copyItem.setImage(image);
|
||||
copyItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
copy();
|
||||
}
|
||||
});
|
||||
|
||||
image = ImageProvider.getImage(sharedImages.getImageDescriptor(ISharedImages.IMG_TOOL_PASTE));
|
||||
pasteItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
pasteItem.setText(Messages.getString("ColorStyledText.PasteItem.Text")); //$NON-NLS-1$
|
||||
pasteItem.setData(this);
|
||||
pasteItem.setImage(image);
|
||||
pasteItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
paste();
|
||||
}
|
||||
});
|
||||
pasteItem.setEnabled(getEditable());
|
||||
|
||||
this.setMenu(popupMenu);
|
||||
MenuItem selectAllItem = new MenuItem(popupMenu, SWT.PUSH);
|
||||
selectAllItem.setText(Messages.getString("ColorStyledText.SelectAllItem.Text")); //$NON-NLS-1$
|
||||
selectAllItem.addListener(SWT.Selection, new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
selectAll();
|
||||
}
|
||||
});
|
||||
this.setMenu(popupMenu);
|
||||
|
||||
Listener selectAllListener = new Listener() {
|
||||
|
||||
public void handleEvent(Event event) {
|
||||
if (event.character == '\u0001') { // CTRL + A
|
||||
selectAll();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
addListener(SWT.KeyDown, selectAllListener);
|
||||
|
||||
Mode mode = Modes.getMode(languageMode + XmlUtil.FILE_XML_SUFFIX);
|
||||
scanner = new ColoringScanner(mode, colorManager);
|
||||
|
||||
addExtendedModifyListener(modifyListener);
|
||||
initColorSetting();
|
||||
}
|
||||
|
||||
|
||||
protected void initColorSetting() {
|
||||
this.setForeground(ITalendThemeService.getColor(PREFERENCE_COLOR_FOREGROUND).orElse(null));
|
||||
this.setBackground(ITalendThemeService.getColor(PREFERENCE_COLOR_BACKGROUND).orElse(null));
|
||||
this.setSelectionBackground(ITalendThemeService.getColor(PREFERENCE_COLOR_SELECTION_BACKGROUND).orElse(null));
|
||||
this.setSelectionForeground(ITalendThemeService.getColor(PREFERENCE_COLOR_SELECTION_FOREGROUND).orElse(null));
|
||||
}
|
||||
|
||||
/**
|
||||
* DOC qli Comment method "invokeAction".
|
||||
*
|
||||
* @param action
|
||||
*
|
||||
* */
|
||||
public void invokeAction(int action) {
|
||||
super.invokeAction(action);
|
||||
|
||||
switch (action) {
|
||||
case ActionCode.UNDO:
|
||||
undo(); // ctrl+Z
|
||||
break;
|
||||
case ActionCode.REDO:
|
||||
redo(); // ctrl+Y
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for undoRedoManager.
|
||||
*
|
||||
* @return the undoRedoManager
|
||||
*/
|
||||
public UndoRedoManager getUndoManager() {
|
||||
return this.undoRedoManager;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the undoRedoManager.
|
||||
*
|
||||
* @param undoRedoManager the undoRedoManager to set
|
||||
*/
|
||||
public void setUndoManager(UndoRedoManager undoRedoManager) {
|
||||
this.undoRedoManager = undoRedoManager;
|
||||
}
|
||||
|
||||
public static class ActionCode {
|
||||
|
||||
public static final int UNDO = Integer.MAX_VALUE;
|
||||
|
||||
public static final int REDO = UNDO - 1;
|
||||
|
||||
}
|
||||
|
||||
private void undo() {
|
||||
if (undoRedoManager != null) {
|
||||
undoRedoManager.undo();
|
||||
}
|
||||
}
|
||||
|
||||
private void redo() {
|
||||
if (undoRedoManager != null) {
|
||||
undoRedoManager.redo();
|
||||
}
|
||||
}
|
||||
|
||||
protected void colorize(final ColoringScanner scanner) {
|
||||
final ArrayList<StyleRange> styles = new ArrayList<StyleRange>();
|
||||
if (this.coloring) {
|
||||
IToken token;
|
||||
if (this.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
|
||||
scanner.parse(this.getText().replaceAll("\"", " ").replaceAll("'", " ")); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$
|
||||
|
||||
do {
|
||||
token = scanner.nextToken();
|
||||
if (!token.isEOF()) {
|
||||
if (token instanceof CToken) {
|
||||
CToken ctoken = (CToken) token;
|
||||
StyleRange styleRange;
|
||||
styleRange = new StyleRange();
|
||||
styleRange.start = scanner.getTokenOffset();
|
||||
styleRange.length = scanner.getTokenLength();
|
||||
if (ctoken.getType() == null) {
|
||||
styleRange.fontStyle = colorManager.getStyleFor(ctoken.getColor());
|
||||
styleRange.foreground = colorManager.getColor(ctoken.getColor());
|
||||
} else {
|
||||
styleRange.fontStyle = colorManager.getStyleForType(ctoken.getColor());
|
||||
styleRange.foreground = colorManager.getColorForType(ctoken.getColor());
|
||||
}
|
||||
styles.add(styleRange);
|
||||
}
|
||||
}
|
||||
} while (!token.isEOF());
|
||||
setStyles(styles);
|
||||
} else {
|
||||
StyleRange styleRange = new StyleRange();
|
||||
styles.add(styleRange);
|
||||
styleRange.start = 0;
|
||||
styleRange.length = this.getText().getBytes().length;
|
||||
styleRange.foreground = null;
|
||||
setStyles(styles);
|
||||
}
|
||||
}
|
||||
|
||||
public void setStyles(final ArrayList<StyleRange> styles) {
|
||||
if (ColorStyledText.this.isDisposed()) {
|
||||
return;
|
||||
}
|
||||
int countChars = getCharCount();
|
||||
|
||||
for (int i = 0; i < styles.size(); i++) {
|
||||
StyleRange styleRange = styles.get(i);
|
||||
// System.out.println("styleRange.start=" + styleRange.start);
|
||||
// System.out.println("styleRange.length=" + styleRange.length);
|
||||
if (!(0 <= styleRange.start && styleRange.start + styleRange.length <= countChars)) {
|
||||
continue;
|
||||
}
|
||||
setStyleRange(styleRange);
|
||||
}
|
||||
}
|
||||
|
||||
ExtendedModifyListener modifyListener = new ExtendedModifyListener() {
|
||||
|
||||
public void modifyText(ExtendedModifyEvent event) {
|
||||
if (ColorStyledText.this.getCharCount() > MAXIMUM_CHARACTERS_BEFORE_USE_TIMER) {
|
||||
colorizeLimiter.resetTimer();
|
||||
colorizeLimiter.startIfExecutable(true, null);
|
||||
} else {
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
colorize(scanner);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public ColorManager getColorManager() {
|
||||
return this.colorManager;
|
||||
}
|
||||
|
||||
public String getLanguageMode() {
|
||||
return this.languageMode;
|
||||
}
|
||||
|
||||
public ColoringScanner getScanner() {
|
||||
return this.scanner;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.swt.custom.StyledText#setEditable(boolean)
|
||||
*/
|
||||
@Override
|
||||
public void setEditable(boolean editable) {
|
||||
super.setEditable(editable);
|
||||
if (pasteItem != null) {
|
||||
pasteItem.setEnabled(editable);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Getter for coloring.
|
||||
*
|
||||
* @return the coloring
|
||||
*/
|
||||
public boolean isColoring() {
|
||||
return this.coloring;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the coloring.
|
||||
*
|
||||
* @param coloring the coloring to set
|
||||
*/
|
||||
public void setColoring(boolean coloring) {
|
||||
boolean wasDifferent = this.coloring != coloring;
|
||||
this.coloring = coloring;
|
||||
if (!coloring) {
|
||||
removeExtendedModifyListener(modifyListener);
|
||||
} else if (wasDifferent) {
|
||||
colorizeLimiter.resetTimer();
|
||||
colorizeLimiter.startIfExecutable(true, null);
|
||||
addExtendedModifyListener(modifyListener);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
* @see org.eclipse.swt.widgets.Widget#dispose()
|
||||
*/
|
||||
@Override
|
||||
public void dispose() {
|
||||
super.dispose();
|
||||
colorManager.dispose();
|
||||
}
|
||||
|
||||
private final ExecutionLimiter colorizeLimiter = new ExecutionLimiter(1000, true) {
|
||||
|
||||
@Override
|
||||
public void execute(final boolean isFinalExecution, Object data) {
|
||||
if (!isDisposed()) {
|
||||
getDisplay().asyncExec(new Runnable() {
|
||||
|
||||
public void run() {
|
||||
colorize(scanner);
|
||||
}
|
||||
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
// ============================================================================
|
||||
package org.talend.commons.ui.swt.dialogs;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.talend.commons.ui.utils.image.ColorUtils;
|
||||
@@ -29,5 +31,7 @@ public interface IConfigModuleDialog {
|
||||
public String getMavenURI();
|
||||
|
||||
public int open();
|
||||
|
||||
public Map<String, String> getModulesMVNUrls();
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2023 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.ui.swt.dialogs;
|
||||
|
||||
import org.talend.commons.ui.runtime.custom.AbsBusinessHandler;
|
||||
import org.talend.commons.ui.swt.dialogs.ModelSelectionDialog.EEditSelection;
|
||||
import org.talend.commons.ui.swt.dialogs.ModelSelectionDialog.ESelectionType;
|
||||
|
||||
/**
|
||||
* DOC cmeng class global comment. Detailled comment
|
||||
*/
|
||||
public class ModelSelectionBusinessHandler extends AbsBusinessHandler {
|
||||
|
||||
private static final String UI_KEY = "ModelSelectionDialog";
|
||||
|
||||
private ESelectionType selectionType;
|
||||
|
||||
private boolean isReadOnly;
|
||||
|
||||
private EEditSelection optionValue;
|
||||
|
||||
public ModelSelectionBusinessHandler(ESelectionType selectionType, boolean isReadOnly) {
|
||||
this.selectionType = selectionType;
|
||||
this.isReadOnly = isReadOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUiKey() {
|
||||
return UI_KEY;
|
||||
}
|
||||
|
||||
public ESelectionType getSelectionType() {
|
||||
return selectionType;
|
||||
}
|
||||
|
||||
public void setSelectionType(ESelectionType selectionType) {
|
||||
this.selectionType = selectionType;
|
||||
}
|
||||
|
||||
public boolean isReadOnly() {
|
||||
return isReadOnly;
|
||||
}
|
||||
|
||||
public void setReadOnly(boolean isReadOnly) {
|
||||
this.isReadOnly = isReadOnly;
|
||||
}
|
||||
|
||||
public EEditSelection getOptionValue() {
|
||||
return this.optionValue;
|
||||
}
|
||||
|
||||
public void setOptionValue(EEditSelection optionValue) {
|
||||
this.optionValue = optionValue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -62,6 +62,10 @@ public class ModelSelectionDialog extends SelectionDialog {
|
||||
this(parentShell, selectionType, false);
|
||||
}
|
||||
|
||||
public ModelSelectionDialog(ModelSelectionBusinessHandler handler, Shell parentShell) {
|
||||
this(parentShell, handler.getSelectionType(), handler.isReadOnly());
|
||||
}
|
||||
|
||||
public ModelSelectionDialog(Shell parentShell, ESelectionType selectionType, boolean isReadOnly) {
|
||||
super(parentShell);
|
||||
setHelpAvailable(false);
|
||||
|
||||
@@ -20,12 +20,14 @@ import org.eclipse.jface.viewers.TableViewer;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.events.DisposeEvent;
|
||||
import org.eclipse.swt.events.DisposeListener;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.layout.GridData;
|
||||
import org.eclipse.swt.layout.RowLayout;
|
||||
import org.eclipse.swt.widgets.Composite;
|
||||
import org.eclipse.swt.widgets.Event;
|
||||
import org.eclipse.swt.widgets.Listener;
|
||||
import org.eclipse.swt.widgets.Table;
|
||||
import org.talend.commons.ui.runtime.ITalendThemeService;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.TableViewerCreatorNotModifiable.LAYOUT_MODE;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.selection.ILineSelectionListener;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.selection.LineSelectionEvent;
|
||||
@@ -156,6 +158,7 @@ public abstract class AbstractExtendedTableViewer<B> extends AbstractExtendedCon
|
||||
final Table table = getTableViewerCreator().getTable();
|
||||
final ILineSelectionListener beforeLineSelectionListener = new ILineSelectionListener() {
|
||||
|
||||
@Override
|
||||
public void handle(LineSelectionEvent e) {
|
||||
if (e.selectionByMethod && !selectionHelper.isMouseSelectionning() && !forceExecuteSelectionEvent) {
|
||||
executeSelectionEvent = false;
|
||||
@@ -166,6 +169,7 @@ public abstract class AbstractExtendedTableViewer<B> extends AbstractExtendedCon
|
||||
};
|
||||
final ILineSelectionListener afterLineSelectionListener = new ILineSelectionListener() {
|
||||
|
||||
@Override
|
||||
public void handle(LineSelectionEvent e) {
|
||||
executeSelectionEvent = true;
|
||||
}
|
||||
@@ -175,6 +179,7 @@ public abstract class AbstractExtendedTableViewer<B> extends AbstractExtendedCon
|
||||
|
||||
DisposeListener disposeListener = new DisposeListener() {
|
||||
|
||||
@Override
|
||||
public void widgetDisposed(DisposeEvent e) {
|
||||
selectionHelper.removeBeforeSelectionListener(beforeLineSelectionListener);
|
||||
selectionHelper.removeAfterSelectionListener(afterLineSelectionListener);
|
||||
@@ -185,6 +190,7 @@ public abstract class AbstractExtendedTableViewer<B> extends AbstractExtendedCon
|
||||
|
||||
table.addListener(SWT.KeyUp, new Listener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(Event event) {
|
||||
|
||||
if (event.character == '\u0001') { // CTRL + A
|
||||
@@ -251,7 +257,9 @@ public abstract class AbstractExtendedTableViewer<B> extends AbstractExtendedCon
|
||||
newTableViewerCreator.setLazyLoad(TableViewerCreator.getRecommandLazyLoad());
|
||||
newTableViewerCreator.setFirstVisibleColumnIsSelection(false);
|
||||
newTableViewerCreator.setCheckboxInFirstColumn(false);
|
||||
newTableViewerCreator.setBgColorForEmptyArea(getParentComposite().getDisplay().getSystemColor(SWT.COLOR_WHITE));
|
||||
Color bgColorForEmptyArea = ITalendThemeService.getColor("org.talend.commons.ui.BgColorForEmptyArea")
|
||||
.orElse(getParentComposite().getDisplay().getSystemColor(SWT.COLOR_WHITE));
|
||||
newTableViewerCreator.setBgColorForEmptyArea(bgColorForEmptyArea);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -271,6 +279,7 @@ public abstract class AbstractExtendedTableViewer<B> extends AbstractExtendedCon
|
||||
|
||||
getExtendedTableModel().addBeforeOperationListListener(1, new IListenableListListener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(ListenableListEvent event) {
|
||||
handleBeforeListenableListOperationEvent(event);
|
||||
}
|
||||
@@ -279,6 +288,7 @@ public abstract class AbstractExtendedTableViewer<B> extends AbstractExtendedCon
|
||||
|
||||
getExtendedTableModel().addAfterOperationListListener(1, new IListenableListListener() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(ListenableListEvent event) {
|
||||
handleAfterListenableListOperationEvent(event);
|
||||
}
|
||||
@@ -287,6 +297,7 @@ public abstract class AbstractExtendedTableViewer<B> extends AbstractExtendedCon
|
||||
|
||||
getExtendedTableModel().addAfterOperationListListener(100, new IListenableListListener<B>() {
|
||||
|
||||
@Override
|
||||
public void handleEvent(ListenableListEvent<B> event) {
|
||||
if (tableViewerCreator.getTable() != null && !tableViewerCreator.getTable().isDisposed()) {
|
||||
// tableViewerCreator.getTable().forceFocus();
|
||||
@@ -368,6 +379,7 @@ public abstract class AbstractExtendedTableViewer<B> extends AbstractExtendedCon
|
||||
tableViewerCreator.setInputList(getBeansList());
|
||||
new AsynchronousThreading(100, true, tableViewerCreator.getTable().getDisplay(), new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
tableViewerCreator.layout();
|
||||
}
|
||||
|
||||
@@ -16,8 +16,10 @@ import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.jface.viewers.ICellEditorListener;
|
||||
import org.eclipse.jface.viewers.TextCellEditor;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Point;
|
||||
import org.eclipse.swt.widgets.Text;
|
||||
import org.talend.commons.ui.runtime.ColorConstants;
|
||||
import org.talend.commons.ui.runtime.i18n.Messages;
|
||||
import org.talend.commons.ui.runtime.swt.tableviewer.data.ModifiedObjectInfo;
|
||||
import org.talend.commons.ui.runtime.thread.AsynchronousThreading;
|
||||
@@ -39,6 +41,8 @@ public abstract class DialogErrorForCellEditorListener implements ICellEditorLis
|
||||
protected TableViewerCreatorColumn column;
|
||||
|
||||
protected TableViewerCreator tableViewerCreator;
|
||||
|
||||
private Color tableBackground = ColorConstants.getTableBackgroundColor();
|
||||
|
||||
/**
|
||||
* DOC amaumont CellEditorListener constructor comment.
|
||||
@@ -89,7 +93,7 @@ public abstract class DialogErrorForCellEditorListener implements ICellEditorLis
|
||||
final String errorMessage = validateValue(newValue, beanPosition);
|
||||
if (errorMessage == null) {
|
||||
newValidValueTyped(beanPosition, lastValidValue, newValue, state);
|
||||
text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_WHITE));
|
||||
text.setBackground(tableBackground);
|
||||
lastValidValue = newValue;
|
||||
} else {
|
||||
text.setBackground(text.getDisplay().getSystemColor(SWT.COLOR_RED));
|
||||
|
||||
@@ -31,6 +31,7 @@ import org.eclipse.swt.graphics.GC;
|
||||
import org.eclipse.swt.graphics.RGB;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.talend.commons.ui.gmf.util.DisplayUtils;
|
||||
import org.talend.commons.ui.runtime.ITalendThemeService;
|
||||
|
||||
/**
|
||||
* Figure managing some simple HTML styles. <br/>
|
||||
@@ -77,6 +78,8 @@ public class SimpleHtmlFigure extends Figure {
|
||||
private static Font boldFont = null;
|
||||
|
||||
private static Font boldItalicFont = null;
|
||||
|
||||
private static final Color DEFAULT_LABEL_COLOR = ITalendThemeService.getColor("NODE_FIGURE_LABEL_FORCEGROUND").orElse(Display.getDefault().getSystemColor(SWT.COLOR_BLACK));
|
||||
|
||||
/**
|
||||
* Constructs a new SimpleHtmlFigure.
|
||||
@@ -262,6 +265,8 @@ public class SimpleHtmlFigure extends Figure {
|
||||
label.setFont(fontToUse);
|
||||
if (colorStack.size() > 0) {
|
||||
label.setForegroundColor(colorStack.get(colorStack.size() - 1));
|
||||
} else {
|
||||
label.setForegroundColor(DEFAULT_LABEL_COLOR); // Set label default foreground color
|
||||
}
|
||||
horizContainer.add(label);
|
||||
}
|
||||
|
||||
@@ -15,8 +15,26 @@ Require-Bundle: org.eclipse.ui,
|
||||
org.talend.libraries.apache,
|
||||
org.eclipse.osgi.services,
|
||||
org.eclipse.ui.navigator,
|
||||
org.eclipse.e4.ui.css.swt.theme,
|
||||
org.talend.libraries.jackson
|
||||
org.talend.libraries.jackson,
|
||||
org.eclipse.emf.ecore,
|
||||
org.talend.commons.runtime,
|
||||
org.eclipse.equinox.common,
|
||||
org.eclipse.core.jobs,
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.osgi,
|
||||
org.eclipse.emf.ecore.xmi,
|
||||
org.eclipse.equinox.registry,
|
||||
org.talend.common.ui.runtime,
|
||||
org.talend.cwm.mip,
|
||||
org.eclipse.swt,
|
||||
org.talend.studio.studio-utils,
|
||||
org.eclipse.core.runtime,
|
||||
org.eclipse.gmf.runtime.notation,
|
||||
org.talend.utils,
|
||||
org.apache.commons.lang3,
|
||||
com.fasterxml.jackson.core.jackson-annotations,
|
||||
com.fasterxml.jackson.core.jackson-core,
|
||||
com.fasterxml.jackson.core.jackson-databind
|
||||
Export-Package: org.talend.core.repository,
|
||||
org.talend.core.repository.constants,
|
||||
org.talend.core.repository.document,
|
||||
|
||||
@@ -285,6 +285,30 @@
|
||||
type="INFORMIX">
|
||||
</DBType>
|
||||
</RepositoryComponent>
|
||||
<RepositoryComponent
|
||||
name="INGRES"
|
||||
withSchema="true"
|
||||
input="tIngresInput"
|
||||
output="tIngresOutput">
|
||||
<Item
|
||||
clazz="org.talend.core.model.properties.DatabaseConnectionItem">
|
||||
</Item>
|
||||
<DBType
|
||||
type="INGRES">
|
||||
</DBType>
|
||||
</RepositoryComponent>
|
||||
<RepositoryComponent
|
||||
name="VECTORWISE"
|
||||
withSchema="true"
|
||||
input="tVectorWiseInput"
|
||||
output="tVectorWiseOutput">
|
||||
<Item
|
||||
clazz="org.talend.core.model.properties.DatabaseConnectionItem">
|
||||
</Item>
|
||||
<DBType
|
||||
type="VECTORWISE">
|
||||
</DBType>
|
||||
</RepositoryComponent>
|
||||
<RepositoryComponent
|
||||
name="JAVADB"
|
||||
withSchema="true"
|
||||
|
||||
@@ -19,6 +19,8 @@ import org.talend.repository.model.RepositoryConstants;
|
||||
*/
|
||||
public interface FileConstants {
|
||||
|
||||
String DOT = ".";
|
||||
|
||||
String OLD_TALEND_PROJECT_FILENAME = "talendProject"; //$NON-NLS-1$
|
||||
|
||||
String LOCAL_PROJECT_FILENAME = "talend.project"; //$NON-NLS-1$
|
||||
@@ -112,5 +114,4 @@ public interface FileConstants {
|
||||
String TALEND_FOLDER_NAME = "TALEND-INF"; //$NON-NLS-1$
|
||||
|
||||
String MAVEN_FOLDER_NAME = "MAVEN-INF";
|
||||
|
||||
}
|
||||
|
||||
@@ -156,6 +156,7 @@ ProjectRepositoryNode.invalidItem=Invalid item
|
||||
ProjectRepositoryNode.columns=Columns
|
||||
ProjectRepositoryNode.validationRules=Validation Rules
|
||||
ProjectRepositoryNode.cdcFoundation=CDC Foundation
|
||||
ProjectRepositoryNode.cdcFoundation.deprecated=CDC Foundation (deprecated)
|
||||
ProjectRepositoryNode.genericSchema=Generic schemas
|
||||
ProjectRepositoryNode.queries=Queries
|
||||
ProjectRepositoryNode.synonymSchemas=Synonym schemas
|
||||
@@ -175,6 +176,7 @@ ProjectRepositoryNode.sapBWDataStoreObject=SAP DSO
|
||||
ProjectRepositoryNode.sapBWInfoCube=SAP InfoCube
|
||||
ProjectRepositoryNode.sapBWInfoObject=SAP InfoObject
|
||||
ProjectRepositoryNode.sapContentExtractor=SAP BI Content Extractor
|
||||
ProjectRepositoryNode.sapCDSView=SAP CDS View
|
||||
RepositoryDropAdapter_copyingItems=Copying items...
|
||||
RepositoryDropAdapter_errorMsg=This directory contains the locked item,it can not be moved now
|
||||
RepositoryDropAdapter_lockedByOthers=This item is locked by other users, it can not be moved now.
|
||||
@@ -204,3 +206,4 @@ RenameFolderAction.warning.cannotFind.title=Action not available
|
||||
ConvertJobsUtil.warning.title=Warning
|
||||
ConvertJobsUtil.warning.message=The target framework is not fully supported for this release.
|
||||
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=Create stats log and implicit parameters
|
||||
WizardPageAPIDefinition_operationIdMissing=API is missing operationIds. operationIds are used to initialize tRESTRequest/cRest output flows. See tRESTRequest/cRest online help.
|
||||
|
||||
@@ -156,6 +156,7 @@ ProjectRepositoryNode.invalidItem=\u00C9l\u00E9ment invalide
|
||||
ProjectRepositoryNode.columns=Colonnes
|
||||
ProjectRepositoryNode.validationRules=R\u00E8gles de validation
|
||||
ProjectRepositoryNode.cdcFoundation=Fondation CDC
|
||||
ProjectRepositoryNode.cdcFoundation.deprecated=CDC Foundation (d\u00E9pr\u00E9ci\u00E9)
|
||||
ProjectRepositoryNode.genericSchema=Sch\u00E9mas g\u00E9n\u00E9riques
|
||||
ProjectRepositoryNode.queries=Requ\u00EAtes
|
||||
ProjectRepositoryNode.synonymSchemas=Sch\u00E9mas synonymes
|
||||
@@ -175,6 +176,7 @@ ProjectRepositoryNode.sapBWDataStoreObject=Objet Data Store SAP
|
||||
ProjectRepositoryNode.sapBWInfoCube=InfoCube SAP
|
||||
ProjectRepositoryNode.sapBWInfoObject=InfoObject SAP
|
||||
ProjectRepositoryNode.sapContentExtractor=Extracteur SAP BI Content
|
||||
ProjectRepositoryNode.sapCDSView=Vue SAP CDS
|
||||
RepositoryDropAdapter_copyingItems=Copie des \u00E9l\u00E9ments...
|
||||
RepositoryDropAdapter_errorMsg=Ce r\u00E9pertoire contient l'\u00E9l\u00E9ment verrouill\u00E9, il ne peut \u00EAtre d\u00E9plac\u00E9
|
||||
RepositoryDropAdapter_lockedByOthers=Cet \u00E9l\u00E9ment est verrouill\u00E9 par d'autres utilisateurs, impossible de le d\u00E9placer.
|
||||
@@ -204,3 +206,4 @@ RenameFolderAction.warning.cannotFind.title=Action non disponible
|
||||
ConvertJobsUtil.warning.title=Avertissement
|
||||
ConvertJobsUtil.warning.message=Le framework cible n'est pas totalement support\u00E9 dans cette version.
|
||||
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=Cr\u00E9er des logs de stat et des param\u00E8tres implicites.
|
||||
WizardPageAPIDefinition_operationIdMissing=Des operationIds manquent dans l'API. Ces operationIds sont utilis\u00E9s pour initialiser les flux de sortie du tRESTRequest/cRest. Consultez l'aide en ligne des composants tRESTRequest/cRest.
|
||||
|
||||
@@ -56,7 +56,7 @@ PropertiesWizardPage.Locker=\u30ED\u30C3\u30AF\u4FDD\u6301\u8005
|
||||
PropertiesWizardPage.Description=\u8AAC\u660E
|
||||
PropertiesWizardPage.EmptyDescWarning=\u8AAC\u660E\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u5165\u529B\u3092\u63A8\u5968\u3057\u307E\u3059\u3002
|
||||
PropertiesWizardPage.EmptyPurposeWarning=\u76EE\u7684\u30D5\u30A3\u30FC\u30EB\u30C9\u306E\u5165\u529B\u3092\u63A8\u5968\u3057\u307E\u3059
|
||||
PropertiesWizardPage.ItemExistsError=\u30A2\u30A4\u30C6\u30E0\u304C\u5B58\u5728\u3057\u307E\u3059\u3002\u3054\u307F\u7BB1\u3092\u78BA\u8A8D\u3057\u3066\u7A7A\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
PropertiesWizardPage.ItemExistsError=\u9805\u76EE\u304C\u5B58\u5728\u3057\u307E\u3059\u3002\u3054\u307F\u7BB1\u3092\u78BA\u8A8D\u3057\u3066\u7A7A\u306B\u3057\u3066\u304F\u3060\u3055\u3044\u3002
|
||||
PropertiesWizardPage.KeywordsError=\u540D\u524D\u304C\u6709\u52B9\u306AID\u3067\u306F\u3042\u308A\u307E\u305B\u3093\u3002
|
||||
PropertiesWizardPage.Name=\u540D\u524D
|
||||
PropertiesWizardPage.NameEmptyError=\u540D\u524D\u304C\u7A7A\u3067\u3059\u3002
|
||||
@@ -156,7 +156,8 @@ ProjectRepositoryNode.invalidItem=\u7121\u52B9\u306A\u30A2\u30A4\u30C6\u30E0
|
||||
ProjectRepositoryNode.columns=\u30AB\u30E9\u30E0
|
||||
ProjectRepositoryNode.validationRules=\u691C\u8A3C\u30EB\u30FC\u30EB
|
||||
ProjectRepositoryNode.cdcFoundation=CDC Foundation
|
||||
ProjectRepositoryNode.genericSchema=\u6C4E\u7528\u30B9\u30AD\u30FC\u30DE
|
||||
ProjectRepositoryNode.cdcFoundation.deprecated=CDC Foundation (\u975E\u63A8\u5968)
|
||||
ProjectRepositoryNode.genericSchema=\u30B8\u30A7\u30CD\u30EA\u30C3\u30AF\u30B9\u30AD\u30FC\u30DE
|
||||
ProjectRepositoryNode.queries=\u30AF\u30A8\u30EA\u30FC
|
||||
ProjectRepositoryNode.synonymSchemas=\u30B7\u30CE\u30CB\u30E0\u30B9\u30AD\u30FC\u30DE
|
||||
ProjectRepositoryNode.calculationViewSchemas=\u8A08\u7B97\u30D3\u30E5\u30FC\u30B9\u30AD\u30FC\u30DE
|
||||
@@ -175,6 +176,7 @@ ProjectRepositoryNode.sapBWDataStoreObject=SAP DSO
|
||||
ProjectRepositoryNode.sapBWInfoCube=SAP InfoCube
|
||||
ProjectRepositoryNode.sapBWInfoObject=SAP InfoObject
|
||||
ProjectRepositoryNode.sapContentExtractor=SAP BI\u30B3\u30F3\u30C6\u30F3\u30C4\u30A8\u30AF\u30B9\u30C8\u30E9\u30AF\u30BF\u30FC
|
||||
ProjectRepositoryNode.sapCDSView=SAP CDS\u30D3\u30E5\u30FC
|
||||
RepositoryDropAdapter_copyingItems=\u30A2\u30A4\u30C6\u30E0\u3092\u30B3\u30D4\u30FC\u4E2D...
|
||||
RepositoryDropAdapter_errorMsg=\u30C7\u30A3\u30EC\u30AF\u30C8\u30EA\u30FC\u306B\u30ED\u30C3\u30AF\u3055\u308C\u305F\u30A2\u30A4\u30C6\u30E0\u304C\u542B\u307E\u308C\u3066\u3044\u307E\u3059\u3002\u73FE\u5728\u3001\u79FB\u52D5\u3067\u304D\u307E\u305B\u3093,
|
||||
RepositoryDropAdapter_lockedByOthers=\u3053\u306E\u30A2\u30A4\u30C6\u30E0\u304C\u4ED6\u306E\u30E6\u30FC\u30B6\u30FC\u306B\u3088\u3063\u3066\u30ED\u30C3\u30AF\u3055\u308C\u307E\u3057\u305F\u3002\u73FE\u5728\u3001\u79FB\u52D5\u3067\u304D\u307E\u305B\u3093\u3002
|
||||
@@ -204,3 +206,4 @@ RenameFolderAction.warning.cannotFind.title=\u4F7F\u7528\u3067\u304D\u306A\u3044
|
||||
ConvertJobsUtil.warning.title=\u8B66\u544A
|
||||
ConvertJobsUtil.warning.message=\u3053\u306E\u30EA\u30EA\u30FC\u30B9\u3067\u306F\u3001\u30BF\u30FC\u30B2\u30C3\u30C8\u30D5\u30EC\u30FC\u30E0\u30EF\u30FC\u30AF\u304C\u5B8C\u5168\u306B\u30B5\u30DD\u30FC\u30C8\u3055\u308C\u3066\u3044\u307E\u305B\u3093\u3002
|
||||
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=\u7D71\u8A08\u30ED\u30B0\u3068\u6697\u9ED9\u7684\u30D1\u30E9\u30E1\u30FC\u30BF\u30FC\u3092\u4F5C\u6210
|
||||
WizardPageAPIDefinition_operationIdMissing=API\u3067operationIds\u304C\u898B\u3064\u304B\u308A\u307E\u305B\u3093\u3002operationIds\u306F\u3001tRESTRequest/cRest\u51FA\u529B\u30D5\u30ED\u30FC\u3092\u521D\u671F\u5316\u3059\u308B\u305F\u3081\u306B\u4F7F\u308F\u308C\u307E\u3059\u3002tRESTRequest/cRest\u306E\u30AA\u30F3\u30E9\u30A4\u30F3\u30D8\u30EB\u30D7\u3092\u3054\u89A7\u304F\u3060\u3055\u3044\u3002
|
||||
|
||||
@@ -156,6 +156,7 @@ ProjectRepositoryNode.invalidItem=\u65E0\u6548\u9879\u76EE
|
||||
ProjectRepositoryNode.columns=\u5217
|
||||
ProjectRepositoryNode.validationRules=\u9A8C\u8BC1\u89C4\u5219
|
||||
ProjectRepositoryNode.cdcFoundation=CDC Foundation
|
||||
ProjectRepositoryNode.cdcFoundation.deprecated=CDC Foundation (\u5DF2\u5F03\u7528)
|
||||
ProjectRepositoryNode.genericSchema=\u901A\u7528 schema
|
||||
ProjectRepositoryNode.queries=\u67E5\u8BE2
|
||||
ProjectRepositoryNode.synonymSchemas=\u540C\u4E49\u5B57 schema
|
||||
@@ -175,6 +176,7 @@ ProjectRepositoryNode.sapBWDataStoreObject=SAP DSO
|
||||
ProjectRepositoryNode.sapBWInfoCube=SAP InfoCube
|
||||
ProjectRepositoryNode.sapBWInfoObject=SAP InfoObject
|
||||
ProjectRepositoryNode.sapContentExtractor=SAP BI \u5185\u5BB9\u63D0\u53D6\u5668
|
||||
ProjectRepositoryNode.sapCDSView=SAP CDS \u89C6\u56FE
|
||||
RepositoryDropAdapter_copyingItems=\u6B63\u5728\u590D\u5236\u9879\u76EE...
|
||||
RepositoryDropAdapter_errorMsg=\u6B64\u76EE\u5F55\u5305\u542B\u9501\u5B9A\u7684\u9879\u76EE\uFF0C\u73B0\u5728\u65E0\u6CD5\u79FB\u52A8
|
||||
RepositoryDropAdapter_lockedByOthers=\u6B64\u9879\u76EE\u88AB\u5176\u4ED6\u7528\u6237\u9501\u5B9A\uFF0C\u73B0\u5728\u65E0\u6CD5\u79FB\u52A8\u3002
|
||||
@@ -204,3 +206,4 @@ RenameFolderAction.warning.cannotFind.title=\u64CD\u4F5C\u4E0D\u53EF\u7528
|
||||
ConvertJobsUtil.warning.title=\u8B66\u544A
|
||||
ConvertJobsUtil.warning.message=\u6B64\u7248\u672C\u4E0D\u5B8C\u5168\u652F\u6301\u76EE\u6807\u6846\u67B6.
|
||||
SyncLibrariesLoginTask.createStatsLogAndImplicitParamter=\u521B\u5EFA\u7EDF\u8BA1\u65E5\u5FD7\u548C\u9690\u5F0F\u53C2\u6570
|
||||
WizardPageAPIDefinition_operationIdMissing=API \u7F3A\u5931 operationId \u53C2\u6570\uFF0C\u8FD9\u4E9B operationId \u53C2\u6570\u7528\u6765\u521D\u59CB\u5316 tRESTRequest \u6216 cRest \u8F93\u51FA\u6D41\u3002\u8BF7\u53C2\u89C1 tRESTRequest \u6216 cRest \u5728\u7EBF\u5E2E\u52A9\u6587\u6863\u3002
|
||||
|
||||
@@ -130,7 +130,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
ERepositoryObjectType.METADATA_FILE_RULES, ERepositoryObjectType.METADATA_FILE_HL7,
|
||||
ERepositoryObjectType.METADATA_FILE_FTP, ERepositoryObjectType.METADATA_FILE_BRMS,
|
||||
ERepositoryObjectType.METADATA_MDMCONNECTION, ERepositoryObjectType.METADATA_HEADER_FOOTER,
|
||||
ERepositoryObjectType.JOB_SCRIPT };
|
||||
ERepositoryObjectType.JOB_SCRIPT, ERepositoryObjectType.METADATA_BIGQUERYCONNECTIONS };
|
||||
|
||||
List<IRepositoryViewObject> deletedItems = new ArrayList<IRepositoryViewObject>();
|
||||
for (ERepositoryObjectType type : types) {
|
||||
@@ -260,6 +260,7 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
if (type == ERepositoryObjectType.METADATA_CON_TABLE) {
|
||||
return false;
|
||||
}
|
||||
|
||||
boolean isAllowMultipleName = (type == ERepositoryObjectType.SQLPATTERNS || type == ERepositoryObjectType.METADATA_FILE_XML);
|
||||
String path = "";
|
||||
if (item.getState() != null) {
|
||||
@@ -872,25 +873,38 @@ public abstract class AbstractEMFRepositoryFactory extends AbstractRepositoryFac
|
||||
@Override
|
||||
public IRepositoryViewObject getLastVersion(Project project, String id, String relativeFolder, ERepositoryObjectType type)
|
||||
throws PersistenceException {
|
||||
List<IRepositoryViewObject> serializableAllVersion = null;
|
||||
Object fullFolder = getFullFolder(project, type, relativeFolder);
|
||||
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, false, true, true);
|
||||
List<IRepositoryViewObject> serializableAllVersion = new ArrayList<>();
|
||||
if (lastFolderForItemMap.containsKey(id)) {
|
||||
ERepositoryObjectType itemType = lastRepositoryTypeForItemMap.get(id);
|
||||
String currentPath = lastFolderForItemMap.get(id);
|
||||
Object fullFolder = getFullFolder(project, itemType, currentPath);
|
||||
try {
|
||||
if (fullFolder != null && (fullFolder instanceof FolderItem || ((IFolder) fullFolder).exists())) {
|
||||
serializableAllVersion.addAll(getSerializableFromFolder(project, fullFolder, id, itemType, false, false, true, true));
|
||||
}
|
||||
} catch (PersistenceException e) {
|
||||
// do nothing.
|
||||
// if any exception happen or can't find the item, just try to look for it everywhere.
|
||||
}
|
||||
}
|
||||
if (serializableAllVersion.isEmpty()) {
|
||||
// look in all folders for this item type
|
||||
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, true, true, true, true);
|
||||
Object fullFolder = getFullFolder(project, type, relativeFolder);
|
||||
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, false, true, true);
|
||||
if (serializableAllVersion.isEmpty()) {
|
||||
// look in all folders for this item type
|
||||
serializableAllVersion = getSerializableFromFolder(project, fullFolder, id, type, false, true, true, true, true);
|
||||
}
|
||||
}
|
||||
int size = serializableAllVersion.size();
|
||||
|
||||
if (size > 1) {
|
||||
String message = getItemsMessages(serializableAllVersion, size);
|
||||
|
||||
throw new PersistenceException(Messages.getString(
|
||||
"AbstractEMFRepositoryFactory.presistenceException.OnlyOneOccurenceMustbeFound", message)); //$NON-NLS-1$
|
||||
} else if (size == 1) {
|
||||
return serializableAllVersion.get(0);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
if (size == 1) {
|
||||
return serializableAllVersion.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
protected void computePropertyMaxInformationLevel(Property property) {
|
||||
|
||||
@@ -184,6 +184,7 @@ public abstract class AbstractRepositoryFactory implements IRepositoryFactory {
|
||||
collect(getMetadata(project, ERepositoryObjectType.METADATA_FILE_LDIF), result);
|
||||
collect(getMetadata(project, ERepositoryObjectType.METADATA_CONNECTIONS), result);
|
||||
collect(getMetadata(project, ERepositoryObjectType.METADATA_SAPCONNECTIONS), result);
|
||||
collect(getMetadata(project, ERepositoryObjectType.METADATA_BIGQUERYCONNECTIONS), result);
|
||||
collect(getMetadata(project, ERepositoryObjectType.METADATA_HEADER_FOOTER), result);
|
||||
collect(getMetadata(project, ERepositoryObjectType.METADATA_LDAP_SCHEMA), result);
|
||||
collect(getMetadata(project, ERepositoryObjectType.METADATA_GENERIC_SCHEMA), result);
|
||||
|
||||
@@ -27,10 +27,6 @@ import java.util.Set;
|
||||
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.log4j.Level;
|
||||
import org.eclipse.core.runtime.IProgressMonitor;
|
||||
import org.eclipse.core.runtime.IStatus;
|
||||
import org.eclipse.core.runtime.Status;
|
||||
import org.eclipse.core.runtime.jobs.Job;
|
||||
import org.talend.commons.exception.ExceptionHandler;
|
||||
import org.talend.core.ICoreService;
|
||||
import org.talend.core.PluginChecker;
|
||||
@@ -39,22 +35,22 @@ import org.talend.core.model.properties.RoutineItem;
|
||||
import org.talend.core.model.properties.SQLPatternItem;
|
||||
import org.talend.core.model.repository.ERepositoryObjectType;
|
||||
import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.pendo.AbstractPendoTrackManager;
|
||||
import org.talend.core.pendo.PendoDataTrackFactory;
|
||||
import org.talend.core.pendo.PendoItemSignatureUtil;
|
||||
import org.talend.core.pendo.PendoItemSignatureUtil.SignatureStatus;
|
||||
import org.talend.core.pendo.PendoItemSignatureUtil.TOSProdNameEnum;
|
||||
import org.talend.core.pendo.PendoItemSignatureUtil.ValueEnum;
|
||||
import org.talend.core.pendo.PendoTrackDataUtil;
|
||||
import org.talend.core.pendo.PendoTrackDataUtil.TrackEvent;
|
||||
import org.talend.core.pendo.PendoTrackSender;
|
||||
import org.talend.core.pendo.TrackEvent;
|
||||
import org.talend.core.pendo.properties.IPendoDataProperties;
|
||||
import org.talend.core.pendo.properties.PendoSignLogonProperties;
|
||||
import org.talend.utils.migration.MigrationTokenUtil;
|
||||
|
||||
/**
|
||||
* DOC jding class global comment. Detailled comment
|
||||
*/
|
||||
public class PendoItemSignatureManager {
|
||||
|
||||
private PendoSignLogonProperties itemSignProperties = new PendoSignLogonProperties();
|
||||
public class PendoItemSignatureManager extends AbstractPendoTrackManager {
|
||||
|
||||
private static PendoItemSignatureManager manager;
|
||||
|
||||
@@ -63,7 +59,7 @@ public class PendoItemSignatureManager {
|
||||
static {
|
||||
manager = new PendoItemSignatureManager();
|
||||
try {
|
||||
isTrackAvailable = PluginChecker.isTIS() && PendoTrackSender.getInstance().isTrackSendAvailable();
|
||||
isTrackAvailable = PluginChecker.isTIS() && PendoDataTrackFactory.getInstance().isTrackSendAvailable();
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e, Level.WARN);
|
||||
}
|
||||
@@ -87,11 +83,12 @@ public class PendoItemSignatureManager {
|
||||
}
|
||||
}
|
||||
|
||||
public void collectProperties() {
|
||||
public IPendoDataProperties collectProperties() {
|
||||
ICoreService coreService = ICoreService.get();
|
||||
if (coreService == null || !isTrackAvailable) {
|
||||
return;
|
||||
return null;
|
||||
}
|
||||
PendoSignLogonProperties itemSignProperties = new PendoSignLogonProperties();
|
||||
try {
|
||||
itemSignProperties.setSignByMigration(signByLoginMigrationItems.size());
|
||||
|
||||
@@ -188,6 +185,7 @@ public class PendoItemSignatureManager {
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e, Level.WARN);
|
||||
}
|
||||
return itemSignProperties;
|
||||
|
||||
}
|
||||
|
||||
@@ -258,23 +256,12 @@ public class PendoItemSignatureManager {
|
||||
if (!isTrackAvailable) {
|
||||
return;
|
||||
}
|
||||
Job job = new Job("send pendo track") {
|
||||
super.sendTrackToPendo();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IStatus run(IProgressMonitor monitor) {
|
||||
try {
|
||||
collectProperties();
|
||||
PendoTrackSender.getInstance().sendTrackData(TrackEvent.ITEM_SIGNATURE, itemSignProperties);
|
||||
} catch (Exception e) {
|
||||
// warning only
|
||||
ExceptionHandler.process(e, Level.WARN);
|
||||
}
|
||||
return Status.OK_STATUS;
|
||||
}
|
||||
};
|
||||
job.setUser(false);
|
||||
job.setPriority(Job.INTERACTIVE);
|
||||
job.schedule();
|
||||
@Override
|
||||
public TrackEvent getTrackEvent() {
|
||||
return TrackEvent.ITEM_SIGNATURE;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -102,6 +102,7 @@ import org.talend.cwm.helper.ConnectionHelper;
|
||||
import org.talend.cwm.helper.SAPBWTableHelper;
|
||||
import org.talend.cwm.helper.SubItemHelper;
|
||||
import org.talend.cwm.helper.TableHelper;
|
||||
import org.talend.cwm.helper.TaggedValueHelper;
|
||||
import org.talend.designer.core.IDesignerCoreService;
|
||||
import org.talend.repository.ProjectManager;
|
||||
import org.talend.repository.model.BinRepositoryNode;
|
||||
@@ -1349,6 +1350,8 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
connection = dbMetadataConnection;
|
||||
} else if (type == ERepositoryObjectType.METADATA_SAPCONNECTIONS) {
|
||||
connection = ((ConnectionItem) repositoryObject.getProperty().getItem()).getConnection();
|
||||
} else if (type == ERepositoryObjectType.METADATA_BIGQUERYCONNECTIONS) {
|
||||
connection = ((ConnectionItem) repositoryObject.getProperty().getItem()).getConnection();
|
||||
} else if (type == ERepositoryObjectType.METADATA_FILE_DELIMITED) {
|
||||
connection = ((ConnectionItem) repositoryObject.getProperty().getItem()).getConnection();
|
||||
} else if (type == ERepositoryObjectType.METADATA_FILE_POSITIONAL) {
|
||||
@@ -1700,11 +1703,11 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
DatabaseConnectionItem connectionItem = (DatabaseConnectionItem) item;
|
||||
DatabaseConnection connection = (DatabaseConnection) connectionItem.getConnection();
|
||||
if (PluginChecker.isCDCPluginLoaded()) {
|
||||
ICDCProviderService service = GlobalServiceRegister.getDefault()
|
||||
.getService(ICDCProviderService.class);
|
||||
ICDCProviderService service = GlobalServiceRegister.getDefault().getService(ICDCProviderService.class);
|
||||
|
||||
if (service != null && service.canCreateCDCConnection(connection)) {
|
||||
RepositoryNode cdcNode = new StableRepositoryNode(node,
|
||||
Messages.getString("ProjectRepositoryNode.cdcFoundation"), //$NON-NLS-1$
|
||||
Messages.getString("ProjectRepositoryNode.cdcFoundation.deprecated"), //$NON-NLS-1$
|
||||
ECoreImage.FOLDER_CLOSE_ICON);
|
||||
node.getChildren().add(cdcNode);
|
||||
service.createCDCTypes(recBinNode, cdcNode, connection.getCdcConns());
|
||||
@@ -1751,6 +1754,9 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
|
||||
// 10. BW Business Content Extractor:
|
||||
createSAPContentExtractorNodes(repObj, metadataConnection, node, validationRules);
|
||||
|
||||
// 11. CDS views:
|
||||
createSAPCDSViewNodes(repObj, metadataConnection, node, validationRules);
|
||||
} else if (metadataConnection instanceof SalesforceSchemaConnection) {
|
||||
createSalesforceModuleNodes(repObj, metadataConnection, node, validationRules);
|
||||
} else {
|
||||
@@ -1784,7 +1790,9 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
for (MetadataTable tablesWithOrder : tablesWithOrders) {
|
||||
EMap<String, String> properties = tablesWithOrder.getAdditionalProperties();
|
||||
String partitionKey = properties.get(EProperties.CONTENT_TYPE.name());
|
||||
if (!ERepositoryObjectType.METADATA_SAP_CONTENT_EXTRACTOR.name().equals(partitionKey)) {
|
||||
String cdsType = TaggedValueHelper.getValueString(EProperties.CONTENT_TYPE.name(), tablesWithOrder);
|
||||
if (!ERepositoryObjectType.METADATA_SAP_CONTENT_EXTRACTOR.name().equals(partitionKey)
|
||||
&& !ERepositoryObjectType.METADATA_SAP_CDS_VIEW.name().equals(cdsType)) {
|
||||
tables.add(tablesWithOrder);
|
||||
}
|
||||
}
|
||||
@@ -1967,6 +1975,32 @@ public class ProjectRepositoryNode extends RepositoryNode implements IProjectRep
|
||||
createTables(tableContainer, repObj, tables, ERepositoryObjectType.METADATA_CON_TABLE, validationRules);
|
||||
}
|
||||
|
||||
private void createSAPCDSViewNodes(IRepositoryViewObject repObj, Connection metadataConnection, RepositoryNode node,
|
||||
List<IRepositoryViewObject> validationRules) {
|
||||
StableRepositoryNode tableContainer = new StableRepositoryNode(node,
|
||||
Messages.getString("ProjectRepositoryNode.sapCDSView"), ECoreImage.FOLDER_CLOSE_ICON); //$NON-NLS-1$
|
||||
tableContainer.setChildrenObjectType(ERepositoryObjectType.METADATA_CON_TABLE);
|
||||
tableContainer.setProperties(EProperties.CONTENT_TYPE, ERepositoryObjectType.METADATA_SAP_CDS_VIEW);
|
||||
IRepositoryNode cacheNode = nodeCache.getCache(tableContainer);
|
||||
if (cacheNode != null && cacheNode instanceof StableRepositoryNode) {
|
||||
tableContainer = (StableRepositoryNode) cacheNode;
|
||||
tableContainer.getChildren().clear();
|
||||
} else {
|
||||
nodeCache.addCache(tableContainer, true);
|
||||
}
|
||||
|
||||
node.getChildren().add(tableContainer);
|
||||
List<MetadataTable> tablesWithOrders = ConnectionHelper.getTablesWithOrders(metadataConnection);
|
||||
EList<MetadataTable> tables = new BasicEList<>();
|
||||
for (MetadataTable tablesWithOrder : tablesWithOrders) {
|
||||
String cdsType = TaggedValueHelper.getValueString(EProperties.CONTENT_TYPE.name(), tablesWithOrder);
|
||||
if (ERepositoryObjectType.METADATA_SAP_CDS_VIEW.name().equals(cdsType)) {
|
||||
tables.add(tablesWithOrder);
|
||||
}
|
||||
}
|
||||
createTables(tableContainer, repObj, tables, ERepositoryObjectType.METADATA_CON_TABLE, validationRules);
|
||||
}
|
||||
|
||||
private void createSalesforceModuleNodes(IRepositoryViewObject rebObj, Connection metadataConnection,
|
||||
RepositoryNode connectionNode, List<IRepositoryViewObject> validationRules) {
|
||||
EList modules = ((SalesforceSchemaConnection) metadataConnection).getModules();
|
||||
|
||||
@@ -54,9 +54,7 @@ import org.eclipse.jface.dialogs.InputDialog;
|
||||
import org.eclipse.jface.dialogs.MessageDialog;
|
||||
import org.eclipse.osgi.internal.serviceregistry.ServiceReferenceImpl;
|
||||
import org.eclipse.osgi.internal.serviceregistry.ServiceRegistrationImpl;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.swt.widgets.MessageBox;
|
||||
import org.eclipse.swt.widgets.Shell;
|
||||
import org.eclipse.ui.navigator.CommonNavigator;
|
||||
import org.eclipse.ui.navigator.CommonViewer;
|
||||
@@ -153,6 +151,7 @@ import org.talend.core.runtime.services.IMavenUIService;
|
||||
import org.talend.core.runtime.util.ItemDateParser;
|
||||
import org.talend.core.runtime.util.JavaHomeUtil;
|
||||
import org.talend.core.runtime.util.SharedStudioUtils;
|
||||
import org.talend.core.service.IComponentJsonformGeneratorService;
|
||||
import org.talend.core.service.ICoreUIService;
|
||||
import org.talend.core.service.IDetectCVEService;
|
||||
import org.talend.core.utils.CodesJarResourceCache;
|
||||
@@ -239,14 +238,14 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
return singleton;
|
||||
}
|
||||
|
||||
private ICoreService getCoreService() {
|
||||
public ICoreService getCoreService() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ICoreService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(ICoreService.class);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private IRunProcessService getRunProcessService() {
|
||||
public IRunProcessService getRunProcessService() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IRunProcessService.class)) {
|
||||
return GlobalServiceRegister.getDefault().getService(IRunProcessService.class);
|
||||
}
|
||||
@@ -351,7 +350,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
* @param project
|
||||
* @throws LoginException
|
||||
*/
|
||||
private void checkProjectCompatibility(Project project) throws LoginException {
|
||||
public void checkProjectCompatibility(Project project) throws LoginException {
|
||||
IMigrationToolService migrationToolService = GlobalServiceRegister.getDefault().getService(
|
||||
IMigrationToolService.class);
|
||||
// update migration system.
|
||||
@@ -446,12 +445,10 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
if (currentShell == null) {
|
||||
currentShell = DisplayUtils.getDefaultShell(false);
|
||||
}
|
||||
MessageBox box = new MessageBox(currentShell, SWT.ICON_WARNING | SWT.OK | SWT.CANCEL);
|
||||
box.setText(Messages.getString("ProxyRepositoryFactory.JobNameErroe")); //$NON-NLS-1$
|
||||
box.setMessage(Messages.getString("ProxyRepositoryFactory.Label") + " " + name + " " + Messages.getString("ProxyRepositoryFactory.ReplaceJob")); //$NON-NLS-1$ //$NON-NLS-2$//$NON-NLS-3$//$NON-NLS-4$
|
||||
|
||||
if (box.open() == SWT.OK) {
|
||||
|
||||
if (MessageDialog.openQuestion(currentShell,
|
||||
Messages.getString("ProxyRepositoryFactory.JobNameErroe"), //$NON-NLS-1$
|
||||
Messages.getString("ProxyRepositoryFactory.Label") + " " + name + " " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||
+ Messages.getString("ProxyRepositoryFactory.ReplaceJob"))) { //$NON-NLS-1$
|
||||
ok[0] = true;
|
||||
}
|
||||
}
|
||||
@@ -1848,7 +1845,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
* @param project
|
||||
* @throws PersistenceException
|
||||
*/
|
||||
private void emptyTempFolder(Project project) throws PersistenceException {
|
||||
public void emptyTempFolder(Project project) throws PersistenceException {
|
||||
try {
|
||||
String str = SharedStudioUtils.getTempFolderPath().toPortableString();
|
||||
FilesUtils.deleteFolder(new File(str), false);
|
||||
@@ -2210,6 +2207,13 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
|
||||
if (IHadoopDistributionService.get() != null) {
|
||||
try {
|
||||
IHadoopDistributionService.get().checkAndMigrateDistributionProxyCredential(project);
|
||||
} catch (Exception e) {
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
// init dynamic distirbution after `beforeLogon`, before loading libraries.
|
||||
initDynamicDistribution(monitor);
|
||||
|
||||
@@ -2379,11 +2383,22 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
}
|
||||
String str[] = new String[] { getRepositoryContext().getUser() + "", projectManager.getCurrentProject() + "" }; //$NON-NLS-1$ //$NON-NLS-2$
|
||||
log.info(Messages.getString("ProxyRepositoryFactory.log.loggedOn", str)); //$NON-NLS-1$
|
||||
|
||||
// no performance impact for studio or commandline
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IComponentJsonformGeneratorService.class)) {
|
||||
IComponentJsonformGeneratorService jsonformSvc = GlobalServiceRegister.getDefault().getService(IComponentJsonformGeneratorService.class);
|
||||
if (jsonformSvc != null && IComponentJsonformGeneratorService.isEnabled()) {
|
||||
jsonformSvc.generate(null);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (LoginException e) {
|
||||
try {
|
||||
logOffProject();
|
||||
} catch (Exception e1) {
|
||||
ExceptionHandler.process(e1);
|
||||
if (!LoginException.RESTART.equals(e.getKey())) {
|
||||
try {
|
||||
logOffProject();
|
||||
} catch (Exception e1) {
|
||||
ExceptionHandler.process(e1);
|
||||
}
|
||||
}
|
||||
throw e;
|
||||
} catch (PersistenceException e) {
|
||||
@@ -2516,7 +2531,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
}
|
||||
}
|
||||
|
||||
private void checkReferenceProjectsProblems(Project project) throws BusinessException, PersistenceException {
|
||||
public void checkReferenceProjectsProblems(Project project) throws BusinessException, PersistenceException {
|
||||
if (ReferenceProjectProblemManager.getInstance().getAllInvalidProjectReferenceSet().size() > 0) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
for (String technicalLabel : ReferenceProjectProblemManager.getInstance().getAllInvalidProjectReferenceSet()) {
|
||||
@@ -2561,7 +2576,6 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
public void logOffProject() {
|
||||
// getRepositoryContext().setProject(null);
|
||||
repositoryFactoryFromProvider.logOffProject();
|
||||
if (!CommonsPlugin.isHeadless()) {
|
||||
ProjectRepositoryNode root = ProjectRepositoryNode.getInstance();
|
||||
if (root != null) {
|
||||
@@ -2617,6 +2631,7 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
|
||||
ReferenceProjectProvider.clearTacReferenceList();
|
||||
ReferenceProjectProblemManager.getInstance().clearAll();
|
||||
repositoryFactoryFromProvider.logOffProject();
|
||||
fullLogonFinished = false;
|
||||
}
|
||||
|
||||
@@ -3014,4 +3029,11 @@ public final class ProxyRepositoryFactory implements IProxyRepositoryFactory {
|
||||
this.repositoryFactoryFromProvider.saveProject(project);
|
||||
}
|
||||
|
||||
public void setCancelled(boolean cancelled) {
|
||||
this.isCancelled = cancelled;
|
||||
}
|
||||
|
||||
public boolean isCancelled() {
|
||||
return this.isCancelled;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,125 +1,127 @@
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 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.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionImplementationProvider;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionPointLimiterImpl;
|
||||
import org.talend.commons.utils.workbench.extensions.IExtensionPointLimiter;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
|
||||
/**
|
||||
* Provides, using extension points, implementation of many factories.
|
||||
*
|
||||
* <ul>
|
||||
* <li>IProcessFactory</li>
|
||||
* </ul>
|
||||
*
|
||||
* $Id: RepositoryFactoryProvider.java 38013 2010-03-05 14:21:59Z mhirt $
|
||||
*/
|
||||
public class RepositoryFactoryProvider {
|
||||
|
||||
private static List<IRepositoryFactory> list = null;
|
||||
|
||||
public static final IExtensionPointLimiter REPOSITORY_PROVIDER = new ExtensionPointLimiterImpl(
|
||||
"org.talend.core.repository.repository_provider", //$NON-NLS-1$
|
||||
"RepositoryFactory", 1, -1); //$NON-NLS-1$
|
||||
|
||||
public static List<IRepositoryFactory> getAvailableRepositories() {
|
||||
if (list == null) {
|
||||
list = new ArrayList<IRepositoryFactory>();
|
||||
List<IConfigurationElement> extension = ExtensionImplementationProvider.getInstanceV2(REPOSITORY_PROVIDER);
|
||||
String hiddenRepos = System.getProperty("hidden.repositories"); //$NON-NLS-1$
|
||||
String hiddenRepository[] = new String[]{};
|
||||
if (hiddenRepos != null) {
|
||||
hiddenRepository = hiddenRepos.split(";"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
boolean isPoweredByTalend = false;
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
|
||||
.getService(IBrandingService.class);
|
||||
isPoweredByTalend = brandingService.isPoweredbyTalend();
|
||||
for (IConfigurationElement current : extension) {
|
||||
try {
|
||||
String only4TalendStr = current.getAttribute("only4Talend"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4TalendStr) && !isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
String only4OemStr = current.getAttribute("only4Oem"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4OemStr) && isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
IRepositoryFactory currentAction = (IRepositoryFactory) current.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
currentAction.setId(current.getAttribute("id")); //$NON-NLS-1$
|
||||
currentAction.setName(current.getAttribute("name")); //$NON-NLS-1$
|
||||
currentAction.setAuthenticationNeeded(new Boolean(current.getAttribute("authenticationNeeded"))); //$NON-NLS-1$
|
||||
currentAction.setDisplayToUser(new Boolean(current.getAttribute("displayToUser")).booleanValue()); //$NON-NLS-1$
|
||||
|
||||
// Getting dynamic login fields:
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("loginField")) { //$NON-NLS-1$
|
||||
DynamicFieldBean key = new DynamicFieldBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("defaultValue"), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("required")), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("password")), //$NON-NLS-1$
|
||||
Boolean.valueOf(currentLoginField.getAttribute("readonly"))); //$NON-NLS-1$
|
||||
currentAction.getFields().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("button")) { //$NON-NLS-1$
|
||||
DynamicButtonBean key = new DynamicButtonBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
(SelectionListener) currentLoginField.createExecutableExtension("selectionListener")); //$NON-NLS-1$
|
||||
currentAction.getButtons().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("choiceField")) { //$NON-NLS-1$
|
||||
DynamicChoiceBean key = new DynamicChoiceBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name")); //$NON-NLS-1$
|
||||
for (IConfigurationElement currentChoice : currentLoginField.getChildren("choice")) { //$NON-NLS-1$
|
||||
String value = currentChoice.getAttribute("value"); //$NON-NLS-1$
|
||||
String label = currentChoice.getAttribute("label"); //$NON-NLS-1$
|
||||
key.addChoice(value, label);
|
||||
}
|
||||
currentAction.getChoices().add(key);
|
||||
}
|
||||
if (ArrayUtils.contains(hiddenRepository, currentAction.getId())) {
|
||||
continue;
|
||||
}
|
||||
list.add(currentAction);
|
||||
} catch (CoreException e) {
|
||||
// e.printStackTrace();
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static IRepositoryFactory getRepositoriyById(String id) {
|
||||
for (IRepositoryFactory current : getAvailableRepositories()) {
|
||||
if (current.getId().equals(id)) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
// ============================================================================
|
||||
//
|
||||
// Copyright (C) 2006-2021 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.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import org.apache.commons.lang.ArrayUtils;
|
||||
import org.eclipse.core.runtime.CoreException;
|
||||
import org.eclipse.core.runtime.IConfigurationElement;
|
||||
import org.eclipse.swt.events.SelectionListener;
|
||||
import org.talend.commons.CommonsPlugin;
|
||||
import org.talend.commons.ui.runtime.exception.ExceptionHandler;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionImplementationProvider;
|
||||
import org.talend.commons.utils.workbench.extensions.ExtensionPointLimiterImpl;
|
||||
import org.talend.commons.utils.workbench.extensions.IExtensionPointLimiter;
|
||||
import org.talend.core.GlobalServiceRegister;
|
||||
import org.talend.core.ui.branding.IBrandingService;
|
||||
|
||||
/**
|
||||
* Provides, using extension points, implementation of many factories.
|
||||
*
|
||||
* <ul>
|
||||
* <li>IProcessFactory</li>
|
||||
* </ul>
|
||||
*
|
||||
* $Id: RepositoryFactoryProvider.java 38013 2010-03-05 14:21:59Z mhirt $
|
||||
*/
|
||||
public class RepositoryFactoryProvider {
|
||||
|
||||
private static List<IRepositoryFactory> list = null;
|
||||
|
||||
public static final IExtensionPointLimiter REPOSITORY_PROVIDER = new ExtensionPointLimiterImpl(
|
||||
"org.talend.core.repository.repository_provider", //$NON-NLS-1$
|
||||
"RepositoryFactory", 1, -1); //$NON-NLS-1$
|
||||
|
||||
public static synchronized List<IRepositoryFactory> getAvailableRepositories() {
|
||||
if (list == null) {
|
||||
list = new ArrayList<IRepositoryFactory>();
|
||||
List<IConfigurationElement> extension = ExtensionImplementationProvider.getInstanceV2(REPOSITORY_PROVIDER);
|
||||
String hiddenRepos = System.getProperty("hidden.repositories"); //$NON-NLS-1$
|
||||
String hiddenRepository[] = new String[]{};
|
||||
if (hiddenRepos != null) {
|
||||
hiddenRepository = hiddenRepos.split(";"); //$NON-NLS-1$
|
||||
}
|
||||
|
||||
boolean isPoweredByTalend = false;
|
||||
IBrandingService brandingService = (IBrandingService) GlobalServiceRegister.getDefault()
|
||||
.getService(IBrandingService.class);
|
||||
isPoweredByTalend = brandingService.isPoweredbyTalend();
|
||||
for (IConfigurationElement current : extension) {
|
||||
try {
|
||||
String only4TalendStr = current.getAttribute("only4Talend"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4TalendStr) && !isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
String only4OemStr = current.getAttribute("only4Oem"); //$NON-NLS-1$
|
||||
if (Boolean.valueOf(only4OemStr) && isPoweredByTalend) {
|
||||
continue;
|
||||
}
|
||||
IRepositoryFactory currentAction = (IRepositoryFactory) current.createExecutableExtension("class"); //$NON-NLS-1$
|
||||
currentAction.setId(current.getAttribute("id")); //$NON-NLS-1$
|
||||
currentAction.setName(current.getAttribute("name")); //$NON-NLS-1$
|
||||
currentAction.setAuthenticationNeeded(new Boolean(current.getAttribute("authenticationNeeded"))); //$NON-NLS-1$
|
||||
currentAction.setDisplayToUser(new Boolean(current.getAttribute("displayToUser")).booleanValue()); //$NON-NLS-1$
|
||||
|
||||
// Getting dynamic login fields:
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("loginField")) { //$NON-NLS-1$
|
||||
DynamicFieldBean key = new DynamicFieldBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("defaultValue"), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("required")), //$NON-NLS-1$
|
||||
new Boolean(currentLoginField.getAttribute("password")), //$NON-NLS-1$
|
||||
Boolean.valueOf(currentLoginField.getAttribute("readonly"))); //$NON-NLS-1$
|
||||
currentAction.getFields().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("button")) { //$NON-NLS-1$
|
||||
DynamicButtonBean key = new DynamicButtonBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name"), //$NON-NLS-1$
|
||||
(SelectionListener) currentLoginField.createExecutableExtension("selectionListener")); //$NON-NLS-1$
|
||||
currentAction.getButtons().add(key);
|
||||
}
|
||||
|
||||
for (IConfigurationElement currentLoginField : current.getChildren("choiceField")) { //$NON-NLS-1$
|
||||
DynamicChoiceBean key = new DynamicChoiceBean(currentLoginField.getAttribute("id"), //$NON-NLS-1$
|
||||
currentLoginField.getAttribute("name")); //$NON-NLS-1$
|
||||
for (IConfigurationElement currentChoice : currentLoginField.getChildren("choice")) { //$NON-NLS-1$
|
||||
String value = currentChoice.getAttribute("value"); //$NON-NLS-1$
|
||||
String label = currentChoice.getAttribute("label"); //$NON-NLS-1$
|
||||
key.addChoice(value, label);
|
||||
}
|
||||
currentAction.getChoices().add(key);
|
||||
}
|
||||
if (ArrayUtils.contains(hiddenRepository, currentAction.getId())) {
|
||||
continue;
|
||||
}
|
||||
list.add(currentAction);
|
||||
} catch (CoreException e) {
|
||||
// e.printStackTrace();
|
||||
ExceptionHandler.process(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
public static IRepositoryFactory getRepositoriyById(String id) {
|
||||
for (IRepositoryFactory current : getAvailableRepositories()) {
|
||||
if (current.getId().equals(id)) {
|
||||
return current;
|
||||
}
|
||||
}
|
||||
ExceptionHandler.log("Can't find repository factory for: " + id);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,6 +52,8 @@ public interface IGitInfoService extends IService {
|
||||
public Map<String, String> getGitInfo(Property property) throws Exception;
|
||||
|
||||
public boolean isPushedToRemote(Property property) throws Exception;
|
||||
|
||||
public String getProjectBranch(Project project)throws Exception;
|
||||
|
||||
public static IGitInfoService get() {
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(IGitInfoService.class)) {
|
||||
|
||||
@@ -606,6 +606,8 @@ public class DuplicateAction extends AContextualAction {
|
||||
item = PropertiesFactory.eINSTANCE.createSalesforceSchemaConnectionItem();
|
||||
} else if (repositoryType == ERepositoryObjectType.METADATA_SAPCONNECTIONS) {
|
||||
item = PropertiesFactory.eINSTANCE.createSAPConnectionItem();
|
||||
} else if (repositoryType == ERepositoryObjectType.METADATA_BIGQUERYCONNECTIONS) {
|
||||
item = PropertiesFactory.eINSTANCE.createBigQueryConnectionItem();
|
||||
} else if (repositoryType == ERepositoryObjectType.METADATA_WSDL_SCHEMA) {
|
||||
item = PropertiesFactory.eINSTANCE.createWSDLSchemaConnectionItem();
|
||||
} else if (repositoryType == ERepositoryObjectType.PROCESS) {
|
||||
|
||||
@@ -15,25 +15,22 @@ package org.talend.core.repository.ui.view;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.eclipse.core.runtime.Platform;
|
||||
import org.eclipse.e4.ui.css.swt.theme.ITheme;
|
||||
import org.eclipse.e4.ui.css.swt.theme.IThemeEngine;
|
||||
import org.eclipse.e4.ui.css.swt.theme.IThemeManager;
|
||||
import org.eclipse.jface.resource.ImageDescriptor;
|
||||
import org.eclipse.jface.resource.JFaceResources;
|
||||
import org.eclipse.jface.util.IPropertyChangeListener;
|
||||
import org.eclipse.jface.util.PropertyChangeEvent;
|
||||
import org.eclipse.jface.viewers.IColorProvider;
|
||||
import org.eclipse.jface.viewers.IFontProvider;
|
||||
import org.eclipse.jface.viewers.LabelProvider;
|
||||
import org.eclipse.jface.viewers.TreeViewer;
|
||||
import org.eclipse.swt.graphics.Color;
|
||||
import org.eclipse.swt.graphics.Font;
|
||||
import org.eclipse.swt.graphics.Image;
|
||||
import org.eclipse.swt.widgets.Control;
|
||||
import org.eclipse.swt.widgets.Display;
|
||||
import org.eclipse.ui.PlatformUI;
|
||||
import org.osgi.framework.Bundle;
|
||||
import org.osgi.framework.BundleContext;
|
||||
import org.osgi.framework.ServiceReference;
|
||||
import org.talend.commons.runtime.model.repository.ECDCStatus;
|
||||
import org.talend.commons.runtime.model.repository.ERepositoryStatus;
|
||||
import org.talend.commons.ui.runtime.ITalendThemeService;
|
||||
import org.talend.commons.ui.runtime.image.ECoreImage;
|
||||
import org.talend.commons.ui.runtime.image.EImage;
|
||||
import org.talend.commons.ui.runtime.image.IImage;
|
||||
@@ -58,7 +55,6 @@ import org.talend.core.model.repository.IRepositoryViewObject;
|
||||
import org.talend.core.model.repository.RepositoryContentManager;
|
||||
import org.talend.core.model.repository.RepositoryNodeProviderRegistryReader;
|
||||
import org.talend.core.model.repository.RepositoryViewObject;
|
||||
import org.talend.core.repository.CoreRepositoryPlugin;
|
||||
import org.talend.core.repository.model.ProxyRepositoryFactory;
|
||||
import org.talend.core.repository.model.repositoryObject.MetadataTableRepositoryObject;
|
||||
import org.talend.core.runtime.CoreRuntimePlugin;
|
||||
@@ -87,18 +83,22 @@ import org.talend.utils.string.DigestUtil;
|
||||
*/
|
||||
public class RepositoryLabelProvider extends LabelProvider implements IColorProvider, IFontProvider {
|
||||
|
||||
private static final Color STABLE_SECONDARY_ENTRY_COLOR = new Color(null, 100, 100, 100);
|
||||
private static final String MERGED_PREFERENCED_ITEMS = "org.talend.core.repository.REPO_MERGED_REFERENCED_ITEMS_COLOR";
|
||||
|
||||
private static final Color STABLE_PRIMARY_ENTRY_COLOR = new Color(null, 0, 0, 0);
|
||||
private static final String LOCKED_ENTRY = "org.talend.core.repository.REPO_LOCKED_ENTRY";
|
||||
|
||||
private static final String STABLE_PRIMARY_ENTRY = "org.talend.core.repository.REPO_STABLE_PRIMARY_ENTRY_COLOR";
|
||||
|
||||
private static final String STABLE_SECONDARY_ENTRY = "org.talend.core.repository.REPO_STABLE_SECONDARY_ENTRY_COLOR";
|
||||
|
||||
private static final Color STABLE_SECONDARY_ENTRY_COLOR = new Color(null, 100, 100, 100);
|
||||
|
||||
protected static final Color INACTIVE_ENTRY_COLOR = new Color(null, 200, 200, 200);
|
||||
|
||||
private static final Color LOCKED_ENTRY = new Color(null, 200, 0, 0);
|
||||
private static final Color LOCKED_ENTRY_COLOR = new Color(null, 200, 0, 0);
|
||||
|
||||
private static final Color MERGED_REFERENCED_ITEMS_COLOR = new Color(null, 120, 120, 120);
|
||||
|
||||
private static final Color WHITE = new Color(null, 255, 255, 255);
|
||||
|
||||
private IRepositoryView view;
|
||||
|
||||
private static boolean refreshProperty = true;
|
||||
@@ -112,6 +112,18 @@ public class RepositoryLabelProvider extends LabelProvider implements IColorProv
|
||||
return view;
|
||||
}
|
||||
|
||||
private Color getStableSecondaryEntryColor() {
|
||||
return ITalendThemeService.getColor(STABLE_SECONDARY_ENTRY).orElse(STABLE_SECONDARY_ENTRY_COLOR);
|
||||
}
|
||||
|
||||
private Color getLockedEntryColor() {
|
||||
return ITalendThemeService.getColor(LOCKED_ENTRY).orElse(LOCKED_ENTRY_COLOR);
|
||||
}
|
||||
|
||||
private Color getMergedReferencedItemsColor() {
|
||||
return ITalendThemeService.getColor(MERGED_PREFERENCED_ITEMS).orElse(MERGED_REFERENCED_ITEMS_COLOR);
|
||||
}
|
||||
|
||||
public String getText(IRepositoryViewObject object) {
|
||||
StringBuffer string = new StringBuffer();
|
||||
string.append(object.getLabel());
|
||||
@@ -492,40 +504,15 @@ public class RepositoryLabelProvider extends LabelProvider implements IColorProv
|
||||
@Override
|
||||
public Color getForeground(Object element) {
|
||||
RepositoryNode node = (RepositoryNode) element;
|
||||
try {
|
||||
Bundle bundle = Platform.getBundle(CoreRepositoryPlugin.PLUGIN_ID);
|
||||
BundleContext context = bundle.getBundleContext();
|
||||
ServiceReference ref = context.getServiceReference(IThemeManager.class.getName());
|
||||
IThemeManager manager = (IThemeManager) context.getService(ref);
|
||||
IThemeEngine engine = manager
|
||||
.getEngineForDisplay(PlatformUI.getWorkbench().getActiveWorkbenchWindow() == null ? Display.getCurrent()
|
||||
: PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell().getDisplay());
|
||||
ITheme curTheme = engine.getActiveTheme();
|
||||
if (curTheme.getId().contains("dark")) {
|
||||
return null;
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
ex.printStackTrace();
|
||||
}
|
||||
switch (node.getType()) {
|
||||
case REFERENCED_PROJECT:
|
||||
return STABLE_PRIMARY_ENTRY_COLOR;
|
||||
case STABLE_SYSTEM_FOLDER:
|
||||
if (node.getLabel().equals(ERepositoryObjectType.SNIPPETS.toString())) {
|
||||
return INACTIVE_ENTRY_COLOR;
|
||||
}
|
||||
if (node.getContentType() == ERepositoryObjectType.METADATA) {
|
||||
return STABLE_PRIMARY_ENTRY_COLOR;
|
||||
}
|
||||
case SYSTEM_FOLDER:
|
||||
if (node.getContentType() == ERepositoryObjectType.PROCESS) {
|
||||
return STABLE_PRIMARY_ENTRY_COLOR;
|
||||
}
|
||||
return STABLE_SECONDARY_ENTRY_COLOR;
|
||||
return getStableSecondaryEntryColor();
|
||||
default:
|
||||
ERepositoryStatus repositoryStatus = node.getObject().getRepositoryStatus();
|
||||
if (repositoryStatus == ERepositoryStatus.LOCK_BY_OTHER) {
|
||||
return LOCKED_ENTRY;
|
||||
return getLockedEntryColor();
|
||||
} else {
|
||||
if (PluginChecker.isRefProjectLoaded()) {
|
||||
IReferencedProjectService service = (IReferencedProjectService) GlobalServiceRegister.getDefault()
|
||||
@@ -537,7 +524,7 @@ public class RepositoryLabelProvider extends LabelProvider implements IColorProv
|
||||
.getCurrentProject().getEmfProject();
|
||||
String projectLabel = object.getProjectLabel();
|
||||
if (!mainProject.getLabel().equals(projectLabel)) {
|
||||
return MERGED_REFERENCED_ITEMS_COLOR;
|
||||
return getMergedReferencedItemsColor();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -563,4 +550,43 @@ public class RepositoryLabelProvider extends LabelProvider implements IColorProv
|
||||
refreshProperty = refresh;
|
||||
}
|
||||
|
||||
public static IPropertyChangeListener createPropertyChangeListener(TreeViewer treeViewer) {
|
||||
return new IPropertyChangeListener() {
|
||||
|
||||
@Override
|
||||
public void propertyChange(PropertyChangeEvent event) {
|
||||
String property = event.getProperty();
|
||||
if (property == null) {
|
||||
return;
|
||||
}
|
||||
boolean changed = false;
|
||||
switch (property) {
|
||||
case RepositoryLabelProvider.STABLE_PRIMARY_ENTRY:
|
||||
// case RepositoryLabelProvider.INACTIVE_ENTRY:
|
||||
// case RepositoryLabelProvider.LOCKED_ENTRY:
|
||||
// case RepositoryLabelProvider.MERGED_PREFERENCED_ITEMS:
|
||||
// case RepositoryLabelProvider.STABLE_SECONDARY_ENTRY:
|
||||
changed = true;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (changed) {
|
||||
Display.getDefault().asyncExec(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
if (treeViewer != null) {
|
||||
Control control = treeViewer.getControl();
|
||||
if (!control.isDisposed()) {
|
||||
treeViewer.refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ import org.talend.core.model.utils.CloneConnectionUtils;
|
||||
import org.talend.core.model.utils.ContextParameterUtils;
|
||||
import org.talend.core.utils.TalendQuoteUtils;
|
||||
import org.talend.cwm.helper.ConnectionHelper;
|
||||
import org.talend.cwm.helper.StudioEncryptionHelper;
|
||||
import org.talend.designer.core.model.utils.emf.talendfile.ContextType;
|
||||
import org.talend.model.bridge.ReponsitoryContextBridge;
|
||||
|
||||
@@ -67,6 +68,7 @@ public class StandaloneConnectionContextUtils {
|
||||
String server = getOriginalValue(contextProperties, dbConn.getServerName());
|
||||
String username = getOriginalValue(contextProperties, dbConn.getUsername());
|
||||
String password = getOriginalValue(contextProperties, dbConn.getRawPassword());
|
||||
String originEncryptedPassword = getOriginalValue(contextProperties, dbConn.getPassword());
|
||||
String port = getOriginalValue(contextProperties, dbConn.getPort());
|
||||
String sidOrDatabase = getOriginalValue(contextProperties, dbConn.getSID());
|
||||
String datasource = getOriginalValue(contextProperties, dbConn.getDatasourceName());
|
||||
@@ -87,6 +89,8 @@ public class StandaloneConnectionContextUtils {
|
||||
cloneConn.setDatasourceName(datasource);
|
||||
cloneConn.setDBRootPath(dbRootPath);
|
||||
cloneConn.setFileFieldName(filePath);
|
||||
//To avoid encrypt the same value
|
||||
cloneConn.setPassword(originEncryptedPassword);
|
||||
cloneConn.setRawPassword(password); // the password is raw.
|
||||
cloneConn.setPort(port);
|
||||
cloneConn.setUiSchema(schemaOracle);
|
||||
|
||||
@@ -48,6 +48,8 @@ import org.talend.commons.runtime.model.emf.provider.EmfResourcesFactoryReader;
|
||||
*/
|
||||
public class TalendResourceSet extends ResourceSetImpl {
|
||||
|
||||
private boolean showLog;
|
||||
|
||||
public TalendResourceSet() {
|
||||
super();
|
||||
|
||||
@@ -58,6 +60,14 @@ public class TalendResourceSet extends ResourceSetImpl {
|
||||
getLoadOptions().put(XMLResource.OPTION_USE_DEPRECATED_METHODS, Boolean.FALSE);
|
||||
}
|
||||
|
||||
public boolean isShowLog() {
|
||||
return this.showLog;
|
||||
}
|
||||
|
||||
public void setShowLog(boolean showLog) {
|
||||
this.showLog = showLog;
|
||||
}
|
||||
|
||||
/*
|
||||
* (non-Javadoc)
|
||||
*
|
||||
@@ -83,7 +93,13 @@ public class TalendResourceSet extends ResourceSetImpl {
|
||||
Resource resource = map.get(uri);
|
||||
if (resource != null) {
|
||||
if (loadOnDemand && !resource.isLoaded()) {
|
||||
demandLoadHelper(resource);
|
||||
try {
|
||||
demandLoadHelper(resource);
|
||||
} catch (Exception e) {
|
||||
if (showLog) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
return resource;
|
||||
}
|
||||
@@ -99,7 +115,13 @@ public class TalendResourceSet extends ResourceSetImpl {
|
||||
}
|
||||
if (theURIConverter.normalize(resource.getURI()).equals(normalizedURI)) {
|
||||
if (loadOnDemand && !resource.isLoaded()) {
|
||||
demandLoadHelper(resource);
|
||||
try {
|
||||
demandLoadHelper(resource);
|
||||
} catch (Exception e) {
|
||||
if (showLog) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (map != null) {
|
||||
@@ -125,7 +147,13 @@ public class TalendResourceSet extends ResourceSetImpl {
|
||||
+ "'; a registered resource factory is needed");
|
||||
}
|
||||
|
||||
demandLoadHelper(resource);
|
||||
try {
|
||||
demandLoadHelper(resource);
|
||||
} catch (Exception e) {
|
||||
if (showLog) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}
|
||||
|
||||
if (map != null) {
|
||||
map.put(uri, resource);
|
||||
|
||||
@@ -390,6 +390,10 @@ public class XmiResourceManager {
|
||||
}
|
||||
|
||||
public Resource getItemResource(ResourceSet resourceSet, Item item, boolean forceLoad) {
|
||||
return getItemResource(getResourceSet(), item, forceLoad, false);
|
||||
}
|
||||
|
||||
public Resource getItemResource(ResourceSet resourceSet, Item item, boolean forceLoad, boolean showLog) {
|
||||
if (item == null) {
|
||||
return null;
|
||||
}
|
||||
@@ -402,13 +406,23 @@ public class XmiResourceManager {
|
||||
} else {
|
||||
itemResourceURI = getItemResourceURI(getItemURI(item));
|
||||
}
|
||||
Resource itemResource = resourceSet.getResource(itemResourceURI, false);
|
||||
if (forceLoad && itemResource == null) {
|
||||
if (item instanceof FileItem) {
|
||||
itemResource = new ByteArrayResource(itemResourceURI);
|
||||
resourceSet.getResources().add(itemResource);
|
||||
Resource itemResource = null;
|
||||
try {
|
||||
if (resourceSet instanceof TalendResourceSet) {
|
||||
((TalendResourceSet) resourceSet).setShowLog(showLog);
|
||||
}
|
||||
itemResource = resourceSet.getResource(itemResourceURI, false);
|
||||
if (forceLoad && itemResource == null) {
|
||||
if (item instanceof FileItem) {
|
||||
itemResource = new ByteArrayResource(itemResourceURI);
|
||||
resourceSet.getResources().add(itemResource);
|
||||
}
|
||||
itemResource = resourceSet.getResource(itemResourceURI, true);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (showLog) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
itemResource = resourceSet.getResource(itemResourceURI, true);
|
||||
}
|
||||
return itemResource;
|
||||
}
|
||||
@@ -628,7 +642,7 @@ public class XmiResourceManager {
|
||||
|
||||
boolean isTestContainer = false;
|
||||
if (GlobalServiceRegister.getDefault().isServiceRegistered(ITestContainerProviderService.class)) {
|
||||
ITestContainerProviderService testContainerService = (ITestContainerProviderService) GlobalServiceRegister
|
||||
ITestContainerProviderService testContainerService = GlobalServiceRegister
|
||||
.getDefault().getService(ITestContainerProviderService.class);
|
||||
if (testContainerService != null) {
|
||||
isTestContainer = testContainerService.isTestContainerItem(property.getItem());
|
||||
|
||||
@@ -2,10 +2,12 @@ Manifest-Version: 1.0
|
||||
Bundle-ManifestVersion: 2
|
||||
Bundle-Name: Core Runtime Plug-in
|
||||
Bundle-SymbolicName: org.talend.core.runtime;singleton:=true
|
||||
Automatic-Module-Name: org.talend.core.runtime
|
||||
Bundle-Version: 8.8.8.qualifier
|
||||
Bundle-Localization: plugin
|
||||
Bundle-Vendor: .Talend SA.
|
||||
Export-Package: org.talend.analysistask,
|
||||
Export-Package: org.json.simple,
|
||||
org.talend.analysistask,
|
||||
org.talend.commons.utils.generation,
|
||||
org.talend.commons.utils.io,
|
||||
org.talend.commons.utils.workbench.resources,
|
||||
@@ -117,19 +119,33 @@ Require-Bundle: org.eclipse.jdt.core,
|
||||
org.apache.commons.lang,
|
||||
org.apache.log4j,
|
||||
org.talend.model,
|
||||
org.talend.utils;visibility:=reexport,
|
||||
org.talend.utils,
|
||||
org.talend.libraries.dom4j-jaxen,
|
||||
org.talend.libraries.csv,
|
||||
org.talend.libraries.apache.http,
|
||||
org.talend.commons.runtime;visibility:=reexport,
|
||||
org.talend.commons.runtime,
|
||||
org.talend.commons.ui,
|
||||
org.ops4j.pax.url.mvn,
|
||||
org.talend.components.api,
|
||||
org.apache.servicemix.bundles.avro,
|
||||
jackson-core-asl,
|
||||
org.talend.libraries.jackson,
|
||||
org.eclipse.m2e.core,
|
||||
org.talend.libraries.apache.common
|
||||
org.talend.libraries.apache.common,
|
||||
org.talend.signon.util,
|
||||
org.eclipse.core.runtime,
|
||||
org.talend.studio.studio-utils,
|
||||
org.eclipse.emf.ecore,
|
||||
org.eclipse.core.resources,
|
||||
org.eclipse.emf.ecore.xmi,
|
||||
org.talend.common.ui.runtime,
|
||||
org.talend.cwm.mip,
|
||||
org.talend.daikon,
|
||||
org.talend.libraries.apache,
|
||||
org.apache.commons.lang3,
|
||||
com.fasterxml.jackson.core.jackson-annotations,
|
||||
com.fasterxml.jackson.core.jackson-databind,
|
||||
com.fasterxml.jackson.core.jackson-core,
|
||||
avro;bundle-version="1.11.2"
|
||||
Bundle-Activator: org.talend.core.runtime.CoreRuntimePlugin
|
||||
Bundle-ActivationPolicy: lazy
|
||||
Bundle-ClassPath: .,
|
||||
@@ -138,3 +154,5 @@ Bundle-ClassPath: .,
|
||||
lib/delight-rhino-sandbox-0.0.15.jar,
|
||||
lib/rhino-1.7.13.jar
|
||||
Eclipse-RegisterBuddy: org.talend.testutils
|
||||
Import-Package: org.eclipse.equinox.p2.repository,
|
||||
org.eclipse.equinox.security.storage
|
||||
|
||||
@@ -22,7 +22,8 @@ bin.includes = META-INF/,\
|
||||
plugin_ja.properties,\
|
||||
plugin_ru.properties,\
|
||||
plugin_swtbot.properties,\
|
||||
plugin_zh_CN.properties
|
||||
plugin_zh_CN.properties,\
|
||||
resources/
|
||||
src.includes = META-INF/,\
|
||||
mappingMetadataTypes.xml,\
|
||||
mappings/,\
|
||||
|
||||
216
main/plugins/org.talend.core.runtime/mappings/mapping_Ingres.xml
Normal file
216
main/plugins/org.talend.core.runtime/mappings/mapping_Ingres.xml
Normal file
@@ -0,0 +1,216 @@
|
||||
<?xml version="1.0"?>
|
||||
<mapping>
|
||||
<dbms product="INGRES" id="ingres_id" label="Mapping Ingres"
|
||||
default="true">
|
||||
<dbTypes>
|
||||
<dbType type="ANSIDATE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BOOLEAN" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BIGINT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BYTE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BYTE VARYING" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="C" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="CHAR" ignorePre="true" />
|
||||
<dbType type="DECIMAL" defaultLength="20" defaultPrecision="10" />
|
||||
<dbType type="DATE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="FLOAT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="FLOAT4" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INTEGER" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INGRESDATE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INTERVAL" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="LONG NVARCHAR" ignorePre="true" />
|
||||
<dbType type="LONG VARCHAR" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="MONEY" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="NCHAR" ignorePre="true" defaultLength="10"/>
|
||||
<dbType type="NVARCHAR" ignorePre="true" defaultLength="10"/>
|
||||
<dbType type="OBJECT_KEY" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="SMALLINT" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="TEXT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TINYINT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIME" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIMESTAMP" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="TABLE_KEY" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="VARCHAR" default="true" defaultLength="1200" ignorePre="true"/>
|
||||
</dbTypes>
|
||||
|
||||
<language name="java">
|
||||
<talendToDbTypes><!-- Adviced mappings -->
|
||||
<talendType type="id_List"/>
|
||||
<talendType type="id_Boolean">
|
||||
<dbType type="BOOLEAN" default="true" />
|
||||
</talendType>
|
||||
<talendType type="id_Byte">
|
||||
<dbType type="BYTE" default="true" />
|
||||
<dbType type="BYTE VARYING" />
|
||||
</talendType>
|
||||
<talendType type="id_byte[]">
|
||||
</talendType>
|
||||
<talendType type="id_Character">
|
||||
<dbType type="CHAR" default="true" />
|
||||
<dbType type="VARCHAR"/>
|
||||
<dbType type="C"/>
|
||||
<dbType type="TEXT"/>
|
||||
<dbType type="LONG VARCHAR"/>
|
||||
<dbType type="NCHAR"/>
|
||||
<dbType type="NVARCHAR"/>
|
||||
<dbType type="LONG NVARCHAR"/>
|
||||
</talendType>
|
||||
<talendType type="id_Date">
|
||||
<dbType type="DATE" default="true" />
|
||||
<dbType type="ANSIDATE" />
|
||||
<dbType type="INGRESDATE" />
|
||||
<dbType type="TIME" />
|
||||
<dbType type="TIMESTAMP" />
|
||||
<dbType type="INTERVAL"/>
|
||||
</talendType>
|
||||
<talendType type="id_BigDecimal">
|
||||
<dbType type="DECIMAL" default="true" />
|
||||
<dbType type="FLOAT4" />
|
||||
<dbType type="FLOAT"/>
|
||||
<dbType type="MONEY"/>
|
||||
</talendType>
|
||||
<talendType type="id_Double">
|
||||
<dbType type="FLOAT" default="true" />
|
||||
<dbType type="FLOAT4" />
|
||||
<dbType type="DECIMAL"/>
|
||||
<dbType type="MONEY"/>
|
||||
</talendType>
|
||||
<talendType type="id_Float">
|
||||
<dbType type="FLOAT4" default="true" />
|
||||
<dbType type="FLOAT"/>
|
||||
<dbType type="DECIMAL" />
|
||||
<dbType type="MONEY"/>
|
||||
</talendType>
|
||||
<talendType type="id_Integer">
|
||||
<dbType type="INTEGER" default="true" />
|
||||
<dbType type="BIGINT" />
|
||||
<dbType type="SMALLINT"/>
|
||||
<dbType type="TINYINT"/>
|
||||
</talendType>
|
||||
<talendType type="id_Long">
|
||||
<dbType type="BIGINT" default="true" />
|
||||
<dbType type="INTEGER"/>
|
||||
<dbType type="SMALLINT"/>
|
||||
<dbType type="TINYINT"/>
|
||||
</talendType>
|
||||
<talendType type="id_Object">
|
||||
<dbType type="MONEY" default="true"/>
|
||||
<dbType type="OBJECT_KEY" />
|
||||
<dbType type="TABLE_KEY" />
|
||||
</talendType>
|
||||
<talendType type="id_Short">
|
||||
<dbType type="SMALLINT" default="true" />
|
||||
<dbType type="INTEGER" />
|
||||
<dbType type="BIGINT"/>
|
||||
<dbType type="TINYINT" />
|
||||
</talendType>
|
||||
<talendType type="id_String">
|
||||
<dbType type="VARCHAR" default="true" />
|
||||
<dbType type="LONG VARCHAR" />
|
||||
<dbType type="NCHAR"/>
|
||||
<dbType type="NVARCHAR" />
|
||||
<dbType type="LONG NVARCHAR" />
|
||||
<dbType type="TEXT" />
|
||||
<dbType type="C"/>
|
||||
<dbType type="CHAR"/>
|
||||
</talendType>
|
||||
</talendToDbTypes>
|
||||
<dbToTalendTypes>
|
||||
<dbType type="ANSIDATE">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BOOLEAN">
|
||||
<talendType type="id_Boolean" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BIGINT">
|
||||
<talendType type="id_Long" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BYTE">
|
||||
<talendType type="id_Byte" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BYTE VARYING">
|
||||
<talendType type="id_Byte" default="true" />
|
||||
</dbType>
|
||||
<dbType type="C">
|
||||
<talendType type="id_String" default="true" />
|
||||
<talendType type="id_Character"/>
|
||||
</dbType>
|
||||
<dbType type="CHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
<talendType type="id_Character"/>
|
||||
</dbType>
|
||||
<dbType type="DECIMAL">
|
||||
<talendType type="id_Float"/>
|
||||
<talendType type="id_BigDecimal" default="true"/>
|
||||
</dbType>
|
||||
<dbType type="DATE">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="FLOAT">
|
||||
<talendType type="id_Double" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="FLOAT4">
|
||||
<talendType type="id_Float" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="INTEGER">
|
||||
<talendType type="id_Integer" default="true" />
|
||||
<talendType type="id_Long"/>
|
||||
<talendType type="id_Short"/>
|
||||
</dbType>
|
||||
<dbType type="INGRESDATE">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="INTERVAL">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="LONG NVARCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="LONG VARCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="MONEY">
|
||||
<talendType type="id_Float" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="NCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="NVARCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="OBJECT_KEY">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="SMALLINT">
|
||||
<talendType type="id_Short" default="true" />
|
||||
<talendType type="id_Integer" />
|
||||
<talendType type="id_Long"/>
|
||||
</dbType>
|
||||
<dbType type="TEXT">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TINYINT">
|
||||
<talendType type="id_Byte" default="true" />
|
||||
<talendType type="id_Integer" />
|
||||
<talendType type="id_Short"/>
|
||||
<talendType type="id_Long" />
|
||||
</dbType>
|
||||
<dbType type="TIME">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TIMESTAMP">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TABLE_KEY">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="VARCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
</dbToTalendTypes>
|
||||
</language>
|
||||
</dbms>
|
||||
|
||||
</mapping>
|
||||
@@ -0,0 +1,211 @@
|
||||
<?xml version="1.0"?>
|
||||
<mapping>
|
||||
<dbms product="VECTORWISE" id="vectorwise_id" label="Mapping VectorWise"
|
||||
default="true">
|
||||
<dbTypes>
|
||||
<dbType type="ANSIDATE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BIGINT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BYTE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="BYTE VARYING" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="C" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="CHAR" ignorePre="true" />
|
||||
<dbType type="DECIMAL" defaultLength="20" defaultPrecision="10" />
|
||||
<dbType type="DATE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="FLOAT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="FLOAT4" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INTEGER" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INGRESDATE" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="INTERVAL" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="LONG NVARCHAR" ignorePre="true" />
|
||||
<dbType type="LONG VARCHAR" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="MONEY" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="NCHAR" ignorePre="true" defaultLength="10"/>
|
||||
<dbType type="NVARCHAR" ignorePre="true" defaultLength="10"/>
|
||||
<dbType type="OBJECT_KEY" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="SMALLINT" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="TEXT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TINYINT" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIME" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="TIMESTAMP" ignoreLen="true" ignorePre="true"/>
|
||||
<dbType type="TABLE_KEY" ignoreLen="true" ignorePre="true" />
|
||||
<dbType type="VARCHAR" default="true" defaultLength="1200" ignorePre="true"/>
|
||||
</dbTypes>
|
||||
|
||||
<language name="java">
|
||||
<talendToDbTypes><!-- Adviced mappings -->
|
||||
<talendType type="id_List"/>
|
||||
<talendType type="id_Boolean">
|
||||
</talendType>
|
||||
<talendType type="id_Byte">
|
||||
<dbType type="BYTE" default="true" />
|
||||
<dbType type="BYTE VARYING" />
|
||||
</talendType>
|
||||
<talendType type="id_byte[]">
|
||||
</talendType>
|
||||
<talendType type="id_Character">
|
||||
<dbType type="CHAR" default="true" />
|
||||
<dbType type="VARCHAR"/>
|
||||
<dbType type="C"/>
|
||||
<dbType type="TEXT"/>
|
||||
<dbType type="LONG VARCHAR"/>
|
||||
<dbType type="NCHAR"/>
|
||||
<dbType type="NVARCHAR"/>
|
||||
<dbType type="LONG NVARCHAR"/>
|
||||
</talendType>
|
||||
<talendType type="id_Date">
|
||||
<dbType type="ANSIDATE" default="true"/>
|
||||
<dbType type="DATE"/>
|
||||
<dbType type="INGRESDATE" />
|
||||
<dbType type="TIME" />
|
||||
<dbType type="TIMESTAMP" />
|
||||
<dbType type="INTERVAL"/>
|
||||
</talendType>
|
||||
<talendType type="id_BigDecimal">
|
||||
<dbType type="DECIMAL" default="true" />
|
||||
<dbType type="FLOAT4" />
|
||||
<dbType type="FLOAT"/>
|
||||
<dbType type="MONEY"/>
|
||||
</talendType>
|
||||
<talendType type="id_Double">
|
||||
<dbType type="FLOAT" default="true" />
|
||||
<dbType type="FLOAT4" />
|
||||
<dbType type="DECIMAL"/>
|
||||
<dbType type="MONEY"/>
|
||||
</talendType>
|
||||
<talendType type="id_Float">
|
||||
<dbType type="FLOAT4" default="true" />
|
||||
<dbType type="FLOAT"/>
|
||||
<dbType type="DECIMAL" />
|
||||
<dbType type="MONEY"/>
|
||||
</talendType>
|
||||
<talendType type="id_Integer">
|
||||
<dbType type="INTEGER" default="true" />
|
||||
<dbType type="BIGINT" />
|
||||
<dbType type="SMALLINT"/>
|
||||
<dbType type="TINYINT"/>
|
||||
</talendType>
|
||||
<talendType type="id_Long">
|
||||
<dbType type="BIGINT" default="true" />
|
||||
<dbType type="INTEGER"/>
|
||||
<dbType type="SMALLINT"/>
|
||||
<dbType type="TINYINT"/>
|
||||
</talendType>
|
||||
<talendType type="id_Object">
|
||||
<dbType type="MONEY" default="true"/>
|
||||
<dbType type="OBJECT_KEY" />
|
||||
<dbType type="TABLE_KEY" />
|
||||
</talendType>
|
||||
<talendType type="id_Short">
|
||||
<dbType type="SMALLINT" default="true" />
|
||||
<dbType type="INTEGER" />
|
||||
<dbType type="BIGINT"/>
|
||||
<dbType type="TINYINT" />
|
||||
</talendType>
|
||||
<talendType type="id_String">
|
||||
<dbType type="VARCHAR" default="true" />
|
||||
<dbType type="LONG VARCHAR" />
|
||||
<dbType type="NCHAR"/>
|
||||
<dbType type="NVARCHAR" />
|
||||
<dbType type="LONG NVARCHAR" />
|
||||
<dbType type="TEXT" />
|
||||
<dbType type="C"/>
|
||||
<dbType type="CHAR"/>
|
||||
</talendType>
|
||||
</talendToDbTypes>
|
||||
<dbToTalendTypes>
|
||||
<dbType type="ANSIDATE">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BIGINT">
|
||||
<talendType type="id_Long" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BYTE">
|
||||
<talendType type="id_Byte" default="true" />
|
||||
</dbType>
|
||||
<dbType type="BYTE VARYING">
|
||||
<talendType type="id_Byte" default="true" />
|
||||
</dbType>
|
||||
<dbType type="C">
|
||||
<talendType type="id_String" default="true" />
|
||||
<talendType type="id_Character"/>
|
||||
</dbType>
|
||||
<dbType type="CHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
<talendType type="id_Character"/>
|
||||
</dbType>
|
||||
<dbType type="DECIMAL">
|
||||
<talendType type="id_Float"/>
|
||||
<talendType type="id_BigDecimal" default="true"/>
|
||||
</dbType>
|
||||
<dbType type="DATE">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="FLOAT">
|
||||
<talendType type="id_Double" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="FLOAT4">
|
||||
<talendType type="id_Float" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="INTEGER">
|
||||
<talendType type="id_Integer" default="true" />
|
||||
<talendType type="id_Long"/>
|
||||
<talendType type="id_Short"/>
|
||||
</dbType>
|
||||
<dbType type="INGRESDATE">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="INTERVAL">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="LONG NVARCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="LONG VARCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="MONEY">
|
||||
<talendType type="id_Float" default="true" />
|
||||
<talendType type="id_BigDecimal"/>
|
||||
</dbType>
|
||||
<dbType type="NCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="NVARCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="OBJECT_KEY">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="SMALLINT">
|
||||
<talendType type="id_Short" default="true" />
|
||||
<talendType type="id_Integer" />
|
||||
<talendType type="id_Long"/>
|
||||
</dbType>
|
||||
<dbType type="TEXT">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TINYINT">
|
||||
<talendType type="id_Byte" default="true" />
|
||||
<talendType type="id_Integer" />
|
||||
<talendType type="id_Short"/>
|
||||
<talendType type="id_Long" />
|
||||
</dbType>
|
||||
<dbType type="TIME">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TIMESTAMP">
|
||||
<talendType type="id_Date" default="true" />
|
||||
</dbType>
|
||||
<dbType type="TABLE_KEY">
|
||||
<talendType type="id_Object" default="true" />
|
||||
</dbType>
|
||||
<dbType type="VARCHAR">
|
||||
<talendType type="id_String" default="true" />
|
||||
</dbType>
|
||||
</dbToTalendTypes>
|
||||
</language>
|
||||
</dbms>
|
||||
|
||||
</mapping>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user