Browse files

made lines count a tooltip on the model name

  • Loading branch information...
1 parent 0d98443 commit ee3da2a8d153b0975883454f306adcd9e8bd74e2 @FarMcKon FarMcKon committed Feb 10, 2012
Showing with 5 additions and 13 deletions.
  1. +4 −6 src/replicatorg/app/ui/EditorHeader.java
  2. +1 −7 src/replicatorg/model/Build.java
View
10 src/replicatorg/app/ui/EditorHeader.java
@@ -141,7 +141,6 @@ public void buildElementUpdate(BuildElement element) {
}
JLabel titleLabel = new JLabel("Untitled");
- JLabel linesLabel = new JLabel ("");
MainWindow editor;
@@ -158,7 +157,7 @@ public EditorHeader(MainWindow mainWindow) {
this.editor = mainWindow;
add(titleLabel);
- add(linesLabel);
+ titleLabel.setToolTipText("(0)");
backgroundColor = new Color(0x92, 0xA0, 0x6B);
textSelectedColor = Base.getColorPref("header.text.selected.color","#1A1A00");
textUnselectedColor = Base.getColorPref("header.text.unselected.color","#ffffff");
@@ -184,18 +183,17 @@ private void addTabForElement(Build build, BuildElement element) {
}
void setBuild(Build build) {
+ int lines = 0;
removeTabs();
- linesLabel.setText("");
if (build.getModel() != null) {
addTabForElement(build,build.getModel());
}
if (build.getCode() != null) {
addTabForElement(build,build.getCode());
- int lines = build.getLines();
- if (0 < lines)
- linesLabel.setText("(" + lines + " lines)");
+ lines = build.getLines();
}
titleLabel.setText(build.getName());
+ titleLabel.setToolTipText("lines: "+lines);
validate();
repaint();
}
View
8 src/replicatorg/model/Build.java
@@ -360,13 +360,7 @@ public int getLines() {
}
protected int countLines(String what) {
- char c[] = what.toCharArray();
- int count = 0;
- for (int i = 0; i < c.length; i++) {
- if (c[i] == '\n')
- count++;
- }
- return count;
+ return what.split("\n").length - 1;
}
static public String scrubComments(String what) {

0 comments on commit ee3da2a

Please sign in to comment.