List of usage examples for org.eclipse.jface.dialogs Dialog open
public int open()
From source file:com.nextep.designer.vcs.ui.services.impl.VersioningUIService.java
License:Open Source License
@Override public List<IVersionable<?>> undoCheckOut(IProgressMonitor monitor, final IVersionable<?>... checkedOutVersions) { final IWorkspaceService workspaceService = CorePlugin.getService(IWorkspaceService.class); // Building confirm text final List<IVersionable<?>> elts = new ArrayList<IVersionable<?>>(); for (IVersionable<?> v : checkedOutVersions) { if (v.getVersion().getUser() != workspaceService.getCurrentUser()) { throw new ErrorException(MessageFormat.format(VCSUIMessages.getString("undoCheckoutInvalidUser"), //$NON-NLS-1$ v.getType().getName().toLowerCase(), v.getName(), v.getVersion().getUser().getName())); }//from w w w .j a va2 s. c om elts.add(v); for (IReferenceable r : v.getReferenceMap().values()) { if (r instanceof IVersionable<?>) { if (((IVersionable<?>) r).getVersion().getStatus() == IVersionStatus.CHECKED_OUT) { elts.add((IVersionable<?>) r); } } } } // initializing dialog ConfirmUndoCheckoutDialog commitDlg = new ConfirmUndoCheckoutDialog(elts); Dialog dlg = new TitleAreaDialogWrapper(UIHelper.getShell(), commitDlg, SWT.RESIZE | SWT.TITLE | SWT.BORDER); dlg.setBlockOnOpen(true); dlg.open(); // If user confirmed, we start undo checkout if (dlg.getReturnCode() == Window.OK) { final IVersioningOperationContext context = versioningService .createVersioningContext(VersioningOperation.UNDO_CHECKOUT, Arrays.asList(checkedOutVersions)); // Validation validate(context); // Execution Job j = new BlockingJob(VCSUIMessages.getString("version.ui.undoCheckOutJob")) { //$NON-NLS-1$ @Override protected IStatus run(IProgressMonitor monitor) { try { // listenerService.setDispatchMode(IListenerService.ASYNCHED); List<IVersionable<?>> undoCheckouts = versioningService.undoCheckOut(monitor, context); setSelection(undoCheckouts); } catch (CancelException e) { return Status.CANCEL_STATUS; // } finally { // listenerService.setDispatchMode(IListenerService.SYNCHED); } return Status.OK_STATUS; } }; j.setUser(true); j.schedule(); } return Collections.emptyList(); }
From source file:com.nextep.designer.vcs.ui.validators.VersionSettingsValidator.java
License:Open Source License
@Override public IStatus validate(IVersioningOperationContext context) { List<IUIComponent> components = new ArrayList<IUIComponent>(); // Adding settings validation dialog if needed if (needsSettingsValidation(context)) { components.add(new VersionSettingsDialog(context)); }//from w ww. j a va 2 s . c o m // Adding commit confirmation (on commit) if (context.getVersioningOperation() == VersioningOperation.COMMIT) { List<IVersionable<?>> elementsToConfirm = buildConfirmList(context.getVersionables()); components.add(new ConfirmCommitDialog(context, elementsToConfirm, components.isEmpty())); } // Displaying Dialog dlg = null; if (components.size() == 1) { dlg = new TitleAreaDialogWrapper(UIHelper.getShell(), components.iterator().next(), SWT.RESIZE | SWT.TITLE | SWT.BORDER); } else if (components.size() > 1) { final IWizard wiz = new ComponentWizard(VCSUIMessages.getString("dialog.versionSettings.title"), //$NON-NLS-1$ components); dlg = new ComponentWizardDialog(UIHelper.getShell(), wiz, true); } else { // Nothing to validate return Status.OK_STATUS; } dlg.setBlockOnOpen(true); dlg.open(); return dlg.getReturnCode() == Window.OK ? Status.OK_STATUS : Status.CANCEL_STATUS; }
From source file:com.nokia.sdt.symbian.ui.appeditor.ApplicationEditor.java
License:Open Source License
/** * Saves the multi-page editor's document. *///from ww w.j ava 2 s . co m public void doSave(IProgressMonitor monitor) { PreflightInfo pi = closingEditorPreflightInfo; if (pi == null) { pi = calcPreflightInfo(false); if (!queryPreflightInfo(pi)) { return; } } if (pi.preSaveOtherEditorsNeeded) { saveOpenEditors(monitor); } // close to-be-removed designs' editors closeUnreferencedDesignEditors(monitor); // ensure the source gen provider knows about changes to design references IProjectContext context = getDataModel().getProjectContext(); if (context != null) { context.getSourceGenProvider().updateProjectInfo(getDataModel()); } if (fireQueryAboutToSave()) { firePreSaveNotify(monitor); // Changes are committed when the user switches the // active page, but changes buffered in the current page // are not committed automatically when saving. IFormPage activePage = getActivePageInstance(); if (activePage != null) { IManagedForm managedForm = activePage.getManagedForm(); if (managedForm != null) { managedForm.commit(true); } } IDesignerDataModel model = getDataModel(); try { model.saveModel(monitor); getCommandStack().markSaveLocation(); editorDirtyStateChanged(); } catch (Exception x) { Check.reportFailure(Messages.getString("ApplicationEditor.genericSaveFailureError"), x); //$NON-NLS-1$ } firePostSaveNotify(monitor); applyPropagatedChanges(pi, monitor); recordPropagatedValues(); Collection<IModelMessage> messages = ModelMessages.validateAndUpdateMarkers(model); EditorUtils.saveCurrentLayout((IDesignerEditor) getAdapter(IDesignerEditor.class)); Dialog dialog = EditorServices.createModelValidationMessagesDialog((Shell) getAdapter(Shell.class), getDataModel(), messages); dialog.open(); if (pi.reloadThis) reload(); } }
From source file:com.nokia.sdt.uidesigner.ui.AbstractDesignerDataModelEditor.java
License:Open Source License
@Override public void doSave(IProgressMonitor monitor) { if (!checkProjectExists()) return;//from ww w . ja v a 2 s.co m IStatus status = dataModel.validateEdit(getEditorSite().getShell()); if (!status.isOK()) { return; } if (!fireQueryAboutToSave()) return; firePreSaveNotify(monitor); // Changes are committed when the user switches the // active page, but changes buffered in the current page // are not committed automatically when saving. IFormPage activePage = getActivePageInstance(); if (activePage != null) { IManagedForm managedForm = activePage.getManagedForm(); if (managedForm != null) { managedForm.commit(true); } } try { dataModel.saveModel(monitor); if (commandStack != null) commandStack.markSaveLocation(); Collection<IModelMessage> messages = ModelMessages.validateAndUpdateMarkers(dataModel); Shell shell = (Shell) getAdapter(Shell.class); //EditorServices.notifyIfDataModelSourceGenProblems(shell, dataModel); Dialog dialog = EditorServices.createModelValidationMessagesDialog(shell, dataModel, messages); dialog.open(); } catch (Exception e) { status = Logging.newStatus(UIDesignerPlugin.getDefault(), e); Logging.log(UIDesignerPlugin.getDefault(), status); Logging.showErrorDialog(null, Strings.getString("AbstractDesignerDataModelEditor.SavingFailedError"), //$NON-NLS-1$ status); } finally { firePostSaveNotify(monitor); } }
From source file:com.nokia.tools.variant.editor.actions.HideSettingsFromViewAction.java
License:Open Source License
private boolean dialogOK() { Dialog d = new Dialog(Display.getCurrent().getActiveShell()) { protected Control createDialogArea(Composite parent) { Composite control = new Composite(parent, SWT.NONE); control.setLayout(new GridLayout()); Label label = new Label(control, SWT.NONE); label.setText("Remove settings from:"); Button allGroupsButton = new Button(control, SWT.RADIO); allGroupsButton.setText("All groups"); allGroupsButton.setSelection(true); allGroupsButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeFromAllGroups = true; }/*from ww w . j av a2 s. c o m*/ }); Button selectedGroupButton = new Button(control, SWT.RADIO); selectedGroupButton.setText("Selected group"); selectedGroupButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { removeFromAllGroups = false; } }); return super.createDialogArea(parent); } @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText("Multiple references for a setting found"); } @Override protected Point getInitialSize() { return new Point(350, 150); } }; if (d.open() == Dialog.OK) { return true; } return false; }
From source file:com.nokia.tools.vct.navigator.sign.ShowSigningStatusAction.java
License:Open Source License
@Override public void run() { final Shell shell = Display.getCurrent().getActiveShell(); Dialog dialog = new StatusDialog(shell, project); dialog.setBlockOnOpen(true);//from w w w . ja v a 2s.com dialog.open(); }
From source file:com.osp.debugger.launch.simul.SimulatorDebuggerTab.java
License:Open Source License
protected void createOptionsComposite(Composite parent) { Composite optionsComp = new Composite(parent, SWT.NONE); //int numberOfColumns = (fAttachMode) ? 1 : 3; int numberOfColumns = 1; GridLayout layout = new GridLayout(numberOfColumns, false); optionsComp.setLayout(layout);// w w w .j a va 2 s. co m optionsComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 1, 1)); // if (fAttachMode == false) { // fStopInMain = createCheckButton( optionsComp, OspLaunchMessages.getString( "CDebuggerTab.Stop_at_main_on_startup" ) ); //$NON-NLS-1$ // fStopInMain.addSelectionListener(new SelectionAdapter() { // // public void widgetSelected(SelectionEvent e) { // fStopInMainSymbol.setEnabled(fStopInMain.getSelection()); // update(); // } // }); // fStopInMainSymbol = new Text(optionsComp, SWT.SINGLE | SWT.BORDER); // final GridData gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); // gridData.widthHint = 100; // fStopInMainSymbol.setLayoutData(gridData); // fStopInMainSymbol.addModifyListener(new ModifyListener() { // public void modifyText(ModifyEvent evt) { // update(); // } // }); // fStopInMainSymbol.getAccessible().addAccessibleListener( // new AccessibleAdapter() { // public void getName(AccessibleEvent e) { // e.result = OspLaunchMessages.getString( "CDebuggerTab.Stop_at_main_on_startup"); //$NON-NLS-1$ // } // } // ); // } fAdvancedButton = createPushButton(optionsComp, OspLaunchMessages.getString("CDebuggerTab.Advanced"), null); //$NON-NLS-1$ ((GridData) fAdvancedButton.getLayoutData()).horizontalAlignment = GridData.END; fAdvancedButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Dialog dialog = new AdvancedDebuggerOptionsDialog(getShell()); dialog.open(); } }); }
From source file:com.osp.debugger.launch.target.TargetDebuggerTab.java
License:Open Source License
protected void createOptionsComposite(Composite parent) { Composite optionsComp = new Composite(parent, SWT.NONE); int numberOfColumns = (fAttachMode) ? 1 : 3; GridLayout layout = new GridLayout(numberOfColumns, false); optionsComp.setLayout(layout);//from ww w . j a v a 2 s . c om optionsComp.setLayoutData(new GridData(GridData.BEGINNING, GridData.CENTER, true, false, 1, 1)); // if (fAttachMode == false) { // fStopInMain = createCheckButton( optionsComp, OspLaunchMessages.getString( "CDebuggerTab.Stop_at_main_on_startup" ) ); //$NON-NLS-1$ // fStopInMain.addSelectionListener(new SelectionAdapter() { // // public void widgetSelected(SelectionEvent e) { // fStopInMainSymbol.setEnabled(fStopInMain.getSelection()); // update(); // } // }); // fStopInMainSymbol = new Text(optionsComp, SWT.SINGLE | SWT.BORDER); // final GridData gridData = new GridData(GridData.FILL, GridData.CENTER, false, false); // gridData.widthHint = 100; // fStopInMainSymbol.setLayoutData(gridData); // fStopInMainSymbol.addModifyListener(new ModifyListener() { // public void modifyText(ModifyEvent evt) { // update(); // } // }); // fStopInMainSymbol.getAccessible().addAccessibleListener( // new AccessibleAdapter() { // public void getName(AccessibleEvent e) { // e.result = OspLaunchMessages.getString( "CDebuggerTab.Stop_at_main_on_startup"); //$NON-NLS-1$ // } // } // ); // } fAdvancedButton = createPushButton(optionsComp, OspLaunchMessages.getString("CDebuggerTab.Advanced"), null); //$NON-NLS-1$ ((GridData) fAdvancedButton.getLayoutData()).horizontalAlignment = GridData.END; fAdvancedButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { Dialog dialog = new AdvancedDebuggerOptionsDialog(getShell()); dialog.open(); } }); }
From source file:com.safi.workshop.sqlexplorer.plugin.actions.About.java
License:Open Source License
public void run(IAction action) { Dialog dialog = new AboutDlg(_shell); dialog.open(); }
From source file:com.sap.dirigible.ide.workspace.ui.commands.RenameCommandHandler.java
License:Open Source License
private String renameResource(IResource resource) { final RenameWizard wizard = new RenameWizard(resource); final Dialog dialog = new WizardDialog(null, wizard); if (dialog.open() == Window.CANCEL) { return null; }//from ww w . java2s.com ; return wizard.getText(); }