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

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

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

Tree.setData介绍

暂无

代码示例

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
public void dragFinished(DragSourceEvent event) {
  tree.setData("dragging", null);
}

代码示例来源:origin: BiglySoftware/BiglyBT

@Override
   public void dragStart(DragSourceEvent event) {
     TreeItem[] selection = tree.getSelection();
 event.doit = selection.length > 0;
     tree.setData("dragging", 1);
}

代码示例来源:origin: com.eclipsesource.tabris/tabris

/**
 * <p>
 * Set the item height of a {@link TreeItem} in pixels.
 * </p>
 *
 * @param itemHeight the item height in pixels. Must be >= 0.
 *
 * @since 1.2
 */
public TreeDecorator setItemHeight( int itemHeight ) {
 when( itemHeight < 0 ).throwIllegalArgument( "ItemHeight must be >= 0 but was " + itemHeight );
 tree.setData( RWT.CUSTOM_ITEM_HEIGHT, Integer.valueOf( itemHeight ) );
 return this;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

/**
 * Sets the way to draw the tree arrows.
 *
 * @see #TREE_ARROWS_MODE_TRIANGLE
 * @see #TREE_ARROWS_MODE_SQUARE
 */
public void setTreeArrowsMode(String arrowsMode) {
  Tree tree = getTree();
  if (arrowsMode == null) {
    tree.setData(TREE_ARROWS_MODE, null);
    setPaintListener(getTreeArrowsForegroundColor());
    return;
  }
  Assert.isTrue(TREE_ARROWS_MODE_TRIANGLE.equals(arrowsMode) || TREE_ARROWS_MODE_SQUARE.equals(arrowsMode));
  tree.setData(TREE_ARROWS_MODE, arrowsMode);
}

代码示例来源:origin: com.eclipsesource.tabris/tabris

/**
 * <p>
 * Controls the number of preloaded items outside (above and below) visible area of a virtual
 * <code>Tree</code>.
 * </p>
 *
 * @param preloadedItems the items to preload. Must be > 0.
 *
 * @since 1.2
 */
public TreeDecorator setPreloadedItems( int preloadedItems ) {
 when( preloadedItems < 0 ).throwIllegalArgument( "Preloaded items must be > 0 but was " + preloadedItems );
 tree.setData( RWT.PRELOADED_ITEMS, Integer.valueOf( preloadedItems ) );
 return this;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.e4.ui.css.swt

/**
 * Adds a custom paint listener which replaces the original tree arrows and
 * draws new ones (based on the state of the TreeItem) if a color is passed
 * (if null is passed, returns to the standard behavior).
 *
 * @param color
 *            The foreground color to be used to paint the items. May be
 *            null (in which case we stop our custom painter from painting
 *            the tree items).
 */
public void setTreeArrowsForegroundColor(Color color) {
  Tree tree = getTree();
  tree.setData(TREE_ARROWS_FOREGROUND_COLOR, color);
  setPaintListener(color);
}

代码示例来源:origin: com.eclipsesource.tabris/tabris

/**
 * <p>
 * Sets a {@link Template} on this tree.
 * </P>
 *
 * @param template the template to use. Must not be null.
 *
 * @see Template
 * @see Cell
 * @see RWT#ROW_TEMPLATE
 *
 * @since 1.2
 */
public TreeDecorator setTemplate( Template template ) {
 whenNull( template ).throwIllegalArgument( "Template must not be null" );
 tree.setData( RWT.ROW_TEMPLATE, template );
 return this;
}

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

tree.setData("name", "searchResultTree"); //$NON-NLS-1$ //$NON-NLS-2$
tree.addFocusListener(new FocusListener() {

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

/**
 * Sets the root entry for this property sheet viewer. The root entry is not
 * visible in the viewer.
 *
 * @param root
 *            the root entry
 */
public void setRootEntry(IPropertySheetEntry root) {
  // If we have a root entry, remove our entry listener
  if (rootEntry != null) {
    rootEntry.removePropertySheetEntryListener(entryListener);
  }
  rootEntry = root;
  // Set the root as user data on the tree
  tree.setData(rootEntry);
  // Add an IPropertySheetEntryListener to listen for entry change
  // notifications
  rootEntry.addPropertySheetEntryListener(entryListener);
  // Pass our input to the root, this will trigger entry change
  // callbacks to update this viewer
  setInput(input);
}

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

/**
 * Sets the root entry for this property sheet viewer. The root entry is not
 * visible in the viewer.
 * 
 * @param root
 *            the root entry
 */
public void setRootEntry(IPropertySheetEntry root) {
  // If we have a root entry, remove our entry listener
  if (rootEntry != null) {
    rootEntry.removePropertySheetEntryListener(entryListener);
  }
  rootEntry = root;
  // Set the root as user data on the tree
  tree.setData(rootEntry);
  // Add an IPropertySheetEntryListener to listen for entry change
  // notifications
  rootEntry.addPropertySheetEntryListener(entryListener);
  // Pass our input to the root, this will trigger entry change
  // callbacks to update this viewer
  setInput(input);
}

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

/**
 * Sets the root entry for this property sheet viewer. The root entry is not
 * visible in the viewer.
 *
 * @param root
 *            the root entry
 */
public void setRootEntry(IPropertySheetEntry root) {
  // If we have a root entry, remove our entry listener
  if (rootEntry != null) {
    rootEntry.removePropertySheetEntryListener(entryListener);
  }
  rootEntry = root;
  // Set the root as user data on the tree
  tree.setData(rootEntry);
  // Add an IPropertySheetEntryListener to listen for entry change
  // notifications
  rootEntry.addPropertySheetEntryListener(entryListener);
  // Pass our input to the root, this will trigger entry change
  // callbacks to update this viewer
  setInput(input);
}

代码示例来源:origin: org.xworker/xworker_swt

public static void attachToTree(ActionContext actionContext){
  Thing self = (Thing) actionContext.get("self");
  Object object = actionContext.get("object");
  
  //添加一个表格数据仓库监听
  Tree tree = (Tree) object;
  Thing listener = new Thing("xworker.app.view.swt.data.events.TreeDataStoreListener");
  listener.put("tree", object);
  //先调用监听初始化
  listener.doAction("onReconfig", actionContext, UtilMap.toMap("store", self));
  //加入到监听器中
  self.doAction("addListenerToFirst", actionContext, UtilMap.toMap("listener", listener));
  //把监听和自身添加到table中以备后用
  tree.setData("storeListener", listener);
  tree.setData("store", self);
  DataStoreDisposeListener.attach(tree);
}

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

tree.setData("org.eclipse.swtbot.widget.key", "LocationTree"); //$NON-NLS-1$ //$NON-NLS-2$

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

public Viewer createDiffViewer(Composite parent) {
  viewer =  new DiffTreeViewer(parent, getCompareConfiguration()){
    protected void fillContextMenu(IMenuManager manager) {
      PatchCompareEditorInput.this.fillContextMenu(manager);
    }
  };
    
  viewer.setLabelProvider(new PatcherCompareEditorLabelProvider((ILabelProvider)viewer.getLabelProvider()));
  viewer.getTree().setData(CompareUI.COMPARE_VIEWER_TITLE, PatchMessages.PatcherCompareEditorInput_PatchContents);
  viewer.addOpenListener(new IOpenListener() {
    public void open(OpenEvent event) {
      IStructuredSelection sel= (IStructuredSelection) event.getSelection();
      Object obj= sel.getFirstElement();
      if (obj instanceof HunkDiffNode) {
        getCompareConfiguration().setLeftLabel(PatchMessages.PreviewPatchPage2_PatchedLocalFile);
        getCompareConfiguration().setRightLabel(PatchMessages.PreviewPatchPage2_OrphanedHunk);
      } else {
        getCompareConfiguration().setLeftLabel(PatchMessages.PatcherCompareEditorInput_LocalCopy);
        getCompareConfiguration().setRightLabel(PatchMessages.PatcherCompareEditorInput_AfterPatch);
      }
    }
  
  });
  viewer.setFilters(getFilters());
  viewer.setInput(root);
  return viewer;
}

代码示例来源:origin: org.xworker/xworker_swt

tree.setData(object);
tree.setData("thing", self);

代码示例来源:origin: org.xworker/xworker_swt

public static Object create(ActionContext actionContext) {
  World world = World.getInstance();
  Thing self = actionContext.getObject("self");
  
  //创建控件
  Thing treeThing = world.getThing("xworker.swt.xworker.prototype.ThingPropertyEditorShell/@tree");
  Tree tree = treeThing.doAction("create", actionContext);
  
  //创建子节点
  actionContext.peek().put("parent", tree);
  for(Thing child : self.getChilds()) {
    child.doAction("create", actionContext);
  }
  
  ThingPropertiesEditor editor = new ThingPropertiesEditor(self, tree, actionContext);
  tree.setData(EDITOR, editor);
  actionContext.g().put(self.getMetadata().getName(), editor);
  
  return tree;
}

代码示例来源:origin: org.xworker/xworker_swt

self.put("tree", parent);
self.put("parent", parent);
parent.setData("_treeModel", treeModel);
parent.setData("treeModel", treeModel);

代码示例来源:origin: org.xworker/xworker_swt

parent.setData("tableCursor", cursor);
parent.setData("tableCursorListener", tableListener);

代码示例来源:origin: org.xworker/xworker_swt

Designer.popCreator();
tree.setData(self);

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

@Override
public Viewer createDiffViewer(Composite parent) {
  viewer =  new DiffTreeViewer(parent, getCompareConfiguration()){
    @Override
    protected void fillContextMenu(IMenuManager manager) {
      PatchCompareEditorInput.this.fillContextMenu(manager);
    }
  };
  viewer.setLabelProvider(new PatcherCompareEditorLabelProvider((ILabelProvider)viewer.getLabelProvider()));
  viewer.getTree().setData(CompareUI.COMPARE_VIEWER_TITLE, PatchMessages.PatcherCompareEditorInput_PatchContents);
  viewer.addOpenListener(event -> {
    IStructuredSelection sel= (IStructuredSelection) event.getSelection();
    Object obj= sel.getFirstElement();
    if (obj instanceof HunkDiffNode) {
      if (((HunkDiffNode) obj).getHunkResult().isOK()) {
        getCompareConfiguration().setLeftLabel(PatchMessages.PatcherCompareEditorInput_LocalCopy);
        getCompareConfiguration().setRightLabel(PatchMessages.PreviewPatchPage2_MatchedHunk);
      } else {
        getCompareConfiguration().setLeftLabel(PatchMessages.PreviewPatchPage2_PatchedLocalFile);
        getCompareConfiguration().setRightLabel(PatchMessages.PreviewPatchPage2_OrphanedHunk);
      }
    } else {
      getCompareConfiguration().setLeftLabel(PatchMessages.PatcherCompareEditorInput_LocalCopy);
      getCompareConfiguration().setRightLabel(PatchMessages.PatcherCompareEditorInput_AfterPatch);
    }
  });
  viewer.setFilters(getFilters());
  viewer.setInput(root);
  return viewer;
}

相关文章

Tree类方法