framework support step: added method to listener to notify when step is reached

This commit is contained in:
nik
2010-10-22 12:09:26 +04:00
parent a8f4a4fb3c
commit c502bbbbcb
6 changed files with 59 additions and 7 deletions
@@ -6,6 +6,7 @@ package com.intellij.ide.util.frameworkSupport;
import com.intellij.CommonBundle;
import com.intellij.ide.util.newProjectWizard.AddSupportForFrameworksPanel;
import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelImpl;
import com.intellij.openapi.application.Result;
import com.intellij.openapi.application.WriteAction;
import com.intellij.openapi.module.Module;
@@ -35,9 +36,10 @@ public class AddFrameworkSupportDialog extends DialogWrapper {
super(module.getProject(), true);
setTitle(ProjectBundle.message("dialog.title.add.frameworks.support"));
myModule = module;
myAddSupportPanel = new AddSupportForFrameworksPanel(providers, LibrariesContainerFactory.createContainer(module.getProject()), null,
new Computable<String>() {
public String compute() {
final FrameworkSupportModelImpl model = new FrameworkSupportModelImpl(module.getProject(), null);
myAddSupportPanel = new AddSupportForFrameworksPanel(providers, LibrariesContainerFactory.createContainer(module.getProject()),
model, new Computable<String>() {
public String compute() {
return contentRootPath;
}
}) {
@@ -24,7 +24,6 @@ import com.intellij.ide.util.frameworkSupport.FrameworkSupportConfigurableListen
import com.intellij.ide.util.frameworkSupport.FrameworkSupportProvider;
import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportCommunicator;
import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelImpl;
import com.intellij.ide.util.projectWizard.ModuleBuilder;
import com.intellij.openapi.Disposable;
import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.module.Module;
@@ -75,11 +74,12 @@ public class AddSupportForFrameworksPanel implements Disposable {
private FrameworkSupportNode myLastSelectedNode;
public AddSupportForFrameworksPanel(final List<FrameworkSupportProvider> providers, final @NotNull LibrariesContainer librariesContainer,
@Nullable ModuleBuilder builder, Computable<String> baseDirForLibrariesGetter) {
final FrameworkSupportModelImpl model,
Computable<String> baseDirForLibrariesGetter) {
myModel = model;
myLibrariesContainer = librariesContainer;
myBaseDirForLibrariesGetter = baseDirForLibrariesGetter;
myProviders = providers;
myModel = new FrameworkSupportModelImpl(myLibrariesContainer.getProject(), builder);
createNodes();
final Splitter splitter = new Splitter(false, 0.30f, 0.1f, 0.7f);
@@ -7,6 +7,7 @@ package com.intellij.ide.util.newProjectWizard;
import com.intellij.CommonBundle;
import com.intellij.ide.util.frameworkSupport.FrameworkSupportProvider;
import com.intellij.ide.util.frameworkSupport.FrameworkSupportUtil;
import com.intellij.ide.util.newProjectWizard.impl.FrameworkSupportModelImpl;
import com.intellij.ide.util.projectWizard.JavaModuleBuilder;
import com.intellij.ide.util.projectWizard.ModuleBuilder;
import com.intellij.ide.util.projectWizard.ModuleWizardStep;
@@ -30,11 +31,15 @@ import java.util.List;
*/
public class SupportForFrameworksStep extends ModuleWizardStep {
private final AddSupportForFrameworksPanel mySupportForFrameworksPanel;
private final FrameworkSupportModelImpl myFrameworkSupportModel;
private boolean myCommitted;
public SupportForFrameworksStep(final ModuleBuilder builder, @NotNull LibrariesContainer librariesContainer) {
List<FrameworkSupportProvider> providers = FrameworkSupportUtil.getProviders(builder);
mySupportForFrameworksPanel = new AddSupportForFrameworksPanel(providers, librariesContainer, builder, new Computable<String>() {
myFrameworkSupportModel = new FrameworkSupportModelImpl(librariesContainer.getProject(), builder);
mySupportForFrameworksPanel = new AddSupportForFrameworksPanel(providers, librariesContainer,
myFrameworkSupportModel,
new Computable<String>() {
public String compute() {
return getBaseDirectory(builder);
}
@@ -91,6 +96,11 @@ public class SupportForFrameworksStep extends ModuleWizardStep {
return mySupportForFrameworksPanel.getMainPanel();
}
@Override
public void updateStep() {
myFrameworkSupportModel.fireWizardStepUpdated();
}
public void updateDataModel() {
}
}
@@ -93,4 +93,8 @@ public class FrameworkSupportModelImpl extends UserDataHolderBase implements Fra
multicaster.frameworkUnselected(node.getProvider());
}
}
public void fireWizardStepUpdated() {
myDispatcher.getMulticaster().wizardStepUpdated();
}
}
@@ -0,0 +1,35 @@
/*
* Copyright 2000-2010 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.intellij.ide.util.frameworkSupport;
import org.jetbrains.annotations.NotNull;
/**
* @author nik
*/
public abstract class FrameworkSupportModelAdapter implements FrameworkSupportModelListener {
@Override
public void frameworkSelected(@NotNull FrameworkSupportProvider provider) {
}
@Override
public void frameworkUnselected(@NotNull FrameworkSupportProvider provider) {
}
@Override
public void wizardStepUpdated() {
}
}
@@ -29,4 +29,5 @@ public interface FrameworkSupportModelListener extends EventListener {
void frameworkUnselected(@NotNull FrameworkSupportProvider provider);
void wizardStepUpdated();
}