Reputation: 23
I am developing a plug-in which is basically create a new project, project contains more than one folder, and the folder contains our own customized editors. Now I dont want to allow the user to rename of the project from anywhere. I can see the rename option in file menu, context menu of project explorer, context menu of package explorer, context menu of navigator. Is it possible to disable/customize the rename option globally. I have tried to use global action handler for rename action,which is basically doing my own job whenever the rename action occurs. But since I want to block/disable the rename option at the time plug-in activator get started, I am able get active view site on the activator class, which doesn't seems to help me because of the active view might be anyother than above mentioned view at sometimes. Hence I tried to using 'Rename Participant' through ltk's renameparticipant extension and I wrote my own class which extending RenameParticipant, but the class never get initiated even I have given the correct class name in plug-in.xml file.
Since our product is plug-in
Could anyone please advise me that how should I proceed further? I hope that someone has already walk on this path to block the rename option globally.
Upvotes: 2
Views: 1897
Reputation: 482
I removed from context menu using that class
public class MoveActionProvider extends RefactorActionProvider {
//@Override
public void fillContextMenu(IMenuManager menu) {}
}
and declaring this into the plugin.xml
<extension point="org.eclipse.ui.navigator.navigatorContent">
<actionProvider
class="com.totvs.tds.ordinechaos.providers.action.MoveActionProvider"
id="com.totvs.tds.ordinechaos.providers.action.MoveActionExtension"
overrides="org.eclipse.ui.navigator.resources.actions.RefactorActions"
priority="highest">
<enablement>
<!-- A hack to allways be enabled -->
<not>
<systemTest
property="MyApp"
value="WONT-EVER-BE-SET">
</systemTest>
</not>
</enablement>
</actionProvider>
</extension>
Upvotes: 2
Reputation: 3621
You can specify your own handler to global rename (id="org.eclipse.ui.edit.rename") and Java Rename element (id="org.eclipse.jdt.ui.edit.text.java.rename.element") commands using Handlers
extension point. However, it is not possible to disable the context menu item (Refactor > Rename...) in Package Explorer because it is hard-coded.
Upvotes: 3