Ejemplo n.º 1
0
        public CodeViewCompletion(CodeView codeView, ITextView textView)
        {
            _codeView = codeView;
            _textView = textView;
            _document = textView.Document;
            _enabled = new BoolSetting("CompletionEnabled", false, textView.Settings);

            _document.Buffer.Changed += OnBufferChanged;
            _textView.TextViewEvent += OnTextViewEvent;
        }
Ejemplo n.º 2
0
        public CodeViewCompletion(CodeView codeView, ITextView textView)
        {
            _codeView = codeView;
            _textView = textView;
            _document = textView.Document;
            _enabled  = new BoolSetting("CompletionEnabled", false, textView.Settings);

            _document.Buffer.Changed += OnBufferChanged;
            _textView.TextViewEvent  += OnTextViewEvent;
        }
	/// returns true if the file was opened, false otherwise
	bool OpenFile (string file)
	{
		_textView = null;
		_codeView = null;
		_filePath = file;

		if (string.IsNullOrEmpty(_filePath))
			return false;

		_textView = TextViewFactory.ViewForFile(_filePath);
		_codeView = new CodeView(MissingEditorAPI.currentInspectorWindow, _textView);

		if (_textView != null)
			_settingsDialog = new SettingsDialog(_textView);
		return true;
	}
Ejemplo n.º 4
0
        // Use of this section requires 4.2 UnityEditor.dll

        /*
         * [UnityEditor.Callbacks.OnOpenAsset]
         * public static bool OnOpenAsset(int instanceID, int line)
         * {
         *      string assetpath = AssetDatabase.GetAssetPath(instanceID);
         *      UnityEngine.Object asset = AssetDatabase.LoadAssetAtPath(assetpath, typeof(UnityEngine.Object));
         *      if(asset is TextAsset || asset is ComputeShader)
         *      {
         *              OpenWindowFor(assetpath);
         *              return true;
         *      }
         *      return false;
         * }
         */

        /// <returns>true if the file was open, false otherwise</returns>
        bool OpenFile(string file)
        {
            _textView = null;
            _codeView = null;
            _filePath = file;
            _fileNameWithExtension = "";

            if (string.IsNullOrEmpty(_filePath))
            {
                return(false);
            }

            _textView = TextViewFactory.ViewForFile(_filePath);
            _codeView = new CodeView(this, _textView);
            _fileNameWithExtension = Path.GetFileName(_filePath);

            if (_textView != null)
            {
                _settingsDialog = new SettingsDialog(_textView);
            }
            return(true);
        }
Ejemplo n.º 5
0
        void OpenFile(string file)
        {
            _textView = null;
            _codeView = null;
            _filePath = file;
            _fileNameWithExtension = "";

            if (string.IsNullOrEmpty(_filePath))
                return;

            _textView = TextViewFactory.ViewForFile(_filePath);
            _codeView = new CodeView(this, _textView);
            _fileNameWithExtension = System.IO.Path.GetFileName(_filePath);
        }
		// Use of this section requires 4.2 UnityEditor.dll
		/*
		[UnityEditor.Callbacks.OnOpenAsset]
		public static bool OnOpenAsset(int instanceID, int line)
		{
			string assetpath = AssetDatabase.GetAssetPath(instanceID);
			UnityEngine.Object asset = AssetDatabase.LoadAssetAtPath(assetpath, typeof(UnityEngine.Object));
			if(asset is TextAsset || asset is ComputeShader)
			{
				OpenWindowFor(assetpath);
				return true;
			}
			return false;
		}
		*/

		/// <returns>true if the file was open, false otherwise</returns>
		bool OpenFile (string file)
		{
			_textView = null;
			_codeView = null;
			_filePath = file;
			_fileNameWithExtension = "";

			if (string.IsNullOrEmpty(_filePath))
				return false;

			_textView = TextViewFactory.ViewForFile(_filePath);
			_codeView = new CodeView(this, _textView);
			_fileNameWithExtension = Path.GetFileName(_filePath);

			if (_textView != null)
				_settingsDialog = new SettingsDialog(_textView);
			return true;
		}