git-svn-id: svn://svn.jdownloader.org/jdownloader/trunk@22864 ebf7c1c2-ba36-0410-9fe8-c592906822b4
This commit is contained in:
coalado 2013-11-04 08:35:43 +00:00
parent f202c278c7
commit 3c73662dbc
9 changed files with 129 additions and 78 deletions

View File

@ -88,7 +88,7 @@
<classpathentry kind="lib" path="ressourcen/libs/sevenzipjbindingMac.jar"/>
<classpathentry combineaccessrules="false" kind="src" path="/MyJDownloaderClient"/>
<classpathentry kind="lib" path="ressourcen/libs/jna_platform.jar"/>
<classpathentry kind="lib" path="ressourcen/libs/UPNP/cling-core.jar">
<classpathentry kind="lib" path="ressourcen/libs/UPNP/cling-core.jar" sourcepath="dev/cling-core-2.0-SNAPSHOT-sources.jar">
<attributes>
<attribute name="source_encoding" value="UTF-8"/>
</attributes>

View File

@ -1,11 +1,9 @@
package org.jdownloader.gui.toolbar.action;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import jd.gui.swing.jdgui.interfaces.View;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.gui.views.components.packagetable.PackageControllerTable;
import org.jdownloader.gui.views.downloads.DownloadsView;
import org.jdownloader.gui.views.downloads.table.DownloadsTable;
import org.jdownloader.gui.views.downloads.table.DownloadsTableModel;
@ -19,7 +17,7 @@ public class MoveDownAction extends AbstractMoveAction {
setName(_GUI._.MoveDownAction_MoveDownAction());
setIconKey("go-down");
setAccelerator(KeyEvent.VK_DOWN, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
setAccelerator(PackageControllerTable.KEY_STROKE_ALT_DOWN);
}

View File

@ -1,11 +1,9 @@
package org.jdownloader.gui.toolbar.action;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import jd.gui.swing.jdgui.interfaces.View;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.gui.views.components.packagetable.PackageControllerTable;
import org.jdownloader.gui.views.downloads.DownloadsView;
import org.jdownloader.gui.views.downloads.table.DownloadsTable;
import org.jdownloader.gui.views.downloads.table.DownloadsTableModel;
@ -19,7 +17,7 @@ public class MoveToBottomAction extends AbstractMoveAction {
setName(_GUI._.MoveToBottomAction_MoveToBottomAction());
setIconKey("go-bottom");
setAccelerator(KeyEvent.VK_END, InputEvent.ALT_DOWN_MASK);
setAccelerator(PackageControllerTable.KEY_STROKE_ALT_END);
}

View File

@ -1,11 +1,9 @@
package org.jdownloader.gui.toolbar.action;
import java.awt.event.InputEvent;
import java.awt.event.KeyEvent;
import jd.gui.swing.jdgui.interfaces.View;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.gui.views.components.packagetable.PackageControllerTable;
import org.jdownloader.gui.views.downloads.DownloadsView;
import org.jdownloader.gui.views.downloads.table.DownloadsTable;
import org.jdownloader.gui.views.downloads.table.DownloadsTableModel;
@ -18,7 +16,8 @@ public class MoveToTopAction extends AbstractMoveAction {
public MoveToTopAction() {
setName(_GUI._.MoveToTopAction_MoveToTopAction());
setIconKey("go-top");
setAccelerator(KeyEvent.VK_HOME, InputEvent.ALT_DOWN_MASK);
setAccelerator(PackageControllerTable.KEY_STROKE_ALT_HOME);
}
@Override

View File

@ -1,11 +1,9 @@
package org.jdownloader.gui.toolbar.action;
import java.awt.Toolkit;
import java.awt.event.KeyEvent;
import jd.gui.swing.jdgui.interfaces.View;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.gui.views.components.packagetable.PackageControllerTable;
import org.jdownloader.gui.views.downloads.DownloadsView;
import org.jdownloader.gui.views.downloads.table.DownloadsTable;
import org.jdownloader.gui.views.downloads.table.DownloadsTableModel;
@ -18,7 +16,8 @@ public class MoveUpAction extends AbstractMoveAction {
public MoveUpAction() {
setName(_GUI._.MoveUpAction_MoveUpAction());
setIconKey("go-up");
setAccelerator(KeyEvent.VK_UP, Toolkit.getDefaultToolkit().getMenuShortcutKeyMask());
setAccelerator(PackageControllerTable.KEY_STROKE_ALT_UP);
}

View File

@ -40,14 +40,14 @@ import org.jdownloader.updatev2.gui.LAFOptions;
public abstract class PackageControllerTable<ParentType extends AbstractPackageNode<ChildrenType, ParentType>, ChildrenType extends AbstractPackageChildrenNode<ParentType>> extends BasicJDTable<AbstractNode> {
private static final KeyStroke KEY_STROKE_ALT_END = KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.ALT_MASK);
private static final KeyStroke KEY_STROKE_ALT_HOME = KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.ALT_MASK);
private static final KeyStroke KEY_STROKE_ALT_DOWN = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.ALT_MASK);
private static final KeyStroke KEY_STROKE_ALT_UP = KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.ALT_MASK);
private static final KeyStroke KEY_STROKE_RIGHT = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0);
private static final KeyStroke KEY_STROKE_KP_RIGHT = KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0);
private static final KeyStroke KEY_STROKE_LEFT = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0);
private static final KeyStroke KEY_STROKE_KP_LEFT = KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0);
public static final KeyStroke KEY_STROKE_ALT_END = KeyStroke.getKeyStroke(KeyEvent.VK_END, InputEvent.ALT_MASK);
public static final KeyStroke KEY_STROKE_ALT_HOME = KeyStroke.getKeyStroke(KeyEvent.VK_HOME, InputEvent.ALT_MASK);
public static final KeyStroke KEY_STROKE_ALT_DOWN = KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, InputEvent.ALT_MASK);
public static final KeyStroke KEY_STROKE_ALT_UP = KeyStroke.getKeyStroke(KeyEvent.VK_UP, InputEvent.ALT_MASK);
public static final KeyStroke KEY_STROKE_RIGHT = KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, 0);
public static final KeyStroke KEY_STROKE_KP_RIGHT = KeyStroke.getKeyStroke(KeyEvent.VK_KP_RIGHT, 0);
public static final KeyStroke KEY_STROKE_LEFT = KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, 0);
public static final KeyStroke KEY_STROKE_KP_LEFT = KeyStroke.getKeyStroke(KeyEvent.VK_KP_LEFT, 0);
/**
*
*/

View File

@ -99,7 +99,7 @@ public class MenuManagerLinkgrabberTableContext extends ContextMenuManager<Crawl
mr.add(EnabledAction.class);
mr.add(new SeperatorData());
mr.add(new ActionData(OpenUrlAction.class));
mr.add(new ActionData(OpenInBrowserAction.class));
mr.add(new SeperatorData());
mr.add(createOthersMenu());

View File

@ -0,0 +1,109 @@
package org.jdownloader.gui.views.linkgrabber.contextmenu;
import java.awt.event.ActionEvent;
import java.util.HashSet;
import java.util.List;
import jd.controlling.linkcrawler.CrawledLink;
import jd.controlling.linkcrawler.CrawledPackage;
import jd.plugins.DownloadLink;
import org.appwork.utils.os.CrossSystem;
import org.appwork.utils.swing.dialog.Dialog;
import org.appwork.utils.swing.dialog.DialogCanceledException;
import org.appwork.utils.swing.dialog.DialogClosedException;
import org.appwork.utils.swing.dialog.ProgressDialog;
import org.appwork.utils.swing.dialog.ProgressDialog.ProgressGetter;
import org.jdownloader.actions.AbstractSelectionContextAction;
import org.jdownloader.gui.IconKey;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.gui.views.SelectionInfo;
import org.jdownloader.gui.views.components.packagetable.LinkTreeUtils;
import org.jdownloader.images.NewTheme;
public class OpenInBrowserAction extends AbstractSelectionContextAction<CrawledPackage, CrawledLink> {
private static final long serialVersionUID = 7911375550836173693L;
public OpenInBrowserAction(SelectionInfo<CrawledPackage, CrawledLink> si) {
super(si);
setIconKey("browse");
setName(_GUI._.gui_table_contextmenu_browselink());
}
@Override
public boolean isEnabled() {
if (!super.isEnabled()) return false;
if (!CrossSystem.isOpenBrowserSupported()) return false;
SelectionInfo<CrawledPackage, CrawledLink> lselection = getSelection();
if (lselection == null) return false;
List<CrawledLink> links = lselection.getChildren();
if (links.size() > 50) return false;
for (CrawledLink cl : links) {
DownloadLink link = cl.getDownloadLink();
if (link.getLinkType() == DownloadLink.LINKTYPE_NORMAL || link.gotBrowserUrl()) return true;
}
return false;
}
public void actionPerformed(ActionEvent e) {
if (!isEnabled()) return;
SelectionInfo<CrawledPackage, CrawledLink> lselection = getSelection();
if (lselection == null) return;
final List<CrawledLink> links = lselection.getChildren();
new Thread("OpenInBrowserAction") {
public void run() {
final HashSet<String> urls = LinkTreeUtils.getURLs(links);
if (links.size() < 5) {
for (String url : urls) {
CrossSystem.openURLOrShowMessage(url);
}
return;
}
ProgressDialog pg = new ProgressDialog(new ProgressGetter() {
private int total = -1;
private int current;
@Override
public void run() throws Exception {
total = urls.size();
current = 0;
for (String url : urls) {
CrossSystem.openURLOrShowMessage(url);
current++;
Thread.sleep(500);
}
}
@Override
public String getString() {
return current + "/" + total;
}
@Override
public int getProgress() {
if (total == 0) return -1;
int ret = (current * 100) / total;
return ret;
}
@Override
public String getLabelString() {
return null;
}
}, 0, _GUI._.OpenInBrowserAction_actionPerformed_open_in_browser__multi(), _GUI._.OpenInBrowserAction_actionPerformed_open_in_browser__multi_msg(urls.size()), NewTheme.I().getIcon(IconKey.ICON_BROWSE, 32), null, null);
try {
Dialog.getInstance().showDialog(pg);
} catch (DialogClosedException e) {
e.printStackTrace();
} catch (DialogCanceledException e) {
e.printStackTrace();
}
}
}.start();
}
}

View File

@ -1,52 +0,0 @@
package org.jdownloader.gui.views.linkgrabber.contextmenu;
import java.awt.event.ActionEvent;
import jd.controlling.linkcrawler.CrawledLink;
import jd.controlling.linkcrawler.CrawledPackage;
import jd.plugins.DownloadLink;
import org.appwork.utils.os.CrossSystem;
import org.jdownloader.actions.AbstractSelectionContextAction;
import org.jdownloader.gui.translate._GUI;
import org.jdownloader.gui.views.SelectionInfo;
public class OpenUrlAction extends AbstractSelectionContextAction<CrawledPackage, CrawledLink> {
/**
*
*/
private static final long serialVersionUID = 1299668511027392364L;
private CrawledLink link;
@Override
public void setSelection(SelectionInfo<CrawledPackage, CrawledLink> selection) {
super.setSelection(selection);
if (getSelection() != null && getSelection().isLinkContext()) {
this.link = getSelection().getContextLink();
setVisible(true);
} else {
link = null;
setVisible(false);
}
}
public OpenUrlAction(SelectionInfo<CrawledPackage, CrawledLink> link) {
super(link);
setName(_GUI._.OpenUrlAction_OpenUrlAction_());
setIconKey("browse");
}
public void actionPerformed(ActionEvent e) {
if (!isEnabled()) return;
CrossSystem.openURL(link.getDownloadLink().getBrowserUrl());
}
@Override
public boolean isEnabled() {
return CrossSystem.isOpenBrowserSupported() && link != null && link.getDownloadLink() != null && (link.getDownloadLink().getLinkType() == DownloadLink.LINKTYPE_NORMAL || link.getDownloadLink().gotBrowserUrl());
}
}