void OnOKClicked(object sender, EventArgs e)
        {
            List <Change>    changes = rename.PerformChanges(options, Properties);
            IProgressMonitor monitor = IdeApp.Workbench.ProgressMonitors.GetBackgroundProgressMonitor(this.Title, null);

            RefactoringService.AcceptChanges(monitor, options.Dom, changes);
            ((Widget)this).Destroy();
        }
        public RenameItemDialog(ISymbol symbol, RenameRefactoring rename)
        {
            this.Build();

            string title;

            if (symbol is ITypeSymbol)
            {
                var t = (ITypeSymbol)symbol;
                if (t.TypeKind == TypeKind.TypeParameter)
                {
                    title      = GettextCatalog.GetString("Rename Type Parameter");
                    entry.Text = t.Name;
                }
                else
                {
                    var typeDefinition = t;
                    if (typeDefinition.ContainingType == null)
                    {
                        // not supported for inner types
                        this.renameFileFlag.Visible = true;
                        this.renameFileFlag.Active  = t.Locations.First().SourceTree.FilePath.Contains(typeDefinition.Name);
                    }
                    else
                    {
                        this.renameFileFlag.Active = false;
                    }
                    if (typeDefinition.TypeKind == TypeKind.Interface)
                    {
                        title = GettextCatalog.GetString("Rename Interface");
                    }
                    else if (typeDefinition.TypeKind == TypeKind.Delegate)
                    {
                        title = GettextCatalog.GetString("Rename Delegate");
                    }
                    else if (typeDefinition.TypeKind == TypeKind.Enum)
                    {
                        title = GettextCatalog.GetString("Rename Enum");
                    }
                    else if (typeDefinition.TypeKind == TypeKind.Struct)
                    {
                        title = GettextCatalog.GetString("Rename Struct");
                    }
                    else
                    {
                        title = GettextCatalog.GetString("Rename Class");
                    }
                }
                //				this.fileName = type.GetDefinition ().Region.FileName;
            }
            else if (symbol.Kind == SymbolKind.Field)
            {
                title = GettextCatalog.GetString("Rename Field");
            }
            else if (symbol.Kind == SymbolKind.Property)
            {
                title = GettextCatalog.GetString("Rename Property");
            }
            else if (symbol.Kind == SymbolKind.Event)
            {
                title = GettextCatalog.GetString("Rename Event");
            }
            else if (symbol.Kind == SymbolKind.Method)
            {
                var m = (IMethodSymbol)symbol;
                if (m.MethodKind == MethodKind.Constructor ||
                    m.MethodKind == MethodKind.StaticConstructor ||
                    m.MethodKind == MethodKind.Destructor)
                {
                    title = GettextCatalog.GetString("Rename Class");
                }
                else
                {
                    title = GettextCatalog.GetString("Rename Method");
                    includeOverloadsCheckbox.Visible = m.ContainingType.GetMembers(m.Name).Length > 1;
                }
            }
            else if (symbol.Kind == SymbolKind.Parameter)
            {
                title = GettextCatalog.GetString("Rename Parameter");
            }
            else if (symbol.Kind == SymbolKind.Local)
            {
                title = GettextCatalog.GetString("Rename Variable");
            }
            else if (symbol.Kind == SymbolKind.TypeParameter)
            {
                title = GettextCatalog.GetString("Rename Type Parameter");
            }
            else if (symbol.Kind == SymbolKind.Namespace)
            {
                title = GettextCatalog.GetString("Rename Namespace");
            }
            else if (symbol.Kind == SymbolKind.Label)
            {
                title = GettextCatalog.GetString("Rename Label");
            }
            else
            {
                title = GettextCatalog.GetString("Rename Item");
            }


            Init(title, symbol.Name, prop => { rename.PerformChanges(symbol, prop); return(new List <Change> ()); });
        }
		public RenameItemDialog (ISymbol symbol, RenameRefactoring rename)
		{
			this.Build ();

			string title;
			if (symbol is ITypeSymbol) {

				var t = (ITypeSymbol)symbol;
				if (t.TypeKind == TypeKind.TypeParameter) {
					title = GettextCatalog.GetString ("Rename Type Parameter");
					entry.Text = t.Name;

				} else {
					var typeDefinition = t;
					if (typeDefinition.ContainingType == null) {
						// not supported for inner types
						this.renameFileFlag.Visible = true;
						this.renameFileFlag.Active = t.Locations.First ().SourceTree.FilePath.Contains (typeDefinition.Name);
					} else {
						this.renameFileFlag.Active = false;
					}
					if (typeDefinition.TypeKind == TypeKind.Interface)
						title = GettextCatalog.GetString ("Rename Interface");
					else if (typeDefinition.TypeKind == TypeKind.Delegate)
						title = GettextCatalog.GetString ("Rename Delegate");
					else if (typeDefinition.TypeKind == TypeKind.Enum)
						title = GettextCatalog.GetString ("Rename Enum");
					else if (typeDefinition.TypeKind == TypeKind.Struct)
						title = GettextCatalog.GetString ("Rename Struct");
					else
						title = GettextCatalog.GetString ("Rename Class");
				}
				//				this.fileName = type.GetDefinition ().Region.FileName;
			} else if (symbol.Kind == SymbolKind.Field) {
				title = GettextCatalog.GetString ("Rename Field");
			} else if (symbol.Kind == SymbolKind.Property) {
				title = GettextCatalog.GetString ("Rename Property");
			} else if (symbol.Kind == SymbolKind.Event) {
				title = GettextCatalog.GetString ("Rename Event");
			} else if (symbol.Kind == SymbolKind.Method) { 
				var m = (IMethodSymbol)symbol;
				if (m.MethodKind == MethodKind.Constructor ||
					m.MethodKind == MethodKind.StaticConstructor ||
					m.MethodKind == MethodKind.Destructor) {
					title = GettextCatalog.GetString ("Rename Class");
				} else {
					title = GettextCatalog.GetString ("Rename Method");
					includeOverloadsCheckbox.Visible = m.ContainingType.GetMembers (m.Name).Length > 1;
				}
			} else if (symbol.Kind == SymbolKind.Parameter) {
				title = GettextCatalog.GetString ("Rename Parameter");
			} else if (symbol.Kind == SymbolKind.Local) {
				title = GettextCatalog.GetString ("Rename Variable");
			} else if (symbol.Kind == SymbolKind.TypeParameter) {
				title = GettextCatalog.GetString ("Rename Type Parameter");
			} else if (symbol.Kind == SymbolKind.Namespace) {
				title = GettextCatalog.GetString ("Rename Namespace");
			} else if (symbol.Kind == SymbolKind.Label) {
				title = GettextCatalog.GetString ("Rename Label");
			} else {
				title = GettextCatalog.GetString ("Rename Item");
			}


			Init (title, symbol.Name, prop => { rename.PerformChanges (symbol, prop); return new List<Change> (); });

		}