01: /*
02: * ChainBuilder ESB
03: * Visual Enterprise Integration
04: *
05: * Copyright (C) 2006 Bostech Corporation
06: *
07: * This program is free software; you can redistribute it and/or modify it
08: * under the terms of the GNU General Public License as published by the
09: * Free Software Foundation; either version 2 of the License, or (at your option)
10: * any later version.
11: *
12: * This program is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14: * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15: * for more details.
16: *
17: * You should have received a copy of the GNU General Public License along with
18: * this program; if not, write to the Free Software Foundation, Inc.,
19: * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20: *
21: *
22: * $Id$
23: */
24: package com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.wizards;
25:
26: import org.eclipse.ui.PlatformUI;
27:
28: import com.bostechcorp.cbesb.common.i18n.I18N;
29: import com.bostechcorp.cbesb.common.i18n.Messages;
30: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.XSLT;
31: import com.bostechcorp.cbesb.ui.componentflow.componentFlowEditor.diagram.part.ComponentFlowEditorDiagramEditor;
32:
33: public class XSLTPropertyWizard extends PropertyWizard {
34:
35: private XSLTPropertyWizardPageMain mainPage;
36:
37: public void addPages() {
38:
39: mainPage = new XSLTPropertyWizardPageMain("Main");
40: addPage(mainPage);
41: super .addPages();
42:
43: }
44:
45: public XSLTPropertyWizard() {
46: super ();
47: this .setWindowTitle(I18N.getString(Messages.XSLT_TITLE));
48: }
49:
50: public XSLT getModels() {
51: XSLT XSLTComponent = null;
52: if (super .getModels() instanceof XSLT)
53: XSLTComponent = (XSLT) super .getModels();
54: return XSLTComponent;
55: }
56:
57: public boolean performCancel() {
58:
59: if (getModels().getName() == null
60: || getModels().getName().equals("")
61: || (mainPage.getErrorMessage() != null
62: && mainPage.getErrorMessage().indexOf(
63: "duplicated") != -1 || (mainPage
64: .getErrorMessage() != null && mainPage
65: .getErrorMessage().indexOf("forbidden") != -1))) {
66: int num = WizardUtil.modelExistNum(getModels());
67: if (num == 0) {
68: getModels().setName("XSLT");
69: } else {
70: getModels().setName("XSLT_" + num);
71: }
72: ((ComponentFlowEditorDiagramEditor) PlatformUI
73: .getWorkbench().getActiveWorkbenchWindow()
74: .getActivePage().getActiveEditor()).setDirty(true);
75: ((ComponentFlowEditorDiagramEditor) PlatformUI
76: .getWorkbench().getActiveWorkbenchWindow()
77: .getActivePage().getActiveEditor())
78: .getPropertySheetPage().refresh();
79: }
80: return super .performCancel();
81: }
82:
83: @Override
84: public PropertyWizardPageMain getMainPage() {
85: // TODO Auto-generated method stub
86: return this.mainPage;
87: }
88:
89: }
|