Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Can't hide import wizards.(Using Activities extension eclipse 3.6.2 not working)
icon5.gif  Can't hide import wizards. [message #754513] Wed, 02 November 2011 20:45 Go to next message
Mario Laureti is currently offline Mario LauretiFriend
Messages: 2
Registered: November 2011
Junior Member
We tried hiding the org.eclipse.ui.wizards.import.FileSystem contributions using an activities extension but it still appears in the table of the Import Dialog. (ImportExportWizard class)

What am I doing wrong?
icon7.gif  Re: Can't hide import wizards. [message #754688 is a reply to message #754513] Thu, 03 November 2011 20:47 Go to previous messageGo to next message
Mario Laureti is currently offline Mario LauretiFriend
Messages: 2
Registered: November 2011
Junior Member
You can't hide the elements on the table of the Import Dialog with Activities.
A college on my team (Thanks André) found a way to programmatically remove it.

An example is worth a thousand words:


private final String excludedWizards = "org\\.eclipse\\.ui\\.wizards\\.(import|export)\\.(?!Preferences).*";


AbstractExtensionWizardRegistry wizardRegistry = (AbstractExtensionWizardRegistry)WorkbenchPlugin.getDefault().getNewWizardRegistry();

IWizardCategory[] categories = WorkbenchPlugin.getDefault().getNewWizardRegistry().getRootCategory().getCategories();

for(IWizardDescriptor wizard : getAllWizards(categories)){
  if(wizard.getId().matches(excludedWizards)){
    WorkbenchWizardElement wizardElement = (WorkbenchWizardElement) wizard;
    wizardRegistry.removeExtension(wizardElement.getConfigurationElement().getDeclaringExtension(), new Object[]{wizardElement});
  }
}


private IWizardDescriptor[] getAllWizards(IWizardCategory[] categories) {
  List<IWizardDescriptor> results = new ArrayList<IWizardDescriptor>();
  for(IWizardCategory wizardCategory : categories){
    results.addAll(Arrays.asList(wizardCategory.getWizards()));
    results.addAll(Arrays.asList(getAllWizards(wizardCategory.getCategories())));
  }
  return results.toArray(new IWizardDescriptor[0]);
}


Re: Can't hide import wizards. [message #893840 is a reply to message #754688] Thu, 05 July 2012 16:14 Go to previous message
Raghavendra Rao is currently offline Raghavendra RaoFriend
Messages: 1
Registered: July 2012
Junior Member
Hi
Could you tell me where do I write this piece of code so that my plug-in
contribution is removed. It should not be in any of my plug-in class right?

My plugin contributes to extension org.eclipse.ui.importWizards, which I want to suppress from appearing in File>Import dialog based on some criteria.



Thanks
Raghavendra

[Updated on: Thu, 05 July 2012 16:18]

Report message to a moderator

Previous Topic:Eclipse RCP Product export issue
Next Topic:Eclipse indexing not working
Goto Forum:
  


Current Time: Sun Nov 23 13:44:07 GMT 2014

Powered by FUDForum. Page generated in 0.01657 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software