use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.
the class OutputDataMapTableView method createFiltersTable.
protected void createFiltersTable() {
this.extendedTableViewerForFilters = new AbstractExtendedTableViewer<FilterTableEntry>(((OutputTable) abstractDataMapTable).getTableFiltersEntriesModel(), centerComposite) {
@Override
protected void createColumns(TableViewerCreator<FilterTableEntry> tableViewerCreator, Table table) {
createFiltersColumns(tableViewerCreator);
}
/*
* (non-Javadoc)
*
* @see
* org.talend.commons.ui.swt.extended.macrotable.AbstractExtendedTableViewer#setTableViewerCreatorOptions
* (org.talend.commons.ui.swt.tableviewer.TableViewerCreator)
*/
@Override
protected void setTableViewerCreatorOptions(TableViewerCreator<FilterTableEntry> newTableViewerCreator) {
super.setTableViewerCreatorOptions(newTableViewerCreator);
newTableViewerCreator.setColumnsResizableByDefault(false);
newTableViewerCreator.setBorderVisible(false);
newTableViewerCreator.setLayoutMode(LAYOUT_MODE.FILL_HORIZONTAL);
newTableViewerCreator.setKeyboardManagementForCellEdition(true);
// tableViewerCreatorForColumns.setUseCustomItemColoring(this.getDataMapTable()
// instanceof
// AbstractInOutTable);
newTableViewerCreator.setFirstColumnMasked(true);
}
};
tableViewerCreatorForFilters = this.extendedTableViewerForFilters.getTableViewerCreator();
this.extendedTableViewerForFilters.setCommandStack(mapperManager.getCommandStack());
tableForConstraints = tableViewerCreatorForFilters.getTable();
tableForConstraintsGridData = new GridData(GridData.FILL_HORIZONTAL);
tableForConstraints.setLayoutData(tableForConstraintsGridData);
boolean tableConstraintsVisible = false;
if (abstractDataMapTable instanceof OutputTable) {
tableConstraintsVisible = ((OutputTable) abstractDataMapTable).getFilterEntries().size() > 0;
}
tableForConstraintsGridData.exclude = !tableConstraintsVisible;
tableForConstraints.setVisible(tableConstraintsVisible);
if (!mapperManager.componentIsReadOnly()) {
new DragNDrop(mapperManager, tableForConstraints, false, true);
}
tableViewerCreatorForFilters.addCellValueModifiedListener(new ITableCellValueModifiedListener() {
public void cellValueModified(TableCellValueModifiedEvent e) {
unselectAllEntriesIfErrorDetected(e);
}
});
final TableViewer tableViewer = tableViewerCreatorForFilters.getTableViewer();
tableViewer.addSelectionChangedListener(new ISelectionChangedListener() {
public void selectionChanged(SelectionChangedEvent event) {
ISelection selection = event.getSelection();
selectThisDataMapTableView();
UIManager uiManager = mapperManager.getUiManager();
uiManager.selectLinks(OutputDataMapTableView.this, uiManager.extractSelectedTableEntries(selection), false, false);
}
});
tableForConstraints.addListener(SWT.KeyDown, new Listener() {
public void handleEvent(Event event) {
processEnterKeyDown(tableViewerCreatorForFilters, event);
}
});
tableViewerCreatorForFilters.setLabelProvider(new DefaultTableLabelProvider(tableViewerCreatorForFilters) {
@Override
public Color getBackground(Object element, int columnIndex) {
return getBackgroundCellColor(tableViewerCreator, element, columnIndex);
}
@Override
public Color getForeground(Object element, int columnIndex) {
return getForegroundCellColor(tableViewerCreator, element, columnIndex);
}
});
initShowMessageErrorListener(tableForConstraints);
}
use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.
the class StyledTextHandler method highlightLineOfCursorPosition.
public int highlightLineOfCursorPosition(Point cursorPosition) {
int countCR = 0;
if (cursorPosition.y > 0 && cursorPosition.y <= this.styledText.getCharCount()) {
countCR = this.styledText.getLineAtOffset(cursorPosition.y);
}
// System.out.println("\n"+countCR);
int lineCount = this.styledText.getLineCount();
// System.out.println(lineCount);
Color whiteColor = this.styledText.getDisplay().getSystemColor(SWT.COLOR_WHITE);
this.styledText.setLineBackground(0, lineCount, whiteColor);
this.styledText.redraw();
this.styledText.setLineBackground(countCR, 1, ColorProviderMapper.getColor(ColorInfo.COLOR_HIGHLIGHTED_TEXT_ROW));
return countCR;
}
use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.
the class ProcessComposite method processMessage.
private boolean processMessage(StringBuffer consoleText, IProcessMessage message, int startLength, List<StyleRange> styles) {
String content = message.getContent();
int lengthBeforeAdd = consoleText.length();
//$NON-NLS-1$
String[] contents = content.split("\n");
for (String content2 : contents) {
if (isPattern(content2) || isPatternFor(content2)) {
//$NON-NLS-1$
consoleText.append("");
//$NON-NLS-1$
content = "";
} else {
consoleText.append(content2);
//$NON-NLS-1$
consoleText.append("\n");
}
}
boolean newStyle = false;
if (message.getType() != MsgType.STD_OUT) {
StyleRange style = new StyleRange();
style.start = startLength + lengthBeforeAdd;
style.length = content.length();
if (message.getType() == MsgType.CORE_OUT || message.getType() == MsgType.CORE_ERR) {
style.fontStyle = SWT.ITALIC;
}
Color color = getColor((MsgType) message.getType());
style.foreground = color;
if ((style.start + style.length) > (startLength + consoleText.length())) {
style.length = startLength + consoleText.length() - style.start;
}
styles.add(style);
newStyle = true;
}
return newStyle;
}
use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.
the class WebServiceTableLiner method initStyleLink.
private void initStyleLink() {
IStyleLink sStyleLink = this.getSelectedStyleLink();
if (sStyleLink == null) {
sStyleLink = createStandardLink(new Color(getBgDrawableComposite().getDisplay(), 255, 102, 102));
this.setSelectedStyleLink(sStyleLink);
}
IStyleLink uStyleLink = this.getUnselectedStyleLink();
if (uStyleLink == null) {
sStyleLink = createStandardLink(getBgDrawableComposite().getDisplay().getSystemColor(SWT.COLOR_GRAY));
this.setUnselectedStyleLink(sStyleLink);
}
}
use of org.eclipse.swt.graphics.Color in project tdi-studio-se by Talend.
the class WebServiceTableLiner method addLinks.
public void addLinks(TableItem itemSource, Object data1, Table tableTarget, Object data2, String mark) {
LinkDescriptor<TableItem, Object, Table, Object> link = new LinkDescriptor<TableItem, Object, Table, Object>(new TableExtremityDescriptor(itemSource, data1), new ExtremityLink<Table, Object>(tableTarget, data2));
link.setStyleLink(createStandardLink(new Color(getBgDrawableComposite().getDisplay(), 255, 102, 102)));
getLinksManager().addLink(link);
if (mark.equals("INPUTMAPPING")) {
sourceInList.add(((IMetadataColumn) itemSource.getData()).getLabel());
} else if (mark.equals("OUTPUTMAPPING")) {
if (((OutPutMappingData) itemSource.getData()).getParameterName() != null) {
String sourseName = ((OutPutMappingData) itemSource.getData()).getParameterName();
// int m = sourseName.lastIndexOf(".");
// sourseName = sourseName.substring(m + 1);
sourceOutList.add(sourseName);
} else {
sourceOutList.add(((OutPutMappingData) itemSource.getData()).getParameter().getName());
}
}
}
Aggregations