Once the location of interest has been found, it is necessary to modify the code to attempt a fix. For example, if the developer wanted to ensure that the window's title was all in upper case, it would be necessary to inject a title.toUpperCase()
call. However, since the .class
file is read-only, it is necessary to import the plug-in's source into the workspace to change the implementation.
org.eclipse.swt
to scroll down the list, and select both the org.eclipse.swt
bundle and the org.eclipse.swt.*
fragment that corresponds to the platform. For example, on macOS this will start with org.eclipse.swt.cocoa
, while on Windows it will start with org.eclipse.swt.win32
; and on Linux, org.eclipse.swt.gtk
:Shell
from the org.eclipse.swt.widgets
package. Instead of showing Shell.class
in the editor title, it should now say Shell.java
and should be mutable.setText
method and add a re-assignment of the string
to convert it to upper case:public void setText(String string) { checkWidget(); if (string == null) error (SWT.ERROR_NULL_ARGUMENT); if (window == null) return; string = string.toUpperCase(); super.setText(string);
Debugging and introspecting variables can be done without source code, but in order to make changes, it is necessary to import the source code. Eclipse provides an easy way to import source code associated with the plug-in using the Plug-ins view and using Import As | Source Project.
When importing as a source project, a project is set up and the source code imported in and compiled. This will give the ability for the compiler to pick up any problems with code changes for the projects that are in the workspace.
If the only changes required are to modify the plugin.xml
(for example, adding another extension), then the project can be imported as a Binary Project or Binary Project with Linked Content. Both of these options are faster, since the previously compiled code is used instead of recompiling with source. The only difference is whether the Jar file is copied into the project or a project link (like a symlink) is used to refer to the Jar from the platform's plugins
directory. In neither case can the existing source files be modified.
Once the source code is available, it can be changed and debugged just like any other plug-in project. In addition, the version of the source code is guaranteed to be the same as the version of the installed plug-in.
18.191.228.88