Author: scabanovich
Date: 2011-05-26 19:12:50 -0400 (Thu, 26 May 2011)
New Revision: 31534
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportHelper.java
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsLabelProvider.java
Log:
JBIDE-9005
https://issues.jboss.org/browse/JBIDE-9005
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportHelper.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportHelper.java 2011-05-26
23:11:27 UTC (rev 31533)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/action/adf/AddADFSupportHelper.java 2011-05-26
23:12:50 UTC (rev 31534)
@@ -22,6 +22,7 @@
import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
import org.jboss.tools.common.model.*;
import org.jboss.tools.common.model.filesystems.FileSystemsHelper;
+import org.jboss.tools.common.model.filesystems.impl.Libs;
import org.jboss.tools.common.model.plugin.ModelPlugin;
import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
@@ -53,16 +54,19 @@
public boolean isEnabled() {
if(object == null) return false;
XModel model = object.getModel();
- XModelObject fss = FileSystemsHelper.getFileSystems(model);
- if(fss == null) return false;
File adfLibFile = new File(adfLibPath);
- if(!adfLibFile.isDirectory()) return false;
- File[] fs = adfLibFile.listFiles();
- if(fs == null || fs.length == 0) return false;
- for (int i = 0; i < fs.length; i++) {
- String n = fs[i].getName();
- if(!n.endsWith(".jar")) continue; //$NON-NLS-1$
- if(fss.getChildByPath("lib-" + n) == null) return true; //$NON-NLS-1$
+ if(adfLibFile.isDirectory()) {
+ File[] fs = adfLibFile.listFiles();
+ if(fs != null && fs.length > 0) {
+ Libs libs = FileSystemsHelper.getLibs(model);
+ if(libs != null) {
+ for (int i = 0; i < fs.length; i++) {
+ if(libs.getLibrary(fs[i]) != null) {
+ return true;
+ }
+ }
+ }
+ }
}
return false;
}
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsLabelProvider.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsLabelProvider.java 2011-05-26
23:11:27 UTC (rev 31533)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsLabelProvider.java 2011-05-26
23:12:50 UTC (rev 31534)
@@ -10,6 +10,7 @@
******************************************************************************/
package org.jboss.tools.jst.web.ui.navigator;
+import org.jboss.tools.common.model.filesystems.impl.Libs;
import org.jboss.tools.common.model.ui.navigator.NavigatorLabelProvider;
import org.jboss.tools.common.model.ui.navigator.decorator.DecoratorManager;
import org.jboss.tools.common.model.ui.navigator.decorator.XModelObjectDecorator;
@@ -54,7 +55,7 @@
while(p != null && p.getFileType() != XModelObject.SYSTEM) p = p.getParent();
if(p != null && p.getModelEntity().getName().equals("FileSystemJar"))
{
String n = p.getAttributeValue("name");
- if(n != null && n.startsWith("lib-")) n = n.substring(4);
+ if(n != null && n.startsWith(Libs.LIB_PREFIX)) n = n.substring(4);
String addition = (n != null) ? " - " + n : "";
return super.getText(element) + addition;
}