home *** CD-ROM | disk | FTP | other *** search
- // PBBundleHost.h - Functionality available to ProjectBuilder extension bundles
- //
- // Copyright (c) 1995, 1996, NeXT Software, Inc.
- // All rights reserved.
-
- #import <AppKit/AppKit.h>
- #import "PBSystem.h"
-
- // PB Bundle Loading
- // At launch time, a single PBBundleHost inside ProjectBuilder attempts to
- // load all bundle wrappers specified in the user's preferences (ProjectBuilder's
- // "BundlesLoadedAtLaunch" preference). Functionality in these bundles can be
- // registered with the application via calls made from bundle initialization
- // method - the preferred method is +initialize on the bundle's principal class,
- // since +load can be fired too early before NSBundle methods are guaranteed to
- // work. These calls should be made to the PBBundleHost, which is accessible as NSApp.
-
- // PB SCM Integration
- // The PBBundleHost can host bundles of any sort. However, it is especially useful
- // for loading interfaces to Software Configuration Management systems, such as CVS.
- // The PBBundleHost interface was explicitly designed with this capability in mind.
- // To register an implementer of the PBConfigManager protocol, call
- // registerConfigManager: on the PBBundleHost. Bundles providing a ConfigManager
- // are encouraged to also register a series of project- and file-specific
- // operations in PB's menus and provide an inspector panel. Preferences specific
- // to the integration can be managed with a preferences panel registered with the
- // PBBundleHost.
-
- @protocol PBConfigManager <NSObject>
- - (BOOL) managesPath: (NSString *) path;
- // Should return YES iff this bundle can grant the user write permission to
- // path under normal circumstances. Should be a cheap call to just check
- // if calling the following more expensive method has a chance in succeeding.
-
- - (BOOL) makePathWritable: (NSString *) path;
- // This actually requests the per-file "check out" from the SCM system.
- // Called when a file transitions from saved to unsaved (dirty) state and
- // the associated file is read only. Should return YES if file was made
- // writable to PB.
- @end
-
- // PB Panel Controllers
- // The PBBundleHost will inform controllers of inspector and preference views that
- // they are in need of refreshing their contents. This might happen on initial
- // exposure of the panel or if relevant data affecting the browser changes
- // (e.g. the selected file/project, in the case of the inspector).
-
- @interface PBInspectorController : NSObject
- {
- NSWindow *window;
- NSView *contentView;
- id tool;
- }
- - (NSString *) inspectorName;
- // Name that will appear on pop-up to select this panel.
- - (NSView *)contentView;
- // Lazily called to provide panel as needed.
- - (void)revert;
- // Called when panel displayed or relevant data changes (e.g. selectedFile)
- @end
-
- // Preferences specific to the operation of a PB Bundle can be managed
- // and storing preferences as a sub-dictionary of PB's preferences, such as:
- // [[NSUserDefaults standardUserDefaults] persistentDomainForName: @"MyConfigMgr"]
-
- @interface PBPreferenceController : NSObject
- {
- NSWindow *window;
- NSView *contentView;
- id prefController;
- }
- - (NSString *) viewName;
- - (NSView *)contentView;
- - (void)revert;
- @end
-
-
- @protocol PBBundleHost
- // Register bundle functionality
- - (BOOL) registerConfigManager: (id<PBConfigManager>) configManager;
- - (BOOL) registerProjectSubmenu: (NSMenu *) menu;
- - (BOOL) registerFileSubmenu: (NSMenu *) menu;
- - (BOOL) registerInspectorController: (PBInspectorController *) inspector;
- - (BOOL) registerPreferenceController: (PBPreferenceController*) prefPanel;
-
- // Query app's state:
- - (NSString*) selectedProjectName;
- // Returns name (as set in inspector panel) of the active project
- - (NSString*) selectedProject;
- // Returns path to currently active project or nil if none.
- - (NSString*) currentlyActiveFile;
- // Returns path to currently active file or nil if none. This is the file
- // that would receive key events from the user typing.
- - (NSArray*) selectedFiles;
- // Returns array of paths for all currently selected files or nil if none.
- - (NSArray*) dirtiedFiles;
- // Returns array of paths of files (including PB.project files)
- // that are "unsaved".
-
- // Change app's state:
- - (BOOL) openFileOrProject: (NSString *) path;
- // equivalent to using Cmd-D and typing in path
- - (BOOL) revertPath: (NSString *) path;
- // Revert file or all files under directory named by path.
- // If files have been modified releative to a loaded buffer, the user
- // will be prompted to have the files re-loaded into PB.
- // Returns YES on successful reload.
- - (BOOL) queryDirtiedFiles;
- // Prompts user to save all files and projects with dirtied buffers.
- // Returns YES if any files were saved.
- - (NSTextView*) viewForFile: (NSString *) path;
- // Calls openFileOrProject: on path if not already loaded.
- // Returns nil if file could not be loaded as text. This
- // allows access to the underlying file contents, the selection, and
- // the associated NSTextStorage. Files can be edited programmatically
- // this way.
-
- // Project editing:
- - (BOOL) addFileWithPath: (NSString *) filePath
- toProject: (NSString *) projectPath;
- - (BOOL) removeFileFromProject: (NSString *) filePath;
- @end
-
- // PB Notifications
- // The following notifications can be observed by PB Bundles from the
- // [NSNotificationCenter defaultCenter]. The following notification names
- // may be used. The object provided in the subscription to the notification
- // should be nil to get all notifications or an NSString containing the path
- // to the file or "PB.project" project file in which the observer is specifically
- // interested. The object of the notifications is an NSString containing the
- // path of the referenced file or project.
-
- // The following four notifications are only sent for top-level projects.
- PB_EXTERN NSString * PBProjectWillOpenNotification;
- PB_EXTERN NSString * PBProjectDidOpenNotification;
-
- PB_EXTERN NSString * PBProjectWillCloseNotification;
- PB_EXTERN NSString * PBProjectDidCloseNotification;
-
- PB_EXTERN NSString * PBFileWillOpenNotification;
- PB_EXTERN NSString * PBFileDidOpenNotification;
-
- PB_EXTERN NSString * PBFileWillCloseNotification;
- PB_EXTERN NSString * PBFileDidCloseNotification;
-
- PB_EXTERN NSString * PBFileDidChangeNotification;
- PB_EXTERN NSString * PBFileWillSaveNotification;
- PB_EXTERN NSString * PBFileDidSaveNotification;
- PB_EXTERN NSString * PBFileSaveDidFailNotification;
- PB_EXTERN NSString * PBFileDirtiedNotification; // File transitioned from saved to unsaved
- PB_EXTERN NSString * PBFileWillRevertNotification;
- PB_EXTERN NSString * PBFileDidRevertNotification;
- PB_EXTERN NSString * PBFileDeletedNotification;
- PB_EXTERN NSString * PBFileRenamedNotification;
-
- PB_EXTERN NSString * PBProjectBuildWillBeginNotification;
- PB_EXTERN NSString * PBProjectBuildDidBeginNotification;
- PB_EXTERN NSString * PBProjectBuildDidSucceedNotification;
- PB_EXTERN NSString * PBProjectBuildDidFailNotification;
- PB_EXTERN NSString * PBProjectBuildDidStopNotification;
-
- PB_EXTERN NSString * PBSelectedProjectDidChangeNotification;
- PB_EXTERN NSString * PBSelectedFileDidChangeNotification;
-
-
-