24
24
import org .eclipse .core .resources .IWorkspaceRoot ;
25
25
import org .eclipse .core .resources .ResourcesPlugin ;
26
26
import org .eclipse .core .runtime .CoreException ;
27
- import org .eclipse .core .runtime .IPath ;
28
27
import org .eclipse .core .runtime .Path ;
29
28
import org .eclipse .jface .action .Action ;
30
29
import org .eclipse .jface .action .IToolBarManager ;
54
53
import com .espressif .idf .core .logging .Logger ;
55
54
import com .espressif .idf .core .util .GcovUtility ;
56
55
import com .espressif .idf .core .util .IDFUtil ;
57
- import com .espressif .idf .core .util .StringUtil ;
58
56
59
57
/**
60
58
* Gcov file view that can be opened by right clicking on the project. It is used to show the gcno/gcda files as one
@@ -116,22 +114,24 @@ public void handleEvent(Event event)
116
114
117
115
// Create Toolbar and Buttons
118
116
IToolBarManager mgr = getViewSite ().getActionBars ().getToolBarManager ();
119
- Action refreshAction = new Action ("Refresh" )
117
+ Action refreshAction = new Action (Messages . GcovFileView_Refresh_Button )
120
118
{
121
119
public void run ()
122
120
{
123
121
refreshList ();
124
122
}
125
123
};
126
- Action selectProjectAction = new Action ("Select Project" )
124
+ Action selectProjectAction = new Action (Messages . GcovFileView_SelectProject_Button )
127
125
{
128
126
public void run ()
129
127
{
130
128
openProjectSelectionDialog ();
131
129
refreshList ();
132
130
}
133
131
};
132
+
134
133
mgr .add (refreshAction );
134
+ mgr .add (selectProjectAction );
135
135
136
136
// Initial population of the list
137
137
refreshList ();
@@ -149,7 +149,7 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection)
149
149
setSelectedProject ((IProject ) obj );
150
150
}
151
151
}
152
-
152
+
153
153
private void openProjectSelectionDialog ()
154
154
{
155
155
IWorkspaceRoot root = ResourcesPlugin .getWorkspace ().getRoot ();
@@ -168,7 +168,8 @@ private void openProjectSelectionDialog()
168
168
setSelectedProject ((IProject ) dialog .getFirstResult ());
169
169
}
170
170
171
- private void createTableItem (Image image , String fileName , String filePath , String gcnoDate , String gcdaDate , String gcnoSize , String gcdaSize , Object data )
171
+ private void createTableItem (Image image , String fileName , String filePath , String gcnoDate , String gcdaDate ,
172
+ String gcnoSize , String gcdaSize , Object data )
172
173
{
173
174
int index = 0 ;
174
175
TableItem item = new TableItem (table , SWT .NONE );
@@ -179,7 +180,7 @@ private void createTableItem(Image image, String fileName, String filePath, Stri
179
180
item .setText (index ++, gcdaDate );
180
181
item .setText (index ++, gcnoSize );
181
182
item .setText (index ++, gcdaSize );
182
-
183
+
183
184
item .setData (data );
184
185
}
185
186
@@ -195,7 +196,7 @@ private String getFileSize(java.nio.file.Path path)
195
196
return Messages .Table_Unknown ;
196
197
}
197
198
}
198
-
199
+
199
200
private void verifyProjectSelection ()
200
201
{
201
202
if (getSelectedProject () == null )
@@ -228,7 +229,7 @@ private void verifyProjectSelection()
228
229
}
229
230
}
230
231
}
231
-
232
+
232
233
private void refreshList ()
233
234
{
234
235
for (TableItem item : table .getItems ())
@@ -251,7 +252,7 @@ public boolean visit(IResource resource)
251
252
if (resource instanceof IFile )
252
253
{
253
254
IFile file = (IFile ) resource ;
254
- if ("gcno" .equals (file .getFileExtension ()))
255
+ if ("gcno" .equals (file .getFileExtension ())) //$NON-NLS-1$
255
256
{
256
257
String parentDir = file .getParent ().getRawLocation ().toString ();
257
258
String partnerFile = parentDir + "/" //$NON-NLS-1$
@@ -270,11 +271,13 @@ public boolean visit(IResource resource)
270
271
.fetchInfo ();
271
272
String dateGcda = DateFormat .getDateTimeInstance ()
272
273
.format (new Date (fileInfo .getLastModified ()));
273
-
274
+
274
275
String gcnoSize = getFileSize (Paths .get (file .getRawLocationURI ()));
275
276
String gcdaSize = getFileSize (Paths .get (partnerFile ));
276
277
277
- createTableItem (image , file .getName ().substring (0 , file .getName ().indexOf (".gcno" )), file .getParent ().getFullPath ().toString (), dateGcno , dateGcda , gcnoSize , gcdaSize , file );
278
+ createTableItem (image , file .getName ().substring (0 , file .getName ().indexOf (".gcno" )), //$NON-NLS-1$
279
+ file .getParent ().getFullPath ().toString (), dateGcno , dateGcda , gcnoSize ,
280
+ gcdaSize , file );
278
281
}
279
282
}
280
283
}
@@ -379,8 +382,7 @@ public int compare(TableItem item1, TableItem item2)
379
382
// Repopulate the table
380
383
populateTable (copiedData );
381
384
}
382
-
383
-
385
+
384
386
private List <TableRowData > createTableDataCopy (TableItem [] items )
385
387
{
386
388
List <TableRowData > copiedData = new ArrayList <>();
@@ -396,10 +398,10 @@ private List<TableRowData> createTableDataCopy(TableItem[] items)
396
398
rowData .itemData = item .getData ();
397
399
copiedData .add (rowData );
398
400
}
399
-
401
+
400
402
return copiedData ;
401
403
}
402
-
404
+
403
405
private void populateTable (List <TableRowData > tableRowData )
404
406
{
405
407
for (TableRowData rowData : tableRowData )
0 commit comments