Skip to content

Instantly share code, notes, and snippets.

@juniorz
Created July 18, 2011 00:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save juniorz/1088269 to your computer and use it in GitHub Desktop.
Save juniorz/1088269 to your computer and use it in GitHub Desktop.
Open Xtext Project Wizard Action
package org.eclipse.amalgam.tutorials.cheatsheets.xtext.actions;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.cheatsheets.ICheatSheetAction;
import org.eclipse.ui.cheatsheets.ICheatSheetManager;
import org.eclipse.xtext.xtext.ui.wizard.project.NewXtextProjectWizard;
import org.eclipse.xtext.xtext.ui.wizard.project.XtextProjectCreator;
public class OpenXtextProjectWizard extends Action implements ICheatSheetAction {
@Override
public void run(String[] params, ICheatSheetManager manager) {
super.run();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
NewXtextProjectWizard wizard = new NewXtextProjectWizard(new XtextProjectCreator());
wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
WizardDialog dialog = new WizardDialog(shell, wizard);
dialog.create();
dialog.open();
notifyResult(dialog.getReturnCode() == Dialog.OK);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment