use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class TableViewSWT_TabsCommon method buildFolder.
private void buildFolder(final Composite form, final String props_prefix) {
PluginInterface pi = PluginInitializer.getDefaultInterface();
UIManager uim = pi.getUIManager();
MenuManager menuManager = uim.getMenuManager();
menuItemShowTabs = menuManager.addMenuItem(props_prefix + "._end_", "ConfigView.section.style.ShowTabsInTorrentView");
menuItemShowTabs.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menuItemShowTabs.setStyle(MenuItem.STYLE_CHECK);
menuItemShowTabs.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setData(COConfigurationManager.getBooleanParameter("Library.ShowTabsInTorrentView"));
}
});
menuItemShowTabs.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
COConfigurationManager.setParameter("Library.ShowTabsInTorrentView", (Boolean) menu.getData());
}
});
cTabsHolder.addListener(SWT.Resize, new Listener() {
@Override
public void handleEvent(Event e) {
if (tabbedMDI.getMinimized()) {
fdHeightChanger.height = tabbedMDI.getFolderHeight();
cTabsHolder.getParent().layout();
return;
}
Double l = (Double) sash.getData("PCT");
if (l != null) {
int newHeight = (int) (form.getBounds().height * l.doubleValue());
if (newHeight != fdHeightChanger.height) {
fdHeightChanger.height = newHeight;
cTabsHolder.getParent().layout();
}
}
}
});
String[] restricted_to = tv.getTabViewsRestrictedTo();
Set<String> rt_set = new HashSet<>();
if (restricted_to != null) {
rt_set.addAll(Arrays.asList(restricted_to));
}
// Call plugin listeners
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null) {
UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
if (pluginUI != null) {
UISWTViewEventListenerWrapper[] pluginViews = pluginUI.getViewListeners(tv.getTableID());
if (pluginViews != null) {
for (final UISWTViewEventListenerWrapper l : pluginViews) {
if (l == null) {
continue;
}
try {
String view_id = l.getViewID();
if (restricted_to != null && !rt_set.contains(view_id)) {
continue;
}
tabbedMDI.registerEntry(view_id, new MdiEntryCreationListener2() {
@Override
public MdiEntry createMDiEntry(MultipleDocumentInterface mdi, String id, Object datasource, Map<?, ?> params) {
return addTabView(l, null);
}
});
tabbedMDI.loadEntryByID(view_id, false);
} catch (Exception e) {
// skip, plugin probably specifically asked to not be added
}
}
}
}
}
if (!tabbedMDI.getMinimized()) {
MdiEntry[] entries = tabbedMDI.getEntries();
if (entries.length > 0) {
tabbedMDI.showEntry(entries[0]);
}
}
}
use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class CategoryUIUtils method createMenuItems.
public static void createMenuItems(final Menu menu, final Category category) {
if (category.getType() == Category.TYPE_USER) {
final MenuItem itemDelete = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(itemDelete, "MyTorrentsView.menu.category.delete");
itemDelete.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
GlobalManager gm = CoreFactory.getSingleton().getGlobalManager();
List<DownloadManager> managers = category.getDownloadManagers(gm.getDownloadManagers());
// move to array,since setCategory removed it from the category,
// which would mess up our loop
DownloadManager[] dms = managers.toArray(new DownloadManager[managers.size()]);
for (DownloadManager dm : dms) {
DownloadManagerState state = dm.getDownloadState();
if (state != null) {
state.setCategory(null);
}
}
CategoryManager.removeCategory(category);
}
});
}
if (category.getType() != Category.TYPE_ALL) {
long kInB = DisplayFormatters.getKinB();
long maxDownload = COConfigurationManager.getIntParameter("Max Download Speed KBs", 0) * kInB;
long maxUpload = COConfigurationManager.getIntParameter("Max Upload Speed KBs", 0) * kInB;
int down_speed = category.getDownloadSpeed();
int up_speed = category.getUploadSpeed();
ViewUtils.addSpeedMenu(menu.getShell(), menu, true, true, true, true, false, down_speed == 0, down_speed, down_speed, maxDownload, false, up_speed == 0, up_speed, up_speed, maxUpload, 1, null, new SpeedAdapter() {
@Override
public void setDownSpeed(int val) {
category.setDownloadSpeed(val);
}
@Override
public void setUpSpeed(int val) {
category.setUploadSpeed(val);
}
});
}
GlobalManager gm = CoreFactory.getSingleton().getGlobalManager();
List<DownloadManager> managers = category.getDownloadManagers(gm.getDownloadManagers());
final DownloadManager[] dms = managers.toArray(new DownloadManager[managers.size()]);
boolean start = false;
boolean stop = false;
for (DownloadManager dm : dms) {
stop = stop || ManagerUtils.isStopable(dm);
start = start || ManagerUtils.isStartable(dm);
}
// Queue
final MenuItem itemQueue = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(itemQueue, "MyTorrentsView.menu.queue");
Utils.setMenuItemImage(itemQueue, "start");
itemQueue.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
GlobalManager gm = CoreFactory.getSingleton().getGlobalManager();
List<?> managers = category.getDownloadManagers(gm.getDownloadManagers());
Object[] dms = managers.toArray();
TorrentUtil.queueDataSources(dms, true);
}
});
itemQueue.setEnabled(start);
// Stop
final MenuItem itemStop = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(itemStop, "MyTorrentsView.menu.stop");
Utils.setMenuItemImage(itemStop, "stop");
itemStop.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
GlobalManager gm = CoreFactory.getSingleton().getGlobalManager();
List<?> managers = category.getDownloadManagers(gm.getDownloadManagers());
Object[] dms = managers.toArray();
TorrentUtil.stopDataSources(dms);
}
});
itemStop.setEnabled(stop);
if (category.canBePublic()) {
new MenuItem(menu, SWT.SEPARATOR);
final MenuItem itemPublic = new MenuItem(menu, SWT.CHECK);
itemPublic.setSelection(category.isPublic());
Messages.setLanguageText(itemPublic, "cat.share");
itemPublic.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
category.setPublic(itemPublic.getSelection());
}
});
}
// share with friends
PluginInterface bpi = PluginInitializer.getDefaultInterface().getPluginManager().getPluginInterfaceByClass(BuddyPlugin.class);
int cat_type = category.getType();
if (bpi != null && cat_type != Category.TYPE_UNCATEGORIZED) {
final BuddyPlugin buddy_plugin = (BuddyPlugin) bpi.getPlugin();
if (buddy_plugin.isClassicEnabled()) {
final Menu share_menu = new Menu(menu.getShell(), SWT.DROP_DOWN);
final MenuItem share_item = new MenuItem(menu, SWT.CASCADE);
Messages.setLanguageText(share_item, "azbuddy.ui.menu.cat.share");
share_item.setMenu(share_menu);
List<BuddyPluginBuddy> buddies = buddy_plugin.getBuddies();
if (buddies.size() == 0) {
final MenuItem item = new MenuItem(share_menu, SWT.CHECK);
item.setText(MessageText.getString("general.add.friends"));
item.setEnabled(false);
} else {
final String cname;
if (cat_type == Category.TYPE_ALL) {
cname = "All";
} else {
cname = category.getName();
}
final boolean is_public = buddy_plugin.isPublicTagOrCategory(cname);
final MenuItem itemPubCat = new MenuItem(share_menu, SWT.CHECK);
Messages.setLanguageText(itemPubCat, "general.all.friends");
itemPubCat.setSelection(is_public);
itemPubCat.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
if (is_public) {
buddy_plugin.removePublicTagOrCategory(cname);
} else {
buddy_plugin.addPublicTagOrCategory(cname);
}
}
});
new MenuItem(share_menu, SWT.SEPARATOR);
for (final BuddyPluginBuddy buddy : buddies) {
if (buddy.getNickName() == null) {
continue;
}
final boolean auth = buddy.isLocalRSSTagOrCategoryAuthorised(cname);
final MenuItem itemShare = new MenuItem(share_menu, SWT.CHECK);
itemShare.setText(buddy.getName());
itemShare.setSelection(auth || is_public);
if (is_public) {
itemShare.setEnabled(false);
}
itemShare.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
if (auth) {
buddy.removeLocalAuthorisedRSSTagOrCategory(cname);
} else {
buddy.addLocalAuthorisedRSSTagOrCategory(cname);
}
}
});
}
}
}
}
if (category.getType() != Category.TYPE_ALL) {
TrancodeUIUtils.TranscodeTarget[] tts = TrancodeUIUtils.getTranscodeTargets();
if (tts.length > 0) {
final Menu t_menu = new Menu(menu.getShell(), SWT.DROP_DOWN);
final MenuItem t_item = new MenuItem(menu, SWT.CASCADE);
Messages.setLanguageText(t_item, "cat.autoxcode");
t_item.setMenu(t_menu);
String existing = category.getStringAttribute(Category.AT_AUTO_TRANSCODE_TARGET);
for (TrancodeUIUtils.TranscodeTarget tt : tts) {
TrancodeUIUtils.TranscodeProfile[] profiles = tt.getProfiles();
if (profiles.length > 0) {
final Menu tt_menu = new Menu(t_menu.getShell(), SWT.DROP_DOWN);
final MenuItem tt_item = new MenuItem(t_menu, SWT.CASCADE);
tt_item.setText(tt.getName());
tt_item.setMenu(tt_menu);
for (final TrancodeUIUtils.TranscodeProfile tp : profiles) {
final MenuItem p_item = new MenuItem(tt_menu, SWT.CHECK);
p_item.setText(tp.getName());
boolean selected = existing != null && existing.equals(tp.getUID());
if (selected) {
Utils.setMenuItemImage(tt_item, "blacktick");
}
p_item.setSelection(selected);
p_item.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
category.setStringAttribute(Category.AT_AUTO_TRANSCODE_TARGET, p_item.getSelection() ? tp.getUID() : null);
}
});
}
}
}
}
}
// rss feed
final MenuItem rssOption = new MenuItem(menu, SWT.CHECK);
rssOption.setSelection(category.getBooleanAttribute(Category.AT_RSS_GEN));
Messages.setLanguageText(rssOption, "cat.rss.gen");
rssOption.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
boolean set = rssOption.getSelection();
category.setBooleanAttribute(Category.AT_RSS_GEN, set);
}
});
if (cat_type != Category.TYPE_UNCATEGORIZED && cat_type != Category.TYPE_ALL) {
final MenuItem upPriority = new MenuItem(menu, SWT.CHECK);
upPriority.setSelection(category.getIntAttribute(Category.AT_UPLOAD_PRIORITY) > 0);
Messages.setLanguageText(upPriority, "cat.upload.priority");
upPriority.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
boolean set = upPriority.getSelection();
category.setIntAttribute(Category.AT_UPLOAD_PRIORITY, set ? 1 : 0);
}
});
}
// options
MenuItem itemOptions = new MenuItem(menu, SWT.PUSH);
Messages.setLanguageText(itemOptions, "cat.options");
itemOptions.addListener(SWT.Selection, new Listener() {
@Override
public void handleEvent(Event event) {
UIFunctions uiFunctions = UIFunctionsManager.getUIFunctions();
if (uiFunctions != null) {
MultipleDocumentInterface mdi = uiFunctions.getMDI();
if (mdi != null) {
mdi.showEntryByID(MultipleDocumentInterface.SIDEBAR_SECTION_TORRENT_OPTIONS, dms);
}
}
}
});
if (dms.length == 0) {
itemOptions.setEnabled(false);
}
}
use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class SBC_ChatOverview method openChat.
public static void openChat(String network, String key) {
BuddyPluginBeta beta = BuddyPluginUtils.getBetaPlugin();
if (beta != null) {
try {
ChatInstance chat = beta.getChat(network, key);
chat.setAutoNotify(true);
MdiEntry mdi_entry = createChatMdiEntry(chat);
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
if (mdi != null) {
mdi.showEntry(mdi_entry);
}
} catch (Throwable e) {
Debug.out(e);
}
}
}
use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class MainWindowImpl method createWindow.
/**
* @param uiInitializer
*
* called in both delayedCore and !delayedCore
*/
private void createWindow(IUIIntializer uiInitializer) {
// System.out.println("MainWindow: createWindow)");
long startTime = SystemTime.getCurrentTime();
UIFunctionsSWT existing_uif = UIFunctionsManagerSWT.getUIFunctionsSWT();
uiFunctions = new UIFunctionsImpl(this);
UIFunctionsManager.setUIFunctions(uiFunctions);
Utils.disposeComposite(shell);
increaseProgress(uiInitializer, "splash.initializeGui");
System.out.println("UIFunctions/ImageLoad took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
shell = existing_uif == null ? new Shell(Utils.getDisplay(), SWT.SHELL_TRIM) : existing_uif.getMainShell();
if (Constants.isWindows) {
try {
Class<?> ehancerClass = Class.forName("com.biglybt.ui.swt.win32.Win32UIEnhancer");
Method method = ehancerClass.getMethod("initMainShell", Shell.class);
method.invoke(null, shell);
} catch (Exception e) {
Debug.outNoStack(Debug.getCompressedStackTrace(e, 0, 30), true);
}
}
try {
shell.setData("class", this);
shell.setText(UIFunctions.MAIN_WINDOW_NAME);
Utils.setShellIcon(shell);
Utils.linkShellMetricsToConfig(shell, "window");
// Shell activeShell = display.getActiveShell();
// shell.setVisible(true);
// shell.moveBelow(activeShell);
System.out.println("new shell took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
increaseProgress(uiInitializer, "v3.splash.initSkin");
skin = SWTSkinFactory.getInstance();
if (Utils.isAZ2UI()) {
SWTSkinProperties skinProperties = skin.getSkinProperties();
String skinPath = SkinPropertiesImpl.PATH_SKIN_DEFS + "skin3_classic";
ResourceBundle rb = ResourceBundle.getBundle(skinPath);
skinProperties.addResourceBundle(rb, skinPath);
}
/*
* KN: passing the skin to the uifunctions so it can be used by UIFunctionsSWT.createMenu()
*/
uiFunctions.setSkin(skin);
System.out.println("new shell setup took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
initSkinListeners();
increaseProgress(uiInitializer, "v3.splash.initSkin");
// 0ms
// System.out.println("skinlisteners init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
// startTime = SystemTime.getCurrentTime();
String startID = Utils.isAZ2UI() ? "classic.shell" : "main.shell";
skin.initialize(shell, startID, uiInitializer);
increaseProgress(uiInitializer, "v3.splash.initSkin");
System.out.println("skin init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
menu = uiFunctions.createMainMenu(shell);
shell.setData("MainMenu", menu);
System.out.println("MainMenu init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
increaseProgress(uiInitializer, "v3.splash.initSkin");
skin.layout();
try {
Utils.createTorrentDropTarget(shell, false);
} catch (Throwable e) {
Logger.log(new LogEvent(LOGID, "Drag and Drop not available", e));
}
shell.addDisposeListener(new DisposeListener() {
@Override
public void widgetDisposed(DisposeEvent e) {
if (configIconBarEnabledListener != null) {
COConfigurationManager.removeParameterListener("IconBar.enabled", configIconBarEnabledListener);
}
if (configShowStatusInTitleListener != null) {
COConfigurationManager.removeParameterListener("Show Status In Window Title", configShowStatusInTitleListener);
}
if (configShowDLBasketListener != null) {
COConfigurationManager.removeParameterListener("Show Download Basket", configShowDLBasketListener);
}
if (configMonitorClipboardListener != null) {
COConfigurationManager.removeParameterListener("Monitor Clipboard For Torrents", configMonitorClipboardListener);
}
if (gmListener != null) {
GlobalManager gm = core.getGlobalManager();
if (gm != null) {
gm.removeListener(gmListener);
}
gmListener = null;
}
if (uiFunctions != null) {
uiFunctions.dispose();
}
if (navigationListener != null) {
NavigationHelper.removeListener(navigationListener);
navigationListener = null;
}
StimulusRPC.unhookListeners();
UISkinnableManagerSWT skinnableManagerSWT = UISkinnableManagerSWT.getInstance();
skinnableManagerSWT.removeSkinnableListener(MessageBoxShell.class.toString(), uiSkinnableSWTListener);
// comment out: shell can dispose without us wanting core to be..
// dispose(false, false);
}
});
shell.addShellListener(new ShellAdapter() {
@Override
public void shellClosed(ShellEvent event) {
if (disposedOrDisposing) {
return;
}
if (COConfigurationManager.getBooleanParameter("Close To Tray") && ((systemTraySWT != null && COConfigurationManager.getBooleanParameter("Enable System Tray")) || COConfigurationManager.getBooleanParameter("System Tray Disabled Override"))) {
minimizeToTray(event);
} else {
event.doit = dispose(false, false);
}
}
@Override
public void shellActivated(ShellEvent e) {
Shell shellAppModal = Utils.findFirstShellWithStyle(SWT.APPLICATION_MODAL);
if (shellAppModal != null) {
shellAppModal.forceActive();
} else {
shell.forceActive();
}
}
@Override
public void shellIconified(ShellEvent event) {
if (disposedOrDisposing) {
return;
}
if (COConfigurationManager.getBooleanParameter("Minimize To Tray") && ((systemTraySWT != null && COConfigurationManager.getBooleanParameter("Enable System Tray")) || COConfigurationManager.getBooleanParameter("System Tray Disabled Override"))) {
minimizeToTray(event);
}
}
@Override
public void shellDeiconified(ShellEvent e) {
if (Constants.isOSX && COConfigurationManager.getBooleanParameter("Password enabled")) {
shell.setVisible(false);
if (PasswordWindow.showPasswordWindow(Utils.getDisplay())) {
shell.setVisible(true);
}
}
}
});
Utils.getDisplay().addFilter(SWT.KeyDown, new Listener() {
@Override
public void handleEvent(Event event) {
// Another window has control, skip filter
Control focus_control = event.display.getFocusControl();
if (focus_control != null && focus_control.getShell() != shell)
return;
int key = event.character;
if ((event.stateMask & SWT.MOD1) != 0 && event.character <= 26 && event.character > 0)
key += 'a' - 1;
if (key == 'l' && (event.stateMask & SWT.MOD1) != 0) {
// Ctrl-L: Open URL
if (core == null) {
return;
}
GlobalManager gm = core.getGlobalManager();
if (gm != null) {
UIFunctionsManagerSWT.getUIFunctionsSWT().openTorrentWindow();
event.doit = false;
}
} else if (key == 'd' && (event.stateMask & SWT.MOD1) != 0) {
// dump
if (Constants.isCVSVersion()) {
Utils.dump(shell);
}
} else if (key == 'f' && (event.stateMask & (SWT.MOD1 + SWT.SHIFT)) == SWT.MOD1 + SWT.SHIFT) {
shell.setFullScreen(!shell.getFullScreen());
} else if (event.keyCode == SWT.F1) {
Utils.launch(Constants.URL_WIKI);
}
}
});
increaseProgress(uiInitializer, "v3.splash.initSkin");
System.out.println("pre skin widgets init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
if (core != null) {
StimulusRPC.hookListeners(core, this);
}
increaseProgress(uiInitializer, "v3.splash.initSkin");
// 0ms
// System.out.println("hooks init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
// startTime = SystemTime.getCurrentTime();
initMDI();
System.out.println("skin widgets (1/2) init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
initWidgets2();
increaseProgress(uiInitializer, "v3.splash.initSkin");
System.out.println("skin widgets (2/2) init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
System.out.println("pre SWTInstance init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
increaseProgress(uiInitializer, "v3.splash.hookPluginUI");
startTime = SystemTime.getCurrentTime();
TableColumnCreatorV3.initCoreColumns();
System.out.println("Init Core Columns took " + (SystemTime.getCurrentTime() - startTime) + "ms");
increaseProgress(uiInitializer, "v3.splash.hookPluginUI");
startTime = SystemTime.getCurrentTime();
// attach the UI to plugins
// Must be done before initializing views, since plugins may register
// table columns and other objects
uiSWTInstanceImpl = new UISWTInstanceImpl();
uiSWTInstanceImpl.init(uiInitializer);
System.out.println("SWTInstance init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
increaseProgress(uiInitializer, "splash.initializeGui");
startTime = SystemTime.getCurrentTime();
} catch (Throwable t) {
Debug.out(t);
} finally {
String configID = SkinConstants.VIEWID_PLUGINBAR + ".visible";
if (!ConfigurationDefaults.getInstance().doesParameterDefaultExist(configID)) {
COConfigurationManager.setBooleanDefault(configID, true);
}
setVisible(WINDOW_ELEMENT_TOPBAR, COConfigurationManager.getBooleanParameter(configID) && COConfigurationManager.getIntParameter("User Mode") > 1);
setVisible(WINDOW_ELEMENT_TOOLBAR, COConfigurationManager.getBooleanParameter("IconBar.enabled"));
shell.layout(true, true);
System.out.println("shell.layout took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
showMainWindow();
// ================
increaseProgress(uiInitializer, "splash.initializeGui");
System.out.println("shell.open took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
processStartupDMS();
System.out.println("processStartupDMS took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
if (core != null) {
postPluginSetup(core);
}
System.out.println("postPluginSetup init took " + (SystemTime.getCurrentTime() - startTime) + "ms");
startTime = SystemTime.getCurrentTime();
navigationListener = new navigationListener() {
@Override
public void processCommand(final int type, final String[] args) {
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
UIFunctions uif = UIFunctionsManager.getUIFunctions();
if (type == NavigationHelper.COMMAND_SWITCH_TO_TAB) {
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
if (mdi == null) {
return;
}
mdi.showEntryByID(args[0]);
if (uif != null) {
uif.bringToFront();
}
} else if (type == NavigationHelper.COMMAND_CONDITION_CHECK) {
}
}
});
}
};
NavigationHelper.addListener(navigationListener);
if (!Constants.isOSX) {
configShowStatusInTitleListener = new ParameterListener() {
private TimerEventPeriodic timer;
private String old_text;
private String my_last_text;
@Override
public void parameterChanged(final String name) {
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
boolean enable = COConfigurationManager.getBooleanParameter(name);
if (enable) {
if (timer == null) {
timer = SimpleTimer.addPeriodicEvent("window.title.updater", 1000, new TimerEventPerformer() {
@Override
public void perform(TimerEvent event) {
Utils.execSWTThread(new AERunnable() {
@Override
public void runSupport() {
if (shell.isDisposed()) {
return;
}
String current_txt = shell.getText();
if (current_txt != null && !current_txt.equals(my_last_text)) {
old_text = current_txt;
}
String txt = getCurrentTitleText();
if (txt != null) {
if (!txt.equals(current_txt)) {
shell.setText(txt);
}
my_last_text = txt;
}
}
});
}
});
}
} else {
if (timer != null) {
timer.cancel();
timer = null;
}
if (old_text != null && !shell.isDisposed()) {
shell.setText(old_text);
}
}
}
});
}
};
COConfigurationManager.addAndFireParameterListener("Show Status In Window Title", configShowStatusInTitleListener);
}
}
}
use of com.biglybt.ui.mdi.MultipleDocumentInterface in project BiglyBT by BiglySoftware.
the class UIFunctionsImpl method closePluginViews.
// @see UIFunctionsSWT#closePluginViews(java.lang.String)
@Override
public void closePluginViews(String sViewID) {
try {
MultipleDocumentInterface mdi = UIFunctionsManager.getUIFunctions().getMDI();
if (mdi == null) {
return;
}
mdi.closeEntry(sViewID);
} catch (Exception e) {
Logger.log(new LogEvent(LOGID, "closePluginViews", e));
}
}
Aggregations