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.File;
031: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorDiagramEditor;
032:
033: public class FilePropertyWizard extends PropertyWizard {
034:
035: private FilePropertyWizardMainPage mainPage;
036:
037: private FilePropertyWizardPageReadProperty wizardPage2;
038:
039: private FilePropertyWizardPageReadFilePath wizardPage3;
040:
041: private FilePropertyWizardPageReadArichiveFile wizardPage4;
042:
043: private FilePropertyWizardPageReadReplySetting wizardPage5;
044:
045: private FilePropertyWizardWritePageProperty wizardPage6;
046:
047: private FilePropertyWizardPageWriteFile wizardPage7;
048:
049: // private boolean flag = true;
050: public void addPages() {
051: mainPage = new FilePropertyWizardMainPage("Main");
052: addPage(mainPage);
053: wizardPage2 = new FilePropertyWizardPageReadProperty(
054: "PageStep2");
055: addPage(wizardPage2);
056: wizardPage3 = new FilePropertyWizardPageReadFilePath(
057: "PageStep3");
058: addPage(wizardPage3);
059: wizardPage4 = new FilePropertyWizardPageReadArichiveFile(
060: "PageStep4");
061: addPage(wizardPage4);
062: wizardPage5 = new FilePropertyWizardPageReadReplySetting(
063: "PageStep5");
064: addPage(wizardPage5);
065: wizardPage6 = new FilePropertyWizardWritePageProperty(
066: "PageStep6");
067: addPage(wizardPage6);
068: wizardPage7 = new FilePropertyWizardPageWriteFile("PageStep7");
069: addPage(wizardPage7);
070: super .addPages();
071:
072: }
073:
074: public FilePropertyWizard() {
075: super ();
076: this .setWindowTitle(I18N.getString(Messages.FILE_PRO_WIZ));
077: }
078:
079: public File getModels() {
080: File fileComponent = null;
081: if (super .getModels() instanceof File)
082: fileComponent = (File) super .getModels();
083: return fileComponent;
084: }
085:
086: @Override
087: public boolean performCancel() {
088:
089: if (getModels().getName() == null
090: || getModels().getName().equals("")
091: || (mainPage.getErrorMessage() != null
092: && mainPage.getErrorMessage().indexOf(
093: "duplicated") != -1 || (mainPage
094: .getErrorMessage() != null && mainPage
095: .getErrorMessage().indexOf("forbidden") != -1))) {
096: int num = WizardUtil.modelExistNum(getModels());
097: if (num == 0) {
098: getModels().setName("File");
099: } else {
100: getModels().setName("File_" + num);
101: }
102: ((ComponentFlowEditorDiagramEditor) PlatformUI
103: .getWorkbench().getActiveWorkbenchWindow()
104: .getActivePage().getActiveEditor()).setDirty(true);
105: ((ComponentFlowEditorDiagramEditor) PlatformUI
106: .getWorkbench().getActiveWorkbenchWindow()
107: .getActivePage().getActiveEditor())
108: .getPropertySheetPage().refresh();
109: }
110: return super .performCancel();
111: }
112:
113: @Override
114: public PropertyWizardPageMain getMainPage() {
115: // TODO Auto-generated method stub
116: return this.mainPage;
117: }
118:
119: }
|