Java 类org.eclipse.ui.internal.wizards.AbstractExtensionWizardRegistry 实例源码

项目:maru    文件:ApplicationWorkbenchWindowAdvisor.java   
/**
 * Remove the wizard category 'General'.
 */
private void removeDefaultNewWizards()
{
    // based on:
    // http://stackoverflow.com/questions/11307367/how-to-remove-default-wizards-from-file-new-menu-in-rcp-application
    // http://www.eclipse.org/forums/index.php/t/261462

    AbstractExtensionWizardRegistry wizardRegistry = (AbstractExtensionWizardRegistry) PlatformUI.getWorkbench().getNewWizardRegistry();
    IWizardCategory[] categories = PlatformUI.getWorkbench().getNewWizardRegistry().getRootCategory().getCategories();

    for (IWizardDescriptor wizard : getAllWizards(categories))
    {
        if(wizard.getCategory().getId().matches("org.eclipse.ui.Basic"))
        {
            WorkbenchWizardElement wizardElement = (WorkbenchWizardElement) wizard;
            wizardRegistry.removeExtension(wizardElement.getConfigurationElement().getDeclaringExtension(), new Object[] { wizardElement });
        }
    }
}
项目:Environment    文件:CloudScaleBranding.java   
private static void removeWizards ()
{   
    AbstractExtensionWizardRegistry wizardRegistry = (AbstractExtensionWizardRegistry)PlatformUI.getWorkbench().getNewWizardRegistry();
    IWizardCategory[] categories = PlatformUI.getWorkbench().getNewWizardRegistry().getRootCategory().getCategories();
    for(IWizardDescriptor wizard : getAllWizards(categories)){


        //System.out.println("ID: " + wizard.getId());
        //System.out.println("  Label: " + wizard.getLabel()); 
        //System.out.println("  Category label: " + wizard.getCategory().getLabel()); 
        //System.out.println("  Category ID: " + wizard.getCategory().getId());


        if(
                !wizard.getCategory().getId().equals("org.eclipse.ui.Basic") && 
                !wizard.getCategory().getId().equals("org.eclipse.ui.Examples") && 

                !wizard.getCategory().getId().startsWith("org.scaledl") && 
                !wizard.getId().startsWith("org.scaledl") && 

                !wizard.getCategory().getId().startsWith("de.uka") && 
                !wizard.getCategory().getId().startsWith("org.palladiosimulator") && 
                !wizard.getId().startsWith("de.uka") && 
                !wizard.getId().startsWith("org.palladiosimulator") && 

                !wizard.getCategory().getId().startsWith("org.reclipse") && 
                !wizard.getId().startsWith("org.reclipse") && 


                !wizard.getCategory().getId().startsWith("org.spotter") && 
                !wizard.getId().startsWith("org.spotter") && 

                !wizard.getCategory().getId().toLowerCase().contains("cloudscale") &&
                !wizard.getId().toLowerCase().contains("cloudscale") &&

                !wizard.getCategory().getId().contains("dlim") 


                /*
                !wizard.getLabel().contains("ServicelevelObjective Model") &&
                !wizard.getLabel().contains("Pms Model") &&
                !wizard.getLabel().contains("Experiments Model") &&
                !wizard.getLabel().contains("Measuringpoint Model") &&
                !wizard.getLabel().contains("Resourceenvironment Model") &&
                !wizard.getLabel().contains("Seff Model") &&
                !wizard.getLabel().contains("Repository Model") &&
                !wizard.getLabel().contains("Usage Model") &&
                !wizard.getLabel().contains("Variation Model") &&
                !wizard.getLabel().contains("Allocation Model") &&
                */
                        )

        {
            // TODO: removed for now when new stuff are integrated on daily bases -- fix-it
            WorkbenchWizardElement wizardElement = (WorkbenchWizardElement) wizard;
            wizardRegistry.removeExtension(wizardElement.getConfigurationElement().getDeclaringExtension(), new Object[]{wizardElement});
        }
    }

}