Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcrogers2010-11-18 02:19:58 -0500
committercrogers2010-11-18 02:19:58 -0500
commite78fc12f0b18c8397340a19ceca41b8cc4f194a6 (patch)
treeb0479860e75ecb78e68f2d97a4069320554fa129
parent03d2fd5174d3161c47364888165be0c86af11cfe (diff)
downloadwebtools.jsf-e78fc12f0b18c8397340a19ceca41b8cc4f194a6.tar.gz
webtools.jsf-e78fc12f0b18c8397340a19ceca41b8cc4f194a6.tar.xz
webtools.jsf-e78fc12f0b18c8397340a19ceca41b8cc4f194a6.zip
[bug 330302] Reduce the number of calls to ModelManagerImpl
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/WorkspaceContextResolver.java15
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DTAppManagerUtil.java21
-rw-r--r--jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/resolver/ViewBasedTaglibResolverFactory.java27
3 files changed, 36 insertions, 27 deletions
diff --git a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/WorkspaceContextResolver.java b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/WorkspaceContextResolver.java
index cb6363065..053ec16da 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/WorkspaceContextResolver.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.common/src/org/eclipse/jst/jsf/context/resolver/structureddocument/internal/impl/WorkspaceContextResolver.java
@@ -50,7 +50,12 @@ import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
{
return null;
}
-
+
+ return getProject(path);
+ }
+
+ private IProject getProject(String path)
+ {
// TOODO needs rework for linked resources
IWorkspaceRoot root = ResourcesPlugin.getWorkspace().getRoot();
IPath iPath = new Path(path);
@@ -77,13 +82,13 @@ import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
public IResource getResource()
{
- IProject project = getProject();
+ final String path = getPath();
- if (project != null)
+ if (path != null)
{
- final String path = getPath();
+ IProject project = getProject(path);
- if (path != null)
+ if (project != null)
{
final IPath iPath = new Path(path);
if (iPath.isAbsolute())
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DTAppManagerUtil.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DTAppManagerUtil.java
index 53ead62af..e26e98a25 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DTAppManagerUtil.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/DTAppManagerUtil.java
@@ -45,12 +45,15 @@ public class DTAppManagerUtil
IStructuredDocumentContextResolverFactory.INSTANCE
.getWorkspaceContextResolver(context);
- final IProject project = wkResolver.getProject();
final IResource res = wkResolver.getResource();
- if (project != null && res instanceof IFile)
+ if (res instanceof IFile)
{
- return getXMLViewDefnAdapter(project, (IFile) res);
+ final IProject project = res.getProject();
+ if (project != null)
+ {
+ return getXMLViewDefnAdapter(project, (IFile) res);
+ }
}
// not found
return null;
@@ -142,17 +145,15 @@ public class DTAppManagerUtil
{
return null;
}
- IProject project = null;
- project = resolver.getProject();
- if (project == null)
- {
- return null;
- }
final IResource resource = resolver.getResource();
if (resource != null)
{
- return getViewRootHandle(resource);
+ IProject project = resource.getProject();
+ if (project != null)
+ {
+ return getViewRootHandle(resource);
+ }
}
return null;
}
diff --git a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/resolver/ViewBasedTaglibResolverFactory.java b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/resolver/ViewBasedTaglibResolverFactory.java
index 472f762e0..bf75439d4 100644
--- a/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/resolver/ViewBasedTaglibResolverFactory.java
+++ b/jsf/plugins/org.eclipse.jst.jsf.core/src/org/eclipse/jst/jsf/designtime/internal/resolver/ViewBasedTaglibResolverFactory.java
@@ -63,24 +63,27 @@ IStructuredDocumentContextResolverFactory2, IAdaptable
.getWorkspaceContextResolver(context);
if (resolver != null)
{
- final IProject project = resolver.getProject();
final IResource res = resolver.getResource();
- if (project != null && res instanceof IFile)
+ if (res instanceof IFile)
{
final IFile file = (IFile) res;
+ final IProject project = file.getProject();
- try
+ if (project != null)
{
- return new ViewBasedTaglibResolver(context, file,
- project);
- }
- catch (final IllegalArgumentException e)
- {
- // the constructor will throw this if the view
- // definition
- // adapter for file is not of the base type it needs
- // just fall through, no need to log
+ try
+ {
+ return new ViewBasedTaglibResolver(context, file,
+ project);
+ }
+ catch (final IllegalArgumentException e)
+ {
+ // the constructor will throw this if the view
+ // definition
+ // adapter for file is not of the base type it needs
+ // just fall through, no need to log
+ }
}
}
}

Back to the top