/// /// Copyright © 2003-2008 JetBrains s.r.o. /// You may distribute under the terms of the GNU General Public License, as published by the Free Software Foundation, version 2 (see License.txt in the repository root folder). /// using System; namespace JetBrains.Omea.OpenAPI { /// /// Allows to exclude certain link types, links and links pane actions from the links /// pane for a specific resource. /// /// /// A links pane filter can be registered for a resource type, or applied on an ad-hoc /// basis for displaying a specific resource. Only one links pane filter can be active /// at the same time. /// public interface ILinksPaneFilter { /// /// Allows to hide all links of a specified type, or to change the display name for /// a link type shown in the links pane. /// /// Currently displayed resource. /// ID of the link type (negative for reverse links). /// Display name of the link type (can be changed). /// true if the link type should be displayed, false otherwise. bool AcceptLinkType( IResource displayedResource, int propId, ref string displayName ); /// /// Allows to hide a specific link from the links pane. /// /// Currently displayed resource. /// ID of the link type (negative for reverse links). /// Resource the link to which is displayed. /// Tooltip shown for the link label. /// true if the link should be displayed, false otherwise. bool AcceptLink( IResource displayedResource, int propId, IResource targetResource, ref string linkTooltip ); /// /// Allows to hide a specific action from the links pane. /// /// Currently displayed resource. /// The action displayed in the links pane. /// true if the action should be displayed, false otherwise. bool AcceptAction( IResource displayedResource, IAction action ); } /// /// The mode of auto-previewing items in a list. /// /// 2.0 public enum AutoPreviewMode { /// /// Auto-preview is not shown. /// Off, /// /// Auto-preview is shown for all items. /// AllItems, /// /// Auto-preview is shown for unread items. /// UnreadItems }; /// /// Configure the visibility of resource list and content panes. /// /// 3.0 public enum BrowserPanesVisibilityMode { ListOnly, ContentOnly, Both }; /// /// Manages the display of resources and resource lists in Omea. /// public interface IResourceBrowser: IContextProvider, ICommandProcessor { BrowserPanesVisibilityMode BrowserPanesMode { get; set; } /// /// Displays the specified resource in a full-height preview pane (with the /// resource list hidden). /// /// The resource to display. void DisplayResource( IResource res ); /// /// Displays the specified resource in a full-height preview pane (with the /// resource list hidden), and allows to control the action performed when the /// resource is deleted. /// /// The resource to display. /// If true, ResourceBrowser goes to the previous resource in the /// browse stack when the resource is deleted. If false, ResourceBrowser performs no additional /// action, which allows other components to handle the deletion. /// 2.0 void DisplayResource( IResource res, bool backOnDelete ); /// /// Displays the specified resource list. /// /// The resource on which the resource list is based /// (typically, the resource selected in the sidebar), or null if not applicable. /// The resource list to display. /// The caption of the resource list. /// The columns to use for displaying the list, or null if /// a default set of columns should be used. void DisplayResourceList( IResource ownerResource, IResourceList resList, string caption, ColumnDescriptor[] columns ); /// /// Displays the specified resource list and sets the selection on the specified resource. /// /// The resource on which the resource list is based /// (typically, the resource selected in the sidebar), or null if not applicable. /// The resource list to display. /// The caption of the resource list. /// The columns to use for displaying the list, or null if /// a default set of columns should be used. /// The resource which is selected in the list. void DisplayResourceList( IResource ownerResource, IResourceList resList, string caption, ColumnDescriptor[] columns, IResource selectedResource ); /// /// Displays the specified resource list, sets the selection on the specified resource /// and uses the specified provider for obtaining search result highlighting data. /// /// The resource on which the resource list is based /// (typically, the resource selected in the sidebar), or null if not applicable. /// The resource list to display. /// The caption of the resource list. /// The columns to use for displaying the list, or null if /// a default set of columns should be used. /// The resource which is selected in the list. /// The provider for the search result highlighting data. void DisplayResourceList( IResource ownerResource, IResourceList resList, string caption, ColumnDescriptor[] columns, IResource selectedResource, IHighlightDataProvider highlightProvider ); /// /// Displays the specified resource list with the specified display options. /// /// The resource on which the resource list is based /// (typically, the resource selected in the sidebar), or null if not applicable. /// The resource list to display. /// The parameters for displaying the resource list. /// 2.0 void DisplayResourceList( IResource ownerResource, IResourceList resList, ResourceListDisplayOptions options ); /// /// Displays the specified resource list with the specified display options and with /// additional options defined by the properties of the owner resource. /// /// The resource on which the resource list is based /// (typically, the resource selected in the sidebar), or null if not applicable. /// The resource list to display. /// The parameters for displaying the resource list. /// 2.0 void DisplayConfigurableResourceList( IResource ownerResource, IResourceList resList, ResourceListDisplayOptions options ); /// /// Displays a resource list in a threaded (hierarchical) view. /// /// The resource on which the resource list is based /// (typically, the resource selected in the sidebar), or null if not applicable. /// The resource list to display. /// The caption of the resource list. /// The space-separated list of property names by which the /// resource list is sorted. /// The ID of a directed link property which links a reply to /// its original resource. /// The columns to use for displaying the list, or null if /// a default set of columns should be used. /// The resource which is selected in the list. void DisplayThreadedResourceList( IResource ownerResource, IResourceList resList, string caption, string sortProp, int replyProp, ColumnDescriptor[] columns, IResource selectedResource ); /// /// Displays the specified resource list without applying tab or workspace filters. /// /// The resource on which the resource list is based /// (typically, the resource selected in the sidebar), or null if not applicable. /// The resource list to display. /// The caption of the resource list. /// The columns to use for displaying the list, or null if /// a default set of columns should be used. void DisplayUnfilteredResourceList( IResource ownerResource, IResourceList resList, string caption, ColumnDescriptor[] columns ); /// /// Displays the conversation of resources linked to the specified resource. /// /// The resource which is a part of a conversation. /// The standard "Reply" link is used to get the replies of resources. void DisplayConversation( IResource res ); /// /// Registers a callback which allows to display a different resource in the display pane /// when a specific resource is selected in the resource browser. /// /// The resource type for which the forwarder is registered. /// The forwarder callback. /// The callback is currently used for Web link resources. The resource which /// is selected in the resource browser is the Web link resource, and the resource which /// is actually displayed is its content resource (HtmlFile, for example). void RegisterResourceDisplayForwarder( string resType, ResourceDisplayForwarderCallback forwarder ); /// /// Refreshes the resource currently displayed in the resource browser. /// /// The method works both for resources selected in a full-height preview /// pane and for the selected resource when a resource list is displayed. void RedisplaySelectedResource(); /// /// Sets the focus to the resource list control. /// void FocusResourceList(); /// /// Adds an information link label above the resource list. /// /// The text to be displayed. /// The handler to execute when the text is clicked. /// If not null, the text is displayed as a clickable link. void AddStatusLine( string text, EventHandler clickHandler ); /// /// Hides the information label above the resource list. /// void HideStatusLine(); /// /// Shows the See Also bar and populates it with links to resources in the /// specified resource list. /// /// The resource list for which the See Also links are displayed. void ShowSeeAlsoBar( IResourceList resList ); /// /// Shows the See Also bar and populates it with links to resources in the /// specified resource list. /// /// The resource list for which the See Also links are displayed. /// Indicates whether the resource list is necessary to be filtered /// with deleted resources. /// 2.1 void ShowSeeAlsoBar( IResourceList resList, bool prepared ); /// /// Sets the selection in the resource list to the specified resource. /// /// The resource to select. /// true if the resource was selected successfully, false if it was /// not found in the list. bool SelectResource( IResource res ); /// /// Begins the in-place editing of the specified resource. /// /// The resource to edit. /// For the in-place editing to work, a /// resource UI handler must be registered /// for the resource. void EditResourceLabel( IResource res ); /// /// Expands the specified conversation node. /// /// The resource to expand. /// The method will not work if the resource is not a root node of a /// conversation but a reply to another resource, and the root of the thread /// has never been expanded. void ExpandConversation( IResource res ); /// /// Shows the URL bar and the URL edit box with the specified URL. /// /// The URL to display in the URL edit box. void ShowUrlBar( string url ); /// /// Begins a batch update of the resource browser. /// /// /// The toolbar, URL bar and status line of the browser are not updated while /// a batch update is in progress. void BeginUpdate(); /// /// Ends a batch update of the resource browser. /// /// /// The toolbar, URL bar and status line of the browser are not updated while /// a batch update is in progress. void EndUpdate(); /// /// Registers a links pane filter which is used for all resources of the specified type. /// /// Type for which the filter is registered. /// The filter instance. void RegisterLinksPaneFilter( string resourceType, ILinksPaneFilter filter ); /// /// Registers a group of link types in the links pane. /// /// The ID of the group. /// List of link type IDs (positive only) which are included in the group. /// Position of the group relative to other groups. /// If a group with the same ID has already been registered, the new property types /// are appended to the property types which were previously registered for the group. void RegisterLinksGroup( string groupId, int[] propTypes, ListAnchor anchor ); /// /// Returns the resource which is displayed above the specified resource /// in the resource list. /// /// The resource for which the previous resource is requested. /// The previous resource, or null if the specified resource is the /// first in the resource list or not displayed in the resource list at all. /// 2.0 IResource GetResourceAbove( IResource res ); /// /// Returns the resource which is displayed below the specified resource /// in the resource list. /// /// The resource for which the next resource is requested. /// The next resource, or null if the specified resource is the /// last in the resource list or not displayed in the resource list at all. /// 2.0 IResource GetResourceBelow( IResource res ); /// /// Returns the list of resources currently displayed in the resource browser. Note that "visible" does not imply on "items currently fitting on screen" or "items in the expanded threads", nor it concerns the items' rendering aspects in any way. /// IResourceList VisibleResources { get; } /// /// Returns the list of resources currently selected in the resource browser. /// IResourceList SelectedResources { get; } /// /// Returns the resource on which the currently displayed resource list is based. /// /// Returns the resource which was passed in the ownerResource parameter /// to one of the methods which display resource lists. IResource OwnerResource { get; } /// /// The resource list which is intersected with any resource list displayed in the browser. /// /// 2.0 IResourceList FilterResourceList { get; } /// /// The filter resource list which was used when the last resource list was displayed. /// /// 2.0 IResourceList LastFilterResourceList { get; } /// /// Returns the resource currently displayed in a full-height preview pane, or null /// if a resource list is currently displayed. /// IResource DisplayedResource { get; } /// /// Gets or sets the value indicating whether the resource browser is currently in /// the Web page layout mode. /// /// In the Web page mode, the URL bar is displayed, and the resource list, /// links pane and the regular toolbar are hidden. bool WebPageMode { get; set; } /// /// Controls the visible state of the links pane which is located to the right of the Preview area. /// bool LinksPaneExpanded { get; set; } /// /// Gets or sets the value indicating whether the resource list is currently collapsed. /// bool ResourceListExpanded { get; set; } /// /// Returns true if the resource browser is currently displaying a resource list, or false /// if a single resource or a newspaper is currently displayed. /// bool ResourceListVisible { get; } /// /// Returns true if the resource browser is currently displaying a resource list and /// it contains current focus. /// /// 2.1 bool ResourceListFocused { get; } /// /// Returns true if the resource browser is currently displaying a threaded resource list. /// /// 2.0 bool IsThreaded { get; } /// /// Returns true if the resource browser is currently displaying a newspaper. /// /// 2.0 bool NewspaperVisible { get; } /// /// Gets or sets the value indicating whether the annotation window is displayed automatically /// when an annotated resource is selected in the resource browser. /// bool ViewAnnotations{ get; set; } /// /// Starts editing the annotation of the specified resource. /// /// The resource for which the annotation should be edited. void EditAnnotation( IResource res ); /// /// Fired when the resource browser displays different content (content of a different /// resource in full-page mode, or a different resource list). /// event EventHandler ContentChanged; /// /// Selects the next unread item in the current view or in the next view which contains /// unread items. /// /// Whether there were unread items to be selected or not. /// 1.0.3 bool GotoNextUnread(); /// /// Goes to the previous item in the current browse stack. /// void GoBack(); /// /// Goes to the next item in the current browse stack. /// void GoForward(); /// /// Sets the default view settings for a specified tab. /// /// The ID of the tab for which the settings are defined. /// The default auto-preview mode. /// The default preview pane layout. /// 2.0 void SetDefaultViewSettings( string tabId, AutoPreviewMode autoPreviewMode, bool verticalLayout ); } /// /// Specifies the options for displaying a resource list in the resource browser. /// /// 2.0 public class ResourceListDisplayOptions { private string _caption; private string _captionTemplate; private ColumnDescriptor[] _columns; private IResource _selectedResource; private IHighlightDataProvider _highlightDataProvider; private IResourceThreadingHandler _threadingHandler; private SortSettings _sortSettings; private bool _tabFilter = true; private bool _seeAlsoBar = false; private bool _suppressContexts = false; private bool _showNewspaper = false; private string _statusLine; private EventHandler _statusLineClickHandler; private string _emptyText; private IResource _transientContainerParent; private string _transientContainerPaneId; private bool _defaultGroupItems = true; public ResourceListDisplayOptions() { } public ResourceListDisplayOptions( ResourceListDisplayOptions options ) { _caption = options.Caption; _captionTemplate = options.CaptionTemplate; _columns = options.Columns; _selectedResource = options.SelectedResource; _highlightDataProvider = options.HighlightDataProvider; _threadingHandler = options.ThreadingHandler; _sortSettings = options.SortSettings; _tabFilter = options.TabFilter; _seeAlsoBar = options.SeeAlsoBar; _suppressContexts = options.SuppressContexts; _statusLine = options.StatusLine; _statusLineClickHandler= options.StatusLineClickHandler; _emptyText = options.EmptyText; _transientContainerPaneId = options._transientContainerPaneId; _transientContainerParent = options._transientContainerParent; } /// /// Gets or sets the caption to display for the resource list. /// public string Caption { get { return _caption; } set { _caption = value; } } /// /// Gets or sets the template of the caption to display for the resource list. /// The string "%OWNER%" in the template is replaced with the display name of the owner resource. /// public string CaptionTemplate { get { return _captionTemplate; } set { _captionTemplate = value; } } /// /// Gets or sets the columns to display for the resource list. /// public ColumnDescriptor[] Columns { get { return _columns; } set { _columns = value; } } /// /// Gets or sets the resource which is initially selected in the list. /// public IResource SelectedResource { get { return _selectedResource; } set { _selectedResource = value; } } /// /// Gets or sets the highlight data provider which is used to highlight found /// words and display contexts for search results. /// public IHighlightDataProvider HighlightDataProvider { get { return _highlightDataProvider; } set { _highlightDataProvider = value; } } /// /// Gets or sets the threading handler which is used to build a threading tree /// in the displayed resource list. If not set, a plain resource list is displayed. /// public IResourceThreadingHandler ThreadingHandler { get { return _threadingHandler; } set { _threadingHandler = value; } } /// /// Gets or sets the settings for sorting the resource list. /// public SortSettings SortSettings { get { return _sortSettings; } set { _sortSettings = value; } } /// /// Gets or sets the value indicating whether the resource list to display is /// intersected with the tab and workspace filter list. /// public bool TabFilter { get { return _tabFilter; } set { _tabFilter = value; } } /// /// Gets or sets the value indicating whether the see-also bar is displayed /// above the resource list. /// public bool SeeAlsoBar { get { return _seeAlsoBar; } set { _seeAlsoBar = value; } } /// /// Gets or sets the value indicating whether the contexts are not shown even if a valid /// highlight data provider is specified in the options. /// public bool SuppressContexts { get { return _suppressContexts; } set { _suppressContexts = value; } } /// /// Gets or sets the value indicating whether the resource list is shown as a newspaper. /// public bool ShowNewspaper { get { return _showNewspaper; } set { _showNewspaper = value; } } /// /// Gets or sets the text of the status line which is displayed above the resource list /// in the resource browser. /// public string StatusLine { get { return _statusLine; } set { _statusLine = value; } } /// /// Gets or sets the click handler which is called when the resource browser status line /// is clicked. /// public EventHandler StatusLineClickHandler { get { return _statusLineClickHandler; } set { _statusLineClickHandler = value; } } /// /// The text displayed in the resource browser when the list is empty. /// public string EmptyText { get { return _emptyText; } set { _emptyText = value; } } /// /// Returns the parent for the transient container which is selected when the resource /// list is displayed. /// public IResource TransientContainerParent { get { return _transientContainerParent; } } /// /// Returns the pane containing the transient container which is selected when the resource /// list is displayed. /// public string TransientContainerPaneId { get { return _transientContainerPaneId; } } /// /// Specifies that a transient container should be created for displaying the resource /// list, and deleted when the user switches to another view. /// /// The parent for the transient container resource. /// The ID of the pane in which the transient container resource is selected. public void SetTransientContainer( IResource parent, string paneId ) { _transientContainerParent = parent; _transientContainerPaneId = paneId; } /// /// Specifies whether item grouping is by default enabled in the view. True by default. /// public bool DefaultGroupItems { get { return _defaultGroupItems; } set { _defaultGroupItems = value; } } } /// /// Allows to substitute a different resource to show in the display pane when /// a resource is selected in the resource browser. /// public delegate IResource ResourceDisplayForwarderCallback( IResource res ); /// /// Allows to specify a custom text representation for a resource property. /// public delegate string PropertyToTextCallback( IResource res, int propId ); /// /// Allows to specify a custom text representation for a resource property, depending /// on the space available for displaying the property value in the list. /// /// 2.0 public delegate string PropertyToTextCallback2( IResource res, int propId, int widthInChars ); }