You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@netbeans.apache.org by GitBox <gi...@apache.org> on 2022/05/10 15:27:06 UTC

[GitHub] [netbeans] usernane opened a new issue, #4099: IDE Creates Multiple Folders as File Path is Being Typed

usernane opened a new issue, #4099:
URL: https://github.com/apache/netbeans/issues/4099

   ### Apache NetBeans version
   
   Apache NetBeans 13
   
   ### What happened
   
   ## What Happened
   While trying to create a new PHP class, I was typing the location where the class will be created. As I was typing, The IDE created multiple folders that I Don't need.
   
   
   ## Expected to happen
   Only the folders that hold the class should be created.
   
   ## What Happened
   The IDE created multiple folders that I Don't need as I was typing where a PHP class will be created.
   
   
   ### How to reproduce
   
   * Created new PHP Application
   * Created new folder with name `src`
   * Right-clicked on the folder and selected `New` > `PHP Class...`
   * Entered `File` as class name, typed `src/webfiori/framework` as `Folder` and, `webfiori\framework` as `namespace`
   * As typing the folder name, the IDE will start by creating folders.
   
   
   
   ### Did this work correctly in an earlier version?
   
   No
   
   ### Operating System
   
   Windows 10 version 10.0 running on amd64; Cp1252; en_US (nb)
   
   ### JDK
   
   Java: 15.0.2; OpenJDK 64-Bit Server VM 15.0.2+7-27
   
   ### Apache NetBeans packaging
   
   Apache NetBeans provided installer
   
   ### Anything else
   
   Here is an image that shows the created folders.
   
   ![image](https://user-images.githubusercontent.com/12120015/167664471-5fdd97c2-bbf6-45cc-b143-b91739fbe0e0.png)
   
   ### Are you willing to submit a pull request?
   
   No
   
   ### Code of Conduct
   
   Yes


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik closed issue #4099: IDE Creates Multiple Folders as File Path is Being Typed

Posted by GitBox <gi...@apache.org>.
tmysik closed issue #4099: IDE Creates Multiple Folders as File Path is Being Typed
URL: https://github.com/apache/netbeans/issues/4099


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on issue #4099: IDE Creates Multiple Folders as File Path is Being Typed

Posted by GitBox <gi...@apache.org>.
tmysik commented on issue #4099:
URL: https://github.com/apache/netbeans/issues/4099#issuecomment-1123710319

   @junichi11 
   
   Junichi, I am not sure if we can do something here... and disabling the field would cause more "damage" than the current situation, I think.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] neilcsmith-net commented on issue #4099: IDE Creates Multiple Folders as File Path is Being Typed

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on issue #4099:
URL: https://github.com/apache/netbeans/issues/4099#issuecomment-1123576463

   OK, looks like this is an old issue https://bz.apache.org/netbeans/show_bug.cgi?id=240917


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on issue #4099: IDE Creates Multiple Folders as File Path is Being Typed

Posted by GitBox <gi...@apache.org>.
tmysik commented on issue #4099:
URL: https://github.com/apache/netbeans/issues/4099#issuecomment-1123708751

   This problem does not happen _so often_, I believe (therefore, not many reports in the last years :)
   
   Let me explain - the typical situation is that one selects some existing option (directory), to add a PHP class. This issue occurs for cases, when one wants to create a new PHP class in non-existing directory (as I wrote above, hopefully not so typical use case).
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on issue #4099: IDE Creates Multiple Folders as File Path is Being Typed

Posted by GitBox <gi...@apache.org>.
junichi11 commented on issue #4099:
URL: https://github.com/apache/netbeans/issues/4099#issuecomment-1124840107

   @tmysik Sure :) Will create it.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on issue #4099: IDE Creates Multiple Folders as File Path is Being Typed

Posted by GitBox <gi...@apache.org>.
tmysik commented on issue #4099:
URL: https://github.com/apache/netbeans/issues/4099#issuecomment-1123584949

   Yes, look into the original issue in BZ, not much can be done in PHP, I am afraid.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] tmysik commented on issue #4099: IDE Creates Multiple Folders as File Path is Being Typed

Posted by GitBox <gi...@apache.org>.
tmysik commented on issue #4099:
URL: https://github.com/apache/netbeans/issues/4099#issuecomment-1124816839

   @junichi11 
   
   Thanks for the idea, that could work! And yes, it is a hack :)
   
   Will you please create a PR for it? Thank you.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] neilcsmith-net commented on issue #4099: IDE Creates Multiple Folders as File Path is Being Typed

Posted by GitBox <gi...@apache.org>.
neilcsmith-net commented on issue #4099:
URL: https://github.com/apache/netbeans/issues/4099#issuecomment-1123626149

   Thanks @tmysik I realised that after debugging the problem and finding the comment about the BZ issue.  I wonder if we can approach the other way and add optional support for making the text field non-editable instead?  Anyway, feel free to close as Won't Fix if you want - was checking through open issues for things that might be NB14 relevant.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists


[GitHub] [netbeans] junichi11 commented on issue #4099: IDE Creates Multiple Folders as File Path is Being Typed

Posted by GitBox <gi...@apache.org>.
junichi11 commented on issue #4099:
URL: https://github.com/apache/netbeans/issues/4099#issuecomment-1123984448

   @tmysik 
   My idea is the following. It's ugly hack... What do you think?
   
   ```patch
   diff --git a/php/php.project/src/org/netbeans/modules/php/project/ui/wizards/NewFileWizardIterator.java b/php/php.project/src/org/netbeans/modules/php/project/ui/wizards/NewFileWizardIterator.java
   index 28a83c1aaf..77a9044a54 100644
   --- a/php/php.project/src/org/netbeans/modules/php/project/ui/wizards/NewFileWizardIterator.java
   +++ b/php/php.project/src/org/netbeans/modules/php/project/ui/wizards/NewFileWizardIterator.java
   @@ -20,6 +20,7 @@ package org.netbeans.modules.php.project.ui.wizards;
    
    import java.awt.Component;
    import java.awt.EventQueue;
   +import java.io.File;
    import java.io.IOException;
    import java.util.Arrays;
    import java.util.Collections;
   @@ -31,6 +32,8 @@ import java.util.Set;
    import java.util.logging.Level;
    import java.util.logging.Logger;
    import javax.swing.JComponent;
   +import javax.swing.JPanel;
   +import javax.swing.JTextField;
    import javax.swing.event.ChangeEvent;
    import javax.swing.event.ChangeListener;
    import org.netbeans.api.annotations.common.CheckForNull;
   @@ -53,7 +56,6 @@ import org.openide.WizardDescriptor.Panel;
    import org.openide.filesystems.FileObject;
    import org.openide.loaders.DataFolder;
    import org.openide.loaders.DataObject;
   -import org.openide.util.RequestProcessor;
    
    public final class NewFileWizardIterator implements WizardDescriptor.AsynchronousInstantiatingIterator<WizardDescriptor> {
    
   @@ -61,47 +63,14 @@ public final class NewFileWizardIterator implements WizardDescriptor.Asynchronou
    
        private static final Logger LOGGER = Logger.getLogger(NewFileWizardIterator.class.getName());
    
   -    private static final RequestProcessor RP = new RequestProcessor(NewFileWizardIterator.class);
   -
        private final BottomPanel bottomPanel;
   -    final RequestProcessor.Task setTargetFolderTask;
   -
        private WizardDescriptor wizard;
        private PhpProject phpProject;
        private WizardDescriptor.Panel<WizardDescriptor>[] wizardPanels;
        private int index;
   -    // @GuardedBy("EDT")
   -    WizardDescriptor.Panel<WizardDescriptor> simpleTargetChooserPanel;
   -
    
        private NewFileWizardIterator(BottomPanel bottomPanel) {
            this.bottomPanel = bottomPanel;
   -        if (bottomPanel != null) {
   -            setTargetFolderTask = RP.create(new Runnable() {
   -                @Override
   -                public void run() {
   -                    EventQueue.invokeLater(new Runnable() {
   -                        @Override
   -                        public void run() {
   -                            assert EventQueue.isDispatchThread();
   -                            final WizardDescriptor.Panel<WizardDescriptor> simpleTargetChooserPanelRef = simpleTargetChooserPanel;
   -                            if (simpleTargetChooserPanelRef == null) {
   -                                // #241005 - already uninitialized
   -                                return;
   -                            }
   -                            WizardDescriptor descriptor = new DummyWizardDescriptor();
   -                            assert simpleTargetChooserPanelRef != null;
   -                            simpleTargetChooserPanelRef.storeSettings(descriptor);
   -                            BottomPanel bottomPanelForPhpProject = getBottomPanelForPhpProject();
   -                            assert bottomPanelForPhpProject != null;
   -                            bottomPanelForPhpProject.targetFolderChanged(Templates.getTargetFolder(descriptor));
   -                        }
   -                    });
   -                }
   -            });
   -        } else {
   -            setTargetFolderTask = null;
   -        }
        }
    
        public static NewFileWizardIterator simple() {
   @@ -215,7 +184,6 @@ public final class NewFileWizardIterator implements WizardDescriptor.Asynchronou
        @Override
        public void uninitialize(WizardDescriptor wizard) {
            wizardPanels = null;
   -        simpleTargetChooserPanel = null;
        }
    
        @Override
   @@ -332,16 +300,39 @@ public final class NewFileWizardIterator implements WizardDescriptor.Asynchronou
                targetChooserBuilder
                        .bottomPanel(bottomPanelForPhpProject);
            }
   -        simpleTargetChooserPanel = targetChooserBuilder
   +        final WizardDescriptor.Panel<WizardDescriptor> simpleTargetChooserPanel = targetChooserBuilder
                    .freeFileExtension()
                    .create();
            if (bottomPanelForPhpProject != null) {
   -            // #240917 hack - it is not possible to listen on panel (name and location)
                simpleTargetChooserPanel.addChangeListener(new ChangeListener() {
                    @Override
                    public void stateChanged(ChangeEvent e) {
   -                    assert setTargetFolderTask != null;
   -                    setTargetFolderTask.schedule(300);
   +                    // #240917 hack - it is not possible to listen on panel (name and location)
   +                    // GH #4099 ugly hack
   +                    Component component = simpleTargetChooserPanel.getComponent();
   +                    if (component instanceof JPanel) {
   +                        // SimpleTargetChooserPanelGUI
   +                        JPanel panel = (JPanel) component;
   +                        for (Component c : panel.getComponents()) {
   +                            if (c instanceof JTextField) {
   +                                JTextField textField = (JTextField) c;
   +                                if (!textField.isEditable()) {
   +                                    String text = textField.getText();
   +                                    if (text != null && text.endsWith(".php")) { // NOI18N
   +                                        File file = new File(text);
   +                                        File parent = file.getParentFile();
   +                                        if (parent == null || !parent.exists()) {
   +                                            return;
   +                                        }
   +                                        break;
   +                                    }
   +                                }
   +                            }
   +                        }
   +                    }
   +                    WizardDescriptor descriptor = new DummyWizardDescriptor();
   +                    simpleTargetChooserPanel.storeSettings(descriptor);
   +                    bottomPanelForPhpProject.targetFolderChanged(Templates.getTargetFolder(descriptor));
                    }
                });
            }
   ```
   Get the "Created File" text field:
   ![nb-php-gh4099](https://user-images.githubusercontent.com/738383/167895008-8a50c773-d375-44cc-8866-ce14b9db5b77.png)
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@netbeans.apache.org
For additional commands, e-mail: notifications-help@netbeans.apache.org

For further information about the NetBeans mailing lists, visit:
https://cwiki.apache.org/confluence/display/NETBEANS/Mailing+lists