use of org.eclipse.swt.custom.StyledText in project tdi-studio-se by Talend.
the class ErrorMessageDialog method createDialogArea.
@Override
protected Control createDialogArea(Composite parent) {
Composite createDialogArea = (Composite) super.createDialogArea(parent);
createDialogArea.setLayout(new FillLayout());
sashForm = new SashForm(createDialogArea, SWT.VERTICAL);
GridLayout sashGrid = new GridLayout();
sashGrid.numColumns = 5;
sashForm.setLayout(sashGrid);
sashForm.setSize(400, 200);
sashForm.pack();
// Composite comSimple = new Composite(sashForm, SWT.NONE);
// comSimple.pack();
// GridLayout simGrid = new GridLayout();
// simGrid.numColumns = 10;
// comSimple.setLayout(simGrid);
// imageLable = new Label(comSimple, SWT.WRAP);
// imageLable.setImage(ImageProvider.getImage(EImage.ERRORSIMPLEMESS_ICON));
// GridData imaData = new GridData(GridData.FILL_VERTICAL);
// imaData.horizontalSpan = 5;
// imageLable.setLayoutData(imaData);
// imageLable.pack();
// titleLable = new Label(comSimple, SWT.WRAP);
// GridData titleData = new GridData(GridData.FILL_BOTH);
// titleData.horizontalSpan = 5;
// titleLable.setLayoutData(titleData);
// titleLable.pack();
// String str[] = content.split("\n");//$NON-NLS-1$
// String simpleMess;
// if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.PERL)) {
// if (mergeNode.isCheckProperty()) {
// simpleMess = Messages.getString("ErrorMessageDialog.property_error") + mergeNode.getUniqueName(); //$NON-NLS-1$
// } else {
// if (str.length >= 1) {
// simpleMess = content.split("\n")[0];//$NON-NLS-1$
// } else {
// simpleMess = Messages.getString("ErrorMessageDialog.EXCEP_IN_COM") + mergeNode.getUniqueName();//$NON-NLS-1$
// }
// }
// titleLable.setText(simpleMess);
//
// } else if (LanguageManager.getCurrentLanguage().equals(ECodeLanguage.JAVA)) {
// if (mergeNode.isCheckProperty()) {
// simpleMess = Messages.getString("ErrorMessageDialog.property_error") + mergeNode.getUniqueName(); //$NON-NLS-1$
// } else {
// if (str.length >= 2) {
// simpleMess = content.split("\n")[0] + "\n" + content.split("\n")[1];//$NON-NLS-1$//$NON-NLS-1$//$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
// } else {
// simpleMess = Messages.getString("ErrorMessageDialog.EXCEP_IN_COM") + mergeNode.getUniqueName();//$NON-NLS-1$
// }
// }
// titleLable.setText(simpleMess);
// }
//
// Composite comDetail = new Composite(sashForm, SWT.NONE);
// GridLayout detailGrid = new GridLayout();
// detailGrid.numColumns = 15;
// comDetail.setLayout(detailGrid);
// GridData dataBut = new GridData();
// dataBut.horizontalSpan = 15;
// button = new CLabel(comDetail, SWT.FLAT);
// button.pack();
// button.setText(Messages.getString("ErrorMessageDialog.DETAIL")); //$NON-NLS-1$
// button.setImage(ImageProvider.getImage(EImage.RIGHTPRESS_ICON));
textArea = new StyledText(sashForm, SWT.BORDER | SWT.WRAP | SWT.H_SCROLL | SWT.V_SCROLL | SWT.READ_ONLY);
textArea.pack();
if (content != null) {
textArea.setText(content);
} else {
textArea.setText("Error in the component's properties!");
}
textArea.setBackground(new Color(Display.getDefault(), new RGB(255, 255, 255)));
textArea.setForeground(new Color(Display.getDefault(), new RGB(255, 102, 102)));
// addButtonListener();
return createDialogArea;
}
use of org.eclipse.swt.custom.StyledText in project tdi-studio-se by Talend.
the class DataMapTableView method highlightLineAndSetSelectionOfStyledText.
private void highlightLineAndSetSelectionOfStyledText(final Text expressionTextEditor) {
final StyledTextHandler styledTextHandler = mapperManager.getUiManager().getTabFolderEditors().getStyledTextHandler();
Runnable runnable = new Runnable() {
@Override
public void run() {
StyledText styledText = styledTextHandler.getStyledText();
if (styledText.isDisposed()) {
return;
}
String text = expressionTextEditor.getText();
Point selection = expressionTextEditor.getSelection();
if (selection.x - 1 > 0) {
while (expressionTextEditor.getLineDelimiter().equals(text.charAt(selection.x - 1))) {
selection.x++;
}
}
if (selection.y - 1 > 0) {
while (expressionTextEditor.getLineDelimiter().equals(text.charAt(selection.y - 1))) {
selection.y++;
}
}
int length = styledText.getText().length();
if (selection.x < 0) {
selection.x = 0;
}
if (selection.x > length) {
selection.x = length;
}
if (selection.y < 0) {
selection.y = 0;
}
if (selection.y > length) {
selection.y = length;
}
styledText.setSelection(selection);
styledTextHandler.highlightLineOfCursorPosition(selection);
}
};
new AsynchronousThreading(50, true, DataMapTableView.this.getDisplay(), runnable).start();
}
use of org.eclipse.swt.custom.StyledText in project tdi-studio-se by Talend.
the class TabFolderEditors method createExpressionEditorTab.
/**
* DOC amaumont Comment method "createExpressionEditorTab".
*/
private void createExpressionEditorTab() {
CTabItem item;
item = new CTabItem(tabFolderEditors, SWT.BORDER);
//$NON-NLS-1$
item.setText(Messages.getString("TabFolderEditors.expressionEditor"));
StyledText styledText = createStyledText(item);
this.styledTextHandler = new StyledTextHandler(styledText, mapperManager);
}
use of org.eclipse.swt.custom.StyledText in project tdi-studio-se by Talend.
the class RuntimeGraphcsComposite method createReportField.
/* private void createInfoField(Composite parent) {
infoComposite = createFlatFormComposite(parent, new FormToolkit(Display.getDefault()));
FormLayout reportLayout = new FormLayout();
reportLayout.marginWidth = 0;
reportLayout.marginHeight = 0;
infoComposite.setLayout(reportLayout);
FormData reportData = new FormData();
reportData.left = new FormAttachment(65, 5);
reportData.right = new FormAttachment(100, -5);
reportData.top = new FormAttachment(50, 0);
reportData.bottom = new FormAttachment(100, -5);
infoComposite.setLayoutData(reportData);
Group group = new Group(infoComposite, SWT.NULL);
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 0;
groupLayout.marginHeight = 0;
group.setLayout(groupLayout);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0, 0);
groupData.right = new FormAttachment(100, 0);
groupData.top = new FormAttachment(0, 0);
groupData.bottom = new FormAttachment(100, 0);
group.setLayoutData(groupData);
group.setText("Run job Informations");
infoField = new Text(group, SWT.BORDER | SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
infoField.setEditable(false);
infoField.setBackground(group.getBackground());
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(100, 0);
infoField.setLayoutData(data);
}*/
private void createReportField(Composite parent) {
reportComposite = createFlatFormComposite(parent, new FormToolkit(Display.getDefault()));
FormLayout reportLayout = new FormLayout();
reportComposite.setLayout(reportLayout);
FormData reportData = new FormData();
reportData.left = new FormAttachment(65, 5);
reportData.right = new FormAttachment(100, -5);
reportData.top = new FormAttachment(0, 0);
reportData.bottom = new FormAttachment(100, -5);
reportComposite.setLayoutData(reportData);
Group group = new Group(reportComposite, SWT.NULL);
FormLayout groupLayout = new FormLayout();
group.setLayout(groupLayout);
FormData groupData = new FormData();
groupData.left = new FormAttachment(0, 0);
groupData.right = new FormAttachment(100, 0);
groupData.top = new FormAttachment(0, 0);
groupData.bottom = new FormAttachment(100, 0);
group.setLayoutData(groupData);
//$NON-NLS-1$
group.setText("Job execution information");
reportField = new StyledText(group, SWT.WRAP | SWT.V_SCROLL | SWT.READ_ONLY);
//may be CoreUIPlugin.setCSSClass can do this globally ,check later
reportField.setBackground(getDisplay().getSystemColor(SWT.COLOR_WHITE));
FormData data;
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, 0);
data.bottom = new FormAttachment(93, 0);
reportField.setLayoutData(data);
displayReportField();
//export button
Button exportButton = new Button(group, SWT.PUSH);
//$NON-NLS-1$
exportButton.setText("Export");
FormData exportData = new FormData();
exportData.left = new FormAttachment(100, -70);
exportData.right = new FormAttachment(100, 0);
exportData.bottom = new FormAttachment(100, -1);
exportButton.setLayoutData(exportData);
exportButton.setEnabled(true);
exportButton.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
if (messageManager == null || messageManager.getMessages().size() < 1) {
//$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openWarning(getShell(), "Warning", "No log to export.");
return;
}
UnboundedFifoBuffer messages = messageManager.getMessages();
Iterator iterator = messages.iterator();
StringBuilder content = new StringBuilder();
while (iterator.hasNext()) {
ReportMessage message = (ReportMessage) iterator.next();
content.append(message.getContent());
}
if (isMonitoring) {
//$NON-NLS-1$ //$NON-NLS-2$
MessageDialog.openWarning(getShell(), "Warning", "Waiting for job done.");
return;
}
FileDialog dialog = new FileDialog(getShell(), SWT.SAVE);
//$NON-NLS-1$
dialog.setFilterPath(".");
String fileName = dialog.open();
if (fileName != null) {
FileWriter writer = null;
try {
writer = new FileWriter(fileName);
writer.write(content.toString());
} catch (IOException e1) {
e1.printStackTrace();
} finally {
try {
if (writer != null) {
writer.close();
}
} catch (IOException e1) {
e1.printStackTrace();
}
}
}
}
});
}
use of org.eclipse.swt.custom.StyledText in project tdi-studio-se by Talend.
the class StandAloneTalendJavaEditor method initializeViewerColors.
@Override
protected void initializeViewerColors(ISourceViewer viewer) {
super.initializeViewerColors(viewer);
StyledText styledText = viewer.getTextWidget();
bgColorForReadOnlyItem = new Color(styledText.getDisplay(), DesignerColorUtils.getPreferenceReadonlyRGB(DesignerColorUtils.READONLY_BACKGROUND_COLOR_NAME, DesignerColorUtils.DEFAULT_READONLY_COLOR));
bgColorForEditabeItem = new Color(styledText.getDisplay(), DesignerColorUtils.getPreferenceDesignerEditorRGB(DesignerColorUtils.JOBDESIGNER_EGITOR_BACKGROUND_COLOR_NAME, DesignerColorUtils.DEFAULT_EDITOR_COLOR));
if (!isEditable()) {
styledText.setBackground(bgColorForReadOnlyItem);
} else {
styledText.setBackground(bgColorForEditabeItem);
}
}
Aggregations