Steps to compare notebooks in Workbench

旧街凉风 提交于 2019-12-09 11:07:37

问题


What, exactly, are the steps involved in using Wolfram Workbench (version 2) to compare two notebooks?

Please be explicit even in such things as what I do in order to open the two notebooks in Workbench.

(I find Workbench fiendishly difficult to use. Its built-in documentation is, I find, of limited value. The tutorial screencasts about it are just too rushed to be able to follow, even with stopping and starting. And there's still a confusion, at least for me, among various versions of sample files that are to accompany the tutorial.)


回答1:


I have never used the workbench but when I fired it up I was comparing documents in minutes, so it can't be that hard.

The steps:

  1. Create a project using the File > New > New Project menu (EDIT: many project types will do I think. I have tried both the Application and the Basic Mathematica type)
  2. Add the two files to be compared to the project using import (in the File menu or the right mouse button context menu). EDIT: The best approach is probably using "General/File system". It will ask for a directory to import from. After that you may select the files you want to import from that directory.
  3. Select both files in the package explorer view
  4. Right mouse button > Compare with> Each other
  5. Compare editor fires up showing the two documents side by side




回答2:


(Welcome to StackOverflow Murray, it's good to see you here!)

This is not a direct answer to your question, but I think you might find it useful to know that the << AuthorTools` package includes functionality for comparing notebooks. Evaluate the following to open the ("hidden") documentation:

NotebookOpen@
 FileNameJoin[{$InstallationDirectory, "AddOns", "Applications", 
   "AuthorTools", "Documentation", "English", "AuthorToolsGuide.nb"}];

Then you can compare them using CreateDocument@NotebookDiff[notebook1, notebook2], or perhaps using the somewhat more convenient

CreateDocument@NotebookDiff[SystemDialogInput["FileOpen"], SystemDialogInput["FileOpen"]]

which will let you select the files more easily.

Alternatively, you can open the two notebooks in the front end, and use this little control panel:

Dynamic@Column[
  {PopupMenu[Dynamic[nb1], 
    Thread[Notebooks[] -> NotebookTools`NotebookName /@ Notebooks[]]],
   PopupMenu[Dynamic[nb2], 
    Thread[Notebooks[] -> NotebookTools`NotebookName /@ Notebooks[]]],
   Button["Show differences", 
    CreateDocument@NotebookTools`NotebookDiff[nb1, nb2]]}
  ]


It's interesting to mention that in Mathematica 8 there's some undocumented notebook-related functionality in the NotebookTools context, including a NotebookTools`NotebookDiff[] function.


Related question: Is it possible to invoke Mathematica's diff functionality from the command line?



来源:https://stackoverflow.com/questions/8774123/steps-to-compare-notebooks-in-workbench

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!