Skip to content

Commit

Permalink
Update tooltip on tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanue1 committed May 30, 2019
1 parent cb8de55 commit cb55392
Show file tree
Hide file tree
Showing 26 changed files with 103 additions and 66 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class ClassFileTreeNodeFactoryProvider extends AbstractTypeFileTreeNodeFa
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf('/');
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new FileTreeNode(entry, new TreeNodeBean(name, CLASS_FILE_ICON), FACTORY);
String label = entry.getPath().substring(lastSlashIndex+1);
return (T)new FileTreeNode(entry, new TreeNodeBean(label, CLASS_FILE_ICON), FACTORY);
}

protected static class Factory implements AbstractTypeFileTreeNodeFactoryProvider.PageAndTipFactory {
Expand All @@ -54,10 +54,10 @@ public <T extends JComponent & UriGettable> T makePage(API a, Container.Entry e)

@Override
public String makeTip(API api, Container.Entry entry) {
File file = new File(entry.getContainer().getRoot().getUri());
String location = new File(entry.getUri()).getPath();
StringBuilder tip = new StringBuilder("<html>Location: ");

tip.append(file.getPath());
tip.append(location);
tip.append("<br>Java compiler version: ");

try (InputStream is = entry.getInputStream()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class CssFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(HtmlFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/css_obj.png"));
Expand All @@ -26,8 +27,9 @@ public class CssFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvi
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON));
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;
import java.net.URI;
import java.util.Collection;

Expand All @@ -42,15 +43,16 @@ public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable>
}

String label = entry.getPath().substring(lastSlashIndex+1);
TreeNode node = new TreeNode(entry, new TreeNodeBean(label, getIcon(), getOpenIcon()));
String location = new File(entry.getUri()).getPath();
TreeNode node = new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, getIcon(), getOpenIcon()));

if (entries.size() > 0) {
// Add dummy node
node.add(new DefaultMutableTreeNode());
}

return (T)node;
}
return (T)node;
}

public ImageIcon getIcon() { return ICON; }
public ImageIcon getOpenIcon() { return OPEN_ICON; }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class DtdFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(DtdFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/dtd_obj.gif"));
Expand All @@ -26,8 +27,9 @@ public class DtdFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvi
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON));
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class EarFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(JarFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/ear_obj.gif"));
Expand All @@ -25,8 +26,9 @@ public class EarFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvid
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
T node = (T)new TreeNode(entry, "ear", new TreeNodeBean(name, ICON));
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
T node = (T)new TreeNode(entry, "ear", new TreeNodeBean(label, "Location: " + location, ICON));
// Add dummy node
node.add(new DefaultMutableTreeNode());
return node;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class EjbJarXmlFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(ManifestFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/xml_obj.gif"));
Expand All @@ -26,7 +27,8 @@ public class EjbJarXmlFileTreeNodeFactoryProvider extends FileTreeNodeFactoryPro
@Override
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
return (T)new TreeNode(entry, new TreeNodeBean("ejb-jar.xml", "Location: " + entry.getUri().getPath(), ICON));
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean("ejb-jar.xml", "Location: " + location, ICON));
}

protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;
import java.net.URI;

public class FileTreeNodeFactoryProvider extends AbstractTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(FileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/file_plain_obj.png"));
protected static final ImageIcon ICON = new ImageIcon(FileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/file_plain_obj.png"));

@Override public String[] getSelectors() { return appendSelectors("*:file:*"); }

@Override
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf('/');
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new TreeNode(entry, new TreeNodeBean(name, ICON));
}
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends DefaultMutableTreeNode implements ContainerEntryGettable, UriGettable {
protected Container.Entry entry;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class HtmlFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(HtmlFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/html_obj.gif"));
Expand All @@ -26,8 +27,9 @@ public class HtmlFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProv
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON));
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.awt.*;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.net.URI;
Expand All @@ -30,8 +31,9 @@ public class ImageFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProvide
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON));
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;
import java.util.Collection;

public class JarFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvider {
Expand All @@ -28,13 +29,14 @@ public class JarFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvid
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
ImageIcon icon = isAEjbModule(entry) ? EJB_FILE_ICON : JAR_FILE_ICON;
T node = (T)new TreeNode(entry, "jar", new TreeNodeBean(name, icon));
T node = (T)new TreeNode(entry, "jar", new TreeNodeBean(label, "Location: " + location, icon));
// Add dummy node
node.add(new DefaultMutableTreeNode());
return node;
}
}

protected static boolean isAEjbModule(Container.Entry entry) {
Collection<Container.Entry> children = entry.getChildren();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ public class JavaFileTreeNodeFactoryProvider extends AbstractTypeFileTreeNodeFac
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf('/');
String name = entry.getPath().substring(lastSlashIndex+1);

return (T)new FileTreeNode(entry, new TreeNodeBean(name, JAVA_FILE_ICON), FACTORY);
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new FileTreeNode(entry, new TreeNodeBean(label, "Location: " + location, JAVA_FILE_ICON), FACTORY);
}

protected static class Factory implements AbstractTypeFileTreeNodeFactoryProvider.PageAndTipFactory {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class JavascriptFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(JavascriptFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/js_obj.png"));
Expand All @@ -25,8 +26,9 @@ public class JavascriptFileTreeNodeFactoryProvider extends TextFileTreeNodeFacto
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON));
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@
import org.jd.gui.api.feature.ContainerEntryGettable;
import org.jd.gui.api.feature.UriGettable;
import org.jd.gui.api.model.Container;
import org.jd.gui.spi.TreeNodeFactory;
import org.jd.gui.view.data.TreeNodeBean;

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class JmodFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvider {
@Override public String[] getSelectors() { return appendSelectors("*:file:*.jmod"); }
Expand All @@ -24,19 +23,11 @@ public class JmodFileTreeNodeFactoryProvider extends ZipFileTreeNodeFactoryProvi
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);



T node = (T)new TreeNode(entry, "generic", new TreeNodeBean(name, ICON));



String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
T node = (T)new TreeNode(entry, "generic", new TreeNodeBean(label, "Location: " + location, ICON));
// Add dummy node
node.add(new DefaultMutableTreeNode());



return node;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class JsonFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(JsonFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/ascii_obj.png"));
Expand All @@ -26,8 +27,9 @@ public class JsonFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProv
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON));
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class JspFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(HtmlFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/html_obj.gif"));
Expand All @@ -26,8 +27,9 @@ public class JspFileTreeNodeFactoryProvider extends TextFileTreeNodeFactoryProvi
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON));
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends TextFileTreeNodeFactoryProvider.TreeNode {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;

public class ManifestFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProvider {
protected static final ImageIcon ICON = new ImageIcon(ManifestFileTreeNodeFactoryProvider.class.getClassLoader().getResource("org/jd/gui/images/manifest_obj.png"));
Expand All @@ -26,7 +27,8 @@ public class ManifestFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProv
@Override
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
return (T)new TreeNode(entry, new TreeNodeBean("MANIFEST.MF", "Location: " + entry.getUri().getPath(), ICON));
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean("MANIFEST.MF", "Location: " + location, ICON));
}

protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import javax.swing.*;
import javax.swing.tree.DefaultMutableTreeNode;
import java.io.File;
import java.util.regex.Pattern;

public class MetainfServiceFileTreeNodeFactoryProvider extends FileTreeNodeFactoryProvider {
Expand All @@ -36,8 +37,9 @@ public Pattern getPathPattern() {
@SuppressWarnings("unchecked")
public <T extends DefaultMutableTreeNode & ContainerEntryGettable & UriGettable> T make(API api, Container.Entry entry) {
int lastSlashIndex = entry.getPath().lastIndexOf("/");
String name = entry.getPath().substring(lastSlashIndex+1);
return (T)new TreeNode(entry, new TreeNodeBean(name, "Location: " + entry.getUri().getPath(), ICON));
String label = entry.getPath().substring(lastSlashIndex+1);
String location = new File(entry.getUri()).getPath();
return (T)new TreeNode(entry, new TreeNodeBean(label, "Location: " + location, ICON));
}

protected static class TreeNode extends FileTreeNodeFactoryProvider.TreeNode implements PageCreator {
Expand Down
Loading

0 comments on commit cb55392

Please sign in to comment.