Skip to content

Commit

Permalink
Fix for handling legacy asset types that have been deleted by the user.
Browse files Browse the repository at this point in the history
  • Loading branch information
garybentley committed Oct 18, 2017
1 parent 2cb5fec commit 0df7c04
Show file tree
Hide file tree
Showing 7 changed files with 1,163 additions and 1,071 deletions.
2 changes: 1 addition & 1 deletion build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<project default="run" basedir=".">

<property name="projectName" value="QuollWriter" />
<property name="currVersion" value="2.6.2" />
<property name="currVersion" value="2.6.4" />
<property name="thesaurusVersion" value="1.0" />
<property name="buildDir" value="./build" />
<property name="imgsDir" value="./imgs" />
Expand Down
9 changes: 8 additions & 1 deletion data/whats-new.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,12 @@
<whatsnew>

<version id="2.6.4">
<item onlyIfCurrentVersion="true">
<title>Missing asset type bug fix</title>
<description><![CDATA[Fixed a bug that prevented the {project} from opening when one of the asset object types has been deleted.]]></description>
</item>
</version>

<version id="2.6.2">
<item onlyIfCurrentVersion="true">
<title>More bug squashing</title>
Expand Down Expand Up @@ -78,7 +85,7 @@
<item>
<title>New double word rule</title>
<description><![CDATA[A new Problem Finder rule to find double word or double punctuation has been added.]]></description>
</item>
</item>
</version>

<version id="2.5.3">
Expand Down
59 changes: 33 additions & 26 deletions src/com/quollwriter/Environment.java
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ public class Environment
private static PropertyChangedListener userConfigurableObjectTypeNameListener = null;

private static Set<Tag> tags = null;

static
{

Expand Down Expand Up @@ -6724,6 +6724,13 @@ public static UserConfigurableObjectType getUserConfigurableObjectType (long key

}

public static boolean hasUserConfigurableObjectType (String userObjType)
{

return Environment.getUserConfigurableObjectType (userObjType) != null;

}

public static UserConfigurableObjectType getUserConfigurableObjectType (String userObjType)
{

Expand Down Expand Up @@ -6897,14 +6904,14 @@ public static void saveTag (Tag tag)
}

Environment.projectInfoManager.saveObject (tag);

if (ev.equals (ProjectEvent.NEW))
{

Environment.tags.add (tag);

}

// Tell all projects about it.
Environment.fireUserProjectEvent (tag,
ProjectEvent.TAG,
Expand All @@ -6925,9 +6932,9 @@ public static void deleteTag (Tag tag)

Environment.projectInfoManager.deleteObject (tag,
true);

Environment.tags.remove (tag);

// Tell all projects about it.
Environment.fireUserProjectEvent (tag,
ProjectEvent.TAG,
Expand All @@ -6948,19 +6955,19 @@ public static Tag getTagByKey (long key)
{

Set<Tag> tags = Environment.getAllTags ();

for (Tag t : tags)
{

if (t.getKey () == key)
{

return t;

}

}

return null;

}
Expand All @@ -6974,25 +6981,25 @@ public static Tag getTagByKey (long key)
public static Tag getTagByName (String name)
throws GeneralException
{

Set<Tag> tags = Environment.getAllTags ();

for (Tag t : tags)
{

if (t.getName ().equalsIgnoreCase (name))
{

return t;

}

}

return null;

}

/**
* Get all the tags.
*
Expand All @@ -7005,16 +7012,16 @@ public static Set<Tag> getAllTags ()

if (Environment.tags == null)
{

Environment.tags = new LinkedHashSet (Environment.projectInfoManager.getObjects (Tag.class,
null,
null,
true));

}

return Environment.tags;

}

}
Loading

0 comments on commit 0df7c04

Please sign in to comment.