Preface 1
Chapter 1: Creating Your First Plug-in 7
Getting started 7
Time for action – setting up the Eclipse SDK environment 8
Creating your first plug-in 11
Time for action – creating a plug-in 11
Running plug-ins 15
Time for action – launching Eclipse from within Eclipse 15
Debugging a plug-in 18
Time for action – debugging a plug-in 18
Time for action – updating code in debugger 22
Debugging with step filters 23
Time for action – setting up step filtering 23
Using different breakpoint types 25
Time for action – breaking at method entry and exit 25
Using conditional breakpoints 26
Time for action – setting a conditional breakpoint 26
Using exceptional breakpoints 28
Time for action – catching exceptions 28
Time for action – using watch variables and expressions 31
Summary 34
Chapter 2: Creating Views with SWT 35
Creating views and widgets 35
Time for action – creating a view 36
Time for action – drawing a custom view 38
Time for action – drawing a second hand 41
Time for action – animating the second hand 42
Time for action – running on the UI thread 43
Time for action – creating a reusable widget 45
Time for action – using layouts 47
Managing resources 50
Time for action – getting colorful 51
Time for action – finding the leak 52
Time for action – plugging the leak 54
Interacting with the user 56
Time for action – getting in focus 57
Time for action – responding to input 58
Using other SWT widgets 60
Time for action – adding items to the tray 60
Time for action – responding to the user 62
Time for action – modal and other effects 64
Time for action – groups and tab folders 66
Summary 73
Chapter 3: Creating JFace Viewers 75
Why JFace? 75
Creating TreeViewers 76
Time for action – creating a TreeViewer 76
Time for action – using Images in JFace 81
Time for action – styling label providers 84
Sorting and filtering 86
Time for action – sorting items in a viewer 87
Time for action – filtering items in a viewer 89
Interaction and properties 91
Time for action – adding a double-click listener 92
Time for action – showing properties 95
Tabular data 100
Time for action – viewing time zones in tables 100
Time for action – syncing selection 104
Summary 107
Chapter 4: Interacting with the User 109
Creating actions, commands, and handlers 109
Time for action – adding context menus 110
Time for action – creating commands and handlers 111
Time for action – binding commands to keys 114
Time for action – changing contexts 115
Time for action – enabling and disabling the menu's items 118
Time for action – reusing expressions 120
Time for action – contributing commands to pop-up menus 121
Jobs and progress 124
Time for action – running operations in the background 125
Time for action – reporting progress 127
Time for action – dealing with cancellation 128
Time for action – using subtasks and subprogress monitors 129
Time for action – using null progress monitors and submonitors 131
Time for action – setting job properties 133
Reporting errors 137
Time for action – showing errors 137
Summary 141
Chapter 5: Storing Preferences and Settings 143
Storing preferences 143
Time for action – persisting a value 144
Time for action – creating a preference page 145
Time for action – creating warning and error messages 147
Time for action – choosing from a list 148
Time for action – using a grid 150
Time for action – placing the preferences page 151
Time for action – using other field editors 153
Time for action – adding keywords 154
Time for action: using IEclipsePreferences 156
Using IMemento and DialogSettings 157
Time for action – adding a memento for the Time Zone View 158
Time for action – using DialogSettings 159
Summary 161
Chapter 6: Working with Resources 163
Using the workspace and resources 163
Time for action – creating an editor 164
Time for action – writing the markup parser 166
Time for action – building the builder 168
Time for action – iterating through resources 170
Time for action – creating resources 173
Time for action – implementing incremental builds 174
Time for action – handling deletion 175
Using natures 178
Time for action – creating a nature 178
Using markers 182
Time for action – error markers if the file is empty 182
Time for action – registering a marker type 184
Summary 186
Chapter 7: Understanding the Eclipse 4 Model 187
Working with the Eclipse 4 model 188
Time for action – installing E4 tooling 188
Time for action – creating an E4 application 190
Time for action – creating a part 195
Time for action – styling the UI with CSS 200
Using services and contexts 206
Time for action – adding logging 206
Time for action – getting the window 208
Time for action – obtaining the selection 209
Time for action – dealing with events 212
Time for action – calculating values on demand 215
Time for action – using preferences 217
Time for action – interacting with the UI 219
Using Commands, Handlers, and MenuItems 221
Time for action – wiring a menu to a command with a handler 221
Time for action – passing command parameters 224
Time for action – creating a direct menu and keybindings 226
Time for action – creating a pop-up menu and a view menu 229
Creating custom injectable classes 232
Time for action – creating a simple service 232
Time for action – injecting subtypes 233
Summary 235
Chapter 8: Creating Features, Update Sites, Applications, and Products 237
Grouping plug-ins with features 237
Time for action – creating a feature 238
Time for action – exporting a feature 240
Time for action – installing a feature 242
Time for action – categorizing the update site 244
Time for action – depending on other features 249
Time for action – branding features 250
Building applications and products 254
Time for action – creating a headless application 254
Time for action – creating a product 259
Summary 263
Chapter 9: Automated Testing of Plug-ins 265
Using JUnit for automated testing 265
Time for action – writing a simple JUnit test case 266
Time for action – writing a plug-in test 267
Using SWTBot for user interface testing 268
Time for action – writing an SWTBot test 268
Time for action – working with menus 271
Working with SWTBot 273
Time for action – hiding the welcome screen 273
Time for action – avoiding SWTBot runtime errors 274
Working with views 274
Time for action – showing views 275
Time for action – interrogating views 276
Interacting with the UI 277
Time for action – getting values from the UI 277
Time for action – waiting for a condition 278
Summary 281
Chapter 10: Automated Builds with Tycho 283
Using Maven to build Eclipse plug-ins with Tycho 283
Time for action – installing Maven 284
Time for action – building with Tycho 286
Building features and update sites with Tycho 289
Time for action – creating a parent project 289
Time for action – building a feature 292
Time for action – building an update site 293
Time for action – building a product 295
Testing and releasing 300
Time for action – running automated tests 300
Time for action – changing the version numbers 303
Signing update sites 305
Time for action – creating a self-signed certificate 305
Time for action – signing the plug-ins 307
Time for action – serving an update site 309
Summary 310
Appendix: Pop Quiz Answers 311
Chapter 1, Creating Your First Plug-in 311
Chapter 2, Creating Views with SWT 312
Chapter 3, Creating JFace Viewers 314
Chapter 4, Interacting with the User 315
Chapter 5, Storing Preferences and Settings 317
Chapter 6, Working with Resources 317
Chapter 7, Understanding the Eclipse 4 Model 318
Chapter 8, Creating Features, Update Sites, Applications, and Products 320
Chapter 9, Automated Testing of Plug-ins 320
Chapter 10, Automated Builds with Tycho 321
Index 323
· · · · · · (
收起)