예제 #1
0
        public ProjectsManager()
        {
            _pcRegistry = new Dom.ProjectContentRegistry();
            _pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(), "FOCodeCompletion"));

            _csProjectContent = new Dom.DefaultProjectContent();
        }
예제 #2
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            if (IsVisualBasic)
            {
                textEditorControl1.Text = @"
Class A
 Sub B
  Dim xx As String
  
 End Sub
End Class
";
                textEditorControl1.SetHighlighting("VBNET");
            }
            else
            {
                textEditorControl1.Text = @"using System;
class A
{
 void B()
 {
  string x;
  
 }
}
";
                textEditorControl1.SetHighlighting("C#");
            }
            textEditorControl1.ShowEOLMarkers   = false;
            textEditorControl1.ShowInvalidLines = false;
            HostCallbackImplementation.Register(this);
            CodeCompletionKeyHandler.Attach(this, textEditorControl1);
            ToolTipProvider.Attach(this, textEditorControl1);

            pcRegistry = new Dom.ProjectContentRegistry();             // Default .NET 2.0 registry

            // Persistence lets SharpDevelop.Dom create a cache file on disk so that
            // future starts are faster.
            // It also caches XML documentation files in an on-disk hash table, thus
            // reducing memory usage.
            pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(),
                                                        "CSharpCodeCompletion"));

            myProjectContent          = new Dom.DefaultProjectContent();
            myProjectContent.Language = CurrentLanguageProperties;
            // create dummy parseInformation to prevent NullReferenceException when using CC before parsing
            // for the first time
            parseInformation = new Dom.ParseInformation(new Dom.DefaultCompilationUnit(myProjectContent));
        }
예제 #3
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            string appPath = Path.GetDirectoryName(Application.ExecutablePath);

            this.sqlConnection1.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + quot + Data_Path + quot + ";Integrated Security=True;User Instance=False;Timeout=60";

            ICSharpCode.TextEditor.Document.FileSyntaxModeProvider provider = new ICSharpCode.TextEditor.Document.FileSyntaxModeProvider(appPath);
            ICSharpCode.TextEditor.Document.HighlightingManager.Manager.AddSyntaxModeFileProvider(provider);
            sqlEditor.Document.HighlightingStrategy = ICSharpCode.TextEditor.Document.HighlightingManager.Manager.FindHighlighter("SQL");


            sqlEditor.Text = @"SELECT word.lemma, synset.pos, synset.definition 
FROM word
LEFT JOIN sense ON word.wordid=sense.wordid
LEFT JOIN synset ON sense.synsetid=synset.synsetid
WHERE word.lemma='light'
ORDER BY synset.pos

";
//			sqlEditor.SetHighlighting("C#");
//			sqlEditor.SetHighlighting("SQL");
            sqlEditor.ShowEOLMarkers = false;
            CodeCompletionKeyHandler.Attach(this, sqlEditor);
            HostCallbackImplementation.Register(this);

            pcRegistry = new Dom.ProjectContentRegistry();             // Default .NET 2.0 registry

            // Persistence caches referenced project contents for faster loading.
            // It also activates loading XML documentation files and caching them
            // for faster loading and lower memory usage.
            pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(),
                                                        "CSharpCodeCompletion"));

            myProjectContent = new Dom.DefaultProjectContent();
            //myProjectContent.Language = Dom.LanguageProperties.CSharp;

            myProjectContent.Language = Dom.LanguageProperties.VBNet;
        }
예제 #4
0
        public IntellisenseEditor()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            textEditorControl1.SetHighlighting(Language);
            textEditorControl1.ShowEOLMarkers = false;
            CodeCompletionKeyHandler.Attach(this, textEditorControl1);
            HostCallbackImplementation.Register(this);

            pcRegistry = new Dom.ProjectContentRegistry();             // Default .NET 2.0 registry

            // Persistence caches referenced project contents for faster loading.
            // It also activates loading XML documentation files and caching them
            // for faster loading and lower memory usage.
            pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(),
                                                        "CSharpCodeCompletion"));

            myProjectContent          = new Dom.DefaultProjectContent();
            myProjectContent.Language = Dom.LanguageProperties.CSharp;
        }
예제 #5
0
        public ScriptForm(PBObjLib.Application app)
        {
            m_App = app;
            InitializeComponent();
            editor.ShowEOLMarkers   = false;
            editor.ShowSpaces       = false;
            editor.ShowTabs         = false;
            editor.ShowInvalidLines = false;
            editor.SetHighlighting("C#");
            workDir           = Path.GetTempPath() + "gPBToolKit\\";
            fullPathDummyFile = workDir + DummyFileName;

            if (!Directory.Exists(workDir))
            {
                Directory.CreateDirectory(workDir);
            }
            if (!Directory.Exists(workDir + "\\CSharpCodeCompletion\\"))
            {
                Directory.CreateDirectory(workDir + "\\CSharpCodeCompletion");
            }



            string indexFile = workDir + "CSharpCodeCompletion\\index.dat";

            if (!File.Exists(fullPathDummyFile))
            {
                string       sh           = @"using System;
using System.Collections.Generic;
using System.Text;
using PBObjLib;
using PBSymLib;
using VBIDE;
using System.Windows.Forms;

namespace gPBToolKit
{
    public class gkScript
    {   
        // ���������� �������� �������
        public static void StartScript(Display d)
        {
            foreach (Symbol s in d.Symbols)
            {
                if (s.Type == 7)
                {
                    Value v = (Value)s;
                    v.BackgroundColor = 32768;  
                    v.ShowUOM = true;
                }           
            }
            Action(d.Application);
        }
        
        public static void Action(PBObjLib.Application m_App)
        {
            try
            {
                VBProject project = null;
                CodeModule codeModule = null;
                for (int i = 1; i <= ((VBE)m_App.VBE).VBProjects.Count; i++)
                {
                    VBProject bufProject = ((VBE)m_App.VBE).VBProjects.Item(i);
                    if (bufProject.FileName.ToLower() == m_App.ActiveDisplay.Path.ToLower()) // ���� �� ��������� ����� ������
                    {
                        project = bufProject;
                        break;
                    }
                }

                if (project == null)
                {
                    MessageBox.Show(""VBProject not found"");
                    return;
                }

                codeModule = project.VBComponents.Item(""ThisDisplay"").CodeModule;
                try
                {
                    string procName = ""Display_Open"";
                    int procCountLine = -1, procStart = -1;
                    try{
						procStart = codeModule.get_ProcBodyLine(procName, vbext_ProcKind.vbext_pk_Proc);
                        procCountLine = codeModule.get_ProcCountLines(procName, vbext_ProcKind.vbext_pk_Proc);	
                    }
                    catch{}
                    
                    if (procStart > 0) 
                        codeModule.DeleteLines(procStart, procCountLine);
                    
                    string srvName = ""do51-dc1-du-pis.sgpz.gpp.gazprom.ru"";
                    string rootModule = ""����"";                   
                    string dispOpenText = string.Format(@""
Private Sub Display_Open()
    AVExtension1.Initialize """"{0}"""", """"{1}"""", ThisDisplay, Trend1
End Sub"", srvName, rootModule);
                    codeModule.AddFromString(dispOpenText);			
                }
                catch (Exception ex) {
                    MessageBox.Show(ex.Message + "" ""+ ex.StackTrace);
                }
            }
            catch { }
        }
    }
}
";
                UTF8Encoding asciEncoding = new UTF8Encoding();
                FileStream   fs           = File.Create(fullPathDummyFile);
                fs.Write(asciEncoding.GetBytes(sh), 0, asciEncoding.GetByteCount(sh));
                fs.Close();
            }
            if (!File.Exists(indexFile))
            {
                File.Create(indexFile).Close();
            }


            editor.LoadFile(fullPathDummyFile);

            refList.Items.Add("System.dll");
            refList.Items.Add("System.Drawing.dll");
            refList.Items.Add("System.Windows.Forms.dll");
            refList.Items.Add(@"C:\Program Files (x86)\PIPC\Procbook\OSIsoft.PBObjLib.dll");
            refList.Items.Add(@"C:\Program Files (x86)\PIPC\Procbook\OSIsoft.PBSymLib.dll");
            refList.Items.Add(@"C:\Program Files (x86)\PIPC\Procbook\Interop.VBIDE.dll");

            CodeCompletionKeyHandler.Attach(this, editor);
            HostCallbackImplementation.Register(this);

            pcRegistry = new Dom.ProjectContentRegistry(); // Default .NET 2.0 registry

            // Persistence caches referenced project contents for faster loading.
            // It also activates loading XML documentation files and caching them
            // for faster loading and lower memory usage.
            pcRegistry.ActivatePersistence(Path.Combine(workDir, "CSharpCodeCompletion"));

            myProjectContent          = new Dom.DefaultProjectContent();
            myProjectContent.Language = Dom.LanguageProperties.CSharp;
        }
예제 #6
0
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //
            // TODO: Add constructor code after the InitializeComponent() call.
            //
            string appPath = Path.GetDirectoryName(Application.ExecutablePath);
            this.sqlConnection1.ConnectionString = "Data Source=.\\SQLEXPRESS;AttachDbFilename=" + quot + Data_Path + quot + ";Integrated Security=True;User Instance=False;Timeout=60";

            ICSharpCode.TextEditor.Document.FileSyntaxModeProvider provider = new ICSharpCode.TextEditor.Document.FileSyntaxModeProvider(appPath);
            ICSharpCode.TextEditor.Document.HighlightingManager.Manager.AddSyntaxModeFileProvider(provider);
            sqlEditor.Document.HighlightingStrategy = ICSharpCode.TextEditor.Document.HighlightingManager.Manager.FindHighlighter("SQL");

            sqlEditor.Text = @"SELECT word.lemma, synset.pos, synset.definition
            FROM word
            LEFT JOIN sense ON word.wordid=sense.wordid
            LEFT JOIN synset ON sense.synsetid=synset.synsetid
            WHERE word.lemma='light'
            ORDER BY synset.pos

            ";
            //			sqlEditor.SetHighlighting("C#");
            //			sqlEditor.SetHighlighting("SQL");
            sqlEditor.ShowEOLMarkers = false;
            CodeCompletionKeyHandler.Attach(this, sqlEditor);
            HostCallbackImplementation.Register(this);

            pcRegistry = new Dom.ProjectContentRegistry(); // Default .NET 2.0 registry

            // Persistence caches referenced project contents for faster loading.
            // It also activates loading XML documentation files and caching them
            // for faster loading and lower memory usage.
            pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(),
                                                        "CSharpCodeCompletion"));

            myProjectContent = new Dom.DefaultProjectContent();
            //myProjectContent.Language = Dom.LanguageProperties.CSharp;

            myProjectContent.Language = Dom.LanguageProperties.VBNet;
        }
        public void setupEnvironment()
        {
            try
            {
                TextEditor.ActiveTextAreaControl.TextArea.KeyEventHandler += TextAreaKeyEventHandler;
                TextEditor.ActiveTextAreaControl.TextArea.Caret.PositionChanged += Caret_PositionChanged;
                TextEditor.Disposed += CloseCodeCompletionWindow;  // When the editor is disposed, close the code completion window

                //set up the ToolTipRequest event
                TextEditor.ActiveTextAreaControl.TextArea.ToolTipRequest += OnToolTipRequest;

                pcRegistry = new ProjectContentRegistry();
                myProjectContent = new DefaultProjectContent {Language = currentLanguageProperties};
                var persistanceFolder = PublicDI.config.O2TempDir.pathCombine("..//_CSharpCodeCompletion").fullPath();  // Path.Combine(Path.GetTempPath(), "CSharpCodeCompletion");
                persistanceFolder.createFolder();
                pcRegistry.ActivatePersistence(persistanceFolder);
                // static parse current code thread
                //startParseCodeThread();
                // add references

                startAddReferencesThread();
                startParseCodeThread();
            }
            catch (Exception ex)
            {
                ex.log("in setupEnvironment");
            }

        }
예제 #8
0
        public PNTabItem(string moduleName)
        {
            InitializeComponent();

            DeclarationNode = new TreeNode("Declaration");
            ModelNode = new TreeNode("Models");
            TreeNode treeNode8 = new TreeNode("Petri Nets Model",
                new TreeNode[] {
                    DeclarationNode,
                    ModelNode
                });

            MenuButton_SetError.Visible = false;

            //treeNode8.Name = "Root";
            treeNode8.Text = "Petri Nets";
            this.TreeView_Structure.Nodes.AddRange(new TreeNode[] { treeNode8 });

            //AssertionNode.Name = "Declaration";
            DeclarationNode.StateImageIndex = 0;
            //AssertionNode.Text = "Declaration";
            ModelNode.Name = "Models";
            ModelNode.StateImageIndex = 1;
            //ModelNode.Text = "Processes";

            AddEventHandlerForButtons();

            textEditorControl = new SharpDevelopTextAreaControl();
            textEditorControl.Dock = DockStyle.Fill;
            textEditorControl.ContextMenuStrip = EditorContextMenuStrip;
            textEditorControl.BorderStyle = BorderStyle.Fixed3D;
            textEditorControl.Visible = true;

            this.splitContainer1.Panel2.Controls.Add(textEditorControl);

            this.TabText = Resources.Document_ + counter;
            counter++;

            textEditorControl.FileNameChanged += new EventHandler(_EditorControl_FileNameChanged);
            textEditorControl.TextChanged += new EventHandler(textEditorControl_TextChanged);
            textEditorControl.Tag = this;

            this.Padding = new Padding(2, 2, 2, 2);
            this.DockableAreas = DockAreas.Document;

            secondaryViewContentCollection = new SecondaryViewContentCollection(this);
            InitFiles();

            file = FileService.CreateUntitledOpenedFile(TabText, new byte[] { });
            file.CurrentView = this;
            textEditorControl.FileName = file.FileName;
            files.Clear();
            files.Add(file);

            this.SetSyntaxLanguage(moduleName);

            textEditorControl.Document.FoldingManager.FoldingStrategy = new FoldingStrategy();

            // Highlight the matching bracket or not...
            this.textEditorControl.ShowMatchingBracket = true;

            this.textEditorControl.BracketMatchingStyle = BracketMatchingStyle.Before;

            HostCallbackImplementation.Register(this);
            CodeCompletionKeyHandler.Attach(this, textEditorControl);
            ToolTipProvider.Attach(this, textEditorControl);

            pcRegistry = new ProjectContentRegistry(); // Default .NET 2.0 registry

            // Persistence lets SharpDevelop.Dom create a cache file on disk so that
            // future starts are faster.
            // It also caches XML documentation files in an on-disk hash table, thus
            // reducing memory usage.
            pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(), "CSharpCodeCompletion"));

            myProjectContent = new DefaultProjectContent();
            myProjectContent.Language = LanguageProperties.CSharp;

            this.TreeView_Structure.HideSelection = false;
            splitContainer1.SplitterDistance = 100;

            addProcessToolStripMenuItem.PerformClick();

            this.TreeView_Structure.ExpandAll();

            Button_AddNewNail.Visible = false;

            //show the declaration
            TreeView_Structure.SelectedNode = DeclarationNode;
            TreeView_Structure_NodeMouseDoubleClick(null, new TreeNodeMouseClickEventArgs(DeclarationNode, MouseButtons.Left, 2, 0, 0));
        }
예제 #9
0
파일: MainForm.cs 프로젝트: pusp/o2platform
		public MainForm()
		{
			//
			// The InitializeComponent() call is required for Windows Forms designer support.
			//
			InitializeComponent();
			
			if (IsVisualBasic) {
				textEditorControl1.Text = @"
Class A
 Sub B
  Dim xx As String
  
 End Sub
End Class
";
				textEditorControl1.SetHighlighting("VBNET");
			} else {
				textEditorControl1.Text = @"using System;
class A
{
 void B()
 {
  string x;
  
 }
}
";
				textEditorControl1.SetHighlighting("C#");
			}
			textEditorControl1.ShowEOLMarkers = false;
			textEditorControl1.ShowInvalidLines = false;
			HostCallbackImplementation.Register(this);
			CodeCompletionKeyHandler.Attach(this, textEditorControl1);
			ToolTipProvider.Attach(this, textEditorControl1);
			
			pcRegistry = new Dom.ProjectContentRegistry(); // Default .NET 2.0 registry
			
			// Persistence lets SharpDevelop.Dom create a cache file on disk so that
			// future starts are faster.
			// It also caches XML documentation files in an on-disk hash table, thus
			// reducing memory usage.
			pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(),
			                                            "CSharpCodeCompletion"));
			
			myProjectContent = new Dom.DefaultProjectContent();
			myProjectContent.Language = CurrentLanguageProperties;
		}
예제 #10
0
        private void ConfigureEditorTextControl()
        {
            txtCode.SetHighlighting("C#");
            txtCode.ShowEOLMarkers = false;
            CodeCompletionKeyHandler.Attach(this, txtCode);
            HostCallbackImplementation.Register(this);

            pcRegistry = new Dom.ProjectContentRegistry(); // Default .NET 2.0 registry

            // Persistence caches referenced project contents for faster loading.
            // It also activates loading XML documentation files and caching them
            // for faster loading and lower memory usage.
            pcRegistry.ActivatePersistence(Path.Combine(Path.GetTempPath(), "CSharpCodeCompletion"));

            myProjectContent = new Dom.DefaultProjectContent();
            myProjectContent.Language = Dom.LanguageProperties.CSharp;
        }
예제 #11
0
		public void SetupIntellisense(TextEditorControl control)
		{
			_control = control;

			control.SetHighlighting((SupportedLanguage == SupportedLanguage.CSharp) ? "C#" : "VBNET");
			control.ShowEOLMarkers = false;
			control.ShowInvalidLines = false;

			HostCallbackImplementation.Register(this);
			CodeCompletionKeyHandler.Attach(this, control);
			ToolTipProvider.Attach(this, control);

			ProjectContentRegistry = new ProjectContentRegistry(); // Default .NET 2.0 registry

			// Persistence lets SharpDevelop.Dom create a cache file on disk so that
			// future starts are faster.
			// It also caches XML documentation files in an on-disk hash table, thus
			// reducing memory usage.
			try
			{
				if (Settings.Default.CacheFiles)
				{
					var persistencePath = Path.Combine(Path.GetTempPath(), ReflexilPersistence);
					var persistenceCheck = Path.Combine(persistencePath, ReflexilPersistenceCheck);

					Directory.CreateDirectory(persistencePath); // Check write/access to directory
					File.WriteAllText(persistenceCheck, @"Using cache!"); // Check write file rights
					File.ReadAllText(persistenceCheck); // Check read file rights

					ProjectContentRegistry.ActivatePersistence(persistencePath);
				}
			}
				// ReSharper disable once EmptyGeneralCatchClause
			catch (Exception)
			{
				// don't use cache file
			}

			ProjectContent = new DefaultProjectContent {Language = LanguageProperties};
			ParseInformation = new ParseInformation(new DefaultCompilationUnit(ProjectContent));
		}
예제 #12
0
        /// <summary>
        /// Initializes a new instance of the <see cref="MainForm"/> class.
        /// </summary>
        public MainForm()
        {
            //
            // The InitializeComponent() call is required for Windows Forms designer support.
            //
            InitializeComponent();

            //            if (IsVisualBasic) {
            //                textEditorControl1.Text = @"
            //Class A
            // Sub B
            //  Dim xx As String
            //
            // End Sub
            //End Class
            //";
            //                textEditorControl1.SetHighlighting("VBNET");
            //            } else {
            //                textEditorControl1.Text = @"using System;
            //class A
            //{
            // void B()
            // {
            //  string x;
            //
            // }
            //}
            //";
            //                textEditorControl1.SetHighlighting("C#");
            //            }
            textEditorControl1.ShowEOLMarkers = false;
            textEditorControl1.ShowInvalidLines = false;

            HostCallbackImplementation.Register(this);
            CodeCompletionKeyHandler.Attach(this, textEditorControl1);
            ToolTipProvider.Attach(this, textEditorControl1);

            pcRegistry = new ProjectContentRegistry(); // Default .NET 2.0 registry

            // Persistence lets SharpDevelop.Dom create a cache file on disk so that
            // future starts are faster.
            // It also caches XML documentation files in an on-disk hash table, thus
            // reducing memory usage.
            // Paul Meems, 1 Sept. 2010: Create the file if it doesn't exist (Bug #1763):
            string cacheFolder = Path.Combine(Path.GetTempPath(), "CSharpCodeCompletion");
            if (!Directory.Exists(cacheFolder))
            {
                Directory.CreateDirectory(cacheFolder);
            }
            pcRegistry.ActivatePersistence(cacheFolder);

            myProjectContent = new DefaultProjectContent();
            myProjectContent.Language = CurrentLanguageProperties;
        }