50
50
* <LI>Edit tags (both name and comment)</LI>
51
51
* <LI>Delete tags</LI>
52
52
* <LI>Assign tags to the currently selected function</LI>
53
- * <LI>Remove tags from the currently selected function</LI>
53
+ * <LI>Remove tags from the currently selected function</LI>
54
54
* </UL>
55
- * This provider can be shown by right-clicking on a function and selecting the
55
+ * This provider can be shown by right-clicking on a function and selecting the
56
56
* "Edit Tags" option, or by selecting the "Edit Function Tags" option from the
57
57
* "Window" menu.
58
58
*/
59
- public class FunctionTagProvider extends ComponentProviderAdapter
60
- implements DomainObjectListener {
59
+ public class FunctionTagProvider extends ComponentProviderAdapter implements DomainObjectListener {
61
60
62
61
private SourceTagsPanel sourcePanel ;
63
62
private TargetTagsPanel targetPanel ;
@@ -75,37 +74,37 @@ public class FunctionTagProvider extends ComponentProviderAdapter
75
74
76
75
private SwingUpdateManager updater = new SwingUpdateManager (this ::doUpdate );
77
76
78
- // The current program location selected in the listing.
77
+ // The current program location selected in the listing.
79
78
private ProgramLocation currentLocation = null ;
80
79
81
80
// Character used as a separator when entering multiple tags in
82
81
// the create tag entry field.
83
82
private static final String INPUT_DELIMITER = "," ;
84
83
85
- /**
86
- * Optional! If there is a file with this name which can be found by the
87
- * {@link ResourceManager}, and it contains a valid list of tag names,
84
+ /**
85
+ * Optional! If there is a file with this name which can be found by the
86
+ * {@link ResourceManager}, and it contains a valid list of tag names,
88
87
* they will be loaded. The file must be XML with the following
89
88
* structure:
90
- *
89
+ *
91
90
* <tags>
92
91
* <tag>
93
92
* <name>TAG1</name>
94
93
* <comment>tag comment</comment>
95
94
* </tag>
96
- * </tags>
97
- *
95
+ * </tags>
96
+ *
98
97
*/
99
98
private static String TAG_FILE = "functionTags.xml" ;
100
99
101
- // Keeps a list of the original tags as loaded from file. This is necessary when switching
102
- // between programs where we need to know the original state of the disabled tags. Without
100
+ // Keeps a list of the original tags as loaded from file. This is necessary when switching
101
+ // between programs where we need to know the original state of the disabled tags. Without
103
102
// this we would need to reload from file on each new program activation.
104
103
private Set <FunctionTag > tagsFromFile ;
105
104
106
105
/**
107
106
* Constructor
108
- *
107
+ *
109
108
* @param plugin the function tag plugin
110
109
* @param program the current program
111
110
*/
@@ -118,10 +117,6 @@ public FunctionTagProvider(FunctionTagPlugin plugin, Program program) {
118
117
addToTool ();
119
118
}
120
119
121
- /******************************************************************************
122
- * PUBLIC METHODS
123
- ******************************************************************************/
124
-
125
120
@ Override
126
121
public void componentShown () {
127
122
updateView ();
@@ -133,10 +128,10 @@ public JComponent getComponent() {
133
128
}
134
129
135
130
/**
136
- * Invoked when a new location has been detected in the listing. When
131
+ * Invoked when a new location has been detected in the listing. When
137
132
* this happens we need to update the tag list to show what tags are assigned
138
133
* at the current location.
139
- *
134
+ *
140
135
* @param loc the address selected in the listing
141
136
*/
142
137
public void locationChanged (ProgramLocation loc ) {
@@ -158,12 +153,6 @@ public void programDeactivated(Program deactivatedProgram) {
158
153
this .program = null ;
159
154
}
160
155
161
- /**
162
- * This class needs to listen for changes to the domain object (tag create, delete, etc...)
163
- * so it can update the display accordingly.
164
- *
165
- * @param ev the change event
166
- */
167
156
@ Override
168
157
public void domainObjectChanged (DomainObjectChangedEvent ev ) {
169
158
@@ -244,8 +233,8 @@ private JPanel createWorkPanel() {
244
233
allFunctionsPanel .setBorder (BorderFactory .createLineBorder (Colors .BORDER ));
245
234
246
235
// If we don't set this, then the splitter won't be able to shrink the
247
- // target panels below the size required by its header, which can be large
248
- // because of the amount of text displayed. Keep the minimum size setting on
236
+ // target panels below the size required by its header, which can be large
237
+ // because of the amount of text displayed. Keep the minimum size setting on
249
238
// the source panel, however. That is generally small.
250
239
targetPanel .setMinimumSize (new Dimension (0 , 0 ));
251
240
@@ -270,7 +259,7 @@ private JPanel createWorkPanel() {
270
259
* Updates the button panel depending on the selection state of the
271
260
* tag lists. Also updates the {@link AllFunctionsPanel} so it can update
272
261
* its list.
273
- *
262
+ *
274
263
* @param panel the panel that generated the selection event
275
264
*/
276
265
public void selectionChanged (TagListPanel panel ) {
@@ -330,7 +319,7 @@ Set<FunctionTag> backgroundLoadTags() {
330
319
331
320
/**
332
321
* Loads tags from the external file specified.
333
- *
322
+ *
334
323
* @return the loaded tags
335
324
*/
336
325
private Set <FunctionTag > getFileTags () {
@@ -342,7 +331,7 @@ private Set<FunctionTag> getFileTags() {
342
331
343
332
/**
344
333
* Returns an array of all tags stored in the database.
345
- *
334
+ *
346
335
* @return list of tags
347
336
*/
348
337
private List <? extends FunctionTag > getAllTagsFromDatabase () {
@@ -355,7 +344,7 @@ private List<? extends FunctionTag> getAllTagsFromDatabase() {
355
344
356
345
/**
357
346
* Returns the {@link Function} for the given program location
358
- *
347
+ *
359
348
* @param loc the program location
360
349
* @return function containing the location, or null if not applicable
361
350
*/
@@ -371,7 +360,7 @@ private Function getFunction(ProgramLocation loc) {
371
360
372
361
/**
373
362
* Retrieves the address of the function associated with the given program location.
374
- *
363
+ *
375
364
* @param loc the program location
376
365
* @return the entry point of the function, or null if not valid
377
366
*/
@@ -408,7 +397,7 @@ private void updateTagViews() {
408
397
targetPanel .setProgram (program );
409
398
allFunctionsPanel .setProgram (program );
410
399
411
- // Get the currently selected tags and use them to update the all functions panel. If
400
+ // Get the currently selected tags and use them to update the all functions panel. If
412
401
// there is no current selection, leave the table as-is.
413
402
Set <FunctionTag > sTags = sourcePanel .getSelectedTags ();
414
403
Set <FunctionTag > tTags = targetPanel .getSelectedTags ();
@@ -423,7 +412,7 @@ private void updateTagViews() {
423
412
}
424
413
425
414
/**
426
- * Parses all items in the text input field and adds them as new tags.
415
+ * Parses all items in the text input field and adds them as new tags.
427
416
*/
428
417
private void processCreates () {
429
418
@@ -462,15 +451,15 @@ private void processCreates() {
462
451
/**
463
452
* Returns a list of tag names the user has entered in the input` field.
464
453
* Note: This assumes that multiple entries are comma-delimited.
465
- *
454
+ *
466
455
* @return the list of tag names to create
467
456
*/
468
457
private List <String > getInputNames () {
469
458
470
459
// first split the string on the delimiter to get all the entries
471
460
String [] names = tagInputField .getText ().split (INPUT_DELIMITER );
472
461
473
- // trim each item to remove any leading/trailing whitespace and add to the return list
462
+ // trim each item to remove any leading/trailing whitespace and add to the return list
474
463
List <String > nameList = new ArrayList <>();
475
464
for (String name : names ) {
476
465
if (!StringUtils .isBlank (name )) {
@@ -483,7 +472,7 @@ private List<String> getInputNames() {
483
472
484
473
/**
485
474
* Creates the text-entry panel for adding new tag names.
486
- *
475
+ *
487
476
* @return the new text input panel
488
477
*/
489
478
private JPanel createInputPanel () {
0 commit comments