List of usage examples for org.eclipse.jface.dialogs MessageDialog openConfirm
public static boolean openConfirm(Shell parent, String title, String message)
From source file:at.bestsolution.efxclipse.tooling.jdt.ui.internal.editors.JFXBuildConfigurationEditor.java
License:Open Source License
/** * handleRemoveSplash.// w w w . j a v a 2s . c o m * * @param value * the value to delete * @return true if value was deleted, and false otherwise. */ private boolean handleRemoveSplash(final Splash value) { if (MessageDialog.openConfirm(getSite().getShell(), "Confirm delete", "Would really like to remove the selected splash")) { RemoveCommand cmd = new RemoveCommand(editingDomain, getTask().getDeploy().getInfo().getSplash(), value); if (cmd.canExecute()) { cmd.execute(); return true; } } return false; }
From source file:at.medevit.elexis.ehc.ui.example.wizard.ImportPatientWizardPage1.java
License:Open Source License
public boolean finish() { IStructuredSelection contentSelection = (IStructuredSelection) contentViewer.getSelection(); if (!contentSelection.isEmpty()) { org.ehealth_connector.common.Patient selectedPatient = (org.ehealth_connector.common.Patient) contentSelection .getFirstElement();/* w ww. j ava 2 s. c o m*/ String gender = selectedPatient.getAdministrativeGenderCode() == AdministrativeGender.FEMALE ? Person.FEMALE : Person.MALE; Patient existing = KontaktMatcher.findPatient(selectedPatient.getName().getFamilyName(), selectedPatient.getName().getGivenNames(), new TimeTool(selectedPatient.getBirthday()).toString(TimeTool.DATE_COMPACT), gender, null, null, null, null, CreateMode.FAIL); if (existing != null) { boolean result = MessageDialog.openConfirm(getShell(), "Patient existiert", "Der Patient existiert bereits sollen die Daten berschrieben werden?"); if (!result) { return true; } } ServiceComponent.getService().getOrCreatePatient(selectedPatient); } return true; }
From source file:at.rc.tacos.client.ApplicationWorkbenchWindowAdvisor.java
License:Open Source License
/** * Handles close events of the workbench window *//*w w w . j av a2 s. c o m*/ @Override public boolean preWindowShellClose() { // confirm quit boolean confirm = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Schlieen besttigen", "Wollen Sie das Leitstellenprogramm wirklich beenden?"); if (!confirm) return false; // check if we have a user info Login login = SessionManager.getInstance().getLoginInformation(); if (login == null) return true; // try to close the connection NetWrapper.getDefault().requestNetworkStop(false); // Close the connection System.out.println("Have a nice day :)"); return true; }
From source file:at.rc.tacos.client.controller.DialysisTransportNowAction.java
License:Open Source License
@Override public void run() { // the selection ISelection selection = viewer.getSelection(); // get the selected dialyse transport DialysisPatient dia = (DialysisPatient) ((IStructuredSelection) selection).getFirstElement(); // check if we have already a transport for today if (MyUtils.isEqualDate(dia.getLastTransportDate(), Calendar.getInstance().getTimeInMillis())) { boolean confirmCreate = MessageDialog.openConfirm( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Dialysetransport besttigen", "Fr diesen Dialysepatienten wurde heute bereits ein Transport erstellt.\n" + "Wollen Sie wirklich noch einen Transport erstellen?"); if (!confirmCreate) return; }//from w w w. j av a 2s .c o m // confirm the action boolean cancelConfirmed = MessageDialog.openQuestion( PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Dialysetransport jetzt durchfhren", "Mchten Sie den Dialysetransport wirklich jetzt durchfhren?"); if (!cancelConfirmed) return; // set the time and send a update request to the server dia.setLastTransportDate(Calendar.getInstance().getTimeInMillis());// to // inform // the // system, // that // no // further // transport // for // this // day // should // be // created // automatically // (by // the // job) NetWrapper.getDefault().sendUpdateMessage(DialysisPatient.ID, dia); // create a transport for this patient CreateTransportFromDialysis createAction = new CreateTransportFromDialysis(dia, Calendar.getInstance()); createAction.run(); }
From source file:at.rc.tacos.client.controller.ImportAddressAction.java
License:Open Source License
/** * Opens a dialog to choose the file and then imports the content *//*www.j a va 2 s .c o m*/ @Override public void run() { FileDialog fileDialog = new FileDialog(window.getShell()); fileDialog.setText("Straen Importieren."); String[] filterExt = { "*.csv" }; fileDialog.setFilterExtensions(filterExt); final String path = fileDialog.open(); // assert valid if (path == null) return; // create a new instance and parse the file try { // parse the given file final List<Map<String, Object>> elementList = CSVParser.getInstance().parseCSV(new File(path)); // ask again ;) boolean result = MessageDialog.openConfirm(window.getShell(), "Straen importieren", "Mchten Sie wirklich die Adressen importieren? (" + elementList.size() + " Eintrge)"); if (!result) return; // Start a new job final Job job = new Job("AddressMonitor") { @Override protected IStatus run(IProgressMonitor monitor) { try { List<AbstractMessage> addressList = new ArrayList<AbstractMessage>(); monitor.beginTask("Importiere die Adressdaten", elementList.size()); // loop an import for (int i = 0; i < elementList.size(); i++) { Map<String, Object> line = elementList.get(i); // access every element of the line int gkz = Integer.parseInt((String) line.get("GKZ")); String city = (String) line.get("Gemeindename"); String street = (String) line.get("BEZEICHNUNG"); Address newAddress = new Address(gkz, city, street); monitor.setTaskName("Importiere Datensatz #" + i + " (" + newAddress + ")"); // add to the list addressList.add(newAddress); // commit 100 entries at one time if (addressList.size() > 100) { monitor.setTaskName("Sende Daten an Server"); NetWrapper.getDefault().sendAddAllMessage(Address.ID, addressList); addressList = new ArrayList<AbstractMessage>(); } } // commit the remaining entries if (!addressList.isEmpty()) { monitor.setTaskName("Sende Daten an Server"); NetWrapper.getDefault().sendAddAllMessage(Address.ID, addressList); } return Status.OK_STATUS; } catch (Exception e) { Activator.getDefault().log("Failed to parse the given csv file :" + path, IStatus.ERROR); return Status.CANCEL_STATUS; } finally { monitor.done(); } } }; job.addJobChangeListener(new JobChangeAdapter() { @Override public void done(IJobChangeEvent event) { if (!event.getResult().isOK()) Activator.getDefault().log("Failed to import the addresses", IStatus.ERROR); } }); job.setUser(true); job.setSystem(false); // start immediate job.schedule(); } catch (Exception e) { Activator.getDefault().log("Failed to parse the given csv file :" + path, IStatus.ERROR); e.printStackTrace(); } }
From source file:at.rc.tacos.client.controller.VehicleSetRepairStatus.java
License:Open Source License
/** * Sets the status and runs the action/*from w ww .ja v a 2 s . co m*/ */ @Override public void run() { boolean confirm = MessageDialog.openConfirm(window.getShell(), "Setzen des Status besttigen", "Wollen sie das Fahrzeug " + detail.getVehicleName() + " wirklich auer Dienst stellen?"); // check if (!confirm) return; // set the status detail.setReadyForAction(false); detail.setOutOfOrder(true); detail.setTransportStatus(VehicleDetail.TRANSPORT_STATUS_NA); // send update request NetWrapper.getDefault().sendUpdateMessage(VehicleDetail.ID, detail); }
From source file:at.rc.tacos.client.controller.VehicleTableSetRepairStatusAction.java
License:Open Source License
/** * Sets the status and runs the action//w ww . j a v a 2s.c om */ @Override public void run() { // the selection ISelection selection = viewer.getSelection(); // get the selected entry VehicleDetail detail = (VehicleDetail) ((IStructuredSelection) selection).getFirstElement(); boolean confirm = MessageDialog.openConfirm(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), "Setzen des Status besttigen", "Wollen sie das Fahrzeug " + detail.getVehicleName() + " wirklich auer Dienst stellen?"); // check if (!confirm) return; // set the status detail.setReadyForAction(false); detail.setOutOfOrder(true); detail.setTransportStatus(VehicleDetail.TRANSPORT_STATUS_NA); // send update request NetWrapper.getDefault().sendUpdateMessage(VehicleDetail.ID, detail); }
From source file:at.rc.tacos.client.editors.AddressEditor.java
License:Open Source License
/** * Creates the section to manage the changes *///from www. ja va 2 s . co m private void createManageSection(Composite parent) { Composite client = createSection(parent, "Adresse verwalten"); // create info label and hyperlinks to save and revert the changes infoLabel = new CLabel(client, SWT.NONE); infoLabel.setText("Hier knnen sie die aktuelle Adresse verwalten und die nderungen speichern."); infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("admin.info")); // Create the hyperlink to save the changes saveHyperlink = toolkit.createImageHyperlink(client, SWT.NONE); saveHyperlink.setText("nderungen speichern"); saveHyperlink.setEnabled(false); saveHyperlink.setForeground(CustomColors.GREY_COLOR); saveHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.saveDisabled")); saveHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { EditorSaveAction saveAction = new EditorSaveAction(); saveAction.run(); } }); // Create the hyperlink to remove the competence removeHyperlink = toolkit.createImageHyperlink(client, SWT.NONE); removeHyperlink.setText("Adresse lschen"); removeHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.addressRemove")); removeHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { boolean result = MessageDialog.openConfirm(getSite().getShell(), "Lschen der Adresse besttigen", "Mchten sie die Adresse " + address.getZip() + "," + address.getCity() + "," + address.getStreet() + " wirklich lschen?"); if (!result) return; // reset the dirty flag to prevent the 'save changes' to popup // on a deleted item isDirty = false; // send the remove request NetWrapper.getDefault().sendRemoveMessage(Address.ID, address); } }); // info label should span over two GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; data.widthHint = 600; infoLabel.setLayoutData(data); }
From source file:at.rc.tacos.client.editors.CompetenceEditor.java
License:Open Source License
/** * Creates the section to manage the changes *//*from w w w .j a v a 2s .co m*/ private void createManageSection(Composite parent) { Composite client = createSection(parent, "Kompetenz verwalten"); // create info label and hyperlinks to save and revert the changes infoLabel = new CLabel(client, SWT.NONE); infoLabel.setText("Hier knnen sie die aktuelle Kompetenz verwalten und die nderungen speichern."); infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("admin.info")); // Create the hyperlink to save the changes saveHyperlink = toolkit.createImageHyperlink(client, SWT.NONE); saveHyperlink.setText("nderungen speichern"); saveHyperlink.setEnabled(false); saveHyperlink.setForeground(CustomColors.GREY_COLOR); saveHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.saveDisabled")); saveHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { EditorSaveAction saveAction = new EditorSaveAction(); saveAction.run(); } }); // Create the hyperlink to remove the competence removeHyperlink = toolkit.createImageHyperlink(client, SWT.NONE); removeHyperlink.setText("Kompetenz lschen"); removeHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.competenceRemove")); removeHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { boolean result = MessageDialog.openConfirm(getSite().getShell(), "Lschen der Kompetenz besttigen", "Mchten sie die Kompetenz " + competence.getCompetenceName() + " wirklich lschen?"); if (!result) return; // reset the dirty flag to prevent the 'save changes' to popup // on a deleted item isDirty = false; // send the remove request NetWrapper.getDefault().sendRemoveMessage(Competence.ID, competence); } }); // info label should span over two GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; data.widthHint = 600; infoLabel.setLayoutData(data); }
From source file:at.rc.tacos.client.editors.DiseaseEditor.java
License:Open Source License
/** * Creates the section to manage the changes *///from www. ja v a 2 s . com private void createManageSection(Composite parent) { Composite client = createSection(parent, "Erkrankung verwalten"); // create info label and hyperlinks to save and revert the changes infoLabel = new CLabel(client, SWT.NONE); infoLabel.setText("Hier knnen sie die aktuelle Erkrankung verwalten und die nderungen speichern."); infoLabel.setImage(ImageFactory.getInstance().getRegisteredImage("admin.info")); // Create the hyperlink to save the changes saveHyperlink = toolkit.createImageHyperlink(client, SWT.NONE); saveHyperlink.setText("nderungen speichern"); saveHyperlink.setEnabled(false); saveHyperlink.setForeground(CustomColors.GREY_COLOR); saveHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.saveDisabled")); saveHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { EditorSaveAction saveAction = new EditorSaveAction(); saveAction.run(); } }); // Create the hyperlink to remove the competence removeHyperlink = toolkit.createImageHyperlink(client, SWT.NONE); removeHyperlink.setText("Erkrankung lschen"); removeHyperlink.setImage(ImageFactory.getInstance().getRegisteredImage("admin.diseaseRemove")); removeHyperlink.addHyperlinkListener(new HyperlinkAdapter() { @Override public void linkActivated(HyperlinkEvent e) { boolean result = MessageDialog.openConfirm(getSite().getShell(), "Lschen der Erkrankung besttigen", "Mchten sie die Erkrankung " + disease.getDiseaseName() + " wirklich lschen?"); if (!result) return; // reset the dirty flag to prevent the 'save changes' to popup // on a deleted item isDirty = false; // send the remove request NetWrapper.getDefault().sendRemoveMessage(Disease.ID, disease); } }); // info label should span over two GridData data = new GridData(GridData.FILL_BOTH); data.horizontalSpan = 2; data.widthHint = 600; infoLabel.setLayoutData(data); }