Skip to content

Commit 931da92

Browse files
committed
string externalization and added action to view
1 parent 3519ab9 commit 931da92

File tree

3 files changed

+22
-16
lines changed

3 files changed

+22
-16
lines changed

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/GcovFileView.java

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import org.eclipse.core.resources.IWorkspaceRoot;
2525
import org.eclipse.core.resources.ResourcesPlugin;
2626
import org.eclipse.core.runtime.CoreException;
27-
import org.eclipse.core.runtime.IPath;
2827
import org.eclipse.core.runtime.Path;
2928
import org.eclipse.jface.action.Action;
3029
import org.eclipse.jface.action.IToolBarManager;
@@ -54,7 +53,6 @@
5453
import com.espressif.idf.core.logging.Logger;
5554
import com.espressif.idf.core.util.GcovUtility;
5655
import com.espressif.idf.core.util.IDFUtil;
57-
import com.espressif.idf.core.util.StringUtil;
5856

5957
/**
6058
* 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)
116114

117115
// Create Toolbar and Buttons
118116
IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager();
119-
Action refreshAction = new Action("Refresh")
117+
Action refreshAction = new Action(Messages.GcovFileView_Refresh_Button)
120118
{
121119
public void run()
122120
{
123121
refreshList();
124122
}
125123
};
126-
Action selectProjectAction = new Action("Select Project")
124+
Action selectProjectAction = new Action(Messages.GcovFileView_SelectProject_Button)
127125
{
128126
public void run()
129127
{
130128
openProjectSelectionDialog();
131129
refreshList();
132130
}
133131
};
132+
134133
mgr.add(refreshAction);
134+
mgr.add(selectProjectAction);
135135

136136
// Initial population of the list
137137
refreshList();
@@ -149,7 +149,7 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection)
149149
setSelectedProject((IProject) obj);
150150
}
151151
}
152-
152+
153153
private void openProjectSelectionDialog()
154154
{
155155
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
@@ -168,7 +168,8 @@ private void openProjectSelectionDialog()
168168
setSelectedProject((IProject) dialog.getFirstResult());
169169
}
170170

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)
172173
{
173174
int index = 0;
174175
TableItem item = new TableItem(table, SWT.NONE);
@@ -179,7 +180,7 @@ private void createTableItem(Image image, String fileName, String filePath, Stri
179180
item.setText(index++, gcdaDate);
180181
item.setText(index++, gcnoSize);
181182
item.setText(index++, gcdaSize);
182-
183+
183184
item.setData(data);
184185
}
185186

@@ -195,7 +196,7 @@ private String getFileSize(java.nio.file.Path path)
195196
return Messages.Table_Unknown;
196197
}
197198
}
198-
199+
199200
private void verifyProjectSelection()
200201
{
201202
if (getSelectedProject() == null)
@@ -228,7 +229,7 @@ private void verifyProjectSelection()
228229
}
229230
}
230231
}
231-
232+
232233
private void refreshList()
233234
{
234235
for (TableItem item : table.getItems())
@@ -251,7 +252,7 @@ public boolean visit(IResource resource)
251252
if (resource instanceof IFile)
252253
{
253254
IFile file = (IFile) resource;
254-
if ("gcno".equals(file.getFileExtension()))
255+
if ("gcno".equals(file.getFileExtension())) //$NON-NLS-1$
255256
{
256257
String parentDir = file.getParent().getRawLocation().toString();
257258
String partnerFile = parentDir + "/" //$NON-NLS-1$
@@ -270,11 +271,13 @@ public boolean visit(IResource resource)
270271
.fetchInfo();
271272
String dateGcda = DateFormat.getDateTimeInstance()
272273
.format(new Date(fileInfo.getLastModified()));
273-
274+
274275
String gcnoSize = getFileSize(Paths.get(file.getRawLocationURI()));
275276
String gcdaSize = getFileSize(Paths.get(partnerFile));
276277

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);
278281
}
279282
}
280283
}
@@ -379,8 +382,7 @@ public int compare(TableItem item1, TableItem item2)
379382
// Repopulate the table
380383
populateTable(copiedData);
381384
}
382-
383-
385+
384386
private List<TableRowData> createTableDataCopy(TableItem[] items)
385387
{
386388
List<TableRowData> copiedData = new ArrayList<>();
@@ -396,10 +398,10 @@ private List<TableRowData> createTableDataCopy(TableItem[] items)
396398
rowData.itemData = item.getData();
397399
copiedData.add(rowData);
398400
}
399-
401+
400402
return copiedData;
401403
}
402-
404+
403405
private void populateTable(List<TableRowData> tableRowData)
404406
{
405407
for (TableRowData rowData : tableRowData)

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/Messages.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ public class Messages extends NLS
1818
public static String TableCol_SizeGCDA;
1919
public static String Dialog_SelectProject_Title;
2020
public static String Table_Unknown;
21+
public static String GcovFileView_Refresh_Button;
22+
public static String GcovFileView_SelectProject_Button;
2123

2224
static
2325
{

bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/messages.properties

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,5 @@ TableCol_SizeGCNO=Size GCNO
66
TableCol_SizeGCDA=Size GCDA
77
Dialog_SelectProject_Title=Select a Project
88
Table_Unknown=Unknown
9+
GcovFileView_Refresh_Button=Refresh
10+
GcovFileView_SelectProject_Button=Select Project

0 commit comments

Comments
 (0)