protected void initializeViewer() { Object[] elems = fSelection.toArray(); ArrayList checked = new ArrayList(elems.length); for (int i = 0; i < elems.length; i++) { Object elem = elems[i]; IProject project = null; if (elem instanceof IFile) { IFile file = (IFile) elem; project = file.getProject(); } else if (elem instanceof IProject) { project = (IProject) elem; } else if (elem instanceof IJavaProject) { project = ((IJavaProject) elem).getProject(); } if (project != null) { IModel model = findModelFor(project); if (model != null && !checked.contains(model)) { checked.add(model); } } } fExportPart.setSelection(checked.toArray()); if (checked.size() > 0) fExportPart.getTableViewer().reveal(checked.get(0)); }
protected void createViewer(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); GridLayout layout = new GridLayout(); layout.numColumns = 3; layout.marginHeight = 0; layout.marginWidth = 0; composite.setLayout(layout); composite.setLayoutData(new GridData(GridData.FILL_BOTH)); fExportPart.createControl(composite); GridData gd = (GridData) fExportPart.getControl().getLayoutData(); gd.heightHint = 125; gd.widthHint = 150; gd.horizontalSpan = 2; TableViewer viewer = fExportPart.getTableViewer(); viewer.setContentProvider(new ExportListProvider()); viewer.setLabelProvider(PDEPlugin.getDefault().getLabelProvider()); viewer.setComparator(ListUtil.PLUGIN_COMPARATOR); viewer.addDoubleClickListener( new IDoubleClickListener() { public void doubleClick(DoubleClickEvent event) { if (event.getSource() instanceof CheckboxTableViewer) { IStructuredSelection selection = (IStructuredSelection) event.getSelection(); ((CheckboxTableViewer) event.getSource()) .setChecked( selection.getFirstElement(), !((CheckboxTableViewer) event.getSource()) .getChecked(selection.getFirstElement())); fExportPart.updateCounter( ((CheckboxTableViewer) event.getSource()).getCheckedElements().length); } } }); fExportPart.getTableViewer().setInput(getInput()); }
protected void pageChanged() { if (getMessage() != null) setMessage(null); if (fOptionsTab != null) { String path = fOptionsTab.getAntBuildFileName(); String warningMessage = null; if (path != null && path.length() > 0 && "build.xml".equals(new Path(path).lastSegment())) // $NON-NLS-1$ warningMessage = PDEUIMessages.ExportOptionsTab_antReservedMessage; setMessage(warningMessage, IMessageProvider.WARNING); } String error = fExportPart.getSelectionCount() > 0 ? null : PDEUIMessages.ExportWizard_status_noselection; if (error == null) error = validateTabs(); setErrorMessage(error); setPageComplete(error == null); }
private void handleWorkingSets() { IWorkingSetManager manager = PlatformUI.getWorkbench().getWorkingSetManager(); IWorkingSetSelectionDialog dialog = manager.createWorkingSetSelectionDialog(getShell(), true); if (dialog.open() == Window.OK) { ArrayList models = new ArrayList(); IWorkingSet[] workingSets = dialog.getSelection(); for (int i = 0; i < workingSets.length; i++) { IAdaptable[] elements = workingSets[i].getElements(); for (int j = 0; j < elements.length; j++) { IModel model = findModelFor(elements[j]); if (isValidModel(model)) { models.add(model); } } } fExportPart.setSelection(models.toArray()); } }
public Object[] getSelectedItems() { return fExportPart.getSelection(); }