📄 mainwindow.java
字号:
final MainWindow this$0;
public void widgetDisposed(DisposeEvent e)
{
config = null;
config_view = null;
}
{
this$0 = MainWindow.this;
super();
}
});
} else
{
mainTabSet.setFocus(config);
refreshIconBar();
refreshTorrentMenu();
}
return config_view;
}
protected boolean showConfig(String id)
{
boolean has_rebuilt = config_view == null;
showConfig();
if (config_view == null)
return false;
if (id == null)
return true;
boolean result = config_view.selectSection(id);
if (!result && !has_rebuilt)
{
config.dispose();
if (config_view != null)
throw new RuntimeException("something has gone wrong");
else
return showConfig(id);
} else
{
return result;
}
}
protected void showConsole()
{
if (console == null)
{
console = mainTabSet.createTabItem(new LoggerView(events), true);
mainTabSet.getView(console).getComposite().addDisposeListener(new DisposeListener() {
final MainWindow this$0;
public void widgetDisposed(DisposeEvent e)
{
console = null;
}
{
this$0 = MainWindow.this;
super();
}
});
} else
{
mainTabSet.setFocus(console);
refreshIconBar();
refreshTorrentMenu();
}
}
protected void showStats()
{
if (stats_tab == null)
{
stats_tab = mainTabSet.createTabItem(new StatsView(globalManager, azureus_core), true);
mainTabSet.getView(stats_tab).getComposite().addDisposeListener(new DisposeListener() {
final MainWindow this$0;
public void widgetDisposed(DisposeEvent e)
{
stats_tab = null;
}
{
this$0 = MainWindow.this;
super();
}
});
} else
{
mainTabSet.setFocus(stats_tab);
refreshIconBar();
refreshTorrentMenu();
}
}
protected void showStatsDHT()
{
showStats();
if (stats_tab == null)
return;
IView view = mainTabSet.getView(stats_tab);
if (view instanceof StatsView)
((StatsView)view).showDHT();
}
protected void showStatsTransfers()
{
showStats();
if (stats_tab == null)
return;
IView view = mainTabSet.getView(stats_tab);
if (view instanceof StatsView)
((StatsView)view).showTransfers();
}
protected void setSelectedLanguageItem()
{
this_mon.enter();
Messages.updateLanguageForControl(shell);
if (systemTraySWT != null)
systemTraySWT.updateLanguage();
if (mainStatusBar != null)
mainStatusBar.refreshStatusText();
if (folder != null)
folder.update();
if (downloadBasket != null)
downloadBasket.updateLanguage();
mainTabSet.updateLanguage();
if (mainStatusBar != null)
mainStatusBar.updateStatusText();
if (mainMenu != null)
MenuFactory.updateMenuText(mainMenu.getMenu("menu.bar"));
this_mon.exit();
break MISSING_BLOCK_LABEL_133;
Exception exception;
exception;
this_mon.exit();
throw exception;
}
/**
* @deprecated Method getMenu is deprecated
*/
public MainMenu getMenu()
{
return (MainMenu)mainMenu;
}
/**
* @deprecated Method setMenu is deprecated
*/
public void setMenu(MainMenu menu)
{
mainMenu = menu;
}
public IMainMenu getMainMenu()
{
return mainMenu;
}
public void setMainMenu(IMainMenu menu)
{
mainMenu = menu;
}
protected AzureusCore getAzureusCore()
{
return azureus_core;
}
public void generate(IndentWriter writer)
{
writer.println("SWT UI");
writer.indent();
mainTabSet.generateDiagnostics(writer);
TableColumnManager.getInstance().generateDiagnostics(writer);
writer.exdent();
break MISSING_BLOCK_LABEL_40;
Exception exception;
exception;
writer.exdent();
throw exception;
}
private void checkForWhatsNewWindow()
{
String CONFIG_LASTSHOWN = "welcome.version.lastshown";
try
{
String lastShown = "";
boolean bIsStringParam = true;
try
{
lastShown = COConfigurationManager.getStringParameter("welcome.version.lastshown", "");
}
catch (Exception e)
{
bIsStringParam = false;
}
if (lastShown.length() == 0)
{
int latestDisplayed = COConfigurationManager.getIntParameter("welcome.version.lastshown", 0);
if (latestDisplayed > 0)
{
bIsStringParam = false;
String s = (new StringBuilder()).append("").append(latestDisplayed).toString();
for (int i = 0; i < s.length(); i++)
{
if (i != 0)
lastShown = (new StringBuilder()).append(lastShown).append(".").toString();
lastShown = (new StringBuilder()).append(lastShown).append(s.charAt(i)).toString();
}
}
}
if (Constants.compareVersions(lastShown, Constants.getBaseVersion()) < 0)
{
new WelcomeWindow(shell);
if (!bIsStringParam)
COConfigurationManager.removeParameter("welcome.version.lastshown");
COConfigurationManager.setParameter("welcome.version.lastshown", Constants.getBaseVersion());
COConfigurationManager.save();
}
}
catch (Exception e)
{
Debug.out(e);
}
}
protected UISWTInstanceImpl getUISWTInstanceImpl()
{
return uiSWTInstanceImpl;
}
protected void setStatusText(String string)
{
if (mainStatusBar != null)
mainStatusBar.setStatusText(string);
}
protected void setStatusText(int statustype, String string, UIStatusTextClickListener l)
{
if (mainStatusBar != null)
mainStatusBar.setStatusText(statustype, string, l);
}
protected SystemTraySWT getSystemTraySWT()
{
return systemTraySWT;
}
protected MainStatusBar getMainStatusBar()
{
return mainStatusBar;
}
public Image generateObfusticatedImage()
{
Image image;
IView allViews[];
Rectangle clientArea;
GC gc;
allViews = mainTabSet.getAllViews();
for (int i = 0; i < allViews.length; i++)
{
IView view = allViews[i];
if (view instanceof ObfusticateTab)
{
Item tab = mainTabSet.getTab(view);
tab.setText(((ObfusticateTab)view).getObfusticatedHeader());
folder.update();
}
}
clientArea = shell.getClientArea();
image = new Image(display, clientArea.width, clientArea.height);
gc = new GC(shell);
gc.copyArea(image, clientArea.x, clientArea.y);
gc.dispose();
break MISSING_BLOCK_LABEL_141;
Exception exception;
exception;
gc.dispose();
throw exception;
IView currentView = getCurrentView();
if (currentView instanceof ObfusticateImage)
{
Point ofs = shell.toDisplay(clientArea.x, clientArea.y);
try
{
((ObfusticateImage)currentView).obfusticatedImage(image, ofs);
}
catch (Exception e)
{
Debug.out((new StringBuilder()).append("Obfusticating ").append(currentView).toString(), e);
}
}
for (int i = 0; i < allViews.length; i++)
{
IView view = allViews[i];
if (view instanceof ObfusticateTab)
view.refresh();
}
return image;
}
private static Point getStoredWindowSize()
{
Point size = null;
boolean isMaximized = COConfigurationManager.getBooleanParameter("window.maximized", false);
if (isMaximized)
{
Monitor monitor = SWTThread.getInstance().getPrimaryMonitor();
if (Utils.isThisThreadSWT() && window != null && window.getShell() != null && !window.getShell().isDisposed())
monitor = window.getShell().getMonitor();
if (monitor != null)
{
Rectangle clientArea = monitor.getClientArea();
size = new Point(clientArea.width, clientArea.height);
return size;
}
}
String windowRectangle = COConfigurationManager.getStringParameter("window.rectangle", null);
if (windowRectangle != null)
{
String values[] = windowRectangle.split(",");
if (values.length == 4)
try
{
size = new Point(Integer.parseInt(values[2]), Integer.parseInt(values[3]));
}
catch (Exception e) { }
}
return size;
}
public static void addToVersionCheckMessage(Map map)
{
Point size;
size = getStoredWindowSize();
if (size == null)
return;
try
{
map.put("mainwindow.w", new Long(size.x));
map.put("mainwindow.h", new Long(size.y));
}
catch (Throwable e)
{
e.printStackTrace();
}
return;
}
public UIFunctionsSWT getUIFunctions()
{
return uiFunctions;
}
public boolean isVisible(int windowElement)
{
if (windowElement == 2)
return bIconBarEnabled;
if (windowElement != 3)
if (windowElement != 1);
return true;
}
public void setVisible(int windowElement, boolean value)
{
if (windowElement == 2)
setIconBarEnabled(value);
else
if (windowElement != 3)
if (windowElement != 1);
}
public Rectangle getMetrics(int windowElement)
{
if (windowElement == 2)
{
if (null != iconBar && null != iconBar.getComposite())
return iconBar.getComposite().getBounds();
} else
{
if (windowElement == 3)
return mainStatusBar.getBounds();
if (windowElement != 4 && windowElement != 5)
{
if (windowElement == 6)
return shell.getClientArea();
if (windowElement == 7)
{
Rectangle r = shell.getClientArea();
r.x += iconBar.getComposite().getBounds().x;
r.height -= iconBar.getComposite().getBounds().height;
r.height -= mainStatusBar.getBounds().height;
return r;
}
}
}
return new Rectangle(0, 0, 0, 0);
}
public void closeAllDetails()
{
if (mainTabSet != null)
mainTabSet.closeAllDetails();
}
public boolean hasDetailViews()
{
if (mainTabSet != null)
return mainTabSet.hasDetails();
else
return false;
}
public Tab getMainTabSet()
{
return mainTabSet;
}
static
{
LOGID = LogIDs.GUI;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -