当前位置: 首页>>代码示例>>Golang>>正文


Golang FilesTreeStore.GetCurrentId方法代码示例

本文整理汇总了Golang中github.com/axel-freesp/sge/models.FilesTreeStore.GetCurrentId方法的典型用法代码示例。如果您正苦于以下问题:Golang FilesTreeStore.GetCurrentId方法的具体用法?Golang FilesTreeStore.GetCurrentId怎么用?Golang FilesTreeStore.GetCurrentId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/axel-freesp/sge/models.FilesTreeStore的用法示例。


在下文中一共展示了FilesTreeStore.GetCurrentId方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: getToplevelId

func getToplevelId(fts *models.FilesTreeStore) string {
	p := fts.GetCurrentId()
	if p == "" {
		log.Fatal("fileSave error: fts.GetCurrentId() failed")
	}
	spl := strings.Split(p, ":")
	return spl[0] // TODO: move to function in fts...
}
开发者ID:axel-freesp,项目名称:sge,代码行数:8,代码来源:menufile.go

示例2: fileClose

func fileClose(menu *GoAppMenu, fts *models.FilesTreeStore, ftv *views.FilesTreeView, jl IJobList) {
	path := fts.GetCurrentId()
	if strings.Contains(path, ":") {
		path = strings.Split(path, ":")[0]
	}
	obj, err := fts.GetObjectById(path)
	if err != nil {
		return
	}
	global.FileMgr(obj).Remove(obj.(fd.Filenamer).Filename())
	jl.Reset()
	MenuEditPost(menu, fts, jl)
}
开发者ID:axel-freesp,项目名称:sge,代码行数:13,代码来源:menufile.go

示例3: editCopy

func editCopy(fts *models.FilesTreeStore, clp *gtk.Clipboard) {
	var buf []byte
	obj, err := fts.GetObjectById(fts.GetCurrentId())
	if err != nil {
		log.Printf("editCopy error: %s\n", err)
		return
	}
	buf, err = obj.(gr.XmlCreator).CreateXml()
	if err != nil {
		log.Printf("editCopy error: %s\n", err)
		return
	}
	clp.SetText(string(buf))
}
开发者ID:axel-freesp,项目名称:sge,代码行数:14,代码来源:menuedit.go

示例4: editDelete

func editDelete(menu *GoAppMenu, fts *models.FilesTreeStore, jl IJobList, ftv *views.FilesTreeView) {
	defer MenuEditPost(menu, fts, jl)
	job := DeleteObjectJobNew(fts.GetCurrentId())
	state, ok := jl.Apply(EditorJobNew(JobDeleteObject, job))
	if ok {
		global.win.graphViews.Sync()
		path, err := gtk.TreePathNewFromString(state.(string))
		if err != nil {
			log.Println("editNew error: TreePathNewFromString failed:", err)
			return
		}
		ftv.TreeView().ExpandToPath(path)
		ftv.TreeView().SetCursor(path, ftv.TreeView().GetExpanderColumn(), false)
	}
}
开发者ID:axel-freesp,项目名称:sge,代码行数:15,代码来源:menuedit.go

示例5: ParseText

func ParseText(text string, fts *models.FilesTreeStore) (job *EditorJob, err error) {
	var parent tr.TreeElementIf
	context := fts.GetCurrentId()
	if len(context) == 0 {
		err = fmt.Errorf("NewElementJob.ParseText TODO: Toplevel elements not implemented")
		return
	}
	parent, err = fts.GetObjectById(context)
	if err != nil {
		return
	}
	var ok bool
	var j *PasteJob
	switch parent.(type) {
	case bh.SignalGraphIf:
		j, ok = parseNode(text, context, parent.(bh.SignalGraphIf).ItsType())
		if ok {
			job = EditorJobNew(JobPaste, j)
			//log.Printf("NewElementJob.ParseText: successfully parsed SignalGraphIf\n")
			return
		}

	case bh.SignalGraphTypeIf:
		j, ok = parseNode(text, context, parent.(bh.SignalGraphTypeIf))
		if ok {
			job = EditorJobNew(JobPaste, j)
			//log.Printf("NewElementJob.ParseText: successfully parsed SignalGraphTypeIf\n")
			return
		}

	case bh.NodeIf:
		j, ok = parseNode(text, getParentId(context), parent.(bh.NodeIf).Context())
		if ok {
			job = EditorJobNew(JobPaste, j)
			//log.Printf("NewElementJob.ParseText: successfully parsed NodeIf\n")
			return
		}

	case bh.NodeTypeIf:
		j, ok = parseNodeType(text, getParentId(context))
		if ok {
			job = EditorJobNew(JobPaste, j)
			//log.Printf("NewElementJob.ParseText: successfully parsed NodeTypeIf\n")
			return
		}

	case bh.PortIf:

	case bh.PortTypeIf:

	case bh.ConnectionIf:

	case bh.SignalTypeIf:
		j, ok = parseSignalType(text, getParentId(context))
		if ok {
			job = EditorJobNew(JobPaste, j)
			//log.Printf("NewElementJob.ParseText: successfully parsed SignalTypeIf\n")
			return
		}

	case bh.LibraryIf:
		j, ok = parseNodeType(text, context)
		if ok {
			job = EditorJobNew(JobPaste, j)
			log.Printf("NewElementJob.ParseText: successfully parsed NodeTypeIf\n")
			return
		}
		j, ok = parseSignalType(text, context)
		if ok {
			job = EditorJobNew(JobPaste, j)
			log.Printf("NewElementJob.ParseText: successfully parsed SignalTypeIf\n")
			return
		}

	case bh.ImplementationIf:

	default:
		err = fmt.Errorf("NewElementJob.ParseText error: can't insert to context %T", parent)
		return
	}

	err = fmt.Errorf("NewElementJob.ParseText error: function not implemented")
	return
}
开发者ID:axel-freesp,项目名称:sge,代码行数:84,代码来源:pastejob.go


注:本文中的github.com/axel-freesp/sge/models.FilesTreeStore.GetCurrentId方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。