Ejemplo n.º 1
0
        private void DoOpen(AssemblyItem item)
        {
            string text = item.GetText();
            if (text.Length > 0)
            {
                Boss boss = ObjectModel.Create("FileSystem");
                var fs = boss.Get<IFileSystem>();
                string file = fs.GetTempFile(item.Label.Replace(".", string.Empty), item.Extension());

                try
                {
                    using (StreamWriter writer = new StreamWriter(file))
                    {
                        writer.WriteLine("{0}", text);
                    }

                    boss = ObjectModel.Create("Application");
                    var launcher = boss.Get<ILaunch>();
                    launcher.Launch(file, -1, -1, 1);
                }
                catch (Exception e)		// can sometimes land here if too many files are open (max is system wide and only 256)
                {
                    NSString title = NSString.Create("Couldn't process '{0}'.", file);
                    NSString message = NSString.Create(e.Message);
                    Unused.Value = Functions.NSRunAlertPanel(title, message);
                }
            }
            else
            {
                Functions.NSBeep();
            }
        }
Ejemplo n.º 2
0
 private void DoGetInfo(AssemblyItem item)
 {
     string text = item.GetInfo();
     if (text.Length > 0)
         DoShowInfo(text, item.Label);
     else
         Functions.NSBeep();
 }
Ejemplo n.º 3
0
 public NSObject outlineView_objectValueForTableColumn_byItem(NSOutlineView table, NSTableColumn col, AssemblyItem item)
 {
     return NSString.Create(item.Label);
 }
Ejemplo n.º 4
0
 public int outlineView_numberOfChildrenOfItem(NSOutlineView table, AssemblyItem item)
 {
     if (item == null)
         if (m_doc.Resources.ChildCount > 0)
             return 1 + m_doc.Namespaces.Length;
         else
             return m_doc.Namespaces.Length;
     else
         return item.ChildCount;
 }
Ejemplo n.º 5
0
 public bool outlineView_isItemExpandable(NSOutlineView table, AssemblyItem item)
 {
     if (item == null)
         return true;
     else
         return item.ChildCount > 0;
 }
Ejemplo n.º 6
0
 public NSObject outlineView_child_ofItem(NSOutlineView table, int index, AssemblyItem item)
 {
     if (item == null)
     {
         if (m_doc.Resources.ChildCount > 0)
         {
             if (index == 0)
                 return m_doc.Resources;
             else
                 return m_doc.Namespaces[index - 1];
         }
         else
         {
             return m_doc.Namespaces[index];
         }
     }
     else
         return item.GetChild(index);
 }