How to detect if file in IDE is being edited using Open Tools API - delphi

I made a small IDE plug-in using Open Tools API that accesses ClearCase. It has menu items "Check In", "Check Out", etc. It works OK but I want it to check out a read-only file automatically if I start typing in IDE editor or if I attempt to save the file. Do you think this is possible?
I tried a few things but gave up eventually. IOTAEditorServices.KeyboardServices has AddKeyboardBinding method which looked promising. Using it I added a notifier with binding type btPartial (and later tried btComplete) and the plug-in started detecting some shortcut key presses but not all keyboard events, far from it... Any ideas would be much appreciated!

I think a "cleaner" way is to hook up a IOTAEditorNotifier to each editor and have your IOTAEditor.Modified method called by the IDE whenever the contents of the editor is modified, whether by keyboard, mouse or programmatically from another plugin.
Here's an example which registers an IOTAIDENotifier to be notified of files being opened in the IDE so it can register its IOTAEditorNotifier instances.

I must be possible somehow: we use SourceConexion (http://www.epocalipse.com/scx.htm) here, which auto checks-out the file before you edit the source or change the form.
JVCS has IDE integration support, it is open source, maybe they have implemented this too:
http://jedivcs.sourceforge.net/

Related

Which tool can I use for viewing WRX files?

I'm working with Progress-4GL, release 11.6, appBuilder and procedure editor.
While working with OCX components, a WRX-file gets automatically created by the appBuilder. I would like to see the content of that WRX-file.
Currently, I've found this website, which also mentions that Progress IDE should contain such a viewer, but even after checking all Pro*tools, I didn't find any tool.
Does anybody know which tool of the Progress-4GL appBuilder/procedure editor toolchain allows viewing WRX-files?
Thanks in advance
According to Progress Knowledgebase, WRX files contain only design and runtime license keys (if required by the ActiveX Controls) along with any custom property settings that were made to any ActiveX Control in the windows. WRX files do not contain any ABL source or .r code.
If it indeed is an OCX you want to look into you can use the Com Object Viewer.
It can be found a couple of different ways.
Quick Access Search in Developer Studio:
Via Pro*Tools under the Tools menu in the AppBuilder
Once started you can use it to open OCXes and Automation Objects to look at the internal API's of those.
You need to locate the file it's stored in. This could be either by knowledge of it's location or other way. If you add an OCX to a ABL Windows/Dialog program you will see the location of the control there:
Then you can open it in the Com Object Viewer to see methods, events and such and also get some short coding help.

delphi integrate custom file editor into IDE

I have deveoped a custom file type, together with a custom editor (basically a tree with several data pages attached and a few extra buttons). OK, I can run it stand alone and that is fine, and even add it to the tools menu, but I would like to integrate it into the Delphi IDE so that my custom editor (or a similar new version) appears in the IDE, rather like a DFM file has a custom editor. I can find references to most extensions in the Delphi IDE, but not this one. Any guiding hands? Note that this is not a property or component editor (the file type has nothing to do with either of these) nor is it simply syntax highlighting of a text file.
AFAIK it currently isn't possible to reliably integrate a custom editor into the Delphi IDE. The required API simply isn't there. See QC89028 Custom Module support.
During the Delphi 2010 and XE betas I spent most my spare time trying to get a resource editor integrated. Although the effort had the official blessing of Embarcadero and got some, half hearted, support from the IDE engineer, I was never able to get them to deliver on their promises and surface the module API. I eventually abandoned the project.
Update: I've now checked my old correspondence regarding this and it turns out part of the problem was that IOTAModuleCreator (used to implement File|New for custom file types) and IOTAEditorContent (used to transfer data to/from the custom module) only supports text data. Binary data gets mangled.
You can probably do this via an IDE plugin that uses the ToolsAPI (see ToolsAPI.pas in the IDE's source folder (e.g. Program Files (x86)\Embarcadero\Studio\source\ToolsAPI\ToolsAPI.pas.)
For information on writing a plugin in general, see David G Hoyle's excellent blog. Once you know the basics - i.e., write a 'wizard' and get it to do something - you will need to work on integrating your editor.
I have never done this, and so I can't guarantee it is possible. However, some interfaces that look worth investigating and implementing are INTACustomEditorView, which represents a 'view' (file tab when that file is open - think the code editor, Welcome view, type library editor, etc) and IOTAEditorViewServices, to register your custom view. I do not know how you associate a view type with a file type, sorry - possibly something to do with the personality interfaces. You might also be interested in INTACustomEditorSubView which is what creates a tab on the bottom of a file.
Good luck, and if you find a solution please write here so that other people can learn too!

Is it possible to invoke refactoring from the Open Tools API?

The Delphi IDE has a plugin system, the Open Tools API. The IDE also has a number of refactorings available, such as a rename refactoring to rename a field, method, etc - an identifier.
Is it possible to invoke this, or any, refactorings from the OTAPI? If not, is there a hacky way to do it?
My research shows no mentions of refactorings in ToolsAPI.pas, but I don't want to give up with "No." It doesn't mean there isn't a way to do it - it just means I don't know what it is :)
There is no support at all from OTA. Therefore your only hope is to hunt down the menu items or actions, invoke their OnClick or OnExecute handlers, poke values into the dialogs that are shown, and then programmatically press the dialog OK buttons.

Delphi .exe after build error

good day! i have a project and it runs perfectly, i did that project 3 months ago. Then, i tried to put some changes and even BUILD ONLY the project (no additional codes). When i open the .EXE it appears errors like this.
when i clicked DON'T SEND
and when i clicked OK
When i opened the form this message appers:
How to fixed it? I really need to add some functions to that project.
Thanks in advance!
Your .dfm file refers to a property that is not published by the component which is being streamed. The streaming framework is attempting to read into a property named Quality of an object named frxPDFExport1. And that object does not publish a property of that name.
Most likely there's a mismatch between the design time package that you used to generate the .dfm file, and the run time component that is reading that .dfm file. Have you upgraded one and not the other recently?
I'm afraid I cannot give you precise steps to fix the problem, but what I describe above is what is happening. Hopefully that will be enough to lead you to the solution.
You must have updated the component used, which looks like Fast Reports. You need to open up the form in Delphi and the new property will be added by Delphi. Any other forms that use the same component will also need to be opened up to update the properties.
When the error reading form message comes up, click ignore. This should add the missing property. You will want to view the DFM as text to make sure the property has been added.

How do I add recent items to my program's jump list on the Windows 7 taskbar?

I'm using Delphi XE and would like to add "recent items" in the Windows 7 taskbar jump list for my application, like when right-clicking on Microsoft Word brings up recently opened documents.
I've found information on how to set the progress but nothing on jump-list items. Any help would be greatly appreciated.
This will happen automatically if, for instance, you only use the standard Windows file dialogs. At least my text editor, Rejbrand Text Editor, has got such a MRU list by Windows. It lists all files I have recently edited using Rejbrand Text Editor, even though I have not written any code at all for it.
I think that Windows observes the files you
open and save in your application by means of standard Windows file dialogs
open in your application by starting yourapp.exe <file name>, for instance by double-clicking a file that opens in your application
and automatically display these in the list.
If you want to control the task bar button and menu programmatically, you can use the Windows API. Delphi-specific examples are found in this blog post.
In my opinion the best way to do this is to make the following simple API call:
SHAddToRecentDocs(SHARD_PATH, PChar(FileName));
This not only deals with Windows 7 jump lists but also adds your file into the system's list of recently used documents which has an effect on early versions of Windows too.
Call the function whenever you open or save a file.
For your convenience, a link to the documentation of SHAddToRecentDocs().
Here are some resources that I have found useful when making my programs vista ready
http://code.google.com/p/theunknownones/wiki/TaskbarListComponents
http://www.installationexcellence.com/articles/VistaWithDelphi/Index.html
http://www.theabsolute.net/sware/delphivista.html

Resources