Java Code Examples for org.eclipse.jface.wizard.WizardDialog.create()

The following are Jave code examples for showing how to use create() of the org.eclipse.jface.wizard.WizardDialog class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
+ Save this method
Example 1
Project: PDFReporter-Studio   File: EditSpiderChartCommand.java   View Source Code Vote up 6 votes
@Override
public void execute() {
	if (newChart == null) {
		JRDesignComponentElement clone = (JRDesignComponentElement) oldChart
				.clone();
		SpiderChartComponent scc = (SpiderChartComponent) clone
				.getComponent();
		// TODO SHOULD TAKE THIS ONE FROM EDITOR

		ChartWizard wizard = new ChartWizard(new MSpiderChart(null, clone,
				-1), (JRDesignElementDataset) scc.getDataset());
		wizard.init(jConfig);
		wizard.setExpressionContext(ModelUtils.getElementExpressionContext(oldChart,originalNode));
		WizardDialog dialog = new WizardDialog(Display.getDefault()
				.getActiveShell(), wizard);
		dialog.create();
		if (dialog.open() == Dialog.OK) {
			this.newChart = (JRDesignComponentElement) wizard.getChart()
					.getValue();
		} else
			return;
	}
	switchCharts(oldChart, newChart);
}
 
Example 2
Project: PDFReporter-Studio   File: EditChartCommand.java   View Source Code Vote up 6 votes
@Override
public void execute() {
	if (newChart == null) {
		JRDesignChart clone = (JRDesignChart) oldChart.clone();

		ChartWizard wizard = new ChartWizard(new MChart(null, clone, -1),
				(JRDesignElementDataset) clone.getDataset(), true);
		wizard.init(jConfig);
		wizard.setExpressionContext(ModelUtils.getElementExpressionContext(oldChart, originalNode));
		WizardDialog dialog = new WizardDialog(Display.getDefault()
				.getActiveShell(), wizard);
		dialog.create();
		if (dialog.open() == Dialog.OK) {
			this.newChart = (JRDesignChart) wizard.getChart().getValue();
		} else
			return;
	}
	switchCharts(oldChart, newChart);
}
 
Example 3
Project: hadoop-EAR   File: NewLocationAction.java   View Source Code Vote up 6 votes
@Override
public void run() {
  WizardDialog dialog = new WizardDialog(null, new Wizard() {
    private HadoopLocationWizard page = new HadoopLocationWizard();

    @Override
    public void addPages() {
      super.addPages();
      setWindowTitle("New Hadoop location...");
      addPage(page);
    }

    @Override
    public boolean performFinish() {
      page.performFinish();
      return true;
    }

  });

  dialog.create();
  dialog.setBlockOnOpen(true);
  dialog.open();

  super.run();
}
 
Example 4
Project: PDFReporter-Studio   File: UploadReportCheatAction.java   View Source Code Vote up 6 votes
@Override
public void run() {
	ANode rootElement = HandlersUtil.getRootElement();
	if (rootElement != null) {
		JasperDesign design = rootElement.getJasperDesign();
		JasperReportsConfiguration config = rootElement.getJasperConfiguration();
		ANode servers = HandlersUtil.getServers();
		if (servers != null && servers.getChildren().size() > 0) {
			// Create a fake root to show only the server connection in the list
			Publish2ServerWizard wizard = new Publish2ServerWizard(design, config, 1);
			WizardDialog dialogToOpen = new WizardDialog(UIUtils.getShell(), wizard);
			dialogToOpen.create();
			dialogToOpen.open();
		} else
			MessageDialog.openWarning(UIUtils.getShell(), Messages.UploadReportCheatAction_no_server_title, Messages.UploadReportCheatAction_no_server_warning);
	} else
		MessageDialog.openWarning(UIUtils.getShell(), Messages.UploadReportCheatAction_warning_title, Messages.UploadReportCheatAction_warning_message);
}
 
Example 5
Project: yamcs-studio   File: UpdateHandler.java   View Source Code Vote up 6 votes
@Override
protected void doExecute(LoadMetadataRepositoryJob job) {
    if (hasNoRepos) {
        MessageDialog.openInformation(null, "Update Yamcs Studio", "Could not check for updates since no repository is configured");
        return;
    }

    UpdateOperation operation = getProvisioningUI().getUpdateOperation(null, null);
    // check for updates
    operation.resolveModal(null);
    if (getProvisioningUI().getPolicy().continueWorkingWithOperation(operation, getShell())) {
        if (UpdateSingleIUWizard.validFor(operation)) {
            // Special case for only updating a single root
            UpdateSingleIUWizard wizard = new UpdateSingleIUWizard(getProvisioningUI(), operation);
            WizardDialog dialog = new WizardDialog(getShell(), wizard);
            dialog.create();
            dialog.open();
        } else {
            // Open the normal version of the update wizard
            getProvisioningUI().openUpdateWizard(false, operation, job);
        }
    }
}
 
Example 6
Project: PDFReporter-Studio   File: SelectorMondrianConnection.java   View Source Code Vote up 6 votes
@Override
protected MResource getLocalResource(MResource res, ResourceDescriptor runit, ANode pnode) {
	AddResourceWizard wizard = new AddResourceWizard(res, true);
	wizard.setMondrianOnly(true);
	WizardDialog dialog = new WizardDialog(UIUtils.getShell(), wizard);
	dialog.create();
	if (dialog.open() != Dialog.OK)
		return null;
	MResource r = wizard.getResource();
	ResourceDescriptor ref = r.getValue();
	ref.setIsNew(true);
	ref.setIsReference(false);
	ref.setParentFolder(runit.getParentFolder() + "/" + runit.getName() + "_files"); //$NON-NLS-1$
	ref.setDirty(true);
	return r;
}
 
Example 7
Project: Copy-Work-Items   File: CopyWorkItemsFromQuery.java   View Source Code Vote up 6 votes
public void run(IAction action) {
	IQueryDescriptorHandle handle= null;
	if (fSelection.getFirstElement() instanceof IQueryDescriptorHandle) {
		handle= (IQueryDescriptorHandle)fSelection.getFirstElement();
	}
	if (handle == null) {
		return;
	}


	CopyWorkItemsFromQueryWizard wizard= new CopyWorkItemsFromQueryWizard();
	wizard.init(fPart.getSite().getWorkbenchWindow().getWorkbench(), new StructuredSelection(handle));
	WizardDialog dialog= new WizardDialog(fPart.getSite().getShell(), wizard);
	dialog.create();
	dialog.open();
}
 
Example 8
Project: PDFReporter-Studio   File: CreateSortFieldCommand.java   View Source Code Vote up 5 votes
private void createObject() {
	if (jrField == null) {
		jrField = MSortField.createJRSortField(jrDataSet);
		SortFieldWizard wizard = new SortFieldWizard();
		wizard.init(jrDataSet, jrField);
		WizardDialog dialog = new WizardDialog(UIUtils.getShell(), wizard);
		dialog.create();
		if (dialog.open() != Dialog.OK) {
			jrField = null;
			return;
		}
	}
}
 
Example 9
Project: PDFReporter-Studio   File: TabStopsCellEditor.java   View Source Code Vote up 5 votes
@Override
protected Object openDialogBox(Control cellEditorWindow) {
	TabStopsEditor wizard = new TabStopsEditor();
	wizard.setValue((List<TabStop>) getValue());
	WizardDialog dialog = new WizardDialog(cellEditorWindow.getShell(), wizard);
	dialog.create();
	if (dialog.open() == Dialog.OK) {
		return wizard.getValue();
	}
	return null;
}
 
Example 10
Project: gama   File: JDataStoreWizard.java   View Source Code Vote up 5 votes
public static void main(final String[] args) {
	final Display display = new Display();
	final Shell shell = new Shell(display);
	final JDataStoreWizard wizard = new JDataStoreWizard(".shp");
	final WizardDialog dialog = new WizardDialog(shell, wizard);
	dialog.create();
	dialog.open();
}
 
Example 11
Project: PDFReporter-Studio   File: SubreportPropertiesCellEditor.java   View Source Code Vote up 5 votes
@Override
protected Object openDialogBox(Control cellEditorWindow) {
	SubreportPropertyEditor wizard = new SubreportPropertyEditor();
	wizard.setValue((JRSubreportParameter[]) getValue(), msubreport);
	WizardDialog dialog = new WizardDialog(cellEditorWindow.getShell(), wizard);
	dialog.create();
	if (dialog.open() == Dialog.OK) {
		return wizard.getValue();
	}
	return null;
}
 
Example 12
Project: txtUML   File: TxtUMLVisualizeSelectedDiagramsHandler.java   View Source Code Vote up 5 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	TxtUMLVisualizeWizard wizard = new TxtUMLVisualizeWizard();
	WizardDialog wizardDialog = new WizardDialog(null, wizard);
	wizardDialog.create();

	VisualizeTxtUMLPage page = ((VisualizeTxtUMLPage) wizardDialog.getSelectedPage());

	// get selected files
	ISelection selection = HandlerUtil.getCurrentSelection(event);
	IStructuredSelection strSelection = (IStructuredSelection) selection;

	List<ICompilationUnit> selectedCompilationUnits = new ArrayList<>();
	Stream.of(strSelection.toArray()).forEach(s -> selectedCompilationUnits
			.add((ICompilationUnit) ((IAdaptable) s).getAdapter(ICompilationUnit.class)));
	try {
		List<IType> types = new ArrayList<>();
		for (ICompilationUnit cu : selectedCompilationUnits) {
			types.addAll(Arrays.asList(cu.getTypes()));
		}
		page.selectElementsInDiagramTree(types.toArray(), false);
		page.setExpandedLayouts(types);
	} catch (JavaModelException ex) {
	}

	wizardDialog.open();
	return null;
}
 
Example 13
Project: txtUML   File: TxtUMLVisualizeSelectedDiagramsHandler.java   View Source Code Vote up 5 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	TxtUMLVisualizeWizard wizard = new TxtUMLVisualizeWizard();
	WizardDialog wizardDialog = new WizardDialog(null, wizard);
	wizardDialog.create();

	VisualizeTxtUMLPage page = ((VisualizeTxtUMLPage) wizardDialog.getSelectedPage());

	// get selected files
	ISelection selection = HandlerUtil.getCurrentSelection(event);
	IStructuredSelection strSelection = (IStructuredSelection) selection;

	List<ICompilationUnit> selectedCompilationUnits = new ArrayList<>();
	Stream.of(strSelection.toArray()).forEach(s -> selectedCompilationUnits
			.add((ICompilationUnit) ((IAdaptable) s).getAdapter(ICompilationUnit.class)));
	try {
		List<IType> types = new ArrayList<>();
		for (ICompilationUnit cu : selectedCompilationUnits) {
			types.addAll(Arrays.asList(cu.getTypes()));
		}
		page.selectElementsInDiagramTree(types.toArray(), false);
		page.setExpandedLayouts(types);
	} catch (JavaModelException ex) {
	}

	wizardDialog.open();
	return null;
}
 
Example 14
Project: PDFReporter-Studio   File: ExportMetadataAction.java   View Source Code Vote up 5 votes
@Override
public void run() {
	StructuredSelection selection = (StructuredSelection) treeViewer.getSelection();

	ExportMetadataWizard wizard = new ExportMetadataWizard(selection);
	WizardDialog dialog = new WizardDialog(UIUtils.getShell(), wizard);
	dialog.create();
	if (dialog.open() == Dialog.OK) {

	}
}
 
Example 15
Project: gwt-eclipse-plugin   File: AbstractOpenWizardAction.java   View Source Code Vote up 5 votes
@Override
public void run() {
  Shell localShell = getShell();
  if (!doCreateProjectFirstOnEmptyWorkspace(localShell)) {
    return;
  }

  try {
    INewWizard wizard = createWizard();
    wizard.init(PlatformUI.getWorkbench(), getSelection());

    WizardDialog dialog = new WizardDialog(localShell, wizard);
    IPixelConverter converter =
        PixelConverterFactory.createPixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70),
        converter.convertHeightInCharsToPixels(20));
    dialog.create();
    int res = dialog.open();
    if (res == Window.OK && wizard instanceof NewElementWizard) {
      createdElement = ((NewElementWizard) wizard).getCreatedElement();
    }

    notifyResult(res == Window.OK);
  } catch (CoreException e) {
    String title = NewWizardMessages.AbstractOpenWizardAction_createerror_title;
    String message = NewWizardMessages.AbstractOpenWizardAction_createerror_message;
    ExceptionHandler.handle(e, localShell, title, message);
  }
}
 
Example 16
Project: PDFReporter-Studio   File: ParameterCellEditor.java   View Source Code Vote up 5 votes
@Override
protected Object openDialogBox(Control cellEditorWindow) {
	ParameterEditor wizard = new ParameterEditor();
	wizard.setValue((ParameterDTO) getValue());
	wizard.setExpressionContext(expContext);
	WizardDialog dialog = new WizardDialog(cellEditorWindow.getShell(), wizard);
	dialog.create();
	if (dialog.open() == Dialog.OK) {
		return wizard.getValue();
	}
	return null;
}
 
Example 17
Project: PDFReporter-Studio   File: JasperReportsSamplesProjectAction.java   View Source Code Vote up 5 votes
@Override
public void run() {
	SampleNewWizard wizard = new SampleNewWizard();
	wizard.init(PlatformUI.getWorkbench(), StructuredSelection.EMPTY);
	WizardDialog dialogToOpen = new WizardDialog(UIUtils.getShell(), wizard);
	dialogToOpen.create();
	dialogToOpen.open();
}
 
Example 18
Project: gemoc-studio-modeldebugging   File: CreateEcoreProposal.java   View Source Code Vote up 4 votes
@Override
public String getReplacementText() {
	
	IWizardDescriptor descriptor = WizardFinder.findNewWizardDescriptor("org.eclipse.ecoretools.emf.design.wizardID");

	// Then if we have a wizard, open it.
	if (descriptor != null) {
		// add a listener to capture the creation of the resulting project
		NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
		ResourcesPlugin.getWorkspace().addResourceChangeListener(
				workspaceListener);
		try {
			IWizard wizard = descriptor.createWizard();
			// this wizard need some dedicated initialization
			String newProjectName = (packageName+"."+languageName+".model").toLowerCase();
			((EcoreModelerWizard) wizard).setInitialProjectName(newProjectName);
			((EcoreModelerWizard) wizard).init(PlatformUI.getWorkbench(),null);
			WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow().getShell(), wizard);
			wd.create();
			wd.setTitle(wizard.getWindowTitle());

			int res = wd.open();
			if (res == WizardDialog.OK) {
				ResourcesPlugin.getWorkspace().removeResourceChangeListener(workspaceListener);
				ecoreProject = workspaceListener.getLastCreatedProject();
			}
		} catch (CoreException e) {
			Activator.error(e.getMessage(), e);
		} finally {
			// make sure to remove listener in all situations
			ResourcesPlugin.getWorkspace().removeResourceChangeListener(
					workspaceListener);
			if(ecoreProject != null){
				return getCreatedEcoreUri();
			}
		}
	}
	
	return ""; 
}
 
Example 19
Project: gemoc-studio-modeldebugging   File: CreateDomainModelWizardContextAction.java   View Source Code Vote up 4 votes
protected void createNewEMFProject() {
	// launch the appropriate wizard

	// "org.eclipse.emf.importer.ui.EMFProjectWizard" = create EMFProject
	// from existing Ecore file

	IWizardDescriptor descriptor = WizardFinder
			.findNewWizardDescriptor("org.eclipse.ecoretools.emf.design.wizardID");

	// Then if we have a wizard, open it.
	if (descriptor != null) {
		// add a listener to capture the creation of the resulting project
		NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
		ResourcesPlugin.getWorkspace().addResourceChangeListener(
				workspaceListener);
		try {
			IWizard wizard;
			wizard = descriptor.createWizard();
			// this wizard need some dedicated initialization
			((EcoreModelerWizard) wizard)
					.setInitialProjectName(MelangeXDSMLProjectHelper
							.baseProjectName(gemocLanguageIProject)
							+ ".model");
			((EcoreModelerWizard) wizard).init(PlatformUI.getWorkbench(),
					(IStructuredSelection) PlatformUI.getWorkbench()
							.getActiveWorkbenchWindow()
							.getSelectionService().getSelection());
			// ((EcoreModelWizard)wizard).init(PlatformUI.getWorkbench(),
			// (IStructuredSelection) selection);
			WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow().getShell(), wizard);
			wd.create();
			wd.setTitle(wizard.getWindowTitle());

			int res = wd.open();
			if (res == WizardDialog.OK) {
				ResourcesPlugin.getWorkspace()
						.removeResourceChangeListener(workspaceListener);
				createdProject = workspaceListener
						.getLastCreatedProject();
				// update the project configuration model
				if (createdProject != null) {
					addEMFProjectToConf(createdProject);
				}
			}
		} catch (CoreException e) {
			Activator.error(e.getMessage(), e);
		} finally {
			// make sure to remove listener in all situations
			ResourcesPlugin.getWorkspace().removeResourceChangeListener(
					workspaceListener);
		}
	}
}
 
Example 20
Project: gemoc-studio-modeldebugging   File: CreateAnimatorProjectWizardContextAction.java   View Source Code Vote up 4 votes
protected void createNewODProject() {
	final IWizardDescriptor descriptor = WizardFinder
			.findNewWizardDescriptor(org.eclipse.gemoc.xdsmlframework.extensions.sirius.Activator.PLUGIN_ID
					+ ".wizards.NewGemocDebugRepresentationWizard");
	// Then if we have a wizard, open it.
	if (descriptor != null) {
		NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
		ResourcesPlugin.getWorkspace().addResourceChangeListener(
				workspaceListener);
		try {
			IWorkbenchWizard wizard;
			wizard = descriptor.createWizard();
			((NewGemocDebugRepresentationWizard) wizard).setInitialProjectName(gemocLanguageIProject.getName());
			if(melangeLanguage != null){
				((NewGemocDebugRepresentationWizard) wizard)
				.setInitialLanguageName(melangeLanguage.getName());
			}
			IWorkbench workbench = PlatformUI.getWorkbench();
			wizard.init(workbench, null);
			WizardDialog wd = new WizardDialog(workbench
					.getActiveWorkbenchWindow().getShell(), wizard);
			wd.create();
			wd.setTitle(wizard.getWindowTitle());
			int res = wd.open();
			if (res == WizardDialog.OK) {
				ResourcesPlugin.getWorkspace()
						.removeResourceChangeListener(workspaceListener);
				IProject createdProject = workspaceListener
						.getLastCreatedProject();
				// update the project configuration model
				if (createdProject != null) {
					/* SiriusAnimatorProject animatorProject = Xdsml_baseFactoryImpl.eINSTANCE
							.createSiriusAnimatorProject();
					animatorProject
							.setProjectName(createdProject.getName());
					addOrUpdateProjectToConf(animatorProject); */
					// DVK may be we should update something the melange files ?
				} else {
					Activator
							.error("not able to detect which project was created by wizard",
									null);
				}
			}
		} catch (CoreException e) {
			Activator.error(e.getMessage(), e);
		} finally {
			ResourcesPlugin.getWorkspace().removeResourceChangeListener(
					workspaceListener);
		}
	} else {
		Activator
				.error("wizard with id=org.eclipse.gemoc.xdsmlframework.extensions.sirius.wizards.NewGemocDebugRepresentationWizard not found",
						null);
	}
}
 
Example 21
Project: gemoc-studio-modeldebugging   File: CreateEditorProjectWizardContextAction.java   View Source Code Vote up 4 votes
protected void createNewXTextProject() {
	/*
	 * MessageDialog.openWarning(
	 * PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(),
	 * "Gemoc Language Workbench UI",
	 * "Action not completly implemented yet");
	 */
	// create xtext project from existing ecore model
	// wizard id =
	// org.eclipse.xtext.xtext.ui.wizard.ecore2xtext.NewXtextProjectFromEcoreWizard
	// launch the appropriate wizard

	IWizardDescriptor descriptor = WizardFinder
			.findNewWizardDescriptor("org.eclipse.xtext.xtext.ui.wizard.ecore2xtext.NewXtextProjectFromEcoreWizard");
	// Then if we have a wizard, open it.
	if (descriptor != null) {
		// add a listener to capture the creation of the resulting project
		NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
		ResourcesPlugin.getWorkspace().addResourceChangeListener(
				workspaceListener);
		try {
			IWizard wizard;
			wizard = descriptor.createWizard();
			// this wizard need some dedicated initialization
			// ((EcoreModelerWizard )wizard).init(PlatformUI.getWorkbench(),
			// (IStructuredSelection)
			// PlatformUI.getWorkbench().getActiveWorkbenchWindow().getSelectionService().getSelection());
			// ((EcoreModelWizard)wizard).init(PlatformUI.getWorkbench(),
			// (IStructuredSelection) selection);
			WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow().getShell(), wizard);
			wd.create();
			wd.setTitle(wizard.getWindowTitle());

			int res = wd.open();
			if (res == WizardDialog.OK) {
				ResourcesPlugin.getWorkspace()
						.removeResourceChangeListener(workspaceListener);
				ArrayList<IProject> newlyCreatedProjects = workspaceListener
						.getNewlyCreatedProjects();
				// find the created project with xtext files in it
				FileFinderVisitor fileFinder = new FileFinderVisitor(
						"xtext");
				for (Iterator<IProject> iterator = newlyCreatedProjects
						.iterator(); iterator.hasNext();) {
					IProject iProject = (IProject) iterator.next();
					iProject.accept(fileFinder);
					if (fileFinder.getFile() != null) {
						createdProject = iProject;
						break;
					}
				}
				// update the project configuration model
				if (createdProject != null) {						
					// maybe we should do something in the melange file ?
				} else {
					Activator
							.error("not able to detect which project was created by wizard",
									null);
				}
			}
		} catch (CoreException e) {
			Activator.error(e.getMessage(), e);
		} finally {
			// make sure to remove listener in all situations
			ResourcesPlugin.getWorkspace().removeResourceChangeListener(
					workspaceListener);
		}
	} else {
		Activator
				.error("wizard with id=org.eclipse.xtext.xtext.ui.wizard.ecore2xtext.NewXtextProjectFromEcoreWizard not found",
						null);
	}
}
 
Example 22
Project: gemoc-studio-modeldebugging   File: CreateEditorProjectWizardContextAction.java   View Source Code Vote up 4 votes
protected void createNewODProject() {
	final IWizardDescriptor descriptor = WizardFinder
			.findNewWizardDescriptor("org.eclipse.gemoc.xdsmlframework.extensions.sirius.wizards.NewGemocSiriusProjectWizard");
	// Then if we have a wizard, open it.
	if (descriptor != null) {
		NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
		ResourcesPlugin.getWorkspace().addResourceChangeListener(
				workspaceListener);
		try {
			IWorkbenchWizard wizard;
			wizard = descriptor.createWizard();
			 ((NewGemocSiriusProjectWizard)wizard).setInitialProjectName(MelangeXDSMLProjectHelper
					                                                .baseProjectName(gemocLanguageIProject));

			IWorkbench workbench = PlatformUI.getWorkbench();
			wizard.init(workbench, null);
			WizardDialog wd = new WizardDialog(workbench
					.getActiveWorkbenchWindow().getShell(), wizard);
			wd.create();
			wd.setTitle(wizard.getWindowTitle());

			int res = wd.open();
			if (res == WizardDialog.OK) {
				ResourcesPlugin.getWorkspace()
						.removeResourceChangeListener(workspaceListener);
				createdProject = workspaceListener
						.getLastCreatedProject();
				// update the project configuration model
				if (createdProject != null) {
					// maybe we should do something in the melange file ?
				} else {
					Activator
							.error("not able to detect which project was created by wizard",
									null);
				}
			}
		} catch (CoreException e) {
			Activator.error(e.getMessage(), e);
		} finally {
			ResourcesPlugin.getWorkspace().removeResourceChangeListener(
					workspaceListener);
		}
	} else {
		Activator
				.error("wizard with id=org.eclipse.sirius.ui.specificationproject.wizard not found",
						null);
	}
}
 
Example 23
Project: ModelDebugging   File: CreateDomainModelWizardContextAction.java   View Source Code Vote up 4 votes
protected void createNewEMFProject() {
	// launch the appropriate wizard

	// "org.eclipse.emf.importer.ui.EMFProjectWizard" = create EMFProject
	// from existing Ecore file

	IWizardDescriptor descriptor = WizardFinder
			.findNewWizardDescriptor("org.eclipse.ecoretools.emf.design.wizardID");

	// Then if we have a wizard, open it.
	if (descriptor != null) {
		// add a listener to capture the creation of the resulting project
		NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
		ResourcesPlugin.getWorkspace().addResourceChangeListener(
				workspaceListener);
		try {
			IWizard wizard;
			wizard = descriptor.createWizard();
			// this wizard need some dedicated initialization
			((EcoreModelerWizard) wizard)
					.setInitialProjectName(MelangeXDSMLProjectHelper
							.baseProjectName(gemocLanguageIProject)
							+ ".model");
			((EcoreModelerWizard) wizard).init(PlatformUI.getWorkbench(),
					(IStructuredSelection) PlatformUI.getWorkbench()
							.getActiveWorkbenchWindow()
							.getSelectionService().getSelection());
			// ((EcoreModelWizard)wizard).init(PlatformUI.getWorkbench(),
			// (IStructuredSelection) selection);
			WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench()
					.getActiveWorkbenchWindow().getShell(), wizard);
			wd.create();
			wd.setTitle(wizard.getWindowTitle());

			int res = wd.open();
			if (res == WizardDialog.OK) {
				ResourcesPlugin.getWorkspace()
						.removeResourceChangeListener(workspaceListener);
				createdProject = workspaceListener
						.getLastCreatedProject();
				// update the project configuration model
				if (createdProject != null) {
					addEMFProjectToConf(createdProject);
				}
			}
		} catch (CoreException e) {
			Activator.error(e.getMessage(), e);
		} finally {
			// make sure to remove listener in all situations
			ResourcesPlugin.getWorkspace().removeResourceChangeListener(
					workspaceListener);
		}
	}
}
 
Example 24
Project: ModelDebugging   File: CreateAnimatorProjectWizardContextAction.java   View Source Code Vote up 4 votes
protected void createNewODProject() {
	final IWizardDescriptor descriptor = WizardFinder
			.findNewWizardDescriptor(org.eclipse.gemoc.xdsmlframework.extensions.sirius.Activator.PLUGIN_ID
					+ ".wizards.NewGemocDebugRepresentationWizard");
	// Then if we have a wizard, open it.
	if (descriptor != null) {
		NewProjectWorkspaceListener workspaceListener = new NewProjectWorkspaceListener();
		ResourcesPlugin.getWorkspace().addResourceChangeListener(
				workspaceListener);
		try {
			IWorkbenchWizard wizard;
			wizard = descriptor.createWizard();
			((NewGemocDebugRepresentationWizard) wizard).setInitialProjectName(gemocLanguageIProject.getName());
			if(melangeLanguage != null){
				((NewGemocDebugRepresentationWizard) wizard)
				.setInitialLanguageName(melangeLanguage.getName());
			}
			IWorkbench workbench = PlatformUI.getWorkbench();
			wizard.init(workbench, null);
			WizardDialog wd = new WizardDialog(workbench
					.getActiveWorkbenchWindow().getShell(), wizard);
			wd.create();
			wd.setTitle(wizard.getWindowTitle());
			int res = wd.open();
			if (res == WizardDialog.OK) {
				ResourcesPlugin.getWorkspace()
						.removeResourceChangeListener(workspaceListener);
				IProject createdProject = workspaceListener
						.getLastCreatedProject();
				// update the project configuration model
				if (createdProject != null) {
					/* SiriusAnimatorProject animatorProject = Xdsml_baseFactoryImpl.eINSTANCE
							.createSiriusAnimatorProject();
					animatorProject
							.setProjectName(createdProject.getName());
					addOrUpdateProjectToConf(animatorProject); */
					// DVK may be we should update something the melange files ?
				} else {
					Activator
							.error("not able to detect which project was created by wizard",
									null);
				}
			}
		} catch (CoreException e) {
			Activator.error(e.getMessage(), e);
		} finally {
			ResourcesPlugin.getWorkspace().removeResourceChangeListener(
					workspaceListener);
		}
	} else {
		Activator
				.error("wizard with id=org.eclipse.gemoc.xdsmlframework.extensions.sirius.wizards.NewGemocDebugRepresentationWizard not found",
						null);
	}
}
 
Example 25
Project: PDFReporter-Studio   File: CreatePercentageCommand.java   View Source Code Vote up 4 votes
/**
 * Creates the object.
 */
@Override
protected void createObject() {
	if (jrElement == null) {
		JRCloneable field = null;
		ResetTypeEnum rtype = ResetTypeEnum.REPORT;
		JRGroup group = null;

		PercentageWizard wizard = new PercentageWizard();
		WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
		wizard.init(jasperDesign);
		dialog.create();
		if (dialog.open() == Dialog.OK) {
			field = wizard.getField();
			rtype = wizard.getResetType();
			group = wizard.getGroup();

			super.createObject();
			if (field != null) {
				JRDesignTextField tf = (JRDesignTextField) jrElement;
				
				
				// Create the expressions based of the reset type selected by the user...
				JRDesignVariable variable = null;
				try {
					if (field instanceof JRField)
					{
						variable = createVariable(((JRField) field).getName(),
								((JRField) field).getValueClassName(), rtype, group);
						
					}
					else if (field instanceof JRVariable)
					{
						variable = createVariable(((JRVariable) field).getName(),
								((JRVariable) field).getValueClassName(), rtype, group);
					}
					
					if (variable == null)
					{
						return; // we don't want to continue in this case...
					}
					
					jasperDesign.addVariable(variable);
					
				} catch (Exception e) {
					UIUtils.showError(e);
					
				}
				
				JRDesignExpression expression = new JRDesignExpression();
				if (field instanceof JRField)
					expression.setText(createExpression(((JRField) field).getName(), variable.getName(), ((JRField) field).getValueClass()));
				if (field instanceof JRVariable)
					expression.setText(createExpression(((JRVariable) field).getName(), variable.getName(), ((JRVariable) field).getValueClass()));
				tf.setExpression(expression);
				tf.setPattern("#,##0.00%");
				
				// Set the evaluation time of this textfield to AUTO
				tf.setEvaluationTime( net.sf.jasperreports.engine.type.EvaluationTimeEnum.AUTO);

				
			}
		}
	}
}