<skipTests>${skipBatchTests}</skipTests>
</configuration>
</plugin>
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <archive>
+ <manifest>
+ <mainClass>org.sonar.batch.protocol.viewer.ViewerApplication</mainClass>
+ </manifest>
+ </archive>
+ <descriptorRefs>
+ <descriptorRef>jar-with-dependencies</descriptorRef>
+ </descriptorRefs>
+ </configuration>
+ <executions>
+ <execution>
+ <id>make-assembly</id>
+ <phase>package</phase>
+ <goals>
+ <goal>single</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
</plugins>
</build>
* This class was designed to be used as a component added to the row header
* of a JScrollPane.
*/
-public class TextLineNumber extends JPanel
- implements CaretListener, DocumentListener, PropertyChangeListener {
- public final static float LEFT = 0.0f;
- public final static float CENTER = 0.5f;
- public final static float RIGHT = 1.0f;
+public class TextLineNumber extends JPanel implements CaretListener, DocumentListener, PropertyChangeListener {
+ public static final float LEFT = 0.0f;
+ public static final float CENTER = 0.5f;
+ public static final float RIGHT = 1.0f;
- private final static Border OUTER = new MatteBorder(0, 0, 0, 2, Color.GRAY);
+ private static final Border OUTER = new MatteBorder(0, 0, 0, 2, Color.GRAY);
- private final static int HEIGHT = Integer.MAX_VALUE - 1000000;
+ private static final int HEIGHT = Integer.MAX_VALUE - 1000000;
// Text component this TextTextLineNumber component is in sync with
private HashMap<String, FontMetrics> fonts;
/**
- * Create a line number component for a text component. This minimum
+ * Create a line number component for a text component. This minimum
* display width will be based on 3 digits.
*
* @param component the related text component
}
/**
- * Create a line number component for a text component.
+ * Create a line number component for a text component.
*
* @param component the related text component
* @param minimumDisplayDigits the number of digits used to calculate
* <li>TextLineNumber.LEFT
* <li>TextLineNumber.CENTER
* <li>TextLineNumber.RIGHT (default)
- * </ul>
+ * </ul>
* @param currentLineForeground the Color used to render the current line
*/
public void setDigitAlignment(float digitAlignment) {
int caretPosition = component.getCaretPosition();
Element root = component.getDocument().getDefaultRootElement();
- if (root.getElementIndex(rowStartOffset) == root.getElementIndex(caretPosition))
- return true;
- else
- return false;
+ return root.getElementIndex(rowStartOffset) == root.getElementIndex(caretPosition);
}
/*
lastHeight = rect.y;
}
} catch (BadLocationException ex) {
- /* nothing to do */ }
+ /* nothing to do */
+ }
}
});
}
private JEditorPane coverageEditor;
private TextLineNumber textLineNumber;
+ /**
+ * Create the application.
+ */
+ public ViewerApplication() {
+ initialize();
+ }
+
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
+ @Override
public void run() {
try {
ViewerApplication window = new ViewerApplication();
getComponentTree().setModel(new DefaultTreeModel(project));
}
- private DefaultMutableTreeNode createNode(Component component) {
- DefaultMutableTreeNode node = new DefaultMutableTreeNode(component) {
+ private static DefaultMutableTreeNode createNode(Component component) {
+ return new DefaultMutableTreeNode(component) {
@Override
public String toString() {
return getNodeName((Component) getUserObject());
}
};
- return node;
}
- private String getNodeName(Component component) {
+ private static String getNodeName(Component component) {
switch (component.getType()) {
case PROJECT:
case MODULE:
}
}
- /**
- * Create the application.
- */
- public ViewerApplication() {
- initialize();
- }
-
/**
* Initialize the contents of the frame.
*/
treeScrollPane.setViewportView(componentTree);
componentTree.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
componentTree.addTreeSelectionListener(new TreeSelectionListener() {
+ @Override
public void valueChanged(TreeSelectionEvent e) {
DefaultMutableTreeNode node = (DefaultMutableTreeNode) componentTree.getLastSelectedPathComponent();
--- /dev/null
+/*
+ * SonarQube, open source software quality management tool.
+ * Copyright (C) 2008-2014 SonarSource
+ * mailto:contact AT sonarsource DOT com
+ *
+ * SonarQube is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 3 of the License, or (at your option) any later version.
+ *
+ * SonarQube is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ */
+@ParametersAreNonnullByDefault
+package org.sonar.batch.protocol.viewer;
+
+import javax.annotation.ParametersAreNonnullByDefault;
+