From 32529c31fa811089adff1a45784b168e66c0b658 Mon Sep 17 00:00:00 2001 From: Viacheslav Kabanovich Date: Mon, 15 Sep 2014 17:32:32 -0700 Subject: [PATCH] JBIDE-18209 Autoapply new default JS/CSS library preferences Case of the first autoapply to workspace created with 4.2.0 beta is covered in the same way as case of file .js-css.xml removed from .metadata. --- .../jst/web/ui/internal/preferences/js/JSLibFactory.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/js/JSLibFactory.java b/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/js/JSLibFactory.java index 37b11d74e..dfdad83f4 100644 --- a/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/js/JSLibFactory.java +++ b/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/internal/preferences/js/JSLibFactory.java @@ -173,7 +173,11 @@ private JSLibModel getPreviousDefaultModel() { String newText = JSLibXMLLoader.saveToString(getDefaultModel()); if(!f.exists()) { FileUtil.writeFile(f, newText); - return null; + //Previous default model is unknown. The best way is to presume + //that each artifact of the current default model is new + //(so that it will be added), and each artifact in current + //preferences is customized (so that it will be preserved). + return new JSLibModel(); } JSLibModel oldDefaultModel = JSLibXMLLoader.load(FileUtil.readFile(f)); if(newDefaultModel.equals(oldDefaultModel)) {