Reputation: 939
I'm currently writing an RCP application with custom editors. I'm trying to check if the file that is to be renamed is open in an editor. Using a custom RenameParticipant I can check this and prevent the rename operation, but this happens AFTER the user has entered a new name. I would like the check to happen before. Is this possible?
Upvotes: 1
Views: 70
Reputation: 671
First, you need to obtain the editors that are opened in your RCP application. Eclipse allows you to do this by means of the following line:
PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getEditorReferences();
Then, you have to check whether your file is opened in one of these editors. To do this, you can iterate the resulting array. Each of the elements of the array is of type IEditorReference
. You can get the file that is opened in each editor reference by means of the method getEditorInput()
.
Upvotes: 1