List of usage examples for org.eclipse.jface.dialogs IDialogConstants FINISH_ID
int FINISH_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants FINISH_ID.
Click Source Link
From source file:org.kalypso.contribs.eclipse.jface.wizard.WizardDialog2.java
License:Open Source License
/** * Executes the given runnable in this dialog (similar to * {@link org.eclipse.jface.operation.IRunnableContext#run(boolean, boolean, org.eclipse.jface.operation.IRunnableWithProgress)} * , but does NOT block the user interface while the operation is running. *//*w w w .j a v a 2 s .com*/ public IStatus executeUnblocked(final boolean cancelable, final boolean enablePageNavigation, final ICoreRunnableWithProgress runnable) { final ProgressMonitorPart progressMonitorPart = (ProgressMonitorPart) getProgressMonitor(); final boolean needsProgressMonitor = getWizard().needsProgressMonitor(); final Button cancelButton = getButton(IDialogConstants.CANCEL_ID); try { /* Disable buttons */ enableButton(IDialogConstants.FINISH_ID, false); if (!cancelable) enableButton(IDialogConstants.CANCEL_ID, false); if (!enablePageNavigation) { enableButton(IDialogConstants.NEXT_ID, false); enableButton(IDialogConstants.BACK_ID, false); } if (needsProgressMonitor) { progressMonitorPart.attachToCancelComponent(cancelButton); progressMonitorPart.setVisible(true); } final ModalRunnableContext rc = new ModalRunnableContext(progressMonitorPart, getShell().getDisplay()); return RunnableContextHelper.execute(rc, true, cancelable, runnable); } finally { // shell may be disposed, if dialog was canceled final Shell shell = getShell(); if (shell != null && !shell.isDisposed()) { enableButton(IDialogConstants.CANCEL_ID, true); progressMonitorPart.setVisible(false); progressMonitorPart.removeFromCancelComponent(cancelButton); updateButtons(); } } }
From source file:org.kalypso.kalypsomodel1d2d.sim.RMA10CalculationWizard.java
License:Open Source License
private void manageFinishButton(final boolean enabled) { final IWizardContainer container = getContainer(); if (container instanceof WizardDialog2) { final Button button = ((WizardDialog2) container).getButton(IDialogConstants.FINISH_ID); button.setEnabled(enabled);/*w w w . j av a2s .c o m*/ } }
From source file:org.kalypso.kalypsomodel1d2d.sim.RMA10CalculationWizard.java
License:Open Source License
private void setFinishText(final String buttonText) { final IWizardContainer container = getContainer(); if (container instanceof WizardDialog2) { final Button button = ((WizardDialog2) container).getButton(IDialogConstants.FINISH_ID); button.setText(buttonText);// w w w.j a va 2 s. c o m } }
From source file:org.kalypso.kalypsomodel1d2d.ui.map.flowrel.FlowRelCalcSimulationPage.java
License:Open Source License
public void reset(final TuhhCalculation templateCalculation, final IFlowRelation1D[] flowRels, final IFlowRelationshipModel flowModel, final IFEDiscretisationModel1d2d discModel) { m_simulationWasRun = false;//from w w w. j ava 2s. co m m_statusComposite.setStatus(new Status(IStatus.INFO, KalypsoModel1D2DPlugin.PLUGIN_ID, Messages.getString("org.kalypso.kalypsomodel1d2d.ui.map.flowrel.FlowRelCalcSimulationPage.16"))); //$NON-NLS-1$ m_console.clearConsole(); m_operations.clear(); final IWizardContainer container = getContainer(); if (container instanceof WizardDialog2) ((WizardDialog2) container).getButton(IDialogConstants.FINISH_ID).setText( Messages.getString("org.kalypso.kalypsomodel1d2d.ui.map.flowrel.FlowRelCalcSimulationPage.17")); //$NON-NLS-1$ for (final IFlowRelation1D flowRel : flowRels) { final FlowRelationshipCalcOperation op = new FlowRelationshipCalcOperation(templateCalculation, flowRel, flowModel, discModel, m_consoleOS); m_operations.add(op); } m_resultTableViewer.refresh(); m_resultTableViewer.setSelection(StructuredSelection.EMPTY); }
From source file:org.kalypso.kalypsomodel1d2d.ui.map.flowrel.FlowRelCalcWizard.java
License:Open Source License
/** * @see org.eclipse.jface.wizard.Wizard#performFinish() *//* www. j a v a 2 s .c o m*/ @Override public boolean performFinish() { final IWizardContainer container = getContainer(); if (m_simulationPage.simulationWasRun()) { // Only really change the data on OK m_simulationPage.applyResults(); return true; } /* Simulation was not yet run, do it now. */ container.showPage(m_simulationPage); m_simulationPage.runSimulation(); if (container instanceof WizardDialog2) { final Button button = ((WizardDialog2) container).getButton(IDialogConstants.FINISH_ID); if (button != null) button.setText(IDialogConstants.OK_LABEL); } return false; }
From source file:org.locationtech.udig.catalog.tests.ui.workflow.BasicWorkflowDialogTest.java
License:Open Source License
@Ignore @Test//from w w w .j av a2 s. c o m public void testBlockingWizard() { Assertion a1 = new Assertion() { public void run() { Button next = DialogDriver.findButton(bdialog, IDialogConstants.NEXT_ID); Button prev = DialogDriver.findButton(bdialog, IDialogConstants.BACK_ID); Button fin = DialogDriver.findButton(bdialog, IDialogConstants.FINISH_ID); if (!next.isEnabled()) fail = true; if (prev.isEnabled()) fail = true; if (fin.isEnabled()) fail = true; } }; Assertion a2 = new Assertion() { public void run() { Button next = DialogDriver.findButton(bdialog, IDialogConstants.NEXT_ID); Button prev = DialogDriver.findButton(bdialog, IDialogConstants.BACK_ID); Button fin = DialogDriver.findButton(bdialog, IDialogConstants.FINISH_ID); if (next.isEnabled()) fail = true; if (!prev.isEnabled()) fail = true; if (!fin.isEnabled()) fail = true; } }; Object[] buttons = new Object[] { a1, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID, a2, IDialogConstants.BACK_ID, IDialogConstants.BACK_ID, IDialogConstants.BACK_ID, a1, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID, a2, IDialogConstants.FINISH_ID }; DialogDriver driver = new DialogDriver(bdialog, buttons); driver.schedule(); bdialog.open(); driver.cancel(); assertFalse(a1.fail); assertFalse(a2.fail); }
From source file:org.locationtech.udig.catalog.tests.ui.workflow.BasicWorkflowDialogTest.java
License:Open Source License
@Ignore @Test// w w w . j a v a2 s.com public void testNonBlockingWizard() { Assertion a1 = new Assertion() { public void run() { Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID); Button prev = DialogDriver.findButton(dialog, IDialogConstants.BACK_ID); Button fin = DialogDriver.findButton(dialog, IDialogConstants.FINISH_ID); if (!next.isEnabled()) fail = true; if (prev.isEnabled()) fail = true; if (fin.isEnabled()) fail = true; } }; Assertion a2 = new Assertion() { public void run() { Button next = DialogDriver.findButton(dialog, IDialogConstants.NEXT_ID); Button prev = DialogDriver.findButton(dialog, IDialogConstants.BACK_ID); Button fin = DialogDriver.findButton(dialog, IDialogConstants.FINISH_ID); if (next.isEnabled()) fail = true; if (!prev.isEnabled()) fail = true; if (!fin.isEnabled()) fail = true; } }; Object[] buttons = new Object[] { a1, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID, a2, IDialogConstants.BACK_ID, IDialogConstants.BACK_ID, IDialogConstants.BACK_ID, a1, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_ID, a2, IDialogConstants.FINISH_ID }; DialogDriver driver = new DialogDriver(dialog, buttons); driver.schedule(); dialog.open(); driver.cancel(); assertFalse(a1.fail); assertFalse(a2.fail); }
From source file:org.locationtech.udig.project.tests.ui.MapImportTest.java
License:Open Source License
@Ignore @Test// ww w. j av a 2 s . c o m public void testMultiResource() throws Exception { Object context = DummyMultiResourceService.url; ICatalog catalog = CatalogPlugin.getDefault().getLocalCatalog(); List members = catalog.members(new DummyMonitor()); if (!members.isEmpty()) { //clear the catalog for (Iterator itr = members.iterator(); itr.hasNext();) { IService service = (IService) itr.next(); catalog.remove(service); } } members = catalog.members(new DummyMonitor()); assertTrue(members.isEmpty()); final WorkflowWizard workflowWizard = mapImport.getDialog().getWorkflowWizard(); workflowWizard.getWorkflow().setContext(context); mapImport.run(new DummyMonitor(), context); UDIGTestUtil.inDisplayThreadWait(3000, new WaitCondition() { public boolean isTrue() { State state = workflowWizard.getWorkflow().getCurrentState(); if (state instanceof ResourceSelectionState) return true; return false; } }, true); assertTrue(workflowWizard.getWorkflow().getCurrentState() instanceof ResourceSelectionState); //check the resource page to ensure that it isn't ignored ResourceSelectionState currentState = (ResourceSelectionState) workflowWizard.getWorkflow() .getCurrentState(); assertTrue(currentState.getResources() == null || currentState.getResources().isEmpty()); //Set the resources on the state and press finish IService service = currentState.getServices().iterator().next(); Map<IGeoResource, IService> resources = new HashMap<IGeoResource, IService>(); for (IResolve resolve : service.resources(new NullProgressMonitor())) { resources.put((IGeoResource) resolve, service); } currentState.setResources(resources); org.locationtech.udig.project.internal.Map activeMap = ApplicationGISInternal.getActiveMap(); if (activeMap != ApplicationGIS.NO_MAP) activeMap.getLayersInternal().clear(); DialogDriver.pushButton(mapImport.getDialog(), IDialogConstants.FINISH_ID); UDIGTestUtil.inDisplayThreadWait(4000, new WaitCondition() { public boolean isTrue() { IMap map = ApplicationGIS.getActiveMap(); if (map == ApplicationGIS.NO_MAP) return false; return true; } }, true); IMap map = ApplicationGIS.getActiveMap(); assertNotSame(ApplicationGIS.NO_MAP, map); List<ILayer> layers = map.getMapLayers(); assertEquals(2, layers.size()); for (ILayer layer : layers) { assertGeoResourceType(layer, DummyMultiResourceService.class); } }
From source file:org.modelio.api.ui.ModelioWizardDialog.java
License:Apache License
@objid("d657c887-910f-11e0-9de7-002564c97630") @Override//from www .j a v a 2 s . com protected void buttonPressed(final int buttonId) { switch (buttonId) { case IDialogConstants.HELP_ID: { helpPressed(); break; } case IDialogConstants.BACK_ID: { backPressed(); break; } case IDialogConstants.NEXT_ID: { nextPressed(); break; } case IDialogConstants.FINISH_ID: { finishPressed(); break; } default: { // Nothing to do // The Cancel button has a listener which calls cancelPressed directly } } }
From source file:org.modelio.api.ui.ModelioWizardDialog.java
License:Apache License
/** * Creates the buttons for this dialog's button bar. * <p>//from w w w . j a va 2s . c om * The <code>WizardDialog</code> implementation of this framework method * prevents the parent composite's columns from being made equal width in * order to remove the margin between the Back and Next buttons. * </p> * @param parent the parent composite to contain the buttons */ @objid("bc1a8716-120f-11e2-b5c6-002564c97630") @Override protected void createButtonsForButtonBar(final Composite parent) { ((GridLayout) parent.getLayout()).makeColumnsEqualWidth = false; if (this.wizard.isHelpAvailable()) { this.helpButton = createButton(parent, IDialogConstants.HELP_ID, IDialogConstants.HELP_LABEL, false); } if (this.wizard.needsPreviousAndNextButtons()) { createPreviousAndNextButtons(parent); } this.finishButton = createButton(parent, IDialogConstants.FINISH_ID, IDialogConstants.FINISH_LABEL, true); this.cancelButton = createCancelButton(parent); if (parent.getDisplay().getDismissalAlignment() == SWT.RIGHT) { // Make the default button the right-most button. // See also special code in org.eclipse.jface.dialogs.Dialog#initializeBounds() this.finishButton.moveBelow(null); } }