Java Code Examples for org.eclipse.jface.wizard.WizardDialog.OK

The following are Jave code examples for showing how to use OK 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: convertigo-eclipse   File: SetupAction.java   View Source Code Vote up 6 votes
public static boolean runSetup() {
	Display display = Display.getDefault();
	WizardDialog wizardDialog = new WizardDialog(display.getActiveShell(), new SetupWizard()) {
		
		@Override
		protected void configureShell(Shell shell) {
			super.configureShell(shell);
			shell.setSize(730, 700);
			setReturnCode(WizardDialog.CANCEL);
		}
		
	};
	
	int ret = wizardDialog.open(); 
	
	return ret == WizardDialog.OK;
}
 
Example 2
Project: subclipse   File: BranchTagAction.java   View Source Code Vote up 6 votes
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (action != null && !action.isEnabled()) { 
    	action.setEnabled(true);
    } 
    else {
     IResource[] resources = getSelectedResources();
    	BranchTagWizard wizard = new BranchTagWizard(resources);
    	SizePersistedWizardDialog dialog = new SizePersistedWizardDialog(getShell(), wizard, "BranchTag"); //$NON-NLS-1$
    	wizard.setParentDialog(dialog);
    	if (dialog.open() == WizardDialog.OK) {	
    		SVNUrl[] sourceUrls = wizard.getUrls();
    		SVNUrl destinationUrl = wizard.getToUrl();
    		String message = wizard.getComment();
    		boolean createOnServer = wizard.isCreateOnServer();
         BranchTagOperation branchTagOperation = new BranchTagOperation(getTargetPart(), getSelectedResources(), sourceUrls, destinationUrl, createOnServer, wizard.getRevision(), message);
         branchTagOperation.setMakeParents(wizard.isMakeParents());
         branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
         branchTagOperation.setNewAlias(wizard.getNewAlias());
         branchTagOperation.switchAfterTagBranchOperation(wizard.isSwitchAfterBranchTag());
         branchTagOperation.setSvnExternals(wizard.getSvnExternals());
         branchTagOperation.run();        		
    	}
    }
}
 
Example 3
Project: APICloud-Studio   File: BranchTagAction.java   View Source Code Vote up 6 votes
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
    if (action != null && !action.isEnabled()) { 
    	action.setEnabled(true);
    } 
    else {
     IResource[] resources = getSelectedResources();
    	BranchTagWizard wizard = new BranchTagWizard(resources);
    	SizePersistedWizardDialog dialog = new SizePersistedWizardDialog(getShell(), wizard, "BranchTag"); //$NON-NLS-1$
    	wizard.setParentDialog(dialog);
    	if (dialog.open() == WizardDialog.OK) {	
    		SVNUrl[] sourceUrls = wizard.getUrls();
    		SVNUrl destinationUrl = wizard.getToUrl();
    		String message = wizard.getComment();
    		boolean createOnServer = wizard.isCreateOnServer();
         BranchTagOperation branchTagOperation = new BranchTagOperation(getTargetPart(), getSelectedResources(), sourceUrls, destinationUrl, createOnServer, wizard.getRevision(), message);
         branchTagOperation.setMakeParents(wizard.isMakeParents());
         branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
         branchTagOperation.setNewAlias(wizard.getNewAlias());
         branchTagOperation.switchAfterTagBranchOperation(wizard.isSwitchAfterBranchTag());
         branchTagOperation.setSvnExternals(wizard.getSvnExternals());
         branchTagOperation.run();        		
    	}
    }
}
 
Example 4
Project: gemoc-studio-modeldebugging   File: CreateDSAWizardContextActionDSA.java   View Source Code Vote up 5 votes
public void selectExistingDSAProject(){
	// launch the appropriate wizard
	SelectDSAIProjectDialog dialog = new SelectDSAIProjectDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
	int res = dialog.open();
	if(res == WizardDialog.OK){
		// update the project model
		// maybe we should update melange model
	}
}
 
Example 5
Project: gemoc-studio-modeldebugging   File: CreateDomainModelWizardContextAction.java   View Source Code Vote up 5 votes
protected void selectExistingEMFProject() {
	// launch the appropriate wizard
	SelectEMFIProjectDialog dialog = new SelectEMFIProjectDialog(PlatformUI
			.getWorkbench().getActiveWorkbenchWindow().getShell());
	int res = dialog.open();
	if (res == WizardDialog.OK) {
		// update the project model
		addEMFProjectToConf(((IProject) dialog.getResult()[0]));
	}
}
 
Example 6
Project: subclipse   File: RepositoryBranchTagAction.java   View Source Code Vote up 5 votes
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
		ISVNRemoteResource[] resources = getSelectedRemoteResources();
    	BranchTagWizard wizard = new BranchTagWizard(resources);
    	WizardDialog dialog = new SizePersistedWizardDialog(getShell(), wizard, "BranchTag"); //$NON-NLS-1$
    	if (dialog.open() == WizardDialog.OK) {	
    	  SVNUrl[] sourceUrls = wizard.getUrls();
          SVNUrl destinationUrl = wizard.getToUrl();
          String message = wizard.getComment();
          SVNRevision revision = wizard.getRevision();
          boolean makeParents = wizard.isMakeParents();
		  ISVNClientAdapter client = null;
		  try {
			  ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
			  if (repository != null)
			  	client = repository.getSVNClient();
			  if (client == null)
				client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
			  RepositoryBranchTagOperation branchTagOperation = new RepositoryBranchTagOperation(getTargetPart(), client, sourceUrls, destinationUrl, revision, message, makeParents);
			  branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
			  branchTagOperation.run();
		  } catch (Exception e) {
			  MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage());
		  } finally {
			  // BranchTagCommand will dispose.
//            SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
		  }
    	}
	}
 
Example 7
Project: PDFReporter-Studio   File: HandleDefaultsAction.java   View Source Code Vote up 5 votes
@Override
public void widgetSelected(SelectionEvent e) {
	JrxmlFilterDialog filterDialog = new JrxmlFilterDialog(UIUtils.getShell(), false);
	if (filterDialog.open() == WizardDialog.OK){
		for(Object result : filterDialog.getResult()){
			IFile file = (IFile) result;
			DefaultManager.INSTANCE.addDefaultFile(file.getRawLocation().toOSString(), false);
		}
		refreshItemList = true;
	}
}
 
Example 8
Project: PDFReporter-Studio   File: HandleDefaultsAction.java   View Source Code Vote up 5 votes
@Override
public void widgetSelected(SelectionEvent e) {
	DefaultNewWizard newWizard = new DefaultNewWizard();
	WizardDialog dialog = new WizardDialog(Display.getDefault().getActiveShell(), newWizard);
	if (dialog.open() == WizardDialog.OK){
		IFile templateFile = newWizard.getReportFile();
		String templatePath = templateFile.getRawLocation().makeAbsolute().toOSString();
		DefaultManager.INSTANCE.addDefaultFile(templatePath, false);
		createMenuElement(templatePath, false);
		refreshItemList = true;
	}
}
 
Example 9
Project: APICloud-Studio   File: RepositoryBranchTagAction.java   View Source Code Vote up 5 votes
protected void execute(IAction action) throws InvocationTargetException, InterruptedException {
		ISVNRemoteResource[] resources = getSelectedRemoteResources();
    	BranchTagWizard wizard = new BranchTagWizard(resources);
    	WizardDialog dialog = new SizePersistedWizardDialog(getShell(), wizard, "BranchTag"); //$NON-NLS-1$
    	if (dialog.open() == WizardDialog.OK) {	
    	  SVNUrl[] sourceUrls = wizard.getUrls();
          SVNUrl destinationUrl = wizard.getToUrl();
          String message = wizard.getComment();
          SVNRevision revision = wizard.getRevision();
          boolean makeParents = wizard.isMakeParents();
		  ISVNClientAdapter client = null;
		  try {
			  ISVNRepositoryLocation repository = SVNProviderPlugin.getPlugin().getRepository(sourceUrls[0].toString());
			  if (repository != null)
			  	client = repository.getSVNClient();
			  if (client == null)
				client = SVNProviderPlugin.getPlugin().getSVNClientManager().getSVNClient();
			  RepositoryBranchTagOperation branchTagOperation = new RepositoryBranchTagOperation(getTargetPart(), client, sourceUrls, destinationUrl, revision, message, makeParents);
			  branchTagOperation.setMultipleTransactions(wizard.isSameStructure());
			  branchTagOperation.run();
		  } catch (Exception e) {
			  MessageDialog.openError(getShell(), Policy.bind("BranchTagDialog.title"), e.getMessage());
		  } finally {
			  // BranchTagCommand will dispose.
//            SVNProviderPlugin.getPlugin().getSVNClientManager().returnSVNClient(client);
		  }
    	}
	}
 
Example 10
Project: ModelDebugging   File: CreateDSAWizardContextActionDSA.java   View Source Code Vote up 5 votes
public void selectExistingDSAProject(){
	// launch the appropriate wizard
	SelectDSAIProjectDialog dialog = new SelectDSAIProjectDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell());
	int res = dialog.open();
	if(res == WizardDialog.OK){
		// update the project model
		// maybe we should update melange model
	}
}
 
Example 11
Project: ModelDebugging   File: CreateDomainModelWizardContextAction.java   View Source Code Vote up 5 votes
protected void selectExistingEMFProject() {
	// launch the appropriate wizard
	SelectEMFIProjectDialog dialog = new SelectEMFIProjectDialog(PlatformUI
			.getWorkbench().getActiveWorkbenchWindow().getShell());
	int res = dialog.open();
	if (res == WizardDialog.OK) {
		// update the project model
		addEMFProjectToConf(((IProject) dialog.getResult()[0]));
	}
}
 
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: 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 18
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 19
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 20
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 21
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);
	}
}