本文整理匯總了Java中org.eclipse.jface.viewers.CheckboxTreeViewer.setChecked方法的典型用法代碼示例。如果您正苦於以下問題:Java CheckboxTreeViewer.setChecked方法的具體用法?Java CheckboxTreeViewer.setChecked怎麽用?Java CheckboxTreeViewer.setChecked使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.eclipse.jface.viewers.CheckboxTreeViewer
的用法示例。
在下文中一共展示了CheckboxTreeViewer.setChecked方法的11個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: checkboxTreeViewerCheckStateChanged
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
private void checkboxTreeViewerCheckStateChanged(CheckStateChangedEvent event) {
CheckboxTreeViewer viewer = (CheckboxTreeViewer) event.getSource();
TableTreeNode node = (TableTreeNode) event.getElement();
if (event.getChecked()) {
viewer.setSubtreeChecked(node, true);
} else {
viewer.setSubtreeChecked(node, false);
if (node.getParent() != null) {
viewer.setChecked(node.getParent(), false);
}
}
Object[] elements = viewer.getCheckedElements();
setPageComplete(elements.length > 0 ? true : false);
checkedTables.clear();
TableTreeNode tableTreeNode;
for (Object obj : elements) {
tableTreeNode = (TableTreeNode) obj;
if (tableTreeNode.isTable) {
checkedTables.add(tableTreeNode.getName());
} else {
dbDriverMetaData.setDbSchema(tableTreeNode.getName());
}
}
}
示例2: setChecked
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
private static void setChecked(final CheckboxTreeViewer tv, Object element) {
// When user checks a checkbox in the tree, check all its children and mark parent as greyed
// When a user uncheck a checkbox, mark the subtree as unchecked and ungrayed and if unique
// sibling parent as grayed.
DirectoryTreeContentProvider provider = (DirectoryTreeContentProvider) tv.getContentProvider();
boolean isChecked = tv.getChecked(element);
if (tv.getGrayed(element)) {
isChecked = !isChecked;
}
tv.setChecked(element, isChecked);
tv.setGrayed(element, false);
if (isChecked) {
tv.setSubtreeChecked(element, true);
} else {
tv.setSubtreeChecked(element, false);
}
setGrayed(tv, provider.getParent(element));
}
示例3: setGrayed
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
private static void setGrayed(CheckboxTreeViewer tv, Object element) {
if (element == null) {
return;
}
DirectoryTreeContentProvider provider = (DirectoryTreeContentProvider) tv.getContentProvider();
boolean checked = tv.getChecked(element);
boolean grayed = false;
for (Object object : provider.getChildren(element)) {
grayed = grayed || tv.getGrayed(object) || tv.getChecked(object);
checked = checked && tv.getChecked(object) && !tv.getGrayed(element);
}
if (checked) {
tv.setChecked(element, true);
tv.setGrayed(element, false);
} else if (grayed) {
tv.setGrayChecked(element, true);
} else {
tv.setChecked(element, false);
tv.setGrayed(element, false);
}
setGrayed(tv, provider.getParent(element));
}
示例4: updateParentState
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
private void updateParentState(IResource child, boolean baseChildState) {
if (mode == MODE_FLAT || child == null || child.getParent() == null || resourceList.contains(child.getParent())) {
return;
}
CheckboxTreeViewer checkboxTreeViewer = (CheckboxTreeViewer)treeViewer;
Object parent = resourceSelectionContentProvider.getParent(child);
if (parent == null) return;
boolean allSameState = true;
Object[] children = null;
children = resourceSelectionContentProvider.getChildren(parent);
for (int i = children.length - 1; i >= 0; i--) {
if (checkboxTreeViewer.getChecked(children[i]) != baseChildState || checkboxTreeViewer.getGrayed(children[i])) {
allSameState = false;
break;
}
}
checkboxTreeViewer.setGrayed(parent, !allSameState);
checkboxTreeViewer.setChecked(parent, !allSameState || baseChildState);
updateParentState((IResource)parent, baseChildState);
}
示例5: selectAll
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
/**
* Selects or deselects all methods.
*
* @param state
* @throws JavaModelException
*/
private void selectAll(boolean state) {
CheckboxTreeViewer checkboxTreeViewer = getGroup().getCheckboxTreeViewer();
ITreeContentProvider contentProvider = (ITreeContentProvider) checkboxTreeViewer.getContentProvider();
Object[] objects = contentProvider.getElements(checkboxTreeViewer.getInput());
for (Object object : objects) {
checkboxTreeViewer.setChecked(object, state);
}
for (IMethod method : getBaseClassMethods()) {
if (viewerFilterMethods.select(null, method.getParent(), method)) {
if (state) {
checkedMethods.add(method);
} else {
checkedMethods.remove(method);
}
}
}
}
示例6: updateParentState
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
private void updateParentState(IResource child, boolean baseChildState) {
if (mode == MODE_FLAT || child == null || child.getParent() == null || resourceList.contains(child.getParent())) {
return;
}
CheckboxTreeViewer checkboxTreeViewer = (CheckboxTreeViewer)treeViewer;
if (child == null) return;
Object parent = resourceSelectionContentProvider.getParent(child);
if (parent == null) return;
boolean allSameState = true;
Object[] children = null;
children = resourceSelectionContentProvider.getChildren(parent);
for (int i = children.length - 1; i >= 0; i--) {
if (checkboxTreeViewer.getChecked(children[i]) != baseChildState || checkboxTreeViewer.getGrayed(children[i])) {
allSameState = false;
break;
}
}
checkboxTreeViewer.setGrayed(parent, !allSameState);
checkboxTreeViewer.setChecked(parent, !allSameState || baseChildState);
updateParentState((IResource)parent, baseChildState);
}
示例7: run
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
@Override
public void run() {
// check all selected compared tours which are not yet stored
final CheckboxTreeViewer viewer = fCompareResultView.getViewer();
final StructuredSelection selection = (StructuredSelection) viewer.getSelection();
if (selection.size() > 0) {
for (final Object tour : selection.toArray()) {
if (tour instanceof TVICompareResultComparedTour) {
final TVICompareResultComparedTour comparedTour = (TVICompareResultComparedTour) tour;
if (comparedTour.isSaved() == false) {
viewer.setChecked(tour, true);
}
}
}
}
}
示例8: checkStateChanged
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
@Override
public void checkStateChanged(CheckStateChangedEvent event) {
CheckboxTreeViewer packagesTreeViewer = (CheckboxTreeViewer) event.getSource();
packagesTreeViewer.setSubtreeChecked(event.getElement(), event.getChecked());
for (IPackageFragment parentPackage : getParentPackages(((IPackageFragment) event.getElement()))) {
int countOfCheckedSubpackages = getCountOfCheckedSubpackages(parentPackage, packagesTreeViewer);
if (countOfCheckedSubpackages == getAllSubPackages(parentPackage).size()) {
packagesTreeViewer.setGrayed(parentPackage, false);
packagesTreeViewer.setChecked(parentPackage, true);
} else if (countOfCheckedSubpackages > 0) {
packagesTreeViewer.setChecked(parentPackage, true);
packagesTreeViewer.setGrayed(parentPackage, true);
} else {
packagesTreeViewer.setChecked(parentPackage, false);
packagesTreeViewer.setGrayed(parentPackage, false);
}
}
}
示例9: expressionStateChanged
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
public static void expressionStateChanged(Expression expression, CheckboxTreeViewer checkboxTreeViewer, boolean state) {
checkboxTreeViewer.setChecked(expression, state);
expression.setEnabled(state);
ProfilesContentProvider contentProvider = (ProfilesContentProvider) checkboxTreeViewer.getContentProvider();
Profile profile = (Profile) contentProvider.getParent(expression);
if (Iterables.all(profile.getExpressions(), new EnabledExpressionPredicate())) {
checkboxTreeViewer.setGrayed(profile, false);
checkboxTreeViewer.setChecked(profile, true);
}
else if (Iterables.any(profile.getExpressions(), new EnabledExpressionPredicate())) {
checkboxTreeViewer.setGrayChecked(profile, true);
}
else {
checkboxTreeViewer.setChecked(profile, false);
}
}
示例10: newFolderButtonPressed
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
protected void newFolderButtonPressed() {
NewFolderDialog dialog= new NewFolderDialog(getShell(), fSelectedContainer);
if (dialog.open() == Window.OK) {
CheckboxTreeViewer treeViewer= fViewer;
treeViewer.refresh(fSelectedContainer);
Object createdFolder= dialog.getResult()[0];
treeViewer.reveal(createdFolder);
treeViewer.setChecked(createdFolder, true);
treeViewer.setSelection(new StructuredSelection(createdFolder));
updateOKStatus();
}
}
示例11: newFolderButtonPressed
import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
protected void newFolderButtonPressed() {
Object createdFolder= createFolder(fSelectedContainer);
if (createdFolder != null) {
CheckboxTreeViewer treeViewer= fViewer;
treeViewer.refresh(fSelectedContainer);
treeViewer.reveal(createdFolder);
treeViewer.setChecked(createdFolder, true);
treeViewer.setSelection(new StructuredSelection(createdFolder));
updateOKStatus();
}
}
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:12,代碼來源:MultipleFolderSelectionDialog.java