/* Menu: Help */
private void createHelpMenu(IMenuManager menuBar) {
MenuManager helpMenu = new MenuManager(Messages.ApplicationActionBarAdvisor_HELP, IWorkbenchActionConstants.M_HELP);
menuBar.add(helpMenu);
helpMenu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
/* Tutorial Wizard */
helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_TUTORIAL) {
@Override
public void run() {
TutorialWizard wizard = new TutorialWizard();
OwlUI.openWizard(getActionBarConfigurer().getWindowConfigurer().getWindow().getShell(), wizard, false, false, null);
}
@Override
public ImageDescriptor getImageDescriptor() {
return OwlUI.getImageDescriptor("icons/elcl16/help.gif"); //$NON-NLS-1$
}
@Override
public String getId() {
return TutorialHandler.ID;
}
@Override
public String getActionDefinitionId() {
return TutorialHandler.ID;
}
});
/* Link to Help */
helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_FAQ) {
@Override
public void run() {
BrowserUtils.openLinkExternal("http://www.rssowl.org/help"); //$NON-NLS-1$
}
});
/* Link to Forum */
helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_VISIT_FORUM) {
@Override
public void run() {
BrowserUtils.openLinkExternal("http://sourceforge.net/projects/rssowl/forums/forum/296910"); //$NON-NLS-1$
}
@Override
public ImageDescriptor getImageDescriptor() {
return OwlUI.getImageDescriptor("icons/obj16/forum.gif"); //$NON-NLS-1$
}
});
/* Show Key Bindings */
helpMenu.add(new Separator());
helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_SHOW_KEY_BINDINGS) {
@Override
public void run() {
IWorkbench workbench = PlatformUI.getWorkbench();
IBindingService bindingService = (IBindingService) workbench.getService(IBindingService.class);
bindingService.openKeyAssistDialog();
}
});
helpMenu.add(new Separator());
/* Report Bugs */
helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_REPORT_PROBLEMS) {
@Override
public void run() {
BrowserUtils.openLinkExternal("http://dev.rssowl.org"); //$NON-NLS-1$
}
@Override
public ImageDescriptor getImageDescriptor() {
return OwlUI.getImageDescriptor("icons/elcl16/bug.gif"); //$NON-NLS-1$
}
});
/* Export Log to File */
helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_EXPORT_LOGFILE) {
@Override
public void run() {
FileDialog dialog = new FileDialog(getActionBarConfigurer().getWindowConfigurer().getWindow().getShell(), SWT.SAVE);
dialog.setText(Messages.ApplicationActionBarAdvisor_EXPORT_LOGFILE_DIALOG);
dialog.setFilterExtensions(new String[] { "*.log" }); //$NON-NLS-1$
dialog.setFileName("rssowl.log"); //$NON-NLS-1$
dialog.setOverwrite(true);
String file = dialog.open();
if (StringUtils.isSet(file)) {
try {
/* Check for Log Message from Core to have a complete log */
String logMessages = CoreUtils.getAndFlushLogMessages();
if (logMessages != null && logMessages.length() > 0)
Activator.safeLogError(logMessages, null);
/* Help to find out where the log is coming from */
Activator.safeLogInfo("Error Log Exported"); //$NON-NLS-1$
/* Export Log File */
File logFile = Platform.getLogFileLocation().toFile();
InputStream inS;
if (logFile.exists())
inS = new FileInputStream(logFile);
else
inS = new ByteArrayInputStream(new byte[0]);
FileOutputStream outS = new FileOutputStream(new File(file));
CoreUtils.copy(inS, outS);
/* Append a Report of Feeds that are not loading if any */
String nl = System.getProperty("line.separator"); //$NON-NLS-1$
if (!StringUtils.isSet(nl))
nl= "\n"; //$NON-NLS-1$
StringBuilder errorReport = new StringBuilder();
Collection<IBookMark> bookmarks = DynamicDAO.getDAO(IBookMarkDAO.class).loadAll();
for (IBookMark bookmark : bookmarks) {
if (bookmark.isErrorLoading()) {
Object errorObj = bookmark.getProperty(Controller.LOAD_ERROR_KEY);
if (errorObj != null && errorObj instanceof String) {
errorReport.append(Controller.getDefault().createLogEntry(bookmark, null, (String) errorObj));
errorReport.append(nl).append(nl);
}
}
}
if (errorReport.length() > 0) {
FileWriter writer = new FileWriter(new File(file), true);
try {
writer.append(nl).append(nl).append(nl);
writer.write("--- Summary of Feeds that are not Loading -----------------------------------------------"); //$NON-NLS-1$
writer.append(nl).append(nl);
writer.write(errorReport.toString());
writer.close();
} finally {
writer.close();
}
}
} catch (FileNotFoundException e) {
Activator.getDefault().logError(e.getMessage(), e);
} catch (IOException e) {
Activator.getDefault().logError(e.getMessage(), e);
}
}
}
});
helpMenu.add(new Separator());
/* Homepage */
helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_HOMEPAGE) {
@Override
public void run() {
BrowserUtils.openLinkExternal("http://www.rssowl.org"); //$NON-NLS-1$
}
});
/* License */
helpMenu.add(new Action(Messages.ApplicationActionBarAdvisor_LICENSE) {
@Override
public void run() {
BrowserUtils.openLinkExternal("http://www.rssowl.org/legal/epl-v10.html"); //$NON-NLS-1$
}
});
// helpMenu.add(getAction(ActionFactory.INTRO.getId()));
helpMenu.add(new Separator());
helpMenu.add(new Separator());
helpMenu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
helpMenu.add(new Separator());
helpMenu.add(getAction(ActionFactory.ABOUT.getId()));
if (Application.IS_MAC) {
IContributionItem item = helpMenu.find(ActionFactory.ABOUT.getId());