Java Code Examples for org.eclipse.jface.dialogs.InputDialog
The following examples show how to use
org.eclipse.jface.dialogs.InputDialog.
These examples are extracted from open source projects.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: http4e Author: nextinterfaces File: ProxyItemListEditor.java License: Apache License 2.0 | 6 votes |
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; }
Example #2
Source Project: xds-ide Author: excelsior-oss File: SdkToolsControl.java License: Eclipse Public License 1.0 | 6 votes |
private String editGroupName(String initialName, final Set<String> usedNames) { InputDialog dlg = new InputDialog(getShell(), Messages.SdkToolsControl_NewGroupName, Messages.SdkToolsControl_EnterGroupName+':', initialName, new IInputValidator() { @Override public String isValid(String newText) { newText = newText.trim(); if (newText.isEmpty()) { return Messages.SdkToolsControl_NameIsEmpty; } else if (usedNames.contains(newText)) { return Messages.SdkToolsControl_NameIsUsed; } return null; } }); if (dlg.open() == Window.OK) { return dlg.getValue().trim(); } return null; }
Example #3
Source Project: gama Author: gama-platform File: RenameResourceAction.java License: GNU General Public License v3.0 | 6 votes |
/** * 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; }
Example #4
Source Project: ermaster-b Author: naoki-iwami File: VGroupEditPart.java License: Apache License 2.0 | 6 votes |
/** * {@inheritDoc} */ @Override public void performRequestOpen() { VGroup group = (VGroup) this.getModel(); ERDiagram diagram = this.getDiagram(); // VGroup copyGroup = group.clone(); InputDialog dialog = new InputDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "�O���[�v���ύX", "�O���[�v�����͂��ĉ������B", group.getName(), null); if (dialog.open() == IDialogConstants.OK_ID) { CompoundCommand command = new CompoundCommand(); command.add(new ChangeVGroupNameCommand(diagram, group, dialog.getValue())); this.executeCommand(command.unwrap()); } }
Example #5
Source Project: erflute Author: dbflute-session File: ChangeVirtualDiagramNameAction.java License: Apache License 2.0 | 6 votes |
@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); } } }
Example #6
Source Project: slr-toolkit Author: sebastiangoetz File: CreateTermHandler.java License: Eclipse Public License 1.0 | 6 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (selection == null || !(selection instanceof IStructuredSelection)) { return null; } IStructuredSelection currentSelection = (IStructuredSelection) selection; if (currentSelection.size() == 1) { Term term = (Term) currentSelection.getFirstElement(); CreateTermDialog dialog = new CreateTermDialog(null, term.getName()); dialog.setBlockOnOpen(true); if (dialog.open() == InputDialog.OK) { TermCreator.create(dialog.getTermName(), term, dialog.getTermPosition()); } } return null; }
Example #7
Source Project: slr-toolkit Author: sebastiangoetz File: RenameTermHandler.java License: Eclipse Public License 1.0 | 6 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (selection == null || !(selection instanceof IStructuredSelection)) { return null; } IStructuredSelection currentSelection = (IStructuredSelection) selection; if (currentSelection.size() == 1) { Term term = (Term) currentSelection.getFirstElement(); InputDialog dialog = new InputDialog( null, "Rename Term", "Rename Term: " + term.getName() + " to:", term.getName(), null); dialog.setBlockOnOpen(true); if (dialog.open() == InputDialog.OK) { TermRenamer.rename(term, dialog.getValue()); } } return null; }
Example #8
Source Project: Eclipse-Postfix-Code-Completion Author: trylimits File: NewNameQueries.java License: Eclipse Public License 1.0 | 6 votes |
private static INewNameQuery createStaticQuery(final IInputValidator validator, final String message, final String initial, final Shell shell){ return new INewNameQuery(){ public String getNewName() throws OperationCanceledException { InputDialog dialog= new InputDialog(shell, ReorgMessages.ReorgQueries_nameConflictMessage, message, initial, validator) { /* (non-Javadoc) * @see org.eclipse.jface.dialogs.InputDialog#createDialogArea(org.eclipse.swt.widgets.Composite) */ @Override protected Control createDialogArea(Composite parent) { Control area= super.createDialogArea(parent); TextFieldNavigationHandler.install(getText()); return area; } }; if (dialog.open() == Window.CANCEL) throw new OperationCanceledException(); return dialog.getValue(); } }; }
Example #9
Source Project: ermaster-b Author: naoki-iwami File: ERModelAddAction.java License: Apache License 2.0 | 6 votes |
@Override public void execute(Event event) throws Exception { ERDiagram diagram = this.getDiagram(); Settings settings = (Settings) diagram.getDiagramContents() .getSettings().clone(); InputDialog dialog = new InputDialog( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "�_�C�A�O�����쐬", "�_�C�A�O����������͂��ĉ������B", "", null); if (dialog.open() == IDialogConstants.OK_ID) { AddERModelCommand command = new AddERModelCommand(diagram, dialog.getValue()); this.execute(command); } // CategoryManageDialog dialog = new CategoryManageDialog(PlatformUI // .getWorkbench().getActiveWorkbenchWindow().getShell(), // settings, diagram); // // if (dialog.open() == IDialogConstants.OK_ID) { // ChangeSettingsCommand command = new ChangeSettingsCommand(diagram, // settings); // this.execute(command); // } }
Example #10
Source Project: JDeodorant Author: tsantalis File: ZoomInputAction.java License: MIT License | 6 votes |
public void run() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); String dialogBoxTitle = "Custom Zoom"; String message = "Enter Zoom Value (in percent): "; String initialValue = ""; InputDialog dialog = new InputDialog(shell, dialogBoxTitle, message, initialValue, new ZoomValueValidator() ); if(dialog.open() == Window.OK){ String value = dialog.getValue(); if(value != null && (root != null || root2!= null)){ if(isFreeform) this.root.setScale(Double.parseDouble(value)/100); else this.root2.setScale(Double.parseDouble(value)/100); } } }
Example #11
Source Project: birt Author: eclipse File: LevelPropertyDialog.java License: Eclipse Public License 1.0 | 6 votes |
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 ); } } }
Example #12
Source Project: birt Author: eclipse File: CubeGroupContent.java License: Eclipse Public License 1.0 | 6 votes |
/** * @deprecated */ private InputDialog createInputDialog( ReportElementHandle handle, String title, String message ) { InputDialog inputDialog = new InputDialog( getShell( ), title, message, handle.getName( ), null ) { public int open( ) { return super.open( ); } }; inputDialog.create( ); return inputDialog; }
Example #13
Source Project: birt Author: eclipse File: ExportElementToLibraryAction.java License: Eclipse Public License 1.0 | 6 votes |
private void doRename( ) { if ( selectedObj instanceof DesignElementHandle || selectedObj instanceof EmbeddedImageHandle ) { initOriginalName( ); InputDialog inputDialog = new InputDialog( UIUtil.getDefaultShell( ), Messages.getString( "ExportElementToLibraryAction.DialogTitle" ), //$NON-NLS-1$ Messages.getString( "ExportElementToLibraryAction.DialogMessage" ), //$NON-NLS-1$ originalName, null ); inputDialog.create( ); clickOK = false; if ( inputDialog.open( ) == Window.OK ) { saveChanges( inputDialog.getValue( ).trim( ) ); clickOK = true; } } }
Example #14
Source Project: Pydev Author: fabioz File: DialogHelpers.java License: Eclipse Public License 1.0 | 6 votes |
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; }
Example #15
Source Project: Pydev Author: fabioz File: DjangoMakeMigrations.java License: Eclipse Public License 1.0 | 6 votes |
@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()); } }
Example #16
Source Project: Pydev Author: fabioz File: DjangoCreateApp.java License: Eclipse Public License 1.0 | 6 votes |
@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()); } }
Example #17
Source Project: elexis-3-core Author: elexis File: FallPlaneRechnung.java License: Eclipse Public License 1.0 | 6 votes |
public Object execute(ExecutionEvent arg0) throws ExecutionException{ InputDialog dlg = new InputDialog(UiDesk.getTopShell(), Messages.FallPlaneRechnung_PlanBillingHeading, Messages.FallPlaneRechnung_PlanBillingAfterDays, "30", new IInputValidator() { //$NON-NLS-1$ public String isValid(String newText){ if (newText.matches("[0-9]*")) { //$NON-NLS-1$ return null; } return Messages.FallPlaneRechnung_PlanBillingPleaseEnterPositiveInteger; } }); if (dlg.open() == Dialog.OK) { return dlg.getValue(); } return null; }
Example #18
Source Project: elexis-3-core Author: elexis File: AddStringEntryAction.java License: Eclipse Public License 1.0 | 6 votes |
@Override public void run(){ InputDialog inputDialog = new InputDialog(UiDesk.getTopShell(), "Hinzufügen", "Bitte geben Sie die Bezeichnung an", null, null); int retVal = inputDialog.open(); if (retVal != Dialog.OK) { return; } String value = inputDialog.getValue(); if (targetCollection != null) { targetCollection.add(value); structuredViewer.setInput(targetCollection); } else { Object input = structuredViewer.getInput(); if (input instanceof Collection) { ((Collection<String>) input).add(value); structuredViewer.refresh(); } super.run(); } }
Example #19
Source Project: olca-app Author: GreenDelta File: ModelEditor.java License: Mozilla Public License 2.0 | 6 votes |
@Override @SuppressWarnings("unchecked") public void doSaveAs() { InputDialog diag = new InputDialog(UI.shell(), M.SaveAs, M.SaveAs, model.name + " - Copy", (name) -> { if (Strings.nullOrEmpty(name)) return M.NameCannotBeEmpty; if (Strings.nullOrEqual(name, model.name)) return M.NameShouldBeDifferent; return null; }); if (diag.open() != Window.OK) return; String newName = diag.getValue(); try { T clone = (T) model.clone(); clone.name = newName; clone = dao.insert(clone); App.openEditor(clone); Navigator.refresh(); } catch (Exception e) { log.error("failed to save " + model + " as " + newName, e); } }
Example #20
Source Project: olca-app Author: GreenDelta File: DbRenameAction.java License: Mozilla Public License 2.0 | 6 votes |
@Override public void run() { if (config == null) { IDatabaseConfiguration conf = Database.getActiveConfiguration(); if (!(conf instanceof DerbyConfiguration)) return; config = (DerbyConfiguration) conf; } InputDialog dialog = new InputDialog(UI.shell(), M.Rename, M.PleaseEnterANewName, config.getName(), null); if (dialog.open() != Window.OK) return; String newName = dialog.getValue(); if (!DbUtils.isValidName(newName) || Database.getConfigurations() .nameExists(newName.trim())) { MsgBox.error(M.DatabaseRenameError); return; } doRename(newName); }
Example #21
Source Project: olca-app Author: GreenDelta File: DbCopyAction.java License: Mozilla Public License 2.0 | 6 votes |
@Override public void run() { if (config == null) { IDatabaseConfiguration conf = Database.getActiveConfiguration(); if (!(conf instanceof DerbyConfiguration)) return; config = (DerbyConfiguration) conf; } InputDialog dialog = new InputDialog(UI.shell(), M.Copy, M.PleaseEnterAName, config.getName(), null); if (dialog.open() != Window.OK) return; String newName = dialog.getValue(); if (!DbUtils.isValidName(newName) || Database.getConfigurations() .nameExists(newName.trim())) { MsgBox.error(M.NewDatabase_InvalidName); return; } App.runInUI("Copy database", () -> doCopy(newName)); }
Example #22
Source Project: n4js Author: eclipse File: MassOpenHandler.java License: Eclipse Public License 1.0 | 5 votes |
@Override public Object execute(ExecutionEvent event) throws ExecutionException { final InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), "Mass Open", "Enter file names to open\n(separated by space, comma, or semicolon; no paths, just files names):", "", null); if (dlg.open() == Window.OK) { final Set<String> fileNames = parseNamesString(dlg.getValue()); openEditors(fileNames); } return null; }
Example #23
Source Project: neoscada Author: eclipse File: ConfigurationFormToolkit.java License: Eclipse Public License 1.0 | 5 votes |
@Override public void runWithEvent ( final Event event ) { final InputDialog dialog = new InputDialog ( this.shell, "Add key", "Enter the name of the key to add", "", null ); if ( dialog.open () == Window.OK ) { this.map.put ( dialog.getValue (), "" ); } }
Example #24
Source Project: neoscada Author: eclipse File: FactoryEditor.java License: Eclipse Public License 1.0 | 5 votes |
public void handleInsert () { final InputDialog dlg = new InputDialog ( getSite ().getShell (), "Create new configuration", "Enter the id of the new configuration object to create", "", null ); if ( dlg.open () == Window.OK ) { insertEntry ( dlg.getValue () ); } }
Example #25
Source Project: http4e Author: nextinterfaces File: GetUserInput.java License: Apache License 2.0 | 5 votes |
protected Control createContents( Composite parent){ Composite composite = new Composite(parent, SWT.NONE); composite.setLayout(new GridLayout(1, false)); // Create a label to display what the user typed in final Label label = new Label(composite, SWT.NONE); label.setText("This will display the user input from InputDialog"); // Create the button to launch the error dialog Button show = new Button(composite, SWT.PUSH); show.setText("Get Input"); show.addSelectionListener(new SelectionAdapter() { public void widgetSelected( SelectionEvent event){ InputDialog dlg = new InputDialog( Display.getCurrent().getActiveShell(), "Enter Input", "Enter Input", label.getText(), new LengthValidator()); if (dlg.open() == Window.OK) { // User clicked OK; update the label with the input label.setText(dlg.getValue()); } } }); parent.pack(); return composite; }
Example #26
Source Project: http4e Author: nextinterfaces File: SSLEditor.java License: Apache License 2.0 | 5 votes |
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; }
Example #27
Source Project: JAADAS Author: flankerhqd File: SootConfigManagerDialog.java License: GNU General Public License v3.0 | 5 votes |
private void renamePressed(){ if (getSelected() == null) return; String result = this.getSelected(); IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); // gets current number of configurations int config_count = 0; int oldNameCount = 0; try { config_count = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$ } catch (NumberFormatException e) { } ArrayList currentNames = new ArrayList(); for (int i = 1; i <= config_count; i++) { currentNames.add(settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config")+i)); //$NON-NLS-1$ if (((String)currentNames.get(i-1)).equals(result)){ oldNameCount = i; } } // sets validator to know about already used names SootConfigNameInputValidator validator = new SootConfigNameInputValidator(); validator.setAlreadyUsed(currentNames); InputDialog nameDialog = new InputDialog(this.getShell(), Messages.getString("SootConfigManagerDialog.Rename_Saved_Configuration"), Messages.getString("SootConfigManagerDialog.Enter_new_name"), "", validator); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ nameDialog.open(); if (nameDialog.getReturnCode() == Dialog.OK){ settings.put(Messages.getString("SootConfigManagerDialog.soot_run_config")+oldNameCount, nameDialog.getValue()); //$NON-NLS-1$ settings.put(nameDialog.getValue(), settings.getArray(result)); getTreeRoot().renameChild(result, nameDialog.getValue()); saveMainClass(nameDialog.getValue(), settings.get(result+"_mainClass")); } refreshTree(); }
Example #28
Source Project: JAADAS Author: flankerhqd File: SootConfigManagerDialog.java License: GNU General Public License v3.0 | 5 votes |
private void clonePressed(){ if (getSelected() == null) return; String result = this.getSelected(); IDialogSettings settings = SootPlugin.getDefault().getDialogSettings(); // gets current number of configurations int config_count = 0; try { config_count = settings.getInt(Messages.getString("SootConfigManagerDialog.config_count")); //$NON-NLS-1$ } catch (NumberFormatException e) { } ArrayList currentNames = new ArrayList(); for (int i = 1; i <= config_count; i++) { currentNames.add(settings.get(Messages.getString("SootConfigManagerDialog.soot_run_config")+i)); //$NON-NLS-1$ } // sets validator to know about already used names SootConfigNameInputValidator validator = new SootConfigNameInputValidator(); validator.setAlreadyUsed(currentNames); InputDialog nameDialog = new InputDialog(this.getShell(), Messages.getString("SootConfigManagerDialog.Clone_Saved_Configuration"), Messages.getString("SootConfigManagerDialog.Enter_new_name"), result, validator); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ nameDialog.open(); if (nameDialog.getReturnCode() == Dialog.OK){ config_count++; settings.put(Messages.getString("SootConfigManagerDialog.soot_run_config")+config_count, nameDialog.getValue()); //$NON-NLS-1$ settings.put(nameDialog.getValue(), settings.getArray(result)); settings.put(Messages.getString("SootConfigManagerDialog.config_count"), config_count); //$NON-NLS-1$ getTreeRoot().addChild(new SootConfiguration(nameDialog.getValue())); saveMainClass(nameDialog.getValue(), settings.get(result+"_mainClass")); } refreshTree(); }
Example #29
Source Project: texlipse Author: eclipse File: SaveAsTemplateAction.java License: Eclipse Public License 1.0 | 5 votes |
/** * 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); } } }
Example #30
Source Project: olca-app Author: GreenDelta File: GroupPage.java License: Mozilla Public License 2.0 | 5 votes |
private ProcessGroupSet createGroupSet() throws Exception { Shell shell = page.getEditorSite().getShell(); InputDialog dialog = new InputDialog(shell, M.SaveAs, M.PleaseEnterAName, "", null); int code = dialog.open(); if (code == Window.CANCEL) return null; ProcessGroupSet set = new ProcessGroupSet(); set.name = dialog.getValue(); new ProcessGroupSetDao(Database.get()).insert(set); return set; }