org.eclipse.swt.widgets.Tree.getItemCount()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(216)

本文整理了Java中org.eclipse.swt.widgets.Tree.getItemCount()方法的一些代码示例,展示了Tree.getItemCount()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Tree.getItemCount()方法的具体详情如下:
包路径:org.eclipse.swt.widgets.Tree
类名称:Tree
方法名:getItemCount

Tree.getItemCount介绍

[英]Returns the number of items contained in the receiver that are direct item children of the receiver. The number that is returned is the number of roots in the tree.
[中]

代码示例

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jface

@Override
protected int getItemCount(Control widget) {
  return ((Tree) widget).getItemCount();
}

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.jface

protected int getItemCount(Control widget) {
  return ((Tree) widget).getItemCount();
}

代码示例来源:origin: org.eclipse/org.eclipse.pde.runtime

private void resetTotalElementCount(){
  totalElementCount = provider.getTree().getItemCount();
}

代码示例来源:origin: org.eclipse/org.eclipse.pde.runtime

public String getTitleSummary(){
  if (fViewer == null || fViewer.getTree() == null)
    return NLS.bind(PDERuntimeMessages.RegistryView_titleSummary, (new String[] {"0", "0"})); //$NON-NLS-1$ //$NON-NLS-2$
  
  return NLS.bind(PDERuntimeMessages.RegistryView_titleSummary, (new String[] {new Integer(fViewer.getTree().getItemCount()).toString(), new Integer(fPluginsTotal).toString()}));
}

代码示例来源:origin: org.eclipse/org.eclipse.datatools.connectivity.ui.dse

public void run() {
    int count = tree.getItemCount();
    monitor.beginTask(DSEPlugin.getDefault().getResourceString("DSE.Jobs.ExpandAll.label"),  //$NON-NLS-1$
        count);
  }
});

代码示例来源:origin: org.eclipse.rap/org.eclipse.rap.rwt.q07

private static void writeItemCount( Tree tree ) throws IOException {
 JSWriter writer = JSWriter.getWriterFor( tree );
 Integer newValue = new Integer( tree.getItemCount() );
 writer.set( PROP_ITEM_COUNT, "itemCount", newValue, ZERO );
}

代码示例来源:origin: org.eclipse.egit/ui

private void updateFileSectionText() {
  filesSection.setText(MessageFormat.format(UIText.CommitDialog_Files,
      Integer.valueOf(filesViewer.getCheckedElements().length),
      Integer.valueOf(filesViewer.getTree().getItemCount())));
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private boolean noSupertypeCanBeUsed() {
  return fTreeViewer.getTree().getItemCount() == countFilesWithValue(0);
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

@Override
protected void setPreferenceTransfers() {
  super.setPreferenceTransfers();
  if (validFromFile()
      && (transfersTree.getViewer().getTree().getItemCount() == 0)) {
    descText
        .setText(PreferencesMessages.WizardPreferences_noSpecificPreferenceDescription);
  } else {
    descText.setText(""); //$NON-NLS-1$
  }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ant.ui

@Override
  public void update() {
    setEnabled(view.getViewer().getTree().getItemCount() != 0);
  }
}

代码示例来源:origin: org.apache.uima/uimaj-ep-configurator

@Override
public void enable() {
 // bind enabled when one item in tree and one in table is selected
 bindButton.setEnabled(tree.getSelectionCount() == 1
     && resourceDependencySection.getTable().getSelectionCount() == 1
     && "".equals(resourceDependencySection.getTable().getSelection()[0].getText(0))); // not
                                              // bound
 removeButton.setEnabled(tree.getSelectionCount() > 0);
 editButton.setEnabled(tree.getSelectionCount() == 1 && !isBoundSpec(tree.getSelection()[0]));
 exportButton.setEnabled(tree.getItemCount() > 0);
}

代码示例来源:origin: ajermakovics/eclipse-instasearch

public void schedule(boolean expandAll) {
  
  this.cancel();
  
  if( !expandAll ) {
    resultViewer.collapseAll();
    return;
  }
  
  if( resultViewer.getTree().getItemCount() == 0 ) {
    return;
  }
  
  this.schedule();
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

@Override
  public void keyPressed(KeyEvent e) {
    // on a CR we want to transfer focus to the list
    boolean hasItems = getViewer().getTree().getItemCount() > 0;
    if (hasItems && e.keyCode == SWT.ARROW_DOWN) {
      treeViewer.getTree().setFocus();
      return;
    }
  }
});

代码示例来源:origin: org.eclipse.pde/org.eclipse.pde.ui

private static void revealTopItem(Tree tree, int[] indexPath) {
  TreeItem itemFound = null;
  for (int i = indexPath.length - 1; i >= 0; i--) {
    int index = indexPath[i];
    if (itemFound != null) {
      itemFound = (itemFound.getItemCount() > index) ? itemFound.getItem(indexPath[i]) : null;
    } else if (i == indexPath.length - 1) {
      itemFound = (tree.getItemCount() > index) ? tree.getItem(indexPath[i]) : null;
    }
  }
  if (itemFound != null) {
    tree.setTopItem(itemFound);
  }
}

代码示例来源:origin: org.apache.uima/uimaj-ep-cas-editor

@Override
public void keyPressed(KeyEvent e) {
 if (e.keyCode == SWT.ARROW_DOWN || e.keyCode == SWT.ARROW_UP) {
  typeTree.getControl().setFocus();
  Tree tree = (Tree) typeTree.getControl();
  if (tree.getItemCount() > 0) {
   tree.setSelection(tree.getItem(0));
  }
 }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.ui.workbench

@Override
protected void selectSavedItem() {
  getTreeViewer().setInput(getPreferenceManager());
  super.selectSavedItem();
  if (getTreeViewer().getTree().getItemCount() > 1) {
    // unfortunately super will force focus to the list but we want the
    // type ahead combo to get it.
    Text filterText = filteredTree.getFilterControl();
    if (filterText != null) {
      filterText.setFocus();
    }
  }
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.m2e.core.ui

void selectFirstElementInTheArtifactTreeIfNoSelectionHasBeenMade() {
 //
 // If we have started a new search when focus is passed to the tree viewer we will automatically select
 // the first element if no element has been selected from a previous expedition into the tree viewer.
 //
 if(searchResultViewer.getTree().getItemCount() > 0 && searchResultViewer.getSelection().isEmpty()) {
  Object artifact = searchResultViewer.getTree().getTopItem().getData();
  searchResultViewer.setSelection(new StructuredSelection(artifact), true);
 }
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.debug.ui

/**
 * Restores the widget state from the preference store, called after all of the widgets have been created and triggers
 * a selection changed event from the tree viewer
 */
protected void initializeControls() {
  if(fTree.getItemCount() > 0) {
    TreeItem item = fTree.getItem(0);
    fTreeViewer.setSelection(new StructuredSelection(item.getData()));
    fTreeViewer.expandToLevel(item.getData(), 1);
  }
//load the group selections
  fSwitchLaunch.load();
  fSwitchSuspend.load();
}

代码示例来源:origin: org.eclipse.jdt/org.eclipse.jdt.ui

private void selectFirstElement() {
  if (fTreeViewer.getTree().getItemCount() > 0) {
    TreeItem item= fTreeViewer.getTree().getItem(0);
    if (item.getData() != null) {
      fTreeViewer.reveal(item.getData());
      Object data= getFirstSimilarElement(item);
      if (data != null) {
        fTreeViewer.setSelection(new StructuredSelection(data));
      }
    }
  }
  fTreeViewer.getTree().setFocus();
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.jdt.ui

private void selectFirstElement() {
  if (fTreeViewer.getTree().getItemCount() > 0) {
    TreeItem item= fTreeViewer.getTree().getItem(0);
    if (item.getData() != null) {
      fTreeViewer.reveal(item.getData());
      Object data= getFirstSimilarElement(item);
      if (data != null) {
        fTreeViewer.setSelection(new StructuredSelection(data));
      }
    }
  }
  fTreeViewer.getTree().setFocus();
}

相关文章

Tree类方法