" + lined); // NOI18N - } - } - } + annotation.append("
" + getCommitMessage(al));
}
} else {
annotation.append(elementAnnotationsSubstitute);
@@ -884,6 +919,33 @@
doc.readUnlock();
}
}
+
+ /**
+ *
+ * @param event
+ */
+ private void showTooltipWindow (MouseEvent event) {
+ Point p = new Point(event.getPoint());
+ SwingUtilities.convertPointToScreen(p, this);
+ Point p2 = new Point(p);
+ SwingUtilities.convertPointFromScreen(p2, textComponent);
+
+ // annotation for target line
+ AnnotateLine al = null;
+ if (elementAnnotations != null) {
+ al = getAnnotateLine(getLineFromMouseEvent(event));
+ }
+
+ /**
+ * al.getCommitMessage() != null - since commit messages are initialized separately from the AL constructor
+ */
+ if (al != null && al.getRevision() != null) {
+ String commitMessage = getCommitMessage(al);
+ TooltipWindow ttw = new TooltipWindow(this, al, commitMessage);
+ ttw.show(new Point(p.x - p2.x, p.y));
+ }
+ }
+
private Color backgroundColor() {
if (textComponent != null) {
@@ -1019,28 +1081,4 @@
public void componentShown(ComponentEvent e) {
}
- private static class CvsAnnotation extends Annotation {
-
- private final String text;
-
- private Line line;
-
- public CvsAnnotation(String tooltip, Line line) {
- text = tooltip;
- this.line = line;
- }
-
- public void attach() {
- attach(line);
- line = null;
- }
-
- public String getShortDescription() {
- return text;
- }
-
- public String getAnnotationType() {
- return "org-netbeans-modules-versioning-system-cvss-Annotation"; // NOI18N
- }
- }
}
diff --git a/git/src/org/netbeans/modules/git/ui/blame/TooltipWindow.java b/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/ui/actions/annotate/TooltipWindow.java
copy from git/src/org/netbeans/modules/git/ui/blame/TooltipWindow.java
copy to versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/ui/actions/annotate/TooltipWindow.java
--- a/git/src/org/netbeans/modules/git/ui/blame/TooltipWindow.java
+++ b/versioning.system.cvss/src/org/netbeans/modules/versioning/system/cvss/ui/actions/annotate/TooltipWindow.java
@@ -41,7 +41,7 @@
* Version 2 license, then the option applies only if the new code is
* made subject to such option by the copyright holder.
*/
-package org.netbeans.modules.git.ui.blame;
+package org.netbeans.modules.versioning.system.cvss.ui.actions.annotate;
import java.awt.AWTEvent;
import java.awt.BorderLayout;
@@ -64,8 +64,6 @@
import java.awt.event.WindowEvent;
import java.awt.event.WindowFocusListener;
import java.text.DateFormat;
-import java.util.Date;
-import java.util.List;
import javax.swing.BorderFactory;
import javax.swing.JComponent;
import javax.swing.JScrollPane;
@@ -78,13 +76,7 @@
import javax.swing.text.Style;
import javax.swing.text.StyleConstants;
import javax.swing.text.StyledDocument;
-import org.netbeans.modules.git.Git;
-import org.netbeans.modules.versioning.util.VCSHyperlinkSupport;
-import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.AuthorLinker;
-import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.IssueLinker;
-import org.netbeans.modules.versioning.util.VCSHyperlinkSupport.StyledDocumentHyperlink;
-import org.netbeans.modules.versioning.util.VCSHyperlinkProvider;
-import org.netbeans.modules.versioning.util.VCSKenaiAccessor.KenaiUser;
+import org.netbeans.lib.cvsclient.command.annotate.AnnotateLine;
/**
* Window displaying the line annotation with links to bugtracking in the commit message.
@@ -100,22 +92,18 @@
private final AnnotationBar master;
private JTextPane textPane;
private final AnnotateLine annotateLine;
- /**
- * Start of the commit message inside the full displayed message
- */
- private int messageOffset;
-
- private VCSHyperlinkSupport linkerSupport = new VCSHyperlinkSupport();
/**
* Currently showing popup
*/
private JWindow contentWindow;
private TooltipContentPanel cp;
+ private final String commitMessage;
- public TooltipWindow(AnnotationBar master, final AnnotateLine al) {
+ public TooltipWindow(AnnotationBar master, final AnnotateLine al, String commitMessage) {
this.annotateLine = al;
this.master = master;
+ this.commitMessage = commitMessage;
}
public void show(Point location) {
@@ -131,7 +119,7 @@
}
// showing the popup tooltip
- cp = new TooltipContentPanel(master.getTextComponent());
+ cp = new TooltipContentPanel(master.getTextComponent(), this.commitMessage);
Window w = SwingUtilities.windowForComponent(master.getTextComponent());
contentWindow = new JWindow(w);
@@ -210,8 +198,7 @@
public void mouseMoved(MouseEvent e) {
if (e.getSource().equals(textPane)) {
textPane.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- linkerSupport.computeBounds(textPane, 0);
- linkerSupport.mouseMoved(e.getPoint(), textPane, messageOffset);
+// NOTE: hyperlinking not supported for CVS?
}
textPane.setToolTipText(""); // NOI18N
}
@@ -219,10 +206,7 @@
@Override
public void mouseClicked(MouseEvent e) {
if (e.getSource().equals(textPane)) {
- linkerSupport.computeBounds(textPane, 0);
- if(linkerSupport.mouseClicked(e.getPoint(), 0)) {
- shutdown(); // close this window
- }
+// NOTE: hyperlinking not supported for CVS?
}
}
@@ -260,7 +244,7 @@
private class TooltipContentPanel extends JComponent {
- public TooltipContentPanel(JTextComponent parentPane) {
+ public TooltipContentPanel(JTextComponent parentPane, String commitMessage) {
try {
textPane = new JTextPane();
StyledDocument doc = (StyledDocument) textPane.getDocument();
@@ -276,55 +260,24 @@
// revision
doc.insertString(
doc.getLength(),
- annotateLine.getRevisionInfo().getRevision().substring(0, 7) + " - ",
+ annotateLine.getRevision() + " - ",
normalStyle);
// author
{
String author = annotateLine.getAuthor().toString();
- StyledDocumentHyperlink l = linkerSupport.getLinker(AuthorLinker.class, 0);
- if (master.isKenai()) {
- KenaiUser kenaiUser = master.getKenaiUser(author);
- if (kenaiUser != null) {
- l = new AuthorLinker(
- kenaiUser,
- authorStyle,
- doc,
- author,
- KenaiUser.getChatLink(
- master.getCurrentFileObject(),
- annotateLine.getLineNum()));
- linkerSupport.add(l, 0);
- }
- }
- if (l != null) {
- l.insertString(doc, authorStyle);
- } else {
- doc.insertString(doc.getLength(), author, normalStyle);
- }
+ //NOTE kenai is not supported for CVS?
+ doc.insertString(doc.getLength(), author, normalStyle);
}
// date
doc.insertString(doc.getLength(), " ", normalStyle);
- doc.insertString(doc.getLength(), DateFormat.getDateInstance().format(new Date(annotateLine.getRevisionInfo().getCommitTime())), normalStyle);
+ doc.insertString(doc.getLength(), DateFormat.getDateInstance().format(annotateLine.getDate()), normalStyle);
doc.insertString(doc.getLength(), "\n", normalStyle);
// commit msg
- {
- StyledDocumentHyperlink l = null;
- String commitMessage = annotateLine.getRevisionInfo().getFullMessage();
- List