Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjustinchen2006-06-13 23:44:51 +0000
committerjustinchen2006-06-13 23:44:51 +0000
commit5ae94181391975ace90a22a15afe2332badd2b82 (patch)
tree6c1e1b08cabbb9a37027013c6bef9d950012d598
parent5b4b7cb59e4057f2f24e76452480c423b5439198 (diff)
downloadwebtools.jsf-5ae94181391975ace90a22a15afe2332badd2b82.tar.gz
webtools.jsf-5ae94181391975ace90a22a15afe2332badd2b82.tar.xz
webtools.jsf-5ae94181391975ace90a22a15afe2332badd2b82.zip
Bug fix for 146046, log for each missing JSF library referenced in a JSF project.
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/Messages.java4
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigModelAdapter.java7
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigPersistData.java76
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/messages.properties2
4 files changed, 68 insertions, 21 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/Messages.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/Messages.java
index ef1555c52..9d1fac092 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/Messages.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/Messages.java
@@ -21,6 +21,10 @@ import org.eclipse.osgi.util.NLS;
public class Messages extends NLS {
private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.core.internal.messages"; //$NON-NLS-1$
+ public static String JSFLibraryConfigPersistData_SAVED_COMPLIB_NOT_FOUND;
+
+ public static String JSFLibraryConfigPersistData_SAVED_IMPLLIB_NOT_FOUND;
+
public static String JSFLibraryRegistry_ErrorCreatingURL;
public static String JSFLibraryRegistry_NoLoadCreatingNew;
public static String JSFLibraryRegistry_ErrorSaving;
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigModelAdapter.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigModelAdapter.java
index 312c7927a..143ccd711 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigModelAdapter.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigModelAdapter.java
@@ -125,8 +125,9 @@ public class JSFLibraryConfigModelAdapter {
if (colJSFImplLib == null) {
List list = new ArrayList(Collections.EMPTY_LIST);
- if (data.getSavedJSFImplLib() != null) {
- list.add(data.getSavedJSFImplLib());
+ JSFLibraryDecorator savedImplLib = data.getSavedJSFImplLib();
+ if (savedImplLib != null) {
+ list.add(savedImplLib);
}
colJSFImplLib = buildJSFLibraryDecoratorList(jsfLibReg
.getImplJSFLibraries(), list);
@@ -336,7 +337,7 @@ public class JSFLibraryConfigModelAdapter {
*
* @param wsJSFLibs
* @param pjJSFLibs
- * @return
+ * @return List
*/
private List buildJSFLibraryDecoratorList(EList wsJSFLibs, List pjJSFLibs) {
List list = new ArrayList(Collections.EMPTY_LIST);
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigPersistData.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigPersistData.java
index ec865cb25..2b44b4fe1 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigPersistData.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/jsflibraryconfig/JSFLibraryConfigPersistData.java
@@ -18,11 +18,14 @@ import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.QualifiedName;
import org.eclipse.jst.jsf.core.internal.JSFCorePlugin;
+import org.eclipse.jst.jsf.core.internal.Messages;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry;
import org.eclipse.jst.jsf.core.internal.project.facet.JSFUtils;
+import org.eclipse.osgi.util.NLS;
/**
* To save and retore JSF library reference configuration
@@ -43,7 +46,10 @@ public class JSFLibraryConfigPersistData {
protected JSFLibraryConfigPersistData(IProject project) {
this.project = project;
this.jsfLibReg = JSFCorePlugin.getDefault().getJSFLibraryRegistry();
- }
+
+ // Checked when object is instanciated instead of at method call
+ VerifySavedLibAvailability();
+ }
/**
* Return previoulsly selected JSF implementation library.
@@ -53,7 +59,7 @@ public class JSFLibraryConfigPersistData {
protected JSFLibraryDecorator getSavedJSFImplLib() {
try {
if ( selJSFLibImpl == null ) {
- String strImplLibs = ((IResource)project).getPersistentProperty(new QualifiedName("", JSFUtils.PP_JSF_IMPLEMENTATION_LIBRARIES));
+ String strImplLibs = ((IResource)project).getPersistentProperty(new QualifiedName("", JSFUtils.PP_JSF_IMPLEMENTATION_LIBRARIES));
selJSFLibImpl = getJSFImplLibfromPersistentProperties(getTuples(strImplLibs));
}
} catch (CoreException e) {
@@ -78,7 +84,7 @@ public class JSFLibraryConfigPersistData {
try {
if ( selJSFLibComp == null ) {
selJSFLibComp = new ArrayList(Collections.EMPTY_LIST);
- String strCompLibs = ((IResource)project).getPersistentProperty(new QualifiedName("", JSFUtils.PP_JSF_COMPONENT_LIBRARIES));
+ String strCompLibs = ((IResource)project).getPersistentProperty(new QualifiedName("", JSFUtils.PP_JSF_COMPONENT_LIBRARIES));
getJSFCompLibsfromPersistentProperties(getTuples(strCompLibs), selJSFLibComp);
}
} catch (CoreException e) {
@@ -111,33 +117,67 @@ public class JSFLibraryConfigPersistData {
}
}
+
+
+ private void VerifySavedLibAvailability() {
+ try {
+ String strImplLibs = ((IResource)project).getPersistentProperty(new QualifiedName("", JSFUtils.PP_JSF_IMPLEMENTATION_LIBRARIES));
+ String strCompLibs = ((IResource)project).getPersistentProperty(new QualifiedName("", JSFUtils.PP_JSF_COMPONENT_LIBRARIES));
+
+ logMissingLib(getTuples(strImplLibs), true);
+ logMissingLib(getTuples(strCompLibs), false);
+
+ } catch (CoreException e) {
+ JSFCorePlugin.getDefault().getMsgLogger().log(e);
+ }
+ }
+
+ private void logMissingLib(List jsfLibTuples, boolean isVerifyImpl) {
+ if (jsfLibReg != null) {
+ Iterator itTuple = jsfLibTuples.iterator();
+ while(itTuple.hasNext()) {
+ Tuple tuple = (Tuple)itTuple.next();
+ JSFLibrary jsfLib = jsfLibReg.getJSFLibraryByID(tuple.ID);
+ // Info logged when saved JSF lib is removed from registry.
+ // One log entry is created for each missing library.
+ if (jsfLib == null) {
+ String prjName = project.getName();
+ String msg = (isVerifyImpl) ?
+ Messages.JSFLibraryConfigPersistData_SAVED_IMPLLIB_NOT_FOUND :
+ Messages.JSFLibraryConfigPersistData_SAVED_COMPLIB_NOT_FOUND;
+ JSFCorePlugin.log(IStatus.INFO, NLS.bind(msg, prjName));
+ }
+ }
+ }
+ }
+
private JSFLibraryDecorator getJSFImplLibfromPersistentProperties(List jsfLibTuples) {
- Iterator itTuple = jsfLibTuples.iterator();
- while(itTuple.hasNext()) {
- Tuple tuple = (Tuple)itTuple.next();
-
- if ( jsfLibReg != null ) {
+ if (jsfLibReg != null) {
+ Iterator itTuple = jsfLibTuples.iterator();
+
+ while(itTuple.hasNext()) {
+ Tuple tuple = (Tuple)itTuple.next();
JSFLibrary jsfLib = jsfLibReg.getJSFLibraryByID(tuple.ID);
if (jsfLib != null) {
return new JSFLibraryDecorator(jsfLib, tuple.selected, tuple.deploy);
}
- }
- }
+ }
+ }
return null;
}
- private void getJSFCompLibsfromPersistentProperties(List jsfLibTuples, List JSFCompLibs) {
- Iterator itTuple = jsfLibTuples.iterator();
- while(itTuple.hasNext()) {
- Tuple tuple = (Tuple)itTuple.next();
-
- if ( jsfLibReg != null ) {
+ private void getJSFCompLibsfromPersistentProperties(List jsfLibTuples, List JSFCompLibs) {
+ if (jsfLibReg != null) {
+ Iterator itTuple = jsfLibTuples.iterator();
+ while(itTuple.hasNext()) {
+ Tuple tuple = (Tuple)itTuple.next();
+
JSFLibrary jsfLib = jsfLibReg.getJSFLibraryByID(tuple.ID);
if (jsfLib != null) {
JSFLibraryDecorator newJSFLibDcrt = new JSFLibraryDecorator(jsfLib, tuple.selected, tuple.deploy);
JSFCompLibs.add(newJSFLibDcrt);
- }
- }
+ }
+ }
}
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/messages.properties b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/messages.properties
index 4a9da617c..ed3e9ae82 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/messages.properties
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/core/internal/messages.properties
@@ -16,6 +16,8 @@ JSFLibraryRegistry_DEFAULT_IMPL_LABEL=<Default>
JSFLibraryRegistry_ErrorLoadingFromExtPt=Error while loading JSF Libaries from extension points
JSFFacetInstallDataModelProvider_ValidateServletName=Specify a servlet name to use
+JSFLibraryConfigPersistData_SAVED_IMPLLIB_NOT_FOUND=Saved JSF implementation library in {0} is unavilable in JSF Library Registry
+JSFLibraryConfigPersistData_SAVED_COMPLIB_NOT_FOUND=Saved JSF component library in {0} is unavilable in JSF Library Registry
JSFFacetInstallDataModelProvider_ValidateJSFImpl=A default JSF implementation has not been set. Please use 'Add...' to create a library or un-check deploy jars
JSFFacetInstallDataModelProvider_ValidateConfigFilePath=The configuration file path is not valid
JSFFacetInstallDataModelProvider_ValidateConfigFileEmpty=Specify a valid name and location for JSF configuration file

Back to the top