本文整理汇总了Java中org.eclipse.jface.dialogs.InputDialog.open方法的典型用法代码示例。如果您正苦于以下问题:Java InputDialog.open方法的具体用法?Java InputDialog.open怎么用?Java InputDialog.open使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.dialogs.InputDialog
的用法示例。
在下文中一共展示了InputDialog.open方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getInputObject
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
/**
* @param current
* @return
*/
protected String getInputObject(final String current) {
final InputDialog dialog = new InputDialog(this.getShell(), JVM_NEW_LABEL, JVM_ENTER_LABEL, current, null);
String param = null;
final int dialogCode = dialog.open();
if (dialogCode == 0) {
param = dialog.getValue();
if (param != null) {
param = param.trim();
if (param.length() == 0) {
return null;
}
}
}
return param;
}
示例2: execute
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
NamedElement element = refactoring.getContextObject();
if (element != null) {
IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
InputDialog dialog = new InputDialog(window.getShell(), "Rename..", "Please enter new name:", element.getName(), new NameUniquenessValidator(element));
if (dialog.open() == Window.OK) {
String newName = dialog.getValue();
if (newName != null) {
((RenameRefactoring)refactoring).setNewName(newName);
refactoring.execute();
}
}
}
return null;
}
示例3: onRenameFilterSet
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
private void onRenameFilterSet() {
final TourTypeFilter filter = (TourTypeFilter) ((StructuredSelection) _filterViewer.getSelection())
.getFirstElement();
final InputDialog inputDialog = new InputDialog(
getShell(),
Messages.Pref_TourTypeFilter_dlg_rename_title,
Messages.Pref_TourTypeFilter_dlg_rename_message,
filter.getFilterName(),
null);
inputDialog.open();
if (inputDialog.getReturnCode() != Window.OK) {
return;
}
// update model
filter.setName(inputDialog.getValue().trim());
// update viewer
_filterViewer.update(filter, null);
_isModified = true;
}
示例4: execute
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@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();
}
}
}
}
}
示例5: run
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
public void run() {
KeyTreeNode node = getNodeSelection();
String key = node.getMessageKey();
String msgHead = MessagesEditorPlugin.getString("dialog.add.head");
String msgBody = MessagesEditorPlugin.getString("dialog.add.body");
InputDialog dialog = new InputDialog(
getShell(), msgHead, msgBody, key, new IInputValidator() {
public String isValid(String newText) {
if (getBundleGroup().isMessageKey(newText)) {
return MessagesEditorPlugin.getString(
"dialog.error.exists");
}
return null;
}
});
dialog.open();
if (dialog.getReturnCode() == Window.OK ) {
String inputKey = dialog.getValue();
MessagesBundleGroup messagesBundleGroup = getBundleGroup();
messagesBundleGroup.addMessages(inputKey);
}
}
示例6: queryNewResourceName
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
/**
* Return the new name to be given to the target resource.
*
* @return java.lang.String
* @param resource
* the resource to query status on
*/
protected String queryNewResourceName(final IResource resource) {
final IWorkspace workspace = IDEWorkbenchPlugin.getPluginWorkspace();
final IPath prefix = resource.getFullPath().removeLastSegments(1);
final IInputValidator validator = string -> {
if (resource.getName()
.equals(string)) { return IDEWorkbenchMessages.RenameResourceAction_nameMustBeDifferent; }
final IStatus status = workspace.validateName(string, resource.getType());
if (!status.isOK()) { return status.getMessage(); }
if (workspace.getRoot()
.exists(prefix.append(string))) { return IDEWorkbenchMessages.RenameResourceAction_nameExists; }
return null;
};
final InputDialog dialog =
new InputDialog(WorkbenchHelper.getShell(), IDEWorkbenchMessages.RenameResourceAction_inputDialogTitle,
IDEWorkbenchMessages.RenameResourceAction_inputDialogMessage, resource.getName(), validator);
dialog.setBlockOnOpen(true);
final int result = dialog.open();
if (result == Window.OK)
return dialog.getValue();
return null;
}
示例7: execute
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@Override
public void execute(Event event) {
final ERDiagram diagram = getDiagram();
final List<?> selectedEditParts = getTreeViewer().getSelectedEditParts();
final EditPart editPart = (EditPart) selectedEditParts.get(0);
final Object model = editPart.getModel();
if (model instanceof ERVirtualDiagram) {
final ERVirtualDiagram vdiagram = (ERVirtualDiagram) model;
final InputVirtualDiagramNameValidator validator = new InputVirtualDiagramNameValidator(diagram, vdiagram.getName());
final InputDialog dialog = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Rename",
"Input new name", vdiagram.getName(), validator);
if (dialog.open() == IDialogConstants.OK_ID) {
final ChangeVirtualDiagramNameCommand command = new ChangeVirtualDiagramNameCommand(vdiagram, dialog.getValue());
execute(command);
}
}
}
示例8: execute
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@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();
}
}
示例9: execute
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@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();
}
}
}
}
}
示例10: run
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
/**
* @see org.eclipse.jface.action.Action#run()
*/
@Override
public void run() {
KeyTreeNode node = getNodeSelection();
String key = node != null ? node.getMessageKey() : "new_key";
String msgHead = Messages.dialog_add_head;
String msgBody = Messages.dialog_add_body;
InputDialog dialog = new InputDialog(getShell(), msgHead, msgBody, key,
new IInputValidator() {
public String isValid(String newText) {
if (getBundleGroup().isMessageKey(newText)) {
return Messages.dialog_error_exists;
}
return null;
}
});
dialog.open();
if (dialog.getReturnCode() == Window.OK) {
String inputKey = dialog.getValue();
MessagesBundleGroup messagesBundleGroup = getBundleGroup();
messagesBundleGroup.addMessages(inputKey);
}
}
示例11: handleDefaultValueEditEvent
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
private void handleDefaultValueEditEvent( )
{
InputDialog dialog = new InputDialog(this.getShell( ), DEFAULTVALUE_EDIT_TITLE, DEFAULTVALUE_EDIT_LABEL, DEUtil.resolveNull( input.getDefaultValue( )), null);
if(dialog.open( ) == Window.OK){
String value = dialog.getValue( );
try
{
if(value==null || value.trim( ).length( ) == 0)
input.setDefaultValue( null );
else input.setDefaultValue( value.trim( ) );
defaultValueViewer.refresh( );
}
catch ( SemanticException e )
{
ExceptionHandler.handle( e );
}
}
}
示例12: getGraphingRadius
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
protected int getGraphingRadius(int defaultSize) {
Shell shell = new Shell();
InputDialog dlg = new InputDialog(
shell,
"Graph Radius",
"How many edges from anchor?",
"" + defaultSize,
null);
dlg.open();
if (dlg.getReturnCode() == Window.CANCEL) {
throw new CancellationException();
}
if (dlg.getReturnCode() != Window.OK) {
return defaultSize;
}
String strval = dlg.getValue();
try {
int intVal = Integer.parseInt(strval.trim());
return intVal;
}
catch (Throwable t) {
t.printStackTrace();
}
return defaultSize;
}
示例13: askForColumnPrefixes
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
private void askForColumnPrefixes()
{
// filter empty lines...
InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), "Column name prefix filters",
"Enter a comma separated list of prefix filters to apply on column names", prefixFiltersString, null);
if (dlg.open() == Dialog.OK)
{
computePrefixFilterList(dlg.getValue());
for (IPluginModelBase p : columnsCache.keySet())
{
TreeViewerColumn tc = columnsCache.get(p);
String newTitle = getColumnName(p);
if (!tc.getColumn().isDisposed() && !tc.getColumn().getText().equals(newTitle))
{
tc.getColumn().setText(newTitle);
tc.getColumn().pack();
}
}
tv.refresh();
}
}
示例14: openAskInt
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
public static Integer openAskInt(String title, String message, int initial) {
Shell shell = EditorUtils.getShell();
String initialValue = "" + initial;
IInputValidator validator = new IInputValidator() {
@Override
public String isValid(String newText) {
if (newText.length() == 0) {
return "At least 1 char must be provided.";
}
try {
Integer.parseInt(newText);
} catch (Exception e) {
return "A number is required.";
}
return null;
}
};
InputDialog dialog = new InputDialog(shell, title, message, initialValue, validator);
dialog.setBlockOnOpen(true);
if (dialog.open() == Window.OK) {
return Integer.parseInt(dialog.getValue());
}
return null;
}
示例15: run
import org.eclipse.jface.dialogs.InputDialog; //导入方法依赖的package包/类
@Override
public void run() {
IDatabase db = Database.get();
if (db == null) {
log.trace("no database activated");
return;
}
String defaultName = db.getName() + "_nexus_index.json";
File file = FileChooser.forExport("*.json", defaultName);
if (file == null)
return;
InputDialog dialog = new InputDialog(UI.shell(), "System model name",
"Please specify a system model if relevant (optional)", "", null);
if (dialog.open() != Window.OK)
return;
String systemModel = dialog.getValue();
App.run("Export Nexus index", new Runner(file, db, systemModel));
}