Author: dgolovin
Date: 2009-11-09 14:11:17 -0500 (Mon, 09 Nov 2009)
New Revision: 18510
Added:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELCorePlugin.java
Removed:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Activator.java
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELProjectSetExtension.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java
Log:
http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4264652#...
Potential memory leak test was fixed
Modified: trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF
===================================================================
--- trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-11-09
19:11:05 UTC (rev 18509)
+++ trunk/common/plugins/org.jboss.tools.common.el.core/META-INF/MANIFEST.MF 2009-11-09
19:11:17 UTC (rev 18510)
@@ -13,7 +13,7 @@
org.jboss.tools.common.el.core.resolver,
org.jboss.tools.common.el.internal.core.parser,
org.jboss.tools.common.el.internal.core.parser.token
-Bundle-Activator: org.jboss.tools.common.el.core.Activator
+Bundle-Activator: org.jboss.tools.common.el.core.ELCorePlugin
Require-Bundle: org.eclipse.jface.text,
org.eclipse.wst.sse.core,
org.eclipse.wst.sse.ui,
Deleted:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Activator.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Activator.java 2009-11-09
19:11:05 UTC (rev 18509)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Activator.java 2009-11-09
19:11:17 UTC (rev 18510)
@@ -1,65 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at
http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.common.el.core;
-
-import org.jboss.tools.common.log.BaseUIPlugin;
-import org.jboss.tools.common.log.IPluginLog;
-import org.osgi.framework.BundleContext;
-
-/**
- * The activator class controls the plug-in life cycle
- */
-public class Activator extends BaseUIPlugin {
-
- // The plug-in ID
- public static final String PLUGIN_ID = "org.jboss.tools.common.el";
//$NON-NLS-1$
-
- // The shared instance
- private static Activator plugin;
-
- /**
- * The constructor
- */
- public Activator() {
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
- */
- public void start(BundleContext context) throws Exception {
- super.start(context);
- plugin = this;
- }
-
- /*
- * (non-Javadoc)
- * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
- */
- public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
- }
-
- /**
- * Returns the shared instance
- *
- * @return the shared instance
- */
- public static Activator getDefault() {
- return plugin;
- }
-
- public static IPluginLog getPluginLog() {
- return getDefault();
- }
-
-}
Copied:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELCorePlugin.java
(from rev 18503,
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/Activator.java)
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELCorePlugin.java
(rev 0)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELCorePlugin.java 2009-11-09
19:11:17 UTC (rev 18510)
@@ -0,0 +1,65 @@
+/*******************************************************************************
+ * Copyright (c) 2008 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at
http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.common.el.core;
+
+import org.jboss.tools.common.log.BaseUIPlugin;
+import org.jboss.tools.common.log.IPluginLog;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class ELCorePlugin extends BaseUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.jboss.tools.common.el";
//$NON-NLS-1$
+
+ // The shared instance
+ private static ELCorePlugin plugin;
+
+ /**
+ * The constructor
+ */
+ public ELCorePlugin() {
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * Returns the shared instance
+ *
+ * @return the shared instance
+ */
+ public static ELCorePlugin getDefault() {
+ return plugin;
+ }
+
+ public static IPluginLog getPluginLog() {
+ return getDefault();
+ }
+
+}
Property changes on:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/ELCorePlugin.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELProjectSetExtension.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELProjectSetExtension.java 2009-11-09
19:11:05 UTC (rev 18509)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/ELProjectSetExtension.java 2009-11-09
19:11:17 UTC (rev 18510)
@@ -7,7 +7,7 @@
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.common.el.core.Activator;
+import org.jboss.tools.common.el.core.ELCorePlugin;
public class ELProjectSetExtension {
public static String EXTENSION_POINT =
"org.jboss.tools.common.el.core.elProjectSet"; //$NON-NLS-1$
@@ -38,7 +38,7 @@
try{
n.searcher = (ProjectsSet)e.createExecutableExtension("projectset-class");
//$NON-NLS-1$
}catch(CoreException ex){
- Activator.getDefault().logError(ex);
+ ELCorePlugin.getDefault().logError(ex);
}
list.add(n);
}
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java 2009-11-09
19:11:05 UTC (rev 18509)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/refactoring/RefactorSearcher.java 2009-11-09
19:11:17 UTC (rev 18510)
@@ -11,6 +11,7 @@
package org.jboss.tools.common.el.core.refactoring;
import java.io.IOException;
+import java.io.InputStream;
import java.util.List;
import java.util.StringTokenizer;
@@ -41,7 +42,7 @@
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
import org.eclipse.wst.xml.core.internal.regions.DOMRegionContext;
-import org.jboss.tools.common.el.core.Activator;
+import org.jboss.tools.common.el.core.ELCorePlugin;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInstance;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
@@ -147,7 +148,7 @@
scanForJava((IFile) resource);
}
}catch(CoreException ex){
- Activator.getDefault().logError(ex);
+ ELCorePlugin.getDefault().logError(ex);
}
}
@@ -160,46 +161,48 @@
scan((IFile) resource);
}
}catch(CoreException ex){
- Activator.getDefault().logError(ex);
+ ELCorePlugin.getDefault().logError(ex);
}
}
private void scanForJava(IFile file){
- String ext = file.getFileExtension();
-
- if(!isFileCorrect(file))
- return;
-
- String content = null;
- try {
- content = FileUtil.readStream(file.getContents());
- } catch (CoreException e) {
- Activator.getDefault().logError(e);
- return;
+ if(isFileCorrect(file)) {
+ String content = null;
+ try {
+ content = FileUtil.readStream(file);
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ }
+ if(content!= null) {
+ String ext = file.getFileExtension();
+ if(JAVA_EXT.equalsIgnoreCase(ext)){
+ scanJava(file, content);
+ } else if(XML_EXT.equalsIgnoreCase(ext)) {
+ scanDOM(file, content);
+ } else if(PROPERTIES_EXT.equalsIgnoreCase(ext)) {
+ scanProperties(file, content);
+ }
+ }
}
- if(JAVA_EXT.equalsIgnoreCase(ext)){
- scanJava(file, content);
- }else if(XML_EXT.equalsIgnoreCase(ext))
- scanDOM(file, content);
- else if(PROPERTIES_EXT.equalsIgnoreCase(ext))
- scanProperties(file, content);
}
private void scan(IFile file){
- String ext = file.getFileExtension();
-
- if(!isFileCorrect(file))
- return;
-
- String content = null;
- try {
- content = FileUtil.readStream(file.getContents());
- } catch (CoreException e) {
- Activator.getDefault().logError(e);
- return;
+ if(isFileCorrect(file)) {
+ String content = null;
+ try {
+ content = FileUtil.readStream(file);
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError("Error occured during reading content of {0}
file", e); //$NON-NLS-1$
+ }
+ if(content!=null) {
+ String ext = file.getFileExtension();
+ if(XML_EXT.equalsIgnoreCase(ext)
+ || XHTML_EXT.equalsIgnoreCase(ext)
+ || JSP_EXT.equalsIgnoreCase(ext)) {
+ scanDOM(file, content);
+ }
+ }
}
- if(XML_EXT.equalsIgnoreCase(ext) || XHTML_EXT.equalsIgnoreCase(ext) ||
JSP_EXT.equalsIgnoreCase(ext))
- scanDOM(file, content);
}
private void scanJava(IFile file, String content){
@@ -220,31 +223,30 @@
token = scaner.nextToken();
}
} catch (BadLocationException e) {
- Activator.getDefault().logError(e);
+ ELCorePlugin.getDefault().logError(e);
}
}
private void scanDOM(IFile file, String content){
IModelManager manager = StructuredModelManager.getModelManager();
- if(manager == null) {
- return;
- }
- IStructuredModel model = null;
- try {
- model = manager.getModelForRead(file);
- if (model instanceof IDOMModel) {
- IDOMModel domModel = (IDOMModel) model;
- IDOMDocument document = domModel.getDocument();
- scanChildNodes(file, document);
+ if(manager != null) {
+ IStructuredModel model = null;
+ try {
+ model = manager.getModelForRead(file);
+ if (model instanceof IDOMModel) {
+ IDOMModel domModel = (IDOMModel) model;
+ IDOMDocument document = domModel.getDocument();
+ scanChildNodes(file, document);
+ }
+ } catch (CoreException e) {
+ ELCorePlugin.getDefault().logError(e);
+ } catch (IOException e) {
+ ELCorePlugin.getDefault().logError(e);
+ } finally {
+ if (model != null) {
+ model.releaseFromRead();
+ }
}
- } catch (CoreException e) {
- Activator.getDefault().logError(e);
- } catch (IOException e) {
- Activator.getDefault().logError(e);
- } finally {
- if (model != null) {
- model.releaseFromRead();
- }
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java 2009-11-09
19:11:05 UTC (rev 18509)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ELResolverFactoryManager.java 2009-11-09
19:11:17 UTC (rev 18510)
@@ -22,7 +22,7 @@
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.InvalidRegistryObjectException;
import org.eclipse.core.runtime.Platform;
-import org.jboss.tools.common.el.core.Activator;
+import org.jboss.tools.common.el.core.ELCorePlugin;
/**
* This factory is used to get EL Resources for particular resource
@@ -77,13 +77,13 @@
if(resolver instanceof ELResolver) {
resolverSet.add((ELResolver)resolver);
} else {
- Activator.getPluginLog().logError(resolver.getClass().getName() + " must be
instance of org.jboss.tools.common.el.core.resolver.ELResolver"); //$NON-NLS-1$
+ ELCorePlugin.getPluginLog().logError(resolver.getClass().getName() + " must
be instance of org.jboss.tools.common.el.core.resolver.ELResolver"); //$NON-NLS-1$
}
}
} catch (InvalidRegistryObjectException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
} catch (CoreException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
IConfigurationElement[] factories = elements[j].getChildren("factory");
//$NON-NLS-1$
@@ -96,10 +96,10 @@
resolverSet.add(resolver);
}
} else {
- Activator.getPluginLog().logError(factory.getClass().getName() + " must be
instance of org.jboss.tools.common.el.core.resolver.ELResolverFactory");
//$NON-NLS-1$
+ ELCorePlugin.getPluginLog().logError(factory.getClass().getName() + " must be
instance of org.jboss.tools.common.el.core.resolver.ELResolverFactory");
//$NON-NLS-1$
}
} catch (CoreException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
}
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2009-11-09
19:11:05 UTC (rev 18509)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/ElVarSearcher.java 2009-11-09
19:11:17 UTC (rev 18510)
@@ -25,7 +25,7 @@
import org.eclipse.wst.sse.core.internal.provisional.IndexedRegion;
import org.eclipse.wst.sse.ui.internal.contentassist.ContentAssistUtils;
import org.eclipse.wst.xml.core.internal.provisional.document.IDOMAttr;
-import org.jboss.tools.common.el.core.Activator;
+import org.jboss.tools.common.el.core.ELCorePlugin;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.parser.ELParserFactory;
import org.w3c.dom.Element;
@@ -122,10 +122,10 @@
try {
model = mm.getModelForRead(file);
} catch (IOException e) {
- Activator.getDefault().logError(e);
+ ELCorePlugin.getDefault().logError(e);
return null;
} catch (CoreException e) {
- Activator.getDefault().logError(e);
+ ELCorePlugin.getDefault().logError(e);
return null;
}
}
@@ -303,9 +303,9 @@
engine.resolveELOperand(file, var.getElToken(), true, parentVars, this);
resolvedToken = parentVar.getResolvedElToken();
} catch (StringIndexOutOfBoundsException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
} catch (BadLocationException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
if(resolvedToken!=null) {
Modified:
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java
===================================================================
---
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java 2009-11-09
19:11:05 UTC (rev 18509)
+++
trunk/common/plugins/org.jboss.tools.common.el.core/src/org/jboss/tools/common/el/core/resolver/TypeInfoCollector.java 2009-11-09
19:11:17 UTC (rev 18510)
@@ -33,7 +33,7 @@
import org.eclipse.jdt.core.ITypeParameter;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.core.Signature;
-import org.jboss.tools.common.el.core.Activator;
+import org.jboss.tools.common.el.core.ELCorePlugin;
import org.jboss.tools.common.model.util.EclipseJavaUtil;
/**
@@ -312,7 +312,7 @@
fMemberType =
getSourceType().getJavaProject().findType(getType().getQualifiedName());
}
} catch (JavaModelException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
return fMemberType;
@@ -391,7 +391,7 @@
superType.initializeParameters(this);
}
} catch (JavaModelException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
@@ -504,7 +504,7 @@
IType declType =
getSourceType().getJavaProject().findType(getDeclaringTypeQualifiedName());
fJavaElement = (declType == null ? null : declType.getField(getName()));
} catch (JavaModelException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
return fJavaElement;
@@ -678,7 +678,7 @@
}
}
} catch (JavaModelException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
return fJavaElement;
@@ -759,7 +759,7 @@
addInfoForDataModelVariable();
}
} catch (JavaModelException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
@@ -962,7 +962,7 @@
methods.add(info);
}
} catch (JavaModelException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
return methods;
@@ -1081,7 +1081,7 @@
properties.add(info);
}
} catch (JavaModelException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
}
@@ -1212,7 +1212,7 @@
result = new MethodInfo(method, declaringType, declaringType, dataModel);
}
} catch (JavaModelException e) {
- Activator.getPluginLog().logError(e);
+ ELCorePlugin.getPluginLog().logError(e);
}
if(result != null && cache!=null) {
cache.put(member, result);