private void refreshEntityViewer() { IJavaProject javaProject = getJavaProject(); if (javaProject != null) { try { entityViewer.setInput(javaProject.getProject()); entityViewer.setContentProvider( RequestFactoryUtils.createEntityListContentProvider(getJavaProject())); entityViewer.refresh(); entityViewer.setAllChecked(true); handleEntitySelectionChanged(); } catch (JavaModelException e) { AppEngineRPCPlugin.log(e); } } }
private void createEntityViewer(Composite composite) throws JavaModelException { Label propertyMethodsLabel = new Label(composite, SWT.NONE); propertyMethodsLabel.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 3, 1)); propertyMethodsLabel.setText("Select entities to include:"); // $NON-NLS-1$ String tooltip = "Entities are identified in Java source with the @Entity or @PersistenceCapable annotations."; //$NON-NLS-1$ // + "To add un-annotated classes, use the \'Add..' button."; propertyMethodsLabel.setToolTipText(tooltip); // spacer new Label(composite, SWT.NONE); entityViewer = CheckboxTableViewer.newCheckList(composite, SWT.BORDER); Table propertyTree = entityViewer.getTable(); GridData gd = new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1); gd.heightHint = 100; propertyTree.setLayoutData(gd); entityTree = entityViewer.getControl(); entityTree.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite selectionControls = new Composite(composite, SWT.NONE); GridLayout layout = new GridLayout(1, false); layout.verticalSpacing = 0; layout.marginWidth = 0; layout.horizontalSpacing = 0; layout.marginHeight = 0; selectionControls.setLayout(layout); selectionControls.setLayoutData(new GridData(SWT.LEFT, SWT.TOP, false, false, 1, 1)); Button selectAllButton = new Button(selectionControls, SWT.NONE); selectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); selectAllButton.setText("Select All"); // $NON-NLS-1$ Button deselectAllButton = new Button(selectionControls, SWT.NONE); deselectAllButton.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); deselectAllButton.setText("Deselect All"); // $NON-NLS-1$ configureMethodTableViewer( entityViewer, RequestFactoryUtils.createEntityListContentProvider(getJavaProject()), new JavaElementLabelProvider(), selectAllButton, deselectAllButton); }