public void removeDialog(Dialog d) { for (int i = 0; i < dialogs.size(); i++) { DialogWrapper p = dialogs.get(i); if (p.getDialog().equals(d)) { p.release(); dialogs.remove(i); return; } } }
private void releaseDialogs(boolean finish) { // clean up dialogs when activity is pausing or finishing for (Iterator<DialogWrapper> iter = dialogs.iterator(); iter.hasNext(); ) { DialogWrapper p = iter.next(); Dialog dialog = p.getDialog(); boolean persistent = p.getPersistent(); // if the activity is pausing but not finishing, clean up dialogs only if // they are non-persistent if (finish || !persistent) { if (dialog != null && dialog.isShowing()) { dialog.dismiss(); } dialogs.remove(p); } } }
/** * The provided {@link Dialog} is opened and the result is returned via the provided {@link * ECPDialogExecutor}. This method searches for a DialogWrapper which will wrap the code in order * to allow opening JFace dialogs in RAP. * * @param dialog the JFace Dialog to open * @param callBack the {@link ECPDialogExecutor} called to handle the result */ public static void openDialog(Dialog dialog, ECPDialogExecutor callBack) { DialogWrapper wrapper = null; final IConfigurationElement[] controls = Platform.getExtensionRegistry() .getConfigurationElementsFor( "org.eclipse.emf.ecp.edit.swt.dialogWrapper"); //$NON-NLS-1$ for (final IConfigurationElement e : controls) { try { wrapper = (DialogWrapper) e.createExecutableExtension("class"); // $NON-NLS-1$ break; } catch (final CoreException e1) { Activator.logException(e1); } } if (wrapper == null) { callBack.handleResult(dialog.open()); return; } wrapper.openDialog(dialog, callBack); }