示例#1
0
        protected override void Initialize()
        {
            try
            {
                Commands.Initialize(this);
                base.Initialize();

                RegisterEditorFactory(new tsEditorFactory(this));
                RegisterEditorFactory(new qrcEditorFactory(this));
                RegisterEditorFactory(new uiEditorFactory(this));

                dte   = ( DTE )GetService(typeof(DTE));
                help2 = ( Help2 )GetService(typeof(SVsHelp));

                var    manager = QtVersionManager.The();
                string error   = null;
                if (manager.HasInvalidVersions(out error))
                {
                    Messages.DisplayErrorMessage(error);
                }
                eventHandler = new AddInEventHandler(dte);
                extLoader    = new ExtLoader();
                if (!isTemplatesInstalled())
                {
                    InstallTemplates();
                }

                //var info = new VersionInformation( @"D:\Qt\5.6.0_beta_x64\5.6\msvc2015_64" ).GetInformationString();
                //MessageBox.Show( info );
            }
            catch (Exception e) {
                MessageBox.Show("VSPackage.Initialize: " + e.Message + "\r\n\r\nStacktrace:\r\n" + e.StackTrace);
            }
        }
示例#2
0
        public override int CreateEditorInstance(
            uint createEditorFlags,
            string documentMoniker,
            string physicalView,
            IVsHierarchy hierarchy,
            uint itemid,
            System.IntPtr docDataExisting,
            out System.IntPtr docView,
            out System.IntPtr docData,
            out string editorCaption,
            out Guid commandUIGuid,
            out int createDocumentWindowFlags)
        {
            int baseReturn = base.CreateEditorInstance(createEditorFlags, documentMoniker, physicalView, hierarchy, itemid, docDataExisting, out docView, out docData, out editorCaption, out commandUIGuid, out createDocumentWindowFlags);

            if (baseReturn != VSConstants.S_OK)
            {
                return(baseReturn);
            }

            byte[] bytes = Encoding.UTF8.GetBytes(documentMoniker);
            documentMoniker = Encoding.Default.GetString(bytes);
            ExtLoader.loadQrcEditor(documentMoniker);
            return(VSConstants.S_OK);
        }
示例#3
0
        private void OpenFileExternally(string fileName)
        {
            bool abortOperation;

            CheckoutFileIfNeeded(fileName, out abortOperation);
            if (abortOperation)
            {
                return;
            }

            string lowerCaseFileName = fileName.ToLower();

            if (lowerCaseFileName.EndsWith(".ui"))
            {
                VSPackage.extLoader.loadDesigner(fileName);

                // Designer can't cope with many files in a short time.
                System.Threading.Thread.Sleep(1000);
            }
            else if (lowerCaseFileName.EndsWith(".ts"))
            {
                ExtLoader.loadLinguist(fileName);
            }
#if false
            // QRC files are directly opened, using the QRC editor.
            else if (lowerCaseFileName.EndsWith(".qrc"))
            {
                Connect.extLoader.loadQrcEditor(fileName);
            }
#endif
        }
示例#4
0
        public override int CreateEditorInstance(
            uint createEditorFlags,
            string documentMoniker,
            string physicalView,
            IVsHierarchy hierarchy,
            uint itemid,
            System.IntPtr docDataExisting,
            out System.IntPtr docView,
            out System.IntPtr docData,
            out string editorCaption,
            out Guid commandUIGuid,
            out int createDocumentWindowFlags)
        {
            int baseReturn = base.CreateEditorInstance(createEditorFlags, documentMoniker, physicalView, hierarchy, itemid, docDataExisting, out docView, out docData, out editorCaption, out commandUIGuid, out createDocumentWindowFlags);

            if (baseReturn != VSConstants.S_OK)
            {
                return(baseReturn);
            }

            ExtLoader.loadLinguist(documentMoniker);
            return(VSConstants.S_OK);
        }
示例#5
0
 private void exportProFile(object sender, EventArgs e)
 {
     ExtLoader.ExportProFile();
 }
示例#6
0
        private void importPriFile(object sender, EventArgs e)
        {
            Project pro = HelperFunctions.GetSelectedQtProject(VSPackage.dte);

            ExtLoader.ImportPriFile(pro);
        }
示例#7
0
 private void importProFile(object sender, EventArgs e)
 {
     ExtLoader.ImportProFile();
     menuCommands["importProFile"].Enabled = false;
 }
示例#8
0
 private void loadLinguist(object sender, EventArgs e)
 {
     ExtLoader.loadLinguist(null);
 }