use of com.biglybt.ui.swt.UIFunctionsSWT in project BiglyBT by BiglySoftware.
the class TrackerView method initYourTableView.
@Override
public TableViewSWT<TrackerPeerSource> initYourTableView() {
tv = TableViewFactory.createTableViewSWT(TrackerPeerSource.class, TableManager.TABLE_TORRENT_TRACKERS, getPropertiesPrefix(), basicItems, basicItems[0].getName(), SWT.MULTI | SWT.FULL_SELECTION | SWT.VIRTUAL);
tv.addLifeCycleListener(this);
tv.addMenuFillListener(this);
tv.addTableDataSourceChangedListener(this, true);
tv.addSelectionListener(this, false);
tv.addKeyListener(new KeyAdapter() {
@Override
public void keyPressed(KeyEvent e) {
if (e.stateMask == 0 && e.keyCode == SWT.DEL) {
Object[] datasources = tv.getSelectedDataSources().toArray();
List<TrackerPeerSource> pss = new ArrayList<>();
String str = "";
for (Object object : datasources) {
TrackerPeerSource ps = (TrackerPeerSource) object;
if (ps.canDelete()) {
pss.add(ps);
str += (str.isEmpty() ? "" : ", ") + ps.getName();
}
}
if (!pss.isEmpty()) {
MessageBoxShell mb = new MessageBoxShell(MessageText.getString("message.confirm.delete.title"), MessageText.getString("message.confirm.delete.text", new String[] { str }), new String[] { MessageText.getString("Button.yes"), MessageText.getString("Button.no") }, 1);
mb.open(new UserPrompterResultListener() {
@Override
public void prompterClosed(int result) {
if (result == 0) {
for (TrackerPeerSource ps : pss) {
ps.delete();
}
}
}
});
}
e.doit = false;
}
}
});
tv.setEnableTabViews(enable_tabs, true, null);
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null) {
UISWTInstance pluginUI = uiFunctions.getUISWTInstance();
registerPluginViews(pluginUI);
}
return tv;
}
use of com.biglybt.ui.swt.UIFunctionsSWT in project BiglyBT by BiglySoftware.
the class UpdateWindow method finishUpdate.
private void finishUpdate(boolean restartNow, boolean just_close) {
// When completing, remove the link in mainWindow :
UIFunctionsSWT functionsSWT = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (functionsSWT != null) {
IMainStatusBar mainStatusBar = functionsSWT.getMainStatusBar();
if (mainStatusBar != null) {
mainStatusBar.setUpdateNeeded(null);
}
}
boolean bDisposeUpdateWindow = true;
if (!just_close) {
// If restart is required, then restart
if (restartRequired && restartNow) {
// this HAS to be done this way around else the restart inherits
// the instance port listen. However, this is a general problem....
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null && uiFunctions.dispose(true, false)) {
bDisposeUpdateWindow = false;
}
} else if (hasMandatoryUpdates && !restartRequired) {
// run a further update check as we can immediately install non-mandatory updates now
update_monitor.requestRecheck();
}
}
if (bDisposeUpdateWindow) {
updateWindow.dispose();
}
}
use of com.biglybt.ui.swt.UIFunctionsSWT in project BiglyBT by BiglySoftware.
the class ConfigListener method checkForUpdates.
/**
* @since 3.0.5.3
*/
public static void checkForUpdates() {
UIFunctionsSWT uiFunctions = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctions != null) {
uiFunctions.bringToFront();
}
CoreFactory.addCoreRunningListener(new CoreRunningListener() {
@Override
public void coreRunning(Core core) {
UpdateMonitor.getSingleton(core).performCheck(true, false, false, null);
}
});
}
use of com.biglybt.ui.swt.UIFunctionsSWT in project BiglyBT by BiglySoftware.
the class DeviceTemplateChooser method createDeviceTemplateList2.
private void createDeviceTemplateList2(SWTSkinObjectContainer soList) {
DeviceTemplate[] devices = mf.getDeviceTemplates();
if (devices.length == 0) {
noDevices();
return;
}
Arrays.sort(devices, new Comparator<DeviceTemplate>() {
@Override
public int compare(DeviceTemplate o1, DeviceTemplate o2) {
return o1.getName().compareToIgnoreCase(o2.getName());
}
});
Composite parent = soList.getComposite();
if (parent.getChildren().length > 0) {
Utils.disposeComposite(parent, false);
}
SWTSkin skin = skinnedDialog.getSkin();
RowLayout layout = new RowLayout(SWT.HORIZONTAL);
layout.spacing = 0;
layout.marginLeft = layout.marginRight = 0;
layout.wrap = true;
layout.justify = true;
layout.fill = true;
parent.setLayout(layout);
Listener clickListener = new Listener() {
boolean down = false;
@Override
public void handleEvent(Event event) {
if (event.type == SWT.MouseDown) {
down = true;
} else if (event.type == SWT.MouseUp && down) {
Widget widget = (event.widget instanceof Label) ? ((Label) event.widget).getParent() : event.widget;
selectedDeviceTemplate = (DeviceTemplate) widget.getData("obj");
if (selectedDeviceTemplate == null) {
Debug.out("selectedDeviceTemplate is null!");
}
skinnedDialog.close();
down = false;
}
}
};
for (DeviceTemplate deviceTemplate : devices) {
if (deviceTemplate.isAuto()) {
continue;
}
// deviceTemplate.getIconURL();
String iconURL = null;
TranscodeChooser.addImageBox(parent, clickListener, null, deviceTemplate, iconURL, deviceTemplate.getName());
}
SWTSkinObjectText soTitle = (SWTSkinObjectText) skin.getSkinObject("title");
if (soTitle != null) {
soTitle.setTextID("devices.choose.device.title");
}
SWTSkinObjectText soSubTitle = (SWTSkinObjectText) skin.getSkinObject("subtitle");
if (soSubTitle != null) {
soSubTitle.setTextID("label.clickone");
}
Shell shell = skinnedDialog.getShell();
Point computeSize = shell.computeSize(shell.getSize().x, SWT.DEFAULT, true);
shell.setSize(computeSize);
UIFunctionsSWT uiFunctionsSWT = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uiFunctionsSWT != null) {
Shell mainShell = uiFunctionsSWT.getMainShell();
Utils.centerWindowRelativeTo(shell, mainShell);
}
}
use of com.biglybt.ui.swt.UIFunctionsSWT in project BiglyBT by BiglySoftware.
the class BaseMdiEntry method show.
public void show() {
if (skinObject == null) {
return;
}
SelectedContentManager.clearCurrentlySelectedContent();
UIFunctionsSWT uif = UIFunctionsManagerSWT.getUIFunctionsSWT();
if (uif != null) {
// uif.refreshIconBar(); // needed?
uif.refreshTorrentMenu();
}
SWTSkinObject skinObject = getSkinObjectMaster();
skinObject.setVisible(true);
if (skinObject instanceof SWTSkinObjectContainer) {
SWTSkinObjectContainer container = (SWTSkinObjectContainer) skinObject;
Composite composite = container.getComposite();
if (composite != null && !composite.isDisposed()) {
composite.setVisible(true);
composite.moveAbove(null);
// composite.setFocus();
// container.getParent().relayout();
composite.getParent().layout();
}
// This causes double show because createSkinObject already calls show
// container.triggerListeners(SWTSkinObjectListener.EVENT_SHOW);
}
Composite c = getComposite();
if (c != null && !c.isDisposed()) {
c.setData("BaseMDIEntry", this);
c.setVisible(true);
c.getParent().layout();
}
try {
// In theory, c.setVisible() will trigger TYPE_FOCUSGAINED, but let's
// call it anyway (it will be ignored if focus is already gained)
triggerEvent(UISWTViewEvent.TYPE_FOCUSGAINED, null);
} catch (Exception e) {
Debug.out(e);
}
setToolbarVisibility(hasToolbarEnableers());
}
Aggregations