processName = DACommunicator.getProcessNameFromTarget(pid);
}
if(processName!=null){
+ processName = splitTitle(processName, DALimit.MAX_STRING_LENGTH);
title.append(processName + CommonConstants.NEW_LINE);
}else{
title.append("unKnown process" + CommonConstants.NEW_LINE);
initFileChart(chart, false);
} else { // parent chart row
String fileName = fileChart.getFileName();
- String title = fileName;
- int maxLen = DALimit.MAX_STRING_LENGTH;
- if (fileName.length() > maxLen && fileName.length() < maxLen * 2) {
- title = fileName.substring(0, maxLen) + CommonConstants.NEW_LINE
- + fileName.substring(maxLen, fileName.length());
- } else if (fileName.length() >= maxLen *2) {
- title = fileName.substring(0, maxLen) + CommonConstants.NEW_LINE
- + fileName.substring(maxLen, maxLen*2 - 1) + "...";
- }
+ String title = splitTitle(fileName, DALimit.MAX_STRING_LENGTH);
item = new DAChartBoardItem(this, title);
item.setData(new FileSelectedData(fileChart.getFilePath(),
fileChart.getPid(), fileChart.getTid(), fileChart.getFd(),
fileChart.setItem(item);
chart.redraw();
}
+
+ private String splitTitle(String name, int maxLen) {
+ String title = name;
+ if (name.length() > maxLen ) {
+ title = name.substring(0, maxLen) + "...";
+ }
+ return title;
+ }
/**
* update file open status