Author: scabanovich
Date: 2012-01-26 16:18:07 -0500 (Thu, 26 Jan 2012)
New Revision: 38226
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsNavigator.java
Log:
JBIDE-6132
https://issues.jboss.org/browse/JBIDE-6132
Do not create instance of preference XModel when it is not necessary . Use
XModelFactory.getDefaultInstance() when XModel instance is required.
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsNavigator.java
===================================================================
---
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsNavigator.java 2012-01-26
21:16:56 UTC (rev 38225)
+++
trunk/jst/plugins/org.jboss.tools.jst.web.ui/src/org/jboss/tools/jst/web/ui/navigator/WebProjectsNavigator.java 2012-01-26
21:18:07 UTC (rev 38226)
@@ -17,8 +17,8 @@
import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.viewers.*;
import org.jboss.tools.common.meta.action.*;
+import org.jboss.tools.common.model.XModelFactory;
import org.jboss.tools.common.model.XModelObject;
-import org.jboss.tools.common.model.options.PreferenceModelUtilities;
import org.jboss.tools.common.model.ui.views.navigator.*;
public class WebProjectsNavigator extends NavigatorViewPart {
@@ -36,36 +36,12 @@
}
protected void initContentProvider(TreeViewer viewer) {
- if(true) {
- c = new WebProjectsContentProvider();
- TreeViewerModelListenerImpl listener = new WebProjectsTreeListener();
- listener.setViewer(viewer);
- c.setListener(listener);
- contentProvider = c;
- viewer.setContentProvider(contentProvider);
- } else {
- viewer.setContentProvider(
- new ITreeContentProvider() {
- public Object[] getChildren(Object parentElement) {
- return new Object[]{};
- }
- public Object getParent(Object element) {
- return null;
- }
- public boolean hasChildren(Object element) {
- return false;
- }
- public Object[] getElements(Object o) {
- return new Object[]{""}; //$NON-NLS-1$
- }
- public void inputChanged(Viewer v, Object o1,Object o2) {
-
- }
- public void dispose() {
- }
- }
- );
- }
+ c = new WebProjectsContentProvider();
+ TreeViewerModelListenerImpl listener = new WebProjectsTreeListener();
+ listener.setViewer(viewer);
+ c.setListener(listener);
+ contentProvider = c;
+ viewer.setContentProvider(contentProvider);
}
static String STRUTS_UI = "org.jboss.tools.struts.ui"; //$NON-NLS-1$
@@ -91,9 +67,12 @@
}
class JSFNavigatorMenuInvoker extends NavigatorMenuInvoker {
- private static XModelObject webWorkspace =
PreferenceModelUtilities.getPreferenceModel().createModelObject("WebWorkspace",
null); //$NON-NLS-1$
-
+ private static XModelObject webWorkspace;
+
protected XModelObject getWorkspaceObject() {
+ if(webWorkspace == null) {
+ webWorkspace =
XModelFactory.getDefaultInstance().createModelObject("WebWorkspace", null);
//$NON-NLS-1$
+ }
return webWorkspace;
}