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.TCPIP;
031: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorDiagramEditor;
032:
033: public class TCPIPPropertyWizard extends PropertyWizard {
034:
035: private TCPIPPropertyWizardMainPage mainPage;
036:
037: private TCPIPClientSettingsWizardPage wizardPage2;
038:
039: private TCPIPServerSettingsWizardPage wizardPage4;
040:
041: private TCPIPConsumerSettingsWizardPage wizardPage6;
042:
043: private TCPIPProviderSettingsWizardPage wizardPage7;
044:
045: public void addPages() {
046:
047: mainPage = new TCPIPPropertyWizardMainPage("Main");
048: addPage(mainPage);
049: wizardPage2 = new TCPIPClientSettingsWizardPage("ClientPage");
050: addPage(wizardPage2);
051: wizardPage4 = new TCPIPServerSettingsWizardPage("ServerPage");
052: addPage(wizardPage4);
053: wizardPage6 = new TCPIPConsumerSettingsWizardPage(
054: "ConsumerPage");
055: addPage(wizardPage6);
056: wizardPage7 = new TCPIPProviderSettingsWizardPage(
057: "ProviderPage");
058: addPage(wizardPage7);
059: super .addPages();
060:
061: }
062:
063: public TCPIPPropertyWizard() {
064: super ();
065: this .setWindowTitle(I18N.getString(Messages.TCPIP_WIZARD));
066: }
067:
068: public TCPIP getModels() {
069: TCPIP tcpipcomponent = null;
070: if (super .getModels() instanceof TCPIP)
071: tcpipcomponent = (TCPIP) super .getModels();
072: return tcpipcomponent;
073: }
074:
075: @Override
076: public boolean performCancel() {
077: if (getModels().getName() == null
078: || getModels().getName().equals("")
079: || (mainPage.getErrorMessage() != null
080: && mainPage.getErrorMessage().indexOf(
081: "duplicated") != -1 || (mainPage
082: .getErrorMessage() != null && mainPage
083: .getErrorMessage().indexOf("forbidden") != -1))) {
084: int num = WizardUtil.modelExistNum(getModels());
085: if (num == 0) {
086: getModels().setName("TCPIP");
087: } else {
088: getModels().setName("TCPIP_" + num);
089: }
090: ((ComponentFlowEditorDiagramEditor) PlatformUI
091: .getWorkbench().getActiveWorkbenchWindow()
092: .getActivePage().getActiveEditor()).setDirty(true);
093: ((ComponentFlowEditorDiagramEditor) PlatformUI
094: .getWorkbench().getActiveWorkbenchWindow()
095: .getActivePage().getActiveEditor())
096: .getPropertySheetPage().refresh();
097: }
098: return super .performCancel();
099: }
100:
101: @Override
102: public PropertyWizardPageMain getMainPage() {
103: // TODO Auto-generated method stub
104: return this.mainPage;
105: }
106: }
|