Search in sources :

Example 1 with Sources

use of org.netbeans.api.project.Sources in project enclojure by EricThorsen.

the class CljSourceWizardIterator method getPanels.

/**
     * Initialize panels representing individual wizard's steps and sets
     * various properties for them influencing wizard appearance.
     */
private WizardDescriptor.Panel[] getPanels() {
    project = Templates.getProject(wizard);
    sources = project.getLookup().lookup(Sources.class);
    groups = sources.getSourceGroups(JavaProjectConstants.SOURCES_TYPE_JAVA);
    //;packageChooserPanel = JavaTemplates.createPackageChooser(project,groups,new CljSourceWizardPanel1());
    if (panels == null) {
        panels = new WizardDescriptor.Panel[] { //JavaTemplates.createPackageChooser(project, groups)
        new CljSourceWizardPanel1() };
        String[] steps = createSteps();
        for (int i = 0; i < panels.length; i++) {
            Component c = panels[i].getComponent();
            if (steps[i] == null) {
                // Default step name to component name of panel. Mainly
                // useful for getting the name of the target chooser to
                // appear in the list of steps.
                steps[i] = c.getName();
            }
            if (c instanceof JComponent) {
                // assume Swing components
                JComponent jc = (JComponent) c;
                // Sets step number of a component
                // TODO if using org.openide.dialogs >= 7.8, can use WizardDescriptor.PROP_*:
                jc.putClientProperty("WizardPanel_contentSelectedIndex", new Integer(i));
                // Sets steps names for a panel
                jc.putClientProperty("WizardPanel_contentData", steps);
                // Turn on subtitle creation on each step
                jc.putClientProperty("WizardPanel_autoWizardStyle", Boolean.TRUE);
                // Show steps on the left side with the image on the background
                jc.putClientProperty("WizardPanel_contentDisplayed", Boolean.TRUE);
                // Turn on numbering of all steps
                jc.putClientProperty("WizardPanel_contentNumbered", Boolean.TRUE);
            }
        }
    }
    LOG.log(Level.INFO, "Leaving getPanels");
    return panels;
}
Also used : JComponent(javax.swing.JComponent) WizardDescriptor(org.openide.WizardDescriptor) JComponent(javax.swing.JComponent) Component(java.awt.Component) Sources(org.netbeans.api.project.Sources)

Example 2 with Sources

use of org.netbeans.api.project.Sources in project enclojure by EricThorsen.

the class ClojureSourcesHelper method getClojureSources.

public static List<FileObject> getClojureSources(Project project) {
    List<FileObject> result = new ArrayList<FileObject>();
    Sources sources = ProjectUtils.getSources(project);
    SourceGroup[] groups = sources.getSourceGroups(Sources.TYPE_GENERIC);
    for (SourceGroup group : groups) {
        FileObject root = group.getRootFolder();
        Enumeration<? extends FileObject> files = root.getData(true);
        while (files.hasMoreElements()) {
            FileObject fobj = files.nextElement();
            if (fobj.getExt().equals(CLOJURE_EXT)) {
                result.add(fobj);
            }
        }
    }
    return result;
}
Also used : ArrayList(java.util.ArrayList) FileObject(org.openide.filesystems.FileObject) Sources(org.netbeans.api.project.Sources) SourceGroup(org.netbeans.api.project.SourceGroup)

Aggregations

Sources (org.netbeans.api.project.Sources)2 Component (java.awt.Component)1 ArrayList (java.util.ArrayList)1 JComponent (javax.swing.JComponent)1 SourceGroup (org.netbeans.api.project.SourceGroup)1 WizardDescriptor (org.openide.WizardDescriptor)1 FileObject (org.openide.filesystems.FileObject)1