List of usage examples for org.eclipse.jface.dialogs IDialogConstants NEXT_ID
int NEXT_ID
To view the source code for org.eclipse.jface.dialogs IDialogConstants NEXT_ID.
Click Source Link
From source file:org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog.java
License:Open Source License
public void updateButtons() { super.updateButtons(); if (!fMakeNextButtonDefault) return;/*w w w. j a v a2s . com*/ if (getShell() == null) return; Button next = getButton(IDialogConstants.NEXT_ID); if (next.isEnabled()) getShell().setDefaultButton(next); }
From source file:org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.java
License:Open Source License
public void updateButtons() { boolean previewPage = isPreviewPageActive(); boolean ok = fWizard.canFinish(); boolean canFlip = fCurrentPage.canFlipToNextPage(); Button defaultButton = null;//from ww w.jav a2 s . c o m Button previewButton = getButton(PREVIEW_ID); if (previewButton != null && !previewButton.isDisposed()) { String previewLabel = previewPage ? IDialogConstants.BACK_LABEL : RefactoringUIMessages.RefactoringWizardDialog2_buttons_preview_label; previewButton.setText(previewLabel); setButtonLayoutData(previewButton); getShell().layout(new Control[] { previewButton }); boolean enable = true; if (!previewPage) enable = canFlip; previewButton.setEnabled(enable); if (enable) defaultButton = previewButton; } Button nextButton = getButton(IDialogConstants.NEXT_ID); if (nextButton != null && !nextButton.isDisposed()) { nextButton.setEnabled(!previewPage); if (!previewPage) nextButton.setEnabled(canFlip); if (nextButton.isEnabled()) defaultButton = nextButton; } Button backButton = getButton(IDialogConstants.BACK_ID); if (backButton != null && !backButton.isDisposed()) backButton.setEnabled(!isFirstPage()); Button okButton = getButton(IDialogConstants.OK_ID); if (okButton != null && !okButton.isDisposed()) { okButton.setEnabled(ok); if (ok) defaultButton = okButton; } if (defaultButton != null) { defaultButton.getShell().setDefaultButton(defaultButton); } }
From source file:org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.java
License:Open Source License
private Map saveUIState(boolean keepCancelEnabled) { Map savedState = new HashMap(10); saveEnableStateAndSet(getButton(PREVIEW_ID), savedState, "preview", false); //$NON-NLS-1$ saveEnableStateAndSet(getButton(IDialogConstants.OK_ID), savedState, "ok", false); //$NON-NLS-1$ saveEnableStateAndSet(getButton(IDialogConstants.BACK_ID), savedState, "back", false); //$NON-NLS-1$ saveEnableStateAndSet(getButton(IDialogConstants.NEXT_ID), savedState, "next", false); //$NON-NLS-1$ saveEnableStateAndSet(getButton(IDialogConstants.CANCEL_ID), savedState, "cancel", keepCancelEnabled); //$NON-NLS-1$ savedState.put("page", ControlEnableState.disable(fVisiblePage.getControl())); //$NON-NLS-1$ return savedState; }
From source file:org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.java
License:Open Source License
private void restoreUIState(Map state) { restoreEnableState(getButton(PREVIEW_ID), state, "preview");//$NON-NLS-1$ restoreEnableState(getButton(IDialogConstants.OK_ID), state, "ok");//$NON-NLS-1$ restoreEnableState(getButton(IDialogConstants.BACK_ID), state, "back"); //$NON-NLS-1$ restoreEnableState(getButton(IDialogConstants.NEXT_ID), state, "next"); //$NON-NLS-1$ restoreEnableState(getButton(IDialogConstants.CANCEL_ID), state, "cancel");//$NON-NLS-1$ ControlEnableState pageState = (ControlEnableState) state.get("page");//$NON-NLS-1$ pageState.restore();// w w w. jav a 2 s. co m }
From source file:org.eclipse.ltk.internal.ui.refactoring.RefactoringWizardDialog2.java
License:Open Source License
private Composite createPreviousAndNextButtons(Composite parent) { // Copied from Wizard Dialog. // increment the number of columns in the button bar GridLayout barLayout = (GridLayout) parent.getLayout(); barLayout.numColumns += 2; // parent is assumed to have a GridLayout (see javadoc of Dialog#createButton(..)) Composite composite = new Composite(parent, SWT.NONE); // create a layout with spacing and margins appropriate for the font // size./*from ww w .j a v a2s. c o m*/ GridLayout layout = new GridLayout(); layout.numColumns = 0; // will be incremented by createButton layout.marginWidth = 0; layout.marginHeight = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; composite.setLayout(layout); composite.setFont(parent.getFont()); Button backButton = createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false); backButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { backPressed(); } }); Button nextButton = createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false); nextButton.addSelectionListener(new SelectionAdapter() { public void widgetSelected(SelectionEvent e) { nextOrPreviewPressed(); } }); GridData data = new GridData(); int widthHint = convertHorizontalDLUsToPixels(IDialogConstants.BUTTON_WIDTH); Point minSize1 = backButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); Point minSize2 = nextButton.computeSize(SWT.DEFAULT, SWT.DEFAULT, true); int minSize = Math.max(minSize1.x, minSize2.x); ((GridData) backButton.getLayoutData()).widthHint = minSize; ((GridData) nextButton.getLayoutData()).widthHint = minSize; data.widthHint = 2 * Math.max(widthHint, minSize) + barLayout.horizontalSpacing; data.horizontalAlignment = SWT.FILL; data.grabExcessHorizontalSpace = true; data.horizontalSpan = 2; composite.setLayoutData(data); return composite; }
From source file:org.eclipse.oomph.setup.ui.wizards.ConfirmationPage.java
License:Open Source License
private void validate() { setErrorMessage(null);//from w w w . j av a 2 s. c o m setPageComplete(false); if (switchWorkspaceButton != null && switchWorkspaceButton.isVisible() && switchWorkspaceButton.getSelection()) { setMessage("The IDE will be restarted with the new workspace " + getPerformer().getWorkspaceLocation() + ".", IMessageProvider.WARNING); } else { setMessage(null); } if (!someTaskChecked) { if (getWizard().getPerformer().getNeededTasks().size() == 0) { setMessage("No tasks need to perform.", IMessageProvider.WARNING); } else { setErrorMessage("Please check one or more tasks to continue with the installation process."); } return; } if (configurationLocationExists && !overwriteButton.getSelection()) { setErrorMessage("The folder " + lastConfigurationLocation + " exists.\n Please check the Overwrite button to rename it and continue with the installation process."); return; } else if (newWorkspaceLocation != null && !ObjectUtil.equals(newWorkspaceLocation, currentWorkspaceLocation) && !switchWorkspaceButton.getSelection()) { setErrorMessage("The workspace location is changed to " + getPerformer().getWorkspaceLocation() + ". Please check the 'Switch workspace' button to restarted the IDE, switch to the new workspace, and continue the installation process."); return; } setPageComplete(true); setButtonState(IDialogConstants.NEXT_ID, false); }
From source file:org.eclipse.oomph.setup.ui.wizards.SetupWizardDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { super.createButtonsForButtonBar(parent); AccessUtil.setKey(getButton(IDialogConstants.BACK_ID), "back"); AccessUtil.setKey(getButton(IDialogConstants.NEXT_ID), "next"); AccessUtil.setKey(getButton(IDialogConstants.FINISH_ID), "finish"); AccessUtil.setKey(getButton(IDialogConstants.CANCEL_ID), "cancel"); }
From source file:org.eclipse.oomph.setup.ui.wizards.VariablePage.java
License:Open Source License
private void validate() { try {/*from ww w.j a v a2s .co m*/ performer = null; incompletePerformers.clear(); allPromptedPerfomers.clear(); setButtonState(IDialogConstants.NEXT_ID, false); performerCreationJob = new PerformerCreationJob(SETUP_TASK_ANALYSIS_TITLE) { @Override protected SetupTaskPerformer createPerformer() throws Exception { return VariablePage.this.createPerformer(VariablePage.this, fullPrompt); } @Override protected Dialog createDialog() { return createDialog(getShell(), SETUP_TASK_ANALYSIS_TITLE, null, "Analyzing the needed setup tasks has taken more than " + (System.currentTimeMillis() - getStart()) / 1000 + " seconds. The Next button will be disabled, though animated, until it completes. You may continue to modify the values of the variables.", MessageDialog.INFORMATION, new String[] { IDialogConstants.OK_LABEL }, 0); } @Override protected void handleDialogResult(int result) { if (result == 0) { setDelay(Integer.MAX_VALUE); } else { setDelay(2 * getDelay()); } } }; if (delay != 0) { performerCreationJob.setDelay(delay); } performerCreationJob.create(); delay = performerCreationJob.getDelay(); Throwable throwable = performerCreationJob.getThrowable(); if (throwable != null) { if (throwable instanceof OperationCanceledException) { performerCreationJob = null; return; } throw throwable; } performer = performerCreationJob.getPerformer(); UIUtil.asyncExec(getControl(), new Runnable() { public void run() { performerCreationJob = null; if (updateFields()) { validate(); } } }); if (performer == null) { setPageComplete(false); } else { setPageComplete(true); if (!prompted) { prompted = true; gotoNextPage(); } } } catch (Throwable t) { performerCreationJob = null; SetupUIPlugin.INSTANCE.log(t); ErrorDialog.open(t); } }
From source file:org.eclipse.osee.framework.ui.swt.NonmodalWizardDialog.java
License:Open Source License
private Composite createPreviousAndNextButtons(Composite parent) { // increment the number of columns in the button bar ((GridLayout) parent.getLayout()).numColumns++; Composite composite = new Composite(parent, SWT.NONE); // create a layout with spacing and margins appropriate for the font size. GridLayout layout = new GridLayout(); layout.numColumns = 0; // will be incremented by createButton layout.marginWidth = 0;/*from w w w .j a v a 2 s .co m*/ layout.marginHeight = 0; layout.horizontalSpacing = 0; layout.verticalSpacing = 0; composite.setLayout(layout); GridData data = new GridData(GridData.HORIZONTAL_ALIGN_CENTER | GridData.VERTICAL_ALIGN_CENTER); composite.setLayoutData(data); composite.setFont(parent.getFont()); backButton = createButton(composite, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false); nextButton = createButton(composite, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false); nextButton.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent event) { // System.out.println("the next button was pressed"); } }); return composite; }
From source file:org.eclipse.papyrus.modelexplorer.dialog.NavigatorSearchDialog.java
License:Open Source License
@Override protected void createButtonsForButtonBar(Composite parent) { backButton = createButton(parent, IDialogConstants.BACK_ID, IDialogConstants.BACK_LABEL, false); nextButton = createButton(parent, IDialogConstants.NEXT_ID, IDialogConstants.NEXT_LABEL, false); createButton(parent, IDialogConstants.OK_ID, IDialogConstants.OK_LABEL, true); backButton.setEnabled(false);//from w w w . java 2 s. c om nextButton.setEnabled(false); nextButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { ISelection sel = viewer.getSelection(); if (!(sel instanceof StructuredSelection)) { return; } StructuredSelection ssel = (StructuredSelection) sel; int index = matchedObjects.lastIndexOf(ssel.getFirstElement()); if (index == matchedObjects.size() - 1) { index = -1; } index++; fireSetSelection(new StructuredSelection(matchedObjects.get(index)), true); } }); backButton.addSelectionListener(new SelectionListener() { public void widgetDefaultSelected(SelectionEvent e) { } public void widgetSelected(SelectionEvent e) { ISelection sel = viewer.getSelection(); if (!(sel instanceof StructuredSelection)) { return; } StructuredSelection ssel = (StructuredSelection) sel; int index = matchedObjects.lastIndexOf(ssel.getFirstElement()); if (index == 0) { index = matchedObjects.size() - 1; } index--; fireSetSelection(new StructuredSelection(matchedObjects.get(index)), true); } }); }