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

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

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

ToolBar.getItem介绍

[英]Returns the item at the given, zero-relative index in the receiver. Throws an exception if the index is out of range.
[中]返回接收器中给定的零相对索引处的项。如果索引超出范围,则引发异常。

代码示例

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

@Override
 public boolean matches( Widget widget ) {
  if( widget instanceof ToolItem ) {
   ToolItem item = ( ToolItem )widget;
   ToolBar toolBar = item.getParent();
   return toolBar.getItem( toolBar.getItemCount() - 1 ) == item;
  }
  return false;
 }
};

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

public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      ToolItem item = tb.getItem(e.childID);
      if (item != null) {
        String toolTip = item.getToolTipText();
        if (toolTip != null) {
          e.result = toolTip;
        }
      }
    }
  }
});

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

@Override
public Control remove(ToolBar parent, Control control) {
  for(ToolItem item : parent.getItems()){
    if(item.getControl() == control){
      Thing parentThing = Designer.getThing(parent);
      Thing itemThing = Designer.getThing(item);                
      parentThing.removeChild(itemThing);
      parentThing.save();
      
      ItemInfo itemInfo = getItemIndex(parent, control);
      int index = itemInfo != null ? itemInfo.index : -1;
      item.dispose();
      control.dispose();
      ToolBarCreator.initToolBar(parent);
      
      
      if(index != -1){
        if(index > 0 && parent.getItemCount() > index - 1){
          return parent.getItem(index - 1).getControl();
        }if(parent.getItemCount() > index){
          return parent.getItem(index).getControl();
        }
      }
      
      return parent;		
    }
  }
  
  return null;
}

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

@Override
public void mouseDown(MouseEvent e) {
  ToolBar bar = (ToolBar) e.widget;
  downPos = new Point(e.x, e.y);
  ToolItem downItem = bar.getItem(downPos);
  // We're only interested if the button went down over a
  // perspective item
  if (downItem != null && downItem.getData() instanceof MPerspective)
    dragItem = downItem;
}

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

@Override
  public void getName(AccessibleEvent e) {
    if (0 <= e.childID && e.childID < perspSwitcherToolbar.getItemCount()) {
      ToolItem item = perspSwitcherToolbar.getItem(e.childID);
      if (item != null) {
        e.result = item.getToolTipText();
      }
    }
  }
});

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

@Override
 public boolean matches( Widget widget ) {
  if( widget instanceof ToolItem ) {
   ToolItem item = ( ToolItem )widget;
   ToolBar toolBar = item.getParent();
   return toolBar.getItem( 0 ) == item;
  }
  return false;
 }
};

代码示例来源:origin: org.eclipse.e4.ui.workbench.renderers/swt

public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      Accessible accessible = (Accessible) e
          .getSource();
      ToolBar toolBar = (ToolBar) accessible
          .getControl();
      if (0 <= e.childID
          && e.childID < toolBar.getItemCount()) {
        ToolItem item = toolBar.getItem(e.childID);
        if (item != null) {
          e.result = item.getToolTipText();
        }
      }
    }
  }
});

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      ToolItem item = toolBar.getItem(e.childID);
      if (item != null) {
        String toolTip = item.getToolTipText();
        if (toolTip != null) {
          e.result = toolTip;
        }
      }
    }
  }
};

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      ToolItem item = toolBar.getItem(e.childID);
      if (item != null) {
        String toolTip = item.getToolTipText();
        if (toolTip != null) {
          e.result = toolTip;
        }
      }
    }
  }
};

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

@Override
  public void getName(AccessibleEvent e) {
    if (e.childID != ACC.CHILDID_SELF) {
      ToolItem item = tb.getItem(e.childID);
      if (item != null) {
        String toolTip = item.getToolTipText();
        if (toolTip != null) {
          e.result = toolTip;
        }
      }
    }
  }
});

代码示例来源:origin: org.eclipse.mylyn.commons/workbench

protected Widget getTipWidget(Event event) {
  Point widgetPosition = new Point(event.x, event.y);
  Widget widget = event.widget;
  if (widget instanceof ToolBar) {
    ToolBar w = (ToolBar) widget;
    return w.getItem(widgetPosition);
  }
  if (widget instanceof Table) {
    Table w = (Table) widget;
    return w.getItem(widgetPosition);
  }
  if (widget instanceof Tree) {
    Tree w = (Tree) widget;
    return w.getItem(widgetPosition);
  }
  return widget;
}

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

@Override
public Node item(int index) {
  return getElement(getToolBar().getItem(index));
}

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

public Node item(int index) {
  return getElement(getToolBar().getItem(index));
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.s390x

boolean isTabGroup () {
  ToolItem [] tabList = parent._getTabItemList ();
  if (tabList != null) {
    for (int i=0; i<tabList.length; i++) {
      if (tabList [i] == this) return true;
    }
  }
  if ((style & SWT.SEPARATOR) != 0) return true;
  int index = parent.indexOf (this);
  if (index == 0) return true;
  ToolItem previous = parent.getItem (index - 1);
  return (previous.getStyle () & SWT.SEPARATOR) != 0;
}

代码示例来源:origin: org.eclipse.scout.sdk.deps/org.eclipse.swt.win32.win32.x86

boolean isTabGroup () {
  ToolItem [] tabList = parent._getTabItemList ();
  if (tabList != null) {
    for (int i=0; i<tabList.length; i++) {
      if (tabList [i] == this) return true;
    }
  }
  if ((style & SWT.SEPARATOR) != 0) return true;
  int index = parent.indexOf (this);
  if (index == 0) return true;
  ToolItem previous = parent.getItem (index - 1);
  return (previous.getStyle () & SWT.SEPARATOR) != 0;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.linux.ppc

boolean isTabGroup () {
  ToolItem [] tabList = parent._getTabItemList ();
  if (tabList != null) {
    for (int i=0; i<tabList.length; i++) {
      if (tabList [i] == this) return true;
    }
  }
  if ((style & SWT.SEPARATOR) != 0) return true;
  int index = parent.indexOf (this);
  if (index == 0) return true;
  ToolItem previous = parent.getItem (index - 1);
  return (previous.getStyle () & SWT.SEPARATOR) != 0;
}

代码示例来源:origin: org.eclipse.platform/org.eclipse.swt.gtk.aix.ppc

boolean isTabGroup () {
  ToolItem [] tabList = parent._getTabItemList ();
  if (tabList != null) {
    for (int i=0; i<tabList.length; i++) {
      if (tabList [i] == this) return true;
    }
  }
  if ((style & SWT.SEPARATOR) != 0) return true;
  int index = parent.indexOf (this);
  if (index == 0) return true;
  ToolItem previous = parent.getItem (index - 1);
  return (previous.getStyle () & SWT.SEPARATOR) != 0;
}

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

@Override
  public void mouseDown(MouseEvent e) {
    ToolItem ti= tb.getItem(new Point(e.x, e.y));
    if (ti != null) {
      if (ti.getData() instanceof ActionContributionItem) {
        ActionContributionItem actionContributionItem= (ActionContributionItem) ti.getData();
        IAction action= actionContributionItem.getAction();
        if (action == fOpenConsoleAction) {
          Event event= new Event();
          event.widget= ti;
          event.x= e.x;
          event.y= e.y;
          action.runWithEvent(event);
        }
      }
    }
  }
});

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

@Override
 public void handleEvent( Event event ) {
  MenuItem item = ( MenuItem )event.widget;
  PageDescriptor pageDescriptor = ( PageDescriptor )item.getData();
  ToolItem dropDown = pageSwitcher.getItem( 0 );
  dropDown.setText( item.getText() );
  dropDown.setData( pageDescriptor );
  dropDown.setImage( item.getImage() );
  if( !DATA_ACTIVATED.equals( event.data ) ) {
   ui.getPageOperator().openPage( pageDescriptor.getId() );
  }
 }
}

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

private void track(MouseEvent e) {
  // Create and track the feedback overlay
  if (dragShell == null)
    createFeedback();
  // Move the drag shell
  Rectangle b = dragItem.getBounds();
  Point p = new Point(e.x, e.y);
  p = dragShell.getDisplay().map(dragItem.getParent(), null, p);
  dragShell.setLocation(p.x - (b.width / 2), p.y - (b.height / 2));
  // Set the cursor feedback
  ToolBar bar = (ToolBar) e.widget;
  ToolItem curItem = bar.getItem(new Point(e.x, e.y));
  if (curItem != null && curItem.getData() instanceof MPerspective) {
    perspSwitcherToolbar.setCursor(perspSwitcherToolbar.getDisplay().getSystemCursor(SWT.CURSOR_HAND));
  } else {
    perspSwitcherToolbar.setCursor(perspSwitcherToolbar.getDisplay().getSystemCursor(SWT.CURSOR_NO));
  }
}

相关文章

ToolBar类方法