use of org.eclipse.jface.viewers.CheckStateChangedEvent in project statecharts by Yakindu.
the class SGenWizardPage2 method createObjectTree.
private void createObjectTree(Composite container) {
lblNewLabel = new Label(container, SWT.NONE);
lblNewLabel.setLayoutData(new GridData(SWT.LEFT, SWT.CENTER, true, false, 1, 1));
lblNewLabel.setText("Choose: " + getSelectedGenerator().getContentType());
resourceTree = new CheckboxTreeViewer(container, SWT.BORDER);
resourceTree.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1));
resourceTree.setContentProvider(new WorkspaceTreeContentProvider());
resourceTree.setLabelProvider(new SGenWorkspaceLabelProvider());
TreePropagatingCheckStateListener checkStateListener = new TreePropagatingCheckStateListener(resourceTree) {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
super.checkStateChanged(event);
}
};
resourceTree.addCheckStateListener(checkStateListener);
resourceTree.addDoubleClickListener(new TreeExpandingDoubleClickListener(resourceTree, checkStateListener));
resourceTree.setAutoExpandLevel(AbstractTreeViewer.ALL_LEVELS);
resourceTree.setFilters(new ViewerFilter[] { new ViewerFilter() {
@Override
public boolean select(Viewer viewer, Object parentElement, Object element) {
// '.' prefixed folder
if (element instanceof IFolder) {
return !((IFolder) element).getName().startsWith(".");
}
return true;
}
} });
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project tdq-studio-se by Talend.
the class AbstractJarSelectDialog method createManageTreeViewer.
/**
* DOC msjian Comment method "createManageTreeViewer".
*
* @param parent
* @return
*/
protected CheckboxTreeViewer createManageTreeViewer(Composite parent) {
if (fContainerMode) {
fManageViewer = new ContainerCheckedTreeViewer(parent, SWT.BORDER);
} else {
fManageViewer = new CheckboxTreeViewer(parent, SWT.BORDER);
}
fManageViewer.setContentProvider(fContentProvider);
fManageViewer.setLabelProvider(fLabelProvider);
fManageViewer.addCheckStateListener(new ICheckStateListener() {
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
updateOKStatus();
}
});
fManageViewer.setComparator(fComparator);
if (fFilters != null) {
for (int i = 0; i != fFilters.size(); i++) {
fManageViewer.addFilter((ViewerFilter) fFilters.get(i));
}
}
fManageViewer.setInput(fInput);
return fManageViewer;
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project tdq-studio-se by Talend.
the class TablesSelectionDialog method addCheckedListener.
@Override
protected void addCheckedListener() {
// When user checks a checkbox in the tree, check all its children
getTreeViewer().addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
TreePath treePath = new TreePath(new Object[] { event.getElement() });
getTreeViewer().setSelection(new TreeSelection(treePath));
if (event.getChecked()) {
Object element = event.getElement();
getTreeViewer().setSubtreeChecked(element, true);
if (element instanceof IRepositoryNode) {
setOutput(element);
handleTablesChecked((IRepositoryNode) element, true);
}
} else {
Object element = event.getElement();
getTreeViewer().setSubtreeChecked(element, false);
if (element instanceof IRepositoryNode) {
setOutput(element);
handleTablesChecked((IRepositoryNode) element, false);
}
}
updateOKStatus();
}
});
getTableViewer().addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
Object element = event.getElement();
if (element instanceof DBTableRepNode || element instanceof DBViewRepNode) {
handleTableChecked((IRepositoryNode) element, event.getChecked());
}
}
});
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project tdq-studio-se by Talend.
the class TwoPartCheckSelectionDialog method createFirstPart.
/**
* Creates the tree viewer.
*
* @param parent the parent composite
* @return the tree viewer
*/
protected CheckboxTreeViewer createFirstPart(Composite parent) {
if (fContainerMode) {
if (DIALOG_TYPE_TABLE == this.getDialogType()) {
fViewer = new TableSelectionViewer(parent, SWT.BORDER);
} else if (!this.addConnFilter) {
fViewer = new MatchColumnSelectionViewer(parent, SWT.BORDER);
} else {
fViewer = new ColumnSelectionViewer(parent, SWT.BORDER);
}
// {
//
// protected void handleTreeExpand(TreeEvent event) {
// super.handleTreeExpand(event);
// checkElementChecked();
// }
// };
} else {
fViewer = new CheckboxTreeViewer(parent, SWT.BORDER) {
@Override
protected void handleTreeExpand(TreeEvent event) {
super.handleTreeExpand(event);
// checkElementChecked();
}
};
}
fViewer.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
applyDialogFont(fViewer.getTree());
fViewer.setContentProvider(fContentProvider);
// mod gdbu 2011-7-25 bug 23220
((ResourceViewContentProvider) fContentProvider).setTreeViewer(fViewer);
// ~23220
fViewer.setLabelProvider(fLabelProvider);
fViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
updateOKStatus();
}
});
fViewer.setComparator(fComparator);
if (fFilters != null) {
for (int i = 0; i != fFilters.size(); i++) {
fViewer.addFilter(fFilters.get(i));
}
}
fViewer.setInput(fInput);
// fViewer.
fViewer.addSelectionChangedListener(this);
return fViewer;
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project tdq-studio-se by Talend.
the class ColumnsSelectionDialog method addCheckedListener.
/*
* (non-Javadoc)
*
* @seeorg.talend.dataprofiler.core.ui.dialog.TwoPartCheckSelectionDialog# addCheckedListener()
*/
@Override
protected void addCheckedListener() {
// When user checks a checkbox in the tree, check all its children
getTreeViewer().addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
// Added TDQ-8718 20140506 yyin: should not load from db when checking
DQDBFolderRepositoryNode.setCallingFromColumnDialog(true);
DQDBFolderRepositoryNode.setLoadDBFromDialog(false);
try {
ColumnSelectionViewer columnViewer = (ColumnSelectionViewer) event.getSource();
TreePath treePath = new TreePath(new Object[] { event.getElement() });
columnViewer.setSelection(new TreeSelection(treePath));
setOutput(event.getElement());
RepositoryNode selectedNode = (RepositoryNode) event.getElement();
if (selectedNode instanceof DBTableRepNode || selectedNode instanceof DBViewRepNode || selectedNode instanceof DFTableRepNode) {
handleTreeElementsChecked(selectedNode, event.getChecked());
} else {
checkChildrenElements(selectedNode, event.getChecked());
}
getTreeViewer().setSubtreeChecked(event.getElement(), event.getChecked());
updateStatusBySelection();
} finally {
// Added TDQ-8718 20140506 yyin
DQDBFolderRepositoryNode.setCallingFromColumnDialog(false);
DQDBFolderRepositoryNode.setLoadDBFromDialog(true);
}
}
private void checkChildrenElements(RepositoryNode repNode, Boolean checkedFlag) {
Set<?> keySet = modelElementCheckedMap.keySet();
RepositoryNode[] repNodeArray = (RepositoryNode[]) modelElementCheckedMap.keySet().toArray(new RepositoryNode[keySet.size()]);
for (RepositoryNode reposNode : repNodeArray) {
RepositoryNode parentNode = reposNode.getParent();
while (parentNode != null) {
if (repNode.equals(parentNode)) {
handleTreeElementsChecked(reposNode, checkedFlag);
break;
} else {
parentNode = parentNode.getParent();
}
}
}
}
});
getTableViewer().addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
handleTableElementsChecked((RepositoryNode) event.getElement(), event.getChecked());
updateStatusBySelection();
}
});
}
Aggregations