eclipse plugin: actual implementation of the "show report" menu
This commit is contained in:
parent
d9ba561934
commit
89b4a907e1
1 changed files with 18 additions and 0 deletions
|
@ -1,10 +1,18 @@
|
|||
package wesnoth_eclipse_plugin.action;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.eclipse.core.resources.IFolder;
|
||||
import org.eclipse.core.resources.IProject;
|
||||
import org.eclipse.jface.action.IAction;
|
||||
import org.eclipse.jface.viewers.ISelection;
|
||||
import org.eclipse.swt.SWT;
|
||||
import org.eclipse.ui.IObjectActionDelegate;
|
||||
import org.eclipse.ui.IWorkbenchPart;
|
||||
|
||||
import wesnoth_eclipse_plugin.utils.GUIUtils;
|
||||
import wesnoth_eclipse_plugin.utils.WorkspaceUtils;
|
||||
|
||||
public class WesnothProjectReport implements IObjectActionDelegate
|
||||
{
|
||||
public WesnothProjectReport(){ }
|
||||
|
@ -16,7 +24,17 @@ public class WesnothProjectReport implements IObjectActionDelegate
|
|||
@Override
|
||||
public void run(IAction action)
|
||||
{
|
||||
IProject project = WorkspaceUtils.getSelectedProject(WorkspaceUtils.getWorkbenchWindow());
|
||||
IFolder scenariosFolder = project.getFolder("scenarios");
|
||||
IFolder mapsFolder = project.getFolder("maps");
|
||||
IFolder unitsFolder = project.getFolder("units");
|
||||
|
||||
String simpleReport = String.format("Scenarios: %d \nMaps: %d \nUnits: %d",
|
||||
new File(scenariosFolder.getLocation().toOSString()).listFiles().length,
|
||||
new File(mapsFolder.getLocation().toOSString()).listFiles().length,
|
||||
new File(unitsFolder.getLocation().toOSString()).listFiles().length);
|
||||
|
||||
GUIUtils.showMessageBox(WorkspaceUtils.getWorkbenchWindow(), simpleReport,SWT.ICON_INFORMATION);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Add table
Reference in a new issue