예제 #1
0
		public static DisplayBindingDescriptor AddExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
		{
			WorkbenchSingleton.AssertMainThread();
			if (binding == null)
				throw new ArgumentNullException("binding");
			DisplayBindingDescriptor descriptor = AddExternalProcessDisplayBindingInternal(binding);
			SaveExternalProcessDisplayBindings();
			return descriptor;
		}
예제 #2
0
		static DisplayBindingDescriptor AddExternalProcessDisplayBindingInternal(ExternalProcessDisplayBinding binding)
		{
			externalProcessDisplayBindings.Add(binding);
			DisplayBindingDescriptor descriptor = new DisplayBindingDescriptor(binding) {
				Id = binding.Id,
				Title = binding.Title
			};
			bindings.Add(descriptor);
			return descriptor;
		}
예제 #3
0
 public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
 {
     if (destinationType == typeof(string))
     {
         ExternalProcessDisplayBinding binding = (ExternalProcessDisplayBinding)value;
         return(binding.Id + "|" + binding.FileExtension + "|" + binding.Title + "|" + binding.CommandLine);
     }
     else
     {
         return(base.ConvertTo(context, culture, value, destinationType));
     }
 }
예제 #4
0
        static DisplayBindingDescriptor AddExternalProcessDisplayBindingInternal(ExternalProcessDisplayBinding binding)
        {
            externalProcessDisplayBindings.Add(binding);
            DisplayBindingDescriptor descriptor = new DisplayBindingDescriptor(binding)
            {
                Id    = binding.Id,
                Title = binding.Title
            };

            bindings.Add(descriptor);
            return(descriptor);
        }
예제 #5
0
        public static DisplayBindingDescriptor AddExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
        {
            WorkbenchSingleton.AssertMainThread();
            if (binding == null)
            {
                throw new ArgumentNullException("binding");
            }
            DisplayBindingDescriptor descriptor = AddExternalProcessDisplayBindingInternal(binding);

            SaveExternalProcessDisplayBindings();
            return(descriptor);
        }
예제 #6
0
		public static void RemoveExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
		{
			WorkbenchSingleton.AssertMainThread();
			if (binding == null)
				throw new ArgumentNullException("binding");
			if (!externalProcessDisplayBindings.Remove(binding))
				throw new ArgumentException("binding was not added");
			SaveExternalProcessDisplayBindings();
			for (int i = 0; i < bindings.Count; i++) {
				if (bindings[i].GetLoadedBinding() == binding) {
					bindings.RemoveAt(i);
					return;
				}
			}
			throw new InvalidOperationException("did not find binding descriptor even though binding was registered");
		}
예제 #7
0
 public static void RemoveExternalProcessDisplayBinding(ExternalProcessDisplayBinding binding)
 {
     WorkbenchSingleton.AssertMainThread();
     if (binding == null)
     {
         throw new ArgumentNullException("binding");
     }
     if (!externalProcessDisplayBindings.Remove(binding))
     {
         throw new ArgumentException("binding was not added");
     }
     SaveExternalProcessDisplayBindings();
     for (int i = 0; i < bindings.Count; i++)
     {
         if (bindings[i].GetLoadedBinding() == binding)
         {
             bindings.RemoveAt(i);
             return;
         }
     }
     throw new InvalidOperationException("did not find binding descriptor even though binding was registered");
 }