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.Script;
031: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorDiagramEditor;
032:
033: // import com.swtdesigner.ResourceManager;
034:
035: public class ScriptPropertyWizard extends PropertyWizard {
036:
037: private ScriptPropertyWizardPageMain mainPage;
038:
039: public void addPages() {
040:
041: mainPage = new ScriptPropertyWizardPageMain("Main");
042: addPage(mainPage);
043:
044: // subWizard =new FilePropertyWizard();
045: // addPage(subWizard);
046: super .addPages();
047:
048: }
049:
050: public ScriptPropertyWizard() {
051: super ();
052: this .setWindowTitle(I18N.getString(Messages.SCRIPT_TITLE));
053: // setDefaultPageImageDescriptor(ResourceManager.getPluginImageDescriptor(Activator
054: // .getDefault(), "icons/FILE.ico"));
055: // addPages();
056: // setNeedsProgressMonitor(true);
057: }
058:
059: public Script getModels() {
060: Script ScriptComponent = null;
061: if (super .getModels() instanceof Script)
062: ScriptComponent = (Script) super .getModels();
063: return ScriptComponent;
064: }
065:
066: public void init() {
067: /*
068: * setWindowTitle(I18N.getString(Messages.IDE_NEW_TRN_FILE));
069: * setDefaultPageImageDescriptor(Activator.imageDescriptorFromPlugin(
070: * Activator.PLUGIN_ID,"icons/full/wizban/openMessageFormatView.gif"));
071: */}
072:
073: public boolean performCancel() {
074:
075: if (getModels().getName() == null
076: || getModels().getName().equals("")
077: || (mainPage.getErrorMessage() != null
078: && mainPage.getErrorMessage().indexOf(
079: "duplicated") != -1 || (mainPage
080: .getErrorMessage() != null && mainPage
081: .getErrorMessage().indexOf("forbidden") != -1))) {
082: int num = WizardUtil.modelExistNum(getModels());
083: if (num == 0) {
084: getModels().setName("Script");
085: } else {
086: getModels().setName("Script_" + num);
087: }
088: ((ComponentFlowEditorDiagramEditor) PlatformUI
089: .getWorkbench().getActiveWorkbenchWindow()
090: .getActivePage().getActiveEditor()).setDirty(true);
091: ((ComponentFlowEditorDiagramEditor) PlatformUI
092: .getWorkbench().getActiveWorkbenchWindow()
093: .getActivePage().getActiveEditor())
094: .getPropertySheetPage().refresh();
095: }
096: return super .performCancel();
097: }
098:
099: @Override
100: public PropertyWizardPageMain getMainPage() {
101: // TODO Auto-generated method stub
102: return this.mainPage;
103: }
104:
105: }
|