| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.debug.ui.liveedit; | 5 package org.chromium.debug.ui.liveedit; |
| 6 | 6 |
| 7 import static org.chromium.debug.ui.DialogUtils.createConstant; | 7 import static org.chromium.debug.ui.DialogUtils.createConstant; |
| 8 import static org.chromium.debug.ui.DialogUtils.createErrorOptional; | 8 import static org.chromium.debug.ui.DialogUtils.createErrorOptional; |
| 9 import static org.chromium.debug.ui.DialogUtils.createOptional; | 9 import static org.chromium.debug.ui.DialogUtils.createOptional; |
| 10 import static org.chromium.debug.ui.DialogUtils.createProcessor; | 10 import static org.chromium.debug.ui.DialogUtils.createProcessor; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 import org.chromium.debug.ui.DialogUtils.ValueSource; | 34 import org.chromium.debug.ui.DialogUtils.ValueSource; |
| 35 import org.chromium.debug.ui.WizardUtils.LogicBasedWizard; | 35 import org.chromium.debug.ui.WizardUtils.LogicBasedWizard; |
| 36 import org.chromium.debug.ui.WizardUtils.NextPageEnabler; | 36 import org.chromium.debug.ui.WizardUtils.NextPageEnabler; |
| 37 import org.chromium.debug.ui.WizardUtils.PageElements; | 37 import org.chromium.debug.ui.WizardUtils.PageElements; |
| 38 import org.chromium.debug.ui.WizardUtils.PageImpl; | 38 import org.chromium.debug.ui.WizardUtils.PageImpl; |
| 39 import org.chromium.debug.ui.WizardUtils.PageListener; | 39 import org.chromium.debug.ui.WizardUtils.PageListener; |
| 40 import org.chromium.debug.ui.WizardUtils.WizardFinishController; | 40 import org.chromium.debug.ui.WizardUtils.WizardFinishController; |
| 41 import org.chromium.debug.ui.WizardUtils.WizardFinisher; | 41 import org.chromium.debug.ui.WizardUtils.WizardFinisher; |
| 42 import org.chromium.debug.ui.WizardUtils.WizardLogic; | 42 import org.chromium.debug.ui.WizardUtils.WizardLogic; |
| 43 import org.chromium.debug.ui.actions.ChooseVmControl; | 43 import org.chromium.debug.ui.actions.ChooseVmControl; |
| 44 import org.chromium.debug.ui.liveedit.LiveEditResultDialog.ErrorPositionHighligh
ter; |
| 44 import org.chromium.debug.ui.liveedit.PushChangesWizard.FinisherDelegate; | 45 import org.chromium.debug.ui.liveedit.PushChangesWizard.FinisherDelegate; |
| 45 import org.chromium.sdk.UpdatableScript.ChangeDescription; | 46 import org.chromium.sdk.UpdatableScript.ChangeDescription; |
| 46 | 47 |
| 47 /** | 48 /** |
| 48 * Creates Updater-based logic implementation of the wizard. It is responsible f
or proper data | 49 * Creates Updater-based logic implementation of the wizard. It is responsible f
or proper data |
| 49 * manipulation and view control updates. | 50 * manipulation and view control updates. |
| 50 * <p> | 51 * <p> |
| 51 * The wizard pages are arranged in graph with one fork:<br> | 52 * The wizard pages are arranged in graph with one fork:<br> |
| 52 * 'choose vm' -> | 53 * 'choose vm' -> |
| 53 * <ul> | 54 * <ul> |
| 54 * <li>[single vm path] -> 'textual preview' -> 'v8 preview' | 55 * <li>[single vm path] -> 'textual preview' -> 'v8 preview' |
| 55 * <li>[multiple vm path] -> 'multiple vm stub' | 56 * <li>[multiple vm path] -> 'multiple vm stub' |
| 56 * </ul> | 57 * </ul> |
| 57 */ | 58 */ |
| 58 class WizardLogicBuilder { | 59 class WizardLogicBuilder { |
| 59 private final Updater updater; | 60 private final Updater updater; |
| 60 private final PushChangesWizard.PageSet pageSet; | 61 private final PushChangesWizard.PageSet pageSet; |
| 61 private final LogicBasedWizard wizardImpl; | 62 private final LogicBasedWizard wizardImpl; |
| 62 | 63 |
| 63 WizardLogicBuilder(PushChangesWizard.PageSet pageSet, LogicBasedWizard wizardI
mpl) { | 64 WizardLogicBuilder(PushChangesWizard.PageSet pageSet, LogicBasedWizard wizardI
mpl) { |
| 64 this.pageSet = pageSet; | 65 this.pageSet = pageSet; |
| 65 this.wizardImpl = wizardImpl; | 66 this.wizardImpl = wizardImpl; |
| 66 | 67 |
| 67 updater = new Updater(); | 68 updater = new Updater(); |
| 68 } | 69 } |
| 69 | 70 |
| 70 WizardLogic create(final List<? extends ScriptTargetMapping> targetList) { | 71 WizardLogic create(final List<? extends ScriptTargetMapping> targetList, |
| 72 final ErrorPositionHighlighter positionHighlighter) { |
| 71 Scope scope = updater.rootScope(); | 73 Scope scope = updater.rootScope(); |
| 72 | 74 |
| 73 final boolean skipSingleTargetSelection = true; | 75 final boolean skipSingleTargetSelection = true; |
| 74 | 76 |
| 75 // Wizard logic is described from the first page toward the last pages. | 77 // Wizard logic is described from the first page toward the last pages. |
| 76 | 78 |
| 77 final PageImpl<PushChangesWizard.ChooseVmPageElements> chooseVmPage = | 79 final PageImpl<PushChangesWizard.ChooseVmPageElements> chooseVmPage = |
| 78 pageSet.getChooseVmPage(); | 80 pageSet.getChooseVmPage(); |
| 79 | 81 |
| 80 // A value corresponding to selected VMs on 'choose vm' page. | 82 // A value corresponding to selected VMs on 'choose vm' page. |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 createMultipleVmPath(chooseVmPage, singleVmSelectedSwitch, nonEmptySelec
tedPlansValue); | 184 createMultipleVmPath(chooseVmPage, singleVmSelectedSwitch, nonEmptySelec
tedPlansValue); |
| 183 | 185 |
| 184 final PreviewAndOptionPath switchBlockItems = DialogUtils.mergeBranchVariabl
es( | 186 final PreviewAndOptionPath switchBlockItems = DialogUtils.mergeBranchVariabl
es( |
| 185 PreviewAndOptionPath.class, singleVmSelectedSwitch, singleVmPath, multip
leVmPath); | 187 PreviewAndOptionPath.class, singleVmSelectedSwitch, singleVmPath, multip
leVmPath); |
| 186 | 188 |
| 187 // A simple value converter that wraps wizard delegate as UI-aware wizard fi
nisher. | 189 // A simple value converter that wraps wizard delegate as UI-aware wizard fi
nisher. |
| 188 ValueProcessor<Optional<? extends WizardFinisher>> finisherValue = | 190 ValueProcessor<Optional<? extends WizardFinisher>> finisherValue = |
| 189 createProcessor(handleErrors(new NormalExpression<WizardFinisher>() { | 191 createProcessor(handleErrors(new NormalExpression<WizardFinisher>() { |
| 190 @Calculate | 192 @Calculate |
| 191 public WizardFinisher calculate(FinisherDelegate finisherDelegate)
{ | 193 public WizardFinisher calculate(FinisherDelegate finisherDelegate)
{ |
| 192 return new PushChangesWizard.FinisherImpl(finisherDelegate); | 194 return new PushChangesWizard.FinisherImpl(finisherDelegate, posi
tionHighlighter); |
| 193 } | 195 } |
| 194 @DependencyGetter | 196 @DependencyGetter |
| 195 public ValueSource<? extends Optional<? extends FinisherDelegate>> | 197 public ValueSource<? extends Optional<? extends FinisherDelegate>> |
| 196 getWizardFinisherDelegateSource() { | 198 getWizardFinisherDelegateSource() { |
| 197 return switchBlockItems.getFinisherDelegateValue(); | 199 return switchBlockItems.getFinisherDelegateValue(); |
| 198 } | 200 } |
| 199 })); | 201 })); |
| 200 updater.addConsumer(scope, finisherValue); | 202 updater.addConsumer(scope, finisherValue); |
| 201 updater.addSource(scope, finisherValue); | 203 updater.addSource(scope, finisherValue); |
| 202 updater.addDependency(finisherValue, switchBlockItems.getFinisherDelegateVal
ue()); | 204 updater.addDependency(finisherValue, switchBlockItems.getFinisherDelegateVal
ue()); |
| (...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 411 public ValueSource<? extends Optional<? extends FinisherDelegate>> | 413 public ValueSource<? extends Optional<? extends FinisherDelegate>> |
| 412 getFinisherDelegateValue() { | 414 getFinisherDelegateValue() { |
| 413 return wizardFinisher; | 415 return wizardFinisher; |
| 414 } | 416 } |
| 415 public ValueSource<Optional<Void>> getWarningValue() { | 417 public ValueSource<Optional<Void>> getWarningValue() { |
| 416 return warningValue; | 418 return warningValue; |
| 417 } | 419 } |
| 418 }; | 420 }; |
| 419 } | 421 } |
| 420 } | 422 } |
| OLD | NEW |