public void run(bContext C, Panel pa) // static void view3d_panel_tool_shelf(const bContext *C, Panel *pa) { SpaceLink sl = bContext.CTX_wm_space_data(C); SpaceType st = null; uiLayout col; byte[] context = StringUtil.toCString(view3d_context_string(C)); if (sl != null) st = ScreenUtil.BKE_spacetype_from_id(sl.spacetype); if (st != null && st.toolshelf.first != null) { CustomTool ct; for (ct = (CustomTool) st.toolshelf.first; ct != null; ct = ct.next) { if (0 == StringUtil.strncmp( context, 0, ct.context, 0, WindowManagerTypes.OP_MAX_TYPENAME)) { col = UILayout.uiLayoutColumn((uiLayout) pa.layout, 1); UILayout.uiItemFullO( col, StringUtil.toJString(ct.opname, 0), null, 0, null, WmTypes.WM_OP_INVOKE_REGION_WIN, 0); } } } col = UILayout.uiLayoutColumn((uiLayout) pa.layout, 1); final SpaceType stf = st; Pointer<ListBase> st_toolshelf = new Pointer<ListBase>() { public ListBase get() { return stf.toolshelf; } public void set(ListBase obj) { throw new UnsupportedOperationException("Not supported yet."); } }; UI.uiDefBlockBut( UILayout.uiLayoutGetBlock((uiLayout) pa.layout), tool_search_menu, st_toolshelf, "Add Tool", 0, 0, UI.UI_UNIT_X, UI.UI_UNIT_Y, "Add Tool in shelf, gets saved in files"); }