Author: scabanovich
Date: 2012-01-26 16:22:13 -0500 (Thu, 26 Jan 2012)
New Revision: 38227
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/navigator/JsfProjectsNavigator.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/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/navigator/JsfProjectsNavigator.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/navigator/JsfProjectsNavigator.java 2012-01-26
21:18:07 UTC (rev 38226)
+++
trunk/jsf/plugins/org.jboss.tools.jsf.ui/src/org/jboss/tools/jsf/ui/navigator/JsfProjectsNavigator.java 2012-01-26
21:22:13 UTC (rev 38227)
@@ -13,8 +13,8 @@
import org.eclipse.jface.viewers.*;
import org.eclipse.swt.widgets.*;
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 JsfProjectsNavigator extends NavigatorViewPart {
@@ -36,36 +36,12 @@
}
protected void initContentProvider(TreeViewer viewer) {
- if(true) {
- c = new JsfProjectsContentProvider();
- TreeViewerModelListenerImpl listener = new JsfProjectsTreeListener();
- 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[]{"no license"}; //$NON-NLS-1$
- }
- public void inputChanged(Viewer v, Object o1,Object o2) {
-
- }
- public void dispose() {
- }
- }
- );
- }
+ c = new JsfProjectsContentProvider();
+ TreeViewerModelListenerImpl listener = new JsfProjectsTreeListener();
+ listener.setViewer(viewer);
+ c.setListener(listener);
+ contentProvider = c;
+ viewer.setContentProvider(contentProvider);
}
protected String[] getActionClasses() {
@@ -86,9 +62,12 @@
}
class JSFNavigatorMenuInvoker extends NavigatorMenuInvoker {
- private static XModelObject jsfWorkspace =
PreferenceModelUtilities.getPreferenceModel().createModelObject("JSFWorkspace",
null); //$NON-NLS-1$
+ private static XModelObject jsfWorkspace;
protected XModelObject getWorkspaceObject() {
+ if(jsfWorkspace == null) {
+ jsfWorkspace =
XModelFactory.getDefaultInstance().createModelObject("JSFWorkspace", null);
//$NON-NLS-1$
+ }
return jsfWorkspace;
}