List of usage examples for org.eclipse.jface.dialogs InputDialog open
public int open()
From source file:Ariva.java
License:Apache License
private void showInput() { // create dialog InputDialog dialog = new InputDialog(ListAriva.shell, "Search", "type string here", "", null); // if ok/*from w w w .j a v a 2s . c o m*/ if (dialog.open() == Window.OK) { // get value String value = dialog.getValue(); // if value not null if (value != null) { // debug // System.out.println(value); // send input sendInput(value); } } }
From source file:ac.soton.eventb.roseEditor.propertySections.abstracts.AbstractTablePropertySection.java
License:Open Source License
protected String getNewDataValue() { Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(); InputDialog inputDialog = new InputDialog(shell, "Add new " + getFeature().getName(), "Input new value for " + getFeature().getName(), "", null); inputDialog.create();//w w w .j a va2 s .c o m inputDialog.open(); return inputDialog.getValue(); }
From source file:ac.soton.eventb.statemachines.navigator.actions.AddStatemachineHandler.java
License:Open Source License
@Override public Object execute(ExecutionEvent event) throws ExecutionException { ISelection selection = HandlerUtil.getCurrentSelectionChecked(event); if (selection instanceof IStructuredSelection) { Object element = ((IStructuredSelection) selection).getFirstElement(); if (element instanceof IMachineRoot) { IMachineRoot machineRoot = (IMachineRoot) element; IFile file = machineRoot.getResource(); if (file != null && file.exists()) { InputDialog dialog = new InputDialog(Display.getCurrent().getActiveShell(), "New Statemachine", "Enter statemachine name: ", null, nameValidator); if (dialog.open() == InputDialog.CANCEL) return null; String name = dialog.getValue().trim(); URI machineURI = URI.createPlatformResourceURI(file.getFullPath().toOSString(), true); Statemachine statemachine = StatemachinesFactory.eINSTANCE.createStatemachine(); statemachine.setName(name); try { AddStatemachineCommand command = new AddStatemachineCommand(machineURI, statemachine); if (command.canExecute()) command.execute(new NullProgressMonitor(), null); } catch (Exception e) { StatemachinesNavigatorPlugin.getDefault().logError("Creating statemachine failed", e); }/* w w w .j a v a 2 s .co m*/ } } } return null; }
From source file:admix.AdmixWorkflow.java
License:Open Source License
public static void admixSearch(AdmixProj proj) { String search = ""; InputDialog dlg = new InputDialog(Display.getCurrent().getActiveShell(), "", "Enter Subject name", "", new LengthValidator()); if (dlg.open() == Window.OK) { // User clicked OK; update the label with the input search = (dlg.getValue());// w w w .j a v a2 s .co m } else { return; } ASubject[] subjects = proj.getDrawInfo().get(0).getSubjects(); ArrayList<ASubject> subjs = getMatchingSubjects(search, subjects); if (subjs.size() == 1) { selectSubject(subjs.get(0), proj); return; } else if (subjs.size() > 1) { String[] names = new String[subjs.size()]; for (int x = 0; x < subjs.size(); x++) { names[x] = subjs.get(x).getSubject().getName(); } PopupList list = new PopupList(UI.mainWindow); list.setItems(names); String chosen = list.open(new Rectangle(UI.display.getBounds().width / 2 - 50, UI.display.getBounds().height / 2 - 50, 250, 50)); ASubject s = findASubjectByName(chosen, proj.getDrawInfo().get(0)); if (s != null) { selectSubject(s, proj); } } else { MessageBox messageBox = new MessageBox(UI.mainWindow, SWT.ICON_INFORMATION); messageBox.setMessage("Couldn't find " + search + " in the data."); messageBox.setText("Sorry!"); messageBox.open(); } }
From source file:at.rc.tacos.client.controller.CancelTransportAction.java
License:Open Source License
@Override public void run() { // the selection ISelection selection = viewer.getSelection(); // get the selected transport Transport transport = (Transport) ((IStructuredSelection) selection).getFirstElement(); // check if the object is currently locked String resultLockMessage = LockManager.sendLock(Transport.ID, transport.getTransportId()); // check the result of the lock if (resultLockMessage != null) { boolean forceEdit = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Information: Eintrag wird bearbeitet", "Der Transport den Sie stornieren mchten wird bereits von " + resultLockMessage + " bearbeitet.\n" + "Ein gleichzeitiges Bearbeiten kann zu unerwarteten Fehlern fhren!\n\n" + "Es wird dringend empfohlen, den Eintrag erst nach Freigabe durch " + resultLockMessage + " zu stornieren!\n\n" + "Mchten Sie den Eintrag trotzdem sofort stornieren?"); if (!forceEdit) return; // log the override of the lock String username = SessionManager.getInstance().getLoginInformation().getUsername(); Activator.getDefault().log("Der Eintrag " + transport + " wird trotz Sperrung durch " + resultLockMessage + " von " + username + " bearbeitet", Status.WARNING); }//ww w . j a v a 2s .c o m // confirm the cancel InputDialog dlg = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Transport Stornierung", "Bitte geben Sie Informationen zur Stornierung ein", null, null); if (dlg.open() == Window.OK) { transport.setNotes(transport.getNotes() + " Stornoinformation: " + dlg.getValue()); transport.setProgramStatus(PROGRAM_STATUS_JOURNAL); transport.setTransportNumber(Transport.TRANSPORT_CANCLED); NetWrapper.getDefault().sendUpdateMessage(Transport.ID, transport); } // remove the lock from the object LockManager.removeLock(Transport.ID, transport.getTransportId()); }
From source file:at.rc.tacos.client.controller.DetachCarAction.java
License:Open Source License
@Override public void run() { // the selection ISelection selection = viewer.getSelection(); // get the selected transport Transport transport = (Transport) ((IStructuredSelection) selection).getFirstElement(); // check if the object is currently locked String resultLockMessage = LockManager.sendLock(Transport.ID, transport.getTransportId()); // check the result of the lock if (resultLockMessage != null) { boolean forceEdit = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Information: Eintrag wird bearbeitet", "Der Transport,von dem Sie das Fahrzeug abziehen mchten wird bereits von " + resultLockMessage + " bearbeitet.\n" + "Ein gleichzeitiges Bearbeiten kann zu unerwarteten Fehlern fhren!\n\n" + "Es wird dringend empfohlen, das Fahrzeug erst nach Freigabe durch " + resultLockMessage + " abzuziehen!\n\n" + "Mchten Sie das Fahrzeug trotzdem abziehen?"); if (!forceEdit) return; // log the override of the lock String username = SessionManager.getInstance().getLoginInformation().getUsername(); Activator.getDefault().log("Der Eintrag " + transport + " wird trotz Sperrung durch " + resultLockMessage + " von " + username + " bearbeitet", Status.WARNING); }/*w ww. j a va 2 s .co m*/ // confirm the cancel InputDialog dlg = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Transport Stornierung", "Bitte geben Sie eine Begrndung fr das Abziehen des Fahrzeuges" + " " + transport.getVehicleDetail().getVehicleName() + " ein", null, null); if (dlg.open() == Window.OK) { transport.getStatusMessages().clear(); transport.clearVehicleDetail(); transport.setNotes(transport.getNotes() + "Fahrzeugabzug: " + dlg.getValue() + "; "); transport.setProgramStatus(PROGRAM_STATUS_OUTSTANDING); NetWrapper.getDefault().sendUpdateMessage(Transport.ID, transport); } // remove the lock from the object LockManager.removeLock(Transport.ID, transport.getTransportId()); }
From source file:at.rc.tacos.client.controller.EmptyTransportAction.java
License:Open Source License
@Override public void run() { // the selection ISelection selection = viewer.getSelection(); // get the selected transport Transport transport = (Transport) ((IStructuredSelection) selection).getFirstElement(); // check if the object is currently locked String resultLockMessage = LockManager.sendLock(Transport.ID, transport.getTransportId()); // check the result of the lock if (resultLockMessage != null) { boolean forceEdit = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Information: Eintrag wird bearbeitet", "Der Transport,den Sie bearbeiten mchten wird bereits von " + resultLockMessage + " bearbeitet.\n" + "Ein gleichzeitiges Bearbeiten kann zu unerwarteten Fehlern fhren!\n\n" + "Es wird dringend empfohlen, den Transport erst nach Freigabe durch " + resultLockMessage + " als Leerfahrt zu kennzeichnen!\n\n" + "Mchten Sie das Fahrzeug trotzdem bearbeiten?"); if (!forceEdit) return; // log the override of the lock String username = SessionManager.getInstance().getLoginInformation().getUsername(); Activator.getDefault().log("Der Eintrag " + transport + " wird trotz Sperrung durch " + resultLockMessage + " von " + username + " bearbeitet", Status.WARNING); }/* w w w . ja v a 2 s .c o m*/ // confirm the cancel InputDialog dlg = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Leerfahrt", "Bitte geben Sie Informationen zur Leerfahrt ein", null, null); if (dlg.open() == Window.OK) { transport.setNotes(transport.getNotes() + " Leerfahrtinformation: " + dlg.getValue()); transport.setProgramStatus(PROGRAM_STATUS_JOURNAL); NetWrapper.getDefault().sendUpdateMessage(Transport.ID, transport); } // remove the lock from the object LockManager.removeLock(Transport.ID, transport.getTransportId()); }
From source file:at.rc.tacos.client.controller.ForwardTransportAction.java
License:Open Source License
@Override public void run() { // the selection ISelection selection = viewer.getSelection(); // get the selected transport Transport transport = (Transport) ((IStructuredSelection) selection).getFirstElement(); // check if the object is currently locked String resultLockMessage = LockManager.sendLock(Transport.ID, transport.getTransportId()); // check the result of the lock if (resultLockMessage != null) { boolean forceEdit = MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "Information: Eintrag wird bearbeitet", "Der Transport den Sie weiterleiten mchten wird bereits von " + resultLockMessage + " bearbeitet.\n" + "Ein gleichzeitiges Bearbeiten kann zu unerwarteten Fehlern fhren!\n\n" + "Es wird dringend empfohlen, den Eintrag erst nach Freigabe durch " + resultLockMessage + " zu stornieren!\n\n" + "Mchten Sie den Eintrag trotzdem sofort weiterleiten?"); if (!forceEdit) return; // log the override of the lock String username = SessionManager.getInstance().getLoginInformation().getUsername(); Activator.getDefault().log("Der Eintrag " + transport + " wird trotz Sperrung durch " + resultLockMessage + " von " + username + " bearbeitet", Status.WARNING); }//from w w w . j a v a 2 s. c o m // confirm the cancel InputDialog dlg = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Weiterleitung", "Bitte geben Sie Informationen zur Weiterleitung ein", null, null); if (dlg.open() == Window.OK) { transport.setNotes(transport.getNotes() + " Weiterleitungsinformation: " + dlg.getValue()); transport.setProgramStatus(PROGRAM_STATUS_JOURNAL); transport.setTransportNumber(Transport.TRANSPORT_FORWARD); NetWrapper.getDefault().sendUpdateMessage(Transport.ID, transport); } // remove the lock from the object LockManager.removeLock(Transport.ID, transport.getTransportId()); }
From source file:at.rc.tacos.client.controller.PersonalSignInAction.java
License:Open Source License
@Override public void run() { // the selection ISelection selection = viewer.getSelection(); // get the selected entry RosterEntry entry = (RosterEntry) ((IStructuredSelection) selection).getFirstElement(); // confirm the cancel InputDialog dlg = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Anmeldezeit", "Bitte geben Sie die Anmeldezeit ein", MyUtils.timestampToString(new Date().getTime(), MyUtils.timeFormat), new DateValidator()); if (dlg.open() == Window.OK) { // get the hour and the minutes long time = MyUtils.stringToTimestamp(dlg.getValue(), MyUtils.timeFormat); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(time);//from ww w . j a va 2 s . c o m // the hour and the minutes int hour = cal.get(Calendar.HOUR_OF_DAY); int minutes = cal.get(Calendar.MINUTE); // now set up a new calendar with the current time and overwrite the // minutes and the hours cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, minutes); // send the update message entry.setRealStartOfWork(cal.getTimeInMillis()); NetWrapper.getDefault().sendUpdateMessage(RosterEntry.ID, entry); } }
From source file:at.rc.tacos.client.controller.PersonalSignOutAction.java
License:Open Source License
@Override public void run() { // the selection ISelection selection = viewer.getSelection(); // get the selected entry RosterEntry entry = (RosterEntry) ((IStructuredSelection) selection).getFirstElement(); // confirm the cancel InputDialog dlg = new InputDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Abmelden", "Bitte geben Sie die Abmeldezeit ein", MyUtils.timestampToString(new Date().getTime(), MyUtils.timeFormat), new DateValidator()); if (dlg.open() == Window.OK) { // get the hour and the minutes long time = MyUtils.stringToTimestamp(dlg.getValue(), MyUtils.timeFormat); Calendar cal = Calendar.getInstance(); cal.setTimeInMillis(time);//w w w . j av a 2s .co m // the hour and the minutes int hour = cal.get(Calendar.HOUR_OF_DAY); int minutes = cal.get(Calendar.MINUTE); // now set up a new calendar with the current time and overwrite the // minutes and the hours cal = Calendar.getInstance(); cal.set(Calendar.HOUR_OF_DAY, hour); cal.set(Calendar.MINUTE, minutes); // send the update message entry.setRealEndOfWork(cal.getTimeInMillis()); NetWrapper.getDefault().sendUpdateMessage(RosterEntry.ID, entry); } }