Java 类org.eclipse.ui.IWorkbenchWizard 实例源码

项目:gama    文件:GamaNavigatorMenu.java   
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();
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:CreateTargetQueries.java   
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;
        }
    };
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CreateTargetQueries.java   
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;
        }
    };
}
项目:Environment    文件:OpenWizardHandler.java   
@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();
        }
    }

}
项目:Environment    文件:CreateNewProjectHadler.java   
@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();
        }
    }
}
项目:Environment    文件:CreateNewExampleProjectHandler.java   
@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();
        }
    }
}
项目:vdt-plugin    文件:AbstractOpenWizardAction.java   
/**
 * 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);
    }
}
项目:NIEM-Modeling-Tool    文件:CreatesAnExampleProject.java   
@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());
}
项目:MMINT    文件:EditorImpl.java   
/**
 * 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;
}
项目:MMINT    文件:EditorImpl.java   
/**
 * 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;
}
项目:MMINT    文件:EditorImpl.java   
/**
 * @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;
}
项目:olca-app    文件:CreateModelAction.java   
@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);
    }
}
项目:olca-app    文件:FlowInfoPage.java   
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);
    }
}
项目:olca-app    文件:SystemCreation.java   
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);
    }
}
项目:n4js    文件:CreateNewN4JSElementInModuleHandler.java   
/**
 * 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;
    }

}
项目:eZooKeeper    文件:BaseWizardAction.java   
@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();
}
项目:neoscada    文件:WriteAttributesOperationAction.java   
@Override
public void run ( final IAction action )
{
    if ( this.selection == null )
    {
        return;
    }

    final IWorkbenchWizard wiz = new WriteAttributesOperationWizard ();
    wiz.init ( this.site.getWorkbenchWindow ().getWorkbench (), this.selection );

    // Embed the wizard into a dialog
    final WizardDialog dialog = new WizardDialog ( this.site.getShell (), wiz );
    dialog.open ();
}
项目:neoscada    文件:WriteOperationAction.java   
@Override
public void run ( final IAction action )
{
    if ( this.selection == null )
    {
        return;
    }

    final IWorkbenchWizard wiz = new WriteOperationWizard ();
    wiz.init ( this.site.getWorkbenchWindow ().getWorkbench (), this.selection );

    // Embed the wizard into a dialog
    final WizardDialog dialog = new WizardDialog ( this.site.getShell (), wiz );
    dialog.open ();
}
项目:PDFReporter-Studio    文件:JSSWizardHandler.java   
@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    String wizardId = getWizardIdParameterId();

    IWorkbenchWindow activeWindow = HandlerUtil.getActiveWorkbenchWindowChecked(event);

    if (wizardId == null) {
        IAction wizardAction = createWizardChooserDialogAction(activeWindow);
        wizardAction.run();
    } else {

        IWizardRegistry wizardRegistry = getWizardRegistry();
        IWizardDescriptor wizardDescriptor = wizardRegistry.findWizard(wizardId);
        if (wizardDescriptor == null) {
            throw new ExecutionException("unknown wizard: " + wizardId); //$NON-NLS-1$
        }

        try {
            IWorkbenchWizard wizard = wizardDescriptor.createWizard();
            ISelection selection = activeWindow.getSelectionService().getSelection();
            IStructuredSelection ss = selection instanceof IStructuredSelection ? (IStructuredSelection) selection
                    : StructuredSelection.EMPTY;
            wizard.init(PlatformUI.getWorkbench(), ss);

            if (wizardDescriptor.canFinishEarly() && !wizardDescriptor.hasPages()) {
                wizard.performFinish();
                return null;
            }

            Shell parent = activeWindow.getShell();
            createAndOpenWizardDialog(parent, wizard);

        } catch (CoreException ex) {
            throw new ExecutionException("error creating wizard", ex); //$NON-NLS-1$
        }

    }

    return null;
}
项目:OpenSPIFe    文件:OpenWizardDialogAction.java   
@Override
public void run() {
    IWorkbenchWizard createWizard;
    try {
        createWizard = descriptor.createWizard();
        IWorkbench workbench = workbenchWindow.getWorkbench();
        IStructuredSelection sselection = StructuredSelection.EMPTY;
        if( selection instanceof StructuredSelection ){
            sselection = (StructuredSelection)selection;    
        }else {
            List<EnsembleCommonNavigator> navigators = EnsembleCommonNavigator.getExistingInstances(EnsembleCommonNavigator.class);
            for (EnsembleCommonNavigator navigator : navigators) {
                IWorkbenchPartSite site = navigator.getSite();
                if(site != null) {
                    ISelectionProvider selectionProvider = site.getSelectionProvider();
                    ISelection potentialSelection = selectionProvider.getSelection();
                    if(potentialSelection instanceof IStructuredSelection) {
                        sselection = (IStructuredSelection) potentialSelection;
                        break;
                    }

                }
            }
        }
        createWizard.init(workbench, sselection);

    } catch (CoreException e) {
        MessageDialog.openError(null, "Error creating wizard", e.getMessage());
        return;
    }
    WizardDialog dialog = new WizardDialog(null, createWizard);
    dialog.open();
}
项目:Eclipse-Postfix-Code-Completion    文件:CreateTargetQueries.java   
private IWizardPage[] openNewElementWizard(IWorkbenchWizard wizard, Shell shell, Object selection) {
    wizard.init(JavaPlugin.getDefault().getWorkbench(), new StructuredSelection(selection));

    WizardDialog dialog= new WizardDialog(shell, wizard);
    PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
    dialog.create();
    dialog.open();
    IWizardPage[] pages= wizard.getPages();
    return pages;
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CreateTargetQueries.java   
private IWizardPage[] openNewElementWizard(IWorkbenchWizard wizard, Shell shell, Object selection) {
    wizard.init(JavaPlugin.getDefault().getWorkbench(), new StructuredSelection(selection));

    WizardDialog dialog= new WizardDialog(shell, wizard);
    PixelConverter converter= new PixelConverter(JFaceResources.getDialogFont());
    dialog.setMinimumPageSize(converter.convertWidthInCharsToPixels(70), converter.convertHeightInCharsToPixels(20));
    dialog.create();
    dialog.open();
    IWizardPage[] pages= wizard.getPages();
    return pages;
}
项目:Archie-Smart-IDE    文件:EclipsePlatformUtils.java   
/*******************************************************
 * Initializes and opens an already created wizard object
 * 
 * @param wizard
 *            The wizard desired to be opened
 * @throws IllegalArgumentException
 *             If wizard is null
 *******************************************************/
public static void openAlreadyCreatedWizard(IWorkbenchWizard wizard)
{
    if (wizard == null)
    {
        throw new IllegalArgumentException();
    }

    // Initialize the wizard, wrap it in a wizard dialog, and open
    // it
    wizard.init(PlatformUI.getWorkbench(), new StructuredSelection());
    WizardDialog wd = new WizardDialog(Display.getDefault().getActiveShell(), wizard);
    wd.setTitle(wizard.getWindowTitle());
    wd.open();
}
项目:gemoc-studio-modeldebugging    文件:CreateAnimatorProjectWizardContextAction.java   
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);
    }
}
项目:gemoc-studio-modeldebugging    文件:CreateEditorProjectWizardContextAction.java   
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);
    }
}
项目:eZooKeeper    文件:NewZooKeeperConnectionAction.java   
@Override
protected IWorkbenchWizard getWizard(IStructuredSelection selection) {
    return new ZooKeeperConnectionNewWizard();
}
项目:eZooKeeper    文件:NewZnodeAction.java   
@Override
protected IWorkbenchWizard getWizard(IStructuredSelection selection) {
    return new ZnodeNewWizard();
}
项目:eZooKeeper    文件:NewJmxConnectionAction.java   
@Override
protected IWorkbenchWizard getWizard(IStructuredSelection selection) {
    return new JmxConnectionNewWizard();
}
项目:ModelDebugging    文件:CreateAnimatorProjectWizardContextAction.java   
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);
    }
}
项目:ModelDebugging    文件:CreateEditorProjectWizardContextAction.java   
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);
    }
}
项目:Archie-Smart-IDE    文件:EclipsePlatformUtils.java   
/*******************************************************
 * Opens the Eclipse's New Wizard for the specified wizard ID.
 * 
 * @param wizardID
 *            The ID of the desired wizard.
 *******************************************************/
public static void openNewWizard(String wizardID)
{
    // First see if this is a "new wizard".
    IWizardDescriptor descriptor = PlatformUI.getWorkbench().getNewWizardRegistry().findWizard(wizardID);
    // If not check if it is an "import wizard".
    if (descriptor == null)
    {
        descriptor = PlatformUI.getWorkbench().getImportWizardRegistry().findWizard(wizardID);
    }
    // Or maybe an export wizard
    if (descriptor == null)
    {
        descriptor = PlatformUI.getWorkbench().getExportWizardRegistry().findWizard(wizardID);
    }
    try
    {
        // Then if we have a wizard, open it.
        if (descriptor != null)
        {
            IWorkbenchWizard wizard = descriptor.createWizard();

            IWorkbench wb = PlatformUI.getWorkbench();

            wizard.init(wb, new StructuredSelection());

            Display display = Display.getCurrent();
            // may be null if outside the UI thread
            if (display == null)
                display = Display.getDefault();

            WizardDialog wd = new WizardDialog(display.getActiveShell(), wizard);
            wd.setTitle(wizard.getWindowTitle());
            wd.open();
        }
    }
    catch (CoreException e)
    {
        e.printStackTrace();
    }
}
项目:relations    文件:WizardCollectionElement.java   
@Override
public IWorkbenchWizard createWizard() throws CoreException {
    // TODO Auto-generated method stub
    return null;
}
项目:MMINT    文件:DiagramImpl.java   
/**
 * @generated NOT
 */
public EditorCreationWizardDialog invokeInstanceWizard(IStructuredSelection initialSelection) throws MMINTException {

    MMINTException.mustBeType(this);

    IWorkbenchWizard wizard = super.getInstanceWizard(initialSelection);
    EditorCreationWizardDialog wizDialog;
    if (getWizardDialogClass() == null) {
        Shell shell = PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell();
        if (initialSelection.getFirstElement() instanceof IFile) {
            String modelUri = ((IFile) initialSelection.getFirstElement()).getFullPath().toOSString();
            String diagramUri = FileUtils.replaceFileExtensionInPath(modelUri, getFileExtensions().get(0));
            Diagram superDiagramType = this;
            while (superDiagramType.getSupertype() != null && superDiagramType.getSupertype() != MIDTypeHierarchy.getRootEditorType()) {
                superDiagramType = (Diagram) superDiagramType.getSupertype();
            }
            String diagramKind = MIDTypeRegistry.getType(superDiagramType.getModelUri()).getName();
            String diagramPluginId = MIDTypeRegistry.getTypeBundle(superDiagramType.getUri()).getSymbolicName();
            // create the diagram directly and do not open the wizard
            try {
                GMFUtils.createGMFDiagramAndFile(modelUri, diagramUri, diagramKind, diagramPluginId, true);
                if (Boolean.parseBoolean(MMINT.getPreference(MMINTConstants.PREFERENCE_MENU_OPENMODELEDITORS_ENABLED))) {
                    FileUtils.openEclipseEditor(diagramUri, getId(), true);
                }
            }
            catch (Exception e) {
                throw new MMINTException("Error creating or opening the gmf diagram", e);
            }
            return new EditorCreationWizardDialog(shell, wizard);
        }
        else {
            wizDialog = new EditorCreationWizardDialog(shell, wizard);
        }
    }
    else {
        wizDialog = super.createCustomInstanceWizard(wizard);
    }
    wizDialog.setTitle(wizard.getWindowTitle());
    if (wizDialog.open() == Window.CANCEL) {
        return null;
    }

    return wizDialog;
}
项目:Environment    文件:ImportResultsHandler.java   
@Execute
public void execute(ESelectionService selectionService){

    Object selection = selectionService.getSelection(); 

    IWorkbenchWizard wizard = new ImportResultsWizard();
    wizard.init(PlatformUI.getWorkbench(), (selection instanceof IStructuredSelection) ? (IStructuredSelection)selection : null);

    WizardDialog wd = new  WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), wizard);
    wd.setTitle(wizard.getWindowTitle());
    wd.open();

}
项目:eZooKeeper    文件:BaseWizardAction.java   
/**
 * Subclasses must override to return the specific {@link IWorkbenchWizard}.
 * 
 * @param selection The {@link IStructuredSelection} that can be used to initialize the wizard.
 * @return The {@link IWorkbenchWizard}.
 */
protected abstract IWorkbenchWizard getWizard(IStructuredSelection selection);
项目:gef-gwt    文件:IWizardDescriptor.java   
/**
 * Create a wizard.
 * 
 * @return the wizard
 * @throws CoreException
 *             thrown if there is a problem creating the wizard
 */
IWorkbenchWizard createWizard() throws CoreException;