/// 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); }
// 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); }