2 * Copyright 2000-2009 JetBrains s.r.o.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
16 package com
.intellij
.uiDesigner
.wizard
;
18 import com
.intellij
.CommonBundle
;
19 import com
.intellij
.ide
.wizard
.AbstractWizard
;
20 import com
.intellij
.openapi
.application
.ApplicationManager
;
21 import com
.intellij
.openapi
.command
.CommandProcessor
;
22 import com
.intellij
.openapi
.diagnostic
.Logger
;
23 import com
.intellij
.openapi
.project
.Project
;
24 import com
.intellij
.openapi
.ui
.Messages
;
25 import com
.intellij
.openapi
.vfs
.VirtualFile
;
26 import com
.intellij
.uiDesigner
.UIDesignerBundle
;
27 import org
.jetbrains
.annotations
.NotNull
;
32 * @author Anton Katilin
33 * @author Vladimir Kondratyev
35 public final class DataBindingWizard
extends AbstractWizard
{
36 private static final Logger LOG
= Logger
.getInstance("#com.intellij.uiDesigner.wizard.DataBindingWizard");
37 private final WizardData myData
;
38 private final Project myProject
;
39 private final BeanStep myBeanStep
;
41 public DataBindingWizard(@NotNull final Project project
, @NotNull final VirtualFile formFile
, @NotNull final WizardData data
) {
42 super(UIDesignerBundle
.message("title.data.binding.wizard"), project
);
46 myBeanStep
= new BeanStep(myData
);
48 addStep(new BindCompositeStep(myData
));
52 if (!data
.myBindToNewBean
) {
57 public JComponent
getPreferredFocusedComponent() {
58 return myBeanStep
.myTfShortClassName
;
61 protected void updateStep() {
63 // "Finish" button is enabled only at the last step
64 getFinishButton().setEnabled(getCurrentStep() == mySteps
.size() - 1);
67 protected void doOKAction() {
68 CommandProcessor
.getInstance().executeCommand(
72 ApplicationManager
.getApplication().runWriteAction(
76 Generator
.generateDataBindingMethods(myData
);
77 DataBindingWizard
.super.doOKAction();
79 catch (Generator
.MyException exc
) {
80 Messages
.showErrorDialog(
83 CommonBundle
.getErrorTitle()
96 protected String
getHelpID() {
97 return "guiDesigner.formCode.dataBind";