void NameNodeTextBox_LabelChanged(object sender, LabelEventArgs e)
 {
     NodeTextBox box = sender as NodeTextBox;
     if (box.Parent.CurrentNode == null) return;
     DataNode node = box.Parent.CurrentNode.Tag as DataNode;
     if (e.NewLabel.Trim() == "" || e.NewLabel.Trim() == TextHelper.GetString("Label.AddExpression"))
     {
         node.Text = e.OldLabel != "" ? e.OldLabel : TextHelper.GetString("Label.AddExpression");
         return;
     }
     bool newExp;
     if (node.NextNode == null) newExp = PanelsHelper.watchUI.AddElement(e.NewLabel);
     else newExp = PanelsHelper.watchUI.ReplaceElement(e.OldLabel, e.NewLabel);
     if (!newExp) node.Text = e.OldLabel;
 }
 void ValueNodeTextBox_LabelChanged(object sender, LabelEventArgs e)
 {
     NodeTextBox box = sender as NodeTextBox;
     if (box.Parent.CurrentNode == null) return;
     VariableNode node = box.Parent.CurrentNode.Tag as VariableNode;
     node.IsEditing = false;
     try
     {
         var debugManager = PluginMain.debugManager;
         var flashInterface = debugManager.FlashInterface;
         IASTBuilder b = new ASTBuilder(false);
         ValueExp exp = b.parse(new java.io.StringReader(node.GetVariablePath()));
         var ctx = new ExpressionContext(flashInterface.Session, flashInterface.GetFrames()[debugManager.CurrentFrame]);
         var obj = exp.evaluate(ctx);
         node.Variable = (Variable)obj;
         if (!watchMode) PanelsHelper.watchUI.UpdateElements();
         if (ValueChanged != null) ValueChanged(this, EventArgs.Empty);
     }
     catch (Exception ex)
     {
         ErrorManager.ShowError(TextHelper.GetString("Error.Reevaluate"), ex);
     }
 }
Example #3
0
        /// <summary>
        /// Called after a label has been edited.  We need to do some name validation here
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        void textBox_LabelChanged(object sender, LabelEventArgs e)
        {
            SceneNode node = e.Subject as SceneNode;
            if (node == null)
                return;

            GUIView view = node.Tag as GUIView;
            GUIControl control = node.Tag as GUIControl;
            if(view != null)
            {
                GUIView existingView = Scene.GetView(e.NewLabel);
                if(existingView != null)
                {
                    MessageBox.Show("Name already in use", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // If we got here, it's a unique name.  Change it now.
                view.Name = e.NewLabel;
              
                if (SelectedViewRenamed != null)
                    SelectedViewRenamed(this, view);
            }
            else if(control != null)
            {
                // Check to see if the parent sceneView contains any other controls by the same name.
                if (control.ParentView.Controls.GetControl(e.NewLabel) != null)
                {
                    MessageBox.Show("Name already in use", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                // If we got here, it's a unique name.  Change it now.
                control.Name = e.NewLabel;

                if (SelectedControlRenamed != null)
                    SelectedControlRenamed(this, control);
            }
        }