Search in sources :

Example 11 with UISWTViewBuilderCore

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);
    }
}
Also used : UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore)

Example 12 with UISWTViewBuilderCore

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);
    }
}
Also used : SWTViewListener(com.biglybt.ui.swt.pifimpl.UISWTInstanceImpl.SWTViewListener) UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore)

Example 13 with UISWTViewBuilderCore

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);
}
Also used : PieceInfoView(com.biglybt.ui.swt.views.piece.PieceInfoView) UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore)

Example 14 with UISWTViewBuilderCore

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);
}
Also used : UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore) PieceInfoView(com.biglybt.ui.swt.views.piece.PieceInfoView) MyPieceDistributionView(com.biglybt.ui.swt.views.piece.MyPieceDistributionView)

Example 15 with UISWTViewBuilderCore

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();
    }
}
Also used : GridLayout(org.eclipse.swt.layout.GridLayout) UISWTViewImpl(com.biglybt.ui.swt.pifimpl.UISWTViewImpl) UISWTViewBuilderCore(com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore) Rectangle(org.eclipse.swt.graphics.Rectangle) Point(org.eclipse.swt.graphics.Point)

Aggregations

UISWTViewBuilderCore (com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore)33 ViewManagerSWT (com.biglybt.ui.swt.views.ViewManagerSWT)9 MultipleDocumentInterfaceSWT (com.biglybt.ui.swt.mdi.MultipleDocumentInterfaceSWT)5 DownloadManager (com.biglybt.core.download.DownloadManager)4 MenuItem (com.biglybt.pif.ui.menus.MenuItem)4 PluginInterface (com.biglybt.pif.PluginInterface)3 ViewTitleInfo (com.biglybt.ui.common.viewtitleinfo.ViewTitleInfo)3 Point (org.eclipse.swt.graphics.Point)3 Core (com.biglybt.core.Core)2 CoreFactory (com.biglybt.core.CoreFactory)2 CoreRunningListener (com.biglybt.core.CoreRunningListener)2 COConfigurationManager (com.biglybt.core.config.COConfigurationManager)2 ParameterListener (com.biglybt.core.config.ParameterListener)2 UnassociatedDevice (com.biglybt.core.devices.DeviceManager.UnassociatedDevice)2 DiskManagerFileInfoFile (com.biglybt.core.download.DiskManagerFileInfoFile)2 DiskManagerFileInfoURL (com.biglybt.core.download.DiskManagerFileInfoURL)2 MessageText (com.biglybt.core.internat.MessageText)2 com.biglybt.core.util (com.biglybt.core.util)2 PluginManager (com.biglybt.pif.PluginManager)2 Download (com.biglybt.pif.download.Download)2