Resolves #235
This commit is contained in:
parent
a2c79f2a81
commit
e1d2196977
4 changed files with 13 additions and 12 deletions
|
@ -158,9 +158,7 @@ public class WorkPaneMainComponent extends VisibleComponent
|
||||||
//load class resources
|
//load class resources
|
||||||
public void addClassResource(final FileContainer container, final String name, final ClassNode cn)
|
public void addClassResource(final FileContainer container, final String name, final ClassNode cn)
|
||||||
{
|
{
|
||||||
final String workingName = container.name + ">" + name;
|
addResource(container, name, new ClassViewer(container, name, cn));
|
||||||
|
|
||||||
addResource(container, name, new ClassViewer(container, name, cn, workingName));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//Load file resources
|
//Load file resources
|
||||||
|
@ -168,16 +166,14 @@ public class WorkPaneMainComponent extends VisibleComponent
|
||||||
{
|
{
|
||||||
if (contents == null) //a directory
|
if (contents == null) //a directory
|
||||||
return;
|
return;
|
||||||
|
|
||||||
final String workingName = container.name + ">" + name;
|
|
||||||
|
|
||||||
addResource(container, name, new FileViewer(container, name, contents, workingName));
|
addResource(container, name, new FileViewer(container, name, contents));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addResource(final FileContainer container, final String name, final ResourceViewer resourceView)
|
private void addResource(final FileContainer container, final String name, final ResourceViewer resourceView)
|
||||||
{
|
{
|
||||||
final String workingName = container.name + ">" + name;
|
final String workingName = container.generateWorkName(name);
|
||||||
|
|
||||||
//create a new tab if the resource isn't opened currently
|
//create a new tab if the resource isn't opened currently
|
||||||
if (!openedTabs.contains(workingName))
|
if (!openedTabs.contains(workingName))
|
||||||
{
|
{
|
||||||
|
|
|
@ -69,9 +69,9 @@ public class ClassViewer extends ResourceViewer
|
||||||
public List<MethodParser> methods = Arrays.asList(new MethodParser(), new MethodParser(), new MethodParser());
|
public List<MethodParser> methods = Arrays.asList(new MethodParser(), new MethodParser(), new MethodParser());
|
||||||
public final String workingName;
|
public final String workingName;
|
||||||
|
|
||||||
public ClassViewer(final FileContainer container, final String name, final ClassNode cn, String workingName)
|
public ClassViewer(final FileContainer container, final String name, final ClassNode cn)
|
||||||
{
|
{
|
||||||
this.workingName = workingName;
|
this.workingName = container.generateWorkName(name);
|
||||||
this.container = container;
|
this.container = container;
|
||||||
|
|
||||||
this.name = name;
|
this.name = name;
|
||||||
|
|
|
@ -61,11 +61,11 @@ public class FileViewer extends ResourceViewer
|
||||||
public BufferedImage image;
|
public BufferedImage image;
|
||||||
public boolean canRefresh;
|
public boolean canRefresh;
|
||||||
|
|
||||||
public FileViewer(final FileContainer container, final String name, final byte[] contents, String workingName)
|
public FileViewer(final FileContainer container, final String name, final byte[] contents)
|
||||||
{
|
{
|
||||||
this.name = name;
|
this.name = name;
|
||||||
this.contents = contents;
|
this.contents = contents;
|
||||||
this.workingName = workingName;
|
this.workingName = container.generateWorkName(name);
|
||||||
this.container = container;
|
this.container = container;
|
||||||
this.setName(name);
|
this.setName(name);
|
||||||
this.setLayout(new BorderLayout());
|
this.setLayout(new BorderLayout());
|
||||||
|
|
|
@ -57,4 +57,9 @@ public class FileContainer {
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String generateWorkName(String name)
|
||||||
|
{
|
||||||
|
return file.getAbsolutePath() + ">" + name;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue