use of com.devonfw.cobigen.eclipse.wizard.common.model.SelectFileContentProvider in project cobigen by devonfw.
the class CheckStateListener method selectNewResources.
/**
* Sets all resources which will be created to be initially selected
*/
private void selectNewResources() {
CheckboxTreeViewer resourcesTree = this.page.getResourcesTree();
LinkedList<Object> worklist = Lists.newLinkedList(Arrays.asList(((SelectFileContentProvider) resourcesTree.getContentProvider()).getElements(resourcesTree.getInput())));
while (worklist.peek() != null) {
Object o = worklist.poll();
if (o instanceof IJavaElementStub || o instanceof IResourceStub || (o instanceof OffWorkspaceResourceTreeNode && !Files.exists(((OffWorkspaceResourceTreeNode) o).getAbsolutePath()))) {
resourcesTree.setChecked(o, true);
}
worklist.addAll(Arrays.asList(((SelectFileContentProvider) resourcesTree.getContentProvider()).getChildren(o)));
}
}
use of com.devonfw.cobigen.eclipse.wizard.common.model.SelectFileContentProvider in project cobigen by devonfw.
the class SelectFilesPage method buildResourceTreeViewer.
/**
* Builds the {@link TreeViewer} providing the tree of resources to be generated
*
* @param customizable states whether the checkboxes of the tree should be displayed or not
*/
public void buildResourceTreeViewer(boolean customizable) {
IContentProvider cp;
IBaseLabelProvider lp;
Object[] checkedElements;
if (this.resourcesTree != null) {
cp = this.resourcesTree.getContentProvider();
lp = this.resourcesTree.getLabelProvider();
checkedElements = this.resourcesTree.getCheckedElements();
} else {
cp = new SelectFileContentProvider();
lp = new SelectFileLabelProvider(this.cobigenWrapper, this.batch);
this.incrementSelector.addCheckStateListener((SelectFileLabelProvider) lp);
checkedElements = new Object[0];
}
disposeContainerRightChildren();
Label label = new Label(this.containerRight, SWT.NONE);
label.setText("Resources to be generated (selected):");
if (customizable) {
this.resourcesTree = new CustomizedCheckboxTreeViewer(this.containerRight);
} else {
this.resourcesTree = new SimulatedCheckboxTreeViewer(this.containerRight);
}
this.resourcesTree.setContentProvider(cp);
this.resourcesTree.setLabelProvider(lp);
this.resourcesTree.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
this.resourcesTree.expandToLevel(AbstractTreeViewer.ALL_LEVELS);
GridData gd = new GridData(GridData.FILL_BOTH);
gd.grabExcessHorizontalSpace = true;
gd.grabExcessVerticalSpace = true;
this.resourcesTree.getTree().setLayoutData(gd);
CheckStateListener listener = new CheckStateListener(this.cobigenWrapper, this, this.batch);
this.resourcesTree.addCheckStateListener(listener);
this.resourcesTree.setCheckedElements(checkedElements);
this.containerRight.layout();
}
Aggregations