public IconEditor() { myTextField.getTextField().setBorder(null); myTextField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { final TreeClassChooserFactory factory = TreeClassChooserFactory.getInstance(getModule().getProject()); PsiFile iconFile = null; if (myValue != null) { VirtualFile iconVFile = ResourceFileUtil.findResourceFileInScope(myValue.getIconPath(), getModule().getProject(), getModule() .getModuleWithDependenciesAndLibrariesScope(true)); if (iconVFile != null) { iconFile = PsiManager.getInstance(getModule().getProject()).findFile(iconVFile); } } TreeFileChooser fileChooser = factory.createFileChooser(UIDesignerBundle.message("title.choose.icon.file"), iconFile, null, new ImageFileFilter(getModule()), false, true); fileChooser.showDialog(); PsiFile file = fileChooser.getSelectedFile(); if (file != null) { String resourceName = FormEditingUtil.buildResourceName(file); if (resourceName != null) { IconDescriptor descriptor = new IconDescriptor(resourceName); IntroIconProperty.loadIconFromFile(file.getVirtualFile(), descriptor); myValue = descriptor; myTextField.setText(descriptor.getIconPath()); } } } }); }