use of com.intellij.ide.wizard.Step in project android by JetBrains.
the class DynamicWizard method showNextStep.
@Nullable
private Step showNextStep(@Nullable AndroidStudioWizardPath path) {
Step newStep = null;
if (path != null) {
newStep = path.next();
}
if (newStep == null) {
newStep = null;
while (myPathListIterator.hasNext() && newStep == null) {
myCurrentPath = myPathListIterator.next();
assert myCurrentPath != null;
myCurrentPath.onPathStarted(true);
newStep = myCurrentPath.getCurrentStep();
}
}
if (newStep != null) {
showStep(newStep);
}
return newStep;
}
use of com.intellij.ide.wizard.Step in project android by JetBrains.
the class AndroidWizardWrapper method getCustomOptionsStep.
@Nullable
@Override
public ModuleWizardStep getCustomOptionsStep(WizardContext context, Disposable parentDisposable) {
if (myWizard == null) {
WizardHostDelegate host = new WizardHostDelegate(context.getWizard());
myWizard = context.isCreatingNewProject() ? new ProjectWizard(context.getProject(), host) : new ModuleWizard(context.getProject(), host);
myWizard.init();
}
return new ModuleWizardStep() {
@Override
public JComponent getComponent() {
return (JComponent) myWizard.getContentPane();
}
@Override
public void updateDataModel() {
}
@Override
public String getHelpId() {
if (myWizard == null || myWizard.getCurrentPath() == null)
return null;
Step step = myWizard.getCurrentPath().getCurrentStep();
if (step instanceof DynamicWizardStep) {
String name = ((DynamicWizardStep) step).getStepName();
if ("Create Android Project".equals(name)) {
return "New_Project_Dialog";
}
if ("Configure Form Factors".equals(name)) {
return "Target_Android_Devices";
}
if ("Activity Gallery".equals(name)) {
return "Add_an_Activity_Dialog";
}
if ("Template parameters".equals(name)) {
return "Customize_the_Activity";
}
}
return null;
}
};
}
use of com.intellij.ide.wizard.Step in project android by JetBrains.
the class DynamicWizard method doPreviousAction.
/**
* Find and go to the previous step. Subclasses should rarely need to override
* this method.
*/
public final void doPreviousAction() {
assert myCurrentPath != null;
if (!myCurrentPath.canGoPrevious()) {
myHost.shakeWindow();
return;
}
Step newStep = myCurrentPath.previous();
if (newStep == null) {
while (myPathListIterator.hasPrevious() && newStep == null) {
myCurrentPath = myPathListIterator.previous();
assert myCurrentPath != null;
myCurrentPath.onPathStarted(false);
newStep = myCurrentPath.getCurrentStep();
}
}
if (newStep != null) {
showStep(newStep);
} else {
LOG.error("Stepped into Path " + myCurrentPath + " which returned a null step");
}
}
use of com.intellij.ide.wizard.Step in project android by JetBrains.
the class DynamicWizard method init.
public void init() {
myHost.init(this);
myIsInitialized = true;
if (myUpdateQueue != null) {
int guard = 0;
// error so we need to detect it and report to developer.
while (!myUpdateQueue.isEmpty()) {
myUpdateQueue.flush();
guard++;
if (guard >= MAX_UPDATE_ATTEMPTS) {
throw new IllegalStateException("Circular dependencies detected. Model state cannot be settled down.");
}
}
}
Step step = showNextStep(null);
assert step != null;
}
use of com.intellij.ide.wizard.Step in project intellij-community by JetBrains.
the class GradleProjectWizardTest method testGradleProject.
public void testGradleProject() throws Exception {
final String projectName = "testProject";
Project project = createProject(new Consumer<Step>() {
@Override
public void consume(Step step) {
if (step instanceof ProjectTypeStep) {
assertTrue(((ProjectTypeStep) step).setSelectedTemplate("Gradle", null));
List<ModuleWizardStep> steps = myWizard.getSequence().getSelectedSteps();
assertEquals(5, steps.size());
final ProjectBuilder projectBuilder = myWizard.getProjectBuilder();
assertInstanceOf(projectBuilder, GradleModuleBuilder.class);
((GradleModuleBuilder) projectBuilder).setName(projectName);
}
}
});
assertEquals(projectName, project.getName());
Module[] modules = ModuleManager.getInstance(project).getModules();
assertEquals(1, modules.length);
final Module module = modules[0];
assertTrue(ModuleRootManager.getInstance(module).isSdkInherited());
assertEquals(projectName, module.getName());
VirtualFile root = ProjectRootManager.getInstance(project).getContentRoots()[0];
VirtualFile settingsScript = VfsUtilCore.findRelativeFile("settings.gradle", root);
assertNotNull(settingsScript);
assertEquals(String.format("rootProject.name = '%s'\n\n", projectName), StringUtil.convertLineSeparators(VfsUtilCore.loadText(settingsScript)));
VirtualFile buildScript = VfsUtilCore.findRelativeFile("build.gradle", root);
assertNotNull(buildScript);
assertEquals("group '" + projectName + "'\n" + "version '1.0-SNAPSHOT'\n" + "\n" + "apply plugin: 'java'\n" + "\n" + "sourceCompatibility = 1.8\n" + "\n" + "repositories {\n" + " mavenCentral()\n" + "}\n" + "\n" + "dependencies {\n" + " testCompile group: 'junit', name: 'junit', version: '4.12'\n" + "}\n", StringUtil.convertLineSeparators(VfsUtilCore.loadText(buildScript)));
}
Aggregations