private void handleNewPlugin() {
   NewPluginProjectWizard wizard = new NewPluginProjectWizard();
   wizard.init(PDEPlugin.getActiveWorkbenchWindow().getWorkbench(), null);
   WizardDialog dialog = new WizardDialog(PDEPlugin.getActiveWorkbenchShell(), wizard);
   dialog.create();
   SWTUtil.setDialogSize(dialog, 400, 500);
   if (dialog.open() == Window.OK) {
     addPlugin(wizard.getPluginId(), wizard.getPluginVersion());
   }
 }
 private void handleAdd() {
   ElementListSelectionDialog dialog =
       new ElementListSelectionDialog(
           PDEPlugin.getActiveWorkbenchShell(), PDEPlugin.getDefault().getLabelProvider());
   dialog.setElements(getBundles());
   dialog.setTitle(PDEUIMessages.PluginSelectionDialog_title);
   dialog.setMessage(PDEUIMessages.PluginSelectionDialog_message);
   dialog.setMultipleSelection(true);
   if (dialog.open() == Window.OK) {
     Object[] bundles = dialog.getResult();
     for (int i = 0; i < bundles.length; i++) {
       BundleDescription desc = (BundleDescription) bundles[i];
       addPlugin(desc.getSymbolicName(), "0.0.0"); // $NON-NLS-1$
       // addPlugin(desc.getSymbolicName(), desc.getVersion().toString());
     }
   }
 }
 private void createTabs() {
   for (int i = 0; i < TAB_LABELS.length; i++) {
     CTabItem item = new CTabItem(fTabFolder, SWT.NULL);
     item.setText(TAB_LABELS[i]);
     item.setImage(
         PDEPlugin.getDefault().getLabelProvider().get(PDEPluginImages.DESC_OPERATING_SYSTEM_OBJ));
   }
   fLastTab = 0;
   fTabFolder.setSelection(fLastTab);
 }
 private void handleProperties() {
   IStructuredSelection ssel = (IStructuredSelection) fPluginTable.getSelection();
   if (ssel.size() == 1) {
     IProductPlugin plugin = (IProductPlugin) ssel.toArray()[0];
     VersionDialog dialog =
         new VersionDialog(PDEPlugin.getActiveWorkbenchShell(), isEditable(), plugin.getVersion());
     dialog.create();
     SWTUtil.setDialogSize(dialog, 400, 200);
     if (dialog.open() == Window.OK) {
       plugin.setVersion(dialog.getVersion());
     }
   }
 }
  /* (non-Javadoc)
   * @see org.eclipse.pde.internal.ui.editor.PDESection#createClient(org.eclipse.ui.forms.widgets.Section, org.eclipse.ui.forms.widgets.FormToolkit)
   */
  protected void createClient(Section section, FormToolkit toolkit) {

    section.setLayout(FormLayoutFactory.createClearGridLayout(false, 1));
    GridData sectionData = new GridData(GridData.FILL_BOTH);
    sectionData.verticalSpan = 2;
    section.setLayoutData(sectionData);

    Composite container = createClientContainer(section, 2, toolkit);
    createViewerPartControl(container, SWT.MULTI, 2, toolkit);
    container.setLayoutData(new GridData(GridData.FILL_BOTH));

    createOptionalDependenciesButton(container);

    TablePart tablePart = getTablePart();
    fPluginTable = tablePart.getTableViewer();
    fPluginTable.setContentProvider(new ContentProvider());
    fPluginTable.setLabelProvider(PDEPlugin.getDefault().getLabelProvider());
    fPluginTable.setComparator(
        new ViewerComparator() {
          public int compare(Viewer viewer, Object e1, Object e2) {
            IProductPlugin p1 = (IProductPlugin) e1;
            IProductPlugin p2 = (IProductPlugin) e2;
            return super.compare(viewer, p1.getId(), p2.getId());
          }
        });
    GridData data = (GridData) tablePart.getControl().getLayoutData();
    data.minimumWidth = 200;
    fPluginTable.setInput(getProduct());

    tablePart.setButtonEnabled(0, isEditable());
    tablePart.setButtonEnabled(1, isEditable());
    tablePart.setButtonEnabled(2, isEditable());

    // remove buttons will be updated on refresh

    tablePart.setButtonEnabled(5, isEditable());

    toolkit.paintBordersFor(container);
    section.setClient(container);

    section.setText(PDEUIMessages.Product_PluginSection_title);
    section.setDescription(PDEUIMessages.Product_PluginSection_desc);
    getModel().addModelChangedListener(this);
    createSectionToolbar(section, toolkit);
  }
 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()]));
   }
 }