當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。