Author: scabanovich
Date: 2010-09-01 07:34:03 -0400 (Wed, 01 Sep 2010)
New Revision: 24595
Added:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddScheduleProviderSupport.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml
trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties
trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
Log:
https://jira.jboss.org/browse/JBIDE-6085
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml 2010-09-01 11:33:11 UTC (rev
24594)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/plugin.xml 2010-09-01 11:34:03 UTC (rev
24595)
@@ -47,6 +47,8 @@
<xclass id="org.jboss.tools.esb.core.model.handlers.AddProviderSupport"
class="org.jboss.tools.esb.core.model.handlers.AddProviderSupport"/>
+ <xclass
id="org.jboss.tools.esb.core.model.handlers.AddScheduleProviderSupport"
+ class="org.jboss.tools.esb.core.model.handlers.AddScheduleProviderSupport"/>
<xclass
id="org.jboss.tools.esb.core.model.handlers.AddGenericActionSupport"
class="org.jboss.tools.esb.core.model.handlers.AddGenericActionSupport"/>
<xclass
id="org.jboss.tools.esb.core.model.handlers.AddContentBasedRouterSupport"
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties 2010-09-01
11:33:11 UTC (rev 24594)
+++
trunk/esb/plugins/org.jboss.tools.esb.core/resources/help/keys-esb.properties 2010-09-01
11:34:03 UTC (rev 24595)
@@ -35,6 +35,8 @@
ESBProviders101_AddScheduleProvider.Title=ESB Schedule Provider
ESBProviders101_AddScheduleProvider_0.WindowTitle=Add Schedule Provider
ESBProviders101_AddScheduleProvider_0.Title=ESB Schedule Provider
+ESBProviders101_AddScheduleProvider_1.WindowTitle=Add Schedule Provider
+ESBProviders101_AddScheduleProvider_1.Title=ESB Schedule
ESBProviders101_AddJMSProvider_0.WindowTitle=Add JMS Provider
ESBProviders101_AddJMSProvider_0.Title=ESB JMS Provider
@@ -82,6 +84,8 @@
ESBProviders110_AddScheduleProvider.Title=ESB Schedule Provider
ESBProviders110_AddScheduleProvider_0.WindowTitle=Add Schedule Provider
ESBProviders110_AddScheduleProvider_0.Title=ESB Schedule Provider
+ESBProviders110_AddScheduleProvider_1.WindowTitle=Add Schedule Provider
+ESBProviders110_AddScheduleProvider_1.Title=ESB Schedule
ESBProviders110_AddJMSProvider_0.WindowTitle=Add JMS Provider
ESBProviders110_AddJMSProvider_0.Title=ESB JMS Provider
@@ -134,6 +138,8 @@
ESBProviders120_AddScheduleProvider.Title=ESB Schedule Provider
ESBProviders120_AddScheduleProvider_0.WindowTitle=Add Schedule Provider
ESBProviders120_AddScheduleProvider_0.Title=ESB Schedule Provider
+ESBProviders120_AddScheduleProvider_1.WindowTitle=Add Schedule Provider
+ESBProviders120_AddScheduleProvider_1.Title=ESB Schedule
ESBProviders120_AddJMSProvider_0.WindowTitle=Add JMS Provider
ESBProviders120_AddJMSProvider_0.Title=ESB JMS Provider
@@ -191,6 +197,8 @@
ESBProviders130_AddScheduleProvider.Title=ESB Schedule Provider
ESBProviders130_AddScheduleProvider_0.WindowTitle=Add Schedule Provider
ESBProviders130_AddScheduleProvider_0.Title=ESB Schedule Provider
+ESBProviders130_AddScheduleProvider_1.WindowTitle=Add Schedule Provider
+ESBProviders130_AddScheduleProvider_1.Title=ESB Schedule
ESBProviders130_AddJMSProvider_0.WindowTitle=Add JMS Provider
ESBProviders130_AddJMSProvider_0.Title=ESB JMS Provider
Modified: trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2010-09-01 11:33:11
UTC (rev 24594)
+++ trunk/esb/plugins/org.jboss.tools.esb.core/resources/meta/esb.meta 2010-09-01 11:34:03
UTC (rev 24595)
@@ -1996,12 +1996,16 @@
<AttributeData AttributeName="id"/>
</EntityData>
</XActionItem>
- <XActionItem HandlerClassName="%Create%" ICON="action.empty"
- PROPERTIES="validator.add=true" WizardClassName="%Default%"
+ <XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
+
PROPERTIES="validator.add=true;support=org.jboss.tools.esb.core.model.handlers.AddScheduleProviderSupport"
displayName="Schedule Provider..." kind="action"
name="AddScheduleProvider">
<EntityData EntityName="ESBScheduleProvider101">
<AttributeData AttributeName="name"/>
</EntityData>
+ <EntityData EntityName="ESBScheduleCreator"
Mandatory="no">
+ <AttributeData AttributeName="schedule kind"
Mandatory="no"/>
+ <AttributeData AttributeName="schedule id"/>
+ </EntityData>
</XActionItem>
<XActionItem HandlerClassName="%SpecialWizard%"
ICON="action.empty"
PROPERTIES="validator.add=true;support=org.jboss.tools.esb.core.model.handlers.AddProviderSupport;busEntity=ESBSQLBus101"
@@ -2270,6 +2274,35 @@
</XActionItem>
<XDependencies/>
</XModelEntity>
+ <XModelEntity name="ESBScheduleCreator">
+ <XChildrenEntities/>
+ <XEntityRenderer>
+ <ICONS>
+ <ICON info="main.esb.schedule" type="main"/>
+ </ICONS>
+ </XEntityRenderer>
+ <XModelAttributes>
+ <XModelAttribute default="schedule" loader="ElementType"
name="element type">
+ <Editor name="Uneditable"/>
+ </XModelAttribute>
+ <XModelAttributeReference
+ attributes="schedule id,start date,end date"
+ entity="ESBSimpleSchedule101" name="schedule"/>
+ <XModelAttribute PROPERTIES="label=false;horizontal=true"
+ default="Simple" name="schedule kind">
+ <Constraint loader="List">
+ <value name="Simple"/>
+ <value name="Cron"/>
+ </Constraint>
+ <Editor name="RadioArray"/>
+ </XModelAttribute>
+ <XModelAttribute TRIM="no" name="comment"
visibility="false" xmlname="#comment">
+ <Editor name="Note"/>
+ </XModelAttribute>
+ </XModelAttributes>
+ <XActionItem kind="list"/>
+ <XDependencies/>
+ </XModelEntity>
<XModelEntity ImplementingClass="%ESB%"
PROPERTIES="formFactory=%Default%;formLayout=org.jboss.tools.esb.ui.editor.form.ESBXMLFormLayoutData;children=%ESBOrdered%"
XMLSUBPATH="schedule-provider" name="ESBScheduleProvider101">
Added:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddScheduleProviderSupport.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddScheduleProviderSupport.java
(rev 0)
+++
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddScheduleProviderSupport.java 2010-09-01
11:34:03 UTC (rev 24595)
@@ -0,0 +1,102 @@
+/*******************************************************************************
+ * 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
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.esb.core.model.handlers;
+
+import java.util.Properties;
+
+import org.jboss.tools.common.meta.XChild;
+import org.jboss.tools.common.meta.action.impl.SpecialWizardSupport;
+import org.jboss.tools.common.meta.action.impl.handlers.DefaultCreateHandler;
+import org.jboss.tools.common.model.XModelException;
+import org.jboss.tools.common.model.XModelObject;
+import org.jboss.tools.common.model.util.FindObjectHelper;
+import org.jboss.tools.common.model.util.XModelObjectLoaderUtil;
+
+/**
+ *
+ * @author Viacheslav Kabanovich
+ *
+ */
+public class AddScheduleProviderSupport extends SpecialWizardSupport {
+ String providerEntity;
+
+ public AddScheduleProviderSupport() {}
+
+ protected void reset() {
+ providerEntity = getEntityData()[0].getModelEntity().getName();
+ }
+
+ public String[] getActionNames(int stepId) {
+ if(getStepId() < getEntityData().length - 1) {
+ if(getStepId() == 0) {
+ return new String[]{NEXT, CANCEL};
+ } else {
+ return new String[]{BACK, NEXT, CANCEL};
+ }
+ } else if(getEntityData().length > 0) {
+ return new String[]{BACK, FINISH, CANCEL};
+ }
+ return new String[]{FINISH, CANCEL, HELP};
+ }
+
+ public boolean isActionEnabled(String name) {
+ if(FINISH.equals(name) && getStepId() < getEntityData().length - 1) {
+ return false;
+ }
+ return true;
+ }
+
+ @Override
+ public void action(String name) throws XModelException {
+ if(FINISH.equals(name)) {
+ execute();
+ setFinished(true);
+ } else if(CANCEL.equals(name)) {
+ setFinished(true);
+ } else if(BACK.equals(name)) {
+ if(getStepId() == 0) return;
+ setStepId(getStepId() - 1);
+ } else if(NEXT.equals(name)) {
+ if(getStepId() >= getEntityData().length - 1) return;
+ setStepId(getStepId() + 1);
+ } else if(HELP.equals(name)) {
+ help();
+ }
+ }
+
+ protected void execute() throws XModelException {
+ Properties p0 = extractStepData(0);
+ XModelObject provider =
XModelObjectLoaderUtil.createValidObject(getTarget().getModel(), providerEntity, p0);
+
+ Properties p1 = extractStepData(1);
+ String scheduleEntity = getScheduleEntity(provider, p1);
+ if(scheduleEntity != null) {
+ XModelObject bus = XModelObjectLoaderUtil.createValidObject(getTarget().getModel(),
scheduleEntity, p1);
+ provider.addChild(bus);
+ }
+
+ DefaultCreateHandler.addCreatedObject(getTarget(), provider,
FindObjectHelper.EVERY_WHERE);
+ }
+
+ private String getScheduleEntity(XModelObject provider, Properties p1) {
+ String scheduleKind = p1.getProperty("schedule kind");
+ XChild[] cs = provider.getModelEntity().getChildren();
+ for (int i = 0; i < cs.length; i++) {
+ if(cs[i].getName().indexOf(scheduleKind) >= 0) return cs[i].getName();
+ }
+ return null;
+ }
+
+ public boolean canBeProcessedByStandardWizard() {
+ return true;
+ }
+
+}
Property changes on:
trunk/esb/plugins/org.jboss.tools.esb.core/src/org/jboss/tools/esb/core/model/handlers/AddScheduleProviderSupport.java
___________________________________________________________________
Name: svn:mime-type
+ text/plain