use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class SBC_ArchivedDownloadsView method registerPluginViews.
private static void registerPluginViews() {
ViewManagerSWT vm = ViewManagerSWT.getInstance();
if (vm.areCoreViewsRegistered(PLUGIN_DS_TYPE)) {
return;
}
vm.registerView(PLUGIN_DS_TYPE, new UISWTViewBuilderCore(ArchivedFilesView.MSGID_PREFIX, null, ArchivedFilesView.class));
vm.setCoreViewsRegistered(PLUGIN_DS_TYPE);
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class PeersViewBase method registerPluginViews.
private static void registerPluginViews() {
ViewManagerSWT vm = ViewManagerSWT.getInstance();
if (vm.areCoreViewsRegistered(PLUGIN_DS_TYPE)) {
return;
}
vm.registerView(PLUGIN_DS_TYPE, new UISWTViewBuilderCore("PeerInfoView", null, PeerInfoView.class));
vm.registerView(PLUGIN_DS_TYPE, new UISWTViewBuilderCore("RemotePieceDistributionView", null, RemotePieceDistributionView.class));
vm.registerView(PLUGIN_DS_TYPE, new UISWTViewBuilderCore(PeerFilesView.MSGID_PREFIX, null, PeerFilesView.class));
vm.registerView(PLUGIN_DS_TYPE, new UISWTViewBuilderCore(LoggerView.VIEW_ID, null, LoggerView.class).setInitialDatasource(true));
vm.setCoreViewsRegistered(PLUGIN_DS_TYPE);
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class ViewManagerSWT method disposeViews.
/**
* Disposes of existing views. Does not dispose of builder, which means new
* views can still be created. To prevent new views being created use
* {@link #unregisterView(Object, String)}
*
* @param parentViewID null for all
* @param viewID view id to dispose of
* @param unregister <br/>
* true: disposes of builder, preventing new views being created<br/>
* false: Keeps builder, allows new views to be created.
* @return Builders that had their views disposed of
*/
public List<UISWTViewBuilderCore> disposeViews(Object forDSTypeOrViewID, String viewID, boolean unregister) {
List<UISWTViewBuilderCore> listDisposeViewsIn = new ArrayList<>();
synchronized (mapDataSourceTypeToBuilder) {
if (forDSTypeOrViewID == null) {
for (Map<String, UISWTViewBuilderCore> mapViewIDtoBuilder : mapDataSourceTypeToBuilder.values()) {
UISWTViewBuilderCore builder = unregister ? mapViewIDtoBuilder.remove(viewID) : mapViewIDtoBuilder.get(viewID);
if (builder != null) {
listDisposeViewsIn.add(builder);
}
}
} else {
Map<String, UISWTViewBuilderCore> mapViewIDtoBuilder = getBuilderMap(forDSTypeOrViewID);
UISWTViewBuilderCore builder = unregister ? mapViewIDtoBuilder.remove(viewID) : mapViewIDtoBuilder.get(viewID);
if (builder != null) {
listDisposeViewsIn.add(builder);
}
}
}
SWTViewListener[] viewListeners = unregister ? listSWTViewListeners.toArray(new SWTViewListener[0]) : null;
for (UISWTViewBuilderCore builder : listDisposeViewsIn) {
builder.disposeViews();
if (unregister) {
for (SWTViewListener l : viewListeners) {
l.setViewDeregistered(forDSTypeOrViewID, builder);
}
}
}
return listDisposeViewsIn;
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class ViewManagerSWT method disposeAll.
public void disposeAll() {
List<UISWTViewBuilderCore> listBuildersToDispose = new ArrayList<>();
synchronized (mapDataSourceTypeToBuilder) {
Collection<Map<String, UISWTViewBuilderCore>> values = mapDataSourceTypeToBuilder.values();
for (Map<String, UISWTViewBuilderCore> value : values) {
listBuildersToDispose.addAll(value.values());
}
mapDataSourceTypeToBuilder.clear();
}
registeredCoreViews.clear();
for (UISWTViewBuilderCore builder : listBuildersToDispose) {
builder.dispose();
}
}
use of com.biglybt.ui.swt.pifimpl.UISWTViewBuilderCore in project BiglyBT by BiglySoftware.
the class DeviceManagerUI method setupEntry.
private void setupEntry(deviceItem new_di, final Device device, String parent) {
synchronized (DeviceManagerUI.this) {
if (new_di.isDestroyed()) {
return;
}
deviceView view = new deviceView(parent, device);
new_di.setView(view);
String key = parent + "/" + device.getID() + ":" + nextSidebarID();
final MdiEntry entry;
int device_type = device.getType();
if (device_type == Device.DT_MEDIA_RENDERER) {
entry = mdi.createEntryFromSkinRef(parent, key, "devicerendererview", device.getName(), view, null, false, null);
} else {
// Hack so first view gets pre-initialized device object, and new
// views (pop-out) get a newly built instance.
UISWTViewBuilderCore builder = new UISWTViewBuilderCore(key, null, view).setParentEntryID(parent).setInitialDatasource(new Object[] { parent, device }).setListenerInstantiator(true, (Builder, swtView) -> new deviceView(parent, device));
entry = mdi.createEntry(builder, false);
entry.setExpanded(true);
}
entry.setDatasource(device);
entry.addListener(new MdiCloseListener() {
@Override
public void mdiEntryClosed(MdiEntry entry, boolean userClosed) {
if (device != null) {
device.setTransientProperty(DEVICE_IVIEW_KEY, null);
}
}
});
new_di.setMdiEntry(entry);
setStatus(device, new_di);
if (device instanceof TranscodeTarget) {
entry.addListener(new MdiEntryDropListener() {
@Override
public boolean mdiEntryDrop(MdiEntry entry, Object payload) {
return handleDrop((TranscodeTarget) device, payload);
}
});
}
final MenuManager menu_manager = ui_manager.getMenuManager();
boolean need_sep = false;
if (device instanceof TranscodeTarget) {
need_sep = true;
MenuItem explore_menu_item = menu_manager.addMenuItem("sidebar." + key, "v3.menu.device.exploreTranscodes");
explore_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
explore_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
ManagerUtils.open(((TranscodeTarget) device).getWorkingDirectory());
}
});
}
if (device instanceof DeviceMediaRenderer) {
need_sep = true;
// filter view
final DeviceMediaRenderer renderer = (DeviceMediaRenderer) device;
if (renderer.canFilterFilesView()) {
MenuItem filterfiles_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.only.show");
filterfiles_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
filterfiles_menu_item.setStyle(MenuItem.STYLE_CHECK);
filterfiles_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setData(Boolean.valueOf(renderer.getFilterFilesView()));
}
});
filterfiles_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setFilterFilesView((Boolean) menu.getData());
}
});
}
if (renderer.canShowCategories()) {
MenuItem showcat_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.show.cat");
showcat_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
showcat_menu_item.setStyle(MenuItem.STYLE_CHECK);
showcat_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setData(Boolean.valueOf(renderer.getShowCategories()));
}
});
showcat_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setShowCategories((Boolean) menu.getData());
}
});
}
if (!DISABLED_TRANSCODING) {
MenuItem alwayscache_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.always.cache");
alwayscache_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
alwayscache_menu_item.setStyle(MenuItem.STYLE_CHECK);
alwayscache_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setData(Boolean.valueOf(renderer.getAlwaysCacheFiles()));
}
});
alwayscache_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setAlwaysCacheFiles((Boolean) menu.getData());
}
});
}
}
if (need_sep) {
MenuItem menu_item = menu_manager.addMenuItem("sidebar." + key, "1");
menu_item.setStyle(MenuItem.STYLE_SEPARATOR);
menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
}
need_sep = false;
if (device instanceof DeviceMediaRenderer) {
final DeviceMediaRenderer renderer = (DeviceMediaRenderer) device;
if (renderer.canCopyToFolder()) {
need_sep = true;
MenuItem autocopy_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.autoCopy");
autocopy_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
autocopy_menu_item.setStyle(MenuItem.STYLE_CHECK);
autocopy_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setData(Boolean.valueOf(renderer.getAutoCopyToFolder()));
}
});
autocopy_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setAutoCopyToFolder((Boolean) menu.getData());
}
});
final MenuItem mancopy_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.mancopy");
mancopy_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
mancopy_menu_item.setStyle(MenuItem.STYLE_PUSH);
mancopy_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
try {
renderer.manualCopy();
} catch (Throwable e) {
Debug.out(e);
}
}
});
mancopy_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
boolean enabled = false;
if (!renderer.getAutoCopyToFolder()) {
File target = renderer.getCopyToFolder();
if (target != null && target.exists()) {
enabled = renderer.getCopyToFolderPending() > 0;
}
}
mancopy_menu_item.setEnabled(enabled);
}
});
MenuItem setcopyto_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.setcopyto");
setcopyto_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
setcopyto_menu_item.setStyle(MenuItem.STYLE_PUSH);
setcopyto_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
Shell shell = Utils.findAnyShell();
DirectoryDialog dd = new DirectoryDialog(shell);
File existing = renderer.getCopyToFolder();
if (existing != null) {
dd.setFilterPath(existing.getAbsolutePath());
}
dd.setText(MessageText.getString("devices.xcode.setcopyto.title"));
String path = dd.open();
if (path != null) {
renderer.setCopyToFolder(new File(path));
}
}
});
}
if (renderer.canCopyToDevice()) {
need_sep = true;
MenuItem autocopy_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.autoCopy.device");
autocopy_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
autocopy_menu_item.setStyle(MenuItem.STYLE_CHECK);
autocopy_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setData(Boolean.valueOf(renderer.getAutoCopyToDevice()));
}
});
autocopy_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setAutoCopyToDevice((Boolean) menu.getData());
}
});
final MenuItem mancopy_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.mancopy");
mancopy_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
mancopy_menu_item.setStyle(MenuItem.STYLE_PUSH);
mancopy_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
try {
renderer.manualCopy();
} catch (Throwable e) {
Debug.out(e);
}
}
});
mancopy_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
boolean enabled = false;
if (!renderer.getAutoCopyToDevice()) {
enabled = renderer.getCopyToDevicePending() > 0;
}
mancopy_menu_item.setEnabled(enabled);
}
});
}
if (renderer.canAutoStartDevice()) {
need_sep = true;
MenuItem autostart_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.autoStart");
autostart_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
autostart_menu_item.setStyle(MenuItem.STYLE_CHECK);
autostart_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu.setData(Boolean.valueOf(renderer.getAutoStartDevice()));
}
});
autostart_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setAutoStartDevice((Boolean) menu.getData());
}
});
}
if (renderer.canAssociate()) {
need_sep = true;
final MenuItem menu_associate = menu_manager.addMenuItem("sidebar." + key, "devices.associate");
menu_associate.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menu_associate.setStyle(MenuItem.STYLE_MENU);
menu_associate.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
menu_associate.removeAllChildItems();
if (renderer.isAlive()) {
InetAddress a = renderer.getAddress();
String address = a == null ? "" : a.getHostAddress();
MenuItem menu_none = menu_manager.addMenuItem(menu_associate, "!" + MessageText.getString("devices.associate.already") + ": " + address + "!");
menu_none.setEnabled(false);
menu_associate.setEnabled(true);
} else {
UnassociatedDevice[] unassoc = device_manager.getUnassociatedDevices();
if (unassoc.length == 0) {
menu_associate.setEnabled(false);
} else {
menu_associate.setEnabled(true);
for (final UnassociatedDevice un : unassoc) {
MenuItem menu_un = menu_manager.addMenuItem(menu_associate, "!" + un.getAddress().getHostAddress() + ": " + un.getDescription() + "!");
menu_un.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.associate(un);
}
});
}
}
}
}
});
}
if (true) {
need_sep = true;
final MenuItem menu_ra = menu_manager.addMenuItem("sidebar." + key, "menu.add.file");
menu_ra.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menu_ra.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
Utils.execSWTThread(() -> {
FileDialog dialog = new FileDialog(Utils.findAnyShell(), SWT.SYSTEM_MODAL | SWT.OPEN | SWT.MULTI);
String filter_path = TorrentOpener.getFilterPathData();
dialog.setFilterPath(filter_path);
dialog.setText(MessageText.getString("wizard.maketorrent.choosefile"));
String str = dialog.open();
String path = TorrentOpener.setFilterPathData(str);
if (path != null) {
String[] paths;
String[] names = dialog.getFileNames();
if (names != null && names.length > 0) {
filter_path = dialog.getFilterPath();
paths = new String[names.length];
for (int i = 0; i < names.length; i++) {
paths[i] = filter_path + File.separator + names[i];
}
} else {
paths = new String[] { path };
}
handleDrop(renderer, paths);
}
});
}
});
}
if (renderer.canRestrictAccess()) {
need_sep = true;
final MenuItem menu_ra = menu_manager.addMenuItem("sidebar." + key, "devices.restrict_access");
menu_ra.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menu_ra.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
if (target instanceof MdiEntry) {
UISWTInputReceiver entry = (UISWTInputReceiver) swt_ui.getInputReceiver();
entry.setMessage("devices.restrict_access.msg");
entry.setPreenteredText(renderer.getAccessRestriction(), false);
entry.maintainWhitespace(false);
entry.allowEmptyInput(true);
entry.setLocalisedTitle(MessageText.getString("devices.restrict_access.prompt", new String[] { device.getName() }));
entry.prompt(new UIInputReceiverListener() {
@Override
public void UIInputReceiverClosed(UIInputReceiver entry) {
if (!entry.hasSubmittedInput()) {
return;
}
String input = entry.getSubmittedInput().trim();
renderer.setAccessRestriction(input);
}
});
}
}
});
}
final TranscodeProfile[] transcodeProfiles = renderer.getTranscodeProfiles();
if (transcodeProfiles.length > 0) {
Arrays.sort(transcodeProfiles, new Comparator<TranscodeProfile>() {
@Override
public int compare(TranscodeProfile o1, TranscodeProfile o2) {
int i1 = o1.getIconIndex();
int i2 = o2.getIconIndex();
if (i1 == i2) {
return o1.getName().compareToIgnoreCase(o2.getName());
} else {
return (i1 - i2);
}
}
});
need_sep = true;
MenuItem menu_default_profile = menu_manager.addMenuItem("sidebar." + key, "v3.menu.device.defaultprofile");
menu_default_profile.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menu_default_profile.setStyle(MenuItem.STYLE_MENU);
MenuItem menu_profile_never = menu_manager.addMenuItem(menu_default_profile, "v3.menu.device.defaultprofile.never");
menu_profile_never.setStyle(MenuItem.STYLE_CHECK);
menu_profile_never.setData(Boolean.TRUE);
menu_profile_never.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setTranscodeRequirement(((Boolean) menu.getData()) ? TranscodeTarget.TRANSCODE_NEVER : TranscodeTarget.TRANSCODE_WHEN_REQUIRED);
}
});
menu_profile_never.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
boolean never = renderer.getTranscodeRequirement() == TranscodeTarget.TRANSCODE_NEVER;
menu.setData(never);
}
});
MenuItem menu_profile_none = menu_manager.addMenuItem(menu_default_profile, "option.askeverytime");
menu_profile_none.setStyle(MenuItem.STYLE_RADIO);
menu_profile_none.setData(Boolean.FALSE);
menu_profile_none.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setDefaultTranscodeProfile(null);
}
});
menu_profile_none.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
if (transcodeProfiles.length <= 1) {
menu.setData(Boolean.FALSE);
menu.setEnabled(false);
} else {
TranscodeProfile profile = null;
try {
profile = renderer.getDefaultTranscodeProfile();
} catch (TranscodeException e) {
}
menu.setData((profile == null) ? Boolean.TRUE : Boolean.FALSE);
menu.setEnabled(renderer.getTranscodeRequirement() != TranscodeTarget.TRANSCODE_NEVER);
}
}
});
for (final TranscodeProfile profile : transcodeProfiles) {
MenuItem menuItem = menu_manager.addMenuItem(menu_default_profile, "!" + profile.getName() + "!");
menuItem.setStyle(MenuItem.STYLE_RADIO);
menuItem.setData(Boolean.FALSE);
menuItem.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setDefaultTranscodeProfile(profile);
}
});
menuItem.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
if (transcodeProfiles.length <= 1) {
menu.setData(Boolean.TRUE);
menu.setEnabled(false);
} else {
TranscodeProfile dprofile = null;
try {
dprofile = renderer.getDefaultTranscodeProfile();
} catch (TranscodeException e) {
}
menu.setData((profile.equals(dprofile)) ? Boolean.TRUE : Boolean.FALSE);
menu.setEnabled(renderer.getTranscodeRequirement() != TranscodeTarget.TRANSCODE_NEVER);
}
}
});
}
}
if (true) {
need_sep = true;
final MenuItem rss_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.rsspub");
rss_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
rss_menu_item.setStyle(MenuItem.STYLE_CHECK);
rss_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
rss_menu_item.setEnabled(device_manager.isRSSPublishEnabled());
menu.setData(Boolean.valueOf(device_manager.isRSSPublishEnabled() && renderer.isRSSPublishEnabled()));
}
});
rss_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
renderer.setRSSPublishEnabled((Boolean) menu.getData());
}
});
rss_menu_item.setEnabled(device_manager.isRSSPublishEnabled());
}
if (true) {
need_sep = true;
final MenuItem aswt_menu_item = menu_manager.addMenuItem("sidebar." + key, "devices.xcode.tagshare");
aswt_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
aswt_menu_item.setStyle(MenuItem.STYLE_MENU);
aswt_menu_item.addFillListener(new MenuItemFillListener() {
@Override
public void menuWillBeShown(MenuItem menu, Object data) {
addTagSubMenu(menu_manager, menu, renderer);
}
});
}
}
if (device.isBrowsable()) {
need_sep = true;
MenuItem browse_menu_item = menu_manager.addMenuItem("sidebar." + key, "device.browse");
browse_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
browse_menu_item.setStyle(MenuItem.STYLE_MENU);
browse_menu_item.addFillListener(will_browse_listener);
}
if (need_sep) {
MenuItem menu_item = menu_manager.addMenuItem("sidebar." + key, "s2");
menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menu_item.setStyle(MenuItem.STYLE_SEPARATOR);
}
// rename
MenuItem rename_menu_item = menu_manager.addMenuItem("sidebar." + key, "MyTorrentsView.menu.rename");
rename_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
rename_menu_item.addListener(rename_listener);
if (device.isExportable()) {
MenuItem export_item = menu_manager.addMenuItem("sidebar." + key, "Subscription.menu.export");
export_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
export_item.addListener(export_listener);
}
// hide
MenuItem hide_menu_item = menu_manager.addMenuItem("sidebar." + key, "device.hide");
hide_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
hide_menu_item.addListener(hide_listener);
// tag
MenuItem tag_menu_item = menu_manager.addMenuItem("sidebar." + key, "device.tag");
tag_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
tag_menu_item.setStyle(MenuItem.STYLE_CHECK);
tag_menu_item.addFillListener(will_tag_listener);
tag_menu_item.addListener(tag_listener);
// remove
MenuItem remove_menu_item = menu_manager.addMenuItem("sidebar." + key, "MySharesView.menu.remove");
remove_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
remove_menu_item.addFillListener(will_remove_listener);
remove_menu_item.addListener(remove_listener);
// sep
MenuItem menu_item_sep = menu_manager.addMenuItem("sidebar." + key, "s3");
menu_item_sep.setStyle(MenuItem.STYLE_SEPARATOR);
menu_item_sep.setDisposeWithUIDetach(UIInstance.UIT_SWT);
final URL wiki_url = device.getWikiURL();
if (wiki_url != null) {
MenuItem wiki_menu_item = menu_manager.addMenuItem("sidebar." + key, "device.wiki");
wiki_menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
wiki_menu_item.addListener(new MenuItemListener() {
@Override
public void selected(MenuItem menu, Object target) {
Utils.launch(wiki_url.toExternalForm());
}
});
}
// props
MenuItem menu_item = menu_manager.addMenuItem("sidebar." + key, "Subscription.menu.properties");
menu_item.setDisposeWithUIDetach(UIInstance.UIT_SWT);
menu_item.addListener(properties_listener);
}
}
Aggregations