001: /*
002: * ChainBuilder ESB
003: * Visual Enterprise Integration
004: *
005: * Copyright (C) 2006 Bostech Corporation
006: *
007: * This program is free software; you can redistribute it and/or modify it
008: * under the terms of the GNU General Public License as published by the
009: * Free Software Foundation; either version 2 of the License, or (at your option)
010: * any later version.
011: *
012: * This program is distributed in the hope that it will be useful,
013: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
014: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
015: * for more details.
016: *
017: * You should have received a copy of the GNU General Public License along with
018: * this program; if not, write to the Free Software Foundation, Inc.,
019: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
020: *
021: *
022: * $Id$
023: */
024: package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards;
025:
026: import org.eclipse.ui.PlatformUI;
027:
028: import com.bostechcorp.cbesb.common.i18n.I18N;
029: import com.bostechcorp.cbesb.common.i18n.Messages;
030: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.JMS;
031: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorDiagramEditor;
032:
033: public class JMSPropertyWizard extends PropertyWizard {
034:
035: private JMSPropertyWizardPageMain mainPage;
036:
037: private JMSPropertyWizardPageConsumerProperty wizardPage2;
038:
039: private JMSPropertyWizardPageConsumerProperty2 wizardPage21;
040:
041: private JMSPropertyWizardPageProviderProperty wizardPage3;
042:
043: private JMSReliableDelMain reliableMain;
044:
045: public void addPages() {
046:
047: mainPage = new JMSPropertyWizardPageMain("Main");
048: addPage(mainPage);
049: reliableMain = new JMSReliableDelMain("ReliableMain");
050: addPage(reliableMain);
051: wizardPage2 = new JMSPropertyWizardPageConsumerProperty(
052: "ConsumerProperty");
053: addPage(wizardPage2);
054: wizardPage21 = new JMSPropertyWizardPageConsumerProperty2(
055: "ConsumerProperty2");
056: addPage(wizardPage21);
057: wizardPage3 = new JMSPropertyWizardPageProviderProperty(
058: "ProviderProperty");
059: addPage(wizardPage3);
060:
061: // subWizard =new FilePropertyWizard();
062: // addPage(subWizard);
063: super .addPages();
064:
065: }
066:
067: public JMSPropertyWizard() {
068: super ();
069: this .setWindowTitle(I18N.getString(Messages.JMS_TITLE));
070: }
071:
072: public JMS getModels() {
073: JMS JMSComponent = null;
074: if (super .getModels() instanceof JMS)
075: JMSComponent = (JMS) super .getModels();
076: return JMSComponent;
077: }
078:
079: public boolean performCancel() {
080:
081: if (getModels().getName() == null
082: || getModels().getName().equals("")
083: || (mainPage.getErrorMessage() != null
084: && mainPage.getErrorMessage().indexOf(
085: "duplicated") != -1 || (mainPage
086: .getErrorMessage() != null && mainPage
087: .getErrorMessage().indexOf("forbidden") != -1))) {
088: int num = WizardUtil.modelExistNum(getModels());
089: if (num == 0) {
090: getModels().setName("JMS");
091: } else {
092: getModels().setName("JMS_" + num);
093: }
094: ((ComponentFlowEditorDiagramEditor) PlatformUI
095: .getWorkbench().getActiveWorkbenchWindow()
096: .getActivePage().getActiveEditor()).setDirty(true);
097: ((ComponentFlowEditorDiagramEditor) PlatformUI
098: .getWorkbench().getActiveWorkbenchWindow()
099: .getActivePage().getActiveEditor())
100: .getPropertySheetPage().refresh();
101: }
102: return super .performCancel();
103: }
104:
105: @Override
106: public PropertyWizardPageMain getMainPage() {
107: // TODO Auto-generated method stub
108: return this.mainPage;
109: }
110:
111: }
|