use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class ViewManagerSWT method addSWTViewListener.
public void addSWTViewListener(SWTViewListener l) {
listSWTViewListeners.add(l);
List<UISWTViewBuilderCore> builders = getBuilders(UISWTInstance.VIEW_MAIN);
for (UISWTViewBuilderCore builder : builders) {
l.setViewRegistered(UISWTInstance.VIEW_MAIN, builder);
}
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class ViewManagerSWT method registerView.
public void registerView(Object forDSTypeOrViewID, UISWTViewBuilderCore builder) {
boolean skipWarning = false;
if (forDSTypeOrViewID == null) {
forDSTypeOrViewID = UISWTInstance.VIEW_MAIN;
} else if (forDSTypeOrViewID instanceof String) {
// Legacy convert. Older plugins registered for a parent viewid when
// they really want to be in all views with a certain datasource type.
// Example, registering to VIEW_MYTORRENTS when they are usefull in all
// Download.class type views
Class<?> cla = mapViewIDToClass((String) forDSTypeOrViewID);
if (cla != null) {
forDSTypeOrViewID = cla;
skipWarning = true;
}
}
synchronized (mapDataSourceTypeToBuilder) {
Map<String, UISWTViewBuilderCore> builderMap = getBuilderMap(forDSTypeOrViewID);
UISWTViewBuilderCore existingBuilder = builderMap.put(builder.getViewID(), builder);
if (existingBuilder != null && existingBuilder != builder && !skipWarning) {
Debug.out("Overiding already registered view '" + builder.getViewID() + "' for " + forDSTypeOrViewID);
}
}
SWTViewListener[] viewListeners = listSWTViewListeners.toArray(new SWTViewListener[0]);
for (SWTViewListener l : viewListeners) {
l.setViewRegistered(forDSTypeOrViewID, builder);
}
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class MyTorrentsView method registerPluginViews.
public static void registerPluginViews() {
// Registering for Download.class implicitly includes DownloadTypeIncomplete and DownloadTypeComplete
ViewManagerSWT vm = ViewManagerSWT.getInstance();
if (vm.areCoreViewsRegistered(Download.class)) {
return;
}
vm.registerView(Download.class, new UISWTViewBuilderCore(GeneralView.MSGID_PREFIX, null, GeneralView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(FilesView.MSGID_PREFIX, null, FilesView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(TaggingView.MSGID_PREFIX, null, TaggingView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(TorrentOptionsView.MSGID_PREFIX, null, TorrentOptionsView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(TrackerView.MSGID_PREFIX, null, TrackerView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(PeersView.MSGID_PREFIX, null, PeersView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(PeersGraphicView.MSGID_PREFIX, null, PeersGraphicView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(PiecesView.MSGID_PREFIX, null, PiecesView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(PieceInfoView.MSGID_PREFIX, null, PieceInfoView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(DownloadActivityView.MSGID_PREFIX, null, DownloadActivityView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(TorrentInfoView.MSGID_PREFIX, null, TorrentInfoView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(PrivacyView.MSGID_PREFIX, null, PrivacyView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(LoggerView.MSGID_PREFIX, null, LoggerView.class));
vm.registerView(Download.class, new UISWTViewBuilderCore(DownloadXferStatsView.MSGID_PREFIX, null, DownloadXferStatsView.class));
vm.setCoreViewsRegistered(Download.class);
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class PiecesViewBase method registerPluginViews.
private static void registerPluginViews() {
ViewManagerSWT vm = ViewManagerSWT.getInstance();
if (vm.areCoreViewsRegistered(PLUGIN_DS_TYPE)) {
return;
}
vm.registerView(PLUGIN_DS_TYPE, new UISWTViewBuilderCore(PieceInfoView.MSGID_PREFIX, null, PieceInfoView.class));
vm.registerView(PLUGIN_DS_TYPE, new UISWTViewBuilderCore("MyPieceDistributionView", null, MyPieceDistributionView.class));
vm.setCoreViewsRegistered(PLUGIN_DS_TYPE);
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class ConfigShell method swt_open.
public void swt_open(String section) {
if (null != shell && !shell.isDisposed()) {
if (swtView != null) {
swtView.setDatasource(section);
}
if (shell.getMinimized()) {
shell.setMinimized(false);
}
shell.forceActive();
shell.forceFocus();
} else {
shell = ShellFactory.createMainShell(SWT.SHELL_TRIM & ~SWT.MIN);
shell.setLayout(new GridLayout());
shell.setText(MessageText.getString("ConfigView.title.full"));
Utils.setShellIcon(shell);
try {
UISWTViewBuilderCore builder = new UISWTViewBuilderCore(MultipleDocumentInterface.SIDEBAR_SECTION_CONFIG, null, ConfigView.class).setInitialDatasource(section);
swtView = new UISWTViewImpl(builder, true);
swtView.setDestroyOnDeactivate(false);
swtView.initialize(shell);
} catch (Exception e1) {
Debug.out(e1);
}
/*
* Set default size and centers the shell if it's configuration does not exist yet
*/
if (null == COConfigurationManager.getStringParameter("options.rectangle", null)) {
Rectangle shellBounds = shell.getMonitor().getBounds();
Point size = new Point(shellBounds.width * 10 / 11, shellBounds.height * 10 / 11);
if (size.x > 1400) {
size.x = 1400;
}
if (size.y > 700) {
size.y = 700;
}
shell.setSize(size);
Utils.centerWindowRelativeTo(shell, Utils.findAnyShell(true));
}
// noinspection DuplicateStringLiteralInspection
Utils.linkShellMetricsToConfig(shell, "options");
shell.addTraverseListener(e -> {
if (e.detail == SWT.TRAVERSE_ESCAPE) {
shell.dispose();
}
});
shell.addDisposeListener(arg0 -> close());
shell.open();
}
}
Aggregations