Exemplo n.º 1
0
        public bool Checkout()
        {
            IVersionController vcs = Manager.Project.VCS;

            if (vcs != null && vcs.IsVersionControlled(this.FileName))
            {
                if (MessageBox.Show(Manager.MainWindow, "The file '" + this.FileName + "' is under revision control but not checked out; do you want to check it out?", "Read-only file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    if (vcs.Checkout(this.FileName))
                    {
                        this.ReadOnly = false;
                        return(true);
                    }
                }
            }
            else
            {
                if (MessageBox.Show(Manager.MainWindow, "The file is read-only and cannot be edited. Would you like to remove the read-only attribute from it?", "Read-only file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
                {
                    try
                    {
                        File.SetAttributes(this.FileName, File.GetAttributes(this.FileName) & ~FileAttributes.ReadOnly);
                        this.ReadOnly = false;
                        return(true);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(Manager.MainWindow, "Failed making " + this.FileName + " writable:\r\n\r\n" + ex.ToString(), "Read-only file", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }

            return(false);
        }
Exemplo n.º 2
0
        public SourceControlWindow(IManager manager)
        {
            InitializeComponent();

            mManager = manager;
            if (mManager.Project.VCS != null)
            {
                mVCS = (IVersionController)mManager.Project.VCS.Clone();
            }
            propertyGrid.SelectedObject = mVCS;

            comboBoxVCSType.Items.Add(new VCSInfo(null));
            if (mVCS == null)
            {
                comboBoxVCSType.SelectedIndex = 0;
            }
            foreach (Type type in mManager.GetPluginImplementations(typeof(IVersionController)))
            {
                VCSInfo info = new VCSInfo(type);
                comboBoxVCSType.Items.Add(info);
                if (mVCS != null && mVCS.GetType() == type)
                {
                    comboBoxVCSType.SelectedItem = info;
                }
            }

            UpdateControls();
        }
Exemplo n.º 3
0
        private void UpdateControls()
        {
            VCSInfo info = (VCSInfo)comboBoxVCSType.SelectedItem;

            if (info.Type == null)
            {
                mVCS = null;
            }
            else
            {
                mVCS = (IVersionController)Activator.CreateInstance(info.Type, new object[] { });
            }
            propertyGrid.SelectedObject = mVCS;

            if (mVCS == null)
            {
                labelVCSInfo.Text    = "";
                labelVCSInfo.Visible = false;
                propertyGrid.Visible = false;
            }
            else
            {
                labelVCSInfo.Text    = mVCS.ConfigurationMessage;
                labelVCSInfo.Visible = true;
                propertyGrid.Visible = true;
            }
        }
Exemplo n.º 4
0
		public SourceControlWindow(IManager manager)
		{
			InitializeComponent();

			mManager = manager;
			if(mManager.Project.VCS != null)
				mVCS = (IVersionController) mManager.Project.VCS.Clone();
			propertyGrid.SelectedObject = mVCS;

			comboBoxVCSType.Items.Add(new VCSInfo(null));
			if (mVCS == null)
				comboBoxVCSType.SelectedIndex = 0;
			foreach (Type type in mManager.GetPluginImplementations(typeof(IVersionController)))
			{
				VCSInfo info = new VCSInfo(type);
				comboBoxVCSType.Items.Add(info);
				if (mVCS != null && mVCS.GetType() == type)
					comboBoxVCSType.SelectedItem = info;
			}

			UpdateControls();
		}
Exemplo n.º 5
0
		void VCS_Message(IVersionController sender, string message)
		{
			Manager.AddMessage("Version Control", message);
		}
Exemplo n.º 6
0
		private void UpdateControls()
		{
			VCSInfo info = (VCSInfo)comboBoxVCSType.SelectedItem;
			if (info.Type == null)
				mVCS = null;
			else
				mVCS = (IVersionController)Activator.CreateInstance(info.Type, new object[] { });
			propertyGrid.SelectedObject = mVCS;

			if (mVCS == null)
			{
				labelVCSInfo.Text = "";
				labelVCSInfo.Visible = false;
				propertyGrid.Visible = false;
			}
			else
			{
				labelVCSInfo.Text = mVCS.ConfigurationMessage;
				labelVCSInfo.Visible = true;
				propertyGrid.Visible = true;
			}
		}
Exemplo n.º 7
0
 void VCS_Message(IVersionController sender, string message)
 {
     Manager.AddMessage("Version Control", message);
 }