📄 uiswtinstanceimpl.java
字号:
case 19: // '\023'
{
MenuItem item = (MenuItem)data;
MenuItemManager.getInstance().removeMenuItem(item);
break;
}
case 13: // '\r'
{
event.setResult(new Boolean(false));
if (data instanceof String)
{
event.setResult(Boolean.TRUE);
uiFunctions.openView(4, data);
}
break;
}
case 24: // '\030'
{
File file_to_use = (File)data;
Utils.launch(file_to_use.getAbsolutePath());
break;
}
case 23: // '\027'
{
File file_to_use = (File)data;
boolean use_open_containing_folder = COConfigurationManager.getBooleanParameter("MyTorrentsView.menu.show_parent_folder_enabled");
ManagerUtils.open(file_to_use, use_open_containing_folder);
break;
}
case 14: // '\016'
case 16: // '\020'
case 18: // '\022'
case 20: // '\024'
default:
{
done = false;
break;
}
}
return done;
}
public Display getDisplay()
{
return SWTThread.getInstance().getDisplay();
}
public Image loadImage(String resource)
{
throw new RuntimeException("plugin specific instance required");
}
protected Image loadImage(PluginInterface pi, String res)
{
java.io.InputStream is = pi.getPluginClassLoader().getResourceAsStream(res);
if (is != null)
{
ImageData imageData = new ImageData(is);
return new Image(getDisplay(), imageData);
} else
{
return null;
}
}
public UISWTGraphic createGraphic(Image img)
{
return new UISWTGraphicImpl(img);
}
/**
* @deprecated Method addView is deprecated
*/
public void addView(UISWTPluginView view, boolean bAutoOpen)
{
try
{
uiFunctions.addPluginView(view);
if (bAutoOpen)
uiFunctions.openPluginView(view);
}
catch (Throwable e) { }
}
public void removeView(UISWTPluginView view)
{
try
{
uiFunctions.removePluginView(view);
}
catch (Throwable e) { }
}
/**
* @deprecated Method addView is deprecated
*/
public void addView(UISWTAWTPluginView view, boolean auto_open)
{
final WeakReference view_ref = new WeakReference(view);
UISWTPluginView v = new UISWTPluginView() {
Composite composite;
Component component;
boolean first_paint;
final WeakReference val$view_ref;
final UISWTInstanceImpl this$0;
public String getPluginViewName()
{
return ((UISWTAWTPluginView)view_ref.get()).getPluginViewName();
}
public String getFullTitle()
{
return ((UISWTAWTPluginView)view_ref.get()).getPluginViewName();
}
public void initialize(Composite _composite)
{
first_paint = true;
composite = _composite;
Composite frame_composite = new Composite(composite, 0x1000000);
GridData data = new GridData(1808);
frame_composite.setLayoutData(data);
Frame f = SWT_AWT.new_Frame(frame_composite);
BorderLayout layout = new BorderLayout() {
final 4 this$1;
public void layoutContainer(Container parent)
{
super.layoutContainer(parent);
if (first_paint)
{
first_paint = false;
((UISWTAWTPluginView)view_ref.get()).open(component);
}
break MISSING_BLOCK_LABEL_97;
Exception exception;
exception;
if (first_paint)
{
first_paint = false;
((UISWTAWTPluginView)view_ref.get()).open(component);
}
throw exception;
}
{
this$1 = 4.this;
super();
}
};
Panel pan = new Panel(layout);
f.add(pan);
component = ((UISWTAWTPluginView)view_ref.get()).create();
pan.add(component, "Center");
}
public Composite getComposite()
{
return composite;
}
public void delete()
{
super.delete();
((UISWTAWTPluginView)view_ref.get()).delete(component);
}
{
this$0 = UISWTInstanceImpl.this;
view_ref = weakreference;
super();
first_paint = true;
}
};
awt_view_map.put(view, v);
addView(v, auto_open);
}
public void removeView(UISWTAWTPluginView view)
{
UISWTPluginView v = (UISWTPluginView)awt_view_map.remove(view);
if (v != null)
removeView(v);
}
public void detach()
throws UIException
{
throw new UIException("not supported");
}
public void addView(String sParentID, final String sViewID, final UISWTViewEventListener l)
{
Map subViews = (Map)views.get(sParentID);
if (subViews == null)
{
subViews = new HashMap();
views.put(sParentID, subViews);
}
subViews.put(sViewID, l);
if (sParentID.equals("Main"))
Utils.execSWTThread(new AERunnable() {
final String val$sViewID;
final UISWTViewEventListener val$l;
final UISWTInstanceImpl this$0;
public void runSupport()
{
try
{
uiFunctions.addPluginView(sViewID, l);
}
catch (Throwable e) { }
}
{
this$0 = UISWTInstanceImpl.this;
sViewID = s;
l = uiswtvieweventlistener;
super();
}
});
}
public void removeViews(String sParentID, final String sViewID)
{
Map subViews = (Map)views.get(sParentID);
if (subViews == null)
return;
if (sParentID.equals("Main"))
Utils.execSWTThread(new AERunnable() {
final String val$sViewID;
final UISWTInstanceImpl this$0;
public void runSupport()
{
try
{
if (uiFunctions != null)
uiFunctions.removePluginView(sViewID);
}
catch (Throwable e) { }
}
{
this$0 = UISWTInstanceImpl.this;
sViewID = s;
super();
}
});
subViews.remove(sViewID);
}
public boolean openView(String sParentID, String sViewID, Object dataSource)
{
return openView(sParentID, sViewID, dataSource, true);
}
public boolean openView(final String sParentID, final String sViewID, final Object dataSource, final boolean setfocus)
{
Map subViews = (Map)views.get(sParentID);
if (subViews == null)
return false;
final UISWTViewEventListener l = (UISWTViewEventListener)subViews.get(sViewID);
if (l == null)
{
return false;
} else
{
Utils.execSWTThread(new AERunnable() {
final String val$sParentID;
final String val$sViewID;
final UISWTViewEventListener val$l;
final Object val$dataSource;
final boolean val$setfocus;
final UISWTInstanceImpl this$0;
public void runSupport()
{
if (uiFunctions != null)
uiFunctions.openPluginView(sParentID, sViewID, l, dataSource, setfocus && !bUIAttaching);
}
{
this$0 = UISWTInstanceImpl.this;
sParentID = s;
sViewID = s1;
l = uiswtvieweventlistener;
dataSource = obj;
setfocus = flag;
super();
}
});
return true;
}
}
public void openMainView(String sViewID, UISWTViewEventListener l, Object dataSource)
{
openMainView(sViewID, l, dataSource, true);
}
public void openMainView(final String sViewID, final UISWTViewEventListener l, final Object dataSource, final boolean setfocus)
{
Utils.execSWTThread(new AERunnable() {
final String val$sViewID;
final UISWTViewEventListener val$l;
final Object val$dataSource;
final boolean val$setfocus;
final UISWTInstanceImpl this$0;
public void runSupport()
{
if (uiFunctions != null)
uiFunctions.openPluginView("Main", sViewID, l, dataSource, setfocus && !bUIAttaching);
}
{
this$0 = UISWTInstanceImpl.this;
sViewID = s;
l = uiswtvieweventlistener;
dataSource = obj;
setfocus = flag;
super();
}
});
}
public UISWTView[] getOpenViews(String sParentID)
{
if (!sParentID.equals("Main"))
break MISSING_BLOCK_LABEL_30;
if (uiFunctions != null)
return uiFunctions.getPluginViews();
break MISSING_BLOCK_LABEL_30;
Throwable e;
e;
return new UISWTView[0];
}
public int promptUser(String title, String text, String options[], int defaultOption)
{
return MessageBoxShell.open(uiFunctions.getMainShell(), title, text, options, defaultOption);
}
public void showDownloadBar(Download download, final boolean display)
{
if (!(download instanceof DownloadImpl))
return;
final DownloadManager dm = ((DownloadImpl)download).getDownload();
if (dm == null)
{
return;
} else
{
Utils.execSWTThread(new AERunnable() {
final boolean val$display;
final DownloadManager val$dm;
final UISWTInstanceImpl this$0;
public void runSupport()
{
if (display)
DownloadBar.open(dm, getDisplay().getActiveShell());
else
DownloadBar.close(dm);
}
{
this$0 = UISWTInstanceImpl.this;
display = flag;
dm = downloadmanager;
super();
}
}, false);
return;
}
}
public void showTransfersBar(final boolean display)
{
Utils.execSWTThread(new AERunnable() {
final boolean val$display;
final UISWTInstanceImpl this$0;
public void runSupport()
{
if (display)
AllTransfersBar.open(core.getGlobalManager(), getDisplay().getActiveShell());
else
AllTransfersBar.close(core.getGlobalManager());
}
{
this$0 = UISWTInstanceImpl.this;
display = flag;
super();
}
}, false);
}
public Map getViewListeners(String sParentID)
{
return (Map)views.get(sParentID);
}
public Map getAllViews()
{
return views;
}
public UIInputReceiver getInputReceiver()
{
return new SimpleTextEntryWindow(getDisplay());
}
public UIMessage createMessage()
{
return new UIMessageImpl();
}
public UISWTStatusEntry createStatusEntry()
{
final UISWTStatusEntryImpl entry = new UISWTStatusEntryImpl();
UIFunctionsSWT functionsSWT = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (functionsSWT == null)
return null;
MainStatusBar mainStatusBar = functionsSWT.getMainStatusBar();
if (mainStatusBar == null)
{
return null;
} else
{
final CLabel label = mainStatusBar.createStatusEntry(entry);
final Listener click_listener = new Listener() {
final UISWTStatusEntryImpl val$entry;
final UISWTInstanceImpl this$0;
public void handleEvent(Event e)
{
entry.onClick();
}
{
this$0 = UISWTInstanceImpl.this;
entry = uiswtstatusentryimpl;
super();
}
};
Utils.execSWTThread(new AERunnable() {
final CLabel val$label;
final Listener val$click_listener;
final UISWTInstanceImpl this$0;
public void runSupport()
{
label.addListener(8, click_listener);
}
{
this$0 = UISWTInstanceImpl.this;
label = clabel;
click_listener = listener;
super();
}
}, true);
return entry;
}
}
public boolean openView(BasicPluginViewModel model)
{
return openView("Main", model.getName().replaceAll(" ", "."), null);
}
public void openConfig(final BasicPluginConfigModel model)
{
Utils.execSWTThread(new Runnable() {
final BasicPluginConfigModel val$model;
final UISWTInstanceImpl this$0;
public void run()
{
uiFunctions.openView(4, model.getSection());
}
{
this$0 = UISWTInstanceImpl.this;
model = basicpluginconfigmodel;
super();
}
});
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -