Example #1
0
        protected TableItem(string path, DirectoryItemStyler styler, string type)
            : base(NSObject.AllocAndInitInstance(type))
        {
            m_path = path;
            m_canonicalPath = UnixPath.GetCanonicalPath(path);
            m_styler = styler;

            DoRefreshName();

            Broadcaster.Register("directory prefs changed", this);
        }
Example #2
0
 public FileItem(string path, DirectoryItemStyler styler)
     : base(path, styler, "FileItem")
 {
     Reload(null);
 }
Example #3
0
 public FolderItem(string path, DirectoryItemStyler styler, DirectoryController controller)
     : base(path, styler, "FolderItem")
 {
     m_controller = controller;
 }
        public DirectoryController(string path)
            : base(NSObject.AllocAndInitInstance("DirectoryController"))
        {
            m_boss = ObjectModel.Create("DirectoryEditor");
            m_path = path;
            m_dirStyler = new DirectoryItemStyler(path);

            Unused.Value = NSBundle.loadNibNamed_owner(NSString.Create("directory-editor"), this);
            m_table = new IBOutlet<NSOutlineView>(this, "table").Value;
            m_targets = new IBOutlet<NSPopUpButton>(this, "targets").Value;
            m_prefs = new IBOutlet<DirPrefsController>(this, "prefsController");

            m_name = System.IO.Path.GetFileName(path);
            window().setTitle(NSString.Create(m_name));
            Unused.Value = window().setFrameAutosaveName(NSString.Create(window().title().ToString() + " editor"));
            window().makeKeyAndOrderFront(this);

            m_table.setDoubleAction("doubleClicked:");
            m_table.setTarget(this);

            var wind = m_boss.Get<IWindow>();
            wind.Window = window();

            m_builder = new GenericBuilder(path);

            m_targets.removeAllItems();
            if (m_builder.CanBuild)
            {
                var handler = m_boss.Get<IMenuHandler>();
                handler.Register(this, 50, this.DoBuild, this.DoBuildEnabled);
                handler.Register(this, 51, this.DoBuildVariables, this.DoHaveBuilder);
                handler.Register(this, 52, this.DoBuildFlags, this.DoHaveBuilder);
                handler.Register(this, 599, () => m_builder.Cancel(), this.DoCancelEnabled);
                handler.Register(this, 1000, this.DoShowPrefs);

                DoLoadPrefs(path);
                Broadcaster.Register("global ignores changed", this);
                Broadcaster.Register("finished building", this);
                DoUpdateTargets(string.Empty, null);
            }
            else
                DoLoadPrefs(path);

            m_root = new FolderItem(m_path, m_dirStyler, this);
            m_table.reloadData();

            m_watcher = DoCreateWatcher(path);
            if (m_watcher != null)
                m_watcher.Changed += this.DoDirChanged;

            //			m_watcher = new FileSystemWatcher(path);
            //			m_watcher.IncludeSubdirectories = true;
            //			m_watcher.Created += this.DoDirChanged;
            //			m_watcher.Deleted += this.DoDirChanged;
            //			m_watcher.Renamed += this.DoDirChanged;

            foreach (IOpened open in m_boss.GetRepeated<IOpened>())
            {
                open.Opened();
            }
            Broadcaster.Invoke("opened directory", m_boss);

            ActiveObjects.Add(this);
        }