Java Code Examples for java.awt.Dialog#toFront()

The following examples show how to use java.awt.Dialog#toFront() . 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: ProjectImporterWizard.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Starts Eclipse importer wizard. */
public void start() {
    final EclipseWizardIterator iterator = new EclipseWizardIterator();
    final WizardDescriptor wizardDescriptor = new WizardDescriptor(iterator);
    iterator.addChangeListener(new ChangeListener() {
        public void stateChanged(ChangeEvent e) {
            wizardDescriptor.putProperty(WizardDescriptor.PROP_ERROR_MESSAGE, // NOI18N
                    iterator.getErrorMessage());
        }
    });
    wizardDescriptor.setTitleFormat(new java.text.MessageFormat("{1}")); // NOI18N
    wizardDescriptor.setTitle(
            ProjectImporterWizard.getMessage("CTL_WizardTitle")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        projects = iterator.getProjects();
        //showAdditionalInfo(projects);
        destination = iterator.getDestination();
        recursively = iterator.getRecursively();
        numberOfImportedProjects = iterator.getNumberOfImportedProject();
        extraPanels = iterator.getExtraPanels();
    }
}
 
Example 2
Source File: ConvertOgreBinaryMeshesAction.java    From MikuMikuStudio with BSD 2-Clause "Simplified" License 6 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("Convert Ogre Binary Meshes");
    wizardDescriptor.putProperty("project", context);
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    final boolean deleteFiles = (Boolean) wizardDescriptor.getProperty("deleteoriginal");
    if (!cancelled) {
        new Thread(new Runnable() {

            public void run() {
                scanDir(((AssetPackProject) context).getAssetsFolder().getPath(), deleteFiles);
            }
        }).start();
    }
}
 
Example 3
Source File: CheckoutWizard.java    From netbeans with Apache License 2.0 6 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(CheckoutWizard.class, "CTL_Checkout")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(CheckoutWizard.class, "CTL_Checkout"));
    dialog.setVisible(true);
    dialog.toFront();
    Object value = wizardDescriptor.getValue();
    boolean finnished = value == WizardDescriptor.FINISH_OPTION;
    
    if(finnished) {
        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
            repositoryStep.stop();                          
        }            
    }
    return finnished;
}
 
Example 4
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 5
Source File: NodeOperationImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Opens a modal propertySheet on given set of Nodes
* @param n the array of nodes to show properties for
*/
public void showProperties (Node[] nodes) {
    Dialog d = findCachedPropertiesDialog( nodes );
    if( null == d ) {
        openProperties(new NbSheet(), nodes);
    } else {
        d.setVisible( true );
        //#131724 - PropertySheet clears its Nodes in removeNotify and keeps
        //only a weakref which is being reused in subsequent addNotify
        //so we should set the Nodes again in case the weakref got garbage collected
        //pls note that PropertySheet code checks for redundant calls of setNodes
        NbSheet sheet = findCachedSheet( d );
        if( null != sheet )
            sheet.setNodes(nodes);
        d.toFront();
        FocusTraversalPolicy ftp = d.getFocusTraversalPolicy();
        if( null != ftp && null != ftp.getDefaultComponent(d) ) {
            ftp.getDefaultComponent(d).requestFocusInWindow();
        } else {
            d.requestFocusInWindow();
        }
    }
}
 
Example 6
Source File: NodeOperationImpl.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Opens a modal propertySheet on given Node
* @param n the node to show properties for
*/
public void showProperties (Node n) {
    Dialog d = findCachedPropertiesDialog( n );
    if( null == d ) {
        Node[] nds = new Node[] { n };
        openProperties(new NbSheet(), nds);
    } else {
        d.setVisible( true );
        //#131724 - PropertySheet clears its Nodes in removeNotify and keeps
        //only a weakref which is being reused in subsequent addNotify
        //so we should set the Nodes again in case the weakref got garbage collected
        //pls note that PropertySheet code checks for redundant calls of setNodes
        NbSheet sheet = findCachedSheet( d );
        if( null != sheet )
            sheet.setNodes(new Node[] { n });
        d.toFront();
        FocusTraversalPolicy ftp = d.getFocusTraversalPolicy();
        if( null != ftp && null != ftp.getDefaultComponent(d) ) {
            ftp.getDefaultComponent(d).requestFocusInWindow();
        } else {
            d.requestFocusInWindow();
        }
    }
}
 
Example 7
Source File: InstallUnitWizard.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean implInvokeWizard (WizardDescriptor.Iterator<WizardDescriptor> iterator) {
    WizardDescriptor wizardDescriptor = new WizardDescriptor (iterator);
    wizardDescriptor.setModal (true);
    
    wizardDescriptor.setTitleFormat (new MessageFormat(NbBundle.getMessage (InstallUnitWizard.class, "InstallUnitWizard_MessageFormat")));
    wizardDescriptor.setTitle (NbBundle.getMessage (InstallUnitWizard.class, "InstallUnitWizard_Title"));
    
    Dialog dialog = DialogDisplayer.getDefault ().createDialog (wizardDescriptor);
    dialog.setVisible (true);
    dialog.toFront ();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    log.log (Level.FINE, "InstallUnitWizard returns with value " + wizardDescriptor.getValue ());
    return !cancelled;
}
 
Example 8
Source File: Clusterize.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private boolean perform() {
    wizardDescriptor.createNotificationLineSupport();
    wizardDescriptor.setTitleFormat(new MessageFormat("{0}"));
    wizardDescriptor.setTitle(NbBundle.getMessage(Clusterize.class, "LAB_ClusterizeWizard"));
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    return wizardDescriptor.getValue() == WizardDescriptor.FINISH_OPTION;
}
 
Example 9
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 10
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 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: 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 13
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 14
Source File: URLPatternWizard.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(URLPatternWizard.class, "CTL_URLPattern")); // NOI18N
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(URLPatternWizard.class, "CTL_URLPattern")); // NOI18N
    dialog.setVisible(true);
    dialog.toFront();
    
    return wizardDescriptor.getValue() == WizardDescriptor.FINISH_OPTION;
}
 
Example 15
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 16
Source File: CatalogAction.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public @Override void actionPerformed(ActionEvent e) {
    
    Dialog dialog = dialogWRef.get ();

    if (dialog == null || ! dialog.isShowing ()) {

        final CatalogPanel cp = new CatalogPanel ();
        JButton closeButton = new JButton ();
        Mnemonics.setLocalizedText (closeButton,NbBundle.getMessage (CatalogAction.class, "BTN_CatalogPanel_CloseButton")); // NOI18N
        JButton openInEditor = new JButton ();
        openInEditor.setEnabled (false);
        OpenInEditorListener l = new OpenInEditorListener (cp, openInEditor);
        openInEditor.addActionListener (l);
        cp.getExplorerManager ().addPropertyChangeListener (l);
        Mnemonics.setLocalizedText (openInEditor,NbBundle.getMessage (CatalogAction.class, "BTN_CatalogPanel_OpenInEditorButton")); // NOI18N
        DialogDescriptor dd = new DialogDescriptor (cp,NbBundle.getMessage (CatalogAction.class, "LBL_CatalogPanel_Title"),  // NOI18N
                                false, // modal
                                new Object [] { openInEditor, closeButton },
                                closeButton,
                                DialogDescriptor.DEFAULT_ALIGN,
                                null,
                                null);
        dd.setClosingOptions (null);
        // set helpctx to null again, DialogDescriptor replaces null with HelpCtx.DEFAULT_HELP
        dd.setHelpCtx (null);
        
        dialog = DialogDisplayer.getDefault ().createDialog (dd);
        dialog.setVisible (true);
        dialogWRef = new WeakReference<Dialog> (dialog);
        
    } else {
        dialog.toFront ();
    }
    
}
 
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: 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 19
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 20
Source File: SkyboxWizardAction.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("Skybox Wizard");
    Dialog dialog = DialogDisplayer.getDefault().createDialog(wizardDescriptor);
    dialog.setVisible(true);
    dialog.toFront();
    boolean cancelled = wizardDescriptor.getValue() != WizardDescriptor.FINISH_OPTION;
    if (!cancelled) {
        topComponent.generateSkybox(wizardDescriptor);
    }
}