コード例 #1
0
 /* (non-Javadoc)
  * @see org.eclipse.jface.viewers.LabelProvider#getText(java.lang.Object)
  */
 public String getText(Object element) {
   if (element instanceof IPluginModelBase) {
     IPluginBase plugin = ((IPluginModelBase) element).getPluginBase();
     String showType = pref.getString(IPreferenceConstants.PROP_SHOW_OBJECTS);
     if (showType.equals(IPreferenceConstants.VALUE_USE_IDS)) return plugin.getId();
     return plugin.getTranslatedName();
   }
   return super.getText(element);
 }
コード例 #2
0
 private void handleAddWorkingSet() {
   IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager();
   IWorkingSetSelectionDialog dialog =
       manager.createWorkingSetSelectionDialog(PDEPlugin.getActiveWorkbenchShell(), true);
   if (dialog.open() == Window.OK) {
     IWorkingSet[] workingSets = dialog.getSelection();
     IProduct product = getProduct();
     IProductModelFactory factory = product.getModel().getFactory();
     ArrayList<IProductPlugin> pluginList = new ArrayList<IProductPlugin>();
     for (int i = 0; i < workingSets.length; i++) {
       IAdaptable[] elements = workingSets[i].getElements();
       for (int j = 0; j < elements.length; j++) {
         IPluginModelBase model = findModel(elements[j]);
         if (model != null) {
           IProductPlugin plugin = factory.createPlugin();
           IPluginBase base = model.getPluginBase();
           plugin.setId(base.getId());
           pluginList.add(plugin);
         }
       }
     }
     product.addPlugins(pluginList.toArray(new IProductPlugin[pluginList.size()]));
   }
 }