mirror of
https://github.com/mirror/jdownloader.git
synced 2024-11-27 05:50:51 +00:00
ContainerPluginController:
-updated getContainerFileFilter, fixed Container entry, missing ".*", all pattern are CASE_INSENSITIVE -refs #90439 AddContainerAction: -fixes #90439, use new ExtFileChooserDialog.setAcceptAllFileFilterUsed git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@49764 ebf7c1c2-ba36-0410-9fe8-c592906822b4 Former-commit-id: 8a8e4a2f578c66fc8be27e4ee0dbb8fe260d6826
This commit is contained in:
parent
68e7f78e71
commit
ea14d59918
@ -17,17 +17,10 @@ package jd.gui.swing.jdgui.menu.actions;
|
||||
|
||||
import java.awt.event.ActionEvent;
|
||||
import java.awt.event.KeyEvent;
|
||||
import java.io.File;
|
||||
|
||||
import jd.controlling.linkcollector.LinkCollectingJob;
|
||||
import jd.controlling.linkcollector.LinkCollector;
|
||||
import jd.controlling.linkcollector.LinkOrigin;
|
||||
import jd.gui.UserIO;
|
||||
|
||||
import org.jdownloader.controlling.contextmenu.CustomizableAppAction;
|
||||
import org.jdownloader.gui.IconKey;
|
||||
import org.jdownloader.gui.translate._GUI;
|
||||
import org.jdownloader.plugins.controller.container.ContainerPluginController;
|
||||
|
||||
public class AddContainerAction extends CustomizableAppAction {
|
||||
private static final long serialVersionUID = 4713690050852393405L;
|
||||
@ -41,17 +34,6 @@ public class AddContainerAction extends CustomizableAppAction {
|
||||
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
final File[] files = UserIO.getInstance().requestFileChooser("_LOADSAVEDLC", _GUI.T.gui_filechooser_loaddlc(), UserIO.FILES_ONLY, true, ContainerPluginController.getInstance().getContainerFileFilter(null));
|
||||
if (files == null || files.length == 0) {
|
||||
return;
|
||||
}
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
for (final File file : files) {
|
||||
if (sb.length() > 0) {
|
||||
sb.append("\r\n");
|
||||
}
|
||||
sb.append(file.toURI().toString());
|
||||
}
|
||||
LinkCollector.getInstance().addCrawlerJob(new LinkCollectingJob(LinkOrigin.ADD_CONTAINER_ACTION.getLinkOriginDetails(), sb.toString()));
|
||||
new org.jdownloader.gui.views.linkgrabber.actions.AddContainerAction().actionPerformed(e);
|
||||
}
|
||||
}
|
@ -44,6 +44,7 @@ public class AddContainerAction extends CustomizableAppAction {
|
||||
final FileFilter[] fileFilter = ContainerPluginController.getInstance().getContainerFileFilter(null);
|
||||
ExtFileChooserDialog d = new ExtFileChooserDialog(0, _GUI.T.AddContainerAction_actionPerformed_(), null, null);
|
||||
d.setFileSelectionMode(FileChooserSelectionMode.FILES_ONLY);
|
||||
d.setAcceptAllFileFilterUsed(false);
|
||||
d.setFileFilter(fileFilter);
|
||||
d.setType(FileChooserType.OPEN_DIALOG);
|
||||
d.setMultiSelection(true);
|
||||
|
@ -8,13 +8,13 @@ import java.util.regex.PatternSyntaxException;
|
||||
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import jd.nutils.io.JDFileFilter;
|
||||
import jd.plugins.PluginsC;
|
||||
|
||||
import org.appwork.utils.DebugMode;
|
||||
import org.appwork.utils.Regex;
|
||||
import org.jdownloader.logging.LogController;
|
||||
|
||||
import jd.nutils.io.JDFileFilter;
|
||||
import jd.plugins.PluginsC;
|
||||
|
||||
public class ContainerPluginController {
|
||||
private static final ContainerPluginController INSTANCE = new ContainerPluginController();
|
||||
|
||||
@ -150,14 +150,14 @@ public class ContainerPluginController {
|
||||
public FileFilter[] getContainerFileFilter(final String filter) {
|
||||
final List<FileFilter> ret = new ArrayList<FileFilter>();
|
||||
final StringBuilder sb = new StringBuilder();
|
||||
sb.append("(");
|
||||
sb.append(".*(");
|
||||
for (final PluginsC act : list()) {
|
||||
if (filter != null && !new Regex(act.getName(), filter).matches()) {
|
||||
continue;
|
||||
} else {
|
||||
final String match = new Regex(act.getSupportedLinks().pattern(), "file:/\\.\\+(.+?)\\$").getMatch(0);
|
||||
if (match != null) {
|
||||
ret.add(new JDFileFilter(act.getName(), Pattern.compile(".*" + match + "$"), true));
|
||||
ret.add(new JDFileFilter(act.getName(), Pattern.compile(".*" + match + "$", Pattern.CASE_INSENSITIVE), true));
|
||||
sb.append(match);
|
||||
sb.append("|");
|
||||
}
|
||||
@ -166,7 +166,7 @@ public class ContainerPluginController {
|
||||
sb.setLength(sb.length() - 1);
|
||||
sb.append(")");
|
||||
try {
|
||||
ret.add(0, new JDFileFilter(null, Pattern.compile(sb.toString()), true));
|
||||
ret.add(0, new JDFileFilter(null, Pattern.compile(sb.toString(), Pattern.CASE_INSENSITIVE), true));
|
||||
} catch (final PatternSyntaxException e) {
|
||||
LogController.CL().log(e);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user