use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-kettle by pentaho.
the class JobEntrySNMPTrapDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobSNMPTrap.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Job entry name line
wName = new LabelText(shell, BaseMessages.getString(PKG, "JobSNMPTrap.Name.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Name.Tooltip"));
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.top = new FormAttachment(0, 0);
fdName.left = new FormAttachment(0, 0);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
wTabFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wTabFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF GENERAL TAB ///
// ////////////////////////
wGeneralTab = new CTabItem(wTabFolder, SWT.NONE);
wGeneralTab.setText(BaseMessages.getString(PKG, "JobSNMPTrap.Tab.General.Label"));
wGeneralComp = new Composite(wTabFolder, SWT.NONE);
props.setLook(wGeneralComp);
FormLayout generalLayout = new FormLayout();
generalLayout.marginWidth = 3;
generalLayout.marginHeight = 3;
wGeneralComp.setLayout(generalLayout);
// ////////////////////////
// START OF SERVER SETTINGS GROUP///
// /
wServerSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wServerSettings);
wServerSettings.setText(BaseMessages.getString(PKG, "JobSNMPTrap.ServerSettings.Group.Label"));
FormLayout ServerSettingsgroupLayout = new FormLayout();
ServerSettingsgroupLayout.marginWidth = 10;
ServerSettingsgroupLayout.marginHeight = 10;
wServerSettings.setLayout(ServerSettingsgroupLayout);
// ServerName line
wServerName = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Server.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Server.Tooltip"));
props.setLook(wServerName);
wServerName.addModifyListener(lsMod);
fdServerName = new FormData();
fdServerName.left = new FormAttachment(0, 0);
fdServerName.top = new FormAttachment(wName, margin);
fdServerName.right = new FormAttachment(100, 0);
wServerName.setLayoutData(fdServerName);
// Server port line
wPort = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Port.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Port.Tooltip"));
props.setLook(wPort);
wPort.addModifyListener(lsMod);
fdPort = new FormData();
fdPort.left = new FormAttachment(0, 0);
fdPort.top = new FormAttachment(wServerName, margin);
fdPort.right = new FormAttachment(100, 0);
wPort.setLayoutData(fdPort);
// Server OID line
wOID = new LabelTextVar(jobMeta, wServerSettings, BaseMessages.getString(PKG, "JobSNMPTrap.OID.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.OID.Tooltip"));
props.setLook(wOID);
wOID.addModifyListener(lsMod);
fdOID = new FormData();
fdOID.left = new FormAttachment(0, 0);
fdOID.top = new FormAttachment(wPort, margin);
fdOID.right = new FormAttachment(100, 0);
wOID.setLayoutData(fdOID);
// Test connection button
wTest = new Button(wServerSettings, SWT.PUSH);
wTest.setText(BaseMessages.getString(PKG, "JobSNMPTrap.TestConnection.Label"));
props.setLook(wTest);
fdTest = new FormData();
wTest.setToolTipText(BaseMessages.getString(PKG, "JobSNMPTrap.TestConnection.Tooltip"));
fdTest.top = new FormAttachment(wOID, margin);
fdTest.right = new FormAttachment(100, 0);
wTest.setLayoutData(fdTest);
fdServerSettings = new FormData();
fdServerSettings.left = new FormAttachment(0, margin);
fdServerSettings.top = new FormAttachment(wName, margin);
fdServerSettings.right = new FormAttachment(100, -margin);
wServerSettings.setLayoutData(fdServerSettings);
// ///////////////////////////////////////////////////////////
// / END OF SERVER SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF Advanced SETTINGS GROUP///
// /
wAdvancedSettings = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wAdvancedSettings);
wAdvancedSettings.setText(BaseMessages.getString(PKG, "JobSNMPTrap.AdvancedSettings.Group.Label"));
FormLayout AdvancedSettingsgroupLayout = new FormLayout();
AdvancedSettingsgroupLayout.marginWidth = 10;
AdvancedSettingsgroupLayout.marginHeight = 10;
wAdvancedSettings.setLayout(AdvancedSettingsgroupLayout);
// Target type
wlTargetType = new Label(wAdvancedSettings, SWT.RIGHT);
wlTargetType.setText(BaseMessages.getString(PKG, "JobSNMPTrap.TargetType.Label"));
props.setLook(wlTargetType);
fdlTargetType = new FormData();
fdlTargetType.left = new FormAttachment(0, margin);
fdlTargetType.right = new FormAttachment(middle, -margin);
fdlTargetType.top = new FormAttachment(wServerSettings, margin);
wlTargetType.setLayoutData(fdlTargetType);
wTargetType = new CCombo(wAdvancedSettings, SWT.SINGLE | SWT.READ_ONLY | SWT.BORDER);
wTargetType.setItems(JobEntrySNMPTrap.target_type_Desc);
props.setLook(wTargetType);
fdTargetType = new FormData();
fdTargetType.left = new FormAttachment(middle, margin);
fdTargetType.top = new FormAttachment(wServerSettings, margin);
fdTargetType.right = new FormAttachment(100, 0);
wTargetType.setLayoutData(fdTargetType);
wTargetType.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
CheckuseUserTarget();
}
});
// Community String line
wComString = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.ComString.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.ComString.Tooltip"));
props.setLook(wComString);
wComString.addModifyListener(lsMod);
fdComString = new FormData();
fdComString.left = new FormAttachment(0, 0);
fdComString.top = new FormAttachment(wTargetType, margin);
fdComString.right = new FormAttachment(100, 0);
wComString.setLayoutData(fdComString);
// User line
wUser = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.User.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.User.Tooltip"));
props.setLook(wUser);
wUser.addModifyListener(lsMod);
fdUser = new FormData();
fdUser.left = new FormAttachment(0, 0);
fdUser.top = new FormAttachment(wComString, margin);
fdUser.right = new FormAttachment(100, 0);
wUser.setLayoutData(fdUser);
// Passphrase String line
wPassphrase = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Passphrase.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Passphrase.Tooltip"), true);
props.setLook(wPassphrase);
wPassphrase.addModifyListener(lsMod);
fdPassphrase = new FormData();
fdPassphrase.left = new FormAttachment(0, 0);
fdPassphrase.top = new FormAttachment(wUser, margin);
fdPassphrase.right = new FormAttachment(100, 0);
wPassphrase.setLayoutData(fdPassphrase);
// EngineID String line
wEngineID = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.EngineID.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.EngineID.Tooltip"));
props.setLook(wEngineID);
wEngineID.addModifyListener(lsMod);
fdEngineID = new FormData();
fdEngineID.left = new FormAttachment(0, 0);
fdEngineID.top = new FormAttachment(wPassphrase, margin);
fdEngineID.right = new FormAttachment(100, 0);
wEngineID.setLayoutData(fdEngineID);
// Retry line
wRetry = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Retry.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Retry.Tooltip"));
props.setLook(wRetry);
wRetry.addModifyListener(lsMod);
fdRetry = new FormData();
fdRetry.left = new FormAttachment(0, 0);
fdRetry.top = new FormAttachment(wEngineID, margin);
fdRetry.right = new FormAttachment(100, 0);
wRetry.setLayoutData(fdRetry);
// Timeout line
wTimeout = new LabelTextVar(jobMeta, wAdvancedSettings, BaseMessages.getString(PKG, "JobSNMPTrap.Timeout.Label"), BaseMessages.getString(PKG, "JobSNMPTrap.Timeout.Tooltip"));
props.setLook(wTimeout);
wTimeout.addModifyListener(lsMod);
fdTimeout = new FormData();
fdTimeout.left = new FormAttachment(0, 0);
fdTimeout.top = new FormAttachment(wRetry, margin);
fdTimeout.right = new FormAttachment(100, 0);
wTimeout.setLayoutData(fdTimeout);
fdAdvancedSettings = new FormData();
fdAdvancedSettings.left = new FormAttachment(0, margin);
fdAdvancedSettings.top = new FormAttachment(wServerSettings, margin);
fdAdvancedSettings.right = new FormAttachment(100, -margin);
wAdvancedSettings.setLayoutData(fdAdvancedSettings);
// ///////////////////////////////////////////////////////////
// / END OF Advanced SETTINGS GROUP
// ///////////////////////////////////////////////////////////
// ////////////////////////
// START OF MESSAGE GROUP///
// /
wMessageGroup = new Group(wGeneralComp, SWT.SHADOW_NONE);
props.setLook(wMessageGroup);
wMessageGroup.setText(BaseMessages.getString(PKG, "JobSNMPTrap.MessageGroup.Group.Label"));
FormLayout MessageGroupgroupLayout = new FormLayout();
MessageGroupgroupLayout.marginWidth = 10;
MessageGroupgroupLayout.marginHeight = 10;
wMessageGroup.setLayout(MessageGroupgroupLayout);
// Message line
wlMessage = new Label(wMessageGroup, SWT.RIGHT);
wlMessage.setText(BaseMessages.getString(PKG, "JobSNMPTrap.Message.Label"));
props.setLook(wlMessage);
fdlMessage = new FormData();
fdlMessage.left = new FormAttachment(0, 0);
fdlMessage.top = new FormAttachment(wComString, margin);
fdlMessage.right = new FormAttachment(middle, -margin);
wlMessage.setLayoutData(fdlMessage);
wMessage = new StyledTextComp(jobEntry, wMessageGroup, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wMessage);
wMessage.addModifyListener(lsMod);
fdMessage = new FormData();
fdMessage.left = new FormAttachment(middle, 0);
fdMessage.top = new FormAttachment(wComString, margin);
fdMessage.right = new FormAttachment(100, -2 * margin);
fdMessage.bottom = new FormAttachment(100, -margin);
wMessage.setLayoutData(fdMessage);
fdMessageGroup = new FormData();
fdMessageGroup.left = new FormAttachment(0, margin);
fdMessageGroup.top = new FormAttachment(wAdvancedSettings, margin);
fdMessageGroup.right = new FormAttachment(100, -margin);
fdMessageGroup.bottom = new FormAttachment(100, -margin);
wMessageGroup.setLayoutData(fdMessageGroup);
// ///////////////////////////////////////////////////////////
// / END OF MESSAGE GROUP
// ///////////////////////////////////////////////////////////
fdGeneralComp = new FormData();
fdGeneralComp.left = new FormAttachment(0, 0);
fdGeneralComp.top = new FormAttachment(0, 0);
fdGeneralComp.right = new FormAttachment(100, 0);
fdGeneralComp.bottom = new FormAttachment(100, 0);
wGeneralComp.setLayoutData(fdGeneralComp);
wGeneralComp.layout();
wGeneralTab.setControl(wGeneralComp);
props.setLook(wGeneralComp);
// ///////////////////////////////////////////////////////////
// / END OF GENERAL TAB
// ///////////////////////////////////////////////////////////
fdTabFolder = new FormData();
fdTabFolder.left = new FormAttachment(0, 0);
fdTabFolder.top = new FormAttachment(wName, margin);
fdTabFolder.right = new FormAttachment(100, 0);
fdTabFolder.bottom = new FormAttachment(100, -50);
wTabFolder.setLayoutData(fdTabFolder);
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wTabFolder);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsTest = new Listener() {
public void handleEvent(Event e) {
test();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wTest.addListener(SWT.Selection, lsTest);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
wServerName.addSelectionListener(lsDef);
wTimeout.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
CheckuseUserTarget();
wTabFolder.setSelection(0);
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobSNMPTrapDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-kettle by pentaho.
the class JobEntrySQLDialog method open.
public JobEntryInterface open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, props.getJobsDialogStyle());
props.setLook(shell);
JobDialog.setShellImage(shell, jobEntry);
ModifyListener lsMod = new ModifyListener() {
public void modifyText(ModifyEvent e) {
jobEntry.setChanged();
}
};
changed = jobEntry.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "JobSQL.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, null);
// Filename line
wlName = new Label(shell, SWT.RIGHT);
wlName.setText(BaseMessages.getString(PKG, "JobSQL.Name.Label"));
props.setLook(wlName);
fdlName = new FormData();
fdlName.left = new FormAttachment(0, 0);
fdlName.right = new FormAttachment(middle, 0);
fdlName.top = new FormAttachment(0, margin);
wlName.setLayoutData(fdlName);
wName = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wName);
wName.addModifyListener(lsMod);
fdName = new FormData();
fdName.left = new FormAttachment(middle, 0);
fdName.top = new FormAttachment(0, margin);
fdName.right = new FormAttachment(100, 0);
wName.setLayoutData(fdName);
// Connection line
wConnection = addConnectionLine(shell, wName, middle, margin);
if (jobEntry.getDatabase() == null && jobMeta.nrDatabases() == 1) {
wConnection.select(0);
}
wConnection.addModifyListener(lsMod);
// SQL from file?
wlSQLFromFile = new Label(shell, SWT.RIGHT);
wlSQLFromFile.setText(BaseMessages.getString(PKG, "JobSQL.SQLFromFile.Label"));
props.setLook(wlSQLFromFile);
fdlSQLFromFile = new FormData();
fdlSQLFromFile.left = new FormAttachment(0, 0);
fdlSQLFromFile.top = new FormAttachment(wConnection, 2 * margin);
fdlSQLFromFile.right = new FormAttachment(middle, -margin);
wlSQLFromFile.setLayoutData(fdlSQLFromFile);
wSQLFromFile = new Button(shell, SWT.CHECK);
props.setLook(wSQLFromFile);
wSQLFromFile.setToolTipText(BaseMessages.getString(PKG, "JobSQL.SQLFromFile.Tooltip"));
fdSQLFromFile = new FormData();
fdSQLFromFile.left = new FormAttachment(middle, 0);
fdSQLFromFile.top = new FormAttachment(wConnection, 2 * margin);
fdSQLFromFile.right = new FormAttachment(100, 0);
wSQLFromFile.setLayoutData(fdSQLFromFile);
wSQLFromFile.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
activeSQLFromFile();
jobEntry.setChanged();
}
});
// Filename line
wlFilename = new Label(shell, SWT.RIGHT);
wlFilename.setText(BaseMessages.getString(PKG, "JobSQL.Filename.Label"));
props.setLook(wlFilename);
fdlFilename = new FormData();
fdlFilename.left = new FormAttachment(0, 0);
fdlFilename.top = new FormAttachment(wSQLFromFile, margin);
fdlFilename.right = new FormAttachment(middle, -margin);
wlFilename.setLayoutData(fdlFilename);
wbFilename = new Button(shell, SWT.PUSH | SWT.CENTER);
props.setLook(wbFilename);
wbFilename.setText(BaseMessages.getString(PKG, "System.Button.Browse"));
fdbFilename = new FormData();
fdbFilename.right = new FormAttachment(100, 0);
fdbFilename.top = new FormAttachment(wSQLFromFile, margin);
wbFilename.setLayoutData(fdbFilename);
wFilename = new TextVar(jobMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wFilename);
wFilename.setToolTipText(BaseMessages.getString(PKG, "JobSQL.Filename.Tooltip"));
wFilename.addModifyListener(lsMod);
fdFilename = new FormData();
fdFilename.left = new FormAttachment(middle, 0);
fdFilename.top = new FormAttachment(wSQLFromFile, margin);
fdFilename.right = new FormAttachment(wbFilename, -margin);
wFilename.setLayoutData(fdFilename);
// Whenever something changes, set the tooltip to the expanded version:
wFilename.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
wFilename.setToolTipText(jobMeta.environmentSubstitute(wFilename.getText()));
}
});
wbFilename.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
FileDialog dialog = new FileDialog(shell, SWT.OPEN);
dialog.setFilterExtensions(new String[] { "*.sql", "*.txt", "*" });
if (wFilename.getText() != null) {
dialog.setFileName(jobMeta.environmentSubstitute(wFilename.getText()));
}
dialog.setFilterNames(FILETYPES);
if (dialog.open() != null) {
wFilename.setText(dialog.getFilterPath() + Const.FILE_SEPARATOR + dialog.getFileName());
}
}
});
// Send one SQL Statement?
wlUseOneStatement = new Label(shell, SWT.RIGHT);
wlUseOneStatement.setText(BaseMessages.getString(PKG, "JobSQL.SendOneStatement.Label"));
props.setLook(wlUseOneStatement);
fdlUseOneStatement = new FormData();
fdlUseOneStatement.left = new FormAttachment(0, 0);
fdlUseOneStatement.top = new FormAttachment(wbFilename, margin);
fdlUseOneStatement.right = new FormAttachment(middle, -margin);
wlUseOneStatement.setLayoutData(fdlUseOneStatement);
wSendOneStatement = new Button(shell, SWT.CHECK);
props.setLook(wSendOneStatement);
wSendOneStatement.setToolTipText(BaseMessages.getString(PKG, "JobSQL.SendOneStatement.Tooltip"));
fdUseOneStatement = new FormData();
fdUseOneStatement.left = new FormAttachment(middle, 0);
fdUseOneStatement.top = new FormAttachment(wbFilename, margin);
fdUseOneStatement.right = new FormAttachment(100, 0);
wSendOneStatement.setLayoutData(fdUseOneStatement);
wSendOneStatement.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setChanged();
}
});
// Use variable substitution?
wlUseSubs = new Label(shell, SWT.RIGHT);
wlUseSubs.setText(BaseMessages.getString(PKG, "JobSQL.UseVariableSubst.Label"));
props.setLook(wlUseSubs);
fdlUseSubs = new FormData();
fdlUseSubs.left = new FormAttachment(0, 0);
fdlUseSubs.top = new FormAttachment(wSendOneStatement, margin);
fdlUseSubs.right = new FormAttachment(middle, -margin);
wlUseSubs.setLayoutData(fdlUseSubs);
wUseSubs = new Button(shell, SWT.CHECK);
props.setLook(wUseSubs);
wUseSubs.setToolTipText(BaseMessages.getString(PKG, "JobSQL.UseVariableSubst.Tooltip"));
fdUseSubs = new FormData();
fdUseSubs.left = new FormAttachment(middle, 0);
fdUseSubs.top = new FormAttachment(wSendOneStatement, margin);
fdUseSubs.right = new FormAttachment(100, 0);
wUseSubs.setLayoutData(fdUseSubs);
wUseSubs.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
jobEntry.setUseVariableSubstitution(!jobEntry.getUseVariableSubstitution());
jobEntry.setChanged();
}
});
wlPosition = new Label(shell, SWT.NONE);
wlPosition.setText(BaseMessages.getString(PKG, "JobSQL.LineNr.Label", "0"));
props.setLook(wlPosition);
fdlPosition = new FormData();
fdlPosition.left = new FormAttachment(0, 0);
fdlPosition.right = new FormAttachment(100, 0);
fdlPosition.bottom = new FormAttachment(wOK, -margin);
wlPosition.setLayoutData(fdlPosition);
// Script line
wlSQL = new Label(shell, SWT.NONE);
wlSQL.setText(BaseMessages.getString(PKG, "JobSQL.Script.Label"));
props.setLook(wlSQL);
fdlSQL = new FormData();
fdlSQL.left = new FormAttachment(0, 0);
fdlSQL.top = new FormAttachment(wUseSubs, margin);
wlSQL.setLayoutData(fdlSQL);
wSQL = new StyledTextComp(jobEntry, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
props.setLook(wSQL, Props.WIDGET_STYLE_FIXED);
wSQL.addModifyListener(lsMod);
fdSQL = new FormData();
fdSQL.left = new FormAttachment(0, 0);
fdSQL.top = new FormAttachment(wlSQL, margin);
fdSQL.right = new FormAttachment(100, -10);
fdSQL.bottom = new FormAttachment(wlPosition, -margin);
wSQL.setLayoutData(fdSQL);
// Add listeners
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
lsDef = new SelectionAdapter() {
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
wName.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
wSQL.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent arg0) {
setPosition();
}
});
wSQL.addKeyListener(new KeyAdapter() {
public void keyPressed(KeyEvent e) {
setPosition();
}
public void keyReleased(KeyEvent e) {
setPosition();
}
});
wSQL.addFocusListener(new FocusAdapter() {
public void focusGained(FocusEvent e) {
setPosition();
}
public void focusLost(FocusEvent e) {
setPosition();
}
});
wSQL.addMouseListener(new MouseAdapter() {
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
public void mouseDown(MouseEvent e) {
setPosition();
}
public void mouseUp(MouseEvent e) {
setPosition();
}
});
wSQL.addModifyListener(lsMod);
// Text Higlighting
wSQL.addLineStyleListener(new SQLValuesHighlight());
getData();
activeSQLFromFile();
BaseStepDialog.setSize(shell);
shell.open();
props.setDialogSize(shell, "JobSQLDialogSize");
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return jobEntry;
}
use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-cassandra-plugin by pentaho.
the class CassandraInputDialog method open.
@Override
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MIN | SWT.MAX);
props.setLook(shell);
setShellImage(shell, m_currentMeta);
// used to listen to a text field (m_wStepname)
ModifyListener lsMod = new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_currentMeta.setChanged();
}
};
changed = m_currentMeta.hasChanged();
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
// $NON-NLS-1$
shell.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Shell.Title"));
int middle = props.getMiddlePct();
int margin = Const.MARGIN;
// Stepname line
m_stepnameLabel = new Label(shell, SWT.RIGHT);
// $NON-NLS-1$
m_stepnameLabel.setText(BaseMessages.getString(PKG, "CassandraInputDialog.StepName.Label"));
props.setLook(m_stepnameLabel);
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(middle, -margin);
fd.top = new FormAttachment(0, margin);
m_stepnameLabel.setLayoutData(fd);
m_stepnameText = new Text(shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
m_stepnameText.setText(stepname);
props.setLook(m_stepnameText);
m_stepnameText.addModifyListener(lsMod);
// format the text field
fd = new FormData();
fd.left = new FormAttachment(middle, 0);
fd.top = new FormAttachment(0, margin);
fd.right = new FormAttachment(100, 0);
m_stepnameText.setLayoutData(fd);
// host line
m_hostLab = new Label(shell, SWT.RIGHT);
props.setLook(m_hostLab);
// $NON-NLS-1$
m_hostLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Hostname.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_stepnameText, margin);
fd.right = new FormAttachment(middle, -margin);
m_hostLab.setLayoutData(fd);
m_hostText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_hostText);
m_hostText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_hostText.setToolTipText(transMeta.environmentSubstitute(m_hostText.getText()));
}
});
m_hostText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_stepnameText, margin);
fd.left = new FormAttachment(middle, 0);
m_hostText.setLayoutData(fd);
// port line
m_portLab = new Label(shell, SWT.RIGHT);
props.setLook(m_portLab);
// $NON-NLS-1$
m_portLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Port.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_hostText, margin);
fd.right = new FormAttachment(middle, -margin);
m_portLab.setLayoutData(fd);
m_portText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_portText);
m_portText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_portText.setToolTipText(transMeta.environmentSubstitute(m_portText.getText()));
}
});
m_portText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_hostText, margin);
fd.left = new FormAttachment(middle, 0);
m_portText.setLayoutData(fd);
// timeout line
m_timeoutLab = new Label(shell, SWT.RIGHT);
props.setLook(m_timeoutLab);
// $NON-NLS-1$
m_timeoutLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Timeout.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_portText, margin);
fd.right = new FormAttachment(middle, -margin);
m_timeoutLab.setLayoutData(fd);
m_timeoutText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_timeoutText);
m_timeoutText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_timeoutText.setToolTipText(transMeta.environmentSubstitute(m_timeoutText.getText()));
}
});
m_timeoutText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_portText, margin);
fd.left = new FormAttachment(middle, 0);
m_timeoutText.setLayoutData(fd);
// max length line
m_maxLengthLab = new Label(shell, SWT.RIGHT);
props.setLook(m_maxLengthLab);
m_maxLengthLab.setText(// $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraInputDialog.TransportMaxLength.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_timeoutText, margin);
fd.right = new FormAttachment(middle, -margin);
m_maxLengthLab.setLayoutData(fd);
m_maxLengthText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_maxLengthText);
m_maxLengthText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_maxLengthText.setToolTipText(transMeta.environmentSubstitute(m_maxLengthText.getText()));
}
});
m_maxLengthText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_timeoutText, margin);
fd.left = new FormAttachment(middle, 0);
m_maxLengthText.setLayoutData(fd);
// username line
m_userLab = new Label(shell, SWT.RIGHT);
props.setLook(m_userLab);
// $NON-NLS-1$
m_userLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.User.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_maxLengthText, margin);
fd.right = new FormAttachment(middle, -margin);
m_userLab.setLayoutData(fd);
m_userText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_userText);
m_userText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_maxLengthText, margin);
fd.left = new FormAttachment(middle, 0);
m_userText.setLayoutData(fd);
// password line
m_passLab = new Label(shell, SWT.RIGHT);
props.setLook(m_passLab);
// $NON-NLS-1$
m_passLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Password.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_userText, margin);
fd.right = new FormAttachment(middle, -margin);
m_passLab.setLayoutData(fd);
m_passText = new PasswordTextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_passText);
m_passText.addModifyListener(lsMod);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_userText, margin);
fd.left = new FormAttachment(middle, 0);
m_passText.setLayoutData(fd);
// keyspace line
m_keyspaceLab = new Label(shell, SWT.RIGHT);
props.setLook(m_keyspaceLab);
// $NON-NLS-1$
m_keyspaceLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Keyspace.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_passText, margin);
fd.right = new FormAttachment(middle, -margin);
m_keyspaceLab.setLayoutData(fd);
m_keyspaceText = new TextVar(transMeta, shell, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(m_keyspaceText);
m_keyspaceText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
m_keyspaceText.setToolTipText(transMeta.environmentSubstitute(m_keyspaceText.getText()));
}
});
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.top = new FormAttachment(m_passText, margin);
fd.left = new FormAttachment(middle, 0);
m_keyspaceText.setLayoutData(fd);
// compression check box
m_compressionLab = new Label(shell, SWT.RIGHT);
props.setLook(m_compressionLab);
m_compressionLab.setText(// $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraInputDialog.UseCompression.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_keyspaceText, margin);
fd.right = new FormAttachment(middle, -margin);
m_compressionLab.setLayoutData(fd);
m_useCompressionBut = new Button(shell, SWT.CHECK);
props.setLook(m_useCompressionBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.left = new FormAttachment(middle, 0);
fd.top = new FormAttachment(m_keyspaceText, margin);
m_useCompressionBut.setLayoutData(fd);
m_useCompressionBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
m_currentMeta.setChanged();
}
});
// execute for each row
Label executeForEachLab = new Label(shell, SWT.RIGHT);
props.setLook(executeForEachLab);
executeForEachLab.setText(// $NON-NLS-1$
BaseMessages.getString(PKG, "CassandraInputDialog.ExecuteForEachRow.Label"));
fd = new FormData();
fd.right = new FormAttachment(middle, -margin);
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_useCompressionBut, margin);
executeForEachLab.setLayoutData(fd);
m_executeForEachRowBut = new Button(shell, SWT.CHECK);
props.setLook(m_executeForEachRowBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.left = new FormAttachment(middle, 0);
fd.top = new FormAttachment(m_useCompressionBut, margin);
m_executeForEachRowBut.setLayoutData(fd);
// Buttons inherited from BaseStepDialog
wOK = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wPreview = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wPreview.setText(BaseMessages.getString(PKG, "System.Button.Preview"));
wCancel = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
setButtonPositions(new Button[] { wOK, wPreview, wCancel }, margin, m_cqlText);
// position label
m_positionLab = new Label(shell, SWT.NONE);
props.setLook(m_positionLab);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(middle, -margin);
fd.bottom = new FormAttachment(wOK, -margin);
m_positionLab.setLayoutData(fd);
m_showSchemaBut = new Button(shell, SWT.PUSH);
// $NON-NLS-1$
m_showSchemaBut.setText(BaseMessages.getString(PKG, "CassandraInputDialog.Schema.Button"));
props.setLook(m_showSchemaBut);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(wOK, -margin);
m_showSchemaBut.setLayoutData(fd);
m_showSchemaBut.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
popupSchemaInfo();
}
});
// cql stuff
m_cqlLab = new Label(shell, SWT.NONE);
props.setLook(m_cqlLab);
// $NON-NLS-1$
m_cqlLab.setText(BaseMessages.getString(PKG, "CassandraInputDialog.CQL.Label"));
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_executeForEachRowBut, margin);
fd.right = new FormAttachment(middle, -margin);
m_cqlLab.setLayoutData(fd);
m_cqlText = new StyledTextComp(transMeta, shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, // $NON-NLS-1$
"");
props.setLook(m_cqlText, PropsUI.WIDGET_STYLE_FIXED);
m_cqlText.addModifyListener(lsMod);
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(m_cqlLab, margin);
fd.right = new FormAttachment(100, -2 * margin);
fd.bottom = new FormAttachment(m_showSchemaBut, -margin);
m_cqlText.setLayoutData(fd);
m_cqlText.addModifyListener(new ModifyListener() {
@Override
public void modifyText(ModifyEvent e) {
setPosition();
m_cqlText.setToolTipText(transMeta.environmentSubstitute(m_cqlText.getText()));
}
});
// Text Highlighting
m_cqlText.addLineStyleListener(new SQLValuesHighlight());
m_cqlText.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
setPosition();
}
@Override
public void keyReleased(KeyEvent e) {
setPosition();
}
});
m_cqlText.addFocusListener(new FocusAdapter() {
@Override
public void focusGained(FocusEvent e) {
setPosition();
}
@Override
public void focusLost(FocusEvent e) {
setPosition();
}
});
m_cqlText.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent e) {
setPosition();
}
@Override
public void mouseDown(MouseEvent e) {
setPosition();
}
@Override
public void mouseUp(MouseEvent e) {
setPosition();
}
});
// Add listeners
lsCancel = new Listener() {
@Override
public void handleEvent(Event e) {
cancel();
}
};
lsOK = new Listener() {
@Override
public void handleEvent(Event e) {
ok();
}
};
lsPreview = new Listener() {
@Override
public void handleEvent(Event e) {
preview();
}
};
wCancel.addListener(SWT.Selection, lsCancel);
wOK.addListener(SWT.Selection, lsOK);
wPreview.addListener(SWT.Selection, lsPreview);
lsDef = new SelectionAdapter() {
@Override
public void widgetDefaultSelected(SelectionEvent e) {
ok();
}
};
m_stepnameText.addSelectionListener(lsDef);
// Detect X or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
cancel();
}
});
setSize();
getData();
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return stepname;
}
use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-cassandra-plugin by pentaho.
the class EnterCQLDialog method open.
public String open() {
Display display = m_parent.getDisplay();
m_shell = new Shell(m_parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.APPLICATION_MODAL);
m_props.setLook(m_shell);
m_shell.setImage(GUIResource.getInstance().getImageSpoon());
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
m_shell.setLayout(formLayout);
m_shell.setText(m_title);
int margin = Const.MARGIN;
int middle = Const.MIDDLE_PCT;
Label dontComplainLab = new Label(m_shell, SWT.RIGHT);
m_props.setLook(dontComplainLab);
// $NON-NLS-1$
dontComplainLab.setText(BaseMessages.getString(this.getClass(), "EnterCQLDialog.DontComplainIfCQLFails.Label"));
FormData fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.right = new FormAttachment(middle, -margin);
fd.bottom = new FormAttachment(100, -50);
dontComplainLab.setLayoutData(fd);
m_dontComplainAboutAprioriCQLFailing = new Button(m_shell, SWT.CHECK);
m_props.setLook(m_dontComplainAboutAprioriCQLFailing);
fd = new FormData();
fd.right = new FormAttachment(100, 0);
fd.bottom = new FormAttachment(100, -50);
fd.left = new FormAttachment(middle, 0);
m_dontComplainAboutAprioriCQLFailing.setLayoutData(fd);
m_dontComplainAboutAprioriCQLFailing.setSelection(m_dontComplain);
m_dontComplainAboutAprioriCQLFailing.addSelectionListener(new SelectionAdapter() {
@Override
public void widgetSelected(SelectionEvent e) {
m_dontComplain = m_dontComplainAboutAprioriCQLFailing.getSelection();
}
});
m_cqlText = // $NON-NLS-1$
new StyledTextComp(m_transMeta, m_shell, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
m_props.setLook(m_cqlText, m_props.WIDGET_STYLE_FIXED);
m_cqlText.setText(m_originalCQL);
m_currentCQL = m_originalCQL;
fd = new FormData();
fd.left = new FormAttachment(0, 0);
fd.top = new FormAttachment(0, 0);
fd.right = new FormAttachment(100, -2 * margin);
fd.bottom = new FormAttachment(m_dontComplainAboutAprioriCQLFailing, -margin);
m_cqlText.setLayoutData(fd);
m_cqlText.addModifyListener(m_lsMod);
m_cqlText.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
m_cqlText.setToolTipText(m_transMeta.environmentSubstitute(m_cqlText.getText()));
}
});
// Text Highlighting
m_cqlText.addLineStyleListener(new SQLValuesHighlight());
// Some buttons
m_ok = new Button(m_shell, SWT.PUSH);
// $NON-NLS-1$
m_ok.setText(BaseMessages.getString(PKG, "System.Button.OK"));
m_cancel = new Button(m_shell, SWT.PUSH);
// $NON-NLS-1$
m_cancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(m_shell, new Button[] { m_ok, m_cancel }, margin, null);
// Add listeners
m_lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
m_lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
m_ok.addListener(SWT.Selection, m_lsOK);
m_cancel.addListener(SWT.Selection, m_lsCancel);
// Detect [X] or ALT-F4 or something that kills this window...
m_shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent e) {
checkCancel(e);
}
});
BaseStepDialog.setSize(m_shell);
m_shell.open();
while (!m_shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return m_currentCQL;
}
use of org.pentaho.di.ui.core.widget.StyledTextComp in project pentaho-kettle by pentaho.
the class RegexEvalHelperDialog method open.
public String open() {
Shell parent = getParent();
Display display = parent.getDisplay();
shell = new Shell(parent, SWT.DIALOG_TRIM | SWT.RESIZE | SWT.MAX | SWT.MIN | SWT.NONE);
props.setLook(shell);
shell.setImage(guiresource.getImageSpoon());
FormLayout formLayout = new FormLayout();
formLayout.marginWidth = Const.FORM_MARGIN;
formLayout.marginHeight = Const.FORM_MARGIN;
shell.setLayout(formLayout);
shell.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.Shell.Label"));
int margin = Const.MARGIN;
int middle = 30;
wNoteFolder = new CTabFolder(shell, SWT.BORDER);
props.setLook(wNoteFolder, Props.WIDGET_STYLE_TAB);
// ////////////////////////
// START OF NOTE CONTENT TAB///
// /
wNoteContentTab = new CTabItem(wNoteFolder, SWT.NONE);
wNoteContentTab.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.RegExTab.Label"));
Composite wNoteContentComp = new Composite(wNoteFolder, SWT.NONE);
props.setLook(wNoteContentComp);
FormLayout fileLayout = new FormLayout();
fileLayout.marginWidth = 3;
fileLayout.marginHeight = 3;
wNoteContentComp.setLayout(fileLayout);
// RegEx Script
wlRegExScript = new Label(wNoteContentComp, SWT.RIGHT);
wlRegExScript.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.Script.Label"));
props.setLook(wlRegExScript);
fdlRegExScript = new FormData();
fdlRegExScript.left = new FormAttachment(0, 0);
fdlRegExScript.top = new FormAttachment(0, 2 * margin);
wlRegExScript.setLayoutData(fdlRegExScript);
wRegExScript = new StyledTextComp(transmeta, wNoteContentComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL, "");
wRegExScript.setText("");
props.setLook(wRegExScript, Props.WIDGET_STYLE_FIXED);
props.setLook(wRegExScript);
fdRegExScript = new FormData();
fdRegExScript.left = new FormAttachment(0, 0);
fdRegExScript.top = new FormAttachment(wlRegExScript, 2 * margin);
fdRegExScript.right = new FormAttachment(100, -2 * margin);
fdRegExScript.bottom = new FormAttachment(40, -margin);
wRegExScript.setLayoutData(fdRegExScript);
wRegExScriptCompile = new Text(wNoteContentComp, SWT.MULTI | SWT.LEFT | SWT.BORDER | SWT.V_SCROLL);
wRegExScriptCompile.setText("");
props.setLook(wRegExScriptCompile, Props.WIDGET_STYLE_FIXED);
fdRegExScriptCompile = new FormData();
fdRegExScriptCompile.left = new FormAttachment(0, 0);
fdRegExScriptCompile.top = new FormAttachment(wRegExScript, margin);
fdRegExScriptCompile.right = new FormAttachment(100, 0);
wRegExScriptCompile.setLayoutData(fdRegExScriptCompile);
wRegExScriptCompile.setEditable(false);
wRegExScriptCompile.setFont(guiresource.getFontNote());
// ////////////////////////
// START OF Values GROUP
//
wValuesGroup = new Group(wNoteContentComp, SWT.SHADOW_NONE);
props.setLook(wValuesGroup);
wValuesGroup.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.TestValues.Label"));
FormLayout groupLayout = new FormLayout();
groupLayout.marginWidth = 10;
groupLayout.marginHeight = 10;
wValuesGroup.setLayout(groupLayout);
// Value1
wlValue1 = new Label(wValuesGroup, SWT.RIGHT);
wlValue1.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.Value1.Label"));
props.setLook(wlValue1);
fdlValue1 = new FormData();
fdlValue1.left = new FormAttachment(0, 0);
fdlValue1.top = new FormAttachment(wRegExScriptCompile, margin);
fdlValue1.right = new FormAttachment(middle, -margin);
wlValue1.setLayoutData(fdlValue1);
wValue1 = new Text(wValuesGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wValue1);
fdValue1 = new FormData();
fdValue1.left = new FormAttachment(middle, margin);
fdValue1.top = new FormAttachment(wRegExScriptCompile, margin);
fdValue1.right = new FormAttachment(100, -margin);
wValue1.setLayoutData(fdValue1);
// Value2
wlValue2 = new Label(wValuesGroup, SWT.RIGHT);
wlValue2.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.Value2.Label"));
props.setLook(wlValue2);
fdlValue2 = new FormData();
fdlValue2.left = new FormAttachment(0, 0);
fdlValue2.top = new FormAttachment(wValue1, margin);
fdlValue2.right = new FormAttachment(middle, -margin);
wlValue2.setLayoutData(fdlValue2);
wValue2 = new Text(wValuesGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wValue2);
fdValue2 = new FormData();
fdValue2.left = new FormAttachment(middle, margin);
fdValue2.top = new FormAttachment(wValue1, margin);
fdValue2.right = new FormAttachment(100, -margin);
wValue2.setLayoutData(fdValue2);
// Value3
wlValue3 = new Label(wValuesGroup, SWT.RIGHT);
wlValue3.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.Value3.Label"));
props.setLook(wlValue3);
fdlValue3 = new FormData();
fdlValue3.left = new FormAttachment(0, 0);
fdlValue3.top = new FormAttachment(wValue2, margin);
fdlValue3.right = new FormAttachment(middle, -margin);
wlValue3.setLayoutData(fdlValue3);
wValue3 = new Text(wValuesGroup, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wValue3);
fdValue3 = new FormData();
fdValue3.left = new FormAttachment(middle, margin);
fdValue3.top = new FormAttachment(wValue2, margin);
fdValue3.right = new FormAttachment(100, -margin);
wValue3.setLayoutData(fdValue3);
fdValuesGroup = new FormData();
fdValuesGroup.left = new FormAttachment(0, margin);
fdValuesGroup.top = new FormAttachment(wRegExScriptCompile, margin);
fdValuesGroup.right = new FormAttachment(100, -margin);
wValuesGroup.setLayoutData(fdValuesGroup);
// ///////////////////////////////////////////////////////////
// / END OF VALUEs GROUP
// ////////////////////////
// START OF Values GROUP
//
wCaptureGroups = new Group(wNoteContentComp, SWT.SHADOW_NONE);
props.setLook(wCaptureGroups);
wCaptureGroups.setText("Capture");
FormLayout captureLayout = new FormLayout();
captureLayout.marginWidth = 10;
captureLayout.marginHeight = 10;
wCaptureGroups.setLayout(captureLayout);
// ValueGroup
wlValueGroup = new Label(wCaptureGroups, SWT.RIGHT);
wlValueGroup.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.ValueGroup.Label"));
props.setLook(wlValueGroup);
fdlValueGroup = new FormData();
fdlValueGroup.left = new FormAttachment(0, 0);
fdlValueGroup.top = new FormAttachment(wValuesGroup, margin);
fdlValueGroup.right = new FormAttachment(middle, -margin);
wlValueGroup.setLayoutData(fdlValueGroup);
wValueGroup = new Text(wCaptureGroups, SWT.SINGLE | SWT.LEFT | SWT.BORDER);
props.setLook(wValueGroup);
fdValueGroup = new FormData();
fdValueGroup.left = new FormAttachment(middle, margin);
fdValueGroup.top = new FormAttachment(wValuesGroup, margin);
fdValueGroup.right = new FormAttachment(100, -margin);
wValueGroup.setLayoutData(fdValueGroup);
wlGroups = new Label(wCaptureGroups, SWT.RIGHT);
wlGroups.setText(BaseMessages.getString(PKG, "RegexEvalHelperDialog.GroupFields.Label"));
props.setLook(wlGroups);
fdlGroups = new FormData();
fdlGroups.left = new FormAttachment(0, 0);
fdlGroups.top = new FormAttachment(wValueGroup, margin);
fdlGroups.right = new FormAttachment(middle, -margin);
wlGroups.setLayoutData(fdlGroups);
wGroups = new List(wCaptureGroups, SWT.LEFT | SWT.BORDER | SWT.V_SCROLL | SWT.H_SCROLL | SWT.SINGLE);
props.setLook(wValue3);
fdGroups = new FormData();
fdGroups.left = new FormAttachment(middle, margin);
fdGroups.top = new FormAttachment(wValueGroup, margin);
fdGroups.right = new FormAttachment(100, -margin);
fdGroups.bottom = new FormAttachment(100, -margin);
wGroups.setLayoutData(fdGroups);
fdCaptureGroups = new FormData();
fdCaptureGroups.left = new FormAttachment(0, margin);
fdCaptureGroups.top = new FormAttachment(wValuesGroup, margin);
fdCaptureGroups.right = new FormAttachment(100, -margin);
fdCaptureGroups.bottom = new FormAttachment(100, -margin);
wCaptureGroups.setLayoutData(fdCaptureGroups);
// ///////////////////////////////////////////////////////////
// / END OF VALUEs GROUP
// ///////////////////////////////////////////////////////////
fdNoteContentComp = new FormData();
fdNoteContentComp.left = new FormAttachment(0, 0);
fdNoteContentComp.top = new FormAttachment(0, 0);
fdNoteContentComp.right = new FormAttachment(100, 0);
fdNoteContentComp.bottom = new FormAttachment(100, 0);
wNoteContentComp.setLayoutData(fdNoteContentComp);
wNoteContentComp.layout();
wNoteContentTab.setControl(wNoteContentComp);
// ///////////////////////////////////////////////////////////
// / END OF NOTE CONTENT TAB
// ///////////////////////////////////////////////////////////
// ////////////////////////
fdNoteFolder = new FormData();
fdNoteFolder.left = new FormAttachment(0, 0);
fdNoteFolder.top = new FormAttachment(0, margin);
fdNoteFolder.right = new FormAttachment(100, 0);
fdNoteFolder.bottom = new FormAttachment(100, -50);
wNoteFolder.setLayoutData(fdNoteFolder);
// Some buttons
wOK = new Button(shell, SWT.PUSH);
wOK.setText(BaseMessages.getString(PKG, "System.Button.OK"));
wCancel = new Button(shell, SWT.PUSH);
wCancel.setText(BaseMessages.getString(PKG, "System.Button.Cancel"));
BaseStepDialog.positionBottomButtons(shell, new Button[] { wOK, wCancel }, margin, wNoteFolder);
// Add listeners
lsOK = new Listener() {
public void handleEvent(Event e) {
ok();
}
};
lsCancel = new Listener() {
public void handleEvent(Event e) {
cancel();
}
};
wOK.addListener(SWT.Selection, lsOK);
wCancel.addListener(SWT.Selection, lsCancel);
wValue1.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
testValue(1, true, null);
}
});
wValue2.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
testValue(2, true, null);
}
});
wValue3.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
testValue(3, true, null);
}
});
wValueGroup.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
testValue(4, true, null);
}
});
wRegExScript.addModifyListener(new ModifyListener() {
public void modifyText(ModifyEvent e) {
errorDisplayed = false;
testValues();
}
});
// Detect [X] or ALT-F4 or something that kills this window...
shell.addShellListener(new ShellAdapter() {
public void shellClosed(ShellEvent e) {
cancel();
}
});
getData();
BaseStepDialog.setSize(shell);
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
return regexscript;
}
Aggregations