Java Code Examples for org.openide.WizardDescriptor#getValue()

The following examples show how to use org.openide.WizardDescriptor#getValue() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SharableLibrariesUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/**
 * Show a multistep wizard for converting a non-sharable project to a sharable, self-contained one.
 * @param helper
 * @param ref
 * @param libraryNames
 * @param jarReferences
 * @return true is migration was performed, false when aborted.
 */
@Messages({
    "TIT_MakeSharableWizard=New Libraries Folder",
    "ACSD_MakeSharableWizard=Wizard dialog that guides you through the process of making the project self-contained and sharable in respect to binary dependencies."
})
public static boolean showMakeSharableWizard(final AntProjectHelper helper, ReferenceHelper ref, List<String> libraryNames, List<String> jarReferences) {

    final CopyIterator cpIt = new CopyIterator(helper);
    final WizardDescriptor wizardDescriptor = new WizardDescriptor(cpIt);
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle(TIT_MakeSharableWizard());
    wizardDescriptor.putProperty(PROP_HELPER, helper);
    wizardDescriptor.putProperty(PROP_REFERENCE_HELPER, ref);
    wizardDescriptor.putProperty(PROP_LIBRARIES, libraryNames);
    wizardDescriptor.putProperty(PROP_JAR_REFS, jarReferences);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(ACSD_MakeSharableWizard());
    dialog.setVisible(true);
    dialog.toFront();
    return wizardDescriptor.getValue() == WizardDescriptor.FINISH_OPTION && cpIt.isSuccess();
}
 
Example 2
Source File: JavaTargetChooserPanel.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void storeSettings(WizardDescriptor wizard) { 
    Object value = wizard.getValue();
    if (WizardDescriptor.PREVIOUS_OPTION.equals(value) || WizardDescriptor.CANCEL_OPTION.equals(value) ||
            WizardDescriptor.CLOSED_OPTION.equals(value)) {
        return;
    }
    if( isValid() ) {
        if ( bottomPanel != null ) {
            bottomPanel.storeSettings( wizard );
        }
        Templates.setTargetFolder(wizard, getTargetFolderFromGUI(wizard));
        Templates.setTargetName(wizard, gui.getTargetName());
    }        
    if (WizardDescriptor.FINISH_OPTION.equals(value)) {
        wizard.putProperty("NewFileWizard_Title", null); // NOI18N
        wizard.putProperty(FOLDER_TO_DELETE, null);
    }
}
 
Example 3
Source File: PullWizard.java    From netbeans with Apache License 2.0 6 votes vote down vote up
boolean show () {
    wizardIterator = new PanelsIterator();
    wizardDescriptor = new WizardDescriptor(wizardIterator);        
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(PullWizard.class, "LBL_PullWizard.title")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    setErrorMessage(wizardIterator.selectUriStep.getErrorMessage());
    dialog.setVisible(true);
    dialog.toFront();
    Object value = wizardDescriptor.getValue();
    boolean finnished = value == WizardDescriptor.FINISH_OPTION;
    if (!finnished) {
        // wizard wasn't properly finnished ...
        if (value == WizardDescriptor.CLOSED_OPTION || value == WizardDescriptor.CANCEL_OPTION ) {
            // wizard was closed or canceled -> reset all steps & kill all running tasks
            wizardIterator.selectUriStep.cancelBackgroundTasks();
        }            
    }
    return finnished;
}
 
Example 4
Source File: NbPlatformCustomizer.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Messages("CTL_AddNetbeansPlatformTitle=Add NetBeans Platform")
private void addPlatform(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addPlatform
    PlatformChooserWizardPanel chooser = new PlatformChooserWizardPanel(null);
    PlatformInfoWizardPanel info = new PlatformInfoWizardPanel(null);
    WizardDescriptor wd = new WizardDescriptor(new BasicWizardPanel[] {chooser, info});
    initPanel(chooser, wd, 0);
    initPanel(info, wd, 1);
    wd.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wd);
    dialog.setTitle(CTL_AddNetbeansPlatformTitle());
    dialog.setVisible(true);
    dialog.toFront();
    if (wd.getValue() == WizardDescriptor.FINISH_OPTION) {
        String plafDir = (String) wd.getProperty(PLAF_DIR_PROPERTY);
        String plafLabel = (String) wd.getProperty(PLAF_LABEL_PROPERTY);
        String id = plafLabel.replace(' ', '_');
        NbPlatform plaf = getPlafListModel().addPlatform(id, plafDir, plafLabel);
        if (plaf != null) {
            platformsList.setSelectedValue(plaf, true);
            refreshPlatform();
        }
    }
}
 
Example 5
Source File: ApisupportAntUIUtils.java    From netbeans with Apache License 2.0 6 votes vote down vote up
public static @CheckForNull NbModuleProject runProjectWizard(
        final NewNbModuleWizardIterator iterator, final String titleBundleKey) {
    WizardDescriptor wd = new WizardDescriptor(iterator);
    wd.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wd.setTitle(NbBundle.getMessage(ApisupportAntUIUtils.class, titleBundleKey));
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wd);
    dialog.setVisible(true);
    dialog.toFront();
    NbModuleProject project = null;
    boolean cancelled = wd.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        FileObject folder = iterator.getCreateProjectFolder();
        if (folder == null) {
            return null;
        }
        try {
            project = (NbModuleProject) ProjectManager.getDefault().findProject(folder);
            OpenProjects.getDefault().open(new Project[] { project }, false);
        } catch (IOException e) {
            ErrorManager.getDefault().notify(ErrorManager.INFORMATIONAL, e);
        }
    }
    return project;
}
 
Example 6
Source File: PushWizard.java    From netbeans with Apache License 2.0 6 votes vote down vote up
boolean show () {
    wizardIterator = new PanelsIterator();
    wizardDescriptor = new WizardDescriptor(wizardIterator);        
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(PushWizard.class, "LBL_PushWizard.title")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    setErrorMessage(wizardIterator.selectUriStep.getErrorMessage());
    dialog.setVisible(true);
    dialog.toFront();
    Object value = wizardDescriptor.getValue();
    boolean finnished = value == WizardDescriptor.FINISH_OPTION;
    if (!finnished) {
        // wizard wasn't properly finnished ...
        if (value == WizardDescriptor.CLOSED_OPTION || value == WizardDescriptor.CANCEL_OPTION ) {
            // wizard was closed or canceled -> reset all steps & kill all running tasks
            wizardIterator.selectUriStep.cancelBackgroundTasks();
        }            
    }
    return finnished;
}
 
Example 7
Source File: ConfigureFXMLControllerPanelVisual.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void storeSettings(WizardDescriptor settings) {
    Object value = settings.getValue();
    if (WizardDescriptor.PREVIOUS_OPTION.equals(value)
            || WizardDescriptor.CANCEL_OPTION.equals(value)
            || WizardDescriptor.CLOSED_OPTION.equals(value)) {
        return;
    }
    if (isValid()) {
        settings.putProperty(FXMLTemplateWizardIterator.PROP_JAVA_CONTROLLER_ENABLED, component.isControllerEnabled());
        settings.putProperty(FXMLTemplateWizardIterator.PROP_JAVA_CONTROLLER_NAME_PROPERTY, 
            component.shouldCreateController() ? component.getNewControllerName() : null);
        settings.putProperty(FXMLTemplateWizardIterator.PROP_JAVA_CONTROLLER_EXISTING_PROPERTY, 
            component.getExistingControllerName());
    }
    settings.putProperty("NewFileWizard_Title", null); // NOI18N
}
 
Example 8
Source File: ConfigureFXMLCSSPanelVisual.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override
public void storeSettings(WizardDescriptor settings) {
    Object value = settings.getValue();
    if (WizardDescriptor.PREVIOUS_OPTION.equals(value)
            || WizardDescriptor.CANCEL_OPTION.equals(value)
            || WizardDescriptor.CLOSED_OPTION.equals(value)) {
        return;
    }
    if (isValid()) {
        settings.putProperty(FXMLTemplateWizardIterator.PROP_CSS_ENABLED, component.isCSSEnabled());
        settings.putProperty(FXMLTemplateWizardIterator.PROP_CSS_NAME_PROPERTY, 
            component.shouldCreateCSS() ? component.getNewCSSName() : null);
        settings.putProperty(FXMLTemplateWizardIterator.PROP_CSS_EXISTING_PROPERTY,
            component.getExistingCSSName());
    }
    settings.putProperty("NewFileWizard_Title", null); // NOI18N
}
 
Example 9
Source File: PublishAssetPackAction.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void actionPerformed(ActionEvent ev) {
    final WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Publish AssetPack");
    wizardDescriptor.putProperty("project", context);
    String projectName = ((AssetPackProject) context).getProjectName().replaceAll(" ", "_") + ".zip";
    wizardDescriptor.putProperty("filename", projectName);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        new Thread(new Runnable() {

            public void run() {
                ProgressHandle handle = ProgressHandleFactory.createHandle("Publishing AssetPack..");
                handle.start();
                packZip(wizardDescriptor);
                copyData(wizardDescriptor);
                handle.progress("Uploading AssetPack..");
                uploadData(wizardDescriptor);
                cleanup(wizardDescriptor);
                handle.finish();
            }
        }).start();
    }
}
 
Example 10
Source File: CloneWizard.java    From netbeans with Apache License 2.0 5 votes vote down vote up
boolean show () {
    wizardIterator = new PanelsIterator();
    wizardDescriptor = new WizardDescriptor(wizardIterator);        
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(CloneWizard.class, "LBL_CloneWizard.title")); // NOI18N
    
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    if(pa != null && forPath != null) {
        Git.getInstance().getRequestProcessor().post(new Runnable() {
            @Override
            public void run () {
                wizardIterator.repositoryStep.waitPopulated();
                // url and credential already provided, so try 
                // to reach the next step ...
                EventQueue.invokeLater(new Runnable() {
                    @Override
                    public void run() {
                        wizardDescriptor.doNextClick();
                    }
                });
            }
        });
    }
    setErrorMessage(wizardIterator.repositoryStep.getErrorMessage());
    dialog.setVisible(true);
    dialog.toFront();
    Object value = wizardDescriptor.getValue();
    boolean finished = value == WizardDescriptor.FINISH_OPTION;
    if (finished) {
        onFinished();
    } else {
        // wizard wasn't properly finnished ...
        if (value == WizardDescriptor.CLOSED_OPTION || value == WizardDescriptor.CANCEL_OPTION ) {
            // wizard was closed or canceled -> reset all steps & kill all running tasks
            wizardIterator.repositoryStep.cancelBackgroundTasks();
        }            
    }
    return finished;
}
 
Example 11
Source File: CreateTerrainWizardAction.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void performAction() {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Terrain Wizard");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        controller.generateTerrain(wizardDescriptor);
    }
}
 
Example 12
Source File: AddTerrainAction.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected Object showWizard(org.openide.nodes.Node node) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Terrain Wizard");
    wizardDescriptor.putProperty("main_node", node);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        return wizardDescriptor;
    }
    return null;
}
 
Example 13
Source File: NewBloomFilterAction.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected Object showWizard(Node node) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Your wizard dialog title here");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        return wizardDescriptor;
    }
    return null;
}
 
Example 14
Source File: ConfigureFXMLPanelVisual.java    From netbeans with Apache License 2.0 5 votes vote down vote up
@Override
public void storeSettings(WizardDescriptor settings) {
    Object value = settings.getValue();
    if (WizardDescriptor.PREVIOUS_OPTION.equals(value)
            || WizardDescriptor.CANCEL_OPTION.equals(value)
            || WizardDescriptor.CLOSED_OPTION.equals(value)) {
        return;
    }
    settings.putProperty("NewFileWizard_Title", null); // NOI18N
}
 
Example 15
Source File: AddSkyboxAction.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected Object showWizard(org.openide.nodes.Node node) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Skybox Wizard");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        return wizardDescriptor;
    }
    return null;
}
 
Example 16
Source File: ImportAssetAction.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void actionPerformed(ActionEvent ev) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Import Asset to AssetPack..");
    wizardDescriptor.putProperty("project", context);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        importAsset(wizardDescriptor);
    }
}
 
Example 17
Source File: ImportModel.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public void actionPerformed(ActionEvent ev) {
    final WizardDescriptor wiz = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wiz.setTitleFormat(new MessageFormat("{0}"));
    wiz.setTitle("Import Model to Project");
    wiz.putProperty("project", context);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wiz);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wiz.getValue() != WizardDescriptor.FINISH_OPTION;
    ((ModelImporterWizardPanel1) panels[0]).cleanup();
    if (!cancelled) {
        new Thread(new Runnable() {

            public void run() {
                ProgressHandle handle = ProgressHandleFactory.createHandle("Importing Model..");
                handle.start();
                try {
                    copyModel(wiz);
                } catch (Exception e) {
                    Exceptions.printStackTrace(e);
                }
                handle.finish();
            }
        }).start();
    }
}
 
Example 18
Source File: ImportWizard.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public boolean show() {
    wizardIterator = new PanelsIterator();
    wizardDescriptor = new WizardDescriptor(wizardIterator);
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}")); // NOI18N
    wizardDescriptor.setTitle(org.openide.util.NbBundle.getMessage(ImportWizard.class, "CTL_Import")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(ImportWizard.class, "CTL_Import"));
    dialog.setVisible(true);
    dialog.toFront();
    Object value = wizardDescriptor.getValue();
    boolean finnished = value == WizardDescriptor.FINISH_OPTION;
    
    if(!finnished) {
        // wizard wasn't properly finnished ...
        if(value == WizardDescriptor.CLOSED_OPTION || 
           value == WizardDescriptor.CANCEL_OPTION ) 
        {
            // wizard was closed or canceled -> reset all steps & kill all running tasks                
            repositoryStep.stop();
            importStep.stop();
            importPreviewStep.stop();
        }            
    } else if (value == WizardDescriptor.FINISH_OPTION) {
        if(wizardIterator.current() == importStep) {
            setupImportPreviewStep(true);
        } else if (wizardIterator.current() == importPreviewStep) {
            importPreviewStep.storeTableSorter();
            importPreviewStep.startCommitTask(repositoryStep.getRepositoryFile().getRepositoryUrl());
        }            
    }
    return finnished;
}
 
Example 19
Source File: BloomWizardAction.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public @Override
void actionPerformed(ActionEvent e) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor(getPanels());
    // {0} will be replaced by WizardDesriptor.Panel.getComponent().getName()
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle("Your wizard dialog title here");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        // do something
    }
}
 
Example 20
Source File: InsertProfilingPointAction.java    From netbeans with Apache License 2.0 4 votes vote down vote up
public void performAction(Lookup.Provider project) {
    ProfilingPointsManager manager = ProfilingPointsManager.getDefault();
    if (manager.isProfilingSessionInProgress()) {
        ProfilerDialogs.displayWarning(
                Bundle.InsertProfilingPointAction_ProfilingInProgressMsg());

        return;
    }

    if (ProjectUtilities.getOpenedProjects().length == 0) {
        ProfilerDialogs.displayWarning(
                Bundle.InsertProfilingPointAction_NoProjectMsg());

        return;
    }

    ProfilingPointWizard ppWizard = ProfilingPointWizard.getDefault();
    final WizardDescriptor wd = ppWizard.getWizardDescriptor(project);

    if (wd != null) { // if null then another PP is currently being created/customized and user is already notified

        final Dialog d = DialogDisplayer.getDefault().createDialog(wd);
        d.setVisible(true);

        boolean createPPoint = wd.getValue() == WizardDescriptor.FINISH_OPTION;
        ProfilingPoint profilingPoint = ppWizard.finish(!createPPoint); // Wizard must be finished even in cancelled to release its resources

        if (createPPoint) {
            manager.addProfilingPoint(profilingPoint);

            if (profilingPoint instanceof GlobalProfilingPoint) {
                SwingUtilities.invokeLater(new Runnable() {
                    public void run() {
                        ProfilingPointsWindow ppWin = ProfilingPointsWindow.getDefault();
                        if (!ppWin.isOpened()) {
                            ppWin.open();
                            ppWin.requestVisible();
                        }
                    }
                });
            }
        }
    }
}