コード例 #1
0
            public override bool Equals(object obj)
            {
                ClasspathEntry entry = obj as ClasspathEntry;

                if (entry != null)
                {
                    return(entry.Classpath == Classpath);
                }
                else
                {
                    return(base.Equals(obj));
                }
            }
コード例 #2
0
        private void listBox_DoubleClick(object sender, System.EventArgs e)
        {
            ClasspathEntry entry = listBox.SelectedItem as ClasspathEntry;

            if (entry == null)
            {
                return;                            // you could have double-clicked on whitespace
            }
            using (FolderBrowserDialog dialog = new FolderBrowserDialog())
            {
                dialog.RootFolder  = Environment.SpecialFolder.Desktop;
                dialog.Description = "Please select a classpath directory.";

                if (project != null)
                {
                    dialog.SelectedPath = project.GetAbsolutePath(entry.Classpath);

                    if (!Directory.Exists(dialog.SelectedPath))
                    {
                        dialog.SelectedPath = project.Directory;
                    }
                }
                else
                {
                    dialog.SelectedPath = entry.Classpath;
                }

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    string selectedPath = dialog.SelectedPath;

                    if (project != null)
                    {
                        if (!CanBeRelative(selectedPath))
                        {
                            return;
                        }
                        selectedPath = project.GetRelativePath(selectedPath);
                    }

                    if (selectedPath == entry.Classpath)
                    {
                        return;                         // nothing to do!
                    }
                    listBox.Items[listBox.SelectedIndex] = new ClasspathEntry(selectedPath);
                    OnChanged();
                }
            }
        }
コード例 #3
0
        private void btnNewClasspath_Click(object sender, EventArgs e)
        {
            using (VistaFolderBrowserDialog dialog = new VistaFolderBrowserDialog())
            {
                dialog.RootFolder             = Environment.SpecialFolder.Desktop;
                dialog.UseDescriptionForTitle = true;
                dialog.Description            = TextHelper.GetString("Info.SelectClasspathDirectory");

                if (project != null)
                {
                    dialog.SelectedPath = project.Directory;
                }
                if (lastBrowserPath != null && Directory.Exists(lastBrowserPath))
                {
                    dialog.SelectedPath = lastBrowserPath;
                }

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    string path = dialog.SelectedPath;
                    if (project != null)
                    {
                        if (CanBeRelative(path))
                        {
                            path = project.GetRelativePath(path);
                            // remove default classpath if you add a subfolder in the classpath
                            if (!path.StartsWithOrdinal("..") && listBox.Items.Count == 1 &&
                                (listBox.Items[0] as ClasspathEntry).Classpath == ".")
                            {
                                listBox.Items.Clear();
                            }
                        }
                    }
                    if (listBox.Items.Count > 0 && !WarnConflictingPath(path))
                    {
                        return;
                    }
                    ClasspathEntry entry = new ClasspathEntry(path);
                    if (!listBox.Items.Contains(entry))
                    {
                        listBox.Items.Add(entry);
                    }
                    OnChanged();
                    lastBrowserPath = dialog.SelectedPath;
                }
            }
        }
コード例 #4
0
        private void btnNewClasspath_Click(object sender, EventArgs e)
        {
            using (FolderBrowserDialog dialog = new FolderBrowserDialog())
            {
                dialog.RootFolder  = Environment.SpecialFolder.Desktop;
                dialog.Description = "Please select a classpath directory.";

                if (project != null)
                {
                    dialog.SelectedPath = project.Directory;
                }

                if (lastBrowserPath != null && Directory.Exists(lastBrowserPath))
                {
                    dialog.SelectedPath = lastBrowserPath;
                }

                if (dialog.ShowDialog(this) == DialogResult.OK)
                {
                    string path = dialog.SelectedPath;

                    if (project != null)
                    {
                        if (!CanBeRelative(path))
                        {
                            return;
                        }
                        path = project.GetRelativePath(path);
                    }

                    if (!WarnConflictingPath(path))
                    {
                        return;
                    }

                    ClasspathEntry entry = new ClasspathEntry(path);

                    if (!listBox.Items.Contains(entry))
                    {
                        listBox.Items.Add(entry);
                    }

                    OnChanged();
                    lastBrowserPath = dialog.SelectedPath;
                }
            }
        }
コード例 #5
0
		private void btnNewClasspath_Click(object sender, EventArgs e)
		{
			using (FolderBrowserDialog dialog = new FolderBrowserDialog())
			{
                dialog.RootFolder = Environment.SpecialFolder.Desktop;
                dialog.Description = TextHelper.GetString("Info.SelectClasspathDirectory");

				if (project != null) dialog.SelectedPath = project.Directory;
				if (lastBrowserPath != null && Directory.Exists(lastBrowserPath)) dialog.SelectedPath = lastBrowserPath;

				if (dialog.ShowDialog(this) == DialogResult.OK)
				{
					string path = dialog.SelectedPath;
					if (project != null)
					{
                        if (CanBeRelative(path))
                        {
                            path = project.GetRelativePath(path);
                            // remove default classpath if you add a subfolder in the classpath
                            if (!path.StartsWith("..") && listBox.Items.Count == 1 
                                && (listBox.Items[0] as ClasspathEntry).Classpath == ".")
                                listBox.Items.Clear();
                        }
					}
					if (listBox.Items.Count > 0 && !WarnConflictingPath(path)) return;
					ClasspathEntry entry = new ClasspathEntry(path);
					if (!listBox.Items.Contains(entry)) listBox.Items.Add(entry);
					OnChanged();
					lastBrowserPath = dialog.SelectedPath;
				}
			}
		}
コード例 #6
0
		private void btnNewClasspath_Click(object sender, EventArgs e)
		{
			using (FolderBrowserDialog dialog = new FolderBrowserDialog())
			{
				dialog.RootFolder = Environment.SpecialFolder.Desktop;
				dialog.Description = "Please select a classpath directory.";

				if (project != null)
					dialog.SelectedPath = project.Directory;

				if (lastBrowserPath != null && Directory.Exists(lastBrowserPath))
					dialog.SelectedPath = lastBrowserPath;

				if (dialog.ShowDialog(this) == DialogResult.OK)
				{
					string path = dialog.SelectedPath;

					if (project != null)
					{
						if (!CanBeRelative(path)) return;
						path = project.GetRelativePath(path);
					}

					if (!WarnConflictingPath(path))
						return;

					ClasspathEntry entry = new ClasspathEntry(path);

					if (!listBox.Items.Contains(entry))
						listBox.Items.Add(entry);

					OnChanged();
					lastBrowserPath = dialog.SelectedPath;
				}
			}
		}