diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/GcovFileView.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/GcovFileView.java index 96d07ba06..89d50a209 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/GcovFileView.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/GcovFileView.java @@ -24,7 +24,6 @@ import org.eclipse.core.resources.IWorkspaceRoot; import org.eclipse.core.resources.ResourcesPlugin; import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; import org.eclipse.core.runtime.Path; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IToolBarManager; @@ -54,7 +53,6 @@ import com.espressif.idf.core.logging.Logger; import com.espressif.idf.core.util.GcovUtility; import com.espressif.idf.core.util.IDFUtil; -import com.espressif.idf.core.util.StringUtil; /** * 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,14 +114,14 @@ public void handleEvent(Event event) // Create Toolbar and Buttons IToolBarManager mgr = getViewSite().getActionBars().getToolBarManager(); - Action refreshAction = new Action("Refresh") + Action refreshAction = new Action(Messages.GcovFileView_Refresh_Button) { public void run() { refreshList(); } }; - Action selectProjectAction = new Action("Select Project") + Action selectProjectAction = new Action(Messages.GcovFileView_SelectProject_Button) { public void run() { @@ -131,7 +129,9 @@ public void run() refreshList(); } }; + mgr.add(refreshAction); + mgr.add(selectProjectAction); // Initial population of the list refreshList(); @@ -149,7 +149,7 @@ public void selectionChanged(IWorkbenchPart part, ISelection selection) setSelectedProject((IProject) obj); } } - + private void openProjectSelectionDialog() { IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot(); @@ -168,7 +168,8 @@ private void openProjectSelectionDialog() setSelectedProject((IProject) dialog.getFirstResult()); } - private void createTableItem(Image image, String fileName, String filePath, String gcnoDate, String gcdaDate, String gcnoSize, String gcdaSize, Object data) + private void createTableItem(Image image, String fileName, String filePath, String gcnoDate, String gcdaDate, + String gcnoSize, String gcdaSize, Object data) { int index = 0; TableItem item = new TableItem(table, SWT.NONE); @@ -179,7 +180,7 @@ private void createTableItem(Image image, String fileName, String filePath, Stri item.setText(index++, gcdaDate); item.setText(index++, gcnoSize); item.setText(index++, gcdaSize); - + item.setData(data); } @@ -195,7 +196,7 @@ private String getFileSize(java.nio.file.Path path) return Messages.Table_Unknown; } } - + private void verifyProjectSelection() { if (getSelectedProject() == null) @@ -228,7 +229,7 @@ private void verifyProjectSelection() } } } - + private void refreshList() { for (TableItem item : table.getItems()) @@ -251,7 +252,7 @@ public boolean visit(IResource resource) if (resource instanceof IFile) { IFile file = (IFile) resource; - if ("gcno".equals(file.getFileExtension())) + if ("gcno".equals(file.getFileExtension())) //$NON-NLS-1$ { String parentDir = file.getParent().getRawLocation().toString(); String partnerFile = parentDir + "/" //$NON-NLS-1$ @@ -270,11 +271,13 @@ public boolean visit(IResource resource) .fetchInfo(); String dateGcda = DateFormat.getDateTimeInstance() .format(new Date(fileInfo.getLastModified())); - + String gcnoSize = getFileSize(Paths.get(file.getRawLocationURI())); String gcdaSize = getFileSize(Paths.get(partnerFile)); - createTableItem(image, file.getName().substring(0, file.getName().indexOf(".gcno")), file.getParent().getFullPath().toString(), dateGcno, dateGcda, gcnoSize, gcdaSize, file); + createTableItem(image, file.getName().substring(0, file.getName().indexOf(".gcno")), //$NON-NLS-1$ + file.getParent().getFullPath().toString(), dateGcno, dateGcda, gcnoSize, + gcdaSize, file); } } } @@ -379,8 +382,7 @@ public int compare(TableItem item1, TableItem item2) // Repopulate the table populateTable(copiedData); } - - + private List createTableDataCopy(TableItem[] items) { List copiedData = new ArrayList<>(); @@ -396,10 +398,10 @@ private List createTableDataCopy(TableItem[] items) rowData.itemData = item.getData(); copiedData.add(rowData); } - + return copiedData; } - + private void populateTable(List tableRowData) { for (TableRowData rowData : tableRowData) diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/Messages.java b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/Messages.java index 36bd05bba..1733cfb8f 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/Messages.java +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/Messages.java @@ -18,6 +18,8 @@ public class Messages extends NLS public static String TableCol_SizeGCDA; public static String Dialog_SelectProject_Title; public static String Table_Unknown; + public static String GcovFileView_Refresh_Button; + public static String GcovFileView_SelectProject_Button; static { diff --git a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/messages.properties b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/messages.properties index 5faa6467e..3df4934c8 100644 --- a/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/messages.properties +++ b/bundles/com.espressif.idf.ui/src/com/espressif/idf/ui/gcov/messages.properties @@ -6,3 +6,5 @@ TableCol_SizeGCNO=Size GCNO TableCol_SizeGCDA=Size GCDA Dialog_SelectProject_Title=Select a Project Table_Unknown=Unknown +GcovFileView_Refresh_Button=Refresh +GcovFileView_SelectProject_Button=Select Project \ No newline at end of file