當前位置: 首頁>>代碼示例>>Java>>正文


Java CheckboxTreeViewer.getContentProvider方法代碼示例

本文整理匯總了Java中org.eclipse.jface.viewers.CheckboxTreeViewer.getContentProvider方法的典型用法代碼示例。如果您正苦於以下問題:Java CheckboxTreeViewer.getContentProvider方法的具體用法?Java CheckboxTreeViewer.getContentProvider怎麽用?Java CheckboxTreeViewer.getContentProvider使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.viewers.CheckboxTreeViewer的用法示例。


在下文中一共展示了CheckboxTreeViewer.getContentProvider方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: 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));
}
 
開發者ID:bazelbuild,項目名稱:eclipse,代碼行數:20,代碼來源:DirectoryTreeContentProvider.java

示例2: 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));
}
 
開發者ID:bazelbuild,項目名稱:eclipse,代碼行數:23,代碼來源:DirectoryTreeContentProvider.java

示例3: getSelectPathsRelativeToRoot

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
/**
 * Returns the list of path selected in <code>tv</code>. It returns the list of checked path
 * without the children of the checked path. Each path is returned as a string giving the relative
 * path from the root of the tree.
 */
static ImmutableList<String> getSelectPathsRelativeToRoot(CheckboxTreeViewer tv) {
  DirectoryTreeContentProvider provider = (DirectoryTreeContentProvider) tv.getContentProvider();
  String root = provider.root.getAbsolutePath();
  ImmutableList.Builder<String> builder = ImmutableList.builder();
  for (Object element : tv.getCheckedElements()) {
    if (!tv.getGrayed(element)) {
      Object parent = provider.getParent(element);
      if (parent == null || tv.getGrayed(parent)) {
        // Only add this element if its parent is not selected (so it's the root).
        String path = ((File) element).getAbsolutePath();
        // Strip root from path
        if (path.startsWith(root)) {
          path = path.substring(root.length());
          if (path.startsWith("/")) {
            path = path.substring(1);
          }
          builder.add(path);
        }
      }
    }
  }
  return builder.build();
}
 
開發者ID:bazelbuild,項目名稱:eclipse,代碼行數:29,代碼來源:DirectoryTreeContentProvider.java

示例4: 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);
			}
		}
	}
}
 
開發者ID:junit-tools-team,項目名稱:junit-tools,代碼行數:26,代碼來源:GroupMethodSelectionCtrl.java

示例5: 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);
  }
}
 
開發者ID:agusevas,項目名稱:logan,代碼行數:18,代碼來源:CheckStateListener.java

示例6: setFileTreeRoot

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
/**
 * Set the root of the directory tree view and refresh the view if appropriate
 */
static void setFileTreeRoot(CheckboxTreeViewer tv, File root) {
  DirectoryTreeContentProvider provider = (DirectoryTreeContentProvider) tv.getContentProvider();
  if ((root == null && provider.getRoot() != null) || !root.equals(provider.getRoot())) {
    provider.setRoot(root);
    tv.refresh();
  }
}
 
開發者ID:bazelbuild,項目名稱:eclipse,代碼行數:11,代碼來源:DirectoryTreeContentProvider.java

示例7: refreshView

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
private void refreshView(CheckboxTreeViewer viewer, PatientInboxElements patInboxElements){
	InboxElementContentProvider contentProvider =
		(InboxElementContentProvider) viewer.getContentProvider();
	contentProvider.refreshElement(patInboxElements);
	viewer.refresh(false);
}
 
開發者ID:elexis,項目名稱:elexis-3-base,代碼行數:7,代碼來源:ChangeMandantCommand.java


注:本文中的org.eclipse.jface.viewers.CheckboxTreeViewer.getContentProvider方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。