public void CreateMeta(ESpecifierMode mode) { if (mode == ESpecifierMode.MODE_UPROPERTY) { AddMetaTextBox("DisplayName"); AddMetaTextBox("Category", false); AddMetaTextBox("Config", false, false); AddMetaTextBox("ReplicatedUsing", false, false); AddMetaTextBox("BitmaskEnum"); AddMetaCheckBox("Bitmask"); AddMetaCheckBox("AllowAbstract"); AddMetaCheckBox("AllowClasses"); AddMetaCheckBox("AllowPreserveRatio"); AddMetaCheckBox("ArrayClamp"); AddMetaCheckBox("DisplayThumbnail"); AddMetaTextBox("EditCondition", true, false); AddMetaCheckBox("ExactClass"); AddMetaCheckBox("ExposeOnSpawn"); AddMetaCheckBox("HideAlphaChannel"); AddMetaCheckBox("MultiLine"); AddMetaCheckBox("NoElementDuplicate"); AddMetaCheckBox("NoSpinbox"); AddMetaCheckBox("FilePathFilter"); AddMetaCheckBox("RelativePath"); AddMetaCheckBox("ShowOnlyInnerProperties"); // Will have to add MetaInteger scroll viewer for ranged values //AddMetaCheckBox("ClampMin"); //AddMetaCheckBox("ClampMax"); } else if (mode == ESpecifierMode.MODE_UCLASS) { // Not implemented at the moment //AddMetaTextBox("HideCategories"); //AddMetaTextBox("HideFunctions"); //AddMetaTextBox("ShowCategories"); //AddMetaTextBox("AutoCollapseCategories"); //AddMetaTextBox("AutoExpandCategories"); AddMetaTextBox("Within", false, false); AddMetaCheckBox("BlueprintSpawnableComponent"); } else if (mode == ESpecifierMode.MODE_UENUM) { AddMetaCheckBox("Bitflags"); } else if (mode == ESpecifierMode.MODE_UFUNCTION) { AddMetaTextBox("Category", false); AddMetaTextBox("CustomThunk", false, false); } else if (mode == ESpecifierMode.MODE_USTRUCT) { // Not implemented at the moment //AddMetaTextBox("HideCategories"); //AddMetaTextBox("HideFunctions"); //AddMetaTextBox("ShowCategories"); //AddMetaTextBox("AutoCollapseCategories"); //AddMetaTextBox("AutoExpandCategories"); } }
private void GenerateSpecifierCallback(object sender, EventArgs e) { //ThreadHelper.JoinableTaskFactory.Run(async () => //{ // await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync(); //}); GeneratorDialog dialog = new GeneratorDialog(); dialog.ShowModal(); if (dialog.ReturnCode == EReturnCode.RETURN_OK) { string text = dialog.ChosenSpecifier; ESpecifierMode editMode = 0; if (text.Contains("UPROPERTY")) { editMode = ESpecifierMode.MODE_UPROPERTY; } else if (text.Contains("UFUNCTION")) { editMode = ESpecifierMode.MODE_UFUNCTION; } else if (text.Contains("UCLASS")) { editMode = ESpecifierMode.MODE_UCLASS; } else if (text.Contains("UENUM")) { editMode = ESpecifierMode.MODE_UENUM; } else if (text.Contains("USTRUCT")) { editMode = ESpecifierMode.MODE_USTRUCT; } SpecifierDialog dialog2 = new SpecifierDialog(editMode, text + " (Generated)", string.Empty); dialog2.ShowModal(); if (dialog2.ReturnCode == EReturnCode.RETURN_OK) { if (!string.IsNullOrWhiteSpace(dialog2.OutputResult)) { DTE dte = (DTE)this.ServiceProvider.GetService(typeof(DTE)); if (dte != null) { var txt = (TextSelection)dte.ActiveDocument.Selection; txt.Text = dialog2.OutputResult; } } } } }
public SpecifierDialog(ESpecifierMode mode, string property, string parameters) : base() { this.InitializeComponent(); SpecifierListBox.SelectionMode = SelectionMode.Multiple; OutputResult = ""; ReturnCode = EReturnCode.RETURN_CANCELLED; m_Data = new SortedDictionary <string, SpecifierData>(); Title += " - " + property; MetaScroller.Content = metaPanel; CreateCheckBoxList(mode); currentMode = mode; ParseExistingSpecifier(parameters); }
public void CreateCheckBoxList(ESpecifierMode mode) { //ESpecifierMode md = (ESpecifierMode)mode; System.Collections.Specialized.StringCollection specifierList = new System.Collections.Specialized.StringCollection(); switch (mode) { case ESpecifierMode.MODE_UPROPERTY: specifierList = EditSpecifiersPackage.Instance.PropertySpecifierList; //Properties.Settings.Default.UPROPERTY_Specifiers; break; case ESpecifierMode.MODE_UENUM: specifierList = EditSpecifiersPackage.Instance.EnumSpecifierList; //Properties.Settings.Default.UPROPERTY_Specifiers; break; case ESpecifierMode.MODE_USTRUCT: specifierList = EditSpecifiersPackage.Instance.StructSpecifierList; //Properties.Settings.Default.UPROPERTY_Specifiers; break; case ESpecifierMode.MODE_UCLASS: specifierList = EditSpecifiersPackage.Instance.ClassSpecifierList; //Properties.Settings.Default.UPROPERTY_Specifiers; break; case ESpecifierMode.MODE_UFUNCTION: specifierList = EditSpecifiersPackage.Instance.FunctionSpecifierList; //Properties.Settings.Default.UPROPERTY_Specifiers; break; case ESpecifierMode.MODE_UINTERFACE: specifierList = EditSpecifiersPackage.Instance.InterfaceSpecifierList; //Properties.Settings.Default.UINTERFACE_Specifiers; break; } CreateMeta(mode); TheList = new ObservableCollection <BoolStringClass>(); for (int i = 0; i < specifierList.Count; ++i) { TheList.Add(new BoolStringClass { TheText = specifierList[i], TheValue = i + 1, TheCheck = false }); } this.DataContext = this; }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void MenuItemCallback(object sender, EventArgs e) { string message = string.Format(CultureInfo.CurrentCulture, "Inside {0}.MenuItemCallback()", this.GetType().FullName); string title = "EditSpecifiers"; // Show a message box to prove we were here /* * VsShellUtilities.ShowMessageBox( * this.ServiceProvider, * message, * title, * OLEMSGICON.OLEMSGICON_INFO, * OLEMSGBUTTON.OLEMSGBUTTON_OK, * OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); */ DTE dte = (DTE)this.ServiceProvider.GetService(typeof(DTE)); if (dte == null) { return; } string text = ""; string parameters = ""; //IWpfTextViewHost host = GetCurrentViewHost(); //text = host.TextView.Selection.SelectedSpans[0].GetText(); if (dte.ActiveDocument != null) { var selection = (TextSelection)dte.ActiveDocument.Selection; if (text.Length == 0) { selection.WordLeft(); selection.WordRight(true); text = selection.Text; // See if we have an existing specifier definition to parse through selection.WordRight(true); if (selection.Text.Contains("(")) { //selection.WordRight(false, -1); selection.EndOfLine(true); parameters = selection.Text; int depth = 0; bool entered = false; int splitpos = 0; for (int i = 0; i < parameters.Length; ++i) { if (parameters[i] == '(') { depth++; } else if (parameters[i] == ')') { depth--; } if (depth >= 1 && !entered) { entered = true; } if (entered && depth <= 0) { splitpos = i + 1; break; } } if (depth != 0) { VsShellUtilities.ShowMessageBox( this.ServiceProvider, "Edit Specifiers found parsing errors in an existing specifier\nPlease correct any mismatching parenthesis", "", OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); return; } selection.CharRight(true, (-1 * (parameters.Length - splitpos))); if (splitpos < parameters.Length) { parameters = parameters.Remove(splitpos); } } else if (!selection.ActivePoint.AtEndOfDocument) { // selection.WordRight(true, -1); selection.CharRight(true, -1); } } } else { return; } #if !DEBUG if (text.Length == 0) { return; } #endif ESpecifierMode editMode = 0; if (text.Contains("UPROPERTY")) { editMode = ESpecifierMode.MODE_UPROPERTY; } else if (text.Contains("UFUNCTION")) { editMode = ESpecifierMode.MODE_UFUNCTION; } else if (text.Contains("UCLASS")) { editMode = ESpecifierMode.MODE_UCLASS; } else if (text.Contains("UENUM")) { editMode = ESpecifierMode.MODE_UENUM; } else if (text.Contains("USTRUCT")) { editMode = ESpecifierMode.MODE_USTRUCT; } else { VsShellUtilities.ShowMessageBox( this.ServiceProvider, "Edit Specifiers did not find a correct UE4 specifier.\nValid Specifiers are as follows:\n\nUPROPERTY\nUFUNCTION\nUENUM\nUCLASS\nUSTRUCT", "", OLEMSGICON.OLEMSGICON_INFO, OLEMSGBUTTON.OLEMSGBUTTON_OK, OLEMSGDEFBUTTON.OLEMSGDEFBUTTON_FIRST); return; } SpecifierDialog dialog = new SpecifierDialog(editMode, text, parameters); dialog.ShowModal(); if (dialog.ReturnCode == EReturnCode.RETURN_OK) { if (!string.IsNullOrWhiteSpace(dialog.OutputResult)) { var txt = (TextSelection)dte.ActiveDocument.Selection; txt.Text = dialog.OutputResult; } } }
public void CreateMeta(ESpecifierMode mode) { if (mode == ESpecifierMode.MODE_UPROPERTY) { AddMetaTextBox("DisplayName"); AddMetaTextBox("Category", false); AddMetaTextBox("Config", false, false); AddMetaTextBox("ReplicatedUsing", false, false); AddMetaTextBox("BitmaskEnum"); AddMetaCheckBox("Bitmask"); AddMetaCheckBox("AllowAbstract"); AddMetaCheckBox("AllowClasses"); AddMetaCheckBox("AllowPreserveRatio"); AddMetaCheckBox("ArrayClamp"); AddMetaCheckBox("DisplayThumbnail"); AddMetaTextBox("EditCondition", true, false); AddMetaCheckBox("ExactClass"); AddMetaCheckBox("ExposeOnSpawn"); AddMetaCheckBox("HideAlphaChannel"); AddMetaCheckBox("MultiLine"); AddMetaCheckBox("NoElementDuplicate"); AddMetaCheckBox("NoSpinbox"); AddMetaCheckBox("FilePathFilter"); AddMetaCheckBox("RelativePath"); AddMetaCheckBox("ShowOnlyInnerProperties"); // Will have to add MetaInteger scroll viewer for ranged values //AddMetaCheckBox("ClampMin"); //AddMetaCheckBox("ClampMax"); } else if (mode == ESpecifierMode.MODE_UCLASS) { AddMetaTextBox("AutoCollapseCategories", false, false, true); AddMetaTextBox("AutoExpandCategories", false, false, true); AddMetaTextBox("ClassGroup", false, true, false); AddMetaTextBox("Config", false, true, false); AddMetaTextBox("DependsOn", false, false, true); AddMetaTextBox("DontAutoCollapseCategories", false, false, true); AddMetaTextBox("HideCategories", false, false, true); AddMetaTextBox("HideFunctions", false, false, true); AddMetaTextBox("ShowCategories", false, false, true); AddMetaTextBox("ShowFunctions", false, false, true); AddMetaTextBox("Within", false, false, false); AddMetaCheckBox("BlueprintSpawnableComponent"); AddMetaCheckBox("BlueprintThreadSafe"); AddMetaCheckBox("ChildCannotTick"); AddMetaCheckBox("ChildCanTick"); AddMetaCheckBox("DeprecatedNode"); AddMetaTextBox("DeprecationMessage", true, true, false); AddMetaTextBox("DisplayName", true, true, false); AddMetaCheckBox("DontUseGenericSpawnObject"); AddMetaCheckBox("ExposedAsyncProxy"); AddMetaCheckBox("IgnoreCategoryKeywordsInSubclasses"); AddMetaTextBox("IsBlueprintBase", true, true, false); AddMetaTextBox("KismetHideOverrides", true, true, false); AddMetaTextBox("ProhibitedInterfaces", true, true, false); AddMetaTextBox("RestrictedToClasses", true, true, false); AddMetaTextBox("ShortToolTip", true, true, false); AddMetaCheckBox("ShowWorldContextPin"); AddMetaCheckBox("UsesHierarchy"); AddMetaTextBox("ToolTip", true, true, false); } else if (mode == ESpecifierMode.MODE_UENUM) { AddMetaCheckBox("Bitflags"); AddMetaCheckBox("Experimental"); AddMetaTextBox("ScriptName", true, true); AddMetaTextBox("ToolTip", true, true); } else if (mode == ESpecifierMode.MODE_UFUNCTION) { AddMetaTextBox("Category", false, true); AddMetaTextBox("AdvancedDisplay", true, true); AddMetaTextBox("ArrayParm", true, true); AddMetaTextBox("ArrayTypeDependentParams", true, true); AddMetaTextBox("AutoCreateRefTerm", true, true); AddMetaCheckBox("BlueprintAutocast"); AddMetaCheckBox("BlueprintInternalUseOnly"); AddMetaCheckBox("BlueprintProtected"); AddMetaCheckBox("CallableWithoutWorldContext"); AddMetaCheckBox("CommutativeAssociativeBinaryOperator"); AddMetaTextBox("CompactNodeTitle", true, true); AddMetaTextBox("CustomStructureParam", true, true); AddMetaCheckBox("DefaultToSelf"); AddMetaCheckBox("DeprecatedFunction"); AddMetaTextBox("DeprecationMessage", true, true); AddMetaCheckBox("DevelopmentOnly"); AddMetaTextBox("DisplayName", true, true); AddMetaTextBox("ExpandEnumAsExecs", true, true); AddMetaTextBox("HidePin", true, true); AddMetaCheckBox("HideSelfPin"); AddMetaTextBox("InternalUseParam", true, true); AddMetaTextBox("KeyWords", true, true); AddMetaCheckBox("Latent"); AddMetaTextBox("LatentInfo", true, true); AddMetaCheckBox("MaterialParameterCollectionFunction"); AddMetaCheckBox("NativeBreakFunc"); AddMetaCheckBox("NotBlueprintThreadSafe"); AddMetaTextBox("ShortToolTip", true, true); AddMetaTextBox("ToolTip", true, true); AddMetaCheckBox("UnsafeDuringActorConstruction"); AddMetaTextBox("WorldContext", true, true); } else if (mode == ESpecifierMode.MODE_USTRUCT) { // Not implemented at the moment //AddMetaTextBox("HideCategories"); //AddMetaTextBox("HideFunctions"); //AddMetaTextBox("ShowCategories"); //AddMetaTextBox("AutoCollapseCategories"); //AddMetaTextBox("AutoExpandCategories"); } else if (mode == ESpecifierMode.MODE_UINTERFACE) { AddMetaCheckBox("CannotImplementInterfaceInBlueprint"); } }