Compare commits

..

4 Commits

Author SHA1 Message Date
bhe-talendbj
56ce038b70 fix(TUP-36730): run command in UI thread 2022-09-22 11:49:38 +08:00
kjwang
fb0ee1ba3f Fix: TUP-36714 Improve the code for SSO feature (#8012) (#8017)
* Fix: TUP-36714 Improve the code for SSO feature
https://jira.talendforge.org/browse/TUP-36714
2022-09-21 13:06:48 +08:00
pyzhou
5b39231455 fix(TDI-48321): tSCP components cannot work with redhat server (#7951)
* fix(TDI-48321): tSCP components cannot work with redhat server

* fix wron /n

* fix tssh compile error

* fix NPE
2022-09-21 12:04:18 +08:00
Oleksandr Zhelezniak
aae4ed766e fix(TDI-48495): support dieOnError in tS3List (#7977) 2022-09-19 10:01:18 +03:00
14 changed files with 169 additions and 160 deletions

View File

@@ -11,6 +11,7 @@ imports="
CodeGeneratorArgument codeGenArgument = (CodeGeneratorArgument) argument;
INode node = (INode)codeGenArgument.getArgument();
String cid = node.getUniqueName();
String dieOnError = ElementParameterParser.getValue(node, "__DIE_ON_ERROR__");
%>
<%@ include file="../tS3Connection/S3Client.javajet" %>
@@ -37,21 +38,25 @@ imports="
try{
objects_<%=cid%> = conn_<%=cid%>.listObjects(currentBucketName_<%=cid%>,<%=objects_prefix!=null && objects_prefix.trim().length()>0 ?objects_prefix:null%>);
}catch(com.amazonaws.AmazonClientException e_<%=cid%>){
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
<%
if(isLog4jEnabled){
if (("true").equals(dieOnError)) {
%>
log.warn("<%=cid%> - Failed to list objects from bucket "+currentBucketName_<%=cid%>);
log.warn("<%=cid%> - "+e_<%=cid%>.getMessage());
throw(e_<%=cid%>);
<%
}else{
%>
System.err.println("WARNING: [<%=cid%>] failed to list objects from bucket "+currentBucketName_<%=cid%>);
System.err.println("WARNING: [<%=cid%>] "+e_<%=cid%>.getMessage());
<%
}
%>
continue;
} else {
if(isLog4jEnabled){
%>
log.warn("<%=cid%> - Failed to list objects from bucket "+currentBucketName_<%=cid%>);
log.warn("<%=cid%> - "+e_<%=cid%>.getMessage());
<%
}else{
%>
System.err.println("WARNING: [<%=cid%>] failed to list objects from bucket "+currentBucketName_<%=cid%>);
System.err.println("WARNING: [<%=cid%>] "+e_<%=cid%>.getMessage());
<%}%>
continue;
<%}%>
}
<%
} else if(buckets.size()>0){
@@ -94,21 +99,25 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
%>
objects_<%=cid%> = conn_<%=cid%>.listObjects(currentBucketName_<%=cid%>,currentPrefix_<%=cid%>);
}catch(com.amazonaws.AmazonClientException e_<%=cid%>){
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
<%
if(isLog4jEnabled){
if (("true").equals(dieOnError)) {
%>
log.warn("<%=cid%> - Failed to list objects from bucket "+currentBucketName_<%=cid%>);
log.warn("<%=cid%> - "+e_<%=cid%>.getMessage());
throw(e_<%=cid%>);
<%
}else{
%>
System.err.println("WARNING: [<%=cid%>] failed to list objects from bucket "+currentBucketName_<%=cid%>);
System.err.println("WARNING: [<%=cid%>] "+e_<%=cid%>.getMessage());
<%
}
%>
continue;
} else {
if(isLog4jEnabled){
%>
log.warn("<%=cid%> - Failed to list objects from bucket "+currentBucketName_<%=cid%>);
log.warn("<%=cid%> - "+e_<%=cid%>.getMessage());
<%
}else{
%>
System.err.println("WARNING: [<%=cid%>] failed to list objects from bucket "+currentBucketName_<%=cid%>);
System.err.println("WARNING: [<%=cid%>] "+e_<%=cid%>.getMessage());
<%}%>
continue;
<%}%>
}
<%
}
@@ -142,4 +151,4 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
%>
<%
}
%>
%>

View File

@@ -30,7 +30,7 @@ imports="
}
%>
}catch(com.amazonaws.AmazonClientException e_<%=cid%>){
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
<%
if (("true").equals(dieOnError)) {
%>
@@ -65,4 +65,4 @@ globalMap.put("<%=cid%>_ERROR_MESSAGE",e_<%=cid%>.getMessage());
log.info("<%=cid%> - Retrieved the objects count: " + nb_bucket_object_<%=cid%> + " .");
<%
}
%>
%>

View File

@@ -137,7 +137,11 @@ imports="
<%
if (("PUBLICKEY").equals(authMethod)) {
%>
try {
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
} catch (java.lang.Exception e) {
//ignore
}
<%}%>
if(14 == se_<%=cid%>.getDisconnectCode()){
throw new IllegalArgumentException("Authentication failed.");

View File

@@ -51,22 +51,29 @@ imports="
log.debug("Execute command: "+ rmCmd_<%= cid %>);
<%}%>
org.apache.sshd.client.channel.ClientChannel channel_<%=cid %> = session_<%=cid %>.createExecChannel((command_<%=cid %>).toString());
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
channel_<%=cid%>.setOut(stdout_<%=cid %>);
channel_<%=cid%>.setErr(stderr_<%=cid %>);
channel_<%=cid%>.open();
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
channel_<%=cid%>.close();
<%if(isLog4jEnabled){%>
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
<%}%>
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
channel_<%=cid%>.close();
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);
@@ -79,6 +86,7 @@ imports="
<% if(dieOnError){ %>
StringBuilder errMsg_<%= cid %> = new StringBuilder("File(s) deleting failed.");
if(clientChannelEvents_<%=cid %>.contains(org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS)){
if (exit_code_<%= cid %> != 0) {
isCmdFailed_<%= cid %> = true;

View File

@@ -167,7 +167,11 @@ imports="
<%
if (("PUBLICKEY").equals(authMethod)) {
%>
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
try {
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
} catch (java.lang.Exception e) {
//ignore
}
<%}%>
if(14 == se_<%=cid%>.getDisconnectCode()){
throw new IllegalArgumentException("Authentication failed.");

View File

@@ -50,22 +50,27 @@ imports="
<%}%>
org.apache.sshd.client.channel.ClientChannel channel_<%=cid %> = session_<%=cid %>.createExecChannel((command_<%=cid %>).toString());
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
channel_<%=cid%>.setOut(stdout_<%=cid %>);
channel_<%=cid%>.setErr(stderr_<%=cid %>);
channel_<%=cid%>.open();
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
channel_<%=cid%>.close();
<%if(isLog4jEnabled){%>
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
<%}%>
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
channel_<%=cid%>.close();
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);

View File

@@ -162,7 +162,11 @@ imports="
<%
if (("PUBLICKEY").equals(authMethod)) {
%>
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
try {
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
} catch (java.lang.Exception e) {
//ignore
}
<%}%>
if(14 == se_<%=cid%>.getDisconnectCode()){
throw new IllegalArgumentException("Authentication failed.");
@@ -191,22 +195,26 @@ imports="
StringBuilder stringStdout_<%=cid%> =new StringBuilder();
StringBuilder stringStderr_<%=cid%> =new StringBuilder();
Integer exit_code_<%=cid%> = null;
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
channel_<%=cid%>.setOut(stdout_<%=cid %>);
channel_<%=cid%>.setErr(stderr_<%=cid %>);
channel_<%=cid%>.open();
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
channel_<%=cid%>.close();
<%if(isLog4jEnabled){%>
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
<%}%>
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
channel_<%=cid%>.close();
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);

View File

@@ -31,22 +31,29 @@ imports="
//execute the command
org.apache.sshd.client.channel.ClientChannel channel_<%=cid %> = session_<%=cid %>.createExecChannel((command_<%=cid %>).toString());
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
channel_<%=cid%>.setOut(stdout_<%=cid %>);
channel_<%=cid%>.setErr(stderr_<%=cid %>);
channel_<%=cid%>.open();
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
channel_<%=cid%>.close();
<%if(isLog4jEnabled){%>
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
<%}%>
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
channel_<%=cid%>.close();
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);

View File

@@ -50,7 +50,11 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
<%
if (("PUBLICKEY").equals(authMethod)) {
%>
try {
java.nio.file.Files.write(privateKey_<%=cid%>,lines_<%=cid%>);
} catch (java.lang.Exception e) {
//ignore
}
<%}%>
if(14 == se_<%=cid%>.getDisconnectCode()){
throw new IllegalArgumentException("Authentication failed.");
@@ -78,7 +82,12 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
}
%>
cmd_<%=cid%>.append("exit\n");
channel_<%=cid%>.setIn(new java.io.ByteArrayInputStream(cmd_<%=cid%>.toString().getBytes()));
channel_<%=cid%>.open().verify(<%=("true").equals(useTimeout)?timeout + " * 1000L":""%>);
final java.io.OutputStream invertedIn_<%=cid%> = channel_<%=cid%>.getInvertedIn();
invertedIn_<%=cid%>.write(cmd_<%=cid%>.toString().getBytes());
invertedIn_<%=cid%>.flush();
invertedIn_<%=cid%>.close();
<%
}else{
if(commands.size() > 0){
@@ -97,6 +106,7 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
}
%>
channel_<%=cid %> = session_<%=cid %>.createExecChannel((command_<%=cid %>).toString());
channel_<%=cid%>.open();
@@ -110,29 +120,41 @@ if ((metadatas!=null)&&(metadatas.size()>0)) {
<%
}
%>
java.io.ByteArrayOutputStream stdout_<%=cid %> = new java.io.ByteArrayOutputStream();
java.io.ByteArrayOutputStream stderr_<%=cid %> = new java.io.ByteArrayOutputStream();
channel_<%=cid%>.setOut(stdout_<%=cid %>);
channel_<%=cid%>.setErr(stderr_<%=cid %>);
channel_<%=cid%>.open();
java.util.Set<org.apache.sshd.client.channel.ClientChannelEvent> clientChannelEvents_<%=cid %> =
channel_<%=cid%>.waitFor(java.util.EnumSet.of(
org.apache.sshd.client.channel.ClientChannelEvent.CLOSED,org.apache.sshd.client.channel.ClientChannelEvent.EXIT_STATUS), 0L);
exit_code_<%=cid%> = channel_<%=cid%>.getExitStatus();
channel_<%=cid%>.close();
session_<%=cid%>.close();
<%if(isLog4jEnabled){%>
log.debug("Channel Events: "+ java.util.Arrays.toString(clientChannelEvents_<%=cid %>.toArray()));
<%}%>
stringStdout_<%=cid%>.append(stdout_<%=cid%>.toString());
stringStderr_<%=cid%>.append(stderr_<%=cid%>.toString());
final java.io.InputStream invertedOut_<%=cid%> = channel_<%=cid%>.getInvertedOut();
final List<String> outLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedOut_<%=cid%>);
final java.io.InputStream invertedErr_<%=cid%> = channel_<%=cid%>.getInvertedErr();
final List<String> errorLines_<%=cid%> = org.apache.sshd.common.util.io.IoUtils.readAllLines(invertedErr_<%=cid%>);
stringStdout_<%=cid%>.append(outLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
stringStderr_<%=cid%>.append(errorLines_<%=cid%>.stream().collect(java.util.stream.Collectors.joining("\n")));
channel_<%=cid%>.close();
session_<%=cid%>.close();
if(stringStdout_<%=cid%>.length() >0 && stringStdout_<%=cid%>.charAt(stringStdout_<%=cid%>.length()-1) == '\n'){
stringStdout_<%=cid%>.deleteCharAt(stringStdout_<%=cid%>.length()-1);
}
out_content_<%=cid%> = stringStdout_<%=cid%>.toString();
err_content_<%=cid%> = stringStderr_<%=cid%>.toString();
<%if(isLog4jEnabled){%>
log.debug("<%=cid%> - Command line standard result: " + out_content_<%=cid%>);
log.debug("<%=cid%> - Command line error result: " + err_content_<%=cid%>);

View File

@@ -121,6 +121,7 @@ import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.IEditorInput;
@@ -1209,19 +1210,22 @@ public abstract class AbstractTalendEditor extends GraphicalEditorWithFlyoutPale
@Override
public void commandStackChanged(final EventObject event) {
if (isDirty()) {
if (!this.savePreviouslyNeeded) {
// remove all error status at any change of the job .
removeErrorStatusIfDirty();
this.savePreviouslyNeeded = true;
Display.getDefault().syncExec(() -> {
if (isDirty()) {
if (!this.savePreviouslyNeeded) {
// remove all error status at any change of the job .
removeErrorStatusIfDirty();
this.savePreviouslyNeeded = true;
firePropertyChange(IEditorPart.PROP_DIRTY);
}
checkSaveAsEnabled();
} else {
savePreviouslyNeeded = false;
firePropertyChange(IEditorPart.PROP_DIRTY);
}
checkSaveAsEnabled();
} else {
savePreviouslyNeeded = false;
firePropertyChange(IEditorPart.PROP_DIRTY);
}
super.commandStackChanged(event);
super.commandStackChanged(event);
});
}
private void checkSaveAsEnabled() {

View File

@@ -12,7 +12,6 @@
// ============================================================================
package org.talend.designer.core.ui.editor;
import org.apache.commons.lang3.StringUtils;
import org.eclipse.draw2d.ColorConstants;
import org.eclipse.draw2d.FreeformFigure;
import org.eclipse.draw2d.Graphics;
@@ -20,9 +19,9 @@ import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.editparts.GridLayer;
import org.eclipse.swt.graphics.Color;
import org.talend.commons.exception.ExceptionHandler;
import org.talend.commons.runtime.service.ITalendThemeService;
import org.talend.commons.ui.gmf.draw2d.AnimatableZoomManager;
import org.talend.commons.ui.runtime.image.EImage;
import org.talend.commons.ui.runtime.image.ImageProvider;
/**
* Grid that will be used for the designer. (modification of the default grid to have black points)
@@ -34,64 +33,9 @@ public class TalendGridLayer extends GridLayer {
public static final Color GRID_COLOR = ColorConstants.black;
private static final Color GRID_COLOR_1 = new Color(131, 131, 131);
private static final Color GRID_COLOR_2 = new Color(255, 255, 255);
private static ITalendThemeService themeServ;
public TalendGridLayer() {
super();
setForegroundColor(ColorConstants.red);
}
private static ITalendThemeService getTheme() {
if (themeServ == null) {
themeServ = ITalendThemeService.get();
}
return themeServ;
}
private Color getThemeColor(String prop) {
ITalendThemeService theme = getTheme();
if (theme == null) {
return null;
}
return (Color) theme.getGlobalThemeColor(prop);
}
private Color getColor1() {
Color themeColor = getThemeColor("DESIGNER_COLOR_A");
if (themeColor == null) {
themeColor = GRID_COLOR_1;
}
return themeColor;
}
private Color getColor2() {
Color themeColor = getThemeColor("DESIGNER_COLOR_B");
if (themeColor == null) {
themeColor = GRID_COLOR_2;
}
return themeColor;
}
private int getColorAlpha() {
final int defaultAlpha = 30;
ITalendThemeService theme = getTheme();
if (theme == null) {
return defaultAlpha;
}
String alpha = theme.getGlobalThemeProp("DESIGNER_COLOR_ALPHA");
if (StringUtils.isBlank(alpha)) {
return defaultAlpha;
}
try {
return Integer.valueOf(alpha);
} catch (Exception e) {
ExceptionHandler.process(e);
}
return defaultAlpha;
setForegroundColor(GRID_COLOR);
}
@Override
@@ -127,18 +71,13 @@ public class TalendGridLayer extends GridLayer {
origin.y += distanceY;
}
}
g.setAlpha(getColorAlpha());
for (int i = origin.x - distanceX; i < clip.x + clip.width; i += distanceX) {
for (int j = origin.y - distanceY; j < clip.y + clip.height; j += distanceY) {
// g.drawPoint(i, j);
// g.drawPoint(i, j);
int re = Math.abs(i - j);
if (re / distanceY % 2 == 0) {
g.setBackgroundColor(getColor1());
// g.drawImage(ImageProvider.getImage(EImage.CHESS_GRAY), i, j);
} else {
g.setBackgroundColor(getColor2());
g.drawImage(ImageProvider.getImage(EImage.CHESS_GRAY), i, j);
}
g.fillRectangle(i, j, 32, 32);
}
}
}

View File

@@ -107,8 +107,6 @@ public class TalendDrawerFigure extends DrawerFigure {
drawerLabelField.setAccessible(true);
talendDrawerLabel = new Label();
talendDrawerLabel.setFont(JFaceResources.getFontRegistry().getBold("TalendDrawerFigureSymbolicName"));
// TUP-35745
talendDrawerLabel.setForegroundColor(cssStyleSetting.getMouseOverForgroundColor3());
talendDrawerLabel.setLabelAlignment(Label.LEFT);
drawerLabelField.set(this, talendDrawerLabel);

View File

@@ -80,8 +80,6 @@ public class TalendEntryEditPart extends ToolEntryEditPart {
customLabelField = ToolEntryEditPart.class.getDeclaredField("customLabel"); //$NON-NLS-1$
customLabelField.setAccessible(true);
customLabelField.set(this, talendCustomLabel);
// TUP-35745
talendCustomLabel.setForegroundColor(cssStyleSetting.getMouseOverForgroundColor3());
} catch (Exception e) {
CommonExceptionHandler.process(e);
}

View File

@@ -83,6 +83,7 @@ import org.talend.signon.util.TMCRepositoryUtil;
import org.talend.signon.util.TokenMode;
import org.talend.signon.util.listener.LoginEventListener;
import org.talend.utils.json.JSONObject;
import org.talend.utils.string.DigestUtil;
public class LoginWithCloudPage extends AbstractLoginActionPage implements LoginEventListener {
@@ -402,6 +403,10 @@ public class LoginWithCloudPage extends AbstractLoginActionPage implements Login
});
try {
TokenMode token = ICloudSignOnService.get().getToken(authCode, this.codeVerifier, dataCenter);
if (CommonsPlugin.isDebugMode()) {
LOGGER.info("Access token SHA256 is:"
+ DigestUtil.sha256Hex(token.getAccessToken().getBytes()) + "\t Refresh token SHA256 is:" + DigestUtil.sha256Hex(token.getRefreshToken().getBytes()));
}
ConnectionBean conn = saveConnection(token, TMCRepositoryUtil.getCloudAdminURL(dataCenter),
ICloudSignOnService.get().getTokenUser(TMCRepositoryUtil.getCloudAdminURL(dataCenter), token));
if (isRefreshToken) {
@@ -571,7 +576,7 @@ public class LoginWithCloudPage extends AbstractLoginActionPage implements Login
private void removeSSOConnection() {
ConnectionUserPerReader reader = ConnectionUserPerReader.getInstance();
List<ConnectionBean> list = reader.readConnections();
List<ConnectionBean> list = reader.forceReadConnections();
Iterator<ConnectionBean> connectionBeanIter = list.iterator();
while (connectionBeanIter.hasNext()) {
if (connectionBeanIter.next().isLoginViaCloud()) {
@@ -584,18 +589,16 @@ public class LoginWithCloudPage extends AbstractLoginActionPage implements Login
private ConnectionBean saveConnection(TokenMode token, String adminURL, String user) {
ConnectionUserPerReader reader = ConnectionUserPerReader.getInstance();
List<ConnectionBean> list = reader.readConnections();
ConnectionBean connection = null;
for (ConnectionBean bean : list) {
if (bean.isLoginViaCloud()) {
connection = bean;
break;
List<ConnectionBean> list = reader.forceReadConnections();
Iterator<ConnectionBean> connectionBeanIter = list.iterator();
while (connectionBeanIter.hasNext()) {
if (connectionBeanIter.next().isLoginViaCloud()) {
connectionBeanIter.remove();
}
}
if (connection == null) {
connection = ConnectionBean.getDefaultCloudConnectionBean(token.getDataCenter());
list.add(connection);
}
ConnectionBean connection = ConnectionBean.getDefaultCloudConnectionBean(token.getDataCenter());
list.add(connection);
connection.setConnectionToken(token);
connection.setUrl(adminURL);
connection.setUser(user);