use of org.pentaho.di.ui.core.dialog.EnterStringDialog in project pentaho-kettle by pentaho.
the class Translator2 method search.
protected void search(String searchLocale) {
// Ask for the search string...
//
EnterStringDialog dialog = new EnterStringDialog(shell, Const.NVL(searchString, ""), BaseMessages.getString(PKG, "i18nDialog.SearchKey"), BaseMessages.getString(PKG, "i18nDialog.SearchLocale1") + " '" + Const.NVL(searchLocale, "") + "' " + BaseMessages.getString(PKG, "i18nDialog.SearchLocale2"));
searchString = dialog.open();
lastFoundKey = null;
searchAgain(searchLocale);
}
use of org.pentaho.di.ui.core.dialog.EnterStringDialog in project pentaho-kettle by pentaho.
the class TransGraph method copies.
public void copies(StepMeta stepMeta) {
final boolean multipleOK = checkNumberOfCopies(transMeta, stepMeta);
selectedSteps = null;
String tt = BaseMessages.getString(PKG, "TransGraph.Dialog.NrOfCopiesOfStep.Title");
String mt = BaseMessages.getString(PKG, "TransGraph.Dialog.NrOfCopiesOfStep.Message");
EnterStringDialog nd = new EnterStringDialog(shell, stepMeta.getCopiesString(), tt, mt, true, transMeta);
String cop = nd.open();
if (!Utils.isEmpty(cop)) {
int copies = Const.toInt(transMeta.environmentSubstitute(cop), -1);
if (copies > 1 && !multipleOK) {
cop = "1";
MessageBox mb = new MessageBox(shell, SWT.YES | SWT.ICON_WARNING);
mb.setMessage(BaseMessages.getString(PKG, "TransGraph.Dialog.MultipleCopiesAreNotAllowedHere.Message"));
mb.setText(BaseMessages.getString(PKG, "TransGraph.Dialog.MultipleCopiesAreNotAllowedHere.Title"));
mb.open();
}
String cps = stepMeta.getCopiesString();
if ((cps != null && !cps.equals(cop)) || (cps == null && cop != null)) {
stepMeta.setChanged();
}
stepMeta.setCopiesString(cop);
spoon.refreshGraph();
}
}
use of org.pentaho.di.ui.core.dialog.EnterStringDialog in project pentaho-kettle by pentaho.
the class RepositoryExplorerDialog method createDirectory.
public void createDirectory(TreeItem ti, RepositoryDirectoryInterface repdir) {
EnterStringDialog esd = new EnterStringDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.AskName.Default"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.AskName.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.AskName.Message"));
String newdir = esd.open();
if (newdir != null) {
RepositoryDirectoryInterface rd = new RepositoryDirectory(repdir, newdir);
String[] path = rd.getPathArray();
RepositoryDirectoryInterface exists = directoryTree.findDirectory(path);
if (exists == null) {
try {
rep.saveRepositoryDirectory(rd);
} catch (Exception exception) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.UnexpectedError.Message1") + newdir + BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.UnexpectedError.Message2") + repdir.getPath() + "]", BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.UnexpectedError.Title"), exception);
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.AlreadyExists.Message1") + newdir + BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.AlreadyExists.Message2") + repdir.getPath() + BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.AlreadyExists.Message3"));
mb.setText(BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Create.AlreadyExists.Title"));
mb.open();
}
}
}
use of org.pentaho.di.ui.core.dialog.EnterStringDialog in project pentaho-kettle by pentaho.
the class SelectDirectoryDialog method setTreeMenu.
public void setTreeMenu() {
Menu mTree = null;
// use SWT.SINGLE in wTree!!!!
TreeItem[] ti = wTree.getSelection();
if (ti.length == 1) {
mTree = new Menu(wTree);
/*
* NEW Sub-directory
*/
MenuItem miNew = new MenuItem(mTree, SWT.CASCADE);
miNew.setText(BaseMessages.getString(PKG, "SelectDirectoryDialog.PopupMenu.Directory.New"));
miNew.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (!readOnly) {
TreeItem ti = wTree.getSelection()[0];
String[] str = ConstUI.getTreeStrings(ti);
//
// In which directory do we want create a subdirectory?
//
RepositoryDirectoryInterface dir = repositoryTree.findDirectory(str);
if (dir != null) {
//
// What's the name of the new directory?
//
EnterStringDialog etd = new EnterStringDialog(shell, BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.EnterDirectoryName.Title"), BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.EnterDirectoryName.Message"), BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.EnterDirectoryName.Default"));
String newdir = etd.open();
if (newdir != null) {
RepositoryDirectory subdir = new RepositoryDirectory(dir, newdir);
try {
rep.saveRepositoryDirectory(subdir);
dir.addSubdirectory(subdir);
TreeItem tiNew = new TreeItem(ti, SWT.NONE);
tiNew.setText(newdir);
tiNew.setImage(GUIResource.getInstance().getImageFolder());
wTree.setSelection(new TreeItem[] { tiNew });
} catch (Exception exception) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.UnableToCreateDirectory.Message"), BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.UnableToCreateDirectory.Title"), exception);
}
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.UnableToLocateDirectory.Message"));
mb.setText(BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.UnableToLocateDirectory.Title"));
mb.open();
}
} else {
MessageBox mb = new MessageBox(shell, SWT.ICON_ERROR | SWT.OK);
mb.setMessage(BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.PermissionDenied.Message1") + (rep.getUserInfo() == null ? "" : rep.getUserInfo().getLogin()) + BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.PermissionDenied.Message2"));
mb.setText(BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.PermissionDenied.Title"));
mb.open();
}
}
});
/*
* RENAME directory
*/
MenuItem miRen = new MenuItem(mTree, SWT.CASCADE);
miRen.setText(BaseMessages.getString(PKG, "SelectDirectoryDialog.PopupMenu.Directory.Rename"));
miRen.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (!readOnly) {
TreeItem ti = wTree.getSelection()[0];
String[] str = ConstUI.getTreeStrings(ti);
RepositoryDirectoryInterface dir = repositoryTree.findDirectory(str);
if (dir != null) {
//
// What's the new name of the directory?
//
String oldName = dir.getName();
EnterStringDialog etd = new EnterStringDialog(shell, oldName, BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.EnterDirectoryNewName.Message"), BaseMessages.getString(PKG, "SelectDirectoryDialog.Dialog.EnterDirectoryNewName.Title"));
String newName = etd.open();
if (newName != null && !newName.equals(oldName)) {
dir.setName(newName);
try {
rep.renameRepositoryDirectory(dir.getObjectId(), dir.getParent(), newName);
ti.setText(newName);
wTree.setSelection(ti);
} catch (Exception exception) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Rename.UnexpectedError.Message1") + oldName + "]" + Const.CR + BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Rename.UnexpectedError.Message2"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Rename.UnexpectedError.Title"), exception);
}
}
}
}
}
});
MenuItem miDel = new MenuItem(mTree, SWT.CASCADE);
miDel.setText(BaseMessages.getString(PKG, "SelectDirectoryDialog.PopupMenu.Directory.Delete"));
miDel.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
if (!readOnly) {
TreeItem ti = wTree.getSelection()[0];
String[] str = ConstUI.getTreeStrings(ti);
RepositoryDirectoryInterface dir = repositoryTree.findDirectory(str);
if (dir != null) {
try {
rep.deleteRepositoryDirectory(dir);
ti.dispose();
} catch (KettleException exception) {
new ErrorDialog(shell, BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Delete.ErrorRemoving.Title"), BaseMessages.getString(PKG, "RepositoryExplorerDialog.Directory.Delete.ErrorRemoving.Message1"), exception);
}
}
}
}
});
}
wTree.setMenu(mTree);
}
Aggregations