Summary description for BulkEditBar2.
상속: System.Windows.Forms.UserControl, IFWDisposable
예제 #1
0
			/// <summary>
			///
			/// </summary>
			protected override void SetupBulkEditBarTab(BulkEditBar bulkEditBar)
			{
				// first initialize the controls, since otherwise, we overwrite our selection.
				// now we can setup the target field
				m_bulkEditBar.InitListChoiceTab();

				base.SetupBulkEditBarTab(bulkEditBar);
				if (m_bulkEditBar.m_listChoiceControl != null)
				{
					if (HasExpectedTargetSelected())
						m_bulkEditBar.m_listChoiceControl.Text = this.ChangeTo;
					if (m_bulkEditBar.CurrentItem.BulkEditControl is ITextChangedNotification)
						(m_bulkEditBar.CurrentItem.BulkEditControl as ITextChangedNotification).ControlTextChanged();
					else
					{
						// couldn't restore target selection, so revert to defaults.
							// (LT-9940 default is ChangeTo, not "")
							m_bulkEditBar.m_listChoiceControl.Text = this.ChangeTo;
					}
				}
				else
				{
					// at least show dummy control.
					m_bulkEditBar.m_listChoiceChangeToCombo.Visible = true;
				}
			}
예제 #2
0
			/// <summary>
			///
			/// </summary>
			protected override void SetupBulkEditBarTab(BulkEditBar bulkEditBar)
			{
				InitizializeTab(bulkEditBar);
				base.SetupBulkEditBarTab(bulkEditBar);
				if (SourceCombo != null)
				{
					SourceCombo.Text = this.SourceField;
					if (SourceCombo.SelectedIndex == -1)
					{
						// by default select the first item.
						if (SourceCombo.Items.Count > 0)
							SourceCombo.SelectedIndex = 0;
					}
				}
				NonEmptyTargetControl.NonEmptyMode =
					(NonEmptyTargetOptions)Enum.Parse(typeof(NonEmptyTargetOptions), this.NonEmptyTargetWriteMode);
				NonEmptyTargetControl.Separator = this.NonEmptyTargetSeparator;
			}
예제 #3
0
			/// <summary>
			///
			/// </summary>
			/// <param name="bulkEditBar"></param>
			protected override void SetupBulkEditBarTab(BulkEditBar bulkEditBar)
			{
				bulkEditBar.InitDeleteTab();
				base.SetupBulkEditBarTab(bulkEditBar);
			}
예제 #4
0
			/// <summary>
			/// Create BulkEditBarTabPage settings for the current tab,
			/// and save them to the property table.
			/// (only effective after initialization (i.e. m_setupOrRestoredBulkEditBarTab)
			/// To restore the settings, use TrySwitchToLastSavedTab() and/or
			/// followed by InitializeSelectedTab().
			/// </summary>
			/// <param name="bulkEditBar"></param>
			/// <returns></returns>
			static internal BulkEditTabPageSettings CaptureSettingsForCurrentTab(BulkEditBar bulkEditBar)
			{
				// don't capture bulk edit bar settings until we're finished with initialization.
				if (!bulkEditBar.m_setupOrRestoredBulkEditBarTab)
					return null;
				BulkEditTabPageSettings tabPageSettings = GetNewSettingsForSelectedTab(bulkEditBar);
				tabPageSettings.SaveSettings(bulkEditBar);
				return tabPageSettings;
			}
예제 #5
0
			/// <summary>
			///
			/// </summary>
			/// <param name="bulkEditBar"></param>
			protected override void InitizializeTab(BulkEditBar bulkEditBar)
			{
				bulkEditBar.InitTransduce();
			}
예제 #6
0
			/// <summary>
			/// Check that we've changed to BulkEditBar to ExpectedTab,
			/// and then set BulkEditBar to those tab settings
			/// </summary>
			/// <param name="bulkEditBar"></param>
			protected override void SetupBulkEditBarTab(BulkEditBar bulkEditBar)
			{
				bulkEditBar.InitFindReplaceTab();
				base.SetupBulkEditBarTab(bulkEditBar);

				// now setup nonserializable objects
				bulkEditBar.m_pattern = this.Pattern;
				bulkEditBar.m_tssReplace = bulkEditBar.m_pattern.ReplaceWith;
				bulkEditBar.UpdateFindReplaceSummary();
				bulkEditBar.EnablePreviewApplyForFindReplace();
			}
예제 #7
0
			private static string BuildCurrentTabSettingsKey(BulkEditBar bulkEditBar)
			{
#pragma warning disable 219
				Mediator mediator = bulkEditBar.m_mediator;
#pragma warning restore 219
				string toolId = GetBulkEditBarToolId(bulkEditBar);
				string property = String.Format("{0}_{1}_TabPageSettings", toolId, GetCurrentTabPageName(bulkEditBar));
				return property;
			}
예제 #8
0
			/// <summary>
			/// when switching contexts, we should commit any pending click copy changes.
			/// </summary>
			/// <param name="bulkEditBar"></param>
			protected override void SaveSettings(BulkEditBar bulkEditBar)
			{
				// first commit any pending changes.
				// switching from click copy, so commit any pending changes.
				m_bulkEditBar.CommitClickChanges(this, EventArgs.Empty);
				base.SaveSettings(bulkEditBar);
			}
예제 #9
0
			private static bool TryGetSettingsForCurrentTabPage(BulkEditBar bulkEditBar, out BulkEditTabPageSettings tabPageSettings)
			{
				string currentTabSettingsKey = BuildCurrentTabSettingsKey(bulkEditBar);
				tabPageSettings = DeserializeTabPageSettings(bulkEditBar, currentTabSettingsKey);
				return tabPageSettings.AreLoaded;
			}
예제 #10
0
			/// <summary>
			/// Check that we've changed to BulkEditBar to ExpectedTab,
			/// and then set BulkEditBar to those tab settings
			/// </summary>
			protected virtual void SetupBulkEditBarTab(BulkEditBar bulkEditBar)
			{
				if (m_bulkEditBar == null || !this.AreLoaded)
					return;
				CheckExpectedTab();
				SetTargetCombo();
				// first load target field name. other settings may depend upon this.
				SetTargetField();
			}
예제 #11
0
			/// <summary>
			/// Try to restore settings for selected tab, otherwise use defaults.
			/// </summary>
			/// <param name="bulkEditBar"></param>
			/// <returns></returns>
			static internal void InitializeSelectedTab(BulkEditBar bulkEditBar)
			{
				BulkEditTabPageSettings tabPageSettings;
				if (TryGetSettingsForCurrentTabPage(bulkEditBar, out tabPageSettings))
				{
					// now that we've loaded/setup a tab, restore the settings for that tab.
					try
					{
						tabPageSettings.SetupBulkEditBarTab(bulkEditBar);
					}
					catch
					{
						// oh well, we tried, just continue with what we could setup, if anything.
					}
				}
				else
				{
					// we didn't restore saved settings, but we may want to initialize defaults instead.
					tabPageSettings = GetNewSettingsForSelectedTab(bulkEditBar);
					tabPageSettings.SetupBulkEditBarTab(bulkEditBar);
				}

				tabPageSettings.SetupApplyPreviewButtons();
			}
예제 #12
0
			/// <summary>
			/// Restore last visited BulkEditBar tab index.
			/// After BulkEditBar finishes initializing its state and controls in that tab,
			/// finish restoring the settings in that tab with InitializeSelectedTab()
			/// </summary>
			/// <param name="bulkEditBar"></param>
			/// <returns></returns>
			static internal bool TrySwitchToLastSavedTab(BulkEditBar bulkEditBar)
			{
				BulkEditTabPageSettings settings;
				// first try to deserialize stored settings.
				settings = BulkEditTabPageSettings.DeserializeLastTabPageSettings(bulkEditBar);
				// get the name of the tab. if we can't get this, no point in continuing to use the settings,
				// because all other settings depend upon the tab.
				if (settings.AreLoaded)
				{
					bool fOk = true;
					// try switching to saved tab.
					try
					{
						BulkEditBarTabs tab = (BulkEditBarTabs)Enum.Parse(typeof(BulkEditBarTabs), settings.TabPageName);
						bulkEditBar.m_operationsTabControl.SelectedIndex = (int)tab;
					}
					catch
					{
						// something went wrong trying to restore tab, so assume we didn't switch to a saved one.
						fOk = false;
					}
					return fOk;
				}
				return false;
			}
예제 #13
0
			static internal BulkEditTabPageSettings GetNewSettingsForSelectedTab(BulkEditBar bulkEditBar)
			{
				BulkEditTabPageSettings tabPageSettings = null;
				switch (bulkEditBar.m_operationsTabControl.SelectedIndex)
				{
					default:
						// by default, just save basic tab info.
						tabPageSettings = new BulkEditTabPageSettings();
						break;
					case (int)BulkEditBarTabs.ListChoice: // list
						tabPageSettings = new ListChoiceTabPageSettings();
						break;
					case (int)BulkEditBarTabs.BulkCopy: // bulk copy
						tabPageSettings = new BulkCopyTabPageSettings();
						break;
					case (int)BulkEditBarTabs.ClickCopy: // click copy
						tabPageSettings = new ClickCopyTabPageSettings();
						break;
					case (int)BulkEditBarTabs.Process: // transduce
						tabPageSettings = new ProcessTabPageSettings();
						break;
					case (int)BulkEditBarTabs.BulkReplace: // find/replace
						tabPageSettings = new BulkReplaceTabPageSettings();
						break;
					case (int)BulkEditBarTabs.Delete: // Delete.
						tabPageSettings = new DeleteTabPageSettings();
						break;
				}
				tabPageSettings.m_bulkEditBar = bulkEditBar;
				return tabPageSettings;
			}
예제 #14
0
			/// <summary>
			///
			/// </summary>
			/// <param name="bulkEditBar"></param>
			protected virtual void InitizializeTab(BulkEditBar bulkEditBar)
			{
				bulkEditBar.InitBulkCopyTab();
			}
예제 #15
0
			/// <summary>
			///
			/// </summary>
			/// <param name="bulkEditBar"></param>
			/// <returns></returns>
			internal static string GetBulkEditBarToolId(BulkEditBar bulkEditBar)
			{
				XmlNode configurationNode = bulkEditBar.m_configurationNode;
				return XWindow.GetToolIdFromControlConfiguration(configurationNode);
			}
예제 #16
0
			/// <summary>
			///
			/// </summary>
			protected override void SetupBulkEditBarTab(BulkEditBar bulkEditBar)
			{
				bulkEditBar.InitClickCopyTab();
				base.SetupBulkEditBarTab(bulkEditBar);
				SourceCopyOptions sourceCopyMode =
					(SourceCopyOptions)Enum.Parse(typeof(SourceCopyOptions), this.SourceCopyMode);
				switch (sourceCopyMode)
				{
					case SourceCopyOptions.StringReorderedAtClicked:
						m_bulkEditBar.m_clickCopyReorderButton.Checked = true;
						break;
					case SourceCopyOptions.CopyWord:
					default:
						m_bulkEditBar.m_clickCopyWordButton.Checked = true;
						break;
				}

				NonEmptyTargetOptions nonEmptyTargetMode =
					(NonEmptyTargetOptions)Enum.Parse(typeof(NonEmptyTargetOptions),
					this.NonEmptyTargetWriteMode);
				switch (nonEmptyTargetMode)
				{
					case NonEmptyTargetOptions.Overwrite:
						m_bulkEditBar.m_clickCopyOverwriteButton.Checked = true;
						break;
					case NonEmptyTargetOptions.Append:
					default:
						m_bulkEditBar.m_clickCopyAppendButton.Checked = true;
						break;
				}
				m_bulkEditBar.m_clickCopySepBox.Text = this.NonEmptyTargetSeparator;
			}
예제 #17
0
			/// <summary>
			/// Serialize the settings for a bulk edit bar tab, and store it in the property table.
			/// </summary>
			/// <param name="bulkEditBar"></param>
			protected virtual void SaveSettings(BulkEditBar bulkEditBar)
			{
				m_bulkEditBar = bulkEditBar;
				string settingsXml = SerializeSettings();
				Mediator mediator = bulkEditBar.m_mediator;
				// first store current tab settings in the property table.
				string currentTabSettingsKey = BuildCurrentTabSettingsKey(bulkEditBar);
				mediator.PropertyTable.SetProperty(currentTabSettingsKey, settingsXml, false, PropertyTable.SettingsGroup.LocalSettings);
				mediator.PropertyTable.SetPropertyPersistence(currentTabSettingsKey, true);
				// next store the *key* to the current tab settings in the property table.
				string lastTabSettingsKey = BuildLastTabSettingsKey(bulkEditBar);
				mediator.PropertyTable.SetProperty(lastTabSettingsKey, currentTabSettingsKey, false, PropertyTable.SettingsGroup.LocalSettings);
				mediator.PropertyTable.SetPropertyPersistence(lastTabSettingsKey, true);
			}
예제 #18
0
			/// <summary>
			///
			/// </summary>
			protected override void SetupBulkEditBarTab(BulkEditBar bulkEditBar)
			{
				base.SetupBulkEditBarTab(bulkEditBar);

				// now handle the process combo.
				if (m_bulkEditBar.m_transduceProcessorCombo != null)
					m_bulkEditBar.m_transduceProcessorCombo.Text = this.Process;
			}
예제 #19
0
			/// <summary>
			/// factory returning a tab settings object, if we found them in the property table.
			/// </summary>
			/// <param name="bulkEditBar"></param>
			/// <returns></returns>
			static private BulkEditTabPageSettings DeserializeLastTabPageSettings(BulkEditBar bulkEditBar)
			{
				Mediator mediator = bulkEditBar.m_mediator;
				string lastTabSettingsKey = BuildLastTabSettingsKey(bulkEditBar);
				// the value of LastTabSettings is the key to the tab settings in the property table.
				string tabSettingsKey = mediator.PropertyTable.GetStringProperty(lastTabSettingsKey, "", PropertyTable.SettingsGroup.LocalSettings);
				return DeserializeTabPageSettings(bulkEditBar, tabSettingsKey);
			}
예제 #20
0
			/// <summary>
			///
			/// </summary>
			/// <param name="bulkEditBar"></param>
			protected override void SaveSettings(BulkEditBar bulkEditBar)
			{
				base.SaveSettings(bulkEditBar);

				// now temporarily save some nonserializable objects so that they will
				// persist for the duration of the app, but not after closing the app.
				// 1) the Find & Replace pattern
				string keyFindPattern = BuildFindPatternKey(bulkEditBar);
				Mediator mediator = bulkEditBar.m_mediator;
				// store the Replace string into the Pattern
				m_bulkEditBar.m_pattern.ReplaceWith = m_bulkEditBar.m_tssReplace;
				VwPatternSerializableSettings patternSettings = new VwPatternSerializableSettings(m_bulkEditBar.m_pattern);
				string patternAsXml = XmlUtils.SerializeObjectToXmlString(patternSettings);
				mediator.PropertyTable.SetProperty(keyFindPattern, patternAsXml, false);
				mediator.PropertyTable.SetPropertyPersistence(keyFindPattern, true);
			}
예제 #21
0
			static private BulkEditTabPageSettings DeserializeTabPageSettings(BulkEditBar bulkEditBar, string tabSettingsKey)
			{
				Mediator mediator = bulkEditBar.m_mediator;
				string settingsXml = "";
				if (tabSettingsKey.Length > 0)
					settingsXml = mediator.PropertyTable.GetStringProperty(tabSettingsKey, "", PropertyTable.SettingsGroup.LocalSettings);
				BulkEditTabPageSettings restoredTabPageSettings = null;
				if (settingsXml.Length > 0)
				{
					// figure out type/class of object to deserialize from xml data.
					XmlDocument doc = new XmlDocument();
					doc.LoadXml(settingsXml);
					string className = doc.DocumentElement.Name;
					// get the type from the xml itself.
					Assembly assembly = Assembly.GetExecutingAssembly();
					// if we can find an existing class/type, we can try to deserialize to it.
					BulkEditTabPageSettings basicTabPageSettings = new BulkEditTabPageSettings();
					Type pgSettingsType = basicTabPageSettings.GetType();
					string baseClassTypeName = pgSettingsType.FullName.Split(new char[] { '+' })[0];
					Type targetType = assembly.GetType(baseClassTypeName + "+" + className, false);

					// deserialize
					restoredTabPageSettings = (BulkEditTabPageSettings)
						XmlUtils.DeserializeXmlString(settingsXml, targetType);
				}
				if (restoredTabPageSettings == null)
					restoredTabPageSettings = new BulkEditTabPageSettings();
				restoredTabPageSettings.m_bulkEditBar = bulkEditBar;
				return restoredTabPageSettings;
			}
예제 #22
0
			private static string BuildFindPatternKey(BulkEditBar bulkEditBar)
			{
				string toolId = GetBulkEditBarToolId(bulkEditBar);
				string currentTabPageName = GetCurrentTabPageName(bulkEditBar);
				string keyFindPattern = String.Format("{0}_{1}_FindAndReplacePattern", toolId, currentTabPageName);
				return keyFindPattern;
			}
예제 #23
0
			/// <summary>
			///
			/// </summary>
			/// <param name="bulkEditBar"></param>
			/// <returns></returns>
			protected static string GetCurrentTabPageName(BulkEditBar bulkEditBar)
			{
				int selectedTabIndex = bulkEditBar.m_operationsTabControl.SelectedIndex;
				BulkEditBarTabs tab = (BulkEditBarTabs)Enum.Parse(typeof(BulkEditBarTabs), selectedTabIndex.ToString());
				return tab.ToString();
			}
예제 #24
0
		public SemanticDomainChooserBEditControl(FdoCache cache, Mediator mediator, BulkEditBar bar, XmlNode colSpec) :
			base(cache, mediator, colSpec)
		{
			m_suggestButton = new Button();
			m_suggestButton.Text = XMLViewsStrings.ksSuggestButtonText;
			m_suggestButton.Image = ResourceHelper.SuggestLightbulb;
			m_suggestButton.ImageAlign = ContentAlignment.MiddleRight;
			m_toolTip = new ToolTip();
			m_toolTip.SetToolTip(m_suggestButton, XMLViewsStrings.ksSuggestButtonToolTip);
			m_doingSuggest = false;
			m_semDomRepo = cache.ServiceLocator.GetInstance<ICmSemanticDomainRepository>();
			m_bar = bar;
			m_searchCache = new SemDomSearchCache(cache);
		}
예제 #25
0
			/// <summary>
			/// Construct the property table key based upon the tool using this BulkEditBar.
			/// </summary>
			/// <param name="bulkEditBar"></param>
			/// <returns></returns>
			private static string BuildLastTabSettingsKey(BulkEditBar bulkEditBar)
			{
				Mediator mediator = bulkEditBar.m_mediator;
				string toolId = GetBulkEditBarToolId(bulkEditBar);
				string property = String.Format("{0}_LastTabPageSettings", toolId);
				return property;
			}