Skip to content
This repository
  • 4 commits
  • 21 files changed
  • 0 comments
  • 1 contributor

Showing 21 changed files with 93 additions and 85 deletions. Show diff stats Hide diff stats

  1. +9 3 no.resheim.elibrarium.epub-feature/feature.properties
  2. +1 1  no.resheim.elibrarium.epub.core/META-INF/MANIFEST.MF
  3. +7 7 ...m.elibrarium.epub.core/src/no/resheim/elibrarium/epub/core/{EPUBCorePlugin.java → EpubCorePlugin.java}
  4. +4 4 no.resheim.elibrarium.epub.core/src/no/resheim/elibrarium/epub/core/{EPUBUtil.java → EpubUtil.java}
  5. +8 8 no.resheim.elibrarium.epub.core/src/no/resheim/elibrarium/epub/core/FolderScanner.java
  6. +1 1  no.resheim.elibrarium.epub.core/src/no/resheim/elibrarium/epub/core/PreferenceInitializer.java
  7. +1 0  no.resheim.elibrarium.epub.ui/.classpath
  8. +3 1 no.resheim.elibrarium.epub.ui/META-INF/MANIFEST.MF
  9. +2 1  no.resheim.elibrarium.epub.ui/build.properties
  10. BIN  no.resheim.elibrarium.epub.ui/icons/bookmark.png
  11. BIN  no.resheim.elibrarium.epub.ui/icons/bookmark_active.png
  12. BIN  no.resheim.elibrarium.epub.ui/icons/bookmark_inactive.png
  13. BIN  no.resheim.elibrarium.epub.ui/img-src/bookmark.idraw
  14. BIN  no.resheim.elibrarium.epub.ui/lib/prettytime-1.0.8.Final.jar
  15. +1 1  no.resheim.elibrarium.epub.ui/plugin.xml
  16. +8 4 no.resheim.elibrarium.epub.ui/src/no/resheim/elibrarium/epub/ui/{EPUBUIPlugin.java → EpubUIPlugin.java}
  17. +2 2 no.resheim.elibrarium.epub.ui/src/no/resheim/elibrarium/epub/ui/preferences/ScanPreferencePage.java
  18. +1 1  ...ium.epub.ui/src/no/resheim/elibrarium/epub/ui/reader/{EPUBLabelProvider.java → EpubLabelProvider.java}
  19. +33 39 ...esheim.elibrarium.epub.ui/src/no/resheim/elibrarium/epub/ui/reader/{EPUBReader.java → EpubReader.java}
  20. +2 2 no.resheim.elibrarium.epub.ui/src/no/resheim/elibrarium/epub/ui/reader/PaginationJob.java
  21. +10 10 no.resheim.elibrarium.epub.ui/src/no/resheim/elibrarium/epub/ui/reader/TOCOutlinePage.java
12 no.resheim.elibrarium.epub-feature/feature.properties
@@ -11,9 +11,15 @@
11 11 featureName=EPUB Reader
12 12 description=Adds support for handling and reading EPUB files.\n\
13 13 \n\
14   -The EPUB reader makes use of the Rangy software developed by Tim Down and
15   -released under the MIT license. Copyright (c) 2011, Tim Down. \n\
16   -See http://code.google.com/p/rangy/
  14 +The EPUB reader makes use of the the following software:\n\
  15 +\n\
  16 +Rangy developed by Tim Down and released under the MIT license.
  17 +Copyright (c) 2011, Tim Down.\n\
  18 +See http://code.google.com/p/rangy/\n\
  19 +\n\
  20 +PrettyTime developed by OCPsoft and released under the APL license.\n\
  21 +Copyright (c) 2011, Lincoln Baxter, III\n\
  22 +See http://ocpsoft.org/prettytime
17 23 providerName=Torkild U. Resheim
18 24 copyright=Copyright (c) 2011, 2012 Torkild U. Resheim. All rights reserved.
19 25 license=\
2  no.resheim.elibrarium.epub.core/META-INF/MANIFEST.MF
@@ -8,6 +8,6 @@ Require-Bundle: org.eclipse.core.runtime,
8 8 org.eclipse.mylyn.docs.epub.core;bundle-version="0.8.0"
9 9 Bundle-RequiredExecutionEnvironment: JavaSE-1.6
10 10 Export-Package: no.resheim.elibrarium.epub.core
11   -Bundle-Activator: no.resheim.elibrarium.epub.core.EPUBCorePlugin
  11 +Bundle-Activator: no.resheim.elibrarium.epub.core.EpubCorePlugin
12 12 Bundle-Vendor: Torkild U. Resheim
13 13 Bundle-ActivationPolicy: lazy
14 .../resheim/elibrarium/epub/core/EPUBCorePlugin.java → .../resheim/elibrarium/epub/core/EpubCorePlugin.java
@@ -33,7 +33,7 @@
33 33 import org.osgi.framework.BundleActivator;
34 34 import org.osgi.framework.BundleContext;
35 35
36   -public class EPUBCorePlugin extends Plugin implements BundleActivator, ICollection, IPreferenceChangeListener {
  36 +public class EpubCorePlugin extends Plugin implements BundleActivator, ICollection, IPreferenceChangeListener {
37 37
38 38 public static final String PLUGIN_ID = "no.resheim.elibrarium.epub.core";
39 39
@@ -41,7 +41,7 @@
41 41
42 42 public static final String COLLECTION_ID = "no.resheim.elibrarium.epub";
43 43
44   - private static EPUBCorePlugin collection;
  44 + private static EpubCorePlugin collection;
45 45
46 46 private final FolderScanner scanner;
47 47
@@ -57,7 +57,7 @@ public Scheduler(FolderScanner scanner) {
57 57 public void done(IJobChangeEvent event) {
58 58 super.done(event);
59 59 if (isDiscoveryEnabled()) {
60   - IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(EPUBCorePlugin.PLUGIN_ID);
  60 + IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(EpubCorePlugin.PLUGIN_ID);
61 61 int minutes = preferences.getInt(PreferenceConstants.SCAN_INTERVAL,
62 62 PreferenceConstants.DEFAULT_SCAN_INTERVAL);
63 63 scanner.schedule(60000 * minutes);
@@ -67,17 +67,17 @@ public void done(IJobChangeEvent event) {
67 67 }
68 68
69 69 private boolean isDiscoveryEnabled() {
70   - IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(EPUBCorePlugin.PLUGIN_ID);
  70 + IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(EpubCorePlugin.PLUGIN_ID);
71 71 return preferences.getBoolean(PreferenceConstants.SCAN_ENABLE, false);
72 72 }
73 73
74   - public EPUBCorePlugin() {
  74 + public EpubCorePlugin() {
75 75 collection = this;
76 76 listeners = new ListenerList();
77 77 scanner = new FolderScanner("Scanning");
78 78 }
79 79
80   - public static EPUBCorePlugin getCollection() {
  80 + public static EpubCorePlugin getCollection() {
81 81 return collection;
82 82 }
83 83
@@ -85,7 +85,7 @@ public static EPUBCorePlugin getCollection() {
85 85 public void start(BundleContext context) throws Exception {
86 86 super.start(context);
87 87 scanner.addJobChangeListener(new Scheduler(scanner));
88   - IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(EPUBCorePlugin.PLUGIN_ID);
  88 + IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(EpubCorePlugin.PLUGIN_ID);
89 89 preferences.addPreferenceChangeListener(this);
90 90 LibraryPlugin.getDefault().addCollection(this);
91 91 if (isDiscoveryEnabled()) {
8 ...src/no/resheim/elibrarium/epub/core/EPUBUtil.java → ...src/no/resheim/elibrarium/epub/core/EpubUtil.java
@@ -30,7 +30,7 @@
30 30 *
31 31 * @author Torkild U. Resheim
32 32 */
33   -public class EPUBUtil {
  33 +public class EpubUtil {
34 34
35 35 private static final EStructuralFeature TEXT = XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text();
36 36
@@ -43,11 +43,11 @@
43 43 * @return the book or <code>null</code>
44 44 */
45 45 public static Book getBook(OPSPublication ops) {
46   - String id = EPUBUtil.getIdentifier(ops);
47   - if (!EPUBCorePlugin.getCollection().hasBook(id)) {
  46 + String id = EpubUtil.getIdentifier(ops);
  47 + if (!EpubCorePlugin.getCollection().hasBook(id)) {
48 48 return null;
49 49 } else {
50   - return EPUBCorePlugin.getCollection().getBook(id);
  50 + return EpubCorePlugin.getCollection().getBook(id);
51 51 }
52 52 }
53 53
16 no.resheim.elibrarium.epub.core/src/no/resheim/elibrarium/epub/core/FolderScanner.java
@@ -49,18 +49,18 @@ private void registerBooks(File epubPath) throws Exception {
49 49 epub.unpack(epubPath);
50 50 List<OPSPublication> publications = epub.getOPSPublications();
51 51 for (OPSPublication ops : publications) {
52   - String title = EPUBUtil.getFirstTitle(ops);
53   - String author = EPUBUtil.getFirstAuthor(ops);
54   - String id = EPUBUtil.getIdentifier(ops);
55   - if (!EPUBCorePlugin.getCollection().hasBook(id)) {
  52 + String title = EpubUtil.getFirstTitle(ops);
  53 + String author = EpubUtil.getFirstAuthor(ops);
  54 + String id = EpubUtil.getIdentifier(ops);
  55 + if (!EpubCorePlugin.getCollection().hasBook(id)) {
56 56 URI uri = epubPath.toURI();
57   - Book book = LibraryUtil.createNewBook(EPUBCorePlugin.COLLECTION_ID, uri, id, title, author);
  57 + Book book = LibraryUtil.createNewBook(EpubCorePlugin.COLLECTION_ID, uri, id, title, author);
58 58 // Mark the book as automatically discovered
59 59 Metadata md = LibraryFactory.eINSTANCE.createMetadata();
60 60 md.setKey("discovered");
61 61 md.setKey(Boolean.toString(true));
62 62 book.getMetadata().add(md);
63   - EPUBCorePlugin.getCollection().add(book);
  63 + EpubCorePlugin.getCollection().add(book);
64 64 }
65 65
66 66 }
@@ -68,7 +68,7 @@ private void registerBooks(File epubPath) throws Exception {
68 68
69 69 @Override
70 70 protected IStatus run(IProgressMonitor monitor) {
71   - IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(EPUBCorePlugin.PLUGIN_ID);
  71 + IEclipsePreferences preferences = InstanceScope.INSTANCE.getNode(EpubCorePlugin.PLUGIN_ID);
72 72 boolean scan = preferences.getBoolean(PreferenceConstants.SCAN_ENABLE, false);
73 73 if (scan){
74 74 String paths = preferences.get(PreferenceConstants.SCAN_FOLDERS, "");
@@ -88,7 +88,7 @@ public boolean accept(File dir, String name) {
88 88 });
89 89
90 90 for (File file : epubs) {
91   - if (!EPUBCorePlugin.getCollection().hasBook(file)) {
  91 + if (!EpubCorePlugin.getCollection().hasBook(file)) {
92 92 try {
93 93 registerBooks(file);
94 94 } catch (Exception e) {
2  no.resheim.elibrarium.epub.core/src/no/resheim/elibrarium/epub/core/PreferenceInitializer.java
@@ -19,7 +19,7 @@
19 19
20 20 @Override
21 21 public void initializeDefaultPreferences() {
22   - IEclipsePreferences preferences = DefaultScope.INSTANCE.getNode(EPUBCorePlugin.PLUGIN_ID);
  22 + IEclipsePreferences preferences = DefaultScope.INSTANCE.getNode(EpubCorePlugin.PLUGIN_ID);
23 23 preferences.putBoolean(PreferenceConstants.SCAN_FOLDERS, false);
24 24 preferences.putBoolean(PreferenceConstants.SCAN_NOTIFY, true);
25 25 preferences.putInt(PreferenceConstants.SCAN_INTERVAL, 10);
1  no.resheim.elibrarium.epub.ui/.classpath
... ... @@ -1,5 +1,6 @@
1 1 <?xml version="1.0" encoding="UTF-8"?>
2 2 <classpath>
  3 + <classpathentry exported="true" kind="lib" path="lib/prettytime-1.0.8.Final.jar"/>
3 4 <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
4 5 <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
5 6 <classpathentry kind="src" path="src"/>
4 no.resheim.elibrarium.epub.ui/META-INF/MANIFEST.MF
@@ -19,7 +19,9 @@ Require-Bundle: org.eclipse.core.runtime,
19 19 no.resheim.elibrarium.library.ui;bundle-version="1.0.0"
20 20 Import-Package: org.eclipse.ui.internal.browser
21 21 Bundle-ActivationPolicy: lazy
22   -Bundle-Activator: no.resheim.elibrarium.epub.ui.EPUBUIPlugin
  22 +Bundle-Activator: no.resheim.elibrarium.epub.ui.EpubUIPlugin
23 23 Export-Package: no.resheim.elibrarium.epub.ui,
24 24 no.resheim.elibrarium.epub.ui.preferences,
25 25 no.resheim.elibrarium.epub.ui.reader
  26 +Bundle-ClassPath: lib/prettytime-1.0.8.Final.jar,
  27 + .
3  no.resheim.elibrarium.epub.ui/build.properties
@@ -3,4 +3,5 @@ output.. = bin/
3 3 bin.includes = META-INF/,\
4 4 .,\
5 5 icons/,\
6   - plugin.xml
  6 + plugin.xml,\
  7 + lib/prettytime-1.0.8.Final.jar
BIN  no.resheim.elibrarium.epub.ui/icons/bookmark.png
BIN  no.resheim.elibrarium.epub.ui/icons/bookmark_active.png
BIN  no.resheim.elibrarium.epub.ui/icons/bookmark_inactive.png
BIN  no.resheim.elibrarium.epub.ui/img-src/bookmark.idraw
Binary file not shown
BIN  no.resheim.elibrarium.epub.ui/lib/prettytime-1.0.8.Final.jar
Binary file not shown
2  no.resheim.elibrarium.epub.ui/plugin.xml
@@ -5,7 +5,7 @@
5 5 <extension
6 6 point="org.eclipse.ui.editors">
7 7 <editor
8   - class="no.resheim.elibrarium.epub.ui.reader.EPUBReader"
  8 + class="no.resheim.elibrarium.epub.ui.reader.EpubReader"
9 9 contributorClass="org.eclipse.ui.texteditor.BasicTextEditorActionContributor"
10 10 default="true"
11 11 extensions="epub"
12 ...c/no/resheim/elibrarium/epub/ui/EPUBUIPlugin.java → ...c/no/resheim/elibrarium/epub/ui/EpubUIPlugin.java
@@ -22,7 +22,7 @@
22 22 * @author Torkild U. Resheim
23 23 *
24 24 */
25   -public class EPUBUIPlugin extends AbstractUIPlugin {
  25 +public class EpubUIPlugin extends AbstractUIPlugin {
26 26
27 27 /** Image for an inactive bookmark */
28 28 public static final String IMG_BOOKMARK_INACTIVE = "img_bookmark_inactive";
@@ -30,7 +30,10 @@
30 30 /** Image for an active bookmark */
31 31 public static final String IMG_BOOKMARK_ACTIVE = "img_bookmark_active";
32 32
33   - public EPUBUIPlugin() {
  33 + /** Image for an active bookmark */
  34 + public static final String IMG_BOOKMARK = "img_bookmark";
  35 +
  36 + public EpubUIPlugin() {
34 37 plugin = this;
35 38 }
36 39
@@ -41,11 +44,11 @@ public EPUBUIPlugin() {
41 44 *
42 45 * @return the shared instance
43 46 */
44   - public static EPUBUIPlugin getDefault() {
  47 + public static EpubUIPlugin getDefault() {
45 48 return plugin;
46 49 }
47 50
48   - private static EPUBUIPlugin plugin;
  51 + private static EpubUIPlugin plugin;
49 52
50 53 @Override
51 54 protected void initializeImageRegistry(ImageRegistry reg) {
@@ -53,6 +56,7 @@ protected void initializeImageRegistry(ImageRegistry reg) {
53 56 reg.put(IMG_BOOKMARK_ACTIVE, LibraryUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, "icons/bookmark_active.png"));
54 57 reg.put(IMG_BOOKMARK_INACTIVE,
55 58 LibraryUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, "icons/bookmark_inactive.png"));
  59 + reg.put(IMG_BOOKMARK, LibraryUIPlugin.imageDescriptorFromPlugin(PLUGIN_ID, "icons/bookmark.png"));
56 60 }
57 61
58 62 }
4 no.resheim.elibrarium.epub.ui/src/no/resheim/elibrarium/epub/ui/preferences/ScanPreferencePage.java
@@ -11,7 +11,7 @@
11 11 *******************************************************************************/
12 12 package no.resheim.elibrarium.epub.ui.preferences;
13 13
14   -import no.resheim.elibrarium.epub.core.EPUBCorePlugin;
  14 +import no.resheim.elibrarium.epub.core.EpubCorePlugin;
15 15 import no.resheim.elibrarium.epub.core.PreferenceConstants;
16 16
17 17 import org.eclipse.core.runtime.preferences.InstanceScope;
@@ -66,7 +66,7 @@ public void createFieldEditors() {
66 66
67 67 public void init(IWorkbench workbench) {
68 68 if (preferences == null) {
69   - preferences = new ScopedPreferenceStore(InstanceScope.INSTANCE, EPUBCorePlugin.PLUGIN_ID);
  69 + preferences = new ScopedPreferenceStore(InstanceScope.INSTANCE, EpubCorePlugin.PLUGIN_ID);
70 70 }
71 71 setPreferenceStore(preferences);
72 72 }
2  .../elibrarium/epub/ui/reader/EPUBLabelProvider.java → .../elibrarium/epub/ui/reader/EpubLabelProvider.java
@@ -25,7 +25,7 @@
25 25 *
26 26 * @author Torkild U. Resheim
27 27 */
28   -public class EPUBLabelProvider extends LabelProvider {
  28 +public class EpubLabelProvider extends LabelProvider {
29 29
30 30 private static final EStructuralFeature TEXT = XMLTypePackage.eINSTANCE.getXMLTypeDocumentRoot_Text();
31 31
72 ...resheim/elibrarium/epub/ui/reader/EPUBReader.java → ...resheim/elibrarium/epub/ui/reader/EpubReader.java
@@ -20,9 +20,9 @@
20 20 import java.util.Date;
21 21 import java.util.UUID;
22 22
23   -import no.resheim.elibrarium.epub.core.EPUBCorePlugin;
24   -import no.resheim.elibrarium.epub.core.EPUBUtil;
25   -import no.resheim.elibrarium.epub.ui.EPUBUIPlugin;
  23 +import no.resheim.elibrarium.epub.core.EpubCorePlugin;
  24 +import no.resheim.elibrarium.epub.core.EpubUtil;
  25 +import no.resheim.elibrarium.epub.ui.EpubUIPlugin;
26 26 import no.resheim.elibrarium.library.Annotation;
27 27 import no.resheim.elibrarium.library.AnnotationColor;
28 28 import no.resheim.elibrarium.library.Book;
@@ -71,7 +71,6 @@
71 71 import org.eclipse.swt.events.MouseListener;
72 72 import org.eclipse.swt.events.SelectionEvent;
73 73 import org.eclipse.swt.events.SelectionListener;
74   -import org.eclipse.swt.graphics.Image;
75 74 import org.eclipse.swt.layout.GridData;
76 75 import org.eclipse.swt.layout.GridLayout;
77 76 import org.eclipse.swt.widgets.Composite;
@@ -94,7 +93,7 @@
94 93 *
95 94 * @author Torkild U. Resheim
96 95 */
97   -public class EPUBReader extends EditorPart {
  96 +public class EpubReader extends EditorPart {
98 97
99 98 /**
100 99 * The direction of browsing.
@@ -316,13 +315,11 @@ public void run() {
316 315
317 316 private boolean disposed;
318 317
319   - private Label header;
320   -
321   - protected Image image;
  318 + private Label headerLabel;
322 319
323 320 protected String initialURL;
324 321
325   - private Label label;
  322 + private Label footerLabel;
326 323
327 324 int lastHeight;
328 325
@@ -351,7 +348,7 @@ public void run() {
351 348
352 349 private Label bookmarkLabel;
353 350
354   - public EPUBReader() {
  351 + public EpubReader() {
355 352 super();
356 353 }
357 354
@@ -363,7 +360,7 @@ public boolean close() {
363 360 final boolean[] result = new boolean[1];
364 361 Display.getDefault().asyncExec(new Runnable() {
365 362 public void run() {
366   - result[0] = getEditorSite().getPage().closeEditor(EPUBReader.this, false);
  363 + result[0] = getEditorSite().getPage().closeEditor(EpubReader.this, false);
367 364 }
368 365 });
369 366 return result[0];
@@ -384,17 +381,17 @@ public void createPartControl(Composite parent) {
384 381
385 382 GridData gdHeader = new GridData(SWT.CENTER, SWT.TOP, true, false);
386 383 gdHeader.minimumWidth = 500;
387   - header = new Label(c, SWT.CENTER);
388   - header.setLayoutData(gdHeader);
389   - header.setText(" ");
390   - header.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR));
  384 + headerLabel = new Label(c, SWT.CENTER);
  385 + headerLabel.setLayoutData(gdHeader);
  386 + headerLabel.setText(" ");
  387 + headerLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR));
391 388
392 389 GridData gdBookmark = new GridData(SWT.CENTER, SWT.BEGINNING, false, false);
393 390 gdBookmark.minimumWidth = 32;
394 391 gdBookmark.widthHint = 32;
395 392 gdBookmark.verticalSpan = 3;
396 393 bookmarkLabel = new Label(c, SWT.CENTER);
397   - bookmarkLabel.setImage(EPUBUIPlugin.getDefault().getImageRegistry().get(EPUBUIPlugin.IMG_BOOKMARK_INACTIVE));
  394 + bookmarkLabel.setImage(EpubUIPlugin.getDefault().getImageRegistry().get(EpubUIPlugin.IMG_BOOKMARK_INACTIVE));
398 395 bookmarkLabel.setLayoutData(gdBookmark);
399 396 bookmarkLabel.addMouseListener(new MouseListener() {
400 397
@@ -422,11 +419,11 @@ public void mouseDoubleClick(MouseEvent e) {
422 419
423 420 GridData gdFooter = new GridData(SWT.CENTER, SWT.BOTTOM, true, false);
424 421 gdFooter.minimumWidth = 500;
425   - label = new Label(c, SWT.CENTER);
  422 + footerLabel = new Label(c, SWT.CENTER);
426 423 gdFooter.horizontalSpan = 2;
427   - label.setLayoutData(gdFooter);
428   - label.setText(" ");
429   - label.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR));
  424 + footerLabel.setLayoutData(gdFooter);
  425 + footerLabel.setText(" ");
  426 + footerLabel.setForeground(JFaceResources.getColorRegistry().get(JFacePreferences.QUALIFIER_COLOR));
430 427
431 428 // Install listener to figure out when we need to re-paginate
432 429 resizeListener = new ResizeListener();
@@ -500,9 +497,6 @@ public void dispose() {
500 497 if (paginationJob != null) {
501 498 paginationJob.cancel();
502 499 }
503   - if (image != null && !image.isDisposed())
504   - image.dispose();
505   - image = null;
506 500 // Store the last location
507 501 if (currentBook != null) {
508 502 currentBook.setLastLocation(currentLocation);
@@ -672,7 +666,7 @@ public void init(IEditorSite site, IEditorInput input) throws PartInitException
672 666 setPartName(getTitle(ops));
673 667 } catch (Exception e) {
674 668 StatusManager.getManager()
675   - .handle(new Status(IStatus.ERROR, EPUBUIPlugin.PLUGIN_ID, "Could not open book", e),
  669 + .handle(new Status(IStatus.ERROR, EpubUIPlugin.PLUGIN_ID, "Could not open book", e),
676 670 StatusManager.SHOW);
677 671 close();
678 672 }
@@ -1005,12 +999,12 @@ public void run() {
1005 999 currentLocation = location;
1006 1000 Bookmark b = hasBookmark();
1007 1001 if (b != null) {
1008   - bookmarkLabel.setImage(EPUBUIPlugin.getDefault().getImageRegistry()
1009   - .get(EPUBUIPlugin.IMG_BOOKMARK_ACTIVE));
  1002 + bookmarkLabel.setImage(EpubUIPlugin.getDefault().getImageRegistry()
  1003 + .get(EpubUIPlugin.IMG_BOOKMARK_ACTIVE));
1010 1004 bookmarkLabel.setToolTipText(b.getText() + "\n(Click to remove bookmark)");
1011 1005 } else {
1012   - bookmarkLabel.setImage(EPUBUIPlugin.getDefault().getImageRegistry()
1013   - .get(EPUBUIPlugin.IMG_BOOKMARK_INACTIVE));
  1006 + bookmarkLabel.setImage(EpubUIPlugin.getDefault().getImageRegistry()
  1007 + .get(EpubUIPlugin.IMG_BOOKMARK_INACTIVE));
1014 1008 bookmarkLabel.setToolTipText("Click to add bookmark");
1015 1009 }
1016 1010 } catch (Exception e) {
@@ -1028,7 +1022,7 @@ public void run() {
1028 1022 sb.append((char) c);
1029 1023 sb.append(' ');
1030 1024 }
1031   - header.setText(sb.toString());
  1025 + headerLabel.setText(sb.toString());
1032 1026 } catch (IOException e) {
1033 1027 e.printStackTrace();
1034 1028 }
@@ -1036,14 +1030,14 @@ public void run() {
1036 1030
1037 1031 });
1038 1032 // Update page number
1039   - label.getDisplay().asyncExec(new Runnable() {
  1033 + footerLabel.getDisplay().asyncExec(new Runnable() {
1040 1034 @Override
1041 1035 public void run() {
1042 1036 synchronized (paginationJob) {
1043 1037 if (paginationJob.getState() == Job.NONE) {
1044   - label.setText("Page " + getCurrentPage() + " of " + paginationJob.getTotalpages());
  1038 + footerLabel.setText("Page " + getCurrentPage() + " of " + paginationJob.getTotalpages());
1045 1039 } else {
1046   - label.setText("Paginating...");
  1040 + footerLabel.setText("Paginating...");
1047 1041 }
1048 1042 }
1049 1043 }
@@ -1156,15 +1150,15 @@ private void readJS(String filename, StringBuilder sb) throws IOException {
1156 1150 }
1157 1151
1158 1152 private void registerBook(IPath path, OPSPublication ops) {
1159   - String title = EPUBUtil.getFirstTitle(ops);
1160   - String author = EPUBUtil.getFirstAuthor(ops);
1161   - String id = EPUBUtil.getIdentifier(ops);
1162   - if (!EPUBCorePlugin.getCollection().hasBook(id)) {
  1153 + String title = EpubUtil.getFirstTitle(ops);
  1154 + String author = EpubUtil.getFirstAuthor(ops);
  1155 + String id = EpubUtil.getIdentifier(ops);
  1156 + if (!EpubCorePlugin.getCollection().hasBook(id)) {
1163 1157 URI uri = path.toFile().toURI();
1164   - currentBook = LibraryUtil.createNewBook(EPUBCorePlugin.COLLECTION_ID, uri, id, title, author);
1165   - EPUBCorePlugin.getCollection().add(currentBook);
  1158 + currentBook = LibraryUtil.createNewBook(EpubCorePlugin.COLLECTION_ID, uri, id, title, author);
  1159 + EpubCorePlugin.getCollection().add(currentBook);
1166 1160 } else {
1167   - currentBook = EPUBCorePlugin.getCollection().getBook(id);
  1161 + currentBook = EpubCorePlugin.getCollection().getBook(id);
1168 1162 }
1169 1163 }
1170 1164
4 no.resheim.elibrarium.epub.ui/src/no/resheim/elibrarium/epub/ui/reader/PaginationJob.java
@@ -19,7 +19,7 @@
19 19 import java.util.concurrent.Executors;
20 20 import java.util.concurrent.TimeUnit;
21 21
22   -import no.resheim.elibrarium.epub.core.EPUBUtil;
  22 +import no.resheim.elibrarium.epub.core.EpubUtil;
23 23
24 24 import org.eclipse.core.runtime.IProgressMonitor;
25 25 import org.eclipse.core.runtime.IStatus;
@@ -171,7 +171,7 @@ public int getWidth() {
171 171 private final Shell shell;
172 172
173 173 public PaginationJob(OPSPublication ops) {
174   - super(MessageFormat.format("Paginating \"{0}\"", EPUBUtil.getFirstTitle(ops)));
  174 + super(MessageFormat.format("Paginating \"{0}\"", EpubUtil.getFirstTitle(ops)));
175 175 this.ops = ops;
176 176 shell = new Shell();
177 177 browser = new Browser(shell, SWT.NONE);
20 no.resheim.elibrarium.epub.ui/src/no/resheim/elibrarium/epub/ui/reader/TOCOutlinePage.java
@@ -11,8 +11,8 @@
11 11 *******************************************************************************/
12 12 package no.resheim.elibrarium.epub.ui.reader;
13 13
14   -import no.resheim.elibrarium.epub.core.EPUBUtil;
15   -import no.resheim.elibrarium.epub.ui.EPUBUIPlugin;
  14 +import no.resheim.elibrarium.epub.core.EpubUtil;
  15 +import no.resheim.elibrarium.epub.ui.EpubUIPlugin;
16 16 import no.resheim.elibrarium.library.Annotation;
17 17 import no.resheim.elibrarium.library.Book;
18 18 import no.resheim.elibrarium.library.Bookmark;
@@ -89,7 +89,7 @@ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
89 89
90 90 private Composite pagebook;
91 91
92   - private final EPUBReader reader;
  92 + private final EpubReader reader;
93 93
94 94 private final ListenerList selectionChangedListeners = new ListenerList();
95 95
@@ -99,7 +99,7 @@ public void inputChanged(Viewer v, Object oldInput, Object newInput) {
99 99
100 100 private TreeViewer toc;
101 101
102   - public TOCOutlinePage(OPSPublication epub, EPUBReader reader) {
  102 + public TOCOutlinePage(OPSPublication epub, EpubReader reader) {
103 103 this.ops = epub;
104 104 this.reader = reader;
105 105 }
@@ -111,7 +111,7 @@ public void addSelectionChangedListener(ISelectionChangedListener listener) {
111 111 @Override
112 112 public void createControl(Composite parent) {
113 113
114   - Book book = EPUBUtil.getBook(ops);
  114 + Book book = EpubUtil.getBook(ops);
115 115
116 116 pagebook = new Composite(parent, SWT.NONE);
117 117 layout = new StackLayout();
@@ -119,13 +119,13 @@ public void createControl(Composite parent) {
119 119
120 120 toc = new TreeViewer(pagebook, getTreeStyle());
121 121 toc.setContentProvider(new TOCContentProvider());
122   - toc.setLabelProvider(new EPUBLabelProvider());
  122 + toc.setLabelProvider(new EpubLabelProvider());
123 123 toc.addSelectionChangedListener(this);
124 124 toc.addDoubleClickListener(this);
125 125
126 126 notes = new AnnotationViewer(pagebook, SWT.FULL_SELECTION);
127 127 notes.setContentProvider(new AnnotationsContentProvider());
128   - notes.setLabelProvider(new EPUBLabelProvider());
  128 + notes.setLabelProvider(new EpubLabelProvider());
129 129 notes.addSelectionChangedListener(this);
130 130 notes.addDoubleClickListener(this);
131 131
@@ -289,7 +289,7 @@ public void run() {
289 289 if (selection instanceof IStructuredSelection) {
290 290 Object o = ((IStructuredSelection) selection).getFirstElement();
291 291 if (o instanceof Annotation) {
292   - EPUBUtil.getBook(ops).getBookmarks().remove(o);
  292 + EpubUtil.getBook(ops).getBookmarks().remove(o);
293 293 }
294 294 }
295 295 }
@@ -298,9 +298,9 @@ public void run() {
298 298 deleteAction.setToolTipText("Deletes the note");
299 299
300 300
301   - showTOC.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EPUBUIPlugin.PLUGIN_ID,
  301 + showTOC.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EpubUIPlugin.PLUGIN_ID,
302 302 "icons/contents.gif"));
303   - showAnnotations.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EPUBUIPlugin.PLUGIN_ID,
  303 + showAnnotations.setImageDescriptor(AbstractUIPlugin.imageDescriptorFromPlugin(EpubUIPlugin.PLUGIN_ID,
304 304 "icons/marking.gif"));
305 305 }
306 306

No commit comments for this range

Something went wrong with that request. Please try again.