List of usage examples for org.eclipse.jface.wizard WizardDialog setPageSize
public void setPageSize(int width, int height)
From source file:Main.java
License:Open Source License
public static void main(String[] args) { // properties propertiesLoader = new PropertiesLoader(); try {//from www.jav a 2s .c o m propertiesLoader.load(); } catch (IOException e) { System.err.println("There was a problem with loading/creating the configuration file"); } LoadingThread loadingThread = new LoadingThread(propertiesLoader); new Splash(loadingThread); // returns after loading view = loadingThread.getView(); controller = loadingThread.getController(); player = loadingThread.getPlay(); // train som controller.trainSom(); if (loadColourWizard()) { ColourAssociationWizard colourWizard = new ColourAssociationWizard(player, propertiesLoader); WizardDialog wizard = new WizardDialog(view.getShell(), colourWizard); wizard.setPageSize(400, 250); wizard.create(); wizard.setBlockOnOpen(false); wizard.open(); } // open window view.setBlockOnOpen(true); view.open(); // save preferences try { propertiesLoader.save(); } catch (IOException ioe) { System.err.println("There was an error saving the properties file while the program was shutting down"); } player.cleanUp(); controller.cleanUp(); Database.cleanUp(); }
From source file:au.gov.ga.earthsci.layer.ui.wizard.gocad.GOCADLayerIntentHandler.java
License:Apache License
@Override protected void handle(final IRetrievalData data, final URL url, final Intent intent, final IIntentCallback callback) { shell.getDisplay().asyncExec(new Runnable() { @Override//ww w.j a v a2s .com public void run() { try { String extension = FileUtil.getExtension(url.toString()); String filename = FileUtil.getFilename(url.toString()); boolean sgrid = extension.toLowerCase().equals("sg"); //$NON-NLS-1$ boolean well = extension.toLowerCase().equals("wl"); //$NON-NLS-1$ InitialParameters initialParameters = InitialParameters.readFromGOCADObject(data); well |= initialParameters.well; sgrid |= initialParameters.sgrid; //wells don't allow property painting String[] properties = well ? null : initialParameters.properties; final GOCADLayerParameters params = new GOCADLayerParameters(); WizardDialog dialog = new WizardDialog(shell, new GOCADLayerParametersWizard(params, properties, false)); dialog.setPageSize(400, 500); dialog.open(); if (dialog.getReturnCode() != WizardDialog.OK) { callback.aborted(intent); return; } String layerType = well ? "BoreholeLayer" : sgrid ? "VolumeLayer" : "ModelLayer"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ String dataFormat = well ? "GOCAD Well" : sgrid ? "GOCAD SGrid" : "GOCAD"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ ColorMap colorMap = params.getColorMap() == null ? null : params.getColorMap().toLegacy(); Color nodataColor = params.getColorMap() == null ? null : params.getColorMap().getNodataColour(); String paintedVariable = params.getPaintedVariable(); DocumentBuilderFactory docFactory = DocumentBuilderFactory.newInstance(); DocumentBuilder docBuilder = docFactory.newDocumentBuilder(); Document doc = docBuilder.newDocument(); Element rootElement = doc.createElement("Layer"); //$NON-NLS-1$ doc.appendChild(rootElement); rootElement.setAttribute("version", "1"); //$NON-NLS-1$ //$NON-NLS-2$ rootElement.setAttribute("layerType", layerType); //$NON-NLS-1$ XMLUtil.appendText(rootElement, "URL", url.toString()); //$NON-NLS-1$ XMLUtil.appendText(rootElement, "DataFormat", dataFormat); //$NON-NLS-1$ XMLUtil.appendText(rootElement, "DisplayName", filename); //$NON-NLS-1$ XMLUtil.appendText(rootElement, "DataCacheName", filename); //$NON-NLS-1$ XMLUtil.appendText(rootElement, "CoordinateSystem", params.getSourceProjection()); //$NON-NLS-1$ if (colorMap != null) { XMLUtil.appendColorMap(rootElement, "ColorMap", colorMap); //$NON-NLS-1$ } if (nodataColor != null) { XMLUtil.appendColor(rootElement, "NoDataColor", nodataColor); //$NON-NLS-1$ } if (paintedVariable != null) { XMLUtil.appendText(rootElement, "PaintedVariable", paintedVariable); //$NON-NLS-1$ } Object layer = BasicFactory.create(AVKey.LAYER_FACTORY, rootElement); callback.completed(layer, intent); } catch (Exception e) { callback.error(e, intent); } } }); }
From source file:ch.acanda.eclipse.pmd.properties.PMDPropertyPageController.java
License:Open Source License
public void addRuleSetConfiguration(final Shell shell) { final AddRuleSetConfigurationWizard wizard = new AddRuleSetConfigurationWizard(project); final WizardDialog dialog = new WizardDialog(shell, wizard); dialog.setPageSize(300, SWT.DEFAULT); final int result = dialog.open(); if (result == Window.OK && wizard.getRuleSetModel() != null) { final RuleSetViewModel viewModel = toViewModel(wizard.getRuleSetModel(), project); model.addRuleSet(viewModel);/*from w w w . jav a2 s. co m*/ final HashSet<RuleSetViewModel> activeConfigs = new HashSet<>(model.getActiveRuleSets()); activeConfigs.add(viewModel); model.setActiveRuleSets(activeConfigs); } }
From source file:ch.unibe.iam.scg.archie.actions.ChartWizardAction.java
License:Open Source License
/** * @see org.eclipse.jface.action.Action#run() */// www. j a v a 2 s .c om @Override public void run() { ChartWizard chartWizard = new ChartWizard(); WizardDialog wizardDialog = new WizardDialog(Display.getDefault().getActiveShell(), chartWizard); wizardDialog.setPageSize(ChartWizardAction.WIZARD_PAGE_WIDTH, ChartWizardAction.WIZARD_PAGE_HEIGHT); wizardDialog.setBlockOnOpen(true); wizardDialog.create(); // create the dialog and check for response if (WizardDialog.OK == wizardDialog.open()) { // get model from wizard ChartModel chartModel = chartWizard.getModel(); // set models ProviderChartFactory.getInstance().setChartModel(chartModel); ChartModelManager.getInstance().setChartModel(chartModel); // check if the chart view is already open and set dirty if needed this.setExistingViewDirty(); try { PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().showView(ChartView.ID); } catch (PartInitException e) { ArchieActivator.LOG.log("Could not create the chart view." + "\n" + e.getLocalizedMessage(), Log.ERRORS); e.printStackTrace(); } } }
From source file:cn.dockerfoundry.ide.eclipse.server.ui.internal.wizards.DockerFoundryApplicationServicesWizardPage.java
License:Open Source License
public void createControl(Composite parent) { setDescription(DESCRIPTION);/*from w w w . java 2s . c om*/ ImageDescriptor banner = DockerFoundryImages.getWizardBanner(serverTypeId); if (banner != null) { setImageDescriptor(banner); } Composite tableArea = new Composite(parent, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(1).applyTo(tableArea); GridDataFactory.fillDefaults().grab(true, true).applyTo(tableArea); Composite toolBarArea = new Composite(tableArea, SWT.NONE); GridLayoutFactory.fillDefaults().numColumns(2).applyTo(toolBarArea); GridDataFactory.fillDefaults().grab(true, false).applyTo(toolBarArea); Label label = new Label(toolBarArea, SWT.NONE); GridDataFactory.fillDefaults().grab(false, false).align(SWT.BEGINNING, SWT.CENTER).applyTo(label); label.setText(Messages.DockerFoundryApplicationServicesWizardPage_LABEL_SELECT_SERVICE); Table table = new Table(tableArea, SWT.BORDER | SWT.SINGLE | SWT.CHECK); GridDataFactory.fillDefaults().grab(true, true).applyTo(table); ToolBarManager toolBarManager = new ToolBarManager(SWT.FLAT); ToolBar bar = toolBarManager.createControl(toolBarArea); GridDataFactory.fillDefaults().align(SWT.END, SWT.BEGINNING).grab(true, false).applyTo(bar); servicesViewer = new CheckboxTableViewer(table); servicesViewer.setContentProvider(new TreeContentProvider()); servicesViewer.setLabelProvider(new ServicesTreeLabelProvider(servicesViewer) { protected Image getColumnImage(DockerApplicationService service, ServiceViewColumn column) { return null; } }); servicesViewer.setSorter(new ServiceViewerSorter(servicesViewer) { @Override protected int compare(DockerApplicationService service1, DockerApplicationService service2, ServiceViewColumn sortColumn) { return super.compare(service1, service2, sortColumn); } }); new ServiceViewerConfigurator().enableAutomaticViewerResizing().configureViewer(servicesViewer); servicesViewer.addSelectionChangedListener(new ISelectionChangedListener() { public void selectionChanged(SelectionChangedEvent event) { Object[] services = servicesViewer.getCheckedElements(); if (services != null) { selectedServicesToBind.clear(); for (Object obj : services) { DockerApplicationService service = (DockerApplicationService) obj; selectedServicesToBind.add(service.getName()); } setServicesToBindInDescriptor(); } } }); Action addServiceAction = new Action(Messages.COMMONTXT_ADD_SERVICE, DockerFoundryImages.NEW_SERVICE) { public void run() { // Do not create the service right away. boolean deferAdditionOfService = true; DockerFoundryServiceWizard wizard = new DockerFoundryServiceWizard(cloudServer, deferAdditionOfService); WizardDialog dialog = new WizardDialog(getShell(), wizard); wizard.setParent(dialog); dialog.setPageSize(900, 600); dialog.setBlockOnOpen(true); if (dialog.open() == Window.OK) { // This cloud service does not yet exist. It will be created // outside of the wizard List<List<ServiceInstance>> addedService = wizard.getServices(); if (addedService != null) { List<DockerApplicationService> _addedServiceList = new ArrayList<DockerApplicationService>(); for (List<ServiceInstance> list : addedService) { for (ServiceInstance serviceInstance : list) { DockerApplicationService e = new DockerApplicationService(); e.setName(serviceInstance.getName()); e.setLinkName(serviceInstance.getUserDefinedName()); _addedServiceList.add(e); } } addServices(_addedServiceList); } } } public String getToolTipText() { return Messages.DockerFoundryApplicationServicesWizardPage_TEXT_TOOLTIP; } }; toolBarManager.add(addServiceAction); toolBarManager.update(true); setControl(tableArea); setInput(); }
From source file:com.amazonaws.eclipse.datatools.enablement.simpledb.editor.SDBTextEditor.java
License:Apache License
public void externalEdit(final TableDataEditor editor) { if (editor.getCursor().getColumn() == 0) { Object value = getCellValue(editor); if ((value instanceof SimpleDBItemName && !((SimpleDBItemName) value).isPersisted()) || value instanceof String || value == null) { SDBTableIdDataWizard wizard = new SDBTableIdDataWizard(editor); WizardDialog dialog = new WizardDialog(editor.getSite().getShell(), wizard); dialog.setPageSize(400, 250); dialog.open();/* w w w. ja v a2 s. co m*/ } else { ErrorDialog ed = new ErrorDialog(editor.getEditorSite().getShell(), Messages.idErrorDialogTitle, Messages.idErrorDialogMessage, new Status(IStatus.INFO, Activator.PLUGIN_ID, Messages.idErrorStatusMessage), SWT.ERROR); ed.open(); } } else { SDBTableDataWizard wizard = new SDBTableDataWizard(editor); WizardDialog dialog = new WizardDialog(editor.getSite().getShell(), wizard); dialog.setPageSize(400, 250); dialog.open(); } }
From source file:com.appcelerator.titanium.desktop.ui.wizard.PackageHandler.java
License:Apache License
public Object execute(ExecutionEvent event) throws ExecutionException { ITitaniumUser user = TitaniumCorePlugin.getDefault().getUserManager().getSignedInUser(); if (user == null) { // Force the login! // TODO Make it easy for user to sign in from here! MessageDialog.openError(UIUtils.getActiveShell(), Messages.PackageHandler_LoginTitle, Messages.PackageHandler_LoginMessage); return null; }//from w w w . j a v a 2 s .c o m DistributeDesktopWizard wizard = new DistributeDesktopWizard(); WizardDialog dialog = new WizardDialog(UIUtils.getActiveShell(), wizard); dialog.setPageSize(400, 300); IResource selectedResource = UIUtils .getSelectedResource((IEvaluationContext) event.getApplicationContext()); if (selectedResource != null) { wizard.init(PlatformUI.getWorkbench(), new StructuredSelection(selectedResource)); } dialog.open(); return null; }
From source file:com.ebmwebsoucing.petals.repositories.explorer.RepositoryExplorerActionProvider.java
License:Open Source License
@Override public void init(final ICommonActionExtensionSite aSite) { ICommonViewerSite site = aSite.getViewSite(); if (!(site instanceof ICommonViewerWorkbenchSite)) return;/* ww w.j a va 2s. co m*/ final ISelectionProvider provider = ((ICommonViewerWorkbenchSite) site).getSelectionProvider(); // // Remove action this.deleteRepositoryAction = new Action() { @Override public void run() { Repository rep = getSelectedRepository(provider); if (rep != null) RepositoryManager.getInstance().removeRepository(rep); } @Override public boolean isEnabled() { return getSelectedRepository(provider) != null; } }; this.deleteRepositoryAction.setText("Delete"); this.deleteRepositoryAction.setToolTipText("Delete this service repository"); this.deleteRepositoryAction.setDescription("Delete this service repository."); ImageDescriptor desc = PetalsRepositoriesPlugin.getImageDescriptor("icons/obj16/delete.gif"); this.deleteRepositoryAction.setImageDescriptor(desc); // // New repository action this.addRepositoryAction = new Action() { @Override public void run() { IWorkbench workbench = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getWorkbench(); RepositoryNewWizard wizard = new RepositoryNewWizard(); final Display display = PlatformUI.getWorkbench().getDisplay(); WizardDialog dlg = new WizardDialog(new Shell(display), wizard) { @Override protected Control createContents(Composite parent) { Control c = super.createContents(parent); Rectangle rect = display.getBounds(); Point shellPoint = getShell().getSize(); int x = (rect.width - shellPoint.x) / 2 + rect.x; int y = (rect.height - shellPoint.y) / 2 + rect.y; getShell().setLocation(x, y); return c; } }; workbench.saveAllEditors(true); dlg.setPageSize(400, 300); dlg.open(); } @Override public boolean isEnabled() { return true; } }; this.addRepositoryAction.setText("New Repository"); this.addRepositoryAction.setToolTipText("Add a new service repository"); this.addRepositoryAction.setDescription("Add a new service repository."); desc = PetalsRepositoriesPlugin.getImageDescriptor("icons/obj16/petals_service.png"); this.addRepositoryAction.setImageDescriptor(desc); // // Properties action this.propertiesAction = new Action() { @Override public boolean isEnabled() { return getSelectedRepository(provider) != null; } @Override public void run() { Repository rep = getSelectedRepository(provider); try { // Show properties view IWorkbenchPage page = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage(); page.showView("org.eclipse.ui.views.PropertySheet"); //$NON-NLS-1$ // Show the Petals service explorer page.showView("com.ebmwebsourcing.petals.repositories.view"); //$NON-NLS-1$ // Select the previous selection in the outline. provider.setSelection(new StructuredSelection(rep)); } catch (Exception e) { PetalsRepositoriesPlugin.log(e, IStatus.ERROR); } } }; this.propertiesAction.setText("Properties"); this.propertiesAction.setToolTipText("Show properties"); this.propertiesAction.setDescription("Show the properties of the selected element."); desc = PetalsRepositoriesPlugin.getImageDescriptor("icons/obj16/properties.gif"); this.propertiesAction.setImageDescriptor(desc); }
From source file:com.ebmwebsourcing.petals.services.eip.designer.handlers.ExportAsPetalsProjectsHandler.java
License:Open Source License
public Object execute(ExecutionEvent event) throws ExecutionException { // Get the selection's content IFile eipChainFile = null;// ww w. jav a 2 s. c o m ISelection s = null; try { s = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection(); Object o = ((IStructuredSelection) s).getFirstElement(); if (o instanceof IFile && ((IFile) o).getName().endsWith(".peip")) eipChainFile = (IFile) o; else eipChainFile = null; } catch (Exception e1) { // nothing } // Load the model EipChain eipChain = null; if (eipChainFile != null) { try { eipChain = EipDesignerSerializer.INSTANCE.read(eipChainFile.getLocation().toFile()); } catch (IOException e) { PetalsEipPlugin.log(e, IStatus.ERROR); MessageDialog.openError(new Shell(), "Export Error", "An error occurred while reading the file. Check the logs for more details."); } } // Open the export wizard if (eipChain != null) { IWorkbench workbench = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getWorkbench(); MavenProjectExportWizard wizard = new MavenProjectExportWizard(eipChain); final Display display = PlatformUI.getWorkbench().getDisplay(); WizardDialog dlg = new WizardDialog(new Shell(display), wizard) { @Override protected Control createContents(Composite parent) { Control c = super.createContents(parent); Rectangle rect = display.getBounds(); Point shellPoint = getShell().getSize(); int x = (rect.width - shellPoint.x) / 2 + rect.x; int y = (rect.height - shellPoint.y) / 2 + rect.y; getShell().setLocation(x, y); return c; } }; workbench.saveAllEditors(true); dlg.setPageSize(400, 300); dlg.open(); } return null; }
From source file:com.huawei.networkos.ops.python.editor.actions.AddPostBodyAction.java
License:Open Source License
public void run(IAction action) { PyEdit pyEdit = getPyEdit();//from w w w . ja v a 2s . co m Display display = Display.getDefault(); AddPostBodyWizard addPostBodyWizard = new AddPostBodyWizard(pyEdit); WizardDialog dialog = new WizardDialog(new Shell(display), addPostBodyWizard); dialog.setPageSize(400, 400); dialog.open(); }