问题
I have the source code for the VersionOne plugin. I am wanting to modify the code because I am getting a NullPointerException when I click a specific button on the plugin which crashes eclipse. I was wondering what steps I need to take in eclipse to import the source code, modify it, and get it to run. I have read over how to create a new plugin project, but I have never tried importing a plugin before. Plugin Source
回答1:
Once you have imported the project and that seems to work fine, just run it like any other plugin.
I.e:
- Set the breakpoints you want in the code
- Click the "Run as..."
- In the run dialog start up a new Eclipse instance
- On the tab "plugins" make sure your imported plugin is selected
- If you are using the plugin at the same time, make sure that the non-workspace is not selected
- In the new Eclipse instance, set up a situation that will provoke the bug
回答2:
You need the following things to do that:
- From Eclipse download a distro with PDE (Plugin Development) included.
- The source pages
- Some configuration management tool like Git or Subversion.
You do then the following steps:
- Unzip your sources locally somewhere and add them to the CM system.
- Create an eclipse plugin project from that source location (depending on Git or SVN different steps).
- Create a run configuration for Eclipse that includes that plugin. That is similar to creating a run configuration for Java, but your Java application is then eclipse (see the Help on Eclipse Application Launcher). You have to ensure that in the "Plug-ins Tab", your new plugin is included. After you have started it, you should see the new feature implemented in the new running eclipse. To debug it, you just have to press the debug button instead of the run button. You may then add breakpoints to the source code of your plugin to see how it is working.
You are then able to start a new eclipse application which includes the plugin and make your tests there. You are able to set breakpoints, debug the code and so on. If you find the error, you can change the code, test it, and as a result have a difference to the source you had initially. The best would be then to make a patch and send it back to the originator.
To deploy it then to others is a different story, and is well documented.
来源:https://stackoverflow.com/questions/7907201/importing-eclipse-plugin-source-in-eclipse