本文整理汇总了Java中org.eclipse.jface.dialogs.InputDialog.OK属性的典型用法代码示例。如果您正苦于以下问题:Java InputDialog.OK属性的具体用法?Java InputDialog.OK怎么用?Java InputDialog.OK使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.eclipse.jface.dialogs.InputDialog
的用法示例。
在下文中一共展示了InputDialog.OK属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getNewInputObject
protected String getNewInputObject(){
String returnvalue = null;
ProxyInputDialog inputDialog = new ProxyInputDialog(getShell());
if (inputDialog.open() == InputDialog.OK) {
// check for valid Input
try {
String name = inputDialog.getName();
String host = inputDialog.getHost();
String port = inputDialog.getPort();
String inputText = name + "," + host + "," + port;
// parse String for empty fields
ProxyItem.createFromString(inputText);
returnvalue = inputText;
} catch (Exception e) {
MessageDialog.openError(getShell(), "Wrong entry", "None of the fields must be left blank");
}
}
return returnvalue;
}
示例2: openRefactorDialog
@Override
public void openRefactorDialog(String projectName, String resourceBundleId,String oldKey, String enumName) {
KeyRefactoringDialog dialog = new KeyRefactoringDialog(Display.getDefault().getActiveShell());
DialogConfiguration config = dialog.new DialogConfiguration();
config.setPreselectedKey(oldKey);
config.setPreselectedBundle(resourceBundleId);
config.setProjectName(projectName);
dialog.setDialogConfiguration(config);
if (dialog.open() != InputDialog.OK) {
return;
}
refactorKey(projectName, resourceBundleId, config.getSelectedLocale(),oldKey, config.getNewKey(), enumName);
}
示例3: execute
@Override
public void execute() {
newDataset = (JRDesignDataset) originalDataset.clone();
boolean operationAborted = false;
try {
while (jrDesign.getDatasetMap().containsKey(newDataset.getName()) && !operationAborted) {
String defaultName = ModelUtils.getDefaultName(jrDesign.getDatasetMap(), "CopyOfDataset_"); //$NON-NLS-1$
InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(),
Messages.CreateFieldCommand_field_name, Messages.CreateFieldCommand_field_name_text_dialog, defaultName,
null);
if (dlg.open() == InputDialog.OK) {
newDataset.setName(dlg.getValue());
} else
operationAborted = true;
}
if (!operationAborted)
jrDesign.addDataset(newDataset);
} catch (JRException e) {
e.printStackTrace();
}
}
示例4: execute
@Override
public void execute() {
if (jrParameter == null) {
this.jrParameter = MParameter.createJRParameter(jrDataset);
}
if (jrParameter != null) {
try {
if (index < 0 || index > jrDataset.getParametersList().size())
jrDataset.addParameter(jrParameter);
else
jrDataset.addParameter(index, jrParameter);
} catch (JRException e) {
e.printStackTrace();
if (e.getMessage().startsWith("Duplicate declaration")) { //$NON-NLS-1$
String defaultName = ModelUtils.getDefaultName(jrDataset.getParametersMap(), "CopyOFParameter_"); //$NON-NLS-1$
InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(),
Messages.CreateParameterCommand_parameter_name,
Messages.CreateParameterCommand_parameter_name_dialog_text, defaultName, null);
if (dlg.open() == InputDialog.OK) {
jrParameter.setName(dlg.getValue());
execute();
}
}
}
}
}
示例5: execute
@Override
public void execute() {
if (jrStyle == null) {
this.jrStyle = MStyle.createJRStyle(jrDesign);
}
if (jrStyle != null) {
try {
if (index < 0 || index > jrDesign.getStylesList().size())
jrDesign.addStyle(jrStyle);
else
jrDesign.addStyle(index, jrStyle);
} catch (JRException e) {
e.printStackTrace();
if (e.getMessage().startsWith("Duplicate declaration")) { //$NON-NLS-1$
String defaultName = ModelUtils.getDefaultName(jrDesign.getStylesMap(), "CopyOf_"+jrStyle.getName()); //$NON-NLS-1$
InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(),
Messages.CreateStyleCommand_style_name, Messages.CreateStyleCommand_style_name_dialog_text, defaultName,
null);
if (dlg.open() == InputDialog.OK) {
jrStyle.setName(dlg.getValue());
execute();
}
}
}
}
}
示例6: execute
@Override
public void execute() {
if (jrScriptlet == null) {
this.jrScriptlet = MScriptlet.createJRScriptlet(jrDataset);
}
if (jrScriptlet != null) {
try {
if (index >= 0 && index < jrDataset.getScriptletsList().size())
jrDataset.addScriptlet(index, jrScriptlet);
else
jrDataset.addScriptlet(jrScriptlet);
} catch (JRException e) {
e.printStackTrace();
if (e.getMessage().startsWith("Duplicate declaration")) { //$NON-NLS-1$
String defaultName = ModelUtils.getDefaultName(jrDataset.getScriptletsMap(), "CopyOFScriptlet_"); //$NON-NLS-1$
InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(),
Messages.CreateScriptletCommand_scriptlet_name,
Messages.CreateScriptletCommand_scriptlet_name_dialog_text, defaultName, null);
if (dlg.open() == InputDialog.OK) {
jrScriptlet.setName(dlg.getValue());
execute();
}
}
}
}
}
示例7: promptForCommitInsideDisplayThread
private static void promptForCommitInsideDisplayThread(Shell shell, Optional<String> name) {
InputDialog dialog = new InputDialog(
shell, "Commit Message", "Please enter a commit message"
+ name.map(n -> " for the diagram: " + n).orElse(StringUtils.EMPTY) + ".",
StringUtils.EMPTY, EditorLauncherBase::isValidCommitMessage);
dialog.setBlockOnOpen(true);
if (dialog.open() != InputDialog.OK) {
return;
}
String commitMessage = dialog.getValue();
try {
transformationManager.handleEditorMerge(commitMessage);
} catch (CommitException e) {
LOGGER.error("Failed to merge branch into master.", e);
ErrorDialog.openError(shell, "Commit failed",
"The requested commit failed. "
+ "The changes stay in the temporary branch but will not appear on the master branch.",
new Status(Status.ERROR, null, "Merging of branches failed.", e));
}
}
示例8: run
@Override
public void run(IAction action) {
IInputValidator validator = new IInputValidator() {
@Override
public String isValid(String newText) {
if (newText.trim().length() == 0) {
return "Name cannot be empty";
}
return null;
}
};
InputDialog d = new InputDialog(EditorUtils.getShell(), "App name",
"Name of the django app to makemigrations on", "",
validator);
int retCode = d.open();
if (retCode == InputDialog.OK) {
createApp(d.getValue().trim());
}
}
示例9: run
@Override
public void run(IAction action) {
IInputValidator validator = new IInputValidator() {
@Override
public String isValid(String newText) {
if (newText.trim().length() == 0) {
return "Name cannot be empty";
}
return null;
}
};
InputDialog d = new InputDialog(EditorUtils.getShell(), "App name", "Name of the django app to be created", "",
validator);
int retCode = d.open();
if (retCode == InputDialog.OK) {
createApp(d.getValue().trim());
}
}
示例10: getNewInputObject
/**
* Creates and returns a new item for the list.
* <p>
* Subclasses must implement this method.
* </p>
*
* @return a new item
*/
protected String getNewInputObject() {
String defaultValue = "";
if (list.getSelection().length != 0) {
defaultValue = list.getSelection()[0];
}
InputDialog dialog = new InputDialog(getShell(), "New Tomcat JVM paramater", "Enter a JVM parameter", defaultValue, null);
String param = null;
int dialogCode = dialog.open();
if (dialogCode == InputDialog.OK) {
param = dialog.getValue();
if (param != null) {
param = param.trim();
if (param.length() == 0)
return null;
}
}
return param;
}
示例11: getNewInputObject
protected String getNewInputObject(){
String returnvalue = null;
SSLInputDialog inputDialog = new SSLInputDialog(getShell());
if (inputDialog.open() == InputDialog.OK) {
// check for valid Input
try {
returnvalue = inputDialog.getName();
} catch (Exception e) {
MessageDialog.openError(getShell(), "Wrong entry", "Wrong entry");
}
}
return returnvalue;
}
示例12: run
/**
* Creates a window for entering the template name, checks the user's input and
* proceeds to save the template.
*/
public void run(IAction action) {
IFile file = ((FileEditorInput)editor.getEditorInput()).getFile();
String fullname = file.getFullPath().toString();
// create dialog
InputQueryDialog dialog = new InputQueryDialog(editor.getEditorSite().getShell(),
TexlipsePlugin.getResourceString("templateSaveDialogTitle"),
TexlipsePlugin.getResourceString("templateSaveDialogMessage").replaceAll("%s", fullname),
file.getName().substring(0,file.getName().lastIndexOf('.')),
new IInputValidator() {
public String isValid(String newText) {
if (newText != null && newText.length() > 0) {
return null; // no error
}
return TexlipsePlugin.getResourceString("templateSaveErrorFileName");
}});
if (dialog.open() == InputDialog.OK) {
String newName = dialog.getInput();
// check existing
boolean reallySave = true;
if (ProjectTemplateManager.templateExists(newName)) {
reallySave = MessageDialog.openConfirm(editor.getSite().getShell(),
TexlipsePlugin.getResourceString("templateSaveOverwriteTitle"),
TexlipsePlugin.getResourceString("templateSaveOverwriteText").replaceAll("%s", newName));
}
if (reallySave) {
ProjectTemplateManager.saveProjectTemplate(file, newName);
}
}
}
示例13: mkdir
/**
* Create a new sub-folder into an existing directory
*
* @param selection
*/
private void mkdir(IStructuredSelection selection) {
List<DFSFolder> folders = filterSelection(DFSFolder.class, selection);
if (folders.size() >= 1) {
DFSFolder folder = folders.get(0);
InputDialog dialog =
new InputDialog(Display.getCurrent().getActiveShell(),
"Create subfolder", "Enter the name of the subfolder", "",
null);
if (dialog.open() == InputDialog.OK)
folder.mkdir(dialog.getValue());
}
}
示例14: inputNewName
private String inputNewName(Shell shell, TreeNode node) {
final InputDialog dialog = new InputDialog(
shell, "Rename", "Input new name:", node.name(),
new UIHelper.EntryNameValidator(
Interop.or(node.parent()),
node.isLeaf())
);
if(dialog.open() == InputDialog.OK) {
return dialog.getValue();
}
return null;
}
示例15: unzip
private void unzip() {
IProject project = getProject();
if (project == null) {
showError("Please select valid project");
return;
}
ProjectFileList plist = new ProjectFileList(getProject());
FileDialog dialog = new FileDialog(_getShell(), SWT.OPEN);
dialog.setText("Unzip selected file to project["+project.getName()+"]");
String zipAbsPath = dialog.open();
if (zipAbsPath == null) {
return;
}
try {
if (!plist.setUnzipFilePath(zipAbsPath, null, fAT)) {
InputDialog input = new InputDialog(_getShell(), "Input zip password", zipAbsPath + "required password to extract...", "", null);
if (input.open() != InputDialog.OK) {
return;
}
String pwd = input.getValue();
if (!plist.setUnzipFilePath(zipAbsPath, pwd, fAT)) {
return;
}
}
PlatformUI.getWorkbench().getProgressService().run(true, true, plist);
} catch (Exception e) {
}
}