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 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();
}
});
}
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 eclipse-integration-commons by spring-projects.
the class ChooseMultipleSection method createContents.
@Override
public void createContents(Composite page) {
Composite composite = new Composite(page, SWT.NONE);
GridLayout layout = new GridLayout();
layout.numColumns = 2;
layout.marginWidth = 0;
composite.setLayout(layout);
GridDataFactory grab = GridDataFactory.fillDefaults().grab(true, true).hint(SWT.DEFAULT, UIConstants.SCROLLABLE_LIST_HEIGTH);
grab.applyTo(composite);
composite.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
Label label = new Label(composite, SWT.NONE);
label.setText(labelText);
GridDataFactory.fillDefaults().align(SWT.CENTER, SWT.BEGINNING).hint(UIConstants.fieldLabelWidthHint(label), SWT.DEFAULT).applyTo(label);
CheckboxTableViewer tv = CheckboxTableViewer.newCheckList(composite, SWT.BORDER);
grab.applyTo(tv.getTable());
tv.setContentProvider(new ContentProvider());
tv.setLabelProvider(new LabelProvider());
tv.setInput(validChoices);
tv.setCheckedElements(chosen.getValues().toArray());
tv.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
@SuppressWarnings("unchecked") T e = (T) event.getElement();
boolean checked = event.getChecked();
if (checked) {
chosen.add(e);
} else {
chosen.remove(e);
}
}
});
if (DEBUG) {
chosen.addListener(new ValueListener<Set<T>>() {
public void gotValue(LiveExpression<Set<T>> exp, Set<T> value) {
System.out.println(">>>> starters");
for (T e : value) {
System.out.println(e.getLabel());
}
System.out.println("<<<< starters");
}
});
}
}
use of org.eclipse.jface.viewers.CheckStateChangedEvent in project webtools.sourceediting by eclipse.
the class CodeAssistCyclingConfigurationBlock method createOwnPageViewer.
private void createOwnPageViewer(Composite composite) {
fOwnPageViewer = CheckboxTableViewer.newCheckList(composite, SWT.SINGLE | SWT.BORDER);
Table table = fOwnPageViewer.getTable();
table.setHeaderVisible(true);
table.setLinesVisible(false);
table.setLayoutData(new GridData(GridData.FILL, GridData.BEGINNING, true, false, 1, 1));
TableColumn nameColumn = new TableColumn(table, SWT.NONE);
nameColumn.setText(SSEUIMessages.CodeAssistAdvancedConfigurationBlock_separate_table_category_column_title);
nameColumn.setResizable(false);
fOwnPageViewer.setContentProvider(new ArrayContentProvider());
ITableLabelProvider labelProvider = new OwnPageTableLabelProvider();
fOwnPageViewer.setLabelProvider(labelProvider);
fOwnPageViewer.setInput(fModel.pageElements);
fOwnPageViewer.setComparator(new ModelViewerComparator(fCategoryPageComparator));
final int ICON_AND_CHECKBOX_WITH = 50;
final int HEADER_MARGIN = 20;
int minNameWidth = computeWidth(table, nameColumn.getText()) + HEADER_MARGIN;
for (int i = 0; i < fModel.pageElements.size(); i++) {
minNameWidth = Math.max(minNameWidth, computeWidth(table, labelProvider.getColumnText(fModel.pageElements.get(i), 0)) + ICON_AND_CHECKBOX_WITH);
}
nameColumn.setWidth(minNameWidth);
fOwnPageViewer.addCheckStateListener(new ICheckStateListener() {
public void checkStateChanged(CheckStateChangedEvent event) {
boolean checked = event.getChecked();
ModelElement element = (ModelElement) event.getElement();
element.setShouldDisplayOnOwnPage(checked);
}
});
table.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
handleOwnPageTableSelection();
}
});
}
Aggregations