use of com.android.tools.idea.npw.module.ModuleGalleryEntry in project android by JetBrains.
the class AndroidNewModuleAction method actionPerformed.
@Override
public void actionPerformed(AnActionEvent e) {
Project project = e.getProject();
if (project != null) {
// TODO: before submitting this code, change this to only use the new wizard
if (Boolean.getBoolean("use.npw.modelwizard") && (e.getModifiers() & InputEvent.SHIFT_MASK) == 0) {
ArrayList<ModuleGalleryEntry> moduleDescriptions = new ArrayList<>();
for (ModuleDescriptionProvider provider : ModuleDescriptionProvider.EP_NAME.getExtensions()) {
moduleDescriptions.addAll(provider.getDescriptions());
}
ChooseModuleTypeStep chooseModuleTypeStep = new ChooseModuleTypeStep(new NewModuleModel(project), moduleDescriptions);
ModelWizard wizard = new ModelWizard.Builder().addStep(chooseModuleTypeStep).build();
new StudioWizardDialogBuilder(wizard, message("android.wizard.module.new.module.title")).build().show();
} else {
NewModuleWizardDynamic dialog = new NewModuleWizardDynamic(project, null);
dialog.init();
dialog.show();
}
}
}
use of com.android.tools.idea.npw.module.ModuleGalleryEntry in project flutter-intellij by flutter.
the class ChoseProjectTypeStep method createDependentSteps.
@NotNull
@Override
public Collection<? extends ModelWizardStep> createDependentSteps() {
List<ModelWizardStep> allSteps = Lists.newArrayList();
myModuleDescriptionToStepMap = new HashMap<>();
for (ModuleGalleryEntry moduleGalleryEntry : myModuleGalleryEntryList) {
FlutterProjectStep step = ((FlutterGalleryEntry) moduleGalleryEntry).createFlutterStep(getModel());
allSteps.add(step);
myModuleDescriptionToStepMap.put(moduleGalleryEntry, step);
}
return allSteps;
}
use of com.android.tools.idea.npw.module.ModuleGalleryEntry in project flutter-intellij by flutter.
the class ChoseProjectTypeStep method createGallery.
@NotNull
private JComponent createGallery() {
myProjectTypeGallery = new ASGallery<ModuleGalleryEntry>(JBList.createDefaultListModel(), image -> image == null ? null : image.getIcon() == null ? null : IconUtil.toImage(image.getIcon()), label -> label == null ? message("android.wizard.gallery.item.none") : label.getName(), DEFAULT_GALLERY_THUMBNAIL_SIZE, null) {
@Override
public Dimension getPreferredScrollableViewportSize() {
// The default implementation assigns a height as tall as the screen.
// When calling setVisibleRowCount(2), the underlying implementation is buggy, and will have a gap on the right and when the user
// resizes, it enters on an adjustment loop at some widths (can't decide to fit 3 or for elements, and loops between the two)
Dimension cellSize = computeCellSize();
int heightInsets = getInsets().top + getInsets().bottom;
int widthInsets = getInsets().left + getInsets().right;
// Don't want to show an exact number of rows, since then it's not obvious there's another row available.
return new Dimension(cellSize.width * 5 + widthInsets, (int) (cellSize.height * 1.2) + heightInsets);
}
};
myProjectTypeGallery.setBorder(BorderFactory.createLineBorder(JBColor.border()));
AccessibleContext accessibleContext = myProjectTypeGallery.getAccessibleContext();
if (accessibleContext != null) {
accessibleContext.setAccessibleDescription(getTitle());
}
return new JBScrollPane(myProjectTypeGallery);
}
use of com.android.tools.idea.npw.module.ModuleGalleryEntry in project flutter-intellij by flutter.
the class ChoseProjectTypeStep method onProceeding.
@Override
protected void onProceeding() {
// This wizard includes a step for each module, but we only visit the selected one. First, we hide all steps (in case we visited a
// different module before and hit back), and then we activate the step we care about.
ModuleGalleryEntry selectedEntry = myProjectTypeGallery.getSelectedElement();
myModuleDescriptionToStepMap.forEach((galleryEntry, step) -> step.setShouldShow(galleryEntry == selectedEntry));
}
Aggregations