package org.tizen.dynamicanalyzer.handlers;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import org.tizen.dynamicanalyzer.setting.TargetData;
import org.tizen.dynamicanalyzer.swap.logparser.DataManagerRegistry;
import org.tizen.dynamicanalyzer.ui.info.callstack.CallStackInserter;
+import org.tizen.dynamicanalyzer.ui.page.PageInfoRegistry;
import org.tizen.dynamicanalyzer.util.Logger;
public class CLIAction implements UIAction {
@Override
public List<String> getPageNames() {
- // TODO Auto-generated method stub
- return null;
- }
-
- @Override
- public List<String> convertPageIDtoPageName(List<String> pageIDs) {
- // TODO Auto-generated method stub
- return null;
+ return new ArrayList<String>(
+ PageInfoRegistry.getPageNamesByTarget(getCurrentTargetName()));
}
@Override
@Override
public void setPageBySetting() {
- TargetData target = SettingDataManager.INSTANCE.getConnectedTarget();
- final String targetName = target.getTargetName();
+ final String targetName = getCurrentTargetName();
DataManagerRegistry.createDataManagersByTarget(targetName);
}
+ /**
+ * Get name(serial) of currently selected target.
+ * @return target name(serial)
+ */
+ private String getCurrentTargetName() {
+ String targetName = null;
+ TargetData target = SettingDataManager.INSTANCE.getConnectedTarget();
+ if (target != null)
+ targetName = target.getTargetName();
+ return targetName;
+ }
+
}
package org.tizen.dynamicanalyzer.handlers;
-import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import org.tizen.dynamicanalyzer.common.DALogExport;
import org.tizen.dynamicanalyzer.common.DAResult;
import org.tizen.dynamicanalyzer.constant.CommonConstants;
-import org.tizen.dynamicanalyzer.nl.SummaryLabels;
import org.tizen.dynamicanalyzer.project.Project;
import org.tizen.dynamicanalyzer.resources.ImageResources;
-import org.tizen.dynamicanalyzer.setting.SettingConstants;
import org.tizen.dynamicanalyzer.setting.SettingDataManager;
import org.tizen.dynamicanalyzer.setting.TargetData;
import org.tizen.dynamicanalyzer.setting.UILayoutDataManager;
-import org.tizen.dynamicanalyzer.ui.file.FilePage;
-import org.tizen.dynamicanalyzer.ui.hierarchy.HierarchyPage;
import org.tizen.dynamicanalyzer.ui.info.appStartup.AppStartupView;
-import org.tizen.dynamicanalyzer.ui.interactive.InteractivePage;
-import org.tizen.dynamicanalyzer.ui.kernel.KernelPage;
-import org.tizen.dynamicanalyzer.ui.memory.MemoryPage;
-import org.tizen.dynamicanalyzer.ui.network.NetworkPage;
-import org.tizen.dynamicanalyzer.ui.opengl.GLPage;
import org.tizen.dynamicanalyzer.ui.page.BaseView;
-import org.tizen.dynamicanalyzer.ui.summary.SummaryPage;
-import org.tizen.dynamicanalyzer.ui.summary.leaks.LeakView;
+import org.tizen.dynamicanalyzer.ui.page.PageInfoRegistry;
import org.tizen.dynamicanalyzer.ui.summary.profiling.FunctionUsageProfilingView;
-import org.tizen.dynamicanalyzer.ui.thread.ThreadPage;
import org.tizen.dynamicanalyzer.ui.timeline.TimelinePage;
import org.tizen.dynamicanalyzer.ui.timeline.calltrace.CallTraceView;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineChartManager;
import org.tizen.dynamicanalyzer.ui.timeline.common.TimelineTableView;
-import org.tizen.dynamicanalyzer.ui.userinterface.UIPage;
import org.tizen.dynamicanalyzer.util.Logger;
import org.tizen.dynamicanalyzer.util.WorkbenchUtil;
import org.tizen.dynamicanalyzer.utils.AnalyzerUtil;
public List<String> getPageNames() {
BaseView bv = (BaseView) WorkbenchUtil.getViewPart(BaseView.ID);
List<String> idList = bv.getMainTab().getViewIDList();
- List<String> nameList = convertPageIDtoPageName(idList);
+ List<String> nameList = PageInfoRegistry.convertPageIDtoPageName(idList);
return nameList;
}
@Override
- public List<String> convertPageIDtoPageName(List<String> pageIDs) {
- List<String> pageNameList = new ArrayList<String>();
-
- for (int i = 0; i < pageIDs.size(); i++) {
- if (pageIDs.get(i).equals(TimelinePage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_TIME_LINE);
- } else if (pageIDs.get(i).equals(ThreadPage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_THREAD);
- } else if (pageIDs.get(i).equals(NetworkPage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_NETWORK);
- } else if (pageIDs.get(i).equals(FilePage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_FILE);
- } else if (pageIDs.get(i).equals(GLPage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_OPENGL);
- } else if (pageIDs.get(i).equals(UIPage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_UI);
- } else if (pageIDs.get(i).equals(KernelPage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_KERNEL);
- } else if (pageIDs.get(i).equals(InteractivePage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_INTERACTIVE);
- } else if (pageIDs.get(i).equals(SummaryPage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_SUMMARY);
- } else if (pageIDs.get(i).equals(HierarchyPage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_HIERARCHY);
- } else if (pageIDs.get(i).equals(MemoryPage.pageID)) {
- pageNameList.add(SettingConstants.PAGE_NAME_MEMORY);
- } else {
- Logger.error("Unknown page ID");
- }
- }
-
- return pageNameList;
- }
-
- @Override
public void setUIElements(Project project) {
setPages(project.getPageTabList());
setCharts(project.getTimelineChartList());
return selectedPageSet;
}
+ /**
+ * Convert ids of tab pages to corresponding tab pages names.
+ *
+ * @param pageIDs list of page ids.
+ * @return list of page names.
+ */
+ public static List<String> convertPageIDtoPageName(List<String> pageIDs) {
+ List<String> pageNameList = new ArrayList<String>();
+
+ // TODO replace if-else with selection from preliminarily prepared map
+ for (int i = 0; i < pageIDs.size(); i++) {
+ if (pageIDs.get(i).equals(TimelinePage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_TIME_LINE);
+ } else if (pageIDs.get(i).equals(ThreadPage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_THREAD);
+ } else if (pageIDs.get(i).equals(NetworkPage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_NETWORK);
+ } else if (pageIDs.get(i).equals(FilePage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_FILE);
+ } else if (pageIDs.get(i).equals(GLPage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_OPENGL);
+ } else if (pageIDs.get(i).equals(UIPage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_UI);
+ } else if (pageIDs.get(i).equals(KernelPage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_KERNEL);
+ } else if (pageIDs.get(i).equals(InteractivePage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_INTERACTIVE);
+ } else if (pageIDs.get(i).equals(SummaryPage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_SUMMARY);
+ } else if (pageIDs.get(i).equals(HierarchyPage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_HIERARCHY);
+ } else if (pageIDs.get(i).equals(MemoryPage.pageID)) {
+ pageNameList.add(SettingConstants.PAGE_NAME_MEMORY);
+ } else {
+ Logger.error("Unknown page ID");
+ }
+ }
+ return pageNameList;
+ }
+
}