public frmMergeGNLines(IApplication app, IEditor editor)
 {
     InitializeComponent();
     _app = app;
     m_editor = editor;
     m_Config = ConfigUtil.GetMergeSplitConfig();
 }
Beispiel #2
0
        // modified form constructor to accept the app and editor objects passed by ref
        public SpiralCurveDialog(ref IApplication pApp, ref IEditor pEditor)
        {
            //
            // Required for Windows Form Designer support
            //
            InitializeComponent();

            try
            {
                m_pApp = pApp;

                m_pEditor = pEditor;
                m_pEditProp2 = (IEditProperties2)m_pEditor;

                // REGEX strings that will be used for DMS units
                m_RegexUnitsDMS = new ArrayList();
                m_RegexUnitsDMS.Add(@" *(\d+)\.(\d\d)(\d\d\d\d) *");
                m_RegexUnitsDMS.Add(@" *(\d+)\/(\d+)\/(\d+\.?\d*) *");
                m_RegexUnitsDMS.Add(@" * *(\d+)\^(\d+)\'(\d+\.?\d*)\" + quote + " *");
                m_RegexUnitsDMS.Add(@" *(\d+)\-(\d+)\-(\d+\.?\d*) *");

                // REGEX string that will be used for DD, radians, Gons, etc..
                m_RegexUnitsDecimals = @" *(\d+\.?\d+) *";

                // REGEX object for validating the length with units
                m_RegexUnitsMeasure = new Regex(@"(\d*\.?\d+) *(" + String.Join("|", this.AllowedUnits) + ") *$");

                // validate the spatial reference of the edit data frame;
                m_SRValid = SpatialRefValid();
            }
            catch
            {

            }
        }
        /// <summary>
        /// 引き継いで新規作成
        /// </summary>
        /// <param name="iEditor">テキストを取得するためのIEditorインターフェース</param>
        /// <returns>正否だけどとりあえずtrueしか返さない</returns>
        public bool CreateNewPlus(IEditor iEditor)
        {
            NewFilePlusControl control = new NewFilePlusControl();
            control.Owner = Application.Current.MainWindow;
            var newFilePlusViewModel = NewFilePlusGenerator.GetNewFilePlusViewModel();
            control.DataContext = newFilePlusViewModel;

            //ダイアログを表示する
            if (ShowDialogManager.ShowDialog(control) == true)
            {
                var transferData = NewFilePlusGenerator.GetTransferData(newFilePlusViewModel);

                ModelsComposite.CreateNew(iEditor);
                CurrentFile = "";

                // Transferの過程でイベントが発生しても怒られないように、一旦Newの状態を各画面に通知する
                EventAggregator.OnDataReloaded(this, new DataReloadedEventArgs());

                // 引き継ぎ
                NewFilePlusTransferer.Transfer(transferData);

                // もっかい画面に通知
                EventAggregator.OnDataReloaded(this, new DataReloadedEventArgs());

                return true;
            }

            return true;
        }
Beispiel #4
0
        public static void Load(IEditor editor, string fileName)
        {
            editor.Clear();

            var doc = new XmlDocument();
            doc.Load(fileName);
            var waves = doc.SelectSingleNode("Waves");

            editor.WaveList = new ObservableCollection<Wave>();

            foreach (XmlNode wave in waves.SelectNodes("Wave"))
            {
                var w = new Wave();
                w.EnemyList = new ObservableCollection<Enemy>();

                foreach (XmlNode enemy in wave.SelectNodes("Enemy"))
                {
                    w.EnemyList.Add(new Enemy
                    {
                        Type = enemy.GetAttribute("Type"),
                        Spawn = float.Parse(enemy.GetAttribute("Spawn").Default("0")),
                        X = float.Parse(enemy.GetAttribute("X").Default("0")),
                        Speed = float.Parse(enemy.GetAttribute("Speed").Default("0")),
                        Money = float.Parse(enemy.GetAttribute("Money").Default("0"))
                    });
                }

                editor.WaveList.Add(w);
            }
        }
 //! Save xml.
 public void SaveXml(XmlWriter Writer, IEditor AssetDatabase)
 {
     // Write original prefab
     Writer.WriteAttributeString("prefab", AssetDatabase.GetAssetPath(AssetDatabase.GetPrefabParent(gameObject)));
     // Save instance
     m_Instance.SaveXml(Writer);
 }
 public FindReplaceDialogViewModel(IEditor editor)
 {
     this.editor = editor;
     //_searchDirections = new List<string>();
     //_searchDirections.Add("Next");
     //_searchDirections.Add("Prev");
 }
Beispiel #7
0
        public CommandDPForm()
        {
            InitializeComponent();
            this.pbImage.Image = new Bitmap(CommandDPForm.IMG_WIDTH, CommandDPForm.IMG_HEIGHT);

            Graphics imgGraphics = Graphics.FromImage(this.pbImage.Image);
            imgGraphics.Clear(Color.White);
            this.calcStretch();

            this.tool = Palette.LINE;
            this.tsbLine.Tag = Palette.LINE;
            this.tsbRectangle.Tag = Palette.RECTANGLE;
            this.tsbEllipse.Tag = Palette.ELLIPSE;

            this.tsbLeft.Tag = MoveType.LEFT;
            this.tsbUp.Tag = MoveType.UP;
            this.tsbRight.Tag = MoveType.RIGHT;
            this.tsbDown.Tag = MoveType.DOWN;

            this.tscbLineWidth.SelectedIndex = 0;
            this.tsbColor.BackColor = Color.Black;

            this.editor = new Editor();
            this.tscbShapes.Items.Add(new EmptyShape(Pens.White));
            this.tscbShapes.SelectedIndex = 0;
        }
 public CurrentUserInfo(IEditor editor)
 {
     _userName = Environment.UserName;
       _domainName = Environment.UserDomainName;
       _fullName = String.Format(@"{0}\{1}", _domainName, _userName);
       _databaseUser = GetDatabaseUser(editor);
 }
        /// <summary>
        /// 新規作成
        /// </summary>
        /// <param name="iEditor">テキストを取得するためのIEditorインターフェース</param>
        /// <returns>正否だけどとりあえずtrueしか返さない</returns>
        public bool CreateNew(IEditor iEditor)
        {
            ModelsComposite.CreateNew(iEditor);
            CurrentFile = "";

            EventAggregator.OnDataReloaded(this, new DataReloadedEventArgs());

            return true;
        }
    EventListener(IEditor editor, bool bListenAll)
    {
      if (editor == null)
      {
        throw new ArgumentNullException();
      }

      m_editor = editor;
    }
 public void Setup()
 {
     _messageDispatcher = new Fake_MessageDispatcher();
     _pluginFactory = MockRepository.GenerateMock<IPluginLoader>();
     _editor = MockRepository.GenerateMock<IEditor>();
     _fileWriter = MockRepository.GenerateMock<IFileWriter>();
     _dispatcher = new EditorDispatcher(_pluginFactory, _messageDispatcher, _fileWriter);
     _dispatcher.SetEditor(_editor);
 }
    public EventListener(IEditor editor, EditorEvent editEvent)
    {
      if (editor == null)
      {
        throw new ArgumentNullException();
      }

      m_editor = editor;

    }
        public SetFlowByDigitizedDirectionCSharp()
        {
            UID uidUtilNet = new UIDClass();
            uidUtilNet.Value = "esriEditorExt.UtilityNetworkAnalysisExt";
            m_utilNetExt = ArcMap.Application.FindExtensionByCLSID(uidUtilNet) as IUtilityNetworkAnalysisExt;

            UID uidEditor = new UIDClass();
            uidEditor.Value = "esriEditor.Editor";
            m_editorExt = ArcMap.Application.FindExtensionByCLSID(uidEditor) as IEditor;        
        }
Beispiel #14
0
        //! Save scene.
        public void SaveScene(string Path, IEditor AssetDatabase)
        {
            // Testing for now
            var stream = new FileStream(Application.dataPath + "/Scenes/" + Path + "scene.bytes", FileMode.Create);
            var formatter = new BinaryFormatter();

            // Serialize map
            m_TerrainManager.Save(formatter, stream, AssetDatabase);

            stream.Flush();
            stream.Close();
        }
Beispiel #15
0
 public void NotifyDocumentSaved(IEditor source)
 {
     //If we are the source, don't do anything.  We already have the changes
     if(source != this)
     {
         DotaDataObject obj = EditingObject;
         //Force the property editor to clear out the data and redraw
         EditingObject = null;
         EditingObject = obj;
     }
   
 }
Beispiel #16
0
        public EditorManager(IFileViewModel setting, MainViewModel mainViewModel)
        {
            m_editorsWithSettings = new FilteredObservableCollection<IEditor>(m_baseEditors, editor => editor.Settings != null);
              m_setting = setting;
              m_mainViewModel = mainViewModel;
              m_imageViewerViewModel = new ImageViewerViewModel();
              m_jsonEditorViewModel = new JsonEditorViewModel(mainViewModel);
              m_simpleEditor = new BaseTextEditorViewModel(mainViewModel);
              m_findInFilesViewModel = new FindInFilesViewModel(mainViewModel);

              UpdateSettings();
              m_setting.ContentChanged += SettingOnContentChanged;
        }
        protected override void DoSave(IEditor source)
        {

            if (source is TextEditor)
            {
                TextEditor textEd = source as TextEditor;
                //Commit these changes to the dota object.  
                KeyValue kv = KVParser.KV1.Parse(textEd.TextContent);

                DotaObject.KeyValue = kv;
            }

        }
        public void Bind(IEditor editorContainer, IModel model)
        {
            this.editorContainer = editorContainer;
            this.model = model;
            //this.editorContainer.Editor.Document.HighlightingStrategy =
            //    HighlightingStrategyFactory.CreateHighlightingStrategy("C#");
            OnBind();

            editorContainer.Editor.TextChanged += new EventHandler(Editor_TextChanged);
            editorContainer.Editor.InputChar += new Editors.OnInputChar(Editor_InputChar);
            editorContainer.Editor.KeyPreview += new Editors.OnKeyPreview(Editor_KeyPreview);

            GlobalService.ModelManager.ParseError += new OnParseError(ModelManager_ParseError);
        }
    public ViperPinForm(IEditor3 editor)
    {
      InitializeComponent();

      m_editor = editor;
      m_edSketch = m_editor as IEditSketch3;
      m_editLayers = m_editor as IEditLayers;

      lblEditLayer.Text = m_editLayers.CurrentLayer.Name;

      //Load field combo box with field names
      IFields pFields = m_editLayers.CurrentLayer.FeatureClass.Fields;
		  for (int i=0; i < pFields.FieldCount; i++)
      {
        cmbPINField.Items.Add(pFields.get_Field(i).Name);
      }

      //get pinfield from registry
      string pinField = null;
      RegistryKey pRegKey = Registry.CurrentUser.OpenSubKey("Software\\ESRI\\ViperPin");
      if (pRegKey != null)
      {
        pinField = pRegKey.GetValue("Pinfield").ToString();
      }

      //set the combo box to the pinfield
      for (int i = 0; i < pFields.FieldCount; i++)
      {
        if (pinField == pFields.get_Field(i).Name)
        {
          cmbPINField.Text = pinField;
          break;
        }
        else
        {
          cmbPINField.Text = "None";
        }
      }

      //cmbPINField.SelectedIndex = 0;
      cmbPINField.Refresh();
      m_lotNum = 1;
      txtlot.Text = "1";

      //Set center right of form to center right of screen
      this.StartPosition = FormStartPosition.Manual;
      this.Left = 0;
      this.Top = (Screen.PrimaryScreen.Bounds.Height / 2) - (this.Height / 2);
    }
Beispiel #20
0
        internal EditLogger(ISDUTExtension ext, Transaction current, TransactionConfig config, QAManager qaManager)
        {
            chg_evnt = new IEditEvents_OnChangeFeatureEventHandler(LogFeatureUpdate);
            crt_evnt = new IEditEvents_OnCreateFeatureEventHandler(LogFeatureInsert);
            del_evnt = new IEditEvents_OnDeleteFeatureEventHandler(LogFeatureDelete);

            transaction = current;
            this.config = config;
            this.qaManager = qaManager;

            editor = ext.Editor;

            ((IEditEvents_Event)editor).OnChangeFeature += chg_evnt;
            ((IEditEvents_Event)editor).OnCreateFeature += crt_evnt;
            ((IEditEvents_Event)editor).OnDeleteFeature += del_evnt;
        }
        public ExpandResult Expand(string folderPath, IEditor iEditor)
        {
            _iEditor = iEditor;

            string fileCompositePath = folderPath + "\\document.xml";
            // ちゃんとしたファイルを書き出す。
            XmlSerializer serializer = new XmlSerializer(typeof(XmlSaveObjectVer1_0_0));
            FileStream outstream = new System.IO.FileStream(fileCompositePath, System.IO.FileMode.Open);

            LoadComposition = (XmlSaveObjectVer1_0_0)serializer.Deserialize(outstream);
            outstream.Close();

            ExpandObject();

            return ExpandResult.Succeeded;
        }
        public CurveByInference()
        {
            Finished = true;
            Curves = new ObservableCollection<InferredCurve>();

            if (ArcMap.Application != null)
            {
                m_pEd = ArcMap.Application.FindExtensionByName("esri object editor") as IEditor;
                if (m_pEd != null)
                {
                    _IsEditing = m_pEd.EditState == esriEditState.esriStateEditing;
                    IEditEvents_Event editEvent = (IEditEvents_Event)m_pEd;

                    editEvent.OnStartEditing += new IEditEvents_OnStartEditingEventHandler(editEvent_OnStartEditing);
                    editEvent.OnStopEditing += new IEditEvents_OnStopEditingEventHandler(editEvent_OnStopEditing);
                }
            }
        }
Beispiel #23
0
        public NotebookEditorLabel(EditorNotebook parent_netbook, IEditor se)
        {
            this.CanFocus=false;
            this.BorderWidth = 1;

            string stockIcon = "home.png";

            if (se.FileName != "StartPage"){
                stockIcon = MainClass.Tools.GetIconForExtension( System.IO.Path.GetExtension(se.Caption) );
            }

            image = new Gtk.Image(MainClass.Tools.GetIconFromStock(stockIcon, Gtk.IconSize.Menu));
            image.SetPadding(2,2);
            this.PackStart(image, false, false, 0);

            caption =se.Caption.Replace("_","__");

            lblDisplay.Text = caption;
            lblDisplay.CanFocus=false;

            this.PackStart(lblDisplay, false, false, 0);

            Pixbuf default_pixbuf = null;
            string file = System.IO.Path.Combine(MainClass.Paths.ResDir, "stock-close.png");
            if (System.IO.File.Exists(file)) {
                default_pixbuf = new Pixbuf(file);

                Button btnClose = new Button(new Gtk.Image(default_pixbuf));
                btnClose.TooltipText = MainClass.Languages.Translate("close");
                btnClose.Relief = ReliefStyle.None;
                btnClose.CanFocus = false;
                btnClose.WidthRequest = btnClose.HeightRequest = 18;
                btnClose.Clicked += delegate { parent_netbook.ClosePage(se); };

                this.PackEnd(btnClose, false, false, 0);
            }

            lblDisplay.TooltipText = se.FileName;

            this.ShowAll();
        }
Beispiel #24
0
        public static void Save(IEditor editor, string fileName)
        {
            var text = "<Waves>\r\n";

            foreach (var wave in editor.WaveList)
            {
                text += "\t<Wave BeforeWaveDelay='{0}'>\r\n".ToFormat(wave.BeforeWaveDelay);

                text = wave.EnemyList.Aggregate(text, (current, enemy) => current +
                    "\t\t<Enemy Type='{0}' Spawn='{1}' X='{2}' Speed='{3}' Money='{4}' />\r\n".ToFormat(enemy.Type, enemy.Spawn, enemy.X, enemy.Speed, enemy.Money));

                text += "\t</Wave>\r\n";
            }

            text += "</Waves>";

            using (var file = new StreamWriter(fileName))
            {
                file.WriteLine(text);
            }
        }
Beispiel #25
0
        public MapTopologyDefaults(IApplication pApp)
        {
            try
            {

                m_pApp = pApp;

                UID pUID = new UIDClass();
                pUID.Value = "esriEditor.Editor";
                m_pEditor = (IEditor)m_pApp.FindExtensionByCLSID(pUID);

                pUID.Value = "esriEditorExt.TopologyExtension";
                m_pTopologyExt = m_pApp.FindExtensionByCLSID(pUID) as ITopologyExtension;
                m_pMapTopology = m_pTopologyExt.MapTopology;

                m_pISDUTExt = RestTransactionManager.Instance.BaseTransactionManager.extension(); //(ISDUTExtension)m_pApp.FindExtensionByName("SUITT Extension");

                //m_XYTolerance = SetTopoClasses();

                m_pTopologyExt.CurrentTopology = m_pMapTopology;

                // make sure the specified tolerance is not less than allowable tolerance
                if (m_XYTolerance < GetMinXYTolerance)
                {
                    util.Logger.Write("The specified xy cluster tolerance (" + m_XYTolerance.ToString() + ") for the <SUITT Map Topology> defaults was " +
                        "below the minimum xy tolerance allowed.  The value of " + GetMinXYTolerance.ToString() + " will be used instead.");
                    m_XYTolerance = GetMinXYTolerance;
                }
                m_pMapTopology.ClusterTolerance = m_XYTolerance;

                //m_pMapTopology.Name = "<ISDUT Map Topology>"; // apply the topology name
            }
            catch(Exception ex)
            {
                Debug.WriteLine(ex.Message + "\n" + ex.StackTrace);
                util.Logger.Write(" Descrip  : Setting up the SUITT map topology defaults." +
                    "\n Message  : " + ex.Message +
                    "\n StackTrc : " + ex.StackTrace, util.Logger.LogLevel.Debug);
            }
        }
 public ToggleOperableStatus()
 {
     m_Editor        = Globals.getEditor(ArcMap.Application);
     ConfigUtil.type = "gas";
 }
 public Task <GotoDefinitionInfo> GotoDefinition(IEditor editor, int offset)
 {
     throw new NotImplementedException();
 }
 public void AttachEditor(IEditor editor)
 {
     _editor = editor;
 }
        public EstablishFlowDigitized()
        {
            m_Editor = Globals.getEditor(ArcMap.Application);

            ConfigUtil.type = "gas";
        }
Beispiel #30
0
 public static void UpdatePlaceholderColor(this MauiTextView textView, IEditor editor) =>
 textView.PlaceholderTextColor = editor.PlaceholderColor?.ToPlatform() ?? ColorExtensions.PlaceholderColor;
Beispiel #31
0
 public static void UpdateVerticalTextAlignment(this MauiTextView textView, IEditor editor)
 {
     textView.VerticalTextAlignment = editor.VerticalTextAlignment;
 }
Beispiel #32
0
        public static void ExpandCode(ILine editLine, Runspace runspace)
        {
            InitTabExpansion();

            // hot line
            if (editLine == null)
            {
                editLine = Far.Api.Line;
                if (editLine == null)
                {
                    A.Message("There is no current editor line.");
                    return;
                }
            }

            int    lineOffset = 0;
            string inputScript;
            int    cursorColumn;
            var    prefix = string.Empty;

            IEditor         editor = null;
            Interactive     console;
            InteractiveArea area;

            // script?
            if (A.Psf.PSVersion.Major > 2 && editLine.WindowKind == WindowKind.Editor && My.PathEx.IsPSFile((editor = Far.Api.Editor).FileName))
            {
                int lineIndex = editor.Caret.Y;
                int lastIndex = editor.Count - 1;

                // previous text
                var sb = new StringBuilder();
                for (int i = 0; i < lineIndex; ++i)
                {
                    sb.AppendLine(editor[i].Text);
                }

                // current line
                lineOffset   = sb.Length;
                cursorColumn = lineOffset + editLine.Caret;

                // remaining text
                for (int i = lineIndex; i < lastIndex; ++i)
                {
                    sb.AppendLine(editor[i].Text);
                }
                sb.Append(editor[lastIndex]);

                // whole text
                inputScript = sb.ToString();
            }
            // area?
            else if (editor != null && (console = editor.Host as Interactive) != null && (area = console.CommandArea()) != null)
            {
                int lineIndex = area.Caret.Y;
                int lastIndex = area.LastLineIndex;

                // previous text
                var sb = new StringBuilder();
                for (int i = area.FirstLineIndex; i < lineIndex; ++i)
                {
                    sb.AppendLine(editor[i].Text);
                }

                // current line
                lineOffset   = sb.Length;
                cursorColumn = lineOffset + area.Caret.X;

                // remaining text
                for (int i = lineIndex; i < lastIndex; ++i)
                {
                    sb.AppendLine(editor[i].Text);
                }
                sb.Append(editor[lastIndex]);

                // whole text
                inputScript = sb.ToString();
            }
            // line
            else
            {
                // original line
                inputScript  = editLine.Text;
                cursorColumn = editLine.Caret;

                // process prefix, used to be just for panels but it is needed in dialogs, too
                Entry.SplitCommandWithPrefix(ref inputScript, out prefix);

                // correct caret
                cursorColumn -= prefix.Length;
                if (cursorColumn < 0)
                {
                    return;
                }
            }

            // skip empty (also avoid errors)
            if (inputScript.Length == 0)
            {
                return;
            }

            // invoke
            try
            {
                // call TabExpansion
                Hashtable result;
                using (var ps = runspace == null ? A.Psf.NewPowerShell() : PowerShell.Create())
                {
                    if (runspace != null)
                    {
                        ps.Runspace = runspace;
                    }

                    result = (Hashtable)ps.AddScript(_callTabExpansion, true).AddArgument(inputScript).AddArgument(cursorColumn).Invoke()[0].BaseObject;
                }

                // results
                var words = Cast <IList> .From(result["CompletionMatches"]);               //! remote gets PSObject

                int replacementIndex  = (int)result["ReplacementIndex"];
                int replacementLength = (int)result["ReplacementLength"];
                replacementIndex -= lineOffset;
                if (replacementIndex < 0 || replacementLength < 0)
                {
                    return;
                }

                // variables from the current editor
                if (editLine.WindowKind == WindowKind.Editor)
                {
                    // replaced text
                    var lastWord = inputScript.Substring(lineOffset + replacementIndex, replacementLength);

                    //! as TabExpansion.ps1 but ends with \$(\w*)$
                    var matchVar = Regex.Match(lastWord, @"^(.*[!;\(\{\|""'']*)\$(global:|script:|private:)?(\w*)$", RegexOptions.IgnoreCase);
                    if (matchVar.Success)
                    {
                        var start = matchVar.Groups[1].Value;
                        var scope = matchVar.Groups[2].Value;
                        var re    = new Regex(@"\$(global:|script:|private:)?(" + scope + matchVar.Groups[3].Value + @"\w+:?)", RegexOptions.IgnoreCase);

                        var variables = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
                        foreach (var line1 in Far.Api.Editor.Lines)
                        {
                            foreach (Match m in re.Matches(line1.Text))
                            {
                                var all = m.Value;
                                if (all[all.Length - 1] != ':')
                                {
                                    variables.Add(start + all);
                                    if (scope.Length == 0 && m.Groups[1].Value.Length > 0)
                                    {
                                        variables.Add(start + "$" + m.Groups[2].Value);
                                    }
                                }
                            }
                        }

                        // union lists
                        foreach (var x in words)
                        {
                            if (x != null)
                            {
                                variables.Add(TECompletionText(x));
                            }
                        }

                        // final sorted list
                        words = variables.OrderBy(x => x, StringComparer.OrdinalIgnoreCase).ToList();
                    }
                }

                // expand
                ExpandText(editLine, replacementIndex + prefix.Length, replacementLength, words);
            }
            catch (RuntimeException) { }
        }
Beispiel #33
0
        private void SetUp(IEditor createdEditor, object model)
        {
            _newStyledText = null;
            _oldStyledText = null;

            /// 親controllerへの通知
            var containerCtrl = _target.Controller as IContainerController;

            Contract.Requires(
                containerCtrl != null && containerCtrl.CanContainChild(_modelFactory.ModelDescriptor)
                );

            var createdConnectionCtrl = createdEditor.Controller as IConnectionController;
            var createdEdge           = createdEditor.Figure as IEdge;

            if (createdEditor == null || createdConnectionCtrl == null || createdEdge == null)
            {
                /// rollback
                containerCtrl.RemoveChild(model);
                _target.RemoveChildEditor(createdEditor);
                throw new ArgumentException();
            }

            var srcConnectableCtrl = _edgeSourceEditor == null?
                                     null:
                                     _edgeSourceEditor.Controller as IConnectableController;
            var srcConnectableFig = _edgeSourceEditor == null?
                                    null:
                                    _edgeSourceEditor.Figure as IConnectable;
            var tgtConnectableCtrl = _edgeTargetEditor == null?
                                     null:
                                     _edgeTargetEditor.Controller as IConnectableController;
            var tgtConnectableFig = _edgeTargetEditor == null?
                                    null:
                                    _edgeTargetEditor.Figure as IConnectable;

            /// パラメタの妥当性検査
            var isValidSrcConnect =
                _edgeSourceEditor != null &&
                srcConnectableFig != null &&
                createdConnectionCtrl.CanConnectSource(_edgeSourceEditor.Model);
            var isValidSrcDisconnect =
                (_edgeSourceEditor == null ||
                 srcConnectableCtrl == null ||
                 !createdConnectionCtrl.CanConnectSource(_edgeSourceEditor.Model)
                ) &&
                createdConnectionCtrl.CanDisconnectSource;
            var isValidSrc = isValidSrcConnect || isValidSrcDisconnect;

            var isValidTgtConnect =
                _edgeTargetEditor != null &&
                tgtConnectableCtrl != null &&
                createdConnectionCtrl.CanConnectTarget(_edgeTargetEditor.Model);
            var isValidTgtDisconnect =
                (_edgeTargetEditor == null ||
                 tgtConnectableCtrl == null ||
                 !createdConnectionCtrl.CanConnectTarget(_edgeTargetEditor.Model)
                ) &&
                createdConnectionCtrl.CanDisconnectTarget;
            var isValidTgt = isValidTgtConnect || isValidTgtDisconnect;

            if (!isValidSrc || !isValidTgt)
            {
                /// rollback
                containerCtrl.RemoveChild(model);
                _target.RemoveChildEditor(createdEditor);
                throw new ArgumentException();
            }

            /// controllerの通知
            if (isValidSrcConnect)
            {
                createdConnectionCtrl.ConnectSource(_edgeSourceEditor.Model);
                srcConnectableCtrl.ConnectOutgoing(model);
            }
            if (isValidTgtConnect)
            {
                createdConnectionCtrl.ConnectTarget(_edgeTargetEditor.Model);
                tgtConnectableCtrl.ConnectIncoming(model);

                var node  = _edgeTargetEditor.Figure as INode;
                var mtext = _edgeTargetEditor.Model as MemoText;
                _oldStyledText = mtext.StyledText.CloneDeeply() as StyledText.Core.StyledText;
                _newStyledText = mtext.StyledText;

                var charIndex = node.GetCharIndexAt(_edgePoints.Last());

                var inline = node.StyledText.GetInlineAt(charIndex);
                var anc    = default(Anchor);
                if (inline.IsAnchorCharacter)
                {
                    anc = inline as Anchor;
                }
                else
                {
                    /// nodeのcharIndex位置にAnchor追加
                    anc = new Anchor();
                    var insertAnchorCommand = new InsertInlineCommand(_newStyledText, charIndex, anc);
                    insertAnchorCommand.Execute();
                }

                var edge = createdEdge;
                _newTargetAnchorId          = anc.Id;
                _oldTargetAnchorId          = edge.TargetConnectionOption as string;
                edge.TargetConnectionOption = _newTargetAnchorId;

                var connectCommand = new ConnectCommand(createdEditor, createdEdge.TargetAnchor, _edgeTargetEditor, _edgePoints.Last());
                connectCommand.Execute();
            }

            /// figureの編集
            createdEdge.SetEdgePoints(_edgePoints);
            createdEdge.Route();
            if (isValidSrcConnect)
            {
                createdEdge.Source = srcConnectableFig;
            }
            if (isValidTgtConnect)
            {
                createdEdge.Target = tgtConnectableFig;
            }

            createdEditor.Enable();
        }
        public void SaveGeologicEvents()
        {
            int idFld              = m_GeologicEventsTable.FindField("GeologicEvents_ID");
            int eventFld           = m_GeologicEventsTable.FindField("Event");
            int ageDisplayFld      = m_GeologicEventsTable.FindField("AgeDisplay");
            int ageYoungerTermFld  = m_GeologicEventsTable.FindField("AgeYoungerTerm");
            int ageOlderTermFld    = m_GeologicEventsTable.FindField("AgeOlderTerm");
            int timeScaleFld       = m_GeologicEventsTable.FindField("TimeScale");
            int ageYoungerValueFld = m_GeologicEventsTable.FindField("AgeYoungerValue");
            int ageOlderValueFld   = m_GeologicEventsTable.FindField("AgeOlderValue");
            int dataSrcFld         = m_GeologicEventsTable.FindField("DataSourceID");
            int notesFld           = m_GeologicEventsTable.FindField("Notes");

            IEditor theEditor = ArcMap.Editor;

            if (theEditor.EditState == esriEditState.esriStateNotEditing)
            {
                theEditor.StartEditing(m_theWorkspace);
            }
            theEditor.StartOperation();

            try
            {
                string  updateWhereClause = "GeologicEvents_ID = '";
                ICursor insertCursor      = m_GeologicEventsTable.Insert(true);

                foreach (KeyValuePair <string, GeologicEvents> aDictionaryEntry in m_GeologicEventsDictionary)
                {
                    GeologicEvents thisGeologicEvents = (GeologicEvents)aDictionaryEntry.Value;
                    switch (thisGeologicEvents.RequiresUpdate)
                    {
                    case true:
                        updateWhereClause += thisGeologicEvents.GeologicEvents_ID + "' OR GeologicEvents_ID = '";
                        break;

                    case false:
                        IRowBuffer theRowBuffer = m_GeologicEventsTable.CreateRowBuffer();
                        theRowBuffer.set_Value(idFld, thisGeologicEvents.GeologicEvents_ID);
                        theRowBuffer.set_Value(eventFld, thisGeologicEvents.Event);
                        theRowBuffer.set_Value(ageDisplayFld, thisGeologicEvents.AgeDisplay);
                        theRowBuffer.set_Value(ageYoungerTermFld, thisGeologicEvents.AgeYoungerTerm);
                        theRowBuffer.set_Value(ageOlderTermFld, thisGeologicEvents.AgeOlderTerm);
                        theRowBuffer.set_Value(timeScaleFld, thisGeologicEvents.TimeScale);
                        theRowBuffer.set_Value(ageYoungerValueFld, thisGeologicEvents.AgeYoungerValue);
                        theRowBuffer.set_Value(ageOlderValueFld, thisGeologicEvents.AgeOlderValue);
                        theRowBuffer.set_Value(dataSrcFld, thisGeologicEvents.DataSourceID);
                        theRowBuffer.set_Value(notesFld, thisGeologicEvents.Notes);

                        insertCursor.InsertRow(theRowBuffer);
                        break;
                    }
                }

                System.Runtime.InteropServices.Marshal.ReleaseComObject(insertCursor);
                theEditor.StopOperation("Insert GeologicEvents");

                if (updateWhereClause == "GeologicEvents_ID = '")
                {
                    return;
                }

                theEditor.StartOperation();
                updateWhereClause = updateWhereClause.Remove(updateWhereClause.Length - 25);

                IQueryFilter QF = new QueryFilterClass();
                QF.WhereClause = updateWhereClause;

                ICursor updateCursor = m_GeologicEventsTable.Update(QF, false);
                IRow    theRow       = updateCursor.NextRow();

                while (theRow != null)
                {
                    string theID = theRow.get_Value(idFld).ToString();

                    GeologicEvents thisGeologicEvents = m_GeologicEventsDictionary[theID];
                    theRow.set_Value(eventFld, thisGeologicEvents.Event);
                    theRow.set_Value(ageDisplayFld, thisGeologicEvents.AgeDisplay);
                    theRow.set_Value(ageYoungerTermFld, thisGeologicEvents.AgeYoungerTerm);
                    theRow.set_Value(ageOlderTermFld, thisGeologicEvents.AgeOlderTerm);
                    theRow.set_Value(timeScaleFld, thisGeologicEvents.TimeScale);
                    theRow.set_Value(ageYoungerValueFld, thisGeologicEvents.AgeYoungerValue);
                    theRow.set_Value(ageOlderValueFld, thisGeologicEvents.AgeOlderValue);
                    theRow.set_Value(dataSrcFld, thisGeologicEvents.DataSourceID);
                    theRow.set_Value(notesFld, thisGeologicEvents.Notes);

                    updateCursor.UpdateRow(theRow);

                    theRow = updateCursor.NextRow();
                }

                theEditor.StopOperation("Update GeologicEvents");
            }
            catch { theEditor.StopOperation("GeologicEvents Management Failure"); }
        }
        private ClangTranslationUnit GenerateTranslationUnit(IEditor editor, List <ClangUnsavedFile> unsavedFiles)
        {
            ClangTranslationUnit result = null;

            var file = editor.SourceFile;

            if (System.IO.File.Exists(file.Location))
            {
                var args = new List <string>();

                var superProject = file.Project.Solution.StartupProject as IStandardProject;

                if (superProject == null)
                {
                    superProject = file.Project as IStandardProject;
                }

                var project = file.Project as IStandardProject;

                var toolchainIncludes = superProject?.ToolChain?.GetToolchainIncludes(file);

                if (toolchainIncludes != null)
                {
                    AddArguments(args, toolchainIncludes.Select(s => $"-isystem{s}"));
                }

                // toolchain includes
                // This code is same as in toolchain, get compiler arguments... does this need a refactor, or toolchain get passed in? Clang take GCC compatible arguments.
                // perhaps this language service has its own clang tool chain, to generate compiler arguments from project configuration?

                // Referenced includes
                var referencedIncludes = project.GetReferencedIncludes();

                AddArguments(args, referencedIncludes.Select(s => $"-I{s}"));

                // global includes
                var globalIncludes = superProject?.GetGlobalIncludes();

                AddArguments(args, globalIncludes?.Select(s => $"-I{s}"));

                // includes
                AddArguments(args, project.Includes.Select(s => $"-I{Path.Combine(project.CurrentDirectory, s.Value)}"));

                var referencedDefines = project.GetReferencedDefines();

                AddArguments(args, referencedDefines.Select(s => $"-D{s}"));

                // global includes
                var globalDefines = superProject?.GetGlobalDefines();

                AddArguments(args, globalDefines?.Select(s => $"-D{s}"));

                AddArguments(args, project.Defines.Select(s => $"-D{s}"));

                switch (file.Extension)
                {
                case ".c":
                {
                    AddArguments(args, superProject?.CCompilerArguments);
                }
                break;

                case ".cpp":
                {
                    AddArguments(args, superProject?.CppCompilerArguments);
                }
                break;
                }

                // TODO do we mark files as class header? CAn clang auto detect this?
                //if (file.Language == Language.Cpp)
                {
                    args.Add("-xc++");
                    args.Add("-std=c++14");
                    args.Add("-D__STDC__"); // This is needed to ensure inbuilt functions are appropriately prototyped.
                }

                args.Add("-Wunused-variable");

                var translationUnitFlags =
                    TranslationUnitFlags.IncludeBriefCommentsInCodeCompletion |
                    TranslationUnitFlags.PrecompiledPreamble |
                    TranslationUnitFlags.CacheCompletionResults |
                    TranslationUnitFlags.Incomplete;

                result = index.ParseTranslationUnit(file.Location, args.ToArray(), unsavedFiles.ToArray(), translationUnitFlags);
            }

            if (result == null)
            {
                throw new Exception("Error generating translation unit.");
            }

            return(result);
        }
        private static IEditor VerifySnippet(Snippet snippet, string body, IEditor server, bool insertViaMenu = false) {
            if (insertViaMenu) {
                Keyboard.Type(snippet.Shortcut + "\t"); // one tab for auto completion, one tab for snippet
            }
            else {
                Keyboard.Type(snippet.Shortcut + "\t\t");
            }

            server.WaitForText(snippet.Expected.Replace("$body$", body));

            foreach (var decl in snippet.Declarations) {
                Console.WriteLine("Declaration: {0}", decl.Replacement);
                Keyboard.Type(decl.Replacement);
                Keyboard.Type("→");
                server.WaitForText(decl.Expected.Replace("$body$", body));
                Keyboard.Type("\t");
            }
            Keyboard.Type("\r");
            return server;
        }
        /// <summary>
        /// Starts using a brush of the specified type
        /// </summary>
        public void UseBrush( IEditor newBrush )
        {
            if ( m_CurrentBrush != null )
            {
                if ( m_Control != null )
                {
                    m_CurrentBrush.UnbindFromControl( m_Control );
                }
                m_CurrentBrush = null;
            }

            m_CurrentBrush = newBrush;

            if ( m_Control != null )
            {
                m_CurrentBrush.BindToControl( m_Control );
            }
        }
Beispiel #38
0
 public override void ConfigureEditor(IEditor editor)
 {
 }
Beispiel #39
0
        private static IReadOnlyCollection <OpenFileArguments> CreateOpenFileArguments(IReadOnlyCollection <string> files, IEditor preferrEditor)
        {
            var arguments = new List <OpenFileArguments>();

            if (!files.Any())
            {
                return(arguments);
            }

            var fdm = IoC.Get <IFileDefinitionManager>();

            foreach (var file in files)
            {
                var fileDefinition = fdm.GetDefinitionByExtension(Path.GetExtension(file));
                var editorId       = Guid.Empty;
                if (preferrEditor != null)
                {
                    editorId = preferrEditor.EditorId;
                }
                var argument = new OpenFileArguments(fileDefinition, file, editorId);
                arguments.Add(argument);
            }
            return(arguments);
        }
Beispiel #40
0
        private async void debugger_Stopped(object sender, StopRecord e)
        {
            if (ignoreEvents)
            {
                return;
            }

            switch (e.Reason)
            {
            case StopReason.ExitedNormally:
            case StopReason.Exited:
            case StopReason.ExitedSignalled:
                IsExecuting = false;
                IsUpdating  = false;
                StopDebugSession();
                break;

            default:
                IsUpdating = true;

                if (DebugFrameChanged != null)
                {
                    var args = new FrameChangedEventArgs();
                    args.Address         = e.Frame.Address;
                    args.VariableChanges = await currentDebugger.UpdateVariablesAsync();

                    DebugFrameChanged(this, args);
                }

                if (e.Frame != null && e.Frame.FullFileName != null)
                {
                    var normalizedPath = e.Frame.FullFileName.Replace("\\\\", "\\").NormalizePath();

                    ISourceFile file = null;

                    var document = _shell.GetDocument(normalizedPath);

                    if (document != null)
                    {
                        lastDocument = document;
                        file         = document?.ProjectFile;
                    }

                    if (file == null)
                    {
                        file = _shell.CurrentSolution.FindFile(normalizedPath);
                    }

                    if (file != null)
                    {
                        await
                        Dispatcher.UIThread.InvokeTaskAsync(
                            async() => { lastDocument = document = await _shell.OpenDocument(file, e.Frame.Line, 1, true); });
                    }
                    else
                    {
                        _console.WriteLine("Unable to find file: " + normalizedPath);
                    }
                }

                IsUpdating  = false;
                IsExecuting = false;
                break;
            }
        }
Beispiel #41
0
        public void FindNext(bool InvertLeftRight = false)
        {
            IEditor CE = GetCurrentEditor();

            if (CE == null)
            {
                return;
            }
            Regex r;

            if (InvertLeftRight)
            {
                SearchUp = !SearchUp;
                r        = GetRegEx();
                SearchUp = !SearchUp;
            }
            else
            {
                r = GetRegEx();
            }

            Match m = r.Match(CE.Text, r.Options.HasFlag(RegexOptions.RightToLeft) ? CE.SelectionStart : CE.SelectionStart + CE.SelectionLength);

            if (m.Success)
            {
                CE.Select(m.Index, m.Length);
            }
            else
            {
                // we have reached the end of the document
                // start again from the beginning/end,
                object OldEditor = CurrentEditor;
                do
                {
                    if (ShowSearchIn)
                    {
                        CE = GetNextEditor(r.Options.HasFlag(RegexOptions.RightToLeft));
                        if (CE == null)
                        {
                            return;
                        }
                    }
                    if (r.Options.HasFlag(RegexOptions.RightToLeft))
                    {
                        m = r.Match(CE.Text, CE.Text.Length);
                    }
                    else
                    {
                        m = r.Match(CE.Text, 0);
                    }
                    if (m.Success)
                    {
                        CE.Select(m.Index, m.Length);
                        break;
                    }
                    else
                    {
                        // Failed to find the text
                        //MessageBox.Show("No occurence found.", "Search");
                    }
                } while (CurrentEditor != OldEditor);
            }
        }
Beispiel #42
0
 public static void UpdatePlaceholderColor(this Entry platformEntry, IEditor editor)
 {
     platformEntry.PlaceholderColor = editor.PlaceholderColor.ToPlatform();
 }
Beispiel #43
0
 public static void UpdateIsReadOnly(this UITextView textView, IEditor editor)
 {
     textView.UserInteractionEnabled = !(editor.IsReadOnly || editor.InputTransparent);
 }
Beispiel #44
0
 // ========================================
 // method
 // ========================================
 public void Select(IEditor selected)
 {
 }
Beispiel #45
0
 public static void UpdatePlaceholder(this MauiTextView textView, IEditor editor) =>
 textView.PlaceholderText = editor.Placeholder;
Beispiel #46
0
 public void Deselect(IEditor selected)
 {
 }
Beispiel #47
0
 public static void UpdateHorizontalTextAlignment(this UITextView textView, IEditor editor)
 {
     textView.TextAlignment = editor.HorizontalTextAlignment.ToPlatformHorizontal().AdjustForFlowDirection(editor);
 }
Beispiel #48
0
 public SessionHolder(T session, IEditor owner)
 {
     Assert.IsNotNull(session);
     Session = session;
     _owner  = owner;
 }
 public TraceSummaryIsolation()
 {
     m_Editor        = Globals.getEditor(ArcMap.Application);
     ConfigUtil.type = "gas";
 }
Beispiel #50
0
        protected override void OnClick()
        {
            ICadastralEditor   pCadEd         = (ICadastralEditor)ArcMap.Application.FindExtensionByName("esriCadastralUI.CadastralEditorExtension");
            IParcelEditManager pParcEditorMan = (IParcelEditManager)pCadEd;

            if (pParcEditorMan == null)
            {
                return;
            }

            IEditor pEd = (IEditor)ArcMap.Application.FindExtensionByName("esri object editor");

            if (pEd.EditState == esriEditState.esriStateNotEditing)
            {
                MessageBox.Show("Please start editing and try again.");
                return;
            }

            IParcelConstruction pConstr = pParcEditorMan.ParcelConstruction;
            ICadastralPoints    pCadastralPts = pConstr as ICadastralPoints;
            IGSPoint            pFromPoint = null;
            IGSPoint            pToPoint = null;
            IGSLine             pParcelLine = null;
            List <double>       xcoords = new List <double>();
            List <double>       ycoords = new List <double>();
            double dX = 0; double dY = 0;
            bool   bLineSelectionSequence = false;

            #region simple method as fall-back
            for (int i = 0; i < pConstr.LineCount; i++)
            {
                if (pConstr.GetLineSelection(i))
                {
                    if (pConstr.GetLine(i, ref pParcelLine))
                    {
                        pFromPoint = pCadastralPts.GetPoint(pParcelLine.FromPoint);
                        pToPoint   = pCadastralPts.GetPoint(pParcelLine.ToPoint);
                        xcoords.Add((pFromPoint.X + pToPoint.X) / 2);
                        ycoords.Add((pFromPoint.Y + pToPoint.Y) / 2);
                    }
                    bLineSelectionSequence = true;
                }
            }
            if (bLineSelectionSequence)
            {
                dX = xcoords.Average();
                dY = ycoords.Average();
            }
            else
            {
                return;
            }
            IMetricUnitConverter pMetricUnitConv = (IMetricUnitConverter)pCadEd;
            double newX = 0;
            double newY = 0;
            pMetricUnitConv.ConvertXY(esriCadastralUnitConversionType.esriCUCFromMetric, dX, dY, ref newX, ref newY);
            // Calculate center point of current map extent
            IPoint centerPoint = new PointClass();
            centerPoint.SpatialReference = ArcMap.Document.ActiveView.FocusMap.SpatialReference;
            centerPoint.PutCoords(newX, newY);

            IEnvelope envelope = ArcMap.Document.ActiveView.Extent;
            envelope.CenterAt(centerPoint);
            //envelope.Expand(zoomRatio, zoomRatio, true);
            ArcMap.Document.ActiveView.Extent = envelope;
            ArcMap.Document.ActiveView.Refresh();

            #endregion
        }
 protected override void Dispose(bool value)
 {
     m_Editor = null;
     base.Dispose(value);
 }
 public void SetUp()
 {
     _editor = new Editor();
 }
 public Task <IEnumerable <SymbolRenameInfo> > RenameSymbol(IEditor editor, string renameTo)
 {
     throw new NotImplementedException();
 }
        public bool SetupEditEnvironment(IWorkspace TheWorkspace, ICadastralFabric TheFabric, IEditor TheEditor,
                                         out bool IsFileBasedGDB, out bool IsUnVersioned, out bool UseNonVersionedEdit)
        {
            IsFileBasedGDB      = false;
            IsUnVersioned       = false;
            UseNonVersionedEdit = false;

            ITable pTable = TheFabric.get_CadastralTable(esriCadastralFabricTable.esriCFTParcels);

            IsFileBasedGDB = (!(TheWorkspace.WorkspaceFactory.WorkspaceType == esriWorkspaceType.esriRemoteDatabaseWorkspace));

            if (!(IsFileBasedGDB))
            {
                IVersionedObject pVersObj = (IVersionedObject)pTable;
                IsUnVersioned = (!(pVersObj.IsRegisteredAsVersioned));
                pTable        = null;
                pVersObj      = null;
            }
            if (IsUnVersioned && !IsFileBasedGDB)
            {//
                DialogResult dlgRes = MessageBox.Show("Fabric is not registered as versioned." +
                                                      "\r\n You will not be able to undo." +
                                                      "\r\n Click 'OK' to delete permanently.",
                                                      "Continue with delete?", MessageBoxButtons.OKCancel);
                if (dlgRes == DialogResult.OK)
                {
                    UseNonVersionedEdit = true;
                }
                else if (dlgRes == DialogResult.Cancel)
                {
                    return(false);
                }
                //MessageBox.Show("The fabric tables are non-versioned." +
                //   "\r\n Please register as versioned, and try again.");
                //return false;
            }
            else if ((TheEditor.EditState == esriEditState.esriStateNotEditing))
            {
                MessageBox.Show("Please start editing first and try again.", "Delete",
                                MessageBoxButtons.OK, MessageBoxIcon.Information);
                return(false);
            }
            return(true);
        }
        public RunCreateRulesCommand()
        {
            ConfigUtil.type = "aa";
            UID editorUID = new UIDClass();
            editorUID.Value = "esriEditor.editor";
            _editor = ArcMap.Application.FindExtensionByCLSID(editorUID) as IEditor;

            if (_editor != null)
            {

                return;
            }
        }
 public IEnumerable <IContextActionProvider> GetContextActionProviders(IEditor editor)
 {
     return(Enumerable.Empty <IContextActionProvider>());
 }
 public LevelGeometryEditMode( )
 {
     m_PolygonBrush	= new PolygonBrushEditor( );
     m_CircleBrush	= new CircleBrushEditor( 3 );
     m_CurrentBrush	= m_PolygonBrush;
 }
        public async Task <CodeCompletionResults> CodeCompleteAtAsync(IEditor editor, int index, int line, int column,
                                                                      List <UnsavedFile> unsavedFiles, char lastChar, string filter)
        {
            var clangUnsavedFiles = new List <ClangUnsavedFile>();

            foreach (var unsavedFile in unsavedFiles)
            {
                clangUnsavedFiles.Add(new ClangUnsavedFile(unsavedFile.FileName, unsavedFile.Contents));
            }

            var result = new CodeCompletionResults();

            await clangAccessJobRunner.InvokeAsync(() =>
            {
                var translationUnit = GetAndParseTranslationUnit(editor, clangUnsavedFiles);

                if (translationUnit != null)
                {
                    var completionResults = translationUnit.CodeCompleteAt(editor.SourceFile.Location, line, column, clangUnsavedFiles.ToArray(),
                                                                           CodeCompleteFlags.IncludeBriefComments | CodeCompleteFlags.IncludeMacros | CodeCompleteFlags.IncludeCodePatterns);
                    completionResults.Sort();

                    result.Contexts = (CompletionContext)completionResults.Contexts;

                    if (result.Contexts == CompletionContext.Unexposed && lastChar == ':')
                    {
                        result.Contexts = CompletionContext.AnyType; // special case Class::<- here static class member access.
                    }

                    foreach (var codeCompletion in completionResults.Results)
                    {
                        var typedText = string.Empty;

                        if (codeCompletion.CompletionString.Availability == AvailabilityKind.Available || codeCompletion.CompletionString.Availability == AvailabilityKind.Deprecated)
                        {
                            foreach (var chunk in codeCompletion.CompletionString.Chunks)
                            {
                                if (chunk.Kind == CompletionChunkKind.TypedText)
                                {
                                    typedText = chunk.Text;
                                }

                                switch (chunk.Kind)
                                {
                                case CompletionChunkKind.LeftParen:
                                case CompletionChunkKind.LeftAngle:
                                case CompletionChunkKind.LeftBrace:
                                case CompletionChunkKind.LeftBracket:
                                case CompletionChunkKind.RightAngle:
                                case CompletionChunkKind.RightBrace:
                                case CompletionChunkKind.RightBracket:
                                case CompletionChunkKind.RightParen:
                                case CompletionChunkKind.Placeholder:
                                case CompletionChunkKind.Comma:
                                    break;
                                }
                            }

                            if (filter == string.Empty || typedText.StartsWith(filter))
                            {
                                var completion = new CodeCompletionData(typedText, typedText)
                                {
                                    Priority     = (int)codeCompletion.CompletionString.Priority,
                                    Kind         = FromClangKind(codeCompletion.CursorKind),
                                    BriefComment = codeCompletion.CompletionString.BriefComment
                                };

                                result.Completions.Add(completion);

                                if (completion.Kind == CodeCompletionKind.OverloadCandidate)
                                {
                                    Console.WriteLine("TODO Implement overload candidate.");
                                }
                            }
                        }
                    }

                    completionResults.Dispose();
                }
            });

            return(result);
        }
        public void SetView(MarkingSelector view, IEditor iEditor)
        {
            _selectTab = 0;
            _iEditor = iEditor;

            _view = view;
            _view.DataContext = this;

            _view.BindData(this);

            EventAggregator.AddIMarkableHandler += EventAggregator_AddIMarkableHandler;
            EventAggregator.DeleteIMarkableHandler += EventAggregator_DeleteIMarkableHandler;
        }
        public void RegisterSourceFile(IEditor editor)
        {
            if (clangAccessJobRunner == null)
            {
                clangAccessJobRunner = new JobRunner();

                Task.Factory.StartNew(() => { clangAccessJobRunner.RunLoop(new CancellationToken()); });
            }

            if (dataAssociations.TryGetValue(editor.SourceFile, out CPlusPlusDataAssociation association))
            {
                throw new Exception("Source file already registered with language service.");
            }

            IndentationStrategy = new CSharpIndentationStrategy(new AvaloniaEdit.TextEditorOptions {
                ConvertTabsToSpaces = true
            });

            association = new CPlusPlusDataAssociation();
            dataAssociations.Add(editor.SourceFile, association);

            association.TextInputHandler = (sender, e) =>
            {
                switch (e.Text)
                {
                case "}":
                case ";":
                    editor.IndentLine(editor.Line);
                    break;

                case "{":
                    if (IndentationStrategy != null)
                    {
                        editor.IndentLine(editor.Line);
                    }
                    break;
                }

                OpenBracket(editor, editor.Document, e.Text);
                CloseBracket(editor, editor.Document, e.Text);
            };

            association.BeforeTextInputHandler = (sender, e) =>
            {
                switch (e.Text)
                {
                case "\n":
                case "\r\n":
                    var nextChar = ' ';

                    if (editor.CaretOffset != editor.Document.TextLength)
                    {
                        nextChar = editor.Document.GetCharAt(editor.CaretOffset);
                    }

                    if (nextChar == '}')
                    {
                        var newline = "\r\n";     // TextUtilities.GetNewLineFromDocument(editor.Document, editor.TextArea.Caret.Line);
                        editor.Document.Insert(editor.CaretOffset, newline);

                        editor.Document.TrimTrailingWhiteSpace(editor.Line - 1);

                        editor.IndentLine(editor.Line);

                        editor.CaretOffset -= newline.Length;
                    }
                    break;
                }
            };

            editor.TextEntered  += association.TextInputHandler;
            editor.TextEntering += association.BeforeTextInputHandler;
        }