Author: scabanovich
Date: 2009-06-11 12:27:01 -0400 (Thu, 11 Jun 2009)
New Revision: 15880
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/handler/CreateBeanRedirectHandler.java
Modified:
trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
trunk/jsf/plugins/org.jboss.tools.jsf/resources/meta/jsfprojects.meta
Log:
https://jira.jboss.org/jira/browse/JBIDE-4464
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2009-06-11 13:13:02 UTC (rev 15879)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/plugin.xml 2009-06-11 16:27:01 UTC (rev 15880)
@@ -321,6 +321,8 @@
class="org.jboss.tools.jsf.model.pv.JSFPromptingProvider"/>
<xclass
id="org.jboss.tools.jsf.model.pv.handler.JSFProjectsConfigurationRedirectHandler"
class="org.jboss.tools.jsf.model.pv.handler.JSFProjectsConfigurationRedirectHandler"/>
+ <xclass
id="org.jboss.tools.jsf.model.pv.handler.CreateBeanRedirectHandler"
+ class="org.jboss.tools.jsf.model.pv.handler.CreateBeanRedirectHandler"/>
<xclass
id="org.jboss.tools.jsf.model.pv.handler.JSFProjectsRootRedirectHandler"
class="org.jboss.tools.jsf.model.pv.handler.JSFProjectsRootRedirectHandler"/>
<xclass id="org.jboss.tools.jsf.project.capabilities.JSFCapabilities"
Modified: trunk/jsf/plugins/org.jboss.tools.jsf/resources/meta/jsfprojects.meta
===================================================================
--- trunk/jsf/plugins/org.jboss.tools.jsf/resources/meta/jsfprojects.meta 2009-06-11
13:13:02 UTC (rev 15879)
+++ trunk/jsf/plugins/org.jboss.tools.jsf/resources/meta/jsfprojects.meta 2009-06-11
16:27:01 UTC (rev 15880)
@@ -143,6 +143,14 @@
</XModelAttribute>
</XModelAttributes>
<XActionItem kind="list">
+ <XActionItem ICON="action.empty" displayName="New"
group="1"
+ kind="list" name="CreateActions">
+ <XActionItem
+
HandlerClassName="org.jboss.tools.jsf.model.pv.handler.CreateBeanRedirectHandler"
+ ICON="main.jsf.bean"
+ PROPERTIES="actionpath=CreateActions/AddManagedBean"
+ displayName="Managed Bean..." kind="action"
name="CreateBean"/>
+ </XActionItem>
<XActionItem ICON="action.empty" kind="list"
name="Properties">
<XActionItem HIDE="always" displayName="Help"
kind="action" name="Help"/>
</XActionItem>
Added:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/handler/CreateBeanRedirectHandler.java
===================================================================
---
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/handler/CreateBeanRedirectHandler.java
(rev 0)
+++
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/handler/CreateBeanRedirectHandler.java 2009-06-11
16:27:01 UTC (rev 15880)
@@ -0,0 +1,44 @@
+/*******************************************************************************
+ * Copyright (c) 2007 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
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.jsf.model.pv.handler;
+
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultRedirectHandler;
+import org.jboss.tools.common.model.XModel;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.jsf.model.JSFConstants;
+import org.jboss.tools.jsf.model.pv.JSFProjectsTree;
+import org.jboss.tools.jst.web.model.pv.WebProjectNode;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class CreateBeanRedirectHandler extends DefaultRedirectHandler {
+
+ protected XModelObject getTrueSource(XModelObject source) {
+ if(source == null) return null;
+ XModel model = source.getModel();
+ WebProjectNode r = JSFProjectsTree.getProjectsRoot(model);
+ if(r == null) return null;
+ WebProjectNode n = (WebProjectNode)r.getChildByPath("Configuration");
+ if(n == null) return null;
+ XModelObject[] fs = n.getTreeChildren();
+ for (XModelObject f: fs) {
+ String entity = f.getModelEntity().getName();
+ if(!entity.startsWith(JSFConstants.ENT_FACESCONFIG)) continue;
+ if(!f.isObjectEditable()) continue;
+ return f.getChildByPath("Managed Beans");
+ }
+ return null;
+ }
+
+}
Property changes on:
trunk/jsf/plugins/org.jboss.tools.jsf/src/org/jboss/tools/jsf/model/pv/handler/CreateBeanRedirectHandler.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain