/* (non-Javadoc) * @see org.eclipse.ui.dialogs.IWorkingSetPage#finish() */ public void finish() { Object[] checked = fTree.getCheckboxTreeViewer().getCheckedElements(); ArrayList<PersistablePluginObject> list = new ArrayList<PersistablePluginObject>(); for (int i = 0; i < checked.length; i++) { String id = ((IPluginModelBase) checked[i]).getPluginBase().getId(); if (id != null && id.length() > 0) list.add(new PersistablePluginObject(id)); } PersistablePluginObject[] objects = list.toArray(new PersistablePluginObject[list.size()]); String workingSetName = fWorkingSetName.getText().trim(); if (fWorkingSet == null) { IWorkingSetManager workingSetManager = PlatformUI.getWorkbench().getWorkingSetManager(); fWorkingSet = workingSetManager.createWorkingSet(workingSetName, objects); } else { fWorkingSet.setName(workingSetName); fWorkingSet.setElements(objects); } }
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()])); } }