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


Java CheckboxTreeViewer.addCheckStateListener方法代碼示例

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


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

示例1: createTreeViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
@Override
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
  int style = SWT.VIRTUAL | SWT.FULL_SELECTION | SWT.BORDER
      | SWT.H_SCROLL | SWT.V_SCROLL;
  CheckboxTreeViewer result = new CheckboxTreeViewer(parent, style);
  result.setLabelProvider(new WorkbenchLabelProvider());
  result.setContentProvider(new BaseWorkbenchContentProvider());
  result.setComparator(new NodeWrapperTreeSorter());

  result.addCheckStateListener(new ICheckStateListener() {
    @Override
    public void checkStateChanged(CheckStateChangedEvent event) {
      if (recursiveTreeSelect) {
        tree.setSubtreeChecked(event.getElement(), event.getChecked());
      }
    }
  });

  tree = result;
  return result;
}
 
開發者ID:google,項目名稱:depan,代碼行數:22,代碼來源:CheckNodeTreeView.java

示例2: createTreeViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
/**
 * Creates the tree viewer.
 *
 * @param parent the parent composite
 * @return the tree viewer
 */
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
    fViewer = new CheckboxTreeViewer(parent, SWT.BORDER);

    fViewer.setContentProvider(fContentProvider);
    fViewer.setLabelProvider(fLabelProvider);
    fViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(CheckStateChangedEvent event) {
            updateOKStatus();
        }
    });

    fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
    if (fFilters != null) {
        for (int i = 0; i != fFilters.size(); i++) {
            fViewer.addFilter((ViewerFilter) fFilters.get(i));
        }
    }

    fViewer.setInput(fInput);

    return fViewer;
}
 
開發者ID:iloveeclipse,項目名稱:filesync4eclipse,代碼行數:30,代碼來源:MultipleFolderSelectionDialog.java

示例3: createTreeViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
/**
 *	Creates this group's tree viewer.
 * @param parent parent composite
 * @param width the width
 * @param height the height
 */
protected void createTreeViewer(Composite parent, int width, int height) {
	Tree tree= new Tree(parent, SWT.CHECK | SWT.BORDER);
	GridData data= new GridData(GridData.FILL_BOTH);
	data.widthHint= width;
	data.heightHint= height;
	tree.setLayoutData(data);

	fTreeViewer= new CheckboxTreeViewer(tree);
	fTreeViewer.setUseHashlookup(true);
	fTreeViewer.setContentProvider(fTreeContentProvider);
	fTreeViewer.setLabelProvider(fTreeLabelProvider);
	fTreeViewer.addTreeListener(this);
	fTreeViewer.addCheckStateListener(this);
	fTreeViewer.addSelectionChangedListener(this);
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:22,代碼來源:CheckboxTreeAndListGroup.java

示例4: createTreeViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
/**
 * Creates the tree viewer.
 *
 * @param parent the parent composite
 * @return the tree viewer
 */
protected CheckboxTreeViewer createTreeViewer(Composite parent) {
	fViewer = new CheckboxTreeViewer(parent, SWT.BORDER);

	fViewer.setContentProvider(fContentProvider);
	fViewer.setLabelProvider(fLabelProvider);
	fViewer.addCheckStateListener(new ICheckStateListener() {
		public void checkStateChanged(CheckStateChangedEvent event) {
			updateOKStatus();
		}
	});

	fViewer.setComparator(new ResourceComparator(ResourceComparator.NAME));
	if (fFilters != null) {
		for (int i = 0; i != fFilters.size(); i++)
			fViewer.addFilter(fFilters.get(i));
	}

	fViewer.setInput(fInput);

	return fViewer;
}
 
開發者ID:trylimits,項目名稱:Eclipse-Postfix-Code-Completion,代碼行數:28,代碼來源:MultipleFolderSelectionDialog.java

示例5: createViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
@Override
protected TreeViewer createViewer(Composite parent) {
	CheckboxTreeViewer viewer = new CheckboxTreeViewer(parent, SWT.BORDER);
	configureViewer(viewer, true);
	viewer.addCheckStateListener((e) -> {
		DiffNode node = (DiffNode) e.getElement();
		if (!isCheckable(node)) {
			if (e.getChecked())
				viewer.setChecked(node, false);
			return;
		}
		if (e.getChecked()) {
			selected.add(node);
		} else {
			if (fixNewElements && node.getContent().local.type == DiffType.NEW) {
				viewer.setChecked(node, true);
				return;
			}
			selected.remove(node);
		}
	});
	UI.gridData(viewer.getTree(), true, true);
	return viewer;
}
 
開發者ID:GreenDelta,項目名稱:olca-app,代碼行數:25,代碼來源:CommitDiffViewer.java

示例6: configureTreeViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
/**
 * 트리 뷰어 설정
 * 
 * @param viewer
 *            void
 */
protected void configureTreeViewer(CheckboxTreeViewer viewer) {
    viewer.setUseHashlookup(true);
    viewer.addCheckStateListener(new ICheckStateListener() {
        /**
         * @see org.eclipse.jface.viewers.ICheckStateListener#checkStateChanged(org.eclipse.jface.viewers.CheckStateChangedEvent)
         */
        public void checkStateChanged(CheckStateChangedEvent event) {
            treeViewer.setSubtreeChecked(event.getElement(), event.getChecked());
        }
    });

    viewer.setContentProvider(new ProjectItemTreeContentProvider(2));
    viewer.setLabelProvider(new ProjectItemLabelProvider());

    // 트리 뷰어의 경우 탐색기의 최상위 요소인 Model을 입력으로 설정하면
    // Model의 자식 요소부터 트리에 보여 주므로
    // 트리에 최상위 요소인 Model을 보여 주기 위해서는
    // Model을 자식으로 가지는 새로운 요소에다 Model을 설정해서
    // 그 요소를 트리의 입력으로 설정해 줘야 한다.
    ContainerElement container = new ContainerElement();
    container.addChild(rootElement);

    viewer.setInput(container);

    ViewerFilter viewerFilter = new ElementViewerFilter(filterType);
    viewer.addFilter(viewerFilter);
    viewer.setSorter(new NameSorter());
}
 
開發者ID:SK-HOLDINGS-CC,項目名稱:NEXCORE-UML-Modeler,代碼行數:35,代碼來源:ProjectItemSelectionDialog.java

示例7: createTreeViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
protected void createTreeViewer(Composite parent, int width, int height)
{
    Tree tree = new Tree(parent, 32);
    GridData data = new GridData(1808);
    data.widthHint = width;
    data.heightHint = height;
    tree.setLayoutData(data);
    fTreeViewer = new CheckboxTreeViewer(tree);
    fTreeViewer.setUseHashlookup(true);
    fTreeViewer.setContentProvider(fTreeContentProvider);
    fTreeViewer.setLabelProvider(fTreeLabelProvider);
    fTreeViewer.addTreeListener(this);
    fTreeViewer.addCheckStateListener(this);
    fTreeViewer.addSelectionChangedListener(this);
}
 
開發者ID:qxo,項目名稱:eclipse-code-lines-plugin,代碼行數:16,代碼來源:CheckboxTreeAndListGroup.java

示例8: createObjectTree

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
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) {
			// TODO: Filter by common navigator filter instead of supressing
			// '.' prefixed folder
			if (element instanceof IFolder) {
				return !((IFolder) element).getName().startsWith(".");
			}
			return true;
		}
	} });
}
 
開發者ID:Yakindu,項目名稱:statecharts,代碼行數:33,代碼來源:SGenWizardPage2.java

示例9: createPackagesTreeViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
/**
 * Create a check box tree viewer for the packages.
 * 
 * @param container
 *            Container in which the tree viewer will be created.
 */
private void createPackagesTreeViewer(Composite container) {
    packagesTreeViewer = new CheckboxTreeViewer(container);
    packagesTreeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
    packagesTreeViewer.setLabelProvider(new PackageLabelProvider());

    packagesTreeContentProvider = new PackagesTreeContentProvider();
    packagesTreeViewer.setContentProvider(packagesTreeContentProvider);

    packagesCheckStateListener = new PackagesCheckStateListener();
    packagesTreeViewer.addCheckStateListener(packagesCheckStateListener);
}
 
開發者ID:kopl,項目名稱:SPLevo,代碼行數:18,代碼來源:PackageScopeDefinitionWizardPage.java

示例10: createLevelViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
private void createLevelViewer( Composite parent )
{
	levelViewer = new CheckboxTreeViewer( parent, SWT.SINGLE | SWT.BORDER );

	GridData gd = new GridData( GridData.FILL_BOTH );
	gd.widthHint = 340;
	gd.heightHint = 250;
	levelViewer.getTree( ).setLayoutData( gd );

	levelViewer.setContentProvider( new CubeContentProvider( ) );
	levelViewer.setLabelProvider( new CubeLabelProvider( ) );
	levelViewer.addCheckStateListener( new ICheckStateListener( ) {

		public void checkStateChanged( CheckStateChangedEvent event )
		{

			LevelHandle item = (LevelHandle) event.getElement( );
			if ( event.getChecked( ) )
			{
				if ( !showLevels.contains( item ) )
					showLevels.add( item );
			}
			else
			{
				if ( showLevels.contains( item ) )
					showLevels.remove( item );
			}

			checkOKButtonStatus( );
		}

	} );
}
 
開發者ID:eclipse,項目名稱:birt,代碼行數:34,代碼來源:LevelViewDialog.java

示例11: createProcessTree

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
private void createProcessTree(Composite container) {
	Composite composite = new Composite(container, SWT.NONE);
	composite.setLayout(new FillLayout());
	UI.gridData(composite, true, true);
	viewer = new CheckboxTreeViewer(composite, SWT.MULTI | SWT.BORDER);
	viewer.setUseHashlookup(true);
	viewer.setContentProvider(new NavigationContentProvider());
	viewer.setLabelProvider(new NavigationLabelProvider(false));
	viewer.setInput(Navigator.getNavigationRoot());
	viewer.addCheckStateListener(new NavigationTreeCheck(viewer));
	viewer.addCheckStateListener(this);
	viewer.addFilter(new NavigationTreeFilter());
	viewer.setSorter(new NavigationSorter());
}
 
開發者ID:GreenDelta,項目名稱:olca-app,代碼行數:15,代碼來源:ExportWizardPage.java

示例12: createControl

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
	Composite container = UI.formComposite(parent);
	setControl(container);
	viewer = new CheckboxTreeViewer(container, SWT.BORDER);
	viewer.setLabelProvider(new Label());
	viewer.setContentProvider(new ContentProvider());
	viewer.setUseHashlookup(true);
	viewer.addCheckStateListener(new SelectionState(this));
	UI.gridData(viewer.getTree(), true, true);
}
 
開發者ID:GreenDelta,項目名稱:olca-app,代碼行數:12,代碼來源:RepositoryImportWizard.java

示例13: createViewer

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
private void createViewer(Composite composite) {
	viewer = new CheckboxTreeViewer(composite, SWT.VIRTUAL | SWT.MULTI
			| SWT.BORDER);
	viewer.setUseHashlookup(true);
	viewer.getTree().setLayoutData(
			new GridData(SWT.FILL, SWT.FILL, true, true));
	viewer.setContentProvider(new NavigationContentProvider());
	viewer.setLabelProvider(new NavigationLabelProvider(false));
	viewer.setSorter(new NavigationSorter());
	viewer.addFilter(new ModelTypeFilter(types));
	viewer.addCheckStateListener(new ModelSelectionState(this, viewer));
	registerInputHandler(composite);
	ColumnViewerToolTipSupport.enableFor(viewer);
}
 
開發者ID:GreenDelta,項目名稱:olca-app,代碼行數:15,代碼來源:ModelSelectionPage.java

示例14: createControl

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
@Override
public void createControl(Composite parent) {
  Composite container = new Composite(parent, SWT.NULL);
  setControl(container);
  container.setLayout(new FillLayout(SWT.HORIZONTAL));

  checkboxTreeViewer = new CheckboxTreeViewer(container, SWT.BORDER);

  MarkAllInWsContentProvider treeViewerContentProvider = new MarkAllInWsContentProvider();

  checkboxTreeViewer.setLabelProvider(new MarkAllInWsLabelProvider());
  checkboxTreeViewer.setContentProvider(treeViewerContentProvider);
  IProject[] projects = ResourcesPlugin.getWorkspace().getRoot().getProjects();
  for (IProject iProject : projects) {
    if (!iProject.isOpen()) {
      this.closedProjects.add(iProject);
    }
  }
  checkboxTreeViewer.setInput(ResourcesPlugin.getWorkspace().getRoot().getProjects());
  checkboxTreeViewer.setGrayedElements(this.closedProjects.toArray());

  checkboxTreeViewer.addCheckStateListener(new ICheckStateListener() {

    @Override
    public void checkStateChanged(CheckStateChangedEvent event) {
      if (event.getChecked()) {
        if (((event.getElement() instanceof IProject)
            && !((IProject) event.getElement()).isOpen())) {
          return;
        }
        checkboxTreeViewer.setSubtreeChecked(event.getElement(), true);
      } else {
        if (((event.getElement() instanceof IProject)
            && !((IProject) event.getElement()).isOpen())) {
          return;
        }
        checkboxTreeViewer.setSubtreeChecked(event.getElement(), false);
      }
      setPageComplete(true);
    }
  });
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:43,代碼來源:MarkAllInWsPage.java

示例15: OptionalExportsControl

import org.eclipse.jface.viewers.CheckboxTreeViewer; //導入方法依賴的package包/類
public OptionalExportsControl(
    final Composite parent,
    final int style,
    final DataProviderCollection dataProviderCollection,
    final DataProviderTreeControl dataProviderTreeControl) {
    super(parent, style);

    final GridLayout layout = new GridLayout(1, false);
    setLayout(layout);

    final Label label = new Label(this, SWT.WRAP);
    label.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
    label.setText(Messages.getString("OptionalExportsControl.SummaryLabelText")); //$NON-NLS-1$

    treeViewer = new CheckboxTreeViewer(this, SWT.BORDER);
    treeViewer.getTree().setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

    treeViewer.setContentProvider(new ContentProvider());
    treeViewer.setLabelProvider(new LabelProvider());

    treeViewer.setInput(dataProviderCollection);

    treeViewer.setExpandedElements(dataProviderCollection.getSortedCategoriesWithOptionalExportProviders());

    final List checkedElements = new ArrayList();
    final DataCategory[] categories = dataProviderCollection.getSortedCategoriesWithOptionalExportProviders();
    for (int i = 0; i < categories.length; i++) {
        final DataProviderWrapper[] dataProviders =
            dataProviderCollection.getSortedOptionalExportProvidersForCategory(categories[i]);
        for (int j = 0; j < dataProviders.length; j++) {
            if (dataProviders[j].isShouldExport()) {
                checkedElements.add(dataProviders[j]);
            }
        }
    }

    treeViewer.setCheckedElements(checkedElements.toArray());

    treeViewer.addCheckStateListener(new ICheckStateListener() {
        @Override
        public void checkStateChanged(final CheckStateChangedEvent event) {
            if (event.getElement() instanceof DataCategory) {
                treeViewer.getTree().setRedraw(false);

                final DataCategory category = (DataCategory) event.getElement();
                final DataProviderWrapper[] children =
                    dataProviderCollection.getSortedOptionalExportProvidersForCategory(category);
                for (int i = 0; i < children.length; i++) {
                    children[i].setShouldExport(event.getChecked());
                    treeViewer.setChecked(children[i], event.getChecked());
                }

                treeViewer.getTree().setRedraw(true);
            } else {
                final DataProviderWrapper dataProvider = (DataProviderWrapper) event.getElement();
                dataProvider.setShouldExport(event.getChecked());

                final DataCategory parentCategory = dataProvider.getDataProviderInfo().getCategory();
                final DataProviderWrapper[] siblings =
                    dataProviderCollection.getSortedOptionalExportProvidersForCategory(parentCategory);
                boolean allChildrenChecked = true;
                for (int i = 0; i < siblings.length; i++) {
                    if (!siblings[i].isShouldExport()) {
                        allChildrenChecked = false;
                        break;
                    }
                }
                treeViewer.setChecked(parentCategory, allChildrenChecked);
            }

            dataProviderTreeControl.refresh();
        }
    });
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:75,代碼來源:OptionalExportsControl.java


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