Esempio n. 1
0
 public WorkspacesBrowserDlg(P4ScmProvider scm, string sender,
                             string integAction, IList <P4.Client> streamsWorkspaces)
 {
     PreferenceKey = "WorkspacesBrowserDlg";
     Scm           = scm;
     InitializeComponent();
     this.Icon = Images.workspace;
     workspaceToolWindowControl1.Scm = scm;
     if (sender.Contains("//"))
     {
         workspaceToolWindowControl1.integAction       = integAction;
         workspaceToolWindowControl1.stream            = sender;
         workspaceToolWindowControl1.streamsWorkspaces = streamsWorkspaces;
     }
     if (sender == "connection")
     {
         workspaceToolWindowControl1.sentOwner = scm.Connection.User;
         workspaceToolWindowControl1.hostOnly  = true;
     }
     if (sender == "get_revision")
     {
         workspaceToolWindowControl1.sentOwner = scm.Connection.User;
         workspaceToolWindowControl1.hostOnly  = false;
     }
     if (sender == "diff_against")
     {
         workspaceToolWindowControl1.sentOwner = scm.Connection.User;
         workspaceToolWindowControl1.hostOnly  = false;
     }
 }
Esempio n. 2
0
        public P4ToolWindowControlBase(P4ScmProvider scm)
        {
            Scm = scm;

            newConection = new P4VsProvider.NewConnectionDelegate(NewConnection);
            P4VsProvider.NewConnection += newConection;
        }
Esempio n. 3
0
        public void NewConnection(P4ScmProvider newScm)
        {
            // save settings for the old connection
            if ((Scm != newScm) && (Scm != null) && (Scm.Connected))
            {
                SaveControlSettings();
            }

            Scm = newScm;

            // clear the cached annotated preference key
            _preferenceKey = null;

            // load settings for the new connection
            if ((Scm != null) && (Scm.Connected))
            {
                // set the clm widths based on the new connection
                Initialize();
            }

            // call the overridden function in the derived class
            this.OnNewConnection(newScm);

            // load settings for the new connection
            if ((Scm != null) && (Scm.Connected))
            {
                // set the clm widths based on the new connection
                Initialize();
            }
        }
Esempio n. 4
0
        private void BrowseWorkspaceBtn_Click(object sender, EventArgs e)
        {
            this.TopMost = false;

            P4ScmProvider _scm = new P4ScmProvider(null);

            _scm.Connection.Port = ServerPort;
            _scm.Connection.User = UserName;

            _scm.Connection.Connect(true, null, true);
            if (_scm.Connected && _scm.Connection.isLoggedIn())
            {
                WorkspacesBrowserDlg dlg = new WorkspacesBrowserDlg(_scm, "connection", null, null);
                dlg.TopMost = true;

                if (DialogResult.Cancel != dlg.ShowDialog())
                {
                    if ((dlg.SelectedWorkspace != null) && (dlg.SelectedWorkspace.Name != null))
                    {
                        WorkspaceTB.Text = dlg.SelectedWorkspace.Name.ToString();
                    }
                }
                _scm.Dispose();
            }
            this.TopMost = true;
        }
Esempio n. 5
0
        public P4ToolWindowControlBase()
        {
            Scm = P4VsProvider.CurrentScm;

            newConection = new P4VsProvider.NewConnectionDelegate(NewConnection);
            P4VsProvider.NewConnection += newConection;
        }
Esempio n. 6
0
        public string getStream()
        {
            try
            {
                if (_StreamclientChecked)
                {
                    return(_Streamclient);
                }
                _StreamclientChecked = true;

                P4ScmProvider scm = P4VsProvider.CurrentScm;

                if (scm.Connection.Disconnected)
                {
                    _Streamclient = null;
                    return(_Streamclient);
                }

                P4.Client current = scm.getClient(scm.Connection.Workspace.ToString(), null);

                if (current.Stream != null)
                {
                    _Streamclient = current.Stream;
                    return(_Streamclient);
                }
            }
            catch (Exception ex)
            {
                logger.Trace("Error in P4Vversion(), {0}: \r\n{1}", ex.Message, ex.StackTrace);
            }
            _Streamclient = null;
            return(_Streamclient);
        }
Esempio n. 7
0
        public FileHistoryDialog(P4ScmProvider scm)
        {
            PreferenceKey = "FileHistoryDialog";

            InitializeComponent();
            sccHistoryToolWindowControl1.Scm = scm;
        }
Esempio n. 8
0
        public bool exists()
        {
            try
            {
                if (_StreamexistsChecked)
                {
                    return(_Streamexists);
                }
                _StreamexistsChecked = true;

                P4ScmProvider scm = P4VsProvider.CurrentScm;

                IList <P4.Depot> depots = scm.GetDepots();

                foreach (P4.Depot depot in depots)
                {
                    if (depot.Type == P4.DepotType.Stream)
                    {
                        _Streamexists = true;;
                        return(_Streamexists);
                    }
                }

                _Streamexists = false;
                return(_Streamexists);
            }
            catch (Exception ex)
            {
                logger.Trace("Error in Streamexists(), {0}: \r\n{1}", ex.Message, ex.StackTrace);

                _Streamexists = false;
                return(_Streamexists);
            }
        }
Esempio n. 9
0
        public override void OnNewConnection(P4ScmProvider newScm)
        {
            if ((newScm != null) && (newScm.Connected))
            {
                IList <string> urls = newScm.GetProperties("Swarm.URL");
                if ((urls == null) || (urls.Count <= 0))
                {
                    string msg = string.Format("No Url for Swarm configured on {0}\r\n\r\n Please enter the Url for Swarm", newScm.Connection.Port);
                    MessageBox.Show(msg, Resources.P4VS);
                    SwarmUrlCB.Text = string.Empty;
                    SwarmBrowser.Navigate("about:blank");
                }
                else
                {
                    foreach (string url in urls)
                    {
                        SwarmUrlCB.Items.Add(url);
                    }
                    SwarmUrlCB.SelectedIndex = 0;

                    SwarmBrowser.Navigate(SwarmUrlCB.Items[0] as string);
                }
            }
            else
            {
                SwarmUrlCB.Text = string.Empty;
                SwarmBrowser.Navigate("about:blank");
            }
        }
Esempio n. 10
0
        public ResolveFileDlg(P4ScmProvider scm)
        {
            PreferenceKey = "ResolveFileDlg";

            _scm = scm;

            InitializeComponent();

            this.Icon = Images.icon_p4vs_16px;
            resolveFileInteractiveControl1.Scm = scm;
            resolveFileAutoControl1.Scm        = scm;
            resolveFileActionControl1.Scm      = scm;

            SelectionCountLblTxt = SelectionCountLbl.Text;

            SelectionCountLbl.Text = string.Format(SelectionCountLblTxt,
                                                   0, (FileList.Items != null) ? FileList.Items.Count : 0);

            resolveFileAutoControl1.Visible        = true;
            resolveFileInteractiveControl1.Visible = false;
            resolveFileActionControl1.Visible      = false;

            resolveFileAutoControl1.UpdateListView        = new InitFileListViewDelegate(InitFileListView);
            resolveFileInteractiveControl1.UpdateListView = new InitFileListViewDelegate(InitFileListView);
            resolveFileActionControl1.UpdateListView      = new InitFileListViewDelegate(InitFileListView);

            resolveFileAutoControl1.SelectedMethod = (ResolveFileAutoControl.AutoResolveMethod)Preferences.LocalSettings.Get("DefaultUatoMergeMethod", ResolveFileAutoControl.AutoResolveMethod.Safe);

            MergeBinaryCB.Checked = Preferences.LocalSettings.GetBool("ReolveDialog.MergeBinaryCB.Checked", false);
        }
Esempio n. 11
0
        /// <summary>
        /// Create a directory map from the output of a 'dirs' command
        /// </summary>
        /// <param name="pserver">Perforce server</param>
        /// <param name="Workspace">Active workspace, if any</param>
        /// <param name="parent">Parent directory for all the directories in the map</param>
        /// <param name="dirsOutput">Output from a 'dirs' command</param>
        /// <returns>THe list of P4Directories</returns>
        public static P4DirectoryMap FromDirsOutput(P4ScmProvider scm, Client Workspace, P4Directory parent, IList <string> dirsOutput)
        {
            if (dirsOutput == null || dirsOutput.Count < 1)
            {
                return(null);
            }

            P4DirectoryMap value = new P4DirectoryMap();

            foreach (string path in dirsOutput)
            {
                int badIdx = path.IndexOf('\\');

                if (badIdx < 0)
                {
                    P4Directory dir = new P4Directory(scm, Workspace, path, null, parent);
                    value[dir.Name] = dir;
                    dir.InDepot     = true;
                    dir.InWorkspace = false;                     // won't know till later
                }
                else
                {
                    badIdx = 0;
                }
            }
            return(value);
        }
Esempio n. 12
0
 public P4.Group Show(P4ScmProvider scm)
 {
     if (this.DialogResult == DialogResult.OK)
     {
         return(SelectedGroup);
     }
     return(null);
 }
Esempio n. 13
0
 public P4.User Show(P4ScmProvider scm)
 {
     if (this.DialogResult == DialogResult.OK)
     {
         return(SelectedUser);
     }
     return(null);
 }
Esempio n. 14
0
        public SwarmReviewsBrowserDlg(P4ScmProvider scm)
        {
            InitializeComponent();

            swarmReviewsToolWindowControl1.Scm = scm;

            swarmReviewsToolWindowControl1.ReviewsLVDoubleClicked += new EventHandler(swarmReviewsToolWindowControl1_ReviewsLV_DoubleClick);
        }
Esempio n. 15
0
        public UsersBrowserDlg(P4ScmProvider scm, string sender)
        {
            PreferenceKey = "UsersBrowserDlg";

            Scm = scm;
            InitializeComponent();

            if (components == null)
            {
                components = new Container();
            }
            this.Icon = Images.icon_p4vs_16px;

            imageList1 = new System.Windows.Forms.ImageList(components);

            //
            // imageList1
            //
            imageList1.TransparentColor = System.Drawing.Color.Transparent;
            imageList1.Images.Add("users_icon.png", Images.users_icon);

            this.listView1.LargeImageList = this.imageList1;
            this.listView1.SmallImageList = this.imageList1;

            if (Scm != null)
            {
                IList <P4.User> users = Scm.GetUsers(null, null);
                foreach (P4.User user in users)
                {
                    string id = user.Id;

                    DateTime localAccess = user.Accessed;

                    // we need a pref for local time, until then, don't do this:
                    //DateTime localAccess = TimeZone.CurrentTimeZone.ToLocalTime(user.Accessed);
                    string access = "";
                    if (Preferences.LocalSettings.GetBool("P4Date_format", true))
                    {
                        access = localAccess.ToString("yyyy/MM/dd HH:mm:ss");
                    }
                    else
                    {
                        access = string.Format("{0} {1}", localAccess.ToShortDateString(),
                                               localAccess.ToShortTimeString());
                    }

                    string       lastAccessed = access;
                    string       email        = user.EmailAddress;
                    string       name         = user.FullName;
                    string[]     theUser      = new string[] { id, email, lastAccessed, name };
                    ListViewItem lvi          = new ListViewItem(theUser);
                    lvi.Tag        = user;
                    lvi.ImageIndex = 0;
                    listView1.Items.Add(lvi);
                }
            }
            ClosedByDoubleClick = false;
        }
Esempio n. 16
0
 public JobsBrowserDlg(P4ScmProvider scm)
 {
     Scm = scm;
     InitializeComponent();
     this.Icon = Images.job;
     jobsToolWindowControl1.Scm = scm;
     jobsToolWindowControl1.refreshJobsList();
     jobsToolWindowControl1.fromBrowser = true;
 }
Esempio n. 17
0
        public FileAttributesDlg(P4ScmProvider scm)
        {
            _scm = scm;

            InitializeComponent();
            this.Icon = Images.icon_p4vs_16px;
            BaseTypeCB.Items.Clear();

            //P4VsOutputWindow.AppendMessage("Server version: {0}", _scm.ServerVersion.ToString());

            BaseTypeCB.Items.Add(P4.BaseFileType.Text);
            BaseTypeCB.Items.Add(P4.BaseFileType.Binary);
            BaseTypeCB.Items.Add(P4.BaseFileType.Symlink);
            BaseTypeCB.Items.Add(P4.BaseFileType.Apple);
            BaseTypeCB.Items.Add(P4.BaseFileType.Resource);
            BaseTypeCB.Items.Add(P4.BaseFileType.Unicode);
            BaseTypeCB.Items.Add(P4.BaseFileType.UTF16);
            if (_scm.ServerVersion >= Versions.V15_2)
            {
                BaseTypeCB.Items.Add(P4.BaseFileType.UTF8);
            }

            MaxRevsCB.Items.Clear();

            MaxRevsCB.Items.Add(1);
            MaxRevsCB.Items.Add(2);
            MaxRevsCB.Items.Add(3);
            MaxRevsCB.Items.Add(4);
            MaxRevsCB.Items.Add(5);
            MaxRevsCB.Items.Add(6);
            MaxRevsCB.Items.Add(7);
            MaxRevsCB.Items.Add(8);
            MaxRevsCB.Items.Add(9);
            MaxRevsCB.Items.Add(10);
            MaxRevsCB.Items.Add(16);
            MaxRevsCB.Items.Add(32);
            MaxRevsCB.Items.Add(64);
            MaxRevsCB.Items.Add(128);
            MaxRevsCB.Items.Add(256);
            MaxRevsCB.Items.Add(512);

            IList <P4.Changelist> changelists = _scm.GetAvailibleChangelists(-1);

            TargetChangeListCB.Items.Clear();

            TargetChangeListCB.Items.Add(Resources.Changelist_New);
            TargetChangeListCB.Items.Add(Resources.Changelist_Default);

            if (changelists != null)
            {
                foreach (P4.Changelist change in changelists)
                {
                    TargetChangeListCB.Items.Add(new ChangelistItem(change));
                }
            }
        }
Esempio n. 18
0
 public SubmittedChangelistsBrowserDlg(P4ScmProvider scm, string sender)
 {
     Scm = scm;
     InitializeComponent();
     this.Icon = Images.submitted;
     submittedChangelistsToolWindowControl1.Scm = scm;
     submittedChangelistsToolWindowControl1.filterBtn.Enabled = true;
     submittedChangelistsToolWindowControl1.fromBrowser       = true;
     if (sender.Contains("diff_"))
     {
         string path = sender.Replace("diff_", "");
         submittedChangelistsToolWindowControl1.pathCB.Text = path;
     }
 }
Esempio n. 19
0
        public ChangeOwnerDlg(string sentUser, string sentWorkspace, string changeslist, P4ScmProvider scm)
        {
            PreferenceKey = "ChangeOwnerDlg";

            InitializeComponent();
            //gridControl1.InitializeGrid();

            _scm             = scm;
            this.Icon        = Images.icon_p4vs_16px;
            promptText       = PromptLbl.Text;
            PromptLbl.Text   = string.Format(promptText, changeslist);
            userTB.Text      = sentUser;
            workspaceTB.Text = sentWorkspace;
        }
Esempio n. 20
0
 public void Dispose()
 {
     try
     {
         if (RefreshThread != null)
         {
             _runRefreshThread = false;
             RefreshThread.Join(TimeSpan.FromSeconds(2));
             RefreshThread = null;
         }
         _scm = null;
     }
     catch { };
 }
Esempio n. 21
0
        private void OpenConnectionBtn_Click(object sender, EventArgs e)
        {
            P4ScmProvider newConection = new P4ScmProvider(SccService);

            if (UseEnvConnect)
            {
                newConection.Connection.Connect(true, null);
            }
            else
            {
                // trigger the connection dialog
                newConection.Connection.Connect();
            }
            // only replace ScmProvider if a connection has been made
            // through env vars or connection dlg
            if (newConection.Connected)
            {
                SccService.ScmProvider = newConection;
            }
            if (SccService.ScmProvider.Connection.Repository != null &&
                !(string.IsNullOrEmpty(SccService.ScmProvider.Connection.Workspace)))
            {
                if (SccService.ScmProvider != null)
                {
                    SccService.ScmProvider.LoadingSolution = !string.IsNullOrEmpty(SccService.LoadingControlledSolutionLocation);
                }
                Init();

                P4VsProvider.BroadcastNewConnection(SccService.ScmProvider);

                ConnectionInfo            = new ConnectionData();
                ConnectionInfo.ServerPort = SccService.ScmProvider.Connection.Port;
                ConnectionInfo.UserName   = SccService.ScmProvider.Connection.User;
                ConnectionInfo.Workspace  = SccService.ScmProvider.Connection.Workspace;

                P4VsProvider.Instance.currentConnectionDropDownComboChoice = ConnectionInfo.ToString();

                string key = "ActiveChangelist_" + SccService.ScmProvider.Connection.Repository.Connection.Server.Address.Uri.Replace(':', '_') +
                             "_" + SccService.ScmProvider.Connection.User + "_" + SccService.ScmProvider.Connection.Workspace;

                P4VsProvider.Instance.ChangeLists = new ActiveChangeListCombo(SccService);
                string newActiveChangeListComboChoice = Preferences.LocalSettings.GetString(key, Resources.Changelist_Default);
                P4VsProvider.Instance.ChangeLists.SetActiveChangeList(newActiveChangeListComboChoice);
            }
            else
            {
                P4VsProvider.BroadcastNewConnection(null);
            }
        }
Esempio n. 22
0
        public P4ScmCache(P4ScmProvider scm)
        {
            cache = new Dictionary <CacheKey, CachedFile>();
            lock (cache)
            {
                _scm = scm;

                int minutes = Preferences.LocalSettings.GetInt("Update_status", 5);
                _refreshInterval = TimeSpan.FromMinutes(minutes);

                if ((_scm != null) && (_scm.SccService != null))
                {
                    OnUpdatedFiles += new UpdatedFiles_Delegate(_scm.OnCacheFilesUpdated);
                }
            }
        }
Esempio n. 23
0
        public void InitView(P4ScmProvider _scm, IList <string> files, IList <object> fields)
        {
            listItemMap = new Dictionary <string, P4ObjectTreeListViewItem>();

            IList <P4.FileSpec> fs = P4.FileSpec.LocalSpecList(files.ToArray());

            Files  = _scm.GetFileMetaData(fs, null);
            Fields = fields;

            foreach (P4.FileMetaData file in Files)
            {
                P4FileTreeListViewItem it = new P4FileTreeListViewItem(null, file, (IList <object>)Fields);
                listItemMap.Add(file.DepotPath.Path, it);
                this.Items.Add(it);
            }
        }
Esempio n. 24
0
        private static void NavigateToCommit(string commitId, IServiceProvider serviceProvider)
        {
            bool          test = P4VsProvider.CurrentScm.CheckConnection();
            P4ScmProvider scm  = P4VsProvider.CurrentScm;

            SubmittedChangelistDlg submitted = new SubmittedChangelistDlg(scm, true);

            int.TryParse(commitId, out int ID);
            submitted.ChangeListId = ID;

            Perforce.P4.ServerMetaData smd = scm.GetServerMetaData();
            submitted.Text = string.Format(Resources.SubmittedChangelistsToolWindowControl_SubmittedChangelistDlgCaption,
                                           commitId, smd.Address.Uri, scm.Connection.Repository.Connection.UserName);

            submitted.ShowDialog();
        }
Esempio n. 25
0
        public UnshelveFileDialog(P4ScmProvider scm)
        {
            PreferenceKey = "UnshelveFileDialog";

            _scm = scm;
            InitializeComponent();
            this.Icon  = Images.icon_p4vs_16px;
            ListImages = new System.Windows.Forms.ImageList(components);
            //
            // ListImages
            //
            ListImages.TransparentColor = System.Drawing.Color.Transparent;
            ListImages.Images.Add("noCheckBox.png", Images.noCheckBox);
            ListImages.Images.Add("CheckBox.png", Images.CheckBox);

            ShelvedFilesLV.SmallImageList     = ListImages;
            ShelvedFilesLV.ListViewItemSorter = (System.Collections.IComparer) new FileListViewSorter();

            IList <P4.Changelist> changes = _scm.GetAvailibleChangelists(-1);

            changeMap = new Dictionary <int, P4.Changelist>();

            //add new as the first item in the list
            TargetChangelistCB.Items.Add(Resources.Changelist_New);
            changeMap[-1] = null;

            //add default as the first item in the list if not already there
            TargetChangelistCB.Items.Add(Resources.Changelist_Default);
            changeMap[0] = null;

            // if there are other existing changelists, add them to the list
            if (changes != null)
            {
                foreach (P4.Changelist item in changes)
                {
                    int id = item.Id;
                    if ((id != -1) && (id != 0))
                    {
                        changeMap[id] = item;
                        int idx = TargetChangelistCB.Items.Add(SelectChangelistDlg.ChangeListToString(item));
                    }
                }
            }

            // select the default changelist
            TargetChangelistCB.SelectedIndex = 1;
        }
Esempio n. 26
0
        public P4ChangeTreeListViewItem(TreeListViewItem parentItem, P4.Changelist changeData,
                                        P4ScmProvider scm, IList <object> fields)
            : base()
        {
            ParentItem = parentItem;
            Fields     = fields;
            NodeType   = nodeType.Pending;           // default
            Scm        = scm;
            Tag        = changeData;

            Ours = (changeData.ClientId == Scm.Connection.Workspace);

            if (Ours)
            {
                P4.Options opts = new P4.Options();

                if (changeData.Id > 0)
                {
                    opts["-e"] = changeData.Id.ToString();
                }
                else
                {
                    opts["-e"] = "default";
                    NodeType.Set(nodeType.Default);
                }
                opts["-Ru"] = null;
                opts["-m"]  = "1";
                P4.FileSpec        fs  = new P4.FileSpec(new P4.ClientPath(@"//" + Scm.Connection.Workspace + @"/..."), null);
                List <P4.FileSpec> lfs = new List <P4.FileSpec>();
                lfs.Add(fs);
                IList <P4.FileMetaData> unresolved = Scm.GetFileMetaData(lfs, opts);

                if ((unresolved != null) && (unresolved.Count > 0))
                {
                    NeedsResolve = true;
                }
            }

            _changeData = changeData;             // don't call InitSubitems() or SelectImagesFromMetaData() yet

            if (changeData.Id > 0)
            {
                _reviewData = Scm.Connection.Swarm.IsChangelistAttachedToReview(changeData.Id);
            }
            InitSubitems();
            SelectImagesFromMetaData();
        }
Esempio n. 27
0
        public IntegrateDlg(List <string> source, string target, string action, P4ScmProvider scm)
        {
            PreferenceKey = "IntegrateDlg";

            _target = target;
            _source = source;
            _action = action;
            _scm    = scm;
            InitializeComponent();
            this.Icon = Images.icon_p4vs_16px;
            if (scm.Connection.Repository == null)
            {
                return;
            }
            Text = Text + " (" + scm.Connection.Repository.Server.Address.Uri + ", " +
                   scm.Connection.User + ", " + scm.Connection.Workspace + ")";
        }
Esempio n. 28
0
        //string SandboxResults = null;

        //public void SandboxDataReceived(Object sender, DataReceivedEventArgs e)
        //{
        //    SandboxResults += e.Data;
        //}

        private void ConfigureSandboxBtn_Click(object sender, EventArgs e)
        {
            if (SandboxConfigPath == null)
            {
                return;
            }

            P4ScmProvider _scm = new P4ScmProvider(null);

            _scm.Connection.Port      = ServerPort;
            _scm.Connection.User      = UserName;
            _scm.Connection.Workspace = Workspace;

            string charset = null;

            _scm.Connection.Connect(true, null);
            if (_scm.Connected)
            {
                charset = _scm.Connection.Repository.Connection.CharacterSetName;
            }
            _scm.Dispose();

            this.TopMost = false;
            Process ConfigSandboxProc = new Process();

            string args = string.Format("-p {0} -u {1} -c {2}", ServerTB.Text, UserTB.Text, WorkspaceTB.Text);

            if (charset != null)
            {
                args += string.Format(" -C {0}", charset);
            }
            ConfigSandboxProc.StartInfo           = new ProcessStartInfo(SandboxConfigPath);
            ConfigSandboxProc.StartInfo.Arguments = args;
            ConfigSandboxProc.StartInfo.RedirectStandardOutput = true;
            ConfigSandboxProc.StartInfo.UseShellExecute        = false;
            ConfigSandboxProc.StartInfo.CreateNoWindow         = false;

            ParameterizedThreadStart threadProc = new ParameterizedThreadStart(ConfigureSandboxRunThreadProc);
            Thread t = new Thread(threadProc);

            t.Start(ConfigSandboxProc);

            this.Enabled = false;

            //ConfigureSandboxRunThreadProc((object)ConfigSandboxProc);
        }
Esempio n. 29
0
        /// <summary>
        /// Create a new P4Directory
        /// </summary>
        /// <param name="server">Perforce Server</param>
        /// <param name="nWorkspace">Active workspace(client), can be null</param>
        /// <param name="nDepotPath">Full path in the depot, can be null</param>
        /// <param name="nLocalPath">Full path in the local file system, can be null</param>
        /// <param name="parent">Parent directory, can be null</param>
        /// <remarks>
        /// Either the depot or local path can be null, not both. The file name
        /// will be taken from the depot path if provided, otherwise from the
        /// local path
        /// </remarks>
        public P4Directory(P4ScmProvider scm, Client nWorkspace, String nDepotPath, String nLocalPath, P4Directory parent)
        {
            String nName;

            if (!String.IsNullOrEmpty(nDepotPath))
            {
                nName = nDepotPath.Substring(nDepotPath.LastIndexOf('/') + 1);
            }
            else if (!String.IsNullOrEmpty(nLocalPath))
            {
                nName = nLocalPath.Substring(nLocalPath.LastIndexOf('/') + 1);
            }
            else
            {
                nName = "????";
            }
            Init(scm, nWorkspace, nName, nDepotPath, nLocalPath, parent);
        }
Esempio n. 30
0
        public GroupsBrowserDlg(P4ScmProvider scm, string sender)
        {
            PreferenceKey = "GroupsBrowserDlg";

            Scm = scm;
            InitializeComponent();

            if (components == null)
            {
                components = new Container();
            }
            this.Icon = Images.icon_p4vs_16px;

            imageList1 = new System.Windows.Forms.ImageList(components);

            //
            // imageList1
            //
            imageList1.TransparentColor = System.Drawing.Color.Transparent;
            imageList1.Images.Add("groups_icon.png", Images.groups_icon);
            imageList1.Images.Add("users_icon.png", Images.users_icon);

            this.groupGridP4ObjectTreeListView.LargeImageList = this.imageList1;
            this.groupGridP4ObjectTreeListView.SmallImageList = this.imageList1;

            if (Scm != null)
            {
                IList <P4.Group> groups = Scm.GetGroups(null, null);
                foreach (P4.Group group in groups)
                {
                    string           id   = group.Id;
                    TreeListViewItem tlvi = new TreeListViewItem();
                    tlvi.Name = id;
                    tlvi.Text = id;
                    tlvi.ChildNodes.Add(new TreeListViewItem());
                    tlvi.Collapse();
                    tlvi.Tag        = group;
                    tlvi.ImageIndex = 0;
                    groupGridP4ObjectTreeListView.Items.Add(tlvi);
                }
            }
            ClosedByDoubleClick = false;
        }