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

The following are Jave code examples for showing how to use setTitle() 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: Open_Source_ECOA_Toolset_AS5   File: ServicesWizardCommand.java   View Source Code Vote up 6 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 2
Project: Open_Source_ECOA_Toolset_AS5   File: CompDefWizardCommand.java   View Source Code Vote up 6 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 3
Project: Open_Source_ECOA_Toolset_AS5   File: InitAssmblWizardCommand.java   View Source Code Vote up 6 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 4
Project: Open_Source_ECOA_Toolset_AS5   File: LogicalSysWizardCommand.java   View Source Code Vote up 6 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 5
Project: Open_Source_ECOA_Toolset_AS5   File: CompImplWizardCommand.java   View Source Code Vote up 6 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 6
Project: Open_Source_ECOA_Toolset_AS5   File: FinalAssmblWizardCommand.java   View Source Code Vote up 6 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 7
Project: Open_Source_ECOA_Toolset_AS5   File: DeployWizardCommand.java   View Source Code Vote up 6 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 8
Project: Open_Source_ECOA_Toolset_AS5   File: TypesWizardCommand.java   View Source Code Vote up 6 votes
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(ID);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(ID);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(ID);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
	return null;
}
 
Example 9
Project: Hydrograph   File: SubJobUtility.java   View Source Code Vote up 6 votes
/**
 * Open sub graph save dialog.
 * 
 * @return the i file
 */
public IFile openSubJobSaveDialog() {
	IFile iFile = null;
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(Messages.JOB_WIZARD_ID);
	if (descriptor != null) {
		IWizard wizard = null;
		try {
			wizard = descriptor.createWizard();
		} catch (CoreException coreException) {
			logger.error("Error while opening create job wizard", coreException);
		}
		WizardDialog wizardDialog = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
		wizardDialog.setTitle(wizard.getWindowTitle());
		wizardDialog.open();
		JobCreationPage jobCreationPage = (JobCreationPage) wizardDialog.getSelectedPage();
		iFile = jobCreationPage.getNewFile();
	}
	return iFile;
}
 
Example 10
Project: statecharts   File: OpenExampleIntroAction.java   View Source Code Vote up 6 votes
public void openWizard(String id) {
	IWizardDescriptor descriptor = PlatformUI.getWorkbench()
			.getNewWizardRegistry().findWizard(id);
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
				.findWizard(id);
	}
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry()
				.findWizard(id);
	}
	try {
		if (descriptor != null) {
			IWizard wizard = descriptor.createWizard();
			WizardDialog wd = new WizardDialog(Display.getDefault()
					.getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (CoreException e) {
		e.printStackTrace();
	}
}
 
Example 11
Project: gama   File: GamaNavigatorMenu.java   View Source Code Vote up 6 votes
public static void openWizard(final String id, final IStructuredSelection selection) {
	// First see if this is a "new wizard".
	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(id);
	// If not check if it is an "import wizard".
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(id);
	}
	// Or maybe an export wizard
	if (descriptor == null) {
		descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(id);
	}
	try {
		// Then if we have a wizard, open it.
		if (descriptor != null) {
			final IWorkbenchWizard wizard = descriptor.createWizard();
			wizard.init(PlatformUI.getWorkbench(), selection);
			final WizardDialog wd = new WizardDialog(WorkbenchHelper.getDisplay().getActiveShell(), wizard);
			wd.setTitle(wizard.getWindowTitle());
			wd.open();
		}
	} catch (final CoreException e) {
		e.printStackTrace();
	}
}
 
Example 12
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 13
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 14
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 15
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 16
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 17
Project: egradle   File: EGradleNewProjectWizard.java   View Source Code Vote up 4 votes
private void importCreatedProject(File targetFolder) throws CoreException {
	/* open import wizard with correct setup */

	IWizardDescriptor descriptor = PlatformUI.getWorkbench().getImportWizardRegistry()
			.findWizard(EGradleRootProjectImportWizard.ID);
	if (descriptor == null) {
		throw new IllegalStateException("Import was not possible, because of missing wizard!");
	}

	IWizard wizard = descriptor.createWizard();
	if (!(wizard instanceof EGradleRootProjectImportWizard)) {
		throw new IllegalStateException("Not a root project wizard but:" + wizard);
	}

	outputToSystemConsole("- start import for generated project");

	EGradleRootProjectImportWizard piw = (EGradleRootProjectImportWizard) wizard;
	piw.setCustomRootProjectpath(targetFolder.getAbsolutePath());
	piw.setCustomJavaHome(context.getJavaHome());
	piw.setImportMode(RootProjectConfigMode.NEW_PROJECT_WIZARD);

	WizardDialog wd = new WizardDialog(getShell(), piw);
	wd.setTitle("Import generated gradle project");

	EclipseUtil.safeAsyncExec(new Runnable() {

		@Override
		public void run() {
			boolean resultOkay = false;
			if (context.isSupportingHeadlessImport()) {
				/* headless usage of import wizard:*/
				piw.addPages();
				piw.createPageControls(new Shell());
				piw.setContainer(getContainer());
				
				resultOkay = piw.performFinish();
				if (resultOkay) {
					outputToSystemConsole("[DONE]");
				} else {
					outputToSystemConsole("[CANCELED]");
				}
				return;

			}else{
				int result = wd.open();
				if (MessageDialog.OK == result) {
					resultOkay = true;
				}
			}


			if (resultOkay) {
				outputToSystemConsole("[DONE]");
			} else {
				outputToSystemConsole("[CANCELED]");
			}
		}
	});
}
 
Example 18
Project: 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: 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: 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: 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: 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);
	}
}