本文整理匯總了Java中org.eclipse.ui.IWorkbenchWizard類的典型用法代碼示例。如果您正苦於以下問題:Java IWorkbenchWizard類的具體用法?Java IWorkbenchWizard怎麽用?Java IWorkbenchWizard使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
IWorkbenchWizard類屬於org.eclipse.ui包,在下文中一共展示了IWorkbenchWizard類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: openWizard
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
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();
}
}
示例2: createNewPackageQuery
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
public ICreateTargetQuery createNewPackageQuery() {
return new ICreateTargetQuery() {
public Object getCreatedTarget(Object selection) {
IWorkbenchWizard packageCreationWizard= new NewPackageCreationWizard();
IWizardPage[] pages= openNewElementWizard(packageCreationWizard, getShell(), selection);
NewPackageWizardPage page= (NewPackageWizardPage) pages[0];
return page.getNewPackageFragment();
}
public String getNewButtonLabel() {
return ReorgMessages.ReorgMoveWizard_newPackage;
}
};
}
示例3: execute
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
@Execute
public void execute(@Named("eu.cloudscaleproject.env.common.command.openwizard.param.id") String wizardID) {
IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
.findWizard(wizardID);
if(descriptor != null){
try {
IWorkbenchWizard wizard = (IWorkbenchWizard)descriptor.createWizard();
wizard.init(PlatformUI.getWorkbench(), null);
WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
wd.setTitle(wizard.getWindowTitle());
wd.open();
} catch (CoreException e) {
e.printStackTrace();
}
}
}
示例4: execute
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
@Execute
public void execute(CommandExecutor commandExecutor) {
IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
.findWizard("eu.cloudscaleproject.env.product.wizard.newproject");
if(descriptor != null){
try {
IWorkbenchWizard wizard = (IWorkbenchWizard)descriptor.createWizard();
wizard.init(PlatformUI.getWorkbench(), null);
WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
wd.setTitle(wizard.getWindowTitle());
wd.open();
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
示例5: execute
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
@Execute
public void execute(CommandExecutor commandExecutor) {
IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry()
.findWizard("eu.cloudscaleproject.env.product.wizard.exampleproject");
if(descriptor != null){
try {
IWorkbenchWizard wizard = (IWorkbenchWizard)descriptor.createWizard();
wizard.init(PlatformUI.getWorkbench(), null);
WizardDialog wd = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
wd.setTitle(wizard.getWindowTitle());
wd.open();
} catch (CoreException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
示例6: run
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
/**
* The user has invoked this action.
*/
public void run() {
Shell shell= VerilogPlugin.getActiveWorkbenchShell();
try {
Wizard wizard= createWizard();
if (wizard instanceof IWorkbenchWizard) {
((IWorkbenchWizard)wizard).init(getWorkbench(), getCurrentSelection());
}
WizardDialog dialog= new WizardDialog(shell, wizard);
dialog.create();
int res= dialog.open();
notifyResult(res == Window.OK);
} catch (CoreException e) {
MessageUI.error(e);
}
}
示例7: createTheProject
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
@Override
protected IProject createTheProject() throws Exception {
final IWorkbench theWorkbench = get_the_workbench();
final IWizardRegistry theNewWizardRegistry = theWorkbench.getNewWizardRegistry();
final IWizardDescriptor wizardDescriptor = theNewWizardRegistry.findWizard(Activator.EXAMPLE_WIZARD_ID);
final IWorkbenchWizard theWizard = wizardDescriptor.createWizard();
theWizard.init(theWorkbench, StructuredSelection.EMPTY);
final WizardDialog theDialog = new WizardDialog(null, theWizard);
theDialog.setBlockOnOpen(false);
theDialog.open();
select_the_default_button(theDialog);
return get_the_project(getTheProjectName());
}
示例8: getInstanceWizard
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
/**
* Gets an editor instance creation wizard for this editor type.
*
* @param initialSelection
* The selection used to initialize the wizard.
* @return The editor creation wizard.
* @throws MMINTException
* if the editor creation wizard couln't be found or
* initialized.
* @generated NOT
*/
protected IWorkbenchWizard getInstanceWizard(IStructuredSelection initialSelection) throws MMINTException {
Model modelType = MIDTypeRegistry.<Model>getType(getModelUri());
IWorkbenchWizard wizard;
if (getWizardId() == null) {
EClass rootEClass = (EClass) modelType.getEMFTypeRoot().getEClassifiers().get(0);
wizard = new DynamicModelWizard(rootEClass);
}
else {
IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(getWizardId());
if (descriptor == null) {
throw new MMINTException("Wizard " + getId() + " not found");
}
try {
wizard = descriptor.createWizard();
}
catch (CoreException e) {
throw new MMINTException("Error creating the wizard", e);
}
}
wizard.init(PlatformUI.getWorkbench(), initialSelection);
return wizard;
}
示例9: createCustomInstanceWizard
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
/**
* Creates a custom editor instance creation wizard dialog for this editor
* type.
*
* @param wizard
* The editor creation wizard.
* @return The editor creation wizard dialog.
* @generated NOT
*/
protected EditorCreationWizardDialog createCustomInstanceWizard(IWorkbenchWizard wizard) {
EditorCreationWizardDialog wizDialog;
String wizardDialogClassName = getWizardDialogClass();
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
try {
wizDialog = (EditorCreationWizardDialog)
MIDTypeRegistry.getTypeBundle(getUri()).
loadClass(wizardDialogClassName).
getConstructor(Shell.class, IWizard.class).
newInstance(shell, wizard);
}
catch (Exception e) {
MMINTException.print(IStatus.WARNING, "Custom editor creation wizard not found: " + wizardDialogClassName + " , using default as fallback", e);
wizDialog = new EditorCreationWizardDialog(shell, wizard);
}
return wizDialog;
}
示例10: invokeInstanceWizard
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
/**
* @generated NOT
*/
public EditorCreationWizardDialog invokeInstanceWizard(IStructuredSelection initialSelection) throws MMINTException {
MMINTException.mustBeType(this);
IWorkbenchWizard wizard = getInstanceWizard(initialSelection);
EditorCreationWizardDialog wizDialog;
if (getWizardDialogClass() == null) {
Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
wizDialog = new EditorCreationWizardDialog(shell, wizard);
}
else {
wizDialog = createCustomInstanceWizard(wizard);
}
wizDialog.setTitle(wizard.getWindowTitle());
if (wizDialog.open() == Window.CANCEL) {
return null;
}
return wizDialog;
}
示例11: run
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
@Override
public void run() {
String wizardId = getWizardId();
try {
IWorkbenchWizard wizard = PlatformUI.getWorkbench()
.getNewWizardRegistry()
.findWizard(wizardId)
.createWizard();
if (wizard instanceof INewModelWizard) {
INewModelWizard modelWizard = (INewModelWizard) wizard;
modelWizard.setCategory(category);
}
WizardDialog dialog = new WizardDialog(UI.shell(), wizard);
dialog.open();
Navigator.refresh(parent);
} catch (final CoreException e) {
log.error("Open model wizard failed", e);
}
}
示例12: openProcessWizard
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
private void openProcessWizard() {
Flow flow = getModel();
try {
String wizardId = "wizards.new.process";
IWorkbenchWizard w = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(wizardId).createWizard();
if (!(w instanceof ProcessWizard))
return;
ProcessWizard wizard = (ProcessWizard) w;
wizard.setRefFlow(flow);
WizardDialog dialog = new WizardDialog(UI.shell(), wizard);
if (dialog.open() == Window.OK) {
Navigator.refresh(Navigator.findElement(ModelType.PROCESS));
}
} catch (Exception e) {
Logger log = LoggerFactory.getLogger(getClass());
log.error("failed to open process dialog from flow " + flow, e);
}
}
示例13: doIt
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
private void doIt() {
try {
String wizardId = "wizards.new.productsystem";
IWorkbenchWizard wizard = PlatformUI.getWorkbench()
.getNewWizardRegistry().findWizard(wizardId).createWizard();
if (!(wizard instanceof ProductSystemWizard))
return;
ProductSystemWizard systemWizard = (ProductSystemWizard) wizard;
systemWizard.setProcess(process);
WizardDialog dialog = new WizardDialog(UI.shell(), wizard);
if (dialog.open() == Window.OK) {
Navigator.refresh(Navigator.findElement(ModelType.PRODUCT_SYSTEM));
}
} catch (Exception e) {
Logger log = LoggerFactory.getLogger(getClass());
log.error("failed to open product system dialog for process", e);
}
}
示例14: openWizardForModule
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
/**
* Opens the wizard with the given id and passes it the selection.
*
* @param wizardId
* The wizard id of the eclipse newWizard registry
* @param selection
* The selection
*/
private void openWizardForModule(String wizardId, IStructuredSelection selection, boolean nested) {
// Retrieve wizard from registry
IWizardDescriptor wizardDescriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(wizardId);
if (wizardDescriptor == null) {
return;
}
try {
IWorkbenchWizard wizard = wizardDescriptor.createWizard();
// Inject wizard members
injector.injectMembers(wizard);
// Create and open a new wizard dialog
WizardDialog wizardDialog = new WizardDialog(UIUtils.getShell(), wizard);
// If the wizard supports it, enable in module option
if (wizard instanceof N4JSNewClassifierWizard<?>) {
((N4JSNewClassifierWizard<?>) wizard).init(PlatformUI.getWorkbench(), selection, nested);
} else {
// Otherwise just pass it the initial selection
wizard.init(PlatformUI.getWorkbench(), selection);
}
// wizardDialog.setTitle(wizard.getWindowTitle());
wizardDialog.open();
} catch (CoreException e) {
/** Failed to create the wizard */
Shell workbenchShell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
MessageDialog.open(MessageDialog.ERROR, workbenchShell, "Failed to launch wizard",
String.format("Failed to launch wizard %s", wizardId), SWT.SHEET);
return;
}
}
示例15: runWithStructuredSelection
import org.eclipse.ui.IWorkbenchWizard; //導入依賴的package包/類
@Override
public void runWithStructuredSelection(IStructuredSelection selection) {
IWorkbenchWizard wizard = getWizard(selection);
wizard.init(getWorkbench(), selection);
WizardDialog wizardDialog = new WizardDialog(getActiveShell(), wizard);
wizardDialog.setBlockOnOpen(true);
wizardDialog.open();
}