List of usage examples for org.eclipse.jface.wizard WizardDialog getShell
public Shell getShell();
From source file:cn.cstv.wspscm.commands.CreateOperatorCommand.java
License:Open Source License
@Override public void execute() { /*//from w w w. j ava2 s .c o m shell = new Shell(display, SWT.NONE); shell.setSize(503, 242); shell.setText("Select Type and Number"); final Composite composite = new Composite(shell, SWT.NONE); composite.setBackground(Display.getCurrent().getSystemColor(SWT.COLOR_WHITE)); composite.setBounds(0, 0, 494, 64); shell.open(); shell.layout(); operator.setLocation(bounds.getLocation()); operator.setSize(bounds.getSize()); redo(); */ CreateOperatorWizard wizard = new CreateOperatorWizard("TypeOfOperator"); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.getShell().setSize(280, 325); dialog.setTitle("Set Operator Wizard"); if (dialog.open() == WizardDialog.OK) { type = wizard.getType(); num = wizard.getNum(); } operator.setType(type); if (!num.equals("")) { operator.setNum(Integer.parseInt(num)); } parent.addChild(operator); operator.setLocation(bounds.getLocation());//??operatorpoint operator.setSize(bounds.getSize()); }
From source file:cn.cstv.wspscm.commands.SetConstraintOfLineConnectionCommand.java
License:Open Source License
public void execute() { // InputDialog dlg = new InputDialog(shell, "Gef Practice", "New node's name:", "Node", null); // if (Window.OK == dlg.open()) { // value = dlg.getValue(); // }//ww w. ja v a2s . c o m if (typeOfConstraint.equals("Strict")) { lineConnection.setIsStrict_int(1); } else { CreateConstraintOfLineConnectionWizard wizard = new CreateConstraintOfLineConnectionWizard( typeOfConstraint); WizardDialog dialog = new WizardDialog(shell, wizard); dialog.create(); dialog.getShell().setSize(280, 325); dialog.setTitle("Set Constraint Wizard"); dialog.setMessage("Set " + typeOfConstraint); if (dialog.open() == WizardDialog.OK) { pastOrFuture = wizard.getPastOrFuture(); value = wizard.getValue(); constraint = wizard.getConstraint(); reset = wizard.getReset(); } if (typeOfConstraint.equals("PresentConstraint")) { oldValue = lineConnection.getPresentConstraintValue(); oldConstraint = lineConnection.getPresentConstraintConstraint(); oldReset = lineConnection.getPresentConstraintReset(); lineConnection.setPresentConstraintValue(value); lineConnection.setPresentConstraintConstraint(constraint); lineConnection.setPresentConstraintReset(reset); } else if (typeOfConstraint.equals("BooleanConstraint")) { if (pastOrFuture.equals("Past")) { oldValue = lineConnection.getPastUnwantedMessageConstraintValue(); oldConstraint = lineConnection.getPastUnwantedMessageConstraintConstraint(); oldReset = lineConnection.getPastUnwantedMessageConstraintReset(); lineConnection.setPastUnwantedMessageConstraintValue(value); lineConnection.setPastUnwantedMessageConstraintConstraint(constraint); lineConnection.setPastUnwantedMessageConstraintReset(reset); } else if (pastOrFuture.equals("Future")) { oldValue = lineConnection.getFutureUnwantedMessageConstraintValue(); oldConstraint = lineConnection.getFutureUnwantedMessageConstraintConstraint(); oldReset = lineConnection.getFutureUnwantedMessageConstraintReset(); lineConnection.setFutureUnwantedMessageConstraintValue(value); lineConnection.setFutureUnwantedMessageConstraintConstraint(constraint); lineConnection.setFutureUnwantedMessageConstraintReset(reset); } } else if (typeOfConstraint.equals("UnwantedMessageConstraint")) { if (pastOrFuture.equals("Past")) { oldValue = lineConnection.getPastUnwantedMessageConstraintValue(); oldConstraint = lineConnection.getPastUnwantedMessageConstraintConstraint(); oldReset = lineConnection.getPastUnwantedMessageConstraintReset(); lineConnection.setPastUnwantedMessageConstraintValue(value); lineConnection.setPastUnwantedMessageConstraintConstraint(constraint); lineConnection.setPastUnwantedMessageConstraintReset(reset); } else if (pastOrFuture.equals("Future")) { oldValue = lineConnection.getFutureUnwantedMessageConstraintValue(); oldConstraint = lineConnection.getFutureUnwantedMessageConstraintConstraint(); oldReset = lineConnection.getFutureUnwantedMessageConstraintReset(); lineConnection.setFutureUnwantedMessageConstraintValue(value); lineConnection.setFutureUnwantedMessageConstraintConstraint(constraint); lineConnection.setFutureUnwantedMessageConstraintReset(reset); } } else if (typeOfConstraint.equals("Present")) { if (pastOrFuture.equals("Past")) { oldValue = lineConnection.getPresentPastValue(); oldConstraint = lineConnection.getPresentPastConstraint(); oldReset = lineConnection.getPresentPastReset(); lineConnection.setPresentPastValue(value); lineConnection.setPresentPastConstraint(constraint); lineConnection.setPresentPastReset(reset); } else if (pastOrFuture.equals("Future")) { oldValue = lineConnection.getPresentFutureValue(); oldConstraint = lineConnection.getPresentFutureConstraint(); oldReset = lineConnection.getPresentFutureReset(); lineConnection.setPresentFutureValue(value); lineConnection.setPresentFutureConstraint(constraint); lineConnection.setPresentFutureReset(reset); } } else if (typeOfConstraint.equals("WantedChainConstraint")) { if (pastOrFuture.equals("Past")) { oldValue = lineConnection.getPastWantedChainConstraintValue(); oldConstraint = lineConnection.getPastWantedChainConstraintConstraint(); oldReset = lineConnection.getPastWantedChainConstraintReset(); lineConnection.setPastWantedChainConstraintValue(value); lineConnection.setPastWantedChainConstraintConstraint(constraint); lineConnection.setPastWantedChainConstraintReset(reset); } else if (pastOrFuture.equals("Future")) { oldValue = lineConnection.getFutureWantedChainConstraintValue(); oldConstraint = lineConnection.getFutureWantedChainConstraintConstraint(); oldReset = lineConnection.getFutureWantedChainConstraintReset(); lineConnection.setFutureWantedChainConstraintValue(value); lineConnection.setFutureWantedChainConstraintConstraint(constraint); lineConnection.setFutureWantedChainConstraintReset(reset); } } else if (typeOfConstraint.equals("UnwantedChainConstraint")) { if (pastOrFuture.equals("Past")) { oldValue = lineConnection.getPastUnwantedChainConstraintValue(); oldConstraint = lineConnection.getPastUnwantedChainConstraintConstraint(); oldReset = lineConnection.getPastUnwantedChainConstraintReset(); lineConnection.setPastUnwantedChainConstraintValue(value); lineConnection.setPastUnwantedChainConstraintConstraint(constraint); lineConnection.setPastUnwantedChainConstraintReset(reset); } else if (pastOrFuture.equals("Future")) { oldValue = lineConnection.getFutureUnwantedChainConstraintValue(); oldConstraint = lineConnection.getFutureUnwantedChainConstraintConstraint(); oldReset = lineConnection.getFutureUnwantedChainConstraintReset(); lineConnection.setFutureUnwantedChainConstraintValue(value); lineConnection.setFutureUnwantedChainConstraintConstraint(constraint); lineConnection.setFutureUnwantedChainConstraintReset(reset); } } } }
From source file:cn.ieclipse.adt.ext.actions.OpenWizardAction.java
License:Apache License
public void run(IAction action) { IWorkbench workbench = (this.mWorkbench != null) ? this.mWorkbench : PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); ISelection selection = this.mSelection; if (selection == null) { selection = window.getSelectionService().getSelection(); }/*from ww w . j a va 2 s . c om*/ IStructuredSelection selectionToPass = StructuredSelection.EMPTY; if (selection instanceof IStructuredSelection) { selectionToPass = (IStructuredSelection) selection; } else { IWorkbenchPart part = window.getPartService().getActivePart(); if (part instanceof IEditorPart) { IEditorInput input = ((IEditorPart) part).getEditorInput(); Class fileClass = LegacyResourceSupport.getFileClass(); if ((input != null) && (fileClass != null)) { Object file = Util.getAdapter(input, fileClass); if (file != null) { selectionToPass = new StructuredSelection(file); } } } } this.mWizard = instanciateWizard(action); this.mWizard.init(workbench, selectionToPass); Shell parent = window.getShell(); WizardDialog dialog = new WizardDialog(parent, this.mWizard); dialog.create(); // Point defaultSize = dialog.getShell().getSize(); // dialog.getShell().setSize( // Math.max(500, defaultSize.x), // Math.max(500, defaultSize.y)); window.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), "org.eclipse.ui.new_wizard_shortcut_context"); this.mDialogResult = dialog.open(); }
From source file:com.android.ide.eclipse.adt.wizards.actions.OpenWizardAction.java
License:Open Source License
/** * Opens and display the Android New Project Wizard. * <p/>/*from w w w . j a va2 s .c om*/ * Most of this implementation is extracted from {@link NewWizardShortcutAction#run()}. * * @see org.eclipse.ui.IActionDelegate#run(org.eclipse.jface.action.IAction) */ public void run(IAction action) { // get the workbench and the current window IWorkbench workbench = PlatformUI.getWorkbench(); IWorkbenchWindow window = workbench.getActiveWorkbenchWindow(); // This code from NewWizardShortcutAction#run() gets the current window selection // and converts it to a workbench structured selection for the wizard, if possible. ISelection selection = window.getSelectionService().getSelection(); IStructuredSelection selectionToPass = StructuredSelection.EMPTY; if (selection instanceof IStructuredSelection) { selectionToPass = (IStructuredSelection) selection; } else { // Build the selection from the IFile of the editor IWorkbenchPart part = window.getPartService().getActivePart(); if (part instanceof IEditorPart) { IEditorInput input = ((IEditorPart) part).getEditorInput(); Class<?> fileClass = LegacyResourceSupport.getFileClass(); if (input != null && fileClass != null) { Object file = Util.getAdapter(input, fileClass); if (file != null) { selectionToPass = new StructuredSelection(file); } } } } // Create the wizard and initialize it with the selection IWorkbenchWizard wizard = instanciateWizard(action); wizard.init(workbench, selectionToPass); // It's not visible yet until a dialog is created and opened Shell parent = window.getShell(); WizardDialog dialog = new WizardDialog(parent, wizard); dialog.create(); // This code comes straight from NewWizardShortcutAction#run() Point defaultSize = dialog.getShell().getSize(); dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, defaultSize.x), Math.max(SIZING_WIZARD_HEIGHT, defaultSize.y)); window.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IWorkbenchHelpContextIds.NEW_WIZARD_SHORTCUT); dialog.open(); }
From source file:com.aptana.ide.ui.io.actions.PromoteToProjectAction.java
License:Open Source License
public void run(IAction action) { if (fSelection == null) { return;//w w w . j a v a 2 s . c om } Object obj = fSelection.getFirstElement(); File file = null; if (obj instanceof IAdaptable) { file = (File) ((IAdaptable) obj).getAdapter(File.class); } if (file != null) { // uses the parent folder if the file is not a directory String path = file.isDirectory() ? file.getPath() : file.getParentFile().getPath(); PromoteToProjectWizard wizard = new PromoteToProjectWizard(path); wizard.setCreatingHostedSite(false); WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard); dialog.create(); CoreUIUtils.placeDialogInScreenCenter(Display.getCurrent().getActiveShell(), dialog.getShell()); dialog.open(); } }
From source file:com.aptana.ide.update.internal.manager.P2Eclipse35PluginManager.java
License:Open Source License
/** * @see com.aptana.ide.update.manager.IPluginManager#install(Plugin[], IProgressMonitor) *///from ww w. j a v a 2s. c o m public IStatus install(final IPlugin[] plugins, IProgressMonitor monitor) throws PluginManagerException { if (monitor == null) { monitor = new NullProgressMonitor(); } if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } String profileId = IProfileRegistry.SELF; IInstallableUnit[] toInstall = getInstallationUnits(plugins, profileId); if (toInstall.length <= 0) { throw new PluginManagerException( P2Eclipse35Messages.P2PluginManager_ERR_MSG_No_installable_units_found); } if (monitor.isCanceled()) { return Status.CANCEL_STATUS; } QueryableMetadataRepositoryManager queryableManager = new QueryableMetadataRepositoryManager( Policy.getDefault().getQueryContext(), false) { @Override protected URI[] getRepoLocations(IRepositoryManager manager) { URI[] result = new URI[plugins.length]; int i = 0; for (IPlugin ref : plugins) { try { result[i++] = ref.getURL().toURI(); } catch (URISyntaxException e) { // ignore for now } } return result; } }; InstallWizard wizard = new InstallWizard(generateNonManipulatingRepoPolicy(), profileId, toInstall, null, queryableManager); WizardDialog dialog = new ProvisioningWizardDialog(Display.getDefault().getActiveShell(), wizard); dialog.create(); PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.INSTALL_WIZARD); dialog.open(); return Status.OK_STATUS; }
From source file:com.aptana.ide.update.internal.manager.P2PluginManager.java
/** * @see com.aptana.ide.installer.plugins.IPluginManager#install(org.eclipse.update.core.IFeatureReference[], * org.eclipse.core.runtime.IProgressMonitor) *///from w ww .ja va 2s. co m public IStatus install(IPlugin[] plugins, IProgressMonitor monitor) throws PluginManagerException { if (monitor == null) monitor = new NullProgressMonitor(); if (monitor.isCanceled()) return Status.CANCEL_STATUS; final String profileId = IProfileRegistry.SELF; IInstallableUnit[] toInstall = getInstallationUnits(plugins, profileId); if (toInstall.length <= 0) { throw new PluginManagerException(Messages.P2PluginManager_ERR_MSG_No_installable_units_found); } if (monitor.isCanceled()) return Status.CANCEL_STATUS; final ProvisioningPlan result = getInstallationProvisioningPlan(toInstall, profileId); if (!validatePlan(result)) return Status.CANCEL_STATUS; if (monitor.isCanceled()) return Status.CANCEL_STATUS; final LicenseManager licenseManager = ProvSDKUIActivator.getDefault().getLicenseManager(); InstallWizard wizard = new InstallWizard(profileId, toInstall, result, licenseManager); WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard); dialog.create(); PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.INSTALL_WIZARD); dialog.open(); return Status.OK_STATUS; }
From source file:com.aptana.ide.update.internal.manager.P2PluginManager.java
/** * @see com.aptana.ide.installer.plugins.IPluginManager#uninstall(org.eclipse.update.core.IFeatureReference, * org.eclipse.core.runtime.IProgressMonitor) *///from ww w. j av a 2s . com public IStatus uninstall(IPlugin plugin, IProgressMonitor monitor) throws PluginManagerException { if (monitor.isCanceled()) return Status.CANCEL_STATUS; final String profileId = IProfileRegistry.SELF; Collector roots = new Collector(); try { InstallableUnitQuery query = new InstallableUnitQuery(getFeatureGroupName(plugin), new Version(plugin.getVersion())); ProfileElement element = new ProfileElement(profileId); roots = element.getQueryable().query(query, roots, monitor); } catch (CoreException e) { IdeLog.logError(P2Activator.getDefault(), e.getMessage(), e); } if (roots == null || roots.size() <= 0) { throw new PluginManagerException(Messages.P2PluginManager_ERR_MSG_No_installable_units_found); } IInstallableUnit[] ius = (IInstallableUnit[]) roots.toArray(IInstallableUnit.class); if (monitor.isCanceled()) return Status.CANCEL_STATUS; ProvisioningPlan plan = getUninstallationProvisioningPlan(ius, profileId); if (monitor.isCanceled()) return Status.CANCEL_STATUS; UninstallWizard wizard = new UninstallWizard(profileId, ius, plan); WizardDialog dialog = new WizardDialog(Display.getCurrent().getActiveShell(), wizard); dialog.create(); PlatformUI.getWorkbench().getHelpSystem().setHelp(dialog.getShell(), IProvHelpContextIds.UNINSTALL_WIZARD); dialog.open(); return Status.OK_STATUS; }
From source file:com.cloudbees.eclipse.ui.internal.preferences.JenkinsInstancesPreferencePage.java
License:Open Source License
@Override protected Control createContents(final Composite parent) { parent.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); Composite comp = new Composite(parent, SWT.NONE); GridLayout gl_comp = new GridLayout(1, false); gl_comp.marginWidth = 0;/*from w ww . j a v a 2s .c o m*/ gl_comp.verticalSpacing = 0; gl_comp.horizontalSpacing = 0; comp.setLayout(gl_comp); Label lblConfiguredJenkins = new Label(comp, SWT.NONE); lblConfiguredJenkins.setText("Available Jenkins instances:"); //TODO i18n Composite compositeJenkinsInstances = new Composite(comp, SWT.NONE); compositeJenkinsInstances.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); GridLayout gl_compositeJenkinsInstances = new GridLayout(2, false); gl_compositeJenkinsInstances.marginWidth = 0; compositeJenkinsInstances.setLayout(gl_compositeJenkinsInstances); Composite compositeTable = new Composite(compositeJenkinsInstances, SWT.NONE); compositeTable.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); GridLayout gl_compositeTable = new GridLayout(1, false); gl_compositeTable.marginHeight = 0; gl_compositeTable.marginWidth = 0; compositeTable.setLayout(gl_compositeTable); this.table = new Table(compositeTable, SWT.BORDER | SWT.FULL_SELECTION); this.table.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); this.table.setHeaderVisible(true); this.table.setLinesVisible(true); this.table.addSelectionListener(new SelectionListener() { public void widgetSelected(final SelectionEvent e) { enableButtons(); } public void widgetDefaultSelected(final SelectionEvent e) { enableButtons(); } }); TableColumn tblclmnLabel = new TableColumn(this.table, SWT.NONE); tblclmnLabel.setWidth(120); tblclmnLabel.setText("Label");//TODO i18n TableColumn tblclmnUrl = new TableColumn(this.table, SWT.NONE); tblclmnUrl.setWidth(300); tblclmnUrl.setText("Url");//TODO i18n Composite compositeButtons = new Composite(compositeJenkinsInstances, SWT.NONE); GridLayout gl_compositeButtons = new GridLayout(1, false); gl_compositeButtons.marginHeight = 0; gl_compositeButtons.marginWidth = 0; compositeButtons.setLayout(gl_compositeButtons); compositeButtons.setLayoutData(new GridData(SWT.FILL, SWT.TOP, false, false, 1, 1)); this.btnAdd = new Button(compositeButtons, SWT.PUSH); GridData gd_btnAdd = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_btnAdd.widthHint = 70; this.btnAdd.setLayoutData(gd_btnAdd); this.btnAdd.setText("&Add..."); this.btnEdit = new Button(compositeButtons, SWT.NONE); this.btnEdit.setEnabled(false); GridData gd_btnEdit = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_btnEdit.widthHint = 70; this.btnEdit.setLayoutData(gd_btnEdit); this.btnEdit.setText("E&dit..."); this.btnRemove = new Button(compositeButtons, SWT.NONE); this.btnRemove.setEnabled(false); GridData gd_btnRemove = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd_btnRemove.widthHint = 70; this.btnRemove.setLayoutData(gd_btnRemove); this.btnRemove.setText("&Remove"); SelectionAdapter addListener = new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { Shell parent = CloudBeesUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); WizardDialog dialog = new JenkinsWizardDialog(parent); dialog.create(); dialog.getShell().setSize(Math.max(400, dialog.getShell().getSize().x), 400); dialog.open(); loadTable(); } }; this.btnAdd.addSelectionListener(addListener); SelectionAdapter editListener = new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { TableItem[] items = JenkinsInstancesPreferencePage.this.table.getSelection(); if (items == null || items.length <= 0) { return; } JenkinsInstance ni = (JenkinsInstance) items[0].getData(); Shell parent = CloudBeesUIPlugin.getDefault().getWorkbench().getActiveWorkbenchWindow().getShell(); WizardDialog dialog = new JenkinsWizardDialog(parent, ni); dialog.create(); dialog.getShell().setSize(Math.max(400, dialog.getShell().getSize().x), 400); dialog.open(); loadTable(); } }; this.btnEdit.addSelectionListener(editListener); SelectionAdapter removeListener = new SelectionAdapter() { @Override public void widgetSelected(final SelectionEvent e) { TableItem[] items = JenkinsInstancesPreferencePage.this.table.getSelection(); int[] itemIndices = JenkinsInstancesPreferencePage.this.table.getSelectionIndices(); if (items == null || items.length <= 0) { return; } for (TableItem item : items) { JenkinsInstance ni = (JenkinsInstance) item.getData(); CloudBeesUIPlugin.getDefault().removeJenkinsInstance(ni); } JenkinsInstancesPreferencePage.this.table.remove(itemIndices); } }; this.btnRemove.addSelectionListener(removeListener); loadTable(); return comp; }
From source file:com.genericworkflownodes.knime.workflowexporter.export.ui.action.WorkflowExportActionDelegate.java
License:Open Source License
@Override public void run(final IAction action) { if (workflowEditor == null) { throw new IllegalStateException("There is no workflowEditor set! Cannot continue."); }// www .ja v a 2 s .c om final IWorkbenchWindow workbenchWindow = PlatformUI.getWorkbench().getActiveWorkbenchWindow(); if (workbenchWindow == null) { // not sure what should happen here return; } final WorkflowExportWizard wizard = new WorkflowExportWizard(workflowEditor, KnimeWorkflowExporterProvider.getInstance().getAvailableExporters()); final Shell parent = workbenchWindow.getShell(); final WizardDialog dialog = new WizardDialog(parent, wizard); dialog.create(); dialog.getShell().setSize(Math.max(SIZING_WIZARD_WIDTH, dialog.getShell().getSize().x), SIZING_WIZARD_HEIGHT); dialog.open(); }