use of org.talend.designer.core.ui.editor.cmd.ChangeNoteTextCommand in project tdi-studio-se by Talend.
the class BasicNotePropertyComposite method createTextControl.
/**
* DOC qwei Comment method "createTextcontrol".
*/
private void createTextControl(Composite parent) {
//$NON-NLS-1$
CLabel textLabel = getWidgetFactory().createCLabel(composite, Messages.getString("TextNoteSection.Label"));
//$NON-NLS-1$
FormData data = new FormData();
data.left = new FormAttachment(0, 0);
data.top = new FormAttachment(colorsAndFontsGroup, 30);
textLabel.setLayoutData(data);
//$NON-NLS-1$
text = getWidgetFactory().createText(composite, "", SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
//$NON-NLS-1$
data = new FormData();
data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
data.right = new FormAttachment(textLabel, 560);
data.top = new FormAttachment(textLabel, 0, SWT.TOP);
// 5 lines
data.height = 5 * text.getLineHeight();
text.setLayoutData(data);
text.setForeground(new Color(null, ColorUtils.stringToRGB((String) note.getPropertyValue(EParameterName.NOTETXT_COLOR.getName()))));
text.setText(note.getText());
text.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
if (!text.getText().equals(note.getText())) {
ChangeNoteTextCommand command = new ChangeNoteTextCommand(note, text.getText());
getCommandStack().execute(command);
}
}
});
text.addKeyListener(new KeyListener() {
@Override
public void keyPressed(org.eclipse.swt.events.KeyEvent e) {
// TODO Auto-generated method stub
}
@Override
public void keyReleased(org.eclipse.swt.events.KeyEvent e) {
// TODO Auto-generated method stub
if (!text.getText().equals(note.getText())) {
ChangeNoteTextCommand command = new ChangeNoteTextCommand(note, text.getText());
getCommandStack().execute(command);
}
}
});
textChanged();
}
use of org.talend.designer.core.ui.editor.cmd.ChangeNoteTextCommand in project tdi-studio-se by Talend.
the class TextNotePropertySection method createControls.
@Override
public void createControls(Composite parent, TabbedPropertySheetPage aTabbedPropertySheetPage) {
super.createControls(parent, aTabbedPropertySheetPage);
Composite composite = getWidgetFactory().createFlatFormComposite(parent);
FormData data;
//$NON-NLS-1$
text = getWidgetFactory().createText(composite, "", SWT.BORDER | SWT.MULTI | SWT.V_SCROLL | SWT.H_SCROLL);
data = new FormData();
data.left = new FormAttachment(0, STANDARD_LABEL_WIDTH);
data.right = new FormAttachment(100, 0);
data.top = new FormAttachment(0, ITabbedPropertyConstants.VSPACE);
// 5 lines
data.height = 5 * text.getLineHeight();
text.setLayoutData(data);
//$NON-NLS-1$
CLabel labelLabel = getWidgetFactory().createCLabel(composite, Messages.getString("TextNoteSection.Label"));
data = new FormData();
data.left = new FormAttachment(0, 0);
data.right = new FormAttachment(text, -ITabbedPropertyConstants.HSPACE);
data.top = new FormAttachment(text, 0, SWT.TOP);
labelLabel.setLayoutData(data);
text.addFocusListener(new FocusAdapter() {
@Override
public void focusLost(FocusEvent e) {
if (!text.getText().equals(note.getText())) {
ChangeNoteTextCommand command = new ChangeNoteTextCommand(note, text.getText());
getCommandStack().execute(command);
}
}
});
}
Aggregations