From 6c477e52cd7b6e3d4a35d2c25b85f7fe0ae59479 Mon Sep 17 00:00:00 2001 From: Frank Shaka Date: Thu, 19 Oct 2017 15:27:43 +0800 Subject: [PATCH] Release 3.7.3.201708180239 --- .../META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.cathy.fonts/pom.xml | 4 +- .../META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.cathy.win32/pom.xml | 4 +- bundles/org.xmind.cathy/META-INF/MANIFEST.MF | 20 +- bundles/org.xmind.cathy/pom.xml | 4 +- .../xmind/cathy/internal/BetaVerifier.java | 6 +- .../org/xmind/cathy/internal/CathyPlugin.java | 4 +- .../cathy/internal/CathyWorkbenchAdvisor.java | 10 +- .../xmind/cathy/internal/GeneralPrefPage.java | 6 +- .../StartupPreferencePageSection.java | 4 +- .../xmind/cathy/internal/WelcomeDialog.java | 8 +- .../dashboard/DashboardAutomationAddon.java | 26 +- .../xmind/cathy/internal/messages.properties | 2 +- .../META-INF/MANIFEST.MF | 4 +- bundles/org.xmind.core.command.remote/pom.xml | 4 +- .../META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.core.command/pom.xml | 4 +- .../org.xmind.core.io/META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.core.io/pom.xml | 4 +- .../META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.core.licensing/pom.xml | 4 +- .../org.xmind.core.net/META-INF/MANIFEST.MF | 5 +- bundles/org.xmind.core.net/pom.xml | 4 +- .../org/xmind/core/net/http/HttpRequest.java | 97 ++- .../xmind/core/net/http/IFinishHandler.java | 28 + .../core/net/internal/XMindNetRequest.java | 81 +- .../org/xmind/core/net/util/LinkUtils.java | 72 ++ .../META-INF/MANIFEST.MF | 4 +- bundles/org.xmind.core.runtime/pom.xml | 4 +- .../META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.core.usagedata/pom.xml | 4 +- .../core/internal/UserDataConstants.java | 32 +- bundles/org.xmind.core/META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.core/pom.xml | 4 +- .../xmind/core/internal/dom/FileFormat_1.java | 7 +- .../xmind/core/internal/dom/ManifestImpl.java | 2 +- .../xmind/core/internal/dom/SheetImpl.java | 2 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 4 +- bundles/org.xmind.gef.ui/META-INF/MANIFEST.MF | 6 +- bundles/org.xmind.gef.ui/pom.xml | 4 +- .../xmind/gef/ui/actions/ActionRegistry.java | 5 +- .../GraphicalPropertySheetPage.java | 23 + .../gef/ui/properties/PropertyPagePart.java | 28 +- .../ui/texteditor/FloatingTextEditTool.java | 4 +- bundles/org.xmind.gef/META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.gef/pom.xml | 4 +- .../src/org/xmind/gef/GraphicalViewer.java | 24 + .../xmind/gef/draw2d/RotatableWrapLabel.java | 31 +- .../org.xmind.neuquant/META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.neuquant/pom.xml | 4 +- .../META-INF/MANIFEST.MF | 2 +- .../pom.xml | 4 +- .../org.xmind.ui.browser/META-INF/MANIFEST.MF | 7 +- bundles/org.xmind.ui.browser/pom.xml | 4 +- .../ui/internal/browser/BrowserUtil.java | 13 +- .../ui/internal/browser/BrowserViewer.java | 16 +- .../META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.ui.dashboard/pom.xml | 4 +- .../META-INF/MANIFEST.MF | 12 +- .../org.xmind.ui.exports.vector.svg/pom.xml | 4 +- .../exports/vector/svg/SVGExporter.java | 2 +- .../META-INF/MANIFEST.MF | 4 +- bundles/org.xmind.ui.exports.vector/pom.xml | 4 +- .../META-INF/MANIFEST.MF | 6 +- bundles/org.xmind.ui.fishbone/pom.xml | 4 +- .../org.xmind.ui.imports/META-INF/MANIFEST.MF | 10 +- bundles/org.xmind.ui.imports/pom.xml | 4 +- .../org.xmind.ui.menus/META-INF/MANIFEST.MF | 10 +- bundles/org.xmind.ui.menus/plugin.xml | 2 +- bundles/org.xmind.ui.menus/pom.xml | 4 +- .../org.xmind.ui.mindmap/META-INF/MANIFEST.MF | 16 +- .../org.xmind.ui.mindmap/icons/comments.svg | 23 + .../org.xmind.ui.mindmap/icons/drill_down.svg | 22 + .../org.xmind.ui.mindmap/icons/drill_up.svg | 22 + .../org.xmind.ui.mindmap/icons/hyperlink.svg | 22 + bundles/org.xmind.ui.mindmap/icons/label.svg | 30 + .../icons/link_callout.svg | 27 + .../icons/link_central_topic.svg | 25 + .../icons/link_floating_Topic.svg | 23 + .../icons/link_main_topic.svg | 25 + .../icons/link_subtopic.svg | 25 + .../icons/link_summary.svg | 23 + bundles/org.xmind.ui.mindmap/icons/notes.svg | 24 + bundles/org.xmind.ui.mindmap/pom.xml | 4 +- .../ui/internal/InfoItemContributorProxy.java | 44 +- .../xmind/ui/internal/MindMapMessages.java | 4 + .../org/xmind/ui/internal/ShareOption.java | 10 +- .../ui/internal/TopicInfoItemManager.java | 134 ++++ .../RecentFileListContributionItem.java | 6 + .../comments/CommentsInfoItemContributor.java | 4 + .../internal/decorators/IconTipDecorator.java | 13 +- .../decorators/InfoItemIconDecorator.java | 11 + .../ui/internal/dialogs/ShareDialog.java | 58 +- .../e4handlers/OpenWorkbooksHandler.java | 5 +- .../internal/editor/LocalFileWorkbookRef.java | 163 +++- .../org/xmind/ui/internal/messages.properties | 2 + .../mindmap/DrillDownInfoItemContributor.java | 4 + .../mindmap/DrillUpInfoItemContributor.java | 4 + .../mindmap/HyperlinkInfoItemContributor.java | 53 ++ .../ui/internal/mindmap/IconTipPart.java | 89 +- .../ui/internal/mindmap/InfoItemIconPart.java | 94 ++- .../mindmap/LabelInfoItemContributor.java | 4 + .../xmind/ui/internal/mindmap/TopicPart.java | 65 +- .../notes/NotesInfoItemContributor.java | 4 + .../internal/properties/PropertiesPart.java | 23 + .../protocols/AttachmentProtocol.java | 78 +- .../ui/internal/protocols/FileProtocol.java | 7 +- .../internal/protocols/ProtocolManager.java | 12 +- .../ui/internal/protocols/TopicProtocol.java | 71 +- .../ui/internal/protocols/WebProtocol.java | 17 +- .../ui/internal/tools/MindMapSelectTool.java | 14 +- .../ui/internal/tools/QuickOpenHelper.java | 21 +- .../internal/zen/ExtensionsDeserializer.java | 94 +++ .../ui/internal/zen/ManifestDeserializer.java | 73 ++ .../ui/internal/zen/MetaDeserializer.java | 67 ++ .../src/org/xmind/ui/internal/zen/Ranges.java | 52 ++ .../ui/internal/zen/SheetDeserializer.java | 759 ++++++++++++++++++ .../ui/internal/zen/WorkbookDeserializer.java | 36 + .../xmind/ui/internal/zen/ZenConstants.java | 114 +++ .../ui/internal/zen/ZenDeserializer.java | 421 ++++++++++ .../mindmap/AbstractInfoItemContributor.java | 12 +- .../org/xmind/ui/mindmap/IHyperlinked.java | 7 + .../org/xmind/ui/mindmap/IIconTipPart.java | 5 +- .../ui/mindmap/IInfoItemContributor.java | 4 + .../org/xmind/ui/mindmap/IInfoItemPart.java | 5 +- .../wizards/AbstractMindMapExportWizard.java | 26 + .../ui/wizards/DocumentExportPageBase.java | 6 +- .../org/xmind/ui/wizards/MindMapImporter.java | 16 +- .../META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.ui.resources/pom.xml | 4 +- .../META-INF/MANIFEST.MF | 8 +- bundles/org.xmind.ui.spelling/pom.xml | 4 +- .../META-INF/MANIFEST.MF | 6 +- .../icons/add_column.svg | 32 + .../icons/add_row.svg | 32 + bundles/org.xmind.ui.spreadsheet/pom.xml | 4 +- .../AddColumnInfoItemContributor.java | 4 + .../AddRowInfoItemContributor.java | 4 + .../org.xmind.ui.toolkit/META-INF/MANIFEST.MF | 2 +- bundles/org.xmind.ui.toolkit/pom.xml | 4 +- .../statushandlers/RuntimeErrorDialog.java | 3 +- .../src/org/xmind/ui/io/DownloadJob.java | 40 +- .../src/org/xmind/ui/io/WebImageManager.java | 10 +- .../xmind/ui/properties/PropertiesEditor.java | 102 ++- .../xmind/ui/resources/ImageReference.java | 8 +- .../src/org/xmind/ui/util/JobPool.java | 139 ++++ .../xmind/ui/viewers/CategorizedViewer.java | 20 + bundles/org.xmind.ui/META-INF/MANIFEST.MF | 6 +- bundles/org.xmind.ui/pom.xml | 4 +- bundles/org.xmind.ui/schema/shareOptions.exsd | 15 + features/org.xmind.cathy.feature/feature.xml | 2 +- features/org.xmind.cathy.feature/pom.xml | 4 +- .../feature.xml | 2 +- .../org.xmind.cathy.platform.feature/pom.xml | 4 +- .../org.xmind.graphicsio.feature/feature.xml | 2 +- features/org.xmind.graphicsio.feature/pom.xml | 4 +- features/org.xmind.hebe.feature/feature.xml | 2 +- features/org.xmind.hebe.feature/pom.xml | 4 +- pom.xml | 2 +- .../META-INF/MANIFEST.MF | 2 +- releng/org.xmind.cathy.product/cathy.product | 2 +- releng/org.xmind.cathy.product/pom.xml | 4 +- .../org.xmind.cathy.repository/category.xml | 8 +- releng/org.xmind.cathy.repository/pom.xml | 2 +- releng/org.xmind.cathy.target/pom.xml | 2 +- .../META-INF/MANIFEST.MF | 4 +- tests/org.xmind.core.runtime.tests/pom.xml | 4 +- .../org.xmind.core.tests/META-INF/MANIFEST.MF | 4 +- tests/org.xmind.core.tests/pom.xml | 4 +- 171 files changed, 3732 insertions(+), 544 deletions(-) create mode 100644 bundles/org.xmind.core.net/src/org/xmind/core/net/http/IFinishHandler.java create mode 100644 bundles/org.xmind.core.net/src/org/xmind/core/net/util/LinkUtils.java create mode 100644 bundles/org.xmind.ui.mindmap/icons/comments.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/drill_down.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/drill_up.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/hyperlink.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/label.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/link_callout.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/link_central_topic.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/link_floating_Topic.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/link_main_topic.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/link_subtopic.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/link_summary.svg create mode 100644 bundles/org.xmind.ui.mindmap/icons/notes.svg create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/TopicInfoItemManager.java create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ExtensionsDeserializer.java create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ManifestDeserializer.java create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/MetaDeserializer.java create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/Ranges.java create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/SheetDeserializer.java create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/WorkbookDeserializer.java create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ZenConstants.java create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ZenDeserializer.java create mode 100644 bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IHyperlinked.java create mode 100644 bundles/org.xmind.ui.spreadsheet/icons/add_column.svg create mode 100644 bundles/org.xmind.ui.spreadsheet/icons/add_row.svg create mode 100644 bundles/org.xmind.ui.toolkit/src/org/xmind/ui/util/JobPool.java diff --git a/bundles/org.xmind.cathy.fonts/META-INF/MANIFEST.MF b/bundles/org.xmind.cathy.fonts/META-INF/MANIFEST.MF index e638c03e8..0441f360d 100644 --- a/bundles/org.xmind.cathy.fonts/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.cathy.fonts/META-INF/MANIFEST.MF @@ -2,5 +2,5 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.xmind.cathy.fonts -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: %Bundle-Vendor diff --git a/bundles/org.xmind.cathy.fonts/pom.xml b/bundles/org.xmind.cathy.fonts/pom.xml index 5401edff7..2525d3153 100644 --- a/bundles/org.xmind.cathy.fonts/pom.xml +++ b/bundles/org.xmind.cathy.fonts/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.cathy.fonts - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.cathy.win32/META-INF/MANIFEST.MF b/bundles/org.xmind.cathy.win32/META-INF/MANIFEST.MF index 2ddfbd9f9..5da84f1ce 100644 --- a/bundles/org.xmind.cathy.win32/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.cathy.win32/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.cathy.win32;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: %providerName Fragment-Host: org.xmind.cathy Bundle-RequiredExecutionEnvironment: JavaSE-1.6 diff --git a/bundles/org.xmind.cathy.win32/pom.xml b/bundles/org.xmind.cathy.win32/pom.xml index d92320c48..aeb3fb4cc 100644 --- a/bundles/org.xmind.cathy.win32/pom.xml +++ b/bundles/org.xmind.cathy.win32/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.cathy.win32 - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.cathy/META-INF/MANIFEST.MF b/bundles/org.xmind.cathy/META-INF/MANIFEST.MF index 7b7da612e..255862669 100644 --- a/bundles/org.xmind.cathy/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.cathy/META-INF/MANIFEST.MF @@ -2,11 +2,11 @@ Manifest-Version: 1.0 Bundle-SymbolicName: org.xmind.cathy;singleton:=true Require-Bundle: org.eclipse.core.runtime, org.eclipse.ui, - org.xmind.ui;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.imports;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)", - org.xmind.core.command;bundle-version="[3.7.2,3.8.0)", - org.xmind.core.command.remote;bundle-version="[3.7.2,3.8.0)", + org.xmind.ui;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.imports;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)", + org.xmind.core.command;bundle-version="[3.7.3,3.8.0)", + org.xmind.core.command.remote;bundle-version="[3.7.3,3.8.0)", org.eclipse.e4.ui.workbench, org.eclipse.ui.themes, org.eclipse.e4.ui.model.workbench, @@ -27,12 +27,12 @@ Require-Bundle: org.eclipse.core.runtime, org.eclipse.core.expressions, org.eclipse.e4.core.commands, org.xmind.ui.dashboard, - org.xmind.core.usagedata;bundle-version="[3.7.2,3.8.0)", + org.xmind.core.usagedata;bundle-version="[3.7.3,3.8.0)", org.json, - org.xmind.ui.browser;bundle-version="[3.7.2,3.8.0)", - org.xmind.core.licensing;bundle-version="[3.7.2,3.8.0)", + org.xmind.ui.browser;bundle-version="[3.7.3,3.8.0)", + org.xmind.core.licensing;bundle-version="[3.7.3,3.8.0)", org.eclipse.e4.ui.workbench.addons.swt, - org.xmind.ui.mindmap;bundle-version="3.7.2", + org.xmind.ui.mindmap;bundle-version="3.7.3", org.eclipse.ui.net;bundle-version="1.3.0", org.eclipse.emf.ecore.xmi Bundle-ManifestVersion: 2 @@ -49,5 +49,5 @@ Export-Package: org.xmind.cathy.internal;x-internal:=true,org.xmind.ca l.renderer;x-internal:=true,org.xmind.ui.internal.e4handlers;x-intern al:=true Bundle-Name: %pluginName -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.cathy.internal.CathyPlugin diff --git a/bundles/org.xmind.cathy/pom.xml b/bundles/org.xmind.cathy/pom.xml index 47cd3ce39..e690e63e4 100644 --- a/bundles/org.xmind.cathy/pom.xml +++ b/bundles/org.xmind.cathy/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.cathy - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/BetaVerifier.java b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/BetaVerifier.java index 362a6c4ba..073c37708 100644 --- a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/BetaVerifier.java +++ b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/BetaVerifier.java @@ -24,6 +24,7 @@ import org.eclipse.swt.graphics.Image; import org.eclipse.swt.program.Program; import org.eclipse.swt.widgets.Display; +import org.xmind.core.net.util.LinkUtils; public class BetaVerifier { @@ -107,8 +108,9 @@ private void promptBetaExpiry() { } private void openDownloadSite() { - Program.launch("http://www.xmind.net/xmind/beta-expired/" //$NON-NLS-1$ - + buildId.replace("qualifier", "000000000000")); //$NON-NLS-1$ //$NON-NLS-2$ + Program.launch( + LinkUtils.getLinkByLanguage(true, false, "/xmind/beta-expired/") //$NON-NLS-1$ + + buildId.replace("qualifier", "000000000000")); //$NON-NLS-1$ //$NON-NLS-2$ } public static boolean isBeta() { diff --git a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/CathyPlugin.java b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/CathyPlugin.java index 698279bc5..a9c4eb9dd 100644 --- a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/CathyPlugin.java +++ b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/CathyPlugin.java @@ -38,6 +38,7 @@ import org.xmind.core.internal.runtime.WorkspaceConfigurer; import org.xmind.core.internal.runtime.WorkspaceSession; import org.xmind.core.licensing.ILicenseAgent; +import org.xmind.core.net.util.LinkUtils; import org.xmind.core.usagedata.IUsageDataSampler; import org.xmind.ui.internal.app.ApplicationConstants; import org.xmind.ui.internal.statushandlers.DefaultErrorReporter; @@ -157,7 +158,8 @@ public class CathyPlugin extends AbstractUIPlugin { /** * Online help page. */ - public static final String ONLINE_HELP_URL = "https://www.xmind.net/xmind/help"; //$NON-NLS-1$ + public static final String ONLINE_HELP_URL = LinkUtils + .getLinkByLanguage(true, true, "/xmind/help"); //$NON-NLS-1$ /** * Boolean value:
diff --git a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/CathyWorkbenchAdvisor.java b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/CathyWorkbenchAdvisor.java index 55730284b..5856a8a07 100644 --- a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/CathyWorkbenchAdvisor.java +++ b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/CathyWorkbenchAdvisor.java @@ -203,9 +203,13 @@ private XMLMemento recordEditorsState( private void saveEditorsState(IMemento memento, ArrayList editorRefs) { - IWorkbenchPage activePage = PlatformUI.getWorkbench() - .getActiveWorkbenchWindow().getActivePage(); - IEditorPart activeEditor = activePage.getActiveEditor(); + IEditorPart activeEditor = null; + + IWorkbenchWindow window = PlatformUI.getWorkbench() + .getActiveWorkbenchWindow(); + if (window != null && window.getActivePage() != null) { + activeEditor = window.getActivePage().getActiveEditor(); + } IMemento childrenMemento = memento .createChild(IWorkbenchConstants.TAG_EDITORS); diff --git a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/GeneralPrefPage.java b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/GeneralPrefPage.java index 8fc1e631d..b6f9b2fb9 100644 --- a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/GeneralPrefPage.java +++ b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/GeneralPrefPage.java @@ -43,6 +43,7 @@ import org.eclipse.ui.forms.widgets.Hyperlink; import org.eclipse.ui.internal.IPreferenceConstants; import org.eclipse.ui.internal.WorkbenchPlugin; +import org.xmind.core.net.util.LinkUtils; import org.xmind.core.usagedata.IUsageDataSampler; import org.xmind.core.usagedata.IUsageDataUploader; import org.xmind.ui.internal.MindMapUIPlugin; @@ -484,7 +485,8 @@ private void addSendUsageDataGroup() { (Color) resources.get(ColorUtils.toDescriptor("#77afe0"))); //$NON-NLS-1$ privacyHyperlink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { - Program.launch("http://www.xmind.net/privacy/usage/"); //$NON-NLS-1$ + Program.launch(LinkUtils.getLinkByLanguage(true, false, + "/privacy/usage/")); //$NON-NLS-1$ } }); @@ -614,4 +616,4 @@ public void handleEvent(Event event) { // checkState(); // } } -} \ No newline at end of file +} diff --git a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/StartupPreferencePageSection.java b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/StartupPreferencePageSection.java index ff8601caf..00d64a43c 100644 --- a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/StartupPreferencePageSection.java +++ b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/StartupPreferencePageSection.java @@ -19,6 +19,7 @@ import org.eclipse.ui.forms.events.HyperlinkAdapter; import org.eclipse.ui.forms.events.HyperlinkEvent; import org.eclipse.ui.forms.widgets.Hyperlink; +import org.xmind.core.net.util.LinkUtils; import org.xmind.core.usagedata.IUsageDataSampler; import org.xmind.core.usagedata.IUsageDataUploader; import org.xmind.ui.preference.PreferenceFieldEditorPageSection; @@ -115,7 +116,8 @@ private void addSendUsageDataGroup(Composite parent) { (Color) resources.get(ColorUtils.toDescriptor("#006CF9"))); //$NON-NLS-1$ privacyHyperlink.addHyperlinkListener(new HyperlinkAdapter() { public void linkActivated(HyperlinkEvent e) { - Program.launch("http://www.xmind.net/privacy/usage/"); //$NON-NLS-1$ + Program.launch(LinkUtils.getLinkByLanguage(true, false, + "/privacy/usage/")); //$NON-NLS-1$ } }); diff --git a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/WelcomeDialog.java b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/WelcomeDialog.java index 5ba7cc3b3..a73c216fc 100644 --- a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/WelcomeDialog.java +++ b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/WelcomeDialog.java @@ -32,6 +32,7 @@ import org.eclipse.ui.forms.events.HyperlinkEvent; import org.eclipse.ui.forms.events.IHyperlinkListener; import org.eclipse.ui.forms.widgets.Hyperlink; +import org.xmind.core.net.util.LinkUtils; import org.xmind.ui.resources.ColorUtils; import org.xmind.ui.resources.FontUtils; @@ -98,7 +99,7 @@ private void createTopSection(Composite parent) { composite.setBackground(parent.getBackground()); GridData layoutData = new GridData(SWT.FILL, SWT.TOP, true, false); layoutData.widthHint = 740; - layoutData.heightHint = 120; +// layoutData.heightHint = 120; composite.setLayoutData(layoutData); GridLayout layout = new GridLayout(1, false); @@ -243,7 +244,7 @@ public void handleEvent(Event event) { private void createTitleSection(Composite parent) { Composite composite = new Composite(parent, SWT.NONE); composite.setBackground(parent.getBackground()); - GridData gridData = new GridData(SWT.FILL, SWT.CENTER, true, true); + GridData gridData = new GridData(SWT.FILL, SWT.FILL, true, true); composite.setLayoutData(gridData); GridLayout layout = new GridLayout(2, false); @@ -514,7 +515,8 @@ public void linkEntered(HyperlinkEvent e) { } public void linkActivated(HyperlinkEvent e) { - Program.launch("http://www.xmind.net/privacy/usage/"); //$NON-NLS-1$ + Program.launch(LinkUtils.getLinkByLanguage(true, false, + "/privacy/usage/")); //$NON-NLS-1$ } }); } diff --git a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/dashboard/DashboardAutomationAddon.java b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/dashboard/DashboardAutomationAddon.java index b53590b82..998ecca5d 100644 --- a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/dashboard/DashboardAutomationAddon.java +++ b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/dashboard/DashboardAutomationAddon.java @@ -289,13 +289,29 @@ public static final String hideVisiblePart(MWindow window, } MPartStack partStack = partStacks.get(0); - MPart visiblePart = null; MStackElement selectedElement = partStack.getSelectedElement(); - if (selectedElement instanceof MPlaceholder) { - MPlaceholder placeholder = (MPlaceholder) selectedElement; + String hidePartId = hidePart(partService, selectedElement); + if (hidePartId != null) { + return hidePartId; + } + + //fix: part may not be hiden + List children = partStack.getChildren(); + for (MStackElement child : children) { + hidePart(partService, child); + } + + return null; + } + + private static String hidePart(EPartService partService, + MStackElement element) { + MPart visiblePart = null; + if (element instanceof MPlaceholder) { + MPlaceholder placeholder = (MPlaceholder) element; visiblePart = partService.findPart(placeholder.getElementId()); - } else if (selectedElement instanceof MPart) { - visiblePart = (MPart) selectedElement; + } else if (element instanceof MPart) { + visiblePart = (MPart) element; } if (visiblePart != null) { diff --git a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/messages.properties b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/messages.properties index 6bf60a363..4ae94e8ea 100644 --- a/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/messages.properties +++ b/bundles/org.xmind.cathy/src/org/xmind/cathy/internal/messages.properties @@ -137,7 +137,7 @@ BetaVerifier_BetaExpiredPromptDialog_ExitButton_text=&Exit BetaVerifier_BetaExpiredPromptDialog_DownloadFailure_message=Oops! An error occurred. Please try again later, or visit www.xmind.net and download the latest release manually. -About_Copyright=Copyright (C) 2006 - 2016, XMind Ltd. All rights reserved. +About_Copyright=Copyright (C) 2006 - 2017, XMind Ltd. All rights reserved. About_Homepage=http://www.xmind.net/ About_BetaExpiryMessage_withExpiryTime=This beta edition will expire at {0}.\n diff --git a/bundles/org.xmind.core.command.remote/META-INF/MANIFEST.MF b/bundles/org.xmind.core.command.remote/META-INF/MANIFEST.MF index 6b23955c0..ff181ffbb 100644 --- a/bundles/org.xmind.core.command.remote/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.core.command.remote/META-INF/MANIFEST.MF @@ -2,11 +2,11 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.xmind.core.command.remote;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.core.internal.command.remote.RemoteCommandPlugin Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, - org.xmind.core.command;bundle-version="[3.7.2,3.8.0)";visibility:=reexport + org.xmind.core.command;bundle-version="[3.7.3,3.8.0)";visibility:=reexport Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Export-Package: org.xmind.core.command.remote, diff --git a/bundles/org.xmind.core.command.remote/pom.xml b/bundles/org.xmind.core.command.remote/pom.xml index 9d5c2a095..1d3177e82 100644 --- a/bundles/org.xmind.core.command.remote/pom.xml +++ b/bundles/org.xmind.core.command.remote/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.core.command.remote - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.core.command/META-INF/MANIFEST.MF b/bundles/org.xmind.core.command/META-INF/MANIFEST.MF index 61944f75c..dc854a09a 100644 --- a/bundles/org.xmind.core.command/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.core.command/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.xmind.core.command;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.core.internal.command.XMindCommandPlugin Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime diff --git a/bundles/org.xmind.core.command/pom.xml b/bundles/org.xmind.core.command/pom.xml index bc4f88412..f33043a6d 100644 --- a/bundles/org.xmind.core.command/pom.xml +++ b/bundles/org.xmind.core.command/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.core.command - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.core.io/META-INF/MANIFEST.MF b/bundles/org.xmind.core.io/META-INF/MANIFEST.MF index 0785b4c8b..780c20e97 100644 --- a/bundles/org.xmind.core.io/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.core.io/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.core.io;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy diff --git a/bundles/org.xmind.core.io/pom.xml b/bundles/org.xmind.core.io/pom.xml index e468a9e64..c4f6c7bc6 100644 --- a/bundles/org.xmind.core.io/pom.xml +++ b/bundles/org.xmind.core.io/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.core.io - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.core.licensing/META-INF/MANIFEST.MF b/bundles/org.xmind.core.licensing/META-INF/MANIFEST.MF index 1e43a446a..3674d5465 100644 --- a/bundles/org.xmind.core.licensing/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.core.licensing/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Licensing API Bundle-SymbolicName: org.xmind.core.licensing -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: XMind Ltd. Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: org.xmind.core.licensing diff --git a/bundles/org.xmind.core.licensing/pom.xml b/bundles/org.xmind.core.licensing/pom.xml index cd9ffaad7..ab1caa0b6 100644 --- a/bundles/org.xmind.core.licensing/pom.xml +++ b/bundles/org.xmind.core.licensing/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.core.licensing - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.core.net/META-INF/MANIFEST.MF b/bundles/org.xmind.core.net/META-INF/MANIFEST.MF index bf194f1bf..64b4e8857 100644 --- a/bundles/org.xmind.core.net/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.core.net/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.core.net;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.core.net.internal.Activator Require-Bundle: org.eclipse.core.runtime, org.json;bundle-version="1.0.0" @@ -10,5 +10,6 @@ Bundle-RequiredExecutionEnvironment: JavaSE-1.7 Bundle-ActivationPolicy: lazy Export-Package: org.xmind.core.net, org.xmind.core.net.http, - org.xmind.core.net.internal;x-internal:=true + org.xmind.core.net.internal;x-internal:=true, + org.xmind.core.net.util Bundle-Vendor: %providerName diff --git a/bundles/org.xmind.core.net/pom.xml b/bundles/org.xmind.core.net/pom.xml index d92cdbf83..b811dc07f 100644 --- a/bundles/org.xmind.core.net/pom.xml +++ b/bundles/org.xmind.core.net/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.core.net - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.core.net/src/org/xmind/core/net/http/HttpRequest.java b/bundles/org.xmind.core.net/src/org/xmind/core/net/http/HttpRequest.java index 8623383b5..8ac84a7b5 100644 --- a/bundles/org.xmind.core.net/src/org/xmind/core/net/http/HttpRequest.java +++ b/bundles/org.xmind.core.net/src/org/xmind/core/net/http/HttpRequest.java @@ -26,6 +26,7 @@ import java.io.UnsupportedEncodingException; import java.net.HttpURLConnection; import java.net.MalformedURLException; +import java.net.SocketTimeoutException; import java.net.URL; import java.net.URLConnection; import java.security.KeyManagementException; @@ -303,6 +304,8 @@ public class HttpRequest { private IResponseHandler responseHandler; + private IFinishHandler finishHandler; + private int statusCode; private String statusMessage; @@ -387,6 +390,18 @@ public IResponseHandler getResponseHandler() { return responseHandler; } + public void setFinishHandler(IFinishHandler finishHandler) { + this.finishHandler = finishHandler; + } + + public IFinishHandler getFinishHandler() { + return finishHandler; + } + + public byte[] getResponseBuffer() { + return responseBuffer; + } + public String getResponseAsString() { if (responseBuffer == null) return null; @@ -529,47 +544,71 @@ private void doExecute(IProgressMonitor monitor, if (monitor.isCanceled()) throw new InterruptedException(); - int connectTimeout = settings.getInt(SETTING_CONNECT_TIMEOUT, -1); - if (connectTimeout >= 0) { - connection.setConnectTimeout(connectTimeout); - } - int readTimeout = settings.getInt(SETTING_READ_TIMEOUT, -1); - if (readTimeout >= 0) { - connection.setReadTimeout(readTimeout); - } - log("Sending...."); //$NON-NLS-1$ setStatusCode(HTTP_SENDING, "Sending"); //$NON-NLS-1$ if (monitor.isCanceled()) throw new InterruptedException(); try { - connection.setDoOutput(requestEntity != null); - if (monitor.isCanceled()) - throw new InterruptedException(); + while (true) { + int connectTimeout = settings.getInt(SETTING_CONNECT_TIMEOUT, + -1); + if (connectTimeout >= 0) { + connection.setConnectTimeout(connectTimeout); + } - connection.setRequestMethod(method); - if (monitor.isCanceled()) - throw new InterruptedException(); + int readTimeout = settings.getInt(SETTING_READ_TIMEOUT, -1); + if (readTimeout >= 0) { + connection.setReadTimeout(readTimeout); + } - writeHeaders(connection); - if (monitor.isCanceled()) - throw new InterruptedException(); + /// connection auto redirect don't have needed params + connection.setInstanceFollowRedirects(false); - writeBody(monitor, connection); - if (monitor.isCanceled()) - throw new InterruptedException(); + connection.setDoOutput(requestEntity != null); + if (monitor.isCanceled()) + throw new InterruptedException(); - log("Waiting..."); //$NON-NLS-1$ - setStatusCode(HTTP_WAITING, "Waiting"); //$NON-NLS-1$ - if (monitor.isCanceled()) - throw new InterruptedException(); + connection.setRequestMethod(method); + if (monitor.isCanceled()) + throw new InterruptedException(); + + writeHeaders(connection); + if (monitor.isCanceled()) + throw new InterruptedException(); + + writeBody(monitor, connection); + if (monitor.isCanceled()) + throw new InterruptedException(); + + log("Waiting..."); //$NON-NLS-1$ + setStatusCode(HTTP_WAITING, "Waiting"); //$NON-NLS-1$ + if (monitor.isCanceled()) + throw new InterruptedException(); + + /// auto redirect + int responseCode = connection.getResponseCode(); + if (responseCode == HTTP_MOVED_PERM + || responseCode == HTTP_MOVED_TEMP) { + String newLocation = connection.getHeaderField("Location"); //$NON-NLS-1$ + connection = (HttpURLConnection) new URL(newLocation) + .openConnection(); + _connection[0] = connection; + + if (monitor.isCanceled()) + throw new InterruptedException(); + } else { + break; + } + } readResponse(monitor, connection, connection.getInputStream(), connection.getResponseCode(), connection.getResponseMessage()); if (monitor.isCanceled()) throw new InterruptedException(); + } catch (SocketTimeoutException e) { + throw e; } catch (IOException e) { InputStream errorStream = connection.getErrorStream(); if (errorStream == null) { @@ -753,6 +792,14 @@ private void readResponse(IProgressMonitor monitor, } log("Handled."); //$NON-NLS-1$ + + if (finishHandler != null) { + try { + finishHandler.handleRequestFinished(monitor, this); + } catch (OperationCanceledException e) { + throw new InterruptedException(); + } + } } private long getResponseLength(InputStream readStream) throws IOException { diff --git a/bundles/org.xmind.core.net/src/org/xmind/core/net/http/IFinishHandler.java b/bundles/org.xmind.core.net/src/org/xmind/core/net/http/IFinishHandler.java new file mode 100644 index 000000000..86a21b0fa --- /dev/null +++ b/bundles/org.xmind.core.net/src/org/xmind/core/net/http/IFinishHandler.java @@ -0,0 +1,28 @@ +/* ****************************************************************************** + * Copyright (c) 2006-2016 XMind Ltd. and others. + * + * This file is a part of XMind 3. XMind releases 3 and + * above are dual-licensed under the Eclipse Public License (EPL), + * which is available at http://www.eclipse.org/legal/epl-v10.html + * and the GNU Lesser General Public License (LGPL), + * which is available at http://www.gnu.org/licenses/lgpl.html + * See http://www.xmind.net/license.html for details. + * + * Contributors: + * XMind Ltd. - initial API and implementation + *******************************************************************************/ +/** + * + */ +package org.xmind.core.net.http; + +import java.io.IOException; + +import org.eclipse.core.runtime.IProgressMonitor; + +public interface IFinishHandler { + + void handleRequestFinished(IProgressMonitor monitor, HttpRequest request) + throws InterruptedException, IOException; + +} diff --git a/bundles/org.xmind.core.net/src/org/xmind/core/net/internal/XMindNetRequest.java b/bundles/org.xmind.core.net/src/org/xmind/core/net/internal/XMindNetRequest.java index 9cd019f93..c62968268 100644 --- a/bundles/org.xmind.core.net/src/org/xmind/core/net/internal/XMindNetRequest.java +++ b/bundles/org.xmind.core.net/src/org/xmind/core/net/internal/XMindNetRequest.java @@ -56,6 +56,7 @@ import org.xmind.core.net.IDataStore; import org.xmind.core.net.JSONStore; import org.xmind.core.net.http.HttpRequest; +import org.xmind.core.net.util.LinkUtils; /** * @deprecated Use {@link HttpRequest} instead @@ -267,7 +268,7 @@ public class XMindNetRequest { private static final boolean DEBUG_ASSC = Activator .isDebugging("/debug/requests/assc"); //$NON-NLS-1$ - private static final String DEFAULT_DOMAIN = "www.xmind.net"; //$NON-NLS-1$ + private static final String DEFAULT_DOMAIN = LinkUtils.HOST_NET; private static final String HEAD = "HEAD"; //$NON-NLS-1$ @@ -317,7 +318,6 @@ public String getEncodedValue() { /* * (non-Javadoc) - * * @see java.lang.Object#toString() */ @Override @@ -434,7 +434,7 @@ private byte[] getBoundary() { return boundary; Random rand = new Random(); byte[] bytes = new byte[rand.nextInt(11) + 30]; // a random size - // from 30 to 40 + // from 30 to 40 for (int i = 0; i < bytes.length; i++) { bytes[i] = BOUNDARY_CHARS[rand.nextInt(BOUNDARY_CHARS.length)]; } @@ -946,33 +946,57 @@ protected void send(String uri, RequestWriter writer) throws IOException { throw new OperationCanceledException(); try { - connection.setDoOutput(writer != null); - if (isAborted()) - throw new OperationCanceledException(); - connection.setRequestMethod(method); - if (isAborted()) - throw new OperationCanceledException(); + while (true) { + /// connection auto redirect don't have needed params + connection.setInstanceFollowRedirects(false); - if (writer != null) { - writer.init(params); - } - if (isAborted()) - throw new OperationCanceledException(); + connection.setDoOutput(writer != null); + if (isAborted()) + throw new OperationCanceledException(); + connection.setRequestMethod(method); + if (isAborted()) + throw new OperationCanceledException(); - writeHeaders(uri, connection, writer); - if (isAborted()) - throw new OperationCanceledException(); + if (writer != null) { + writer.init(params); + } + if (isAborted()) + throw new OperationCanceledException(); - if (writer != null) { - writeBody(uri, connection, writer); - } - if (isAborted()) - throw new OperationCanceledException(); + writeHeaders(uri, connection, writer); + if (isAborted()) + throw new OperationCanceledException(); - setStatusCode(HTTP_WAITING); - debug("HTTP Request: (Waiting...) %s %s", method, uri); //$NON-NLS-1$ - if (isAborted()) - throw new OperationCanceledException(); + if (writer != null) { + writeBody(uri, connection, writer); + } + if (isAborted()) + throw new OperationCanceledException(); + + setStatusCode(HTTP_WAITING); + debug("HTTP Request: (Waiting...) %s %s", method, uri); //$NON-NLS-1$ + if (isAborted()) + throw new OperationCanceledException(); + + /// auto redirect + int responseCode = connection.getResponseCode(); + if (responseCode == HTTP_MOVED_PERM + || responseCode == HTTP_MOVED_TEMP) { + String newLocation = connection.getHeaderField("Location"); //$NON-NLS-1$ + if (proxy != null) { + connection = (HttpURLConnection) new URL(newLocation) + .openConnection(proxy); + } else { + connection = (HttpURLConnection) new URL(newLocation) + .openConnection(); + } + if (isAborted()) { + throw new OperationCanceledException(); + } + } else { + break; + } + } readResponse(uri, connection, connection.getInputStream(), connection.getResponseCode()); @@ -1297,7 +1321,6 @@ private static void assc(HttpURLConnection connection) { /** * A solution to accept self-signed SSL certificates. - * *

* Source came from Craig Flichel's post 4.0.0 org.xmind.cathy.plugins org.xmind.core.runtime - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.core.usagedata/META-INF/MANIFEST.MF b/bundles/org.xmind.core.usagedata/META-INF/MANIFEST.MF index ee3b2891c..9849c1072 100644 --- a/bundles/org.xmind.core.usagedata/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.core.usagedata/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Usage Data API Bundle-SymbolicName: org.xmind.core.usagedata -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy diff --git a/bundles/org.xmind.core.usagedata/pom.xml b/bundles/org.xmind.core.usagedata/pom.xml index 2734e1f7f..2158068c4 100644 --- a/bundles/org.xmind.core.usagedata/pom.xml +++ b/bundles/org.xmind.core.usagedata/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.core.usagedata - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.core.usagedata/src/org/xmind/core/internal/UserDataConstants.java b/bundles/org.xmind.core.usagedata/src/org/xmind/core/internal/UserDataConstants.java index 88b9c7649..f47bd7b0f 100644 --- a/bundles/org.xmind.core.usagedata/src/org/xmind/core/internal/UserDataConstants.java +++ b/bundles/org.xmind.core.usagedata/src/org/xmind/core/internal/UserDataConstants.java @@ -21,18 +21,18 @@ public class UserDataConstants { public static final String APP_ID = "AppId"; //$NON-NLS-1$ public static final String BUY_COUNT = "BuyCount"; //$NON-NLS-1$ - public static final String BUY_FOR_S_COUNT = "BuyFor%sCount"; //$NON-NLS-1$ + public static final String BUY_FOR_S_COUNT = "BuyCountFor/%s"; //$NON-NLS-1$ public static final String SUBSCRIBE_COUNT = "SubscribeCount"; //$NON-NLS-1$ public static final String KEY_AUTH_SESSION_ID = "sessionId"; //$NON-NLS-1$ public static final String KEY_AUTH_ACCOUNT_ID = "user"; //$NON-NLS-1$ - public static final String KEY_AUTH_SIGN_IN_TIME_WITH_SESSION_ID = "XMindIdAuthorizations/%s/SignInTime"; //$NON-NLS-1$ - public static final String KEY_AUTH_SIGN_OUT_TIME_WITH_SESSION_ID = "XMindIdAuthorizations/%s/SignOutTime"; //$NON-NLS-1$ - public static final String KEY_AUTH_ACCOUNT_TYPE_WITH_SESSION_ID = "XMindIdAuthorizations/%s/AccountType"; //$NON-NLS-1$ + public static final String KEY_AUTH_SIGN_IN_TIME_WITH_SESSION_ID = "XMindIdAuthorizations/SignInTime/%s"; //$NON-NLS-1$ + public static final String KEY_AUTH_SIGN_OUT_TIME_WITH_SESSION_ID = "XMindIdAuthorizations/SignOutTime/%s"; //$NON-NLS-1$ + public static final String KEY_AUTH_ACCOUNT_TYPE_WITH_SESSION_ID = "XMindIdAuthorizations/AccountType/%s"; //$NON-NLS-1$ - public static final String KEY_SHOW_TIME = "Notifications/%s/%s/ShowTime"; //$NON-NLS-1$ - public static final String KEY_DISMISS_TIME = "Notifications/%s/%s/DismissTime"; //$NON-NLS-1$ - public static final String KEY_CLICK_TIME = "Notifications/%s/%s/ClickTime"; //$NON-NLS-1$ + public static final String KEY_SHOW_TIME = "Notifications/ShowTime/%s/%s"; //$NON-NLS-1$ + public static final String KEY_DISMISS_TIME = "Notifications/DismissTime/%s/%s"; //$NON-NLS-1$ + public static final String KEY_CLICK_TIME = "Notifications/ClickTime/%s/%s"; //$NON-NLS-1$ /** Workbook */ public static final String CREATE_WORKBOOK_COUNT = "CreateWorkbookCount"; //$NON-NLS-1$ @@ -50,13 +50,13 @@ public class UserDataConstants { public static final String TOGGLE_MULTI_COLOR_COUNT = "ToggleMultiColorCount"; //$NON-NLS-1$ public static final String CHANGE_LEGEND_BACKGROUD_COUNT = "ChangeLegendBackgroudCount"; //$NON-NLS-1$ public static final String SHOW_LEGEND_COUNT = "ShowLegendCount"; //$NON-NLS-1$ - public static final String NUMBERING_TYPE_COUNT = "Numbering/%s/TypeCount"; //$NON-NLS-1$ + public static final String NUMBERING_TYPE_COUNT = "Numbering/TypeCount/%s"; //$NON-NLS-1$ public static final String NUMBER_DEPTH_COUNT = "NumberDepthCount"; //$NON-NLS-1$ public static final String FILTER_OPERATION_COUNT = "FilterOperationCount"; //$NON-NLS-1$ public static final String WELCOME_TO_XMIND_COUNT = "WelcomeToXmindCount"; //$NON-NLS-1$ public static final String SHOW_PRO_COUNT = "ShowProCount"; //$NON-NLS-1$ - public static final String SHOW_PRO_FOR_S_COUNT = "ShowProFor%sCount"; //$NON-NLS-1$ + public static final String SHOW_PRO_FOR_S_COUNT = "ShowProCountFor/%s"; //$NON-NLS-1$ /** Modify */ public static final String DRILL_DOWN_COUNT = "DrillDownCount"; //$NON-NLS-1$ @@ -71,7 +71,7 @@ public class UserDataConstants { public static final String SPREAD_SHEET_COUNT = "SpreadSheetCount"; //$NON-NLS-1$ /** Structure */ - public static final String STRUCTURE_TYPE_COUNT = "Structure/%s/TypeCount";//$NON-NLS-1$ + public static final String STRUCTURE_TYPE_COUNT = "Structure/TypeCount/%s";//$NON-NLS-1$ public static final String MODIFY_STRUCTURE_COUNT = "ModifyStructureCount"; //$NON-NLS-1$ /** MarkerPart */ @@ -101,7 +101,7 @@ public class UserDataConstants { /** Template */ public static final String SHOW_TEMPLATES_COUNT = "ShowTemplatesCount"; //$NON-NLS-1$ public static final String USE_TEMPLATES_COUNT = "UseTemplatesCount"; //$NON-NLS-1$ - public static final String USE_S_TEMPLATE_COUNT = "Template/%s/UseCount";//$NON-NLS-1$ + public static final String USE_S_TEMPLATE_COUNT = "Template/UseCount/%s";//$NON-NLS-1$ /** Theme */ public static final String SHOW_THEME_COUNT = "ShowThemeCount"; //$NON-NLS-1$ @@ -109,7 +109,7 @@ public class UserDataConstants { public static final String EDIT_THEME_COUNT = "EditThemeCount"; //$NON-NLS-1$ public static final String EXTRACT_THEME_COUNT = "ExtractThemeCount"; //$NON-NLS-1$ public static final String CREATE_THEME_COUNT = "CreateThemeCount"; //$NON-NLS-1$ - public static final String USE_S_THEME_COUNT = "Theme/%s/UseCount";//$NON-NLS-1$ + public static final String USE_S_THEME_COUNT = "Theme/UseCount/%s";//$NON-NLS-1$ /** Style */ public static final String CREATE_STYLE_COUNT = "CreateStyleCount"; //$NON-NLS-1$ @@ -125,7 +125,7 @@ public class UserDataConstants { public static final String ADD_ATTACHMENT_COUNT = "AddAttachmentCount"; //$NON-NLS-1$ public static final String ATTACHMENT_FORMAT_COUNT_BLANK_FORMAT = "AttachmentFormatCount:BlankFormat"; //$NON-NLS-1$ - public static final String ATTACHMENT_FORMAT_COUNT_S = "Attachment/%s/FormatCount"; //$NON-NLS-1$ + public static final String ATTACHMENT_FORMAT_COUNT_S = "Attachment/FormatCount/%s"; //$NON-NLS-1$ /** Import */ public static final String IMPORT_FROM_WORD_COUNT = "ImportFromWordCount"; //$NON-NLS-1$ @@ -183,7 +183,7 @@ public class UserDataConstants { public static final String DOWNLOAD_ICON_COUNT = "DownloadIconCount"; //$NON-NLS-1$ public static final String ICONFINDER_SHOW_SIZE_DIALOG_COUNT = "IconfinderShowSizeDialogCount"; //$NON-NLS-1$ public static final String ICONFINDER_ICON_USE_COUNT = "Iconfinder/Icon/UseCount"; //$NON-NLS-1$ - public static final String ICONFINDER_S_SEARCH_COUNT = "Iconfinder/%s/SearchCount"; //$NON-NLS-1$ + public static final String ICONFINDER_S_SEARCH_COUNT = "Iconfinder/SearchCount/%s"; //$NON-NLS-1$ /** AudioNotes */ public static final String INSERT_AUDIO_NOTES_COUNT = "InsertAudioNotesCount"; //$NON-NLS-1$ @@ -191,8 +191,8 @@ public class UserDataConstants { /** TaskInfoPart */ public static final String SHOW_TASK_INFO_PART_COUNT = "ShowTaskInfoPartCount"; //$NON-NLS-1$ - public static final String TASK_END_TIME = "Task/%s/startTime"; //$NON-NLS-1$ - public static final String TASK_START_TIME = "Task/%s/endTime"; //$NON-NLS-1$ + public static final String TASK_END_TIME = "Task/startTime/%s"; //$NON-NLS-1$ + public static final String TASK_START_TIME = "Task/endTime/%s"; //$NON-NLS-1$ public static final String TASK_INFO_CLICK_CHECK_POINT_COUNT = "TaskInfoClickCheckPointCount"; //$NON-NLS-1$ public static final String CHANGE_PREDECESSOR_COUNT = "ChangePredecessorCount"; //$NON-NLS-1$ public static final String REMOVE_PREDECESSOR_COUNT = "RemovePredecessorCount"; //$NON-NLS-1$ diff --git a/bundles/org.xmind.core/META-INF/MANIFEST.MF b/bundles/org.xmind.core/META-INF/MANIFEST.MF index e43d03666..286de2faa 100644 --- a/bundles/org.xmind.core/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.core/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.core -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Export-Package: org.xmind.core, org.xmind.core.event, org.xmind.core.internal;x-internal:=true, diff --git a/bundles/org.xmind.core/pom.xml b/bundles/org.xmind.core/pom.xml index e88d98564..6779880a3 100644 --- a/bundles/org.xmind.core/pom.xml +++ b/bundles/org.xmind.core/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.core - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.core/src/org/xmind/core/internal/dom/FileFormat_1.java b/bundles/org.xmind.core/src/org/xmind/core/internal/dom/FileFormat_1.java index 72b7ffa54..dcae5d3a1 100644 --- a/bundles/org.xmind.core/src/org/xmind/core/internal/dom/FileFormat_1.java +++ b/bundles/org.xmind.core/src/org/xmind/core/internal/dom/FileFormat_1.java @@ -145,7 +145,10 @@ public boolean identifies() throws CoreException, IOException { Element ele = document.getDocumentElement(); String version = DOMUtils.getAttribute(ele, ATTR_VERSION); - return version == null || VERSION.equals(version); + Element[] mapEles = DOMUtils.getChildElementsByTag(ele, TAG_MAP); + + return (version == null || VERSION.equals(version)) + && mapEles.length > 0; } public WorkbookImpl load() throws CoreException, IOException { @@ -828,4 +831,4 @@ private void loadControlPoint(IRelationship rel, int index, Element relEle, } } } -} \ No newline at end of file +} diff --git a/bundles/org.xmind.core/src/org/xmind/core/internal/dom/ManifestImpl.java b/bundles/org.xmind.core/src/org/xmind/core/internal/dom/ManifestImpl.java index 9c10d9ce3..dd24ac660 100644 --- a/bundles/org.xmind.core/src/org/xmind/core/internal/dom/ManifestImpl.java +++ b/bundles/org.xmind.core/src/org/xmind/core/internal/dom/ManifestImpl.java @@ -134,7 +134,7 @@ protected IStorage getStorage() { return storage; } - protected void setStreamNormalizer(IEntryStreamNormalizer normalizer) { + public void setStreamNormalizer(IEntryStreamNormalizer normalizer) { this.normalizer = normalizer == null ? IEntryStreamNormalizer.NULL : normalizer; } diff --git a/bundles/org.xmind.core/src/org/xmind/core/internal/dom/SheetImpl.java b/bundles/org.xmind.core/src/org/xmind/core/internal/dom/SheetImpl.java index 41d4be451..f06a7c265 100644 --- a/bundles/org.xmind.core/src/org/xmind/core/internal/dom/SheetImpl.java +++ b/bundles/org.xmind.core/src/org/xmind/core/internal/dom/SheetImpl.java @@ -301,7 +301,7 @@ public IMarkerRefCounter getMarkerRefCounter() { return markerRefCounter; } - protected void addNotify(WorkbookImpl workbook) { + public void addNotify(WorkbookImpl workbook) { getImplementation().setIdAttribute(DOMConstants.ATTR_ID, true); workbook.getAdaptableRegistry().registerById(this, getId(), getImplementation().getOwnerDocument()); diff --git a/bundles/org.xmind.de.erichseifert.vectorgraphics2d/META-INF/MANIFEST.MF b/bundles/org.xmind.de.erichseifert.vectorgraphics2d/META-INF/MANIFEST.MF index 6fb0ba0c2..f8a9e2cf8 100644 --- a/bundles/org.xmind.de.erichseifert.vectorgraphics2d/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.de.erichseifert.vectorgraphics2d/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.de.erichseifert.vectorgraphics2d;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-Vendor: %providerName Export-Package: org.xmind.de.erichseifert.vectorgraphics2d, diff --git a/bundles/org.xmind.de.erichseifert.vectorgraphics2d/pom.xml b/bundles/org.xmind.de.erichseifert.vectorgraphics2d/pom.xml index f0bb69471..65155a00a 100644 --- a/bundles/org.xmind.de.erichseifert.vectorgraphics2d/pom.xml +++ b/bundles/org.xmind.de.erichseifert.vectorgraphics2d/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.orbit org.xmind.de.erichseifert.vectorgraphics2d - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.gef.ui/META-INF/MANIFEST.MF b/bundles/org.xmind.gef.ui/META-INF/MANIFEST.MF index d2f40e1af..dc06f5b06 100644 --- a/bundles/org.xmind.gef.ui/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.gef.ui/META-INF/MANIFEST.MF @@ -2,14 +2,14 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.gef.ui;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.gef.ui.internal.GEFPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.core.expressions, - org.xmind.gef;bundle-version="[3.7.2,3.8.0)";visibility:=reexport, - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)" + org.xmind.gef;bundle-version="[3.7.3,3.8.0)";visibility:=reexport, + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)" Eclipse-LazyStart: true Export-Package: org.xmind.gef.ui.actions, org.xmind.gef.ui.editor, diff --git a/bundles/org.xmind.gef.ui/pom.xml b/bundles/org.xmind.gef.ui/pom.xml index 5c473934c..a608beeab 100644 --- a/bundles/org.xmind.gef.ui/pom.xml +++ b/bundles/org.xmind.gef.ui/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.gef.ui - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/actions/ActionRegistry.java b/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/actions/ActionRegistry.java index 3d5e0335b..5dac6ab17 100644 --- a/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/actions/ActionRegistry.java +++ b/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/actions/ActionRegistry.java @@ -51,7 +51,10 @@ public void dispose() { } public IAction getAction(String id) { - IAction action = actions.get(id); + IAction action = null; + if (actions != null) { + action = actions.get(id); + } if (action == null && parent != null) { action = parent.getAction(id); } diff --git a/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/properties/GraphicalPropertySheetPage.java b/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/properties/GraphicalPropertySheetPage.java index 04e3c3694..fd5a52e2e 100644 --- a/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/properties/GraphicalPropertySheetPage.java +++ b/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/properties/GraphicalPropertySheetPage.java @@ -14,6 +14,7 @@ import java.util.List; import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.util.Util; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.SelectionChangedEvent; @@ -22,13 +23,16 @@ import org.eclipse.swt.events.ControlListener; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; import org.eclipse.ui.forms.widgets.ScrolledForm; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.part.IPageSite; @@ -244,6 +248,7 @@ public void createControl(Composite parent) { this.widgetFactory = new WidgetFactory(composite.getDisplay()); form = widgetFactory.createScrolledForm(composite); + addHorizontalScrollSupport(form); form.setLayoutData(new GridData(GridData.FILL_BOTH)); form.setMinWidth(DEFAULT_SECTION_WIDTH); // TODO this not working??? form.addDisposeListener(new DisposeListener() { @@ -266,6 +271,24 @@ public void widgetDisposed(DisposeEvent e) { form.reflow(true); } + // add horizontal scroll support for windows + private void addHorizontalScrollSupport(final ScrolledForm form) { + if (Util.isWindows()) { + form.addListener(SWT.MouseHorizontalWheel, new Listener() { + + public void handleEvent(Event event) { + if (!form.isDisposed()) { + int offset = event.count; + offset = -(int) (Math.sqrt(Math.abs(offset)) * offset); + + Point origin = form.getOrigin(); + form.setOrigin(origin.x + offset, origin.y); + } + } + }); + } + } + protected void createExtendSectionControls(WidgetFactory widgetFactory, Composite parent) { } diff --git a/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/properties/PropertyPagePart.java b/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/properties/PropertyPagePart.java index 49a9fbdd0..0cfc468f5 100644 --- a/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/properties/PropertyPagePart.java +++ b/bundles/org.xmind.gef.ui/src/org/xmind/gef/ui/properties/PropertyPagePart.java @@ -17,17 +17,21 @@ import java.util.List; import org.eclipse.core.runtime.Assert; +import org.eclipse.jface.util.Util; import org.eclipse.jface.viewers.ISelection; import org.eclipse.swt.SWT; import org.eclipse.swt.events.ControlEvent; import org.eclipse.swt.events.ControlListener; import org.eclipse.swt.events.DisposeEvent; import org.eclipse.swt.events.DisposeListener; +import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; import org.eclipse.ui.forms.widgets.ScrolledForm; import org.eclipse.ui.forms.widgets.Section; import org.eclipse.ui.part.IPageSite; @@ -60,7 +64,8 @@ public SectionRec(IPropertySectionPart section) { private ScrolledForm form; - public void init(IPropertyPartContainer container, IGraphicalEditor editor) { + public void init(IPropertyPartContainer container, + IGraphicalEditor editor) { this.container = container; this.editor = editor; for (SectionRec rec : sections) { @@ -113,6 +118,7 @@ public List getSections() { public void createControl(Composite parent) { this.widgetFactory = new WidgetFactory(parent.getDisplay()); form = widgetFactory.createScrolledForm(parent); + addHorizontalScrollSupport(form); form.setMinWidth(DEFAULT_SECTION_WIDTH); // TODO this not working??? form.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { @@ -126,6 +132,24 @@ public void widgetDisposed(DisposeEvent e) { form.reflow(true); } + // add horizontal scroll support for windows + private void addHorizontalScrollSupport(final ScrolledForm form) { + if (Util.isWindows()) { + form.addListener(SWT.MouseHorizontalWheel, new Listener() { + + public void handleEvent(Event event) { + if (!form.isDisposed()) { + int offset = event.count; + offset = -(int) (Math.sqrt(Math.abs(offset)) * offset); + + Point origin = form.getOrigin(); + form.setOrigin(origin.x + offset, origin.y); + } + } + }); + } + } + protected void createSectionControls(final ScrolledForm form, final Composite parent) { GridLayout layout = new GridLayout(1, true); @@ -221,4 +245,4 @@ public void setFocus() { } } -} \ No newline at end of file +} diff --git a/bundles/org.xmind.gef.ui/src/org/xmind/ui/texteditor/FloatingTextEditTool.java b/bundles/org.xmind.gef.ui/src/org/xmind/ui/texteditor/FloatingTextEditTool.java index a82e224de..ac9a336b2 100644 --- a/bundles/org.xmind.gef.ui/src/org/xmind/ui/texteditor/FloatingTextEditTool.java +++ b/bundles/org.xmind.gef.ui/src/org/xmind/ui/texteditor/FloatingTextEditTool.java @@ -405,7 +405,9 @@ protected void unhookEditor(FloatingTextEditor editor) { @Override public void run() { - restoreFocusControl(); + if (focusOnRequest) { + restoreFocusControl(); + } } }); } diff --git a/bundles/org.xmind.gef/META-INF/MANIFEST.MF b/bundles/org.xmind.gef/META-INF/MANIFEST.MF index 726f9642a..4308bb66e 100644 --- a/bundles/org.xmind.gef/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.gef/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.gef;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: %providerName Eclipse-LazyStart: true Require-Bundle: org.eclipse.core.runtime, diff --git a/bundles/org.xmind.gef/pom.xml b/bundles/org.xmind.gef/pom.xml index 504aa7c97..9307449eb 100644 --- a/bundles/org.xmind.gef/pom.xml +++ b/bundles/org.xmind.gef/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.gef - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.gef/src/org/xmind/gef/GraphicalViewer.java b/bundles/org.xmind.gef/src/org/xmind/gef/GraphicalViewer.java index b2809f91d..e6475ef5e 100644 --- a/bundles/org.xmind.gef/src/org/xmind/gef/GraphicalViewer.java +++ b/bundles/org.xmind.gef/src/org/xmind/gef/GraphicalViewer.java @@ -23,12 +23,15 @@ import org.eclipse.draw2d.geometry.Dimension; import org.eclipse.draw2d.geometry.Point; import org.eclipse.draw2d.geometry.Rectangle; +import org.eclipse.jface.util.Util; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.StructuredSelection; import org.eclipse.swt.SWT; import org.eclipse.swt.graphics.Cursor; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; import org.xmind.gef.dnd.IDndSupport; import org.xmind.gef.event.PartsEventDispatcher; import org.xmind.gef.event.ViewerEventDispatcher; @@ -185,10 +188,31 @@ public org.eclipse.swt.graphics.Rectangle computeTrim(int x, int y, } }; + addHorizontalScrollSupport(canvas); canvas.setViewport(viewport); return canvas; } + // add horizontal scroll support for windows + private void addHorizontalScrollSupport(final FigureCanvas canvas) { + if (Util.isWindows()) { + canvas.addListener(SWT.MouseHorizontalWheel, new Listener() { + + public void handleEvent(Event event) { + if (!canvas.isDisposed()) { + int offset = event.count; + offset = -(int) (Math.sqrt(Math.abs(offset)) * offset); + + Point viewLocation = canvas.getViewport() + .getViewLocation(); + canvas.getViewport() + .setHorizontalLocation(viewLocation.x + offset); + } + } + }); + } + } + /* * (non-Javadoc) * @see diff --git a/bundles/org.xmind.gef/src/org/xmind/gef/draw2d/RotatableWrapLabel.java b/bundles/org.xmind.gef/src/org/xmind/gef/draw2d/RotatableWrapLabel.java index 5d0e9ba38..f174d1b08 100644 --- a/bundles/org.xmind.gef/src/org/xmind/gef/draw2d/RotatableWrapLabel.java +++ b/bundles/org.xmind.gef/src/org/xmind/gef/draw2d/RotatableWrapLabel.java @@ -938,7 +938,36 @@ protected void drawTextShape(Graphics graphics, Path shape) { } protected boolean isNormalRenderStyle() { - return renderStyle == NORMAL; + /// some fonts don't show correctly when use graphics.drawText(), so render it by path. + boolean shownWrong = false; + String fontName = null; + if (getFont() != null) { + fontName = (getFont().getFontData())[0].getName(); + } + + String[] wrongFontNames = { "Cambria Math", "Gabriola", "Javanese Text", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "Lucida Sans Unicode", "Microsoft Himalaya", "MV Boli", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + "Myanmar Text", "Segoe MDL2 Assets" }; //$NON-NLS-1$ //$NON-NLS-2$ + String[] wrongFontPrefixs = { "Sitka" }; //$NON-NLS-1$ + + if (fontName != null) { + for (String name : wrongFontNames) { + if (fontName.equals(name)) { + shownWrong = true; + break; + } + } + if (!shownWrong) { + for (String prefix : wrongFontPrefixs) { + if (fontName.startsWith(prefix)) { + shownWrong = true; + break; + } + } + } + } + + return renderStyle == NORMAL && !shownWrong; } /** diff --git a/bundles/org.xmind.neuquant/META-INF/MANIFEST.MF b/bundles/org.xmind.neuquant/META-INF/MANIFEST.MF index bd827f547..4c07f40fc 100644 --- a/bundles/org.xmind.neuquant/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.neuquant/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.neuquant -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: %providerName Bundle-RequiredExecutionEnvironment: J2SE-1.5 Require-Bundle: org.eclipse.swt diff --git a/bundles/org.xmind.neuquant/pom.xml b/bundles/org.xmind.neuquant/pom.xml index 54182c7fa..0866d81be 100644 --- a/bundles/org.xmind.neuquant/pom.xml +++ b/bundles/org.xmind.neuquant/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.neuquant - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.org.freehep.vectorgraphics/META-INF/MANIFEST.MF b/bundles/org.xmind.org.freehep.vectorgraphics/META-INF/MANIFEST.MF index c99d506d2..d24cce27c 100644 --- a/bundles/org.xmind.org.freehep.vectorgraphics/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.org.freehep.vectorgraphics/META-INF/MANIFEST.MF @@ -1,7 +1,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-SymbolicName: org.xmind.org.freehep.vectorgraphics;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-RequiredExecutionEnvironment: J2SE-1.5 Export-Package: org.xmind.org.freehep.graphics2d, org.xmind.org.freehep.graphics2d.font, diff --git a/bundles/org.xmind.org.freehep.vectorgraphics/pom.xml b/bundles/org.xmind.org.freehep.vectorgraphics/pom.xml index 0a8ec09b3..9ce351358 100644 --- a/bundles/org.xmind.org.freehep.vectorgraphics/pom.xml +++ b/bundles/org.xmind.org.freehep.vectorgraphics/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.orbit org.xmind.org.freehep.vectorgraphics - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.browser/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.browser/META-INF/MANIFEST.MF index dfab914c8..ad851d594 100644 --- a/bundles/org.xmind.ui.browser/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.browser/META-INF/MANIFEST.MF @@ -2,14 +2,15 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.browser;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.internal.browser.BrowserPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.core.net, - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)", - org.xmind.core.command;bundle-version="[3.7.2,3.8.0)" + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)", + org.xmind.core.command;bundle-version="[3.7.3,3.8.0)", + org.xmind.core.net;bundle-version="[3.7.3,3.8.0)";visibility:=reexport Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Export-Package: org.xmind.ui.browser; diff --git a/bundles/org.xmind.ui.browser/pom.xml b/bundles/org.xmind.ui.browser/pom.xml index f0f9d54fc..ac605627e 100644 --- a/bundles/org.xmind.ui.browser/pom.xml +++ b/bundles/org.xmind.ui.browser/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.browser - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.browser/src/org/xmind/ui/internal/browser/BrowserUtil.java b/bundles/org.xmind.ui.browser/src/org/xmind/ui/internal/browser/BrowserUtil.java index 4a42fc93a..e3ff47ff1 100644 --- a/bundles/org.xmind.ui.browser/src/org/xmind/ui/internal/browser/BrowserUtil.java +++ b/bundles/org.xmind.ui.browser/src/org/xmind/ui/internal/browser/BrowserUtil.java @@ -26,6 +26,7 @@ import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IWorkbenchWindow; import org.eclipse.ui.PlatformUI; +import org.xmind.core.net.util.LinkUtils; public class BrowserUtil { @@ -149,7 +150,8 @@ public static String normalizeURL(String url) { if (uri != null) { String host = uri.getHost(); - if (host != null && host.endsWith(".xmind.net")) //$NON-NLS-1$ + if (host != null && (host.endsWith(".xmind.net") //$NON-NLS-1$ + || host.endsWith(".xmind.cn"))) //$NON-NLS-1$ /// make our server decide where exactly this url should go return makeRedirectURL(url); } @@ -159,7 +161,12 @@ public static String normalizeURL(String url) { public static String makeRedirectURL(String url) { StringBuffer buffer = new StringBuffer(100); - buffer.append("http://www.xmind.net/xmind/go?r="); //$NON-NLS-1$ + + boolean isCnLink = url.contains(LinkUtils.HOST_CN) + && url.indexOf(LinkUtils.HOST_CN) < LinkUtils.HOST_NET.length(); + buffer.append( + LinkUtils.getLinkByUser(isCnLink, true, false, "/xmind/go?r=")); //$NON-NLS-1$ + buffer.append(encode(url)); buffer.append("&u="); //$NON-NLS-1$ String user = System.getProperty("net.xmind.signin.account.user"); //$NON-NLS-1$ @@ -200,4 +207,4 @@ private static String encode(String text) { } } -} \ No newline at end of file +} diff --git a/bundles/org.xmind.ui.browser/src/org/xmind/ui/internal/browser/BrowserViewer.java b/bundles/org.xmind.ui.browser/src/org/xmind/ui/internal/browser/BrowserViewer.java index 828641c97..c8cc2ba20 100644 --- a/bundles/org.xmind.ui.browser/src/org/xmind/ui/internal/browser/BrowserViewer.java +++ b/bundles/org.xmind.ui.browser/src/org/xmind/ui/internal/browser/BrowserViewer.java @@ -54,6 +54,7 @@ import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Listener; import org.eclipse.ui.PartInitException; +import org.xmind.core.net.util.LinkUtils; import org.xmind.ui.animation.AnimationViewer; import org.xmind.ui.animation.IAnimationContentProvider; import org.xmind.ui.browser.BrowserSupport; @@ -214,7 +215,6 @@ public void unhook(Browser browser) { /* * (non-Javadoc) - * * @see * org.eclipse.swt.browser.LocationListener#changed(org.eclipse.swt. * browser.LocationEvent) @@ -239,7 +239,6 @@ public void changed(LocationEvent event) { /* * (non-Javadoc) - * * @see * org.eclipse.swt.browser.LocationListener#changing(org.eclipse.swt * .browser.LocationEvent) @@ -258,7 +257,6 @@ public void changing(LocationEvent event) { /* * (non-Javadoc) - * * @see org.eclipse.swt.browser.OpenWindowListener#open(org.eclipse.swt. * browser .WindowEvent) */ @@ -272,7 +270,6 @@ public void open(WindowEvent event) { /* * (non-Javadoc) - * * @see * org.eclipse.swt.browser.VisibilityWindowListener#hide(org.eclipse * .swt.browser.WindowEvent) @@ -283,7 +280,6 @@ public void hide(WindowEvent event) { /* * (non-Javadoc) - * * @see * org.eclipse.swt.browser.VisibilityWindowListener#show(org.eclipse * .swt.browser.WindowEvent) @@ -304,7 +300,6 @@ public void show(WindowEvent event) { /* * (non-Javadoc) - * * @see * org.eclipse.swt.browser.CloseWindowListener#close(org.eclipse.swt * .browser.WindowEvent) @@ -319,7 +314,6 @@ public void close(WindowEvent event) { /* * (non-Javadoc) - * * @see * org.eclipse.swt.browser.ProgressListener#changed(org.eclipse.swt. * browser.ProgressEvent) @@ -363,7 +357,6 @@ else if (homeBusy.isAnimating() && done) // once the progress hits /* * (non-Javadoc) - * * @see * org.eclipse.swt.browser.ProgressListener#completed(org.eclipse.swt * .browser.ProgressEvent) @@ -383,7 +376,6 @@ public void completed(ProgressEvent event) { /* * (non-Javadoc) - * * @see * org.eclipse.swt.browser.TitleListener#changed(org.eclipse.swt.browser * .TitleEvent) @@ -398,7 +390,6 @@ public void changed(TitleEvent event) { /* * (non-Javadoc) - * * @see * org.eclipse.swt.browser.StatusTextListener#changed(org.eclipse.swt * .browser.StatusTextEvent) @@ -425,7 +416,8 @@ public void changed(StatusTextEvent event) { private static final int MAX_HISTORY = 50; - private static final String URL_HOME = "http://www.xmind.net"; //$NON-NLS-1$ + private static final String URL_HOME = LinkUtils.getHostByLanguage(true, + false); private static List URL_HISTORY; @@ -1407,4 +1399,4 @@ private String makeRedirectUrl(String source) { return source; } -} \ No newline at end of file +} diff --git a/bundles/org.xmind.ui.dashboard/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.dashboard/META-INF/MANIFEST.MF index b2c201c5f..c20a18a12 100644 --- a/bundles/org.xmind.ui.dashboard/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.dashboard/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: Dashboard Bundle-SymbolicName: org.xmind.ui.dashboard;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.internal.dashboard.DashboardPlugin Bundle-Vendor: XMind Ltd Require-Bundle: org.eclipse.ui, diff --git a/bundles/org.xmind.ui.dashboard/pom.xml b/bundles/org.xmind.ui.dashboard/pom.xml index 736fae5d7..12cfd8d65 100644 --- a/bundles/org.xmind.ui.dashboard/pom.xml +++ b/bundles/org.xmind.ui.dashboard/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.dashboard - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.exports.vector.svg/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.exports.vector.svg/META-INF/MANIFEST.MF index dd2bcdaed..9c7aaba76 100644 --- a/bundles/org.xmind.ui.exports.vector.svg/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.exports.vector.svg/META-INF/MANIFEST.MF @@ -2,16 +2,16 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.exports.vector.svg;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.internal.exports.vector.svg.SvgPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, - org.xmind.ui;bundle-version="[3.7.2,3.8.0)", - org.xmind.de.erichseifert.vectorgraphics2d;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.exports.vector;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)", - org.xmind.core.usagedata;bundle-version="[3.7.2,3.8.0)" + org.xmind.ui;bundle-version="[3.7.3,3.8.0)", + org.xmind.de.erichseifert.vectorgraphics2d;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.exports.vector;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)", + org.xmind.core.usagedata;bundle-version="[3.7.3,3.8.0)" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin diff --git a/bundles/org.xmind.ui.exports.vector.svg/pom.xml b/bundles/org.xmind.ui.exports.vector.svg/pom.xml index 7cbbcf392..6f4ab4859 100644 --- a/bundles/org.xmind.ui.exports.vector.svg/pom.xml +++ b/bundles/org.xmind.ui.exports.vector.svg/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.exports.vector.svg - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.exports.vector.svg/src/org/xmind/ui/internal/exports/vector/svg/SVGExporter.java b/bundles/org.xmind.ui.exports.vector.svg/src/org/xmind/ui/internal/exports/vector/svg/SVGExporter.java index 77c59591e..6ae5c34e2 100644 --- a/bundles/org.xmind.ui.exports.vector.svg/src/org/xmind/ui/internal/exports/vector/svg/SVGExporter.java +++ b/bundles/org.xmind.ui.exports.vector.svg/src/org/xmind/ui/internal/exports/vector/svg/SVGExporter.java @@ -157,7 +157,7 @@ public void end() throws InvocationTargetException { adaptor.dispose(); cleanUpSources(); } catch (Exception e) { - e.printStackTrace(); + throw new InvocationTargetException(e); } } diff --git a/bundles/org.xmind.ui.exports.vector/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.exports.vector/META-INF/MANIFEST.MF index 199220ae0..3d999edcd 100644 --- a/bundles/org.xmind.ui.exports.vector/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.exports.vector/META-INF/MANIFEST.MF @@ -2,12 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.exports.vector;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.exports.vector.VectorPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, - org.xmind.ui;bundle-version="[3.7.2,3.8.0)" + org.xmind.ui;bundle-version="[3.7.3,3.8.0)" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Bundle-Localization: plugin diff --git a/bundles/org.xmind.ui.exports.vector/pom.xml b/bundles/org.xmind.ui.exports.vector/pom.xml index 3a9664607..57f3373b7 100644 --- a/bundles/org.xmind.ui.exports.vector/pom.xml +++ b/bundles/org.xmind.ui.exports.vector/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.exports.vector - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.fishbone/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.fishbone/META-INF/MANIFEST.MF index 36a19f9c0..a8bf52d7a 100644 --- a/bundles/org.xmind.ui.fishbone/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.fishbone/META-INF/MANIFEST.MF @@ -2,13 +2,13 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.fishbone;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.internal.fishbone.FishboneUIPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, - org.xmind.ui;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)" + org.xmind.ui;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)" Eclipse-LazyStart: true Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy diff --git a/bundles/org.xmind.ui.fishbone/pom.xml b/bundles/org.xmind.ui.fishbone/pom.xml index cc296dc61..39738e09a 100644 --- a/bundles/org.xmind.ui.fishbone/pom.xml +++ b/bundles/org.xmind.ui.fishbone/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.fishbone - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.imports/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.imports/META-INF/MANIFEST.MF index f30b84a0c..4501d1705 100644 --- a/bundles/org.xmind.ui.imports/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.imports/META-INF/MANIFEST.MF @@ -2,15 +2,15 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.imports;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.internal.imports.ImportPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, - org.xmind.core.io;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.mindmap;bundle-version="[3.7.2,3.8.0)", - org.xmind.core.usagedata;bundle-version="[3.7.2,3.8.0)", + org.xmind.core.io;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.mindmap;bundle-version="[3.7.3,3.8.0)", + org.xmind.core.usagedata;bundle-version="[3.7.3,3.8.0)", org.json;bundle-version="1.0.0" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy diff --git a/bundles/org.xmind.ui.imports/pom.xml b/bundles/org.xmind.ui.imports/pom.xml index 15f7c4275..120fe8bc3 100644 --- a/bundles/org.xmind.ui.imports/pom.xml +++ b/bundles/org.xmind.ui.imports/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.imports - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.menus/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.menus/META-INF/MANIFEST.MF index 223a2e5bc..295f40d44 100644 --- a/bundles/org.xmind.ui.menus/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.menus/META-INF/MANIFEST.MF @@ -3,12 +3,12 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, org.eclipse.e4.ui.model.workbench, org.eclipse.e4.ui.workbench, - org.xmind.core;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.spelling;bundle-version="[3.7.2,3.8.0)" + org.xmind.core;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.spelling;bundle-version="[3.7.3,3.8.0)" Bundle-ActivationPolicy: lazy -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Name: %Bundle-Name Bundle-Activator: org.xmind.ui.menus.MenusPlugin Bundle-ManifestVersion: 2 diff --git a/bundles/org.xmind.ui.menus/plugin.xml b/bundles/org.xmind.ui.menus/plugin.xml index 86f0efe17..7a6f0b028 100644 --- a/bundles/org.xmind.ui.menus/plugin.xml +++ b/bundles/org.xmind.ui.menus/plugin.xml @@ -804,7 +804,7 @@ + visible="false"> diff --git a/bundles/org.xmind.ui.menus/pom.xml b/bundles/org.xmind.ui.menus/pom.xml index 5bdb30534..28ce0a59f 100644 --- a/bundles/org.xmind.ui.menus/pom.xml +++ b/bundles/org.xmind.ui.menus/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.menus - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.mindmap/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.mindmap/META-INF/MANIFEST.MF index ad8b06a41..997966c9c 100644 --- a/bundles/org.xmind.ui.mindmap/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.mindmap/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.mindmap;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-ClassPath: . Bundle-Activator: org.xmind.ui.internal.MindMapUIPlugin Bundle-Vendor: %providerName @@ -63,14 +63,14 @@ Require-Bundle: org.eclipse.ui, org.eclipse.core.filesystem, org.eclipse.core.resources, org.apache.commons.codec, - org.xmind.core.runtime;bundle-version="[3.7.2,3.8.0)";visibility:=reexport, - org.xmind.gef.ui;bundle-version="[3.7.2,3.8.0)";visibility:=reexport, - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.browser;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.spelling;bundle-version="[3.7.2,3.8.0)", - org.xmind.core.command;bundle-version="[3.7.2,3.8.0)", + org.xmind.core.runtime;bundle-version="[3.7.3,3.8.0)";visibility:=reexport, + org.xmind.gef.ui;bundle-version="[3.7.3,3.8.0)";visibility:=reexport, + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.browser;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.spelling;bundle-version="[3.7.3,3.8.0)", + org.xmind.core.command;bundle-version="[3.7.3,3.8.0)", org.eclipse.swt, - org.xmind.core.usagedata;bundle-version="[3.7.2,3.8.0)", + org.xmind.core.usagedata;bundle-version="[3.7.3,3.8.0)", org.xmind.core, org.eclipse.e4.core.commands, org.eclipse.e4.core.di, diff --git a/bundles/org.xmind.ui.mindmap/icons/comments.svg b/bundles/org.xmind.ui.mindmap/icons/comments.svg new file mode 100644 index 000000000..a29405327 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/comments.svg @@ -0,0 +1,23 @@ + + + + ic comments + Created with Sketch. + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/drill_down.svg b/bundles/org.xmind.ui.mindmap/icons/drill_down.svg new file mode 100644 index 000000000..a14817849 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/drill_down.svg @@ -0,0 +1,22 @@ + + + + ic drill down + Created with Sketch. + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/drill_up.svg b/bundles/org.xmind.ui.mindmap/icons/drill_up.svg new file mode 100644 index 000000000..36f1a154b --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/drill_up.svg @@ -0,0 +1,22 @@ + + + + ic drill up + Created with Sketch. + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/hyperlink.svg b/bundles/org.xmind.ui.mindmap/icons/hyperlink.svg new file mode 100644 index 000000000..b67a9a1cc --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/hyperlink.svg @@ -0,0 +1,22 @@ + + + + ic hyperlink + Created with Sketch. + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/label.svg b/bundles/org.xmind.ui.mindmap/icons/label.svg new file mode 100644 index 000000000..6e5bd0654 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/label.svg @@ -0,0 +1,30 @@ + + + + ic label + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/link_callout.svg b/bundles/org.xmind.ui.mindmap/icons/link_callout.svg new file mode 100644 index 000000000..bac1e500e --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/link_callout.svg @@ -0,0 +1,27 @@ + + + + ic callout + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/link_central_topic.svg b/bundles/org.xmind.ui.mindmap/icons/link_central_topic.svg new file mode 100644 index 000000000..2a92702d5 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/link_central_topic.svg @@ -0,0 +1,25 @@ + + + + ic central topic + Created with Sketch. + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/link_floating_Topic.svg b/bundles/org.xmind.ui.mindmap/icons/link_floating_Topic.svg new file mode 100644 index 000000000..af6154a80 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/link_floating_Topic.svg @@ -0,0 +1,23 @@ + + + + ic Floating Topic + Created with Sketch. + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/link_main_topic.svg b/bundles/org.xmind.ui.mindmap/icons/link_main_topic.svg new file mode 100644 index 000000000..b43e496a3 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/link_main_topic.svg @@ -0,0 +1,25 @@ + + + + ic main topic + Created with Sketch. + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/link_subtopic.svg b/bundles/org.xmind.ui.mindmap/icons/link_subtopic.svg new file mode 100644 index 000000000..ff4345170 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/link_subtopic.svg @@ -0,0 +1,25 @@ + + + + ic Subtopic + Created with Sketch. + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/link_summary.svg b/bundles/org.xmind.ui.mindmap/icons/link_summary.svg new file mode 100644 index 000000000..35de8df3c --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/link_summary.svg @@ -0,0 +1,23 @@ + + + + ic summary + Created with Sketch. + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/icons/notes.svg b/bundles/org.xmind.ui.mindmap/icons/notes.svg new file mode 100644 index 000000000..a5ae21235 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/icons/notes.svg @@ -0,0 +1,24 @@ + + + + ic notes + Created with Sketch. + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.mindmap/pom.xml b/bundles/org.xmind.ui.mindmap/pom.xml index 1b0006d3a..7c6c832de 100644 --- a/bundles/org.xmind.ui.mindmap/pom.xml +++ b/bundles/org.xmind.ui.mindmap/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.mindmap - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/InfoItemContributorProxy.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/InfoItemContributorProxy.java index a85fac2bc..369ac3ad0 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/InfoItemContributorProxy.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/InfoItemContributorProxy.java @@ -22,8 +22,8 @@ public class InfoItemContributorProxy implements IInfoItemContributor { - private static class NullInfoItemContributor implements - IInfoItemContributor { + private static class NullInfoItemContributor + implements IInfoItemContributor { private NullInfoItemContributor() { } @@ -67,6 +67,10 @@ public String getCardLabel() { return null; } + public String getSVGFilePath(ITopic topic, IAction action) { + return null; + } + public boolean isCardModeAvailable(ITopic topic, ITopicPart topicPart) { return false; } @@ -76,6 +80,11 @@ public List getPopupMenuActions(ITopicPart topicPart, return Collections.emptyList(); } + @Override + public boolean isModified(ITopicPart topicPart, ITopic topic, + IAction action) { + return true; + } } private static final IInfoItemContributor NULL_CONTRIBUTOR = new NullInfoItemContributor(); @@ -110,10 +119,10 @@ public InfoItemContributorProxy(IConfigurationElement element) this.cardLabel = element.getAttribute(RegistryConstants.ATT_CARD_LABEL); if (RegistryReader.getClassValue(element, RegistryConstants.ATT_CONTRIBUTOR_CLASS) == null) { - throw new CoreException(new Status(IStatus.ERROR, - element.getNamespaceIdentifier(), 0, - "Invalid extension (missing class name): " + id, //$NON-NLS-1$ - null)); + throw new CoreException( + new Status(IStatus.ERROR, element.getNamespaceIdentifier(), + 0, "Invalid extension (missing class name): " + id, //$NON-NLS-1$ + null)); } } @@ -168,6 +177,11 @@ public String getCardLabel() { return cardLabel; } + public String getSVGFilePath(ITopic topic, IAction action) { + /// TODO write in extension + return getImplementation().getSVGFilePath(topic, action); + } + public boolean isCardModeAvailable(ITopic topic, ITopicPart topicPart) { return getImplementation().isCardModeAvailable(topic, topicPart); } @@ -185,15 +199,13 @@ public IInfoItemContributor getImplementation() { if (implementation == null) { try { implementation = (IInfoItemContributor) element - .createExecutableExtension(RegistryConstants.ATT_CONTRIBUTOR_CLASS); + .createExecutableExtension( + RegistryConstants.ATT_CONTRIBUTOR_CLASS); } catch (CoreException e) { - Logger.log( - e, + Logger.log(e, "Failed to create icon tip contributor from class: " //$NON-NLS-1$ - + RegistryReader - .getClassValue( - element, - RegistryConstants.ATT_CONTRIBUTOR_CLASS)); + + RegistryReader.getClassValue(element, + RegistryConstants.ATT_CONTRIBUTOR_CLASS)); implementation = NULL_CONTRIBUTOR; } } @@ -225,4 +237,10 @@ public List getPopupMenuActions(ITopicPart topicPart, return getImplementation().getPopupMenuActions(topicPart, topic); } + @Override + public boolean isModified(ITopicPart topicPart, ITopic topic, + IAction action) { + return getImplementation().isModified(topicPart, topic, action); + } + } diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/MindMapMessages.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/MindMapMessages.java index 060575cb8..ad815ad19 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/MindMapMessages.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/MindMapMessages.java @@ -285,6 +285,10 @@ public class MindMapMessages extends NLS { public static String LocalFileWorkbookRef_removeDialog_title; + public static String LocalFileWorkbookRef_saveFailed_description; + + public static String LocalFileWorkbookRef_saveFailed_title; + public static String MindMapEditor_CompatibilityWarning_dialogTitle; public static String MindMapEditor_CompatibilityWarning_Overwrite_button; diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/ShareOption.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/ShareOption.java index 7fd681fa4..58d5d8eb8 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/ShareOption.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/ShareOption.java @@ -9,12 +9,13 @@ import org.eclipse.ui.plugin.AbstractUIPlugin; /** - * * @author Shawn Liu * @since 3.6.50 */ public class ShareOption { + public static final String ATT_DISABLED_SITE = "disabledSite"; //$NON-NLS-1$ + private IConfigurationElement element; private String id; @@ -29,6 +30,8 @@ public class ShareOption { private String category; + private String disabledSite; + public ShareOption(IConfigurationElement element) throws CoreException { this.element = element; this.id = element.getAttribute(IWorkbenchRegistryConstants.ATT_ID); @@ -40,6 +43,7 @@ public ShareOption(IConfigurationElement element) throws CoreException { .getAttribute(IWorkbenchRegistryConstants.ATT_CATEGORY); this.commandId = element .getAttribute(IWorkbenchRegistryConstants.ATT_COMMAND_ID); + this.disabledSite = element.getAttribute(ATT_DISABLED_SITE); this.icon = null; if (id == null || commandId == null) @@ -89,4 +93,8 @@ public String getCategory() { return category; } + public String getDisabledSite() { + return disabledSite; + } + } diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/TopicInfoItemManager.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/TopicInfoItemManager.java new file mode 100644 index 000000000..6914862fb --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/TopicInfoItemManager.java @@ -0,0 +1,134 @@ +package org.xmind.ui.internal; + +import static org.xmind.core.ISheetSettings.INFO_ITEM; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.eclipse.jface.action.IAction; +import org.xmind.core.ISettingEntry; +import org.xmind.core.ISheet; +import org.xmind.core.ISheetSettings; +import org.xmind.core.ITopic; +import org.xmind.ui.internal.mindmap.IconTip; +import org.xmind.ui.internal.mindmap.TopicPart; +import org.xmind.ui.mindmap.IIconTipContributor; +import org.xmind.ui.mindmap.IInfoItemContributor; + +public class TopicInfoItemManager { + + private TopicPart topicPart; + + private Map contributorToModel = new HashMap(); + + public TopicInfoItemManager(TopicPart topicPart) { + this.topicPart = topicPart; + } + + public List getIconTips() { + List iconTips = new ArrayList(); + ITopic topic = topicPart.getTopic(); + + List contributors = IconTipContributorManager + .getInstance().getContributors(); + if (!contributors.isEmpty()) { + for (IIconTipContributor contributor : contributors) { + IAction action = contributor.createAction(topicPart, topic); + if (action != null) { + iconTips.add(new IconTip(topic, contributor, action)); + } + } + } + + List contributors2 = InfoItemContributorManager + .getInstance().getContributors(); + if (!contributors2.isEmpty()) { + for (IInfoItemContributor contributor : contributors2) { + + IconTip oldIconTip = contributorToModel.get(contributor); + if (oldIconTip != null) { + if (!contributor.isModified(topicPart, topic, + oldIconTip.getAction())) { + iconTips.add(oldIconTip); + continue; + } + } + + IconTip iconTip = null; + IAction action = contributor.createAction(topicPart, topic); + if (action != null) { + iconTip = new IconTip(topic, contributor, action); + iconTips.add(iconTip); + } + + if (iconTip != null) { + contributorToModel.put(contributor, iconTip); + } else { + contributorToModel.remove(contributor); + } + } + } + + List bothContributors = InfoItemContributorManager + .getInstance().getBothContributors(); + if (!bothContributors.isEmpty()) { + ISheet sheet = topic.getOwnedSheet(); + if (sheet != null) { + for (IInfoItemContributor contributor : bothContributors) { + + IconTip oldIconTip = contributorToModel.get(contributor); + if (oldIconTip != null) { + if (!contributor.isModified(topicPart, topic, + oldIconTip.getAction())) { + iconTips.add(oldIconTip); + continue; + } + } + + IconTip iconTip = null; + String infoItemMode = null; + String type = contributor.getId(); + if (type != null && !"".equals(type)) { //$NON-NLS-1$ + List entries = sheet.getSettings() + .getEntries(INFO_ITEM); + for (ISettingEntry entry : entries) { + String t = entry + .getAttribute(ISheetSettings.ATTR_TYPE); + if (type.equals(t)) + infoItemMode = entry + .getAttribute(ISheetSettings.ATTR_MODE); + } + } + + if (infoItemMode == null || "".equals(infoItemMode)) //$NON-NLS-1$ + infoItemMode = contributor.getDefaultMode(); + if (ISheetSettings.MODE_ICON.equals(infoItemMode) + || !contributor.isCardModeAvailable(topic, + topicPart)) { + IAction action = contributor.createAction(topicPart, + topic); + if (action != null) { + iconTip = new IconTip(topic, contributor, action); + iconTips.add(iconTip); + } + } + + if (iconTip != null) { + contributorToModel.put(contributor, iconTip); + } else { + contributorToModel.remove(contributor); + } + } + } + } + + return iconTips; + } + + public void topicDeactivated() { + contributorToModel.clear(); + } + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/actions/RecentFileListContributionItem.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/actions/RecentFileListContributionItem.java index 97dfcf751..cd2b2e03e 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/actions/RecentFileListContributionItem.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/actions/RecentFileListContributionItem.java @@ -7,6 +7,7 @@ import java.util.Map; import org.eclipse.jface.action.IContributionItem; +import org.eclipse.jface.action.Separator; import org.eclipse.ui.actions.CompoundContributionItem; import org.eclipse.ui.internal.IPreferenceConstants; import org.eclipse.ui.internal.WorkbenchPlugin; @@ -70,6 +71,11 @@ private void fillItems(List items) { IEditorHistoryItem item = editorHistory.getItem(inputURI); items.add(makeHistoryCommandItem(inputURI, index, item.getName())); } + + // add separator + if (items.size() > 0) { + items.add(new Separator()); + } } private IContributionItem makeHistoryCommandItem(URI item, int index, diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/comments/CommentsInfoItemContributor.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/comments/CommentsInfoItemContributor.java index f647d0794..edd3cf28b 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/comments/CommentsInfoItemContributor.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/comments/CommentsInfoItemContributor.java @@ -120,6 +120,10 @@ public IAction createAction(ITopicPart topicPart, ITopic topic) { return action; } + public String getSVGFilePath(ITopic topic, IAction action) { + return "platform:/plugin/org.xmind.ui.mindmap/icons/comments.svg"; //$NON-NLS-1$ + } + @Override protected void registerTopicEvent(ITopicPart topicPart, ITopic topic, ICoreEventRegister register) { diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/decorators/IconTipDecorator.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/decorators/IconTipDecorator.java index 6d123af43..128c3e52a 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/decorators/IconTipDecorator.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/decorators/IconTipDecorator.java @@ -18,6 +18,8 @@ import org.xmind.gef.draw2d.SizeableImageFigure; import org.xmind.gef.part.Decorator; import org.xmind.gef.part.IGraphicalPart; +import org.xmind.ui.internal.svgsupport.SVGImageData; +import org.xmind.ui.internal.svgsupport.SVGImageFigure; import org.xmind.ui.mindmap.IIconTipPart; public class IconTipDecorator extends Decorator { @@ -36,6 +38,12 @@ public void decorate(IGraphicalPart part, IFigure figure) { } imgFigure.setImage(image); imgFigure.setPreferredSize(imgFigure.getImageSize()); + } else if (figure instanceof SVGImageFigure) { + SVGImageFigure svgImageFigure = (SVGImageFigure) figure; + SVGImageData svgData = null; + + svgData = ((IIconTipPart) part).getSVGData(); + svgImageFigure.setSVGData(svgData); } } @@ -44,10 +52,13 @@ public void deactivate(IGraphicalPart part, IFigure figure) { if (figure instanceof SizeableImageFigure) { SizeableImageFigure imgFigure = (SizeableImageFigure) figure; imgFigure.setImage(null); + } else if (figure instanceof SVGImageFigure) { + SVGImageFigure svgImageFigure = (SVGImageFigure) figure; + svgImageFigure.setSVGData(null); } } public static IconTipDecorator getInstance() { return instance; } -} \ No newline at end of file +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/decorators/InfoItemIconDecorator.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/decorators/InfoItemIconDecorator.java index e3e939f94..2d7ab090f 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/decorators/InfoItemIconDecorator.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/decorators/InfoItemIconDecorator.java @@ -5,6 +5,8 @@ import org.xmind.gef.draw2d.SizeableImageFigure; import org.xmind.gef.part.Decorator; import org.xmind.gef.part.IGraphicalPart; +import org.xmind.ui.internal.svgsupport.SVGImageData; +import org.xmind.ui.internal.svgsupport.SVGImageFigure; import org.xmind.ui.mindmap.IInfoItemPart; public class InfoItemIconDecorator extends Decorator { @@ -24,6 +26,12 @@ public void decorate(IGraphicalPart part, IFigure figure) { } imgFigure.setImage(image); imgFigure.setPreferredSize(imgFigure.getImageSize()); + } else if (figure instanceof SVGImageFigure) { + SVGImageFigure svgImageFigure = (SVGImageFigure) figure; + SVGImageData svgData = null; + + svgData = ((IInfoItemPart) part).getSVGData(); + svgImageFigure.setSVGData(svgData); } } @@ -32,6 +40,9 @@ public void deactivate(IGraphicalPart part, IFigure figure) { if (figure instanceof SizeableImageFigure) { SizeableImageFigure imgFigure = (SizeableImageFigure) figure; imgFigure.setImage(null); + } else if (figure instanceof SVGImageFigure) { + SVGImageFigure svgImageFigure = (SVGImageFigure) figure; + svgImageFigure.setSVGData(null); } } diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/dialogs/ShareDialog.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/dialogs/ShareDialog.java index e8cbd536f..301bd524a 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/dialogs/ShareDialog.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/dialogs/ShareDialog.java @@ -125,9 +125,20 @@ protected Control createDialogArea(Composite parent) { applyDialogFont(composite); - createTopSection(composite); - createSeparator(composite); - createBottomSection(composite); + boolean hasTopItem = hasEnabledItem( + RegistryConstants.VAL_CATEGORY_POPULAR); + boolean hasBottomItem = hasEnabledItem( + RegistryConstants.VAL_CATEGORY_NORMAL); + + if (hasTopItem) { + createTopSection(composite); + } + if (hasTopItem && hasBottomItem) { + createSeparator(composite); + } + if (hasBottomItem) { + createBottomSection(composite); + } return composite; } @@ -148,9 +159,13 @@ private void createTopSection(Composite parent) { List options = optionRegistry .getOptionsByCategory(RegistryConstants.VAL_CATEGORY_POPULAR); for (ShareOption option : options) { - createShareItem(composite, option.getLabel(), - (Image) resources.get(option.getImage()), option.getId(), 3, - 8); + boolean disabled = (isCnUser() + && "cn".equals(option.getDisabledSite())); //$NON-NLS-1$ + if (!disabled) { + createShareItem(composite, option.getLabel(), + (Image) resources.get(option.getImage()), + option.getId(), 3, 8); + } } } @@ -192,9 +207,13 @@ private void createBottomSection(Composite parent) { List options = optionRegistry .getOptionsByCategory(RegistryConstants.VAL_CATEGORY_NORMAL); for (ShareOption option : options) { - createShareItem(composite, option.getLabel(), - (Image) resources.get(option.getImage()), option.getId(), 0, - 5); + boolean disabled = (isCnUser() + && "cn".equals(option.getDisabledSite())); //$NON-NLS-1$ + if (!disabled) { + createShareItem(composite, option.getLabel(), + (Image) resources.get(option.getImage()), + option.getId(), 0, 5); + } } } @@ -266,4 +285,25 @@ private void handleWidgetEvent(Event event) { okPressed(); } + private boolean hasEnabledItem(String category) { + List options = optionRegistry + .getOptionsByCategory(category); + + for (ShareOption option : options) { + boolean disabled = (isCnUser() + && "cn".equals(option.getDisabledSite())); //$NON-NLS-1$ + if (!disabled) { + return true; + } + } + + return false; + } + + private boolean isCnUser() { + String cnUser = System.getProperty("account.cnUser"); //$NON-NLS-1$ + boolean isCnUser = "true".equals(cnUser); //$NON-NLS-1$ + return isCnUser; + } + } diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/e4handlers/OpenWorkbooksHandler.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/e4handlers/OpenWorkbooksHandler.java index f9e33e745..70a93eca6 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/e4handlers/OpenWorkbooksHandler.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/e4handlers/OpenWorkbooksHandler.java @@ -15,6 +15,7 @@ import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.util.SafeRunnable; import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Display; import org.eclipse.ui.IEditorInput; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IWorkbenchPage; @@ -54,8 +55,8 @@ public static void execute(IWorkbenchWindow window, List uris) { return; if (uris.isEmpty()) { - List files = DialogUtils.openXMindFiles(window.getShell(), - SWT.MULTI); + List files = DialogUtils.openXMindFiles( + Display.getDefault().getActiveShell(), SWT.MULTI); uris = new ArrayList(files.size()); for (File file : files) { uris.add(file.toURI().toString()); diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/editor/LocalFileWorkbookRef.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/editor/LocalFileWorkbookRef.java index 8aea32c2e..e295ffc77 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/editor/LocalFileWorkbookRef.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/editor/LocalFileWorkbookRef.java @@ -2,6 +2,7 @@ import java.io.File; import java.io.FileInputStream; +import java.io.FileNotFoundException; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; @@ -14,6 +15,7 @@ import java.util.Properties; import java.util.Set; import java.util.UUID; +import java.util.zip.ZipInputStream; import org.eclipse.core.runtime.Assert; import org.eclipse.core.runtime.IProgressMonitor; @@ -22,6 +24,7 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.SubMonitor; import org.eclipse.jface.dialogs.ErrorSupportProvider; +import org.eclipse.jface.dialogs.MessageDialog; import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.util.SafeRunnable; import org.eclipse.swt.SWT; @@ -31,6 +34,7 @@ import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Shell; import org.eclipse.ui.IMemento; import org.eclipse.ui.IWorkbenchPage; import org.eclipse.ui.IWorkbenchWindow; @@ -56,6 +60,7 @@ import org.xmind.core.event.ICoreEventSource2; import org.xmind.core.io.DirectoryInputSource; import org.xmind.core.io.DirectoryOutputTarget; +import org.xmind.core.io.IInputSource; import org.xmind.core.io.IStorage; import org.xmind.core.util.CloneHandler; import org.xmind.core.util.FileUtils; @@ -68,6 +73,8 @@ import org.xmind.ui.internal.handlers.OpenBlackBoxDialogHandler; import org.xmind.ui.internal.protocols.FilePathParser; import org.xmind.ui.internal.utils.CommandUtils; +import org.xmind.ui.internal.zen.ZenConstants; +import org.xmind.ui.internal.zen.ZenDeserializer; import org.xmind.ui.mindmap.IWorkbookRef; import org.xmind.ui.mindmap.MindMapImageExporter; import org.xmind.ui.mindmap.MindMapUI; @@ -85,6 +92,65 @@ public class LocalFileWorkbookRef extends AbstractWorkbookRef { private static boolean DEBUG_BACKUP = MindMapUIPlugin .isDebugging(MindMapUIPlugin.OPTION_LOCAL_FILE_BACKUP); + private static class PreParser { + + private IInputSource inputSource; + + private InputStream inputStream; + + private IStorage storage; + + public PreParser() { + } + + public void setInputSource(IInputSource source) { + if (source == null) + throw new IllegalArgumentException("input source is null"); //$NON-NLS-1$ + this.inputSource = source; + this.inputStream = null; + } + + public void setInputStream(InputStream stream) { + if (stream == null) + throw new IllegalArgumentException("input stream is null"); //$NON-NLS-1$ + this.inputStream = stream; + this.inputSource = null; + } + + public void setWorkbookStorage(IStorage storage) { + if (storage == null) + throw new IllegalArgumentException("storage is null"); //$NON-NLS-1$ + this.storage = storage; + } + + public boolean isJsonFormat() { + try { + if (inputStream != null) { + ZipInputStream zin = new ZipInputStream(inputStream); + try { + FileUtils.extractZipFile(zin, + storage.getOutputTarget()); + } finally { + zin.close(); + } + } else if (inputSource != null) { + FileUtils.transfer(inputSource, storage.getOutputTarget()); + } + } catch (IOException e) { + return false; + } + + if (storage != null) { + IInputSource source = storage.getInputSource(); + if (source != null && source.hasEntry(ZenConstants.CONTENT_JSON) + && source.isEntryAvailable(ZenConstants.CONTENT_JSON)) { + return true; + } + } + return false; + } + } + private static class LocalFileBackup { private final File file; @@ -351,30 +417,80 @@ public long getModificationTime() { protected IWorkbook doLoadWorkbookFromURI(IProgressMonitor monitor, URI uri) throws InterruptedException, InvocationTargetException { File file = new File(uri); + IStorage storage = getTempStorage(); + if (isJsonFormat(file, storage)) { + return doLoadWorkbookFromJson(monitor, storage); + } else { + return doLoadWorkbookFromXml(monitor, storage); + } + } + + private boolean isJsonFormat(File file, IStorage storage) + throws InvocationTargetException { + PreParser parser = new PreParser(); + parser.setWorkbookStorage(storage); + InputStream stream = null; try { - IDeserializer deserializer = Core.getWorkbookBuilder() - .newDeserializer(); - deserializer.setEntryStreamNormalizer(getEncryptionHandler()); - deserializer.setWorkbookStorage(getTempStorage()); - InputStream stream = null; try { if (file.isDirectory()) { - deserializer.setInputSource(new DirectoryInputSource(file)); + parser.setInputSource(new DirectoryInputSource(file)); } else { stream = new FileInputStream(file); - deserializer.setInputStream(stream); + parser.setInputStream(stream); } - ProgressReporter reporter = new ProgressReporter(monitor); - deserializer.deserializeManifest(reporter); - String passwordHint = deserializer.getManifest() - .getPasswordHint(); - getEncryptable().setPasswordHint(passwordHint); - deserializer.deserialize(reporter); + return parser.isJsonFormat(); + } finally { if (stream != null) { stream.close(); } } + } catch (IOException e) { + throw new InvocationTargetException(e); + } + } + + private IWorkbook doLoadWorkbookFromJson(IProgressMonitor monitor, + IStorage storage) + throws InvocationTargetException, InterruptedException { + try { + IDeserializer deserializer = new ZenDeserializer(storage); + deserializer.setEntryStreamNormalizer(getEncryptionHandler()); + deserializer.setWorkbookStorageAsInputSource(); + ProgressReporter reporter = new ProgressReporter(monitor); + deserializer.deserializeManifest(reporter); + String passwordHint = deserializer.getManifest().getPasswordHint(); + getEncryptable().setPasswordHint(passwordHint); + deserializer.deserialize(reporter); + return deserializer.getWorkbook(); + } catch (IOException e) { + throw new InvocationTargetException(e); + } catch (CoreException e) { + if (e.getType() == Core.ERROR_CANCELLATION) + throw new InterruptedException(); + if (e.getType() == Core.ERROR_WRONG_PASSWORD) { + if (getEncryptable() != null) { + getEncryptable().reset(); + } + } + throw new InvocationTargetException(e); + } + } + + private IWorkbook doLoadWorkbookFromXml(IProgressMonitor monitor, + IStorage storage) + throws InvocationTargetException, InterruptedException { + try { + IDeserializer deserializer = Core.getWorkbookBuilder() + .newDeserializer(); + deserializer.setEntryStreamNormalizer(getEncryptionHandler()); + deserializer.setWorkbookStorage(storage); + deserializer.setWorkbookStorageAsInputSource(); + ProgressReporter reporter = new ProgressReporter(monitor); + deserializer.deserializeManifest(reporter); + String passwordHint = deserializer.getManifest().getPasswordHint(); + getEncryptable().setPasswordHint(passwordHint); + deserializer.deserialize(reporter); return deserializer.getWorkbook(); } catch (IOException e) { throw new InvocationTargetException(e); @@ -472,7 +588,26 @@ protected void doSaveWorkbookToURIFromSource(IProgressMonitor monitor, serializer.setOutputTarget(new DirectoryOutputTarget(file)); } else { backup.makeBackup(); - stream = new FileOutputStream(file); + + try { + stream = new FileOutputStream(file); + } catch (FileNotFoundException e) { + Display display = Display.getCurrent(); + Shell parent = (display != null + ? display.getActiveShell() : null); + MessageDialog.openWarning(parent, + MindMapMessages.LocalFileWorkbookRef_saveFailed_title, + MindMapMessages.LocalFileWorkbookRef_saveFailed_description); + throw new InterruptedException(); + + } catch (SecurityException e) { + MessageDialog.openWarning( + Display.getCurrent().getActiveShell(), + MindMapMessages.LocalFileWorkbookRef_saveFailed_title, + MindMapMessages.LocalFileWorkbookRef_saveFailed_description); + throw new InterruptedException(); + } + serializer.setOutputStream(stream); } serializer.serialize(new ProgressReporter(monitor)); diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/messages.properties b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/messages.properties index bb7558261..2aa9a8a74 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/messages.properties +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/messages.properties @@ -329,6 +329,8 @@ LocalFileWorkbookRef_removeDialog_delete_button=Delete LocalFileWorkbookRef_removeDialog_message=This mind map has been deleted . You can delete it now or save as a new XMind file. LocalFileWorkbookRef_removeDialog_saveAs_button=Save As LocalFileWorkbookRef_removeDialog_title=File Not Accessible +LocalFileWorkbookRef_saveFailed_description=Save failed, please try to choose another path to save your file. +LocalFileWorkbookRef_saveFailed_title=XMind MindMapEditor_CompatibilityWarning_dialogTitle=XMind - Compatibility Warning MindMapEditor_CompatibilityWarning_Overwrite_button=&Overwrite MindMapEditor_CompatibilityWarning_OverwritingHigherVersion_message=CAUTION: You're about to overwrite an XMind file that has a higher version of format ({0}), which may cause inconsistency or loss of unrecognized data. Do you want to save the edited content to another file? diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/DrillDownInfoItemContributor.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/DrillDownInfoItemContributor.java index 88b5d1672..2eb8fb620 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/DrillDownInfoItemContributor.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/DrillDownInfoItemContributor.java @@ -57,6 +57,10 @@ public IAction createAction(ITopicPart topicPart, ITopic topic) { return null; } + public String getSVGFilePath(ITopic topic, IAction action) { + return "platform:/plugin/org.xmind.ui.mindmap/icons/drill_down.svg"; //$NON-NLS-1$ + } + private boolean hasTraceService(IViewer viewer) { if (viewer instanceof IGraphicalViewer) { return ((IGraphicalViewer) viewer) diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/DrillUpInfoItemContributor.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/DrillUpInfoItemContributor.java index c34bf9612..e328a762a 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/DrillUpInfoItemContributor.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/DrillUpInfoItemContributor.java @@ -42,6 +42,10 @@ public IAction createAction(ITopicPart topicPart, ITopic topic) { return null; } + public String getSVGFilePath(ITopic topic, IAction action) { + return "platform:/plugin/org.xmind.ui.mindmap/icons/drill_up.svg"; //$NON-NLS-1$ + } + private boolean hasTraceService(IViewer viewer) { if (viewer instanceof IGraphicalViewer) { return ((IGraphicalViewer) viewer) diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/HyperlinkInfoItemContributor.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/HyperlinkInfoItemContributor.java index be5965b01..540dc5413 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/HyperlinkInfoItemContributor.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/HyperlinkInfoItemContributor.java @@ -10,6 +10,7 @@ import org.eclipse.core.runtime.SafeRunner; import org.eclipse.jface.action.Action; import org.eclipse.jface.action.IAction; +import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.util.SafeRunnable; import org.eclipse.osgi.util.NLS; import org.eclipse.swt.SWT; @@ -36,7 +37,9 @@ import org.xmind.ui.internal.actions.ModifyHyperlinkAction; import org.xmind.ui.internal.dialogs.DialogMessages; import org.xmind.ui.mindmap.AbstractInfoItemContributor; +import org.xmind.ui.mindmap.IHyperlinked; import org.xmind.ui.mindmap.IInfoPart; +import org.xmind.ui.mindmap.IMindMapImages; import org.xmind.ui.mindmap.ITopicPart; import org.xmind.ui.mindmap.MindMapUI; @@ -52,14 +55,64 @@ public IAction createAction(ITopicPart topicPart, ITopic topic) { if (action != null) { action.setId(MindMapActionFactory.OPEN_HYPERLINK.getId()); } + return action; + } + public boolean isModified(ITopicPart topicPart, ITopic topic, + IAction action) { + if (!(action instanceof IHyperlinked)) { + return true; + } + + String hyperlink = topic.getHyperlink(); + String hyperlink2 = ((IHyperlinked) action).getHyperlink(); + + return (hyperlink == null && hyperlink2 != null) + || (hyperlink != null && !hyperlink.equals(hyperlink2)); } public String getContent(ITopic topic) { return topic.getHyperlink(); } + public String getSVGFilePath(ITopic topic, IAction action) { + String hyperlink = topic.getHyperlink(); + if (hyperlink == null || action == null) + return null; + + Object element = HyperlinkUtils.findElement(hyperlink, + topic.getOwnedWorkbook()); + String filePath = "platform:/plugin/org.xmind.ui.mindmap/icons/"; //$NON-NLS-1$ + if (element != null && element instanceof ITopic) { + String type = ((ITopic) element).getType(); + if (ITopic.ROOT.equals(type)) { + return filePath + "link_central_topic.svg"; //$NON-NLS-1$ + } + if (ITopic.SUMMARY.equals(type)) { + return filePath + "link_summary.svg"; //$NON-NLS-1$ + } + if (ITopic.DETACHED.equals(type)) { + return filePath + "link_floating_topic.svg"; //$NON-NLS-1$ + } + if (ITopic.CALLOUT.equals(type)) { + return filePath + "link_callout.svg"; //$NON-NLS-1$ + } + ITopic parent = ((ITopic) element).getParent(); + if (parent != null && parent.isRoot()) { + return filePath + "link_main_topic.svg"; //$NON-NLS-1$ + } + return filePath + "link_subtopic.svg"; //$NON-NLS-1$ + } else if (isLinkToWeb(hyperlink)) { + ImageDescriptor descriptor = action.getImageDescriptor(); + ImageDescriptor hyperlinkDescriptor = MindMapUI.getImages() + .get(IMindMapImages.HYPERLINK, true); + if (descriptor != null && descriptor.equals(hyperlinkDescriptor)) + return filePath + "hyperlink.svg"; //$NON-NLS-1$ + } + return null; + } + @Override public boolean isCardModeAvailable(ITopic topic, ITopicPart topicPart) { return isLinkToWeb(topic.getHyperlink()) && !isIconTipOnly(topicPart); diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/IconTipPart.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/IconTipPart.java index 60049a1f7..197e7e6c7 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/IconTipPart.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/IconTipPart.java @@ -29,6 +29,8 @@ import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.LocalResourceManager; +import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.graphics.Image; @@ -43,6 +45,9 @@ import org.xmind.gef.service.IFeedback; import org.xmind.gef.ui.actions.IActionRegistry; import org.xmind.ui.internal.decorators.IconTipDecorator; +import org.xmind.ui.internal.svgsupport.SVGImageData; +import org.xmind.ui.internal.svgsupport.SVGImageFigure; +import org.xmind.ui.internal.svgsupport.SVGReference; import org.xmind.ui.mindmap.IIconTipPart; import org.xmind.ui.mindmap.ISelectionFeedbackHelper; import org.xmind.ui.mindmap.ITopicPart; @@ -63,12 +68,21 @@ public class IconTipPart extends MindMapPartBase private ImageReference imageRef = null; + private SVGReference svgRef = null; + + private ResourceManager resources; + public IconTipPart() { setDecorator(IconTipDecorator.getInstance()); } protected IFigure createFigure() { - return new SizeableImageFigure(); + if (svgRef != null) { + SVGImageFigure figure = new SVGImageFigure(); + figure.setManager(resources); + return figure; + } else + return new SizeableImageFigure(); } public IAction getAction() { @@ -81,6 +95,10 @@ public Image getImage() { return null; } + public SVGImageData getSVGData() { + return svgRef == null ? null : svgRef.getSVGData(); + } + public SizeableImageFigure getImageFigure() { return (SizeableImageFigure) super.getFigure(); } @@ -129,6 +147,19 @@ public void setParent(IPart parent) { } } + public void setModel(Object model) { + super.setModel(model); + + if (svgRef == null) { + if (model instanceof IconTip) { + String svgFilePath = ((IconTip) model).getInfoItemContributor() + .getSVGFilePath(getTopic(), action); + if (svgFilePath != null && !"".equals(svgFilePath)) //$NON-NLS-1$ + svgRef = createSVGReference(svgFilePath); + } + } + } + protected void register() { super.register(); if (getModel() instanceof IconTip) { @@ -189,27 +220,50 @@ private void registerAction(IAction action) { } private void updateImage() { - ImageDescriptor oldImageDescriptor = imageRef == null ? null - : imageRef.getImageDescriptor(); - ImageDescriptor newImageDescriptor = null; - if (action != null) - newImageDescriptor = action.getImageDescriptor(); - if (oldImageDescriptor != newImageDescriptor - && (oldImageDescriptor == null - || !oldImageDescriptor.equals(newImageDescriptor))) { - if (imageRef != null) { - imageRef.dispose(); + if (svgRef == null) { + ImageDescriptor oldImageDescriptor = imageRef == null ? null + : imageRef.getImageDescriptor(); + ImageDescriptor newImageDescriptor = null; + if (action != null) + newImageDescriptor = action.getImageDescriptor(); + if (oldImageDescriptor != newImageDescriptor + && (oldImageDescriptor == null || !oldImageDescriptor + .equals(newImageDescriptor))) { + if (imageRef != null) { + imageRef.dispose(); + } + imageRef = newImageDescriptor == null ? null + : new ImageReference(newImageDescriptor, false); + } + } else { + Object model = getModel(); + if (model != null && model instanceof IconTip) { + String svgFilePath = ((IconTip) model).getInfoItemContributor() + .getSVGFilePath(getTopic(), action); + if (svgFilePath == null || "".equals(svgFilePath)) { //$NON-NLS-1$ + /// for favicon + svgRef = null; + getParent().refresh(); + } } - imageRef = newImageDescriptor == null ? null - : new ImageReference(newImageDescriptor, false); } } + @Override + protected void onActivated() { + super.onActivated(); + resources = new LocalResourceManager(JFaceResources.getResources()); + } + protected void onDeactivated() { if (imageRef != null) { imageRef.dispose(); imageRef = null; } + if (svgRef != null) { + svgRef = null; + resources.dispose(); + } super.onDeactivated(); } @@ -297,6 +351,15 @@ protected ISelectionFeedbackHelper createSelectionFeedbackHelper() { return new SelectionFeedbackHelper(); } + private SVGReference createSVGReference(String svgFilePath) { + SVGReference ref = new SVGReference(svgFilePath); + + if (this.resources == null) + resources = new LocalResourceManager(JFaceResources.getResources()); + + return ref; + } + public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (IAction.TEXT.equals(property) diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/InfoItemIconPart.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/InfoItemIconPart.java index c7df83b8d..cd7000c42 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/InfoItemIconPart.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/InfoItemIconPart.java @@ -16,6 +16,8 @@ import org.eclipse.jface.action.MenuManager; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.resource.LocalResourceManager; +import org.eclipse.jface.resource.ResourceManager; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; import org.eclipse.swt.graphics.Image; @@ -30,6 +32,9 @@ import org.xmind.gef.service.IFeedback; import org.xmind.gef.ui.actions.IActionRegistry; import org.xmind.ui.internal.decorators.InfoItemIconDecorator; +import org.xmind.ui.internal.svgsupport.SVGImageData; +import org.xmind.ui.internal.svgsupport.SVGImageFigure; +import org.xmind.ui.internal.svgsupport.SVGReference; import org.xmind.ui.mindmap.IInfoItemPart; import org.xmind.ui.mindmap.IInfoPart; import org.xmind.ui.mindmap.ISelectionFeedbackHelper; @@ -48,13 +53,22 @@ public class InfoItemIconPart extends MindMapPartBase private ImageReference imageRef = null; + private SVGReference svgRef = null; + + private ResourceManager resources; + public InfoItemIconPart() { setDecorator(InfoItemIconDecorator.getInstance()); } @Override protected IFigure createFigure() { - return new SizeableImageFigure(); + if (svgRef != null) { + SVGImageFigure figure = new SVGImageFigure(); + figure.setManager(resources); + return figure; + } else + return new SizeableImageFigure(); } public IAction getAction() { @@ -67,6 +81,10 @@ public Image getImage() { return null; } + public SVGImageData getSVGData() { + return svgRef == null ? null : svgRef.getSVGData(); + } + public IMenuManager getPopupMenu() { InfoPart infoPart = (InfoPart) getParent(); ITopicPart topicPart = infoPart.getTopicPart(); @@ -117,6 +135,21 @@ public void setParent(IPart parent) { ((InfoPart) getParent()).addInfoItemIcon(this); } + @Override + public void setModel(Object model) { + super.setModel(model); + + if (svgRef == null) { + if (model instanceof InfoItemIcon) { + String svgFilePath = ((InfoItemIcon) model).getContributor() + .getSVGFilePath(getTopic(), action); + if (svgFilePath != null && !"".equals(svgFilePath)) //$NON-NLS-1$ + svgRef = createSVGReference(svgFilePath); + } + } + + } + @Override protected void register() { super.register(); @@ -178,30 +211,52 @@ private void registerAction(IAction action) { } private void updateImage() { - ImageDescriptor oldImageDescriptor = imageRef == null ? null - : imageRef.getImageDescriptor(); - ImageDescriptor newImageDescriptor = null; - if (action != null) - newImageDescriptor = action.isEnabled() - ? action.getImageDescriptor() - : action.getDisabledImageDescriptor(); - if (oldImageDescriptor != newImageDescriptor - && (oldImageDescriptor == null - || !oldImageDescriptor.equals(newImageDescriptor))) { - if (imageRef != null) { - imageRef.dispose(); + if (svgRef == null) { + ImageDescriptor oldImageDescriptor = imageRef == null ? null + : imageRef.getImageDescriptor(); + ImageDescriptor newImageDescriptor = null; + if (action != null) + newImageDescriptor = action.isEnabled() + ? action.getImageDescriptor() + : action.getDisabledImageDescriptor(); + if (oldImageDescriptor != newImageDescriptor + && (oldImageDescriptor == null || !oldImageDescriptor + .equals(newImageDescriptor))) { + if (imageRef != null) { + imageRef.dispose(); + } + imageRef = newImageDescriptor == null ? null + : new ImageReference(newImageDescriptor, false); + } + } else { + Object model = getModel(); + if (model != null && model instanceof InfoItemIcon) { + String filePath = ((InfoItemIcon) model).getContributor() + .getSVGFilePath(getTopic(), action); + if (filePath == null || "".equals(filePath)) { //$NON-NLS-1$ + svgRef = null; + getParent().refresh(); + } } - imageRef = newImageDescriptor == null ? null - : new ImageReference(newImageDescriptor, false); } } + @Override + protected void onActivated() { + resources = new LocalResourceManager(JFaceResources.getResources()); + super.onActivated(); + } + @Override protected void onDeactivated() { if (imageRef != null) { imageRef.dispose(); imageRef = null; } + if (svgRef != null) { + svgRef = null; + resources.dispose(); + } super.onDeactivated(); } @@ -281,6 +336,15 @@ protected ISelectionFeedbackHelper createSelectionFeedbackHelper() { return new SelectionFeedbackHelper(); } + private SVGReference createSVGReference(String svgFilePath) { + SVGReference ref = new SVGReference(svgFilePath); + + if (this.resources == null) + resources = new LocalResourceManager(JFaceResources.getResources()); + + return ref; + } + public void propertyChange(PropertyChangeEvent event) { String property = event.getProperty(); if (IAction.TEXT.equals(property) diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/LabelInfoItemContributor.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/LabelInfoItemContributor.java index e65b1c656..68912c6e8 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/LabelInfoItemContributor.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/LabelInfoItemContributor.java @@ -117,6 +117,10 @@ public String getContent(ITopic topic) { return MindMapUtils.getLabelText(labels); } + public String getSVGFilePath(ITopic topic, IAction action) { + return "platform:/plugin/org.xmind.ui.mindmap/icons/label.svg"; //$NON-NLS-1$ + } + @Override public boolean isCardModeAvailable(ITopic topic, ITopicPart topicPart) { return !isIconTipOnly(topicPart); diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/TopicPart.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/TopicPart.java index 2fdc7ae9b..b0a5b23aa 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/TopicPart.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/mindmap/TopicPart.java @@ -13,8 +13,6 @@ *******************************************************************************/ package org.xmind.ui.internal.mindmap; -import static org.xmind.core.ISheetSettings.INFO_ITEM; - import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -24,14 +22,10 @@ import org.eclipse.draw2d.IFigure; import org.eclipse.draw2d.LayoutManager; import org.eclipse.draw2d.geometry.Point; -import org.eclipse.jface.action.IAction; import org.xmind.core.Core; import org.xmind.core.IImage; import org.xmind.core.INumbering; import org.xmind.core.IRelationship; -import org.xmind.core.ISettingEntry; -import org.xmind.core.ISheet; -import org.xmind.core.ISheetSettings; import org.xmind.core.ITopic; import org.xmind.core.event.CoreEvent; import org.xmind.core.event.ICoreEventRegister; @@ -54,6 +48,7 @@ import org.xmind.gef.ui.actions.IActionRegistry; import org.xmind.ui.internal.IconTipContributorManager; import org.xmind.ui.internal.InfoItemContributorManager; +import org.xmind.ui.internal.TopicInfoItemManager; import org.xmind.ui.internal.decorators.TopicDecorator; import org.xmind.ui.internal.figures.TopicFigure; import org.xmind.ui.internal.graphicalpolicies.TopicGraphicalPolicy; @@ -170,6 +165,9 @@ public int compare(IMarkerRef p, IMarkerRef q) { private IAnchorListener anchorListener = null; + private TopicInfoItemManager topicInfoItemManager = new TopicInfoItemManager( + this);; + public TopicPart() { setDecorator(TopicDecorator.getInstance()); setGraphicalPolicy(TopicGraphicalPolicy.getInstance()); @@ -360,62 +358,10 @@ private void addMarkers(ITopic topic, List list) { for (IMarkerRef ref : markerRefsToSort) { list.add(new ViewerModel(MarkerPart.class, ref)); } - } private void addIconTips(ITopic topic, List list) { - List contributors = IconTipContributorManager - .getInstance().getContributors(); - if (!contributors.isEmpty()) { - for (IIconTipContributor contributor : contributors) { - IAction action = contributor.createAction(this, topic); - if (action != null) { - list.add(new IconTip(topic, contributor, action)); - } - } - } - - List contributors2 = InfoItemContributorManager - .getInstance().getContributors(); - if (!contributors2.isEmpty()) { - for (IInfoItemContributor contributor : contributors2) { - IAction action = contributor.createAction(this, topic); - if (action != null) - list.add(new IconTip(topic, contributor, action)); - } - } - - List bothContributors = InfoItemContributorManager - .getInstance().getBothContributors(); - if (!bothContributors.isEmpty()) { - ISheet sheet = topic.getOwnedSheet(); - if (sheet != null) { - for (IInfoItemContributor c : bothContributors) { - String infoItemMode = null; - String type = c.getId(); - if (type != null && !"".equals(type)) { //$NON-NLS-1$ - List entries = sheet.getSettings() - .getEntries(INFO_ITEM); - for (ISettingEntry entry : entries) { - String t = entry - .getAttribute(ISheetSettings.ATTR_TYPE); - if (type.equals(t)) - infoItemMode = entry - .getAttribute(ISheetSettings.ATTR_MODE); - } - } - - if (infoItemMode == null || "".equals(infoItemMode)) //$NON-NLS-1$ - infoItemMode = c.getDefaultMode(); - if (ISheetSettings.MODE_ICON.equals(infoItemMode) - || !c.isCardModeAvailable(topic, this)) { - IAction action = c.createAction(this, topic); - if (action != null) - list.add(new IconTip(topic, c, action)); - } - } - } - } + list.addAll(topicInfoItemManager.getIconTips()); } public IPart findAt(Point position) { @@ -561,6 +507,7 @@ protected void onDeactivated() { .getInstance().getContributors()) { iconTipCont.topicDeactivated(this); } + topicInfoItemManager.topicDeactivated(); super.onDeactivated(); } diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/notes/NotesInfoItemContributor.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/notes/NotesInfoItemContributor.java index 4feebdbaf..86810abf9 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/notes/NotesInfoItemContributor.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/notes/NotesInfoItemContributor.java @@ -118,6 +118,10 @@ public String getContent(ITopic topic) { return null; } + public String getSVGFilePath(ITopic topic, IAction action) { + return "platform:/plugin/org.xmind.ui.mindmap/icons/notes.svg"; //$NON-NLS-1$ + } + @Override public boolean isCardModeAvailable(ITopic topic, ITopicPart topicPart) { return !isIconTipOnly(topicPart); diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/properties/PropertiesPart.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/properties/PropertiesPart.java index 61d9c1258..e8a42a9f0 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/properties/PropertiesPart.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/properties/PropertiesPart.java @@ -15,6 +15,7 @@ import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.resource.LocalResourceManager; import org.eclipse.jface.resource.ResourceManager; +import org.eclipse.jface.util.Util; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; import org.eclipse.jface.viewers.ISelectionProvider; @@ -30,13 +31,16 @@ import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Point; import org.eclipse.swt.graphics.Rectangle; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; import org.eclipse.swt.widgets.Display; +import org.eclipse.swt.widgets.Event; import org.eclipse.swt.widgets.Label; +import org.eclipse.swt.widgets.Listener; import org.eclipse.ui.IActionBars; import org.eclipse.ui.IEditorPart; import org.eclipse.ui.IViewSite; @@ -235,6 +239,7 @@ protected Control doCreateContent(Composite parent) { this.widgetFactory = new WidgetFactory(contentComposite.getDisplay()); form = widgetFactory.createScrolledForm(contentComposite); + addHorizontalScrollSupport(form); form.setLayoutData(new GridData(GridData.FILL_BOTH)); form.setMinWidth(DEFAULT_SECTION_WIDTH); form.addDisposeListener(new DisposeListener() { @@ -264,6 +269,24 @@ public void widgetDisposed(DisposeEvent e) { return composite; } + // add horizontal scroll support for windows + private void addHorizontalScrollSupport(final ScrolledForm form) { + if (Util.isWindows()) { + form.addListener(SWT.MouseHorizontalWheel, new Listener() { + + public void handleEvent(Event event) { + if (!form.isDisposed()) { + int offset = event.count; + offset = -(int) (Math.sqrt(Math.abs(offset)) * offset); + + Point origin = form.getOrigin(); + form.setOrigin(origin.x + offset, origin.y); + } + } + }); + } + } + private Composite createDefaultPage(Composite parent) { Composite page = new Composite(parent, SWT.NONE); GridLayout gridLayout = new GridLayout(1, false); diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/AttachmentProtocol.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/AttachmentProtocol.java index be29fcc5f..edace09b3 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/AttachmentProtocol.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/AttachmentProtocol.java @@ -39,6 +39,7 @@ import org.xmind.core.IManifest; import org.xmind.core.INamed; import org.xmind.core.ITitled; +import org.xmind.core.ITopic; import org.xmind.core.IWorkbook; import org.xmind.core.event.ICoreEventListener; import org.xmind.core.event.ICoreEventSource2; @@ -48,6 +49,7 @@ import org.xmind.gef.ui.editor.IGraphicalEditorPage; import org.xmind.ui.internal.MindMapMessages; import org.xmind.ui.internal.editor.MME; +import org.xmind.ui.mindmap.IHyperlinked; import org.xmind.ui.mindmap.IMindMapImages; import org.xmind.ui.mindmap.IProtocol; import org.xmind.ui.mindmap.MindMapUI; @@ -56,7 +58,8 @@ public class AttachmentProtocol implements IProtocol { - private static class AttachmentAction extends Action { + private static class AttachmentAction extends Action + implements IHyperlinked { private IWorkbenchWindow window; @@ -66,13 +69,18 @@ private static class AttachmentAction extends Action { private String fileName; + private ITopic topic; + private IWindowListener windowListener; + private long modificationTime = -1L; + public AttachmentAction(IWorkbenchWindow window, IWorkbook workbook, - String path, String fileName) { + String path, String fileName, ITopic topic) { this.window = window; this.workbook = workbook; this.path = path; + this.topic = topic; this.fileName = fileName; } @@ -122,6 +130,7 @@ public void run() { //add write temp file back to entry support. private void addSaveBackSupport(final File hiberFile, final IFileEntry fileEntry) { + modificationTime = hiberFile.lastModified(); IEditorPart activeEditor = window.getActivePage().getActiveEditor(); if (activeEditor instanceof IGraphicalEditor) { @@ -200,16 +209,31 @@ public void windowActivated(IWorkbenchWindow window) { private void saveEntryBack(final IFileEntry fileEntry, final File hiberFile) { + if (modificationTime == hiberFile.lastModified()) { + return; + } + try { - InputStream is = new FileInputStream(hiberFile); - OutputStream os = fileEntry.openOutputStream(); - FileUtils.transfer(is, os); + IFileEntry newEntry = workbook.getManifest() + .createAttachmentFromStream( + new FileInputStream(hiberFile), fileName, + fileEntry.getMediaType()); + if (topic != null) { + topic.setHyperlink( + HyperlinkUtils.toAttachmentURL(newEntry.getPath())); + } + modificationTime = hiberFile.lastModified(); } catch (IOException e) { Logger.log(e, "Failed to transfer temp-attachments to attachment dir."); //$NON-NLS-1$ return; } } + + @Override + public String getHyperlink() { + return path; + } } private Map> actions = null; @@ -226,6 +250,11 @@ public IAction createOpenHyperlinkAction(Object context, String uri) { if (workbook == null) return null; + ITopic topic = null; + if (context instanceof IAdaptable) { + topic = (ITopic) ((IAdaptable) context).getAdapter(ITopic.class); + } + if (actions == null) actions = new HashMap>(); Map wbActions = actions.get(workbook); @@ -236,7 +265,7 @@ public IAction createOpenHyperlinkAction(Object context, String uri) { IAction action = wbActions.get(uri); if (action == null) { action = createOpenAttachmentAction(getWindow(context), workbook, - path, getFileName(context)); + path, getFileName(context), topic); wbActions.put(uri, action); } return action; @@ -244,24 +273,41 @@ public IAction createOpenHyperlinkAction(Object context, String uri) { } private IAction createOpenAttachmentAction(IWorkbenchWindow window, - IWorkbook workbook, String path, String fileName) { - IAction action = new AttachmentAction(window, workbook, path, fileName); + IWorkbook workbook, String path, String fileName, ITopic topic) { + IAction action = new AttachmentAction(window, workbook, path, fileName, + topic); action.setText(MindMapMessages.OpenAttachment_text); action.setToolTipText(fileName); - ImageDescriptor image = MindMapUI.getImages().getFileIcon(path, true); - if (image == null) { - IFileEntry e = workbook.getManifest().getFileEntry(path); - if (e != null && e.isDirectory()) { - image = MindMapUI.getImages().get(IMindMapImages.OPEN, true); - } else { - image = MindMapUI.getImages().get(IMindMapImages.UNKNOWN_FILE, - true); + + ImageDescriptor image = null; + + // show missing image when file not exist + if (!existsEntryFile(workbook, path)) { + image = MindMapUI.getImages().get(IMindMapImages.UNKNOWN_FILE, + true); + } else { + image = MindMapUI.getImages().getFileIcon(path, true); + if (image == null) { + IFileEntry e = workbook.getManifest().getFileEntry(path); + if (e != null && e.isDirectory()) { + image = MindMapUI.getImages().get(IMindMapImages.OPEN, + true); + } else { + image = MindMapUI.getImages() + .get(IMindMapImages.UNKNOWN_FILE, true); + } } } action.setImageDescriptor(image); return action; } + private boolean existsEntryFile(IWorkbook workbook, String path) { + IManifest manifest = workbook.getManifest(); + IFileEntry fileEntry = manifest.getFileEntry(path); + return fileEntry != null && fileEntry.getSize() > 0; + } + private static String getFileName(Object context) { if (context instanceof IAdaptable) { Object adapter = ((IAdaptable) context).getAdapter(ITitled.class); diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/FileProtocol.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/FileProtocol.java index ee57777e9..3aae6df07 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/FileProtocol.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/FileProtocol.java @@ -19,6 +19,7 @@ import org.xmind.core.IWorkbook; import org.xmind.ui.internal.MindMapMessages; import org.xmind.ui.internal.editor.MME; +import org.xmind.ui.mindmap.IHyperlinked; import org.xmind.ui.mindmap.IMindMapImages; import org.xmind.ui.mindmap.IProtocol; import org.xmind.ui.mindmap.MindMapUI; @@ -26,7 +27,7 @@ public class FileProtocol implements IProtocol { - private static class OpenFileAction extends Action { + private static class OpenFileAction extends Action implements IHyperlinked { private IWorkbenchWindow window; @@ -41,6 +42,10 @@ public void run() { MME.launch(window, path, new File(path).getName()); } + @Override + public String getHyperlink() { + return path; + } } public FileProtocol() { diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/ProtocolManager.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/ProtocolManager.java index 4dccbc434..1882c1cbc 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/ProtocolManager.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/ProtocolManager.java @@ -34,6 +34,7 @@ import org.xmind.ui.internal.MindMapMessages; import org.xmind.ui.internal.browser.BrowserUtil; import org.xmind.ui.internal.mindmap.TopicContext; +import org.xmind.ui.mindmap.IHyperlinked; import org.xmind.ui.mindmap.IMindMapImages; import org.xmind.ui.mindmap.IProtocol; import org.xmind.ui.mindmap.IProtocolDescriptor; @@ -47,7 +48,8 @@ public class ProtocolManager extends RegistryReader private static String DEFAULT_BROWSER_ID = "org.xmind.ui.defaultProtocol.browser"; //$NON-NLS-1$ - private static class DefaultOpenURLAction extends Action { + private static class DefaultOpenURLAction extends Action + implements IHyperlinked { private String url; public DefaultOpenURLAction(String url) { @@ -66,7 +68,8 @@ public void run() throws Exception { try { URI uri = new URI(theURL); String host = uri.getHost(); - if (host != null && host.endsWith(".xmind.net")) { //$NON-NLS-1$ + if (host != null && (host.endsWith(".xmind.net") //$NON-NLS-1$ + || host.endsWith(".xmind.cn"))) { //$NON-NLS-1$ theURL = BrowserUtil.makeRedirectURL(theURL); } } catch (Exception ignored) { @@ -76,6 +79,11 @@ public void run() throws Exception { } }); } + + @Override + public String getHyperlink() { + return url; + } } protected static class DefaultProtocol implements IProtocol { diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/TopicProtocol.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/TopicProtocol.java index ba514e3ab..6ba6377a5 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/TopicProtocol.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/TopicProtocol.java @@ -17,6 +17,7 @@ import org.xmind.ui.commands.ModifyTopicHyperlinkCommand; import org.xmind.ui.internal.MindMapMessages; import org.xmind.ui.internal.dialogs.DialogMessages; +import org.xmind.ui.mindmap.IHyperlinked; import org.xmind.ui.mindmap.IMindMapImages; import org.xmind.ui.mindmap.IProtocol; import org.xmind.ui.mindmap.MindMapUI; @@ -24,6 +25,46 @@ public class TopicProtocol implements IProtocol { + private class GoTopicAction extends Action implements IHyperlinked { + + private String uri; + + private IWorkbook workbook; + + private Object context; + + public GoTopicAction(String text, ImageDescriptor image, String uri, + IWorkbook workbook, Object context) { + super(text); + this.uri = uri; + this.workbook = workbook; + this.context = context; + setImageDescriptor(image); + } + + public void run() { + Object element = HyperlinkUtils.findElement(uri, workbook); + if (element != null) { + navigateTo(context, element, workbook); + } else { + // Element may have been deleted, ask whether to delete + // this link as well. + ITopic topic = findSourceTopic(context); + if (topic == null) + return; + + if (confirmDelete(context, uri)) { + deleteHyperlink(topic, context, uri); + } + } + } + + @Override + public String getHyperlink() { + return uri; + } + } + public TopicProtocol() { } @@ -46,25 +87,9 @@ public IAction createOpenHyperlinkAction(final Object context, name = title; } - Action action = new Action( - MindMapMessages.TopicProtocol_GoToTopic_text, icon) { - public void run() { - Object element = HyperlinkUtils.findElement(uri, workbook); - if (element != null) { - navigateTo(context, element, workbook); - } else { - // Element may have been deleted, ask whether to delete - // this link as well. - ITopic topic = findSourceTopic(context); - if (topic == null) - return; - - if (confirmDelete(context, uri)) { - deleteHyperlink(topic, context, uri); - } - } - } - }; + Action action = new GoTopicAction( + MindMapMessages.TopicProtocol_GoToTopic_text, icon, uri, + workbook, context); action.setToolTipText(name); return action; } @@ -130,11 +155,9 @@ public boolean isHyperlinkModifiable(Object source, String uri) { } private boolean confirmDelete(Object context, String uri) { - return MessageDialog - .openQuestion( - findShell(context), - DialogMessages.TopicProtocol_ConfirmDeleteInvalidTopicHyperlink_windowTitle, - DialogMessages.TopicProtocol_ConfirmDeleteInvalidTopicHyperlink_message); + return MessageDialog.openQuestion(findShell(context), + DialogMessages.TopicProtocol_ConfirmDeleteInvalidTopicHyperlink_windowTitle, + DialogMessages.TopicProtocol_ConfirmDeleteInvalidTopicHyperlink_message); } private void deleteHyperlink(ITopic topic, Object context, String uri) { diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/WebProtocol.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/WebProtocol.java index 123a7b530..1926ee619 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/WebProtocol.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/protocols/WebProtocol.java @@ -18,6 +18,7 @@ import org.xmind.core.IAdaptable; import org.xmind.core.ITopic; import org.xmind.core.event.ICoreEventSource; +import org.xmind.core.net.util.LinkUtils; import org.xmind.core.util.FileUtils; import org.xmind.gef.image.ImageExportUtils; import org.xmind.ui.browser.BrowserSupport; @@ -25,10 +26,12 @@ import org.xmind.ui.internal.browser.BrowserUtil; import org.xmind.ui.io.WebImageManager; import org.xmind.ui.io.WebImageManager.WebImageCallback; +import org.xmind.ui.mindmap.IHyperlinked; import org.xmind.ui.mindmap.IMindMapImages; import org.xmind.ui.mindmap.IProtocol; import org.xmind.ui.mindmap.MindMapUI; import org.xmind.ui.resources.ImageUtils; +import org.xmind.ui.util.JobPool; import org.xmind.ui.util.MindMapUtils; public class WebProtocol implements IProtocol { @@ -44,7 +47,9 @@ private static interface Callback { private static final String PATH_FAVICONS = "favicons/"; //$NON-NLS-1$ - private static class OpenURLAction extends Action { + private static JobPool jobPool = new JobPool(); + + private static class OpenURLAction extends Action implements IHyperlinked { private String url; @@ -63,7 +68,8 @@ public void run() throws Exception { String theURL = url; try { URI uri = new URI(theURL); - if ("www.xmind.net".equals(uri.getHost())) { //$NON-NLS-1$ + if (LinkUtils.HOST_NET.equals(uri.getHost()) + || LinkUtils.HOST_CN.equals(uri.getHost())) { theURL = BrowserUtil.makeRedirectURL(theURL); } } catch (Exception ignored) { @@ -73,6 +79,11 @@ public void run() throws Exception { } }); } + + @Override + public String getHyperlink() { + return url; + } } public IAction createOpenHyperlinkAction(final Object context, @@ -140,7 +151,7 @@ private ImageDescriptor getWebIcon(String url, final Callback callback) { return image; } - WebImageManager.getInstance().requestWebImage(iconUrl, + WebImageManager.getInstance().requestWebImage(iconUrl, jobPool, new WebImageCallback() { public void handleWith(String imagePath) { diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/tools/MindMapSelectTool.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/tools/MindMapSelectTool.java index 54f938ff6..5f2b89e43 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/tools/MindMapSelectTool.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/tools/MindMapSelectTool.java @@ -465,19 +465,24 @@ protected String getAttachmentAbsolutePath(ITopic topic, String uri) { return null; String hiberLoc = Core.getWorkspace() - .getAbsolutePath(".temp-attachments"); //$NON-NLS-1$ + .getAbsolutePath(".temp-attachments/quickOpen"); //$NON-NLS-1$ if (hiberLoc == null) return null; File hiberDir = new File(hiberLoc); - if (!hiberDir.isDirectory()) - return null; + //clear old cache. + if (hiberDir.exists()) { + hiberDir.delete(); + } + + File attFile = new File(hiberLoc, path); + FileUtils.ensureFileParent(attFile); IManifest manifest = workbook.getManifest(); IFileEntry fileEntry = manifest.getFileEntry(path); try { InputStream is = fileEntry.openInputStream(); - OutputStream os = new FileOutputStream(hiberLoc); + OutputStream os = new FileOutputStream(attFile.getAbsolutePath()); FileUtils.transfer(is, os); } catch (IOException e) { Logger.log(e, @@ -485,7 +490,6 @@ protected String getAttachmentAbsolutePath(ITopic topic, String uri) { return null; } - File attFile = new File(hiberDir, path); if (!attFile.exists()) return null; diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/tools/QuickOpenHelper.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/tools/QuickOpenHelper.java index b1b2ee82e..84fea320f 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/tools/QuickOpenHelper.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/tools/QuickOpenHelper.java @@ -14,14 +14,12 @@ package org.xmind.ui.internal.tools; -import java.io.File; import java.io.IOException; import org.eclipse.core.runtime.Platform; /** * @author Frank Shaka - * */ public class QuickOpenHelper { @@ -29,8 +27,6 @@ public class QuickOpenHelper { private Process process; - private String[] shownPaths = null; - public boolean canShow() { return "macosx".equals(Platform.getOS()); //$NON-NLS-1$ } @@ -48,7 +44,6 @@ public void show(String... paths) { return; } this.process = proc; - this.shownPaths = paths; } public boolean isOpen() { @@ -63,19 +58,9 @@ public boolean isOpen() { } public void hide() { - if (process == null) - return; - process.destroy(); - process = null; - if (shownPaths != null) { - for (String shownPath : shownPaths) { - File toHideFile = new File(shownPath); - if (toHideFile != null && toHideFile.exists() - && toHideFile.canWrite()) { - toHideFile.delete(); - } - } - shownPaths = null; + if (process != null) { + process.destroy(); + process = null; } } diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ExtensionsDeserializer.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ExtensionsDeserializer.java new file mode 100644 index 000000000..e95c116d7 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ExtensionsDeserializer.java @@ -0,0 +1,94 @@ +package org.xmind.ui.internal.zen; + +import java.util.Iterator; + +import org.eclipse.core.runtime.Assert; +import org.json.JSONArray; +import org.json.JSONObject; +import org.xmind.core.IResourceRef; +import org.xmind.core.IWorkbookExtension; +import org.xmind.core.IWorkbookExtensionElement; +import org.xmind.core.IWorkbookExtensionManager; +import org.xmind.core.util.HyperlinkUtils; + +/** + * @author Jason Wong + */ +public class ExtensionsDeserializer { + + public ExtensionsDeserializer() { + } + + public void deserialize(IWorkbookExtensionManager extensionManager, + JSONObject extensionsObject) { + JSONArray extArray = extensionsObject + .optJSONArray(ZenConstants.KEY_EXTENSIONS); + if (extArray != null) { + for (Object extObject : extArray) { + if (extObject instanceof JSONObject) { + deserializeWorkbookExtension(extensionManager, + (JSONObject) extObject); + } + } + } + } + + private void deserializeWorkbookExtension( + IWorkbookExtensionManager extensionManager, JSONObject extObject) { + String providerName = extObject.optString(ZenConstants.KEY_PROVIDER, + null); + Assert.isNotNull(providerName); + IWorkbookExtension ext = extensionManager.createExtension(providerName); + + deserializeWorkbookExtensionElement(ext.getContent(), extObject); + JSONArray resourceRefArray = extObject + .optJSONArray(ZenConstants.KEY_RESOURCE_REFS); + if (resourceRefArray != null) { + for (Object resourceRefArrayElement : resourceRefArray) { + if (resourceRefArrayElement instanceof String) { + String refURL = (String) resourceRefArrayElement; + if (HyperlinkUtils.isAttachmentURL(refURL)) { + IResourceRef ref = ext.getOwnedWorkbook() + .createResourceRef(IResourceRef.FILE_ENTRY, + HyperlinkUtils + .toAttachmentPath(refURL)); + ext.addResourceRef(ref); + } + } + } + } + } + + private void deserializeWorkbookExtensionElement( + IWorkbookExtensionElement ele, JSONObject eleObject) { + JSONObject attrMapObject = eleObject + .optJSONObject(ZenConstants.KEY_ATTRS); + if (attrMapObject != null) { + Iterator attrKeyIt = attrMapObject.keys(); + while (attrKeyIt.hasNext()) { + String attrKey = attrKeyIt.next(); + ele.setAttribute(attrKey, attrMapObject.getString(attrKey)); + } + } + + Object content = eleObject.opt(ZenConstants.KEY_CONTENT); + if (content instanceof String) { + ele.setTextContent((String) content); + } else if (content instanceof JSONArray) { + JSONArray childElementArray = (JSONArray) content; + for (Object childElementObject : childElementArray) { + if (childElementObject instanceof JSONObject) { + String childName = ((JSONObject) childElementObject) + .optString(ZenConstants.KEY_NAME, null); + Assert.isNotNull(childName); + deserializeWorkbookExtensionElement( + ele.createChild(childName), + (JSONObject) childElementObject); + } + } + } else { + /// TODO bad file format + } + } + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ManifestDeserializer.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ManifestDeserializer.java new file mode 100644 index 000000000..fe868a738 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ManifestDeserializer.java @@ -0,0 +1,73 @@ +package org.xmind.ui.internal.zen; + +import static org.xmind.core.internal.dom.DOMConstants.ATTR_ALGORITHM_NAME; +import static org.xmind.core.internal.dom.DOMConstants.ATTR_ITERATION_COUNT; +import static org.xmind.core.internal.dom.DOMConstants.ATTR_KEY_DERIVATION_NAME; +import static org.xmind.core.internal.dom.DOMConstants.ATTR_KEY_IV; +import static org.xmind.core.internal.dom.DOMConstants.ATTR_KEY_SIZE; +import static org.xmind.core.internal.dom.DOMConstants.ATTR_SALT; +import static org.xmind.core.internal.dom.DOMConstants.TAG_ALGORITHM; +import static org.xmind.core.internal.dom.DOMConstants.TAG_KEY_DERIVATION; + +import org.json.JSONObject; +import org.xmind.core.IEncryptionData; +import org.xmind.core.IFileEntry; +import org.xmind.core.IManifest; + +public class ManifestDeserializer { + + public void deserialize(IManifest manifest, JSONObject manifestObject) { + + JSONObject entriesObject = manifestObject + .optJSONObject(ZenConstants.KEY_FILE_ENTRIES); + if (entriesObject != null) { + for (String path : entriesObject.keySet()) { + IFileEntry fileEntry = manifest.createFileEntry(path); + + JSONObject pathObject = entriesObject.optJSONObject(path); + if (pathObject != null) { + JSONObject encryptionDataObject = pathObject + .optJSONObject(ZenConstants.KEY_ENCRYPTION_DATA); + if (encryptionDataObject != null) { + deserializeEncryptionData(fileEntry, + encryptionDataObject); + } + } + } + } + + String passwordHint = (String) manifestObject + .opt(ZenConstants.KEY_PASSWORD_HINT); + if (passwordHint != null) { + manifest.setPasswordHint(passwordHint); + } + } + + private void deserializeEncryptionData(IFileEntry fileEntry, + JSONObject encryptionDataObject) { + + int iterationCount = encryptionDataObject + .optInt(ZenConstants.KEY_ITERATION_COUNT); + String algorithmName = encryptionDataObject + .optString(ZenConstants.KEY_ALGORITHM_NAME); + String derivationName = encryptionDataObject + .optString(ZenConstants.KEY_DERIVATION_NAME); + int size = encryptionDataObject.optInt(ZenConstants.KEY_SIZE); + String salt = encryptionDataObject.optString(ZenConstants.KEY_SALT); + String iv = encryptionDataObject.optString(ZenConstants.KEY_IV); + + IEncryptionData encryptionData = fileEntry.createEncryptionData(); + + encryptionData.setAttribute("" + iterationCount, //$NON-NLS-1$ + TAG_KEY_DERIVATION, ATTR_ITERATION_COUNT); + encryptionData.setAttribute(algorithmName, TAG_ALGORITHM, + ATTR_ALGORITHM_NAME); + encryptionData.setAttribute(derivationName, TAG_KEY_DERIVATION, + ATTR_KEY_DERIVATION_NAME); + encryptionData.setAttribute("" + size, //$NON-NLS-1$ + TAG_KEY_DERIVATION, ATTR_KEY_SIZE); + encryptionData.setAttribute(salt, TAG_KEY_DERIVATION, ATTR_SALT); + encryptionData.setAttribute(iv, TAG_KEY_DERIVATION, ATTR_KEY_IV); + } + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/MetaDeserializer.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/MetaDeserializer.java new file mode 100644 index 000000000..4ac3eaabc --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/MetaDeserializer.java @@ -0,0 +1,67 @@ +package org.xmind.ui.internal.zen; + +import org.json.JSONObject; +import org.xmind.core.IMeta; + +public class MetaDeserializer { + + public void deserialize(IMeta meta, JSONObject metaObject) { + + JSONObject authorObject = metaObject + .optJSONObject(ZenConstants.KEY_META_AUTHOR); + if (authorObject != null) { + String name = (String) authorObject.opt(ZenConstants.KEY_META_NAME); + if (name != null) { + meta.setValue(IMeta.AUTHOR_NAME, name); + } + } + + JSONObject createObject = metaObject + .optJSONObject(ZenConstants.KEY_CREATE); + if (createObject != null) { + String createTime = (String) createObject + .opt(ZenConstants.KEY_TIME); + if (createTime != null) { + meta.setValue(IMeta.CREATED_TIME, createTime); + } + } + + JSONObject creatorObject = metaObject + .optJSONObject(ZenConstants.KEY_CREATOR); + if (creatorObject != null) { + String name = (String) creatorObject + .opt(ZenConstants.KEY_META_NAME); + if (name != null) { + meta.setValue(IMeta.CREATOR_NAME, name); + } + String version = (String) creatorObject + .opt(ZenConstants.KEY_VERSION); + if (version != null) { + meta.setValue(IMeta.CREATOR_VERSION, version); + } + } + + JSONObject thumbnailObject = metaObject + .optJSONObject(ZenConstants.KEY_THUMBNAIL); + if (thumbnailObject != null) { + JSONObject originObject = thumbnailObject + .optJSONObject(ZenConstants.KEY_ORIGIN); + if (originObject != null) { + String x = (String) originObject.opt(ZenConstants.KEY_META_X); + if (x != null) { + meta.setValue(IMeta.ORIGIN_X, x); + } + String y = (String) originObject.opt(ZenConstants.KEY_META_Y); + if (y != null) { + meta.setValue(IMeta.ORIGIN_Y, y); + } + } + String backgroundColor = (String) thumbnailObject + .opt(ZenConstants.KEY_BACKGROUND_COLOR); + if (backgroundColor != null) { + meta.setValue(IMeta.BACKGROUND_COLOR, backgroundColor); + } + } + } + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/Ranges.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/Ranges.java new file mode 100644 index 000000000..a53c6364d --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/Ranges.java @@ -0,0 +1,52 @@ +/* ****************************************************************************** + * Copyright (c) 2006-2016 XMind Ltd. and others. + * + * This file is a part of XMind 3. XMind releases 3 and + * above are dual-licensed under the Eclipse Public License (EPL), + * which is available at http://www.eclipse.org/legal/epl-v10.html + * and the GNU Lesser General Public License (LGPL), + * which is available at http://www.gnu.org/licenses/lgpl.html + * See http://www.xmind.net/license.html for details. + * + * Contributors: + * XMind Ltd. - initial API and implementation + *******************************************************************************/ +/** + * + */ +package org.xmind.ui.internal.zen; + +import org.xmind.core.internal.dom.NumberUtils; + +public class Ranges { + + public static final String RANGE_MASTER = "master"; //$NON-NLS-1$ + + public static int parseStartIndex(String range) { + if (range != null && range.startsWith("(") //$NON-NLS-1$ + && range.endsWith(")")) { //$NON-NLS-1$ + int sep = range.indexOf(','); + if (sep > 0) { + String startIndexValue = range.substring(1, sep).trim(); + int index = NumberUtils.safeParseInt(startIndexValue, -1); + return index < 0 ? -1 : index; + } + } + return -1; + } + + public static int parseEndIndex(String range) { + if (range != null && range.startsWith("(") //$NON-NLS-1$ + && range.endsWith(")")) { //$NON-NLS-1$ + int sep = range.lastIndexOf(','); + if (sep > 0) { + String endIndexValue = range + .substring(sep + 1, range.length() - 1).trim(); + int index = NumberUtils.safeParseInt(endIndexValue, -1); + return index < 0 ? -1 : index; + } + } + return -1; + } + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/SheetDeserializer.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/SheetDeserializer.java new file mode 100644 index 000000000..c2d33c713 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/SheetDeserializer.java @@ -0,0 +1,759 @@ +/* ****************************************************************************** + * Copyright (c) 2006-2016 XMind Ltd. and others. + * + * This file is a part of XMind 3. XMind releases 3 and + * above are dual-licensed under the Eclipse Public License (EPL), + * which is available at http://www.eclipse.org/legal/epl-v10.html + * and the GNU Lesser General Public License (LGPL), + * which is available at http://www.gnu.org/licenses/lgpl.html + * See http://www.xmind.net/license.html for details. + * + * Contributors: + * XMind Ltd. - initial API and implementation + *******************************************************************************/ +/** + * + */ +package org.xmind.ui.internal.zen; + +import java.io.IOException; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; +import java.util.Map; +import java.util.Properties; +import java.util.Set; + +import org.eclipse.core.runtime.Assert; +import org.json.JSONArray; +import org.json.JSONObject; +import org.xmind.core.IBoundary; +import org.xmind.core.IComment; +import org.xmind.core.ICommentManager; +import org.xmind.core.IControlPoint; +import org.xmind.core.IFileEntry; +import org.xmind.core.IHtmlNotesContent; +import org.xmind.core.IHyperlinkSpan; +import org.xmind.core.IIdentifiable; +import org.xmind.core.IImage; +import org.xmind.core.ILegend; +import org.xmind.core.INotes; +import org.xmind.core.INotesContent; +import org.xmind.core.IParagraph; +import org.xmind.core.IPlainNotesContent; +import org.xmind.core.IRelationship; +import org.xmind.core.IResourceRef; +import org.xmind.core.ISettingEntry; +import org.xmind.core.ISheet; +import org.xmind.core.ISheetSettings; +import org.xmind.core.ISpan; +import org.xmind.core.ISpanList; +import org.xmind.core.ISummary; +import org.xmind.core.ITopic; +import org.xmind.core.ITopicExtension; +import org.xmind.core.ITopicExtensionElement; +import org.xmind.core.IWorkbook; +import org.xmind.core.internal.dom.BoundaryImpl; +import org.xmind.core.internal.dom.DOMConstants; +import org.xmind.core.internal.dom.RelationshipImpl; +import org.xmind.core.internal.dom.SheetImpl; +import org.xmind.core.internal.dom.SummaryImpl; +import org.xmind.core.internal.dom.TopicImpl; +import org.xmind.core.marker.IMarker; +import org.xmind.core.marker.IMarkerGroup; +import org.xmind.core.marker.IMarkerSheet; +import org.xmind.core.style.IStyle; +import org.xmind.core.style.IStyleSheet; +import org.xmind.core.style.IStyled; +import org.xmind.core.util.HyperlinkUtils; +import org.xmind.core.util.IStyleRefCounter; + +public class SheetDeserializer { + + private IWorkbook workbook; + + private Map styleTable; + + /** + * + */ + public SheetDeserializer(IWorkbook workbook) { + this.workbook = workbook; + this.styleTable = new HashMap(); + } + + /** + * @param sheet + * @param sheetObject + */ + public void deserialize(ISheet sheet, JSONObject sheetObject) + throws IOException { + + String sheetId = sheetObject.optString(ZenConstants.KEY_ID); + ((SheetImpl) sheet).getImplementation() + .setAttribute(DOMConstants.ATTR_ID, sheetId); + + String sheetTitle = sheetObject.optString(ZenConstants.KEY_TITLE); + sheet.setTitleText(sheetTitle); + + JSONObject rootTopicObject = sheetObject + .optJSONObject(ZenConstants.KEY_ROOT_TOPIC); + Assert.isNotNull(rootTopicObject); + ITopic rootTopic = parseTopic(rootTopicObject, null); + sheet.replaceRootTopic(rootTopic); + + JSONArray relationshipArray = sheetObject + .optJSONArray(ZenConstants.KEY_RELATIONSHIPS); + if (relationshipArray != null) { + for (Object relationshipArrayElement : relationshipArray) { + if (relationshipArrayElement instanceof JSONObject) { + sheet.addRelationship(parseRelationship( + (JSONObject) relationshipArrayElement)); + } + } + } + + // legend + JSONObject legendObject = sheetObject + .optJSONObject(ZenConstants.KEY_LEGEND); + if (legendObject != null) { + ILegend legend = sheet.getLegend(); + legend.setVisible(ZenConstants.VAL_VISIBLE.equals( + legendObject.optString(ZenConstants.KEY_VISIBILITY, null))); + JSONObject positionObject = legendObject + .optJSONObject(ZenConstants.KEY_POSITION); + if (positionObject != null) { + legend.setPosition(positionObject.optInt(ZenConstants.KEY_X, 0), + positionObject.optInt(ZenConstants.KEY_Y, 0)); + } + JSONObject markerMapObject = legendObject + .optJSONObject(ZenConstants.KEY_MARKERS); + JSONObject groupMapObject = legendObject + .optJSONObject(ZenConstants.KEY_GROUPS); + IMarkerSheet markerSheet = workbook.getMarkerSheet(); + if (groupMapObject != null) { + Iterator groupIdIt = groupMapObject.keys(); + while (groupIdIt.hasNext()) { + String groupId = groupIdIt.next(); + JSONObject groupObject = groupMapObject + .getJSONObject(groupId); + IMarkerGroup group = markerSheet.getMarkerGroup(groupId); + if (group == null) { + group = markerSheet.createMarkerGroupById(groupId); + } + group.setName(groupObject.optString(ZenConstants.KEY_NAME)); + + JSONArray markerArray = groupObject + .optJSONArray(ZenConstants.KEY_MARKERS); + if (markerArray != null) { + for (Object markerArrayElement : markerArray) { + String markerId = (String) markerArrayElement; + JSONObject markerObject = markerMapObject + .optJSONObject(markerId); + if (markerObject != null) { + IMarker marker = markerSheet + .getMarker(markerId); + if (marker == null) { + String resourceURL = markerObject.optString( + ZenConstants.KEY_RESOURCE); + String resourcePath = resourceURL == null + ? null + : HyperlinkUtils.toAttachmentPath( + resourceURL); + String newPath = allocateMarkerResource( + markerSheet, resourcePath); + marker = markerSheet.createMarkerById( + markerId, newPath); + } + if (marker.getParent() == null) + group.addMarker(marker); + } + } + } + + if (!group.isEmpty() && group.getParent() == null) { + markerSheet.addMarkerGroup(group); + } + } + } + if (markerMapObject != null) { + Iterator markerIdIt = markerMapObject.keys(); + while (markerIdIt.hasNext()) { + String markerId = markerIdIt.next(); + JSONObject markerObject = markerMapObject + .optJSONObject(markerId); + if (markerObject != null) { + legend.setMarkerDescription(markerId, markerObject + .optString(ZenConstants.KEY_NAME, null)); + } + } + } + } + + JSONObject settingsObject = sheetObject + .optJSONObject(ZenConstants.KEY_SETTINGS); + if (settingsObject != null) { + ISheetSettings settings = sheet.getSettings(); + Iterator settingPathIt = settingsObject.keys(); + while (settingPathIt.hasNext()) { + String settingPath = settingPathIt.next(); + JSONArray settingEntryArray = settingsObject + .optJSONArray(settingPath); + if (settingEntryArray != null) { + for (Object settingEntryArrayElement : settingEntryArray) { + if (settingEntryArrayElement instanceof JSONObject) { + JSONObject settingEntryObject = (JSONObject) settingEntryArrayElement; + ISettingEntry settingEntry = settings + .createEntry(settingPath); + Iterator keyIt = settingEntryObject.keys(); + while (keyIt.hasNext()) { + String key = keyIt.next(); + settingEntry.setAttribute(key, + settingEntryObject.optString(key, + null)); + } + settings.addEntry(settingEntry); + } + } + + } + } + } + + deserializeStyle(sheet, sheetObject); + deserializeTheme(sheet, sheetObject); + } + + private ITopic parseTopic(JSONObject topicObject, String type) { + String topicId = topicObject.optString(ZenConstants.KEY_ID, null); + Assert.isNotNull(topicId); + ITopic topic = workbook.createTopic(); + ((TopicImpl) topic).getImplementation() + .setAttribute(DOMConstants.ATTR_ID, topicId); + + topic.setTitleText(topicObject.optString(ZenConstants.KEY_TITLE, null)); + topic.setTitleWidth(topicObject.optInt(ZenConstants.KEY_TITLE_WIDTH, + ITopic.UNSPECIFIED)); + topic.setFolded(ZenConstants.VAL_FOLDED + .equals(topicObject.optString(ZenConstants.KEY_BRANCH, null))); + + deserializeTopicStructure(topicObject, topic, type); + JSONObject positionObject = topicObject + .optJSONObject(ZenConstants.KEY_POSITION); + if (positionObject != null) { + topic.setPosition(positionObject.optInt(ZenConstants.KEY_X, 0), + positionObject.optInt(ZenConstants.KEY_Y, 0)); + } else { + topic.setPosition(null); + } + topic.setHyperlink(topicObject.optString(ZenConstants.KEY_HREF, null)); + + JSONArray labelArray = topicObject + .optJSONArray(ZenConstants.KEY_LABELS); + if (labelArray != null) { + Set labels = new HashSet(); + for (Object label : labelArray) { + if (label instanceof String) { + labels.add((String) label); + } + } + topic.setLabels(labels); + } + + JSONArray markerRefArray = topicObject + .optJSONArray(ZenConstants.KEY_MARKERS); + if (markerRefArray != null) { + for (Object markerRefObject : markerRefArray) { + if (markerRefObject instanceof JSONObject) { + String markerId = ((JSONObject) markerRefObject) + .optString(ZenConstants.KEY_MARKER_ID, null); + if (markerId != null) { + topic.addMarker(markerId); + } + } + } + } + + deserializeStyle(topic, topicObject); + + JSONObject imageObject = topicObject + .optJSONObject(ZenConstants.KEY_IMAGE); + if (imageObject != null) { + topic.getImage().setSource( + imageObject.optString(ZenConstants.KEY_SRC, null)); + topic.getImage().setAlignment( + imageObject.optString(ZenConstants.KEY_ALIGN, null)); + topic.getImage().setWidth(imageObject.optInt(ZenConstants.KEY_WIDTH, + IImage.UNSPECIFIED)); + topic.getImage().setHeight(imageObject + .optInt(ZenConstants.KEY_HEIGHT, IImage.UNSPECIFIED)); + } + + JSONObject numberingObject = topicObject + .optJSONObject(ZenConstants.KEY_NUMBERING); + if (numberingObject != null) { + topic.getNumbering().setFormat(numberingObject + .optString(ZenConstants.KEY_NUMBER_FORMAT, null)); + topic.getNumbering().setDepth(numberingObject + .optString(ZenConstants.KEY_NUMBER_DEPTH, null)); + topic.getNumbering().setPrefix( + numberingObject.optString(ZenConstants.KEY_PREFIX, null)); + topic.getNumbering().setSuffix( + numberingObject.optString(ZenConstants.KEY_SUFFIX, null)); + topic.getNumbering().setSeparator(numberingObject + .optString(ZenConstants.KEY_NUMBER_SEPARATOR, null)); + String prepend = numberingObject + .optString(ZenConstants.KEY_PREPENDING_NUMBERS, null); + if (ZenConstants.VAL_NONE.equals(prepend)) { + topic.getNumbering().setPrependsParentNumbers(false); + } + } + + JSONObject notesObject = topicObject + .optJSONObject(ZenConstants.KEY_NOTES); + if (notesObject != null) { + JSONObject plainObject = notesObject + .optJSONObject(ZenConstants.KEY_PLAIN); + if (plainObject != null) { + String textContent = plainObject + .optString(ZenConstants.KEY_CONTENT, null); + if (textContent != null) { + INotesContent plainContent = workbook + .createNotesContent(INotes.PLAIN); + if (plainContent instanceof IPlainNotesContent) { + ((IPlainNotesContent) plainContent) + .setTextContent(textContent); + topic.getNotes().setContent(INotes.PLAIN, plainContent); + } + } + } + + JSONObject htmlObject = notesObject + .optJSONObject(ZenConstants.KEY_HTML); + if (htmlObject != null) { + JSONObject contentObject = htmlObject + .optJSONObject(ZenConstants.KEY_CONTENT); + if (contentObject != null) { + INotesContent htmlContent = workbook + .createNotesContent(INotes.HTML); + if (htmlContent instanceof IHtmlNotesContent) { + deserializeHtmlNotesContent( + (IHtmlNotesContent) htmlContent, contentObject); + topic.getNotes().setContent(INotes.HTML, htmlContent); + } + } + } + } + + JSONObject childrenObject = topicObject + .optJSONObject(ZenConstants.KEY_CHILDREN); + if (childrenObject != null) { + Iterator types = childrenObject.keys(); + while (types.hasNext()) { + String childType = types.next(); + JSONArray topicArray = childrenObject.optJSONArray(childType); + for (Object childObject : topicArray) { + ITopic childTopic = parseTopic((JSONObject) childObject, + childType); + topic.add(childTopic, childType); + } + } + } + + JSONArray boundaryArray = topicObject + .optJSONArray(ZenConstants.KEY_BOUNDARIES); + if (boundaryArray != null) { + for (Object boundaryObject : boundaryArray) { + if (boundaryObject instanceof JSONObject) { + topic.addBoundary( + parseBoundary((JSONObject) boundaryObject)); + } + } + } + + JSONArray summaryArray = topicObject + .optJSONArray(ZenConstants.KEY_SUMMARIES); + if (summaryArray != null) { + for (Object summaryObject : summaryArray) { + if (summaryObject instanceof JSONObject) { + topic.addSummary(parseSummary((JSONObject) summaryObject)); + } + } + } + + JSONArray extArray = topicObject + .optJSONArray(ZenConstants.KEY_EXTENSIONS); + if (extArray != null) { + for (Object extObject : extArray) { + if (extObject instanceof JSONObject) { + deserializeTopicExtension(topic, (JSONObject) extObject); + } + } + } + + JSONArray commentArray = topicObject + .optJSONArray(ZenConstants.KEY_COMMENTS); + if (commentArray != null) { + for (Object commentObject : commentArray) { + if (commentObject instanceof JSONObject) { + deserializeComment(topic, (JSONObject) commentObject); + } + } + } + + return topic; + } + + private void deserializeTopicStructure(JSONObject topicObject, ITopic topic, + String type) { + String structureClass = topicObject + .optString(ZenConstants.KEY_STRUCTURE_CLASS, null); + if ("detached".equals(type)) { //$NON-NLS-1$ + if ("org.xmind.ui.map".equals(structureClass) //$NON-NLS-1$ + || "org.xmind.ui.map.unbalanced".equals(structureClass)) { //$NON-NLS-1$ + structureClass = "org.xmind.ui.map.floating"; //$NON-NLS-1$ + } else if ("org.xmind.ui.map.clockwise".equals(structureClass)) { //$NON-NLS-1$ + structureClass = "org.xmind.ui.map.floating.clockwise"; //$NON-NLS-1$ + } else if ("org.xmind.ui.map.anticlockwise" //$NON-NLS-1$ + .equals(structureClass)) { + structureClass = "org.xmind.ui.map.floating.anticlockwise"; //$NON-NLS-1$ + } + } + topic.setStructureClass(structureClass); + } + + /** + * @param topic + * @param commentObject + */ + private void deserializeComment(IIdentifiable object, + JSONObject commentObject) { + String author = commentObject.optString(ZenConstants.KEY_AUTHOR, null); + long creationTime = commentObject + .optLong(ZenConstants.KEY_CREATION_TIME, 0); + String objectId = object.getId(); + if (author == null) + return; + + ICommentManager commentManager = workbook.getCommentManager(); + IComment comment = commentManager.createComment(author, creationTime, + objectId); + comment.setContent( + commentObject.optString(ZenConstants.KEY_CONTENT, null)); + commentManager.addComment(comment); + } + + private void deserializeHtmlNotesContent(IHtmlNotesContent content, + JSONObject contentObject) { + JSONArray paragraphArray = contentObject + .optJSONArray(ZenConstants.KEY_PARAGRAPHS); + if (paragraphArray != null) { + for (Object paragraphArrayElement : paragraphArray) { + if (paragraphArrayElement instanceof JSONObject) { + JSONObject paragraphObject = (JSONObject) paragraphArrayElement; + IParagraph paragraph = content.createParagraph(); + deserializeStyle(paragraph, paragraphObject); + deserializeSpanList(paragraph, paragraphObject, content); + content.addParagraph(paragraph); + } + } + } + } + + private void deserializeSpanList(ISpanList spanList, + JSONObject sourceObject, IHtmlNotesContent spanFactory) { + JSONArray spanArray = sourceObject.optJSONArray(ZenConstants.KEY_SPANS); + if (spanArray == null || spanArray.length() == 0) + return; + + for (Object spanArrayElement : spanArray) { + if (spanArrayElement instanceof JSONObject) { + JSONObject spanObject = (JSONObject) spanArrayElement; + ISpan span; + String text = spanObject.optString(ZenConstants.KEY_TEXT, null); + if (text != null) { + span = spanFactory.createTextSpan(text); + } else { + String imageSource = spanObject + .optString(ZenConstants.KEY_IMAGE, null); + if (imageSource != null) { + span = spanFactory.createImageSpan(imageSource); + } else { + String href = spanObject + .optString(ZenConstants.KEY_HREF, null); + if (href != null) { + span = spanFactory.createHyperlinkSpan(href); + deserializeSpanList((IHyperlinkSpan) span, + spanObject, spanFactory); + } else { + continue; + } + } + } + deserializeStyle(span, spanObject); + spanList.addSpan(span); + } + } + } + + private IBoundary parseBoundary(JSONObject boundaryObject) { + String id = boundaryObject.optString(ZenConstants.KEY_ID, null); + Assert.isNotNull(id); + IBoundary boundary = workbook.createBoundary(); + ((BoundaryImpl) boundary).getImplementation() + .setAttribute(DOMConstants.ATTR_ID, id); + + boundary.setTitleText( + boundaryObject.optString(ZenConstants.KEY_TITLE, null)); + + String range = boundaryObject.optString(ZenConstants.KEY_RANGE, null); + if (Ranges.RANGE_MASTER.equals(range)) { + boundary.setMasterBoundary(true); + } else { + boundary.setStartIndex(Ranges.parseStartIndex(range)); + boundary.setEndIndex(Ranges.parseEndIndex(range)); + } + + deserializeStyle(boundary, boundaryObject); + return boundary; + } + + private ISummary parseSummary(JSONObject summaryObject) { + String id = summaryObject.optString(ZenConstants.KEY_ID, null); + Assert.isNotNull(id); + ISummary summary = workbook.createSummary(); + ((SummaryImpl) summary).getImplementation() + .setAttribute(DOMConstants.ATTR_ID, id); + summary.setTopicId( + summaryObject.optString(ZenConstants.KEY_TOPIC_ID, null)); + + String range = summaryObject.optString(ZenConstants.KEY_RANGE, null); + summary.setStartIndex(Ranges.parseStartIndex(range)); + summary.setEndIndex(Ranges.parseEndIndex(range)); + + deserializeStyle(summary, summaryObject); + return summary; + } + + private IRelationship parseRelationship(JSONObject relObject) { + String relId = relObject.optString(ZenConstants.KEY_ID, null); + Assert.isNotNull(relId); + IRelationship rel = workbook.createRelationship(); + ((RelationshipImpl) rel).getImplementation() + .setAttribute(DOMConstants.ATTR_ID, relId); + + rel.setTitleText(relObject.optString(ZenConstants.KEY_TITLE, null)); + rel.setEnd1Id(relObject.optString(ZenConstants.KEY_END1_ID, null)); + rel.setEnd2Id(relObject.optString(ZenConstants.KEY_END2_ID, null)); + + JSONObject controlPointMap = relObject + .optJSONObject(ZenConstants.KEY_CONTROL_POINTS); + if (controlPointMap != null) { + Iterator indexKeys = controlPointMap.keys(); + while (indexKeys.hasNext()) { + String indexKey = indexKeys.next(); + int index; + try { + index = Integer.parseInt(indexKey, 10); + } catch (NumberFormatException e) { + continue; + } + deserializeControlPoint(rel, index, + controlPointMap.getJSONObject(indexKey)); + } + } + + deserializeStyle(rel, relObject); + + return rel; + } + + private void deserializeControlPoint(IRelationship rel, int index, + JSONObject controlPointObject) { + boolean hasPosition = controlPointObject.has(ZenConstants.KEY_X) + || controlPointObject.has(ZenConstants.KEY_Y); + boolean hasAngle = controlPointObject.has(ZenConstants.KEY_ANGLE); + boolean hasAmount = controlPointObject.has(ZenConstants.KEY_AMOUNT); + if (!hasPosition && !hasAngle && !hasAmount) + return; + + IControlPoint controlPoint = rel.getControlPoint(index); + if (hasPosition) { + controlPoint.setPosition( + controlPointObject.optInt(ZenConstants.KEY_X, 0), + controlPointObject.optInt(ZenConstants.KEY_Y, 0)); + } + if (hasAngle) { + controlPoint.setPolarAngle( + controlPointObject.optDouble(ZenConstants.KEY_ANGLE, 0)); + } + if (hasAmount) { + controlPoint.setPolarAmount( + controlPointObject.optDouble(ZenConstants.KEY_AMOUNT, 0)); + } + } + + private void deserializeTopicExtension(ITopic topic, JSONObject extObject) { + String providerName = extObject.optString(ZenConstants.KEY_PROVIDER, + null); + Assert.isNotNull(providerName); + ITopicExtension ext = topic.createExtension(providerName); + + deserializeTopicExtensionElement(ext.getContent(), extObject); + + JSONArray resourceRefArray = extObject + .optJSONArray(ZenConstants.KEY_RESOURCE_REFS); + if (resourceRefArray != null) { + for (Object resourceRefArrayElement : resourceRefArray) { + if (resourceRefArrayElement instanceof String) { + String refURL = (String) resourceRefArrayElement; + if (HyperlinkUtils.isAttachmentURL(refURL)) { + ext.addResourceRef( + ext.getOwnedWorkbook().createResourceRef( + IResourceRef.FILE_ENTRY, HyperlinkUtils + .toAttachmentPath(refURL))); + } + } + } + } + } + + private void deserializeTopicExtensionElement(ITopicExtensionElement ele, + JSONObject eleObject) { + JSONObject attrMapObject = eleObject + .optJSONObject(ZenConstants.KEY_ATTRS); + if (attrMapObject != null) { + Iterator attrKeyIt = attrMapObject.keys(); + while (attrKeyIt.hasNext()) { + String attrKey = attrKeyIt.next(); + ele.setAttribute(attrKey, attrMapObject.getString(attrKey)); + } + } + + Object content = eleObject.opt(ZenConstants.KEY_CONTENT); + if (content instanceof String) { + ele.setTextContent((String) content); + } else if (content instanceof JSONArray) { + JSONArray childElementArray = (JSONArray) content; + for (Object childElementObject : childElementArray) { + if (childElementObject instanceof JSONObject) { + String childName = ((JSONObject) childElementObject) + .optString(ZenConstants.KEY_NAME, null); + Assert.isNotNull(childName); + deserializeTopicExtensionElement(ele.createChild(childName), + (JSONObject) childElementObject); + } + } + } else { + /// TODO bad file format + } + } + + private void deserializeStyle(IStyled styled, JSONObject sourceObject) { + JSONObject styleObject = sourceObject + .optJSONObject(ZenConstants.KEY_STYLE); + if (styleObject == null) + return; + + IStyle style = findOrCreateStyle(styleObject, IStyleSheet.NORMAL_STYLES, + styled.getStyleType()); + if (style == null) + return; + + styled.setStyleId(style.getId()); + } + + private IStyle findOrCreateStyle(JSONObject styleObject, String groupName, + String defaultType) { + String type = styleObject.optString(ZenConstants.KEY_TYPE, null); + if (type == null) { + type = defaultType; + } + if (type == null) { + return null; + } + + JSONObject propertiesObject = styleObject + .optJSONObject(ZenConstants.KEY_PROPERTIES); + if (propertiesObject == null) + return null; + + IStyle style = workbook.getStyleSheet().createStyle(type); + + Properties properties = new Properties(); + properties.setProperty("$__TYPE__$", type); //$NON-NLS-1$ + properties.setProperty("$__GROUP__$", groupName); //$NON-NLS-1$ + + Iterator keyIt = propertiesObject.keys(); + while (keyIt.hasNext()) { + String key = keyIt.next(); + String value = propertiesObject.getString(key); + style.setProperty(key, value); + properties.setProperty(key, value); + } + + IStyle createdStyle = styleTable.get(properties); + if (createdStyle != null) { + workbook.getAdapter(IStyleRefCounter.class) + .decreaseRef(style.getId()); + return createdStyle; + } + + styleTable.put(properties, style); + workbook.getStyleSheet().addStyle(style, groupName); + + return style; + } + + private void deserializeTheme(ISheet sheet, JSONObject sheetObject) { + JSONObject themeObject = sheetObject + .optJSONObject(ZenConstants.KEY_THEME); + if (themeObject == null) + return; + + IStyle theme = workbook.getStyleSheet().createStyle(IStyle.THEME); + + Properties properties = new Properties(); + properties.setProperty("$__TYPE__$", IStyle.THEME); //$NON-NLS-1$ + properties.setProperty("$__GROUP__$", IStyleSheet.MASTER_STYLES); //$NON-NLS-1$ + + Iterator keyIt = themeObject.keys(); + while (keyIt.hasNext()) { + String key = keyIt.next(); + JSONObject styleObject = themeObject.optJSONObject(key); + if (styleObject == null) + continue; + + IStyle style = findOrCreateStyle(styleObject, + IStyleSheet.AUTOMATIC_STYLES, null); + if (style == null) + continue; + + theme.setDefaultStyleId(key, style.getId()); + properties.setProperty(key, style.getId()); + } + + IStyle createdTheme = styleTable.get(properties); + if (createdTheme != null) { + workbook.getAdapter(IStyleRefCounter.class) + .decreaseRef(createdTheme.getId()); + theme = createdTheme; + } else { + styleTable.put(properties, theme); + workbook.getStyleSheet().addStyle(theme, IStyleSheet.MASTER_STYLES); + } + + sheet.setThemeId(theme.getId()); + } + + private String allocateMarkerResource(IMarkerSheet markerSheet, + String resourcePath) throws IOException { + IFileEntry fileEntry = workbook.getManifest() + .getFileEntry(resourcePath); + String fileName = resourcePath.substring(resourcePath.indexOf("/") + 1); //$NON-NLS-1$ + String newPath = markerSheet + .allocateMarkerResource(fileEntry.openInputStream(), fileName); + return newPath; + } + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/WorkbookDeserializer.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/WorkbookDeserializer.java new file mode 100644 index 000000000..a39d74eb2 --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/WorkbookDeserializer.java @@ -0,0 +1,36 @@ +package org.xmind.ui.internal.zen; + +import java.io.IOException; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.xmind.core.ISheet; +import org.xmind.core.IWorkbook; + +public class WorkbookDeserializer { + + public void deserialize(IWorkbook workbook, JSONArray workbookArray) + throws IOException { + + //deserialize sheets + SheetDeserializer sheetDeserializer = new SheetDeserializer(workbook); + for (int i = 0; i < workbookArray.length(); i++) { + JSONObject sheetObject = workbookArray.getJSONObject(i); + ISheet sheet = null; + if (i == 0) { + sheet = workbook.getPrimarySheet(); + } else { + sheet = (ISheet) workbook.createSheet(); + workbook.addSheet(sheet); + } + sheetDeserializer.deserialize(sheet, sheetObject); + } + + //deserialize extensions +// ExtensionsDeserializer extensionsDeserializer = new ExtensionsDeserializer(); +// IWorkbookExtensionManager extensionManager = (IWorkbookExtensionManager) workbook +// .getAdapter(IWorkbookExtensionManager.class); +// extensionsDeserializer.deserialize(extensionManager, workbookArray); + } + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ZenConstants.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ZenConstants.java new file mode 100644 index 000000000..efd1a98cb --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ZenConstants.java @@ -0,0 +1,114 @@ +package org.xmind.ui.internal.zen; + +public class ZenConstants { + + public static final String MANIFEST_JSON = "manifest.json"; //$NON-NLS-1$ + + public static final String META_JSON = "metadata.json"; //$NON-NLS-1$ + + public static final String CONTENT_JSON = "content.json"; //$NON-NLS-1$ + + public static final String PATH_RESOURCES = "resources/"; //$NON-NLS-1$ + + public static final String PATH_REVISIONS = "Revisions/"; //$NON-NLS-1$ + + public static final String PATH_THUMBNAILS = "Thumbnails/"; //$NON-NLS-1$ + + public static final String THUMBNAILS_PNG = PATH_THUMBNAILS + + "thumbnail.png"; //$NON-NLS-1$ + + // JSON Keys + public static final String KEY_ID = "id"; //$NON-NLS-1$ + public static final String KEY_NAME = "name"; //$NON-NLS-1$ + public static final String KEY_TITLE = "title"; //$NON-NLS-1$ + public static final String KEY_CREATION_TIME = "creationTime"; //$NON-NLS-1$ + public static final String KEY_TYPE = "type"; //$NON-NLS-1$ + + public static final String KEY_ALIGN = "align"; //$NON-NLS-1$ + public static final String KEY_AMOUNT = "amount"; //$NON-NLS-1$ + public static final String KEY_ANGLE = "angle"; //$NON-NLS-1$ + public static final String KEY_ATTRS = "attrs"; //$NON-NLS-1$ + public static final String KEY_AUTHOR = "author"; //$NON-NLS-1$ + public static final String KEY_BOUNDARIES = "boundaries"; //$NON-NLS-1$ + public static final String KEY_BRANCH = "branch"; //$NON-NLS-1$ + public static final String KEY_CHILDREN = "children"; //$NON-NLS-1$ + public static final String KEY_COMMENTS = "comments"; //$NON-NLS-1$ + public static final String KEY_CONTENT = "content"; //$NON-NLS-1$ + public static final String KEY_CONTROL_POINTS = "controlPoints"; //$NON-NLS-1$ + public static final String KEY_END1_ID = "end1Id"; //$NON-NLS-1$ + public static final String KEY_END2_ID = "end2Id"; //$NON-NLS-1$ + public static final String KEY_EXTENSIONS = "extensions"; //$NON-NLS-1$ + public static final String KEY_GROUPS = "groups"; //$NON-NLS-1$ + public static final String KEY_HEIGHT = "height"; //$NON-NLS-1$ + public static final String KEY_HREF = "href"; //$NON-NLS-1$ + public static final String KEY_HTML = "html"; //$NON-NLS-1$ + public static final String KEY_IMAGE = "image"; //$NON-NLS-1$ + public static final String KEY_LABELS = "labels"; //$NON-NLS-1$ + public static final String KEY_LEGEND = "legend"; //$NON-NLS-1$ + public static final String KEY_MARKER_ID = "markerId"; //$NON-NLS-1$ + public static final String KEY_MARKERS = "markers"; //$NON-NLS-1$ + public static final String KEY_NOTES = "notes"; //$NON-NLS-1$ + public static final String KEY_NUMBERING = "numbering"; //$NON-NLS-1$ + public static final String KEY_NUMBER_FORMAT = "numberFormat"; //$NON-NLS-1$ + public static final String KEY_NUMBER_DEPTH = "numberDepth"; //$NON-NLS-1$ + public static final String KEY_NUMBER_SEPARATOR = "numberSeparator"; //$NON-NLS-1$ + public static final String KEY_PARAGRAPHS = "paragraphs"; //$NON-NLS-1$ + public static final String KEY_PLAIN = "plain"; //$NON-NLS-1$ + public static final String KEY_POSITION = "position"; //$NON-NLS-1$ + public static final String KEY_PREFIX = "prefix"; //$NON-NLS-1$ + public static final String KEY_PREPENDING_NUMBERS = "prependingNumbers"; //$NON-NLS-1$ + public static final String KEY_PROPERTIES = "properties"; //$NON-NLS-1$ + public static final String KEY_PROVIDER = "provider"; //$NON-NLS-1$ + public static final String KEY_RANGE = "range"; //$NON-NLS-1$ + public static final String KEY_RELATIONSHIPS = "relationships"; //$NON-NLS-1$ + public static final String KEY_RESOURCE = "resource"; //$NON-NLS-1$ + public static final String KEY_RESOURCES = "resources"; //$NON-NLS-1$ + public static final String KEY_RESOURCE_REFS = "resourceRefs"; //$NON-NLS-1$ + public static final String KEY_ROOT_TOPIC = "rootTopic"; //$NON-NLS-1$ + public static final String KEY_SETTINGS = "settings"; //$NON-NLS-1$ + public static final String KEY_SPANS = "spans"; //$NON-NLS-1$ + public static final String KEY_SRC = "src"; //$NON-NLS-1$ + public static final String KEY_STRUCTURE_CLASS = "structureClass"; //$NON-NLS-1$ + public static final String KEY_STYLE = "style"; //$NON-NLS-1$ + public static final String KEY_SUFFIX = "suffix"; //$NON-NLS-1$ + public static final String KEY_SUMMARIES = "summaries"; //$NON-NLS-1$ + public static final String KEY_TEXT = "text"; //$NON-NLS-1$ + public static final String KEY_THEME = "theme"; //$NON-NLS-1$ + public static final String KEY_TITLE_WIDTH = "width"; //$NON-NLS-1$ + public static final String KEY_TOPIC_ID = "topicId"; //$NON-NLS-1$ + public static final String KEY_USER_NAME = "userName"; //$NON-NLS-1$ + public static final String KEY_VISIBILITY = "visibility"; //$NON-NLS-1$ + public static final String KEY_WIDTH = "width"; //$NON-NLS-1$ + public static final String KEY_X = "x"; //$NON-NLS-1$ + public static final String KEY_Y = "y"; //$NON-NLS-1$ + + // JSON Values + public static final String VAL_FOLDED = "folded"; //$NON-NLS-1$ + public static final String VAL_NONE = "none"; //$NON-NLS-1$ + public static final String VAL_VISIBLE = "visible"; //$NON-NLS-1$ + + // meta keys + public static final String KEY_CREATE = "Create"; //$NON-NLS-1$ + public static final String KEY_TIME = "Time"; //$NON-NLS-1$ + public static final String KEY_CREATOR = "Creator"; //$NON-NLS-1$ + public static final String KEY_VERSION = "Version"; //$NON-NLS-1$ + public static final String KEY_THUMBNAIL = "Thumbnail"; //$NON-NLS-1$ + public static final String KEY_ORIGIN = "Origin"; //$NON-NLS-1$ + public static final String KEY_BACKGROUND_COLOR = "BackgroundColor"; //$NON-NLS-1$ + public static final String KEY_META_AUTHOR = "Author"; //$NON-NLS-1$ + public static final String KEY_META_NAME = "Name"; //$NON-NLS-1$ + public static final String KEY_META_X = "X"; //$NON-NLS-1$ + public static final String KEY_META_Y = "Y"; //$NON-NLS-1$ + + // manifest keys + public static final String KEY_FILE_ENTRIES = "file-entries"; //$NON-NLS-1$ + public static final String KEY_ENCRYPTION_DATA = "encryption-data"; //$NON-NLS-1$ + public static final String KEY_ITERATION_COUNT = "iteration-count"; //$NON-NLS-1$ + public static final String KEY_ALGORITHM_NAME = "algorithm-name"; //$NON-NLS-1$ + public static final String KEY_DERIVATION_NAME = "key-derivation-name"; //$NON-NLS-1$ + public static final String KEY_SIZE = "size"; //$NON-NLS-1$ + public static final String KEY_SALT = "salt"; //$NON-NLS-1$ + public static final String KEY_IV = "iv"; //$NON-NLS-1$ + public static final String KEY_PASSWORD_HINT = "password-hint"; //$NON-NLS-1$ + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ZenDeserializer.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ZenDeserializer.java new file mode 100644 index 000000000..e8b98e79b --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/internal/zen/ZenDeserializer.java @@ -0,0 +1,421 @@ +/* ****************************************************************************** + * Copyright (c) 2006-2016 XMind Ltd. and others. + * + * This file is a part of XMind 3. XMind releases 3 and + * above are dual-licensed under the Eclipse Public License (EPL), + * which is available at http://www.eclipse.org/legal/epl-v10.html + * and the GNU Lesser General Public License (LGPL), + * which is available at http://www.gnu.org/licenses/lgpl.html + * See http://www.xmind.net/license.html for details. + * + * Contributors: + * XMind Ltd. - initial API and implementation + *******************************************************************************/ +/** + * + */ +package org.xmind.ui.internal.zen; + +import java.io.BufferedReader; +import java.io.File; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.util.HashMap; +import java.util.Map; +import java.util.zip.ZipInputStream; + +import org.json.JSONArray; +import org.json.JSONObject; +import org.xmind.core.Core; +import org.xmind.core.CoreException; +import org.xmind.core.IDeserializer; +import org.xmind.core.IFileEntry; +import org.xmind.core.IManifest; +import org.xmind.core.ISheet; +import org.xmind.core.IWorkbook; +import org.xmind.core.internal.AbstractSerializingBase; +import org.xmind.core.internal.dom.ManifestImpl; +import org.xmind.core.internal.dom.SheetImpl; +import org.xmind.core.internal.dom.WorkbookImpl; +import org.xmind.core.io.CoreIOException; +import org.xmind.core.io.IInputSource; +import org.xmind.core.io.IStorage; +import org.xmind.core.io.InvalidChecksumException; +import org.xmind.core.util.DOMUtils; +import org.xmind.core.util.FileUtils; +import org.xmind.core.util.IProgressReporter; + +public class ZenDeserializer extends AbstractSerializingBase + implements IDeserializer { + + private IWorkbook workbook; + + private IStorage storage; + + private IInputSource inputSource; + + private InputStream inputStream; + + private boolean usesWorkbookStorageAsInputSource; + + private IManifest manifest; + + private final Map loadedJsons; + + private final Map loadedJsonArrays; + + public ZenDeserializer(IStorage storage) { + this.workbook = new WorkbookImpl(DOMUtils.createDocument(), storage); + this.storage = storage; + this.inputSource = null; + this.inputStream = null; + this.usesWorkbookStorageAsInputSource = false; + this.manifest = null; + this.loadedJsons = new HashMap(); + this.loadedJsonArrays = new HashMap(); + } + + /* + * (non-Javadoc) + * @see org.xmind.core.IDeserializer#getWorkbook() + */ + public IWorkbook getWorkbook() { + return workbook; + } + + /* + * (non-Javadoc) + * @see org.xmind.core.IDeserializer#setWorkbookStorage(org.xmind.core.io. + * IStorage) + */ + public void setWorkbookStorage(IStorage storage) { + if (storage == null) + throw new IllegalArgumentException("storage is null"); //$NON-NLS-1$ + this.storage = storage; + } + + /* + * (non-Javadoc) + * @see org.xmind.core.IDeserializer#getWorkbookStorage() + */ + public IStorage getWorkbookStorage() { + return this.storage; + } + + /* + * (non-Javadoc) + * @see org.xmind.core.IDeserializer#setInputSource(org.xmind.core.io. + * IInputSource) + */ + public void setInputSource(IInputSource source) { + if (source == null) + throw new IllegalArgumentException("input source is null"); //$NON-NLS-1$ + this.inputSource = source; + this.inputStream = null; + this.usesWorkbookStorageAsInputSource = false; + } + + /* + * (non-Javadoc) + * @see org.xmind.core.IDeserializer#setInputStream(java.io.InputStream) + */ + public void setInputStream(InputStream stream) { + if (stream == null) + throw new IllegalArgumentException("input stream is null"); //$NON-NLS-1$ + this.inputStream = stream; + this.inputSource = null; + this.usesWorkbookStorageAsInputSource = false; + } + + /* + * (non-Javadoc) + * @see org.xmind.core.IDeserializer#setWorkbookStorageAsInputSource() + */ + public void setWorkbookStorageAsInputSource() { + this.usesWorkbookStorageAsInputSource = true; + this.inputSource = null; + this.inputStream = null; + } + + /* + * (non-Javadoc) + * @see org.xmind.core.IDeserializer#hasInputSource() + */ + public boolean hasInputSource() { + return inputSource != null || inputStream != null + || usesWorkbookStorageAsInputSource; + } + + public IManifest getManifest() { + return manifest; + } + + /* + * (non-Javadoc) + * @see org.xmind.core.IDeserializer#deserialize(org.xmind.core.util. + * IProgressReporter) + */ + public void deserialize(IProgressReporter reporter) + throws IOException, CoreException, IllegalStateException { + if (manifest == null) + deserializeManifest(reporter); + + try { + loadWorkbook(); + purgeStorage(); + } catch (InvalidChecksumException e) { + throw new CoreException(Core.ERROR_WRONG_PASSWORD, e); + } catch (CoreIOException e) { + CoreException ce = e.getCoreException(); + throw new CoreException(ce.getType(), ce.getCodeInfo(), e); + } + } + + public void deserializeManifest(IProgressReporter reporter) + throws IOException, CoreException, IllegalStateException { + if (inputStream != null) { + ZipInputStream zin = new ZipInputStream(inputStream); + try { + FileUtils.extractZipFile(zin, storage.getOutputTarget()); + } finally { + zin.close(); + } + } else if (inputSource != null) { + FileUtils.transfer(inputSource, storage.getOutputTarget()); + } else if (!usesWorkbookStorageAsInputSource) { + throw new IllegalStateException("no input source available"); //$NON-NLS-1$ + } + + /// load manifest.json + JSONObject manifestJson = forceLoadJsonFromEntry( + ZenConstants.MANIFEST_JSON); + this.manifest = workbook.getManifest(); + new ManifestDeserializer().deserialize(manifest, manifestJson); + ((ManifestImpl) manifest) + .setStreamNormalizer(getEntryStreamNormalizer()); + } + + private void loadWorkbook() throws IOException, CoreException { + /// load content.json + JSONArray contentArray = forceLoadJsonArrayFromEntry( + ZenConstants.CONTENT_JSON); + new WorkbookDeserializer().deserialize(workbook, contentArray); + + //load meta.json +// IMeta meta = workbook.getMeta(); +// JSONObject metaJson = forceLoadJsonFromEntry(ZenConstants.META_JSON); +// new MetaDeserializer().deserialize(meta, metaJson); +// +// if (meta.getValue(IMeta.CREATED_TIME) == null) { +// meta.setValue(IMeta.CREATED_TIME, +// NumberUtils.formatDate(System.currentTimeMillis())); +// } +// meta.setValue(IMeta.CREATOR_NAME, getCreatorName()); +// meta.setValue(IMeta.CREATOR_VERSION, getCreatorVersion()); + + /// initialize workbook content + for (ISheet sheet : workbook.getSheets()) { + ((SheetImpl) sheet).addNotify((WorkbookImpl) workbook); + } + } + + private JSONObject forceLoadJsonFromEntry(String entryPath) + throws CoreException { + JSONObject json; + try { + json = loadJsonFromEntry(entryPath); + } catch (IOException e) { + json = null; + } + + if (json == null) { + json = new JSONObject(); + loadedJsons.put(entryPath, json); + } + return json; + } + + private JSONObject loadJsonFromEntry(String entryPath) + throws IOException, CoreException { + JSONObject cache = loadedJsons.get(entryPath); + if (cache != null) + return cache; + + InputStream stream = openEntryInputStream(entryPath); + if (stream == null) + return null; + + JSONObject json; + try { + json = loadJsonFromStream(stream); + } catch (IOException e) { + if (hasEncryptionData(entryPath)) { + throw new CoreException(Core.ERROR_WRONG_PASSWORD, e); + } + throw e; + } catch (RuntimeException e) { + /// catching any runtime exception during json parsing + if (hasEncryptionData(entryPath)) { + throw new CoreException(Core.ERROR_WRONG_PASSWORD, e); + } + throw e; + } catch (Error e) { + /// catching any error during json parsing + if (hasEncryptionData(entryPath)) { + throw new CoreException(Core.ERROR_WRONG_PASSWORD, e); + } + throw e; + } finally { + if (stream != null) + stream.close(); + } + + if (json != null) { + loadedJsons.put(entryPath, json); + } + return json; + } + + private InputStream openEntryInputStream(String entryPath) + throws IOException, CoreException { + if (manifest == null && storage == null) + throw new IllegalStateException( + "No manifest or input source available"); //$NON-NLS-1$ + + if (manifest != null) { + IFileEntry entry = manifest.getFileEntry(entryPath); + if (entry != null) { + if (!entry.canRead()) + return null; + return entry.openInputStream(); + } + } + + if (storage != null) { + IInputSource source = storage.getInputSource(); + if (source != null && source.hasEntry(entryPath) + && source.isEntryAvailable(entryPath)) { + return source.openEntryStream(entryPath); + } + } + + return null; + } + + private JSONObject loadJsonFromStream(InputStream stream) + throws IOException { + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(stream, "utf-8")); //$NON-NLS-1$ + StringBuilder sb = new StringBuilder(); + String read; + while ((read = reader.readLine()) != null) { + sb.append(read).append('\n'); + } + + JSONObject json = new JSONObject(sb.toString()); + return json; + } finally { + reader.close(); + } + } + + private boolean hasEncryptionData(String entryPath) { + if (manifest != null) { + IFileEntry entry = manifest.getFileEntry(entryPath); + return entry != null && entry.getEncryptionData() != null; + } + return false; + } + + /// load json array + private JSONArray forceLoadJsonArrayFromEntry(String entryPath) + throws CoreException { + JSONArray json; + try { + json = loadJsonArrayFromEntry(entryPath); + } catch (IOException e) { + json = null; + } + + if (json == null) { + json = new JSONArray(); + loadedJsonArrays.put(entryPath, json); + } + return json; + } + + private JSONArray loadJsonArrayFromEntry(String entryPath) + throws IOException, CoreException { + JSONArray cache = loadedJsonArrays.get(entryPath); + if (cache != null) + return cache; + + InputStream stream = openEntryInputStream(entryPath); + if (stream == null) + return null; + + JSONArray json; + try { + json = loadJsonArrayFromStream(stream); + } catch (IOException e) { + if (hasEncryptionData(entryPath)) { + throw new CoreException(Core.ERROR_WRONG_PASSWORD, e); + } + throw e; + } catch (RuntimeException e) { + /// catching any runtime exception during json parsing + if (hasEncryptionData(entryPath)) { + throw new CoreException(Core.ERROR_WRONG_PASSWORD, e); + } + throw e; + } catch (Error e) { + /// catching any error during json parsing + if (hasEncryptionData(entryPath)) { + throw new CoreException(Core.ERROR_WRONG_PASSWORD, e); + } + throw e; + } finally { + if (stream != null) + stream.close(); + } + + if (json != null) { + loadedJsonArrays.put(entryPath, json); + } + return json; + } + + private JSONArray loadJsonArrayFromStream(InputStream stream) + throws IOException { + BufferedReader reader = null; + try { + reader = new BufferedReader(new InputStreamReader(stream, "utf-8")); //$NON-NLS-1$ + StringBuilder sb = new StringBuilder(); + String read; + while ((read = reader.readLine()) != null) { + sb.append(read).append('\n'); + } + + JSONArray json = new JSONArray(sb.toString()); + return json; + } finally { + reader.close(); + } + } + + // only delete top-level's *.json files. + private void purgeStorage() { + String rootPath = storage.getFullPath(); + File[] children = new File(rootPath).listFiles(); + if (children != null) { + for (File child : children) { + if (child.getName().endsWith(".json")) { //$NON-NLS-1$ + child.delete(); + } + } + } + } + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/AbstractInfoItemContributor.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/AbstractInfoItemContributor.java index 86e86867b..e918207ef 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/AbstractInfoItemContributor.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/AbstractInfoItemContributor.java @@ -15,8 +15,8 @@ import org.xmind.ui.style.Styles; import org.xmind.ui.util.MindMapUtils; -public abstract class AbstractInfoItemContributor implements - IInfoItemContributor { +public abstract class AbstractInfoItemContributor + implements IInfoItemContributor { private static final String CACHE_INFORITEM_EVENT_REG = "org.xmind.ui.cache.inforItem.eventReg"; //$NON-NLS-1$ @@ -29,6 +29,11 @@ public AbstractInfoItemContributor() { NUMBER++; } + public boolean isModified(ITopicPart topicPart, ITopic topic, + IAction action) { + return true; + } + public void fillContextMenu(IInfoItemPart part) { } @@ -127,7 +132,8 @@ public void topicDeactivated(ITopicPart topicPart) { protected abstract void registerTopicEvent(ITopicPart topicPart, ITopic topic, ICoreEventRegister register); - protected abstract void handleTopicEvent(IInfoPart infoPart, CoreEvent event); + protected abstract void handleTopicEvent(IInfoPart infoPart, + CoreEvent event); protected abstract void handleTopicEvent(ITopicPart topicPart, CoreEvent event); diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IHyperlinked.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IHyperlinked.java new file mode 100644 index 000000000..99e43666a --- /dev/null +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IHyperlinked.java @@ -0,0 +1,7 @@ +package org.xmind.ui.mindmap; + +public interface IHyperlinked { + + String getHyperlink(); + +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IIconTipPart.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IIconTipPart.java index 574a5d3d3..4d9c6edc0 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IIconTipPart.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IIconTipPart.java @@ -18,6 +18,7 @@ import org.eclipse.swt.graphics.Image; import org.xmind.core.ITopic; import org.xmind.gef.part.IGraphicalPart; +import org.xmind.ui.internal.svgsupport.SVGImageData; public interface IIconTipPart extends IGraphicalPart { @@ -27,8 +28,10 @@ public interface IIconTipPart extends IGraphicalPart { Image getImage(); + SVGImageData getSVGData(); + IAction getAction(); IMenuManager getPopupMenu(); -} \ No newline at end of file +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IInfoItemContributor.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IInfoItemContributor.java index b3943a20d..3f8f20c2e 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IInfoItemContributor.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IInfoItemContributor.java @@ -9,6 +9,8 @@ public interface IInfoItemContributor { IAction createAction(ITopicPart topicPart, ITopic topic); + boolean isModified(ITopicPart topicPart, ITopic topic, IAction action); + String getContent(ITopic topic); String getId(); @@ -19,6 +21,8 @@ public interface IInfoItemContributor { String getCardLabel(); + String getSVGFilePath(ITopic topic, IAction action); + boolean isCardModeAvailable(ITopic topic, ITopicPart topicPart); void fillContextMenu(IInfoItemPart part); diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IInfoItemPart.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IInfoItemPart.java index f478d79aa..1b2cb268e 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IInfoItemPart.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/mindmap/IInfoItemPart.java @@ -18,6 +18,7 @@ import org.eclipse.swt.graphics.Image; import org.xmind.core.ITopic; import org.xmind.gef.part.IGraphicalPart; +import org.xmind.ui.internal.svgsupport.SVGImageData; public interface IInfoItemPart extends IGraphicalPart { @@ -29,8 +30,10 @@ public interface IInfoItemPart extends IGraphicalPart { Image getImage(); + SVGImageData getSVGData(); + IAction getAction(); IMenuManager getPopupMenu(); -} \ No newline at end of file +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/AbstractMindMapExportWizard.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/AbstractMindMapExportWizard.java index 9a7dd95fa..e483dfbc0 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/AbstractMindMapExportWizard.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/AbstractMindMapExportWizard.java @@ -14,6 +14,7 @@ package org.xmind.ui.wizards; import java.io.File; +import java.io.FileNotFoundException; import java.io.InterruptedIOException; import java.io.OutputStream; import java.lang.reflect.InvocationTargetException; @@ -44,6 +45,8 @@ public abstract class AbstractMindMapExportWizard extends AbstractExportWizard { + private static final int MAX_FILE_NAME_LENGTH = 120; + private IGraphicalEditor sourceEditor; private IGraphicalEditorPage sourcePage; @@ -132,6 +135,7 @@ public boolean performFinish() { WizardMessages.Export_UncompatibleFormat_title, messages)) return false; } + setTargetPath(trimPath(getTargetPath())); if (!isOverwriteWithoutPrompt() && new File(getTargetPath()).exists()) { if (!DialogUtils.confirmOverwrite(getShell(), getTargetPath())) @@ -163,6 +167,17 @@ private boolean isLegalPath(String targetPath) { return isLagel; } + private String trimPath(String path) { + String dirPath = path.substring(0, + path.lastIndexOf(File.separator) + 1); + String fileName = FileUtils.getNoExtensionFileName(path); + + if (fileName.length() > MAX_FILE_NAME_LENGTH) { + fileName = fileName.substring(0, MAX_FILE_NAME_LENGTH); + } + return dirPath + fileName + FileUtils.getExtension(path); + } + protected boolean doExport() { final Display display = Display.getCurrent(); final Shell parentShell = findParentShell(display); @@ -210,6 +225,13 @@ public void run() { protected void handleExportException(Throwable e) { Logger.log(e, NLS.bind(WizardMessages.Export_FailedWhenExport, getFormatName())); + e.printStackTrace(); + + if (e instanceof FileNotFoundException) { + MessageDialog.openInformation(getShell(), + WizardMessages.ExportPage_FindFileFail_title, + WizardMessages.ExportPage_FindFileFail_message); + } } private Shell findParentShell(Display display) { @@ -286,6 +308,10 @@ protected String getSuggestedFileName() { return WizardMessages.ExportWizard_SuggestedFileName; String fileName = mindMap.getCentralTopic().getTitleText(); String replacedFileName = MindMapUtils.trimFileName(fileName); + if (replacedFileName.length() > MAX_FILE_NAME_LENGTH) { + replacedFileName = replacedFileName.substring(0, + MAX_FILE_NAME_LENGTH); + } return replacedFileName; } diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/DocumentExportPageBase.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/DocumentExportPageBase.java index 97ef7c2d5..609801cd3 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/DocumentExportPageBase.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/DocumentExportPageBase.java @@ -52,6 +52,7 @@ import org.xmind.core.IWorkbook; import org.xmind.core.marker.IMarker; import org.xmind.core.marker.IMarkerRef; +import org.xmind.core.net.util.LinkUtils; import org.xmind.gef.GraphicalViewer; import org.xmind.gef.IGraphicalViewer; import org.xmind.gef.draw2d.AdvancedToolbarLayout; @@ -79,7 +80,6 @@ * Export wizard page for exporting documents with mixed text and graphics. * * @author MANGOSOFT - * */ public abstract class DocumentExportPageBase extends AbstractMindMapExportPage { @@ -1030,7 +1030,7 @@ protected ISheet createSampleSheet() { mainTopic.setLabels( Arrays.asList(WizardMessages.DocumentExportPage_Sample_Label1, WizardMessages.DocumentExportPage_Sample_Label2)); - mainTopic.setHyperlink("http://www.xmind.net"); //$NON-NLS-1$ + mainTopic.setHyperlink(LinkUtils.getHostByLanguage(true, false)); mainTopic.getImage().setSource("temp.png"); //$NON-NLS-1$ INotesContent notesContent = workbook.createNotesContent(INotes.PLAIN); ((IPlainNotesContent) notesContent).setTextContent(getSampleNotes()); @@ -1088,4 +1088,4 @@ private static final String getDefaultLabel(String propertyName) { return WizardMessages.DocumentExportPage_IncludeAttachments; return ""; //$NON-NLS-1$ } -} \ No newline at end of file +} diff --git a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/MindMapImporter.java b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/MindMapImporter.java index 9fea4cdf4..6e106ff4d 100644 --- a/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/MindMapImporter.java +++ b/bundles/org.xmind.ui.mindmap/src/org/xmind/ui/wizards/MindMapImporter.java @@ -93,12 +93,16 @@ protected void postBuilded() { private void initStyles() { for (ISheet sheet : getTargetWorkbook().getSheets()) { - sheet.setThemeId(createAppliedTheme(getTargetWorkbook(), - MindMapUI.getResourceManager().getDefaultTheme()).getId()); - - List topics = MindMapUtils.getAllTopics(sheet, true, true); - for (ITopic topic : topics) { - topic.setStyleId(null); + IStyle appliedTheme = createAppliedTheme(getTargetWorkbook(), + MindMapUI.getResourceManager().getDefaultTheme()); + if (appliedTheme != null) { + sheet.setThemeId(appliedTheme.getId()); + + List topics = MindMapUtils.getAllTopics(sheet, true, + true); + for (ITopic topic : topics) { + topic.setStyleId(null); + } } } } diff --git a/bundles/org.xmind.ui.resources/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.resources/META-INF/MANIFEST.MF index ad241ac4a..5bd16d10e 100644 --- a/bundles/org.xmind.ui.resources/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.resources/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.resources;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: %providerName Fragment-Host: org.xmind.ui Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/bundles/org.xmind.ui.resources/pom.xml b/bundles/org.xmind.ui.resources/pom.xml index 99372a712..778f01419 100644 --- a/bundles/org.xmind.ui.resources/pom.xml +++ b/bundles/org.xmind.ui.resources/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.resources - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.spelling/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.spelling/META-INF/MANIFEST.MF index e93fdbf6a..0262f947e 100644 --- a/bundles/org.xmind.ui.spelling/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.spelling/META-INF/MANIFEST.MF @@ -2,15 +2,15 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.spelling;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.internal.spelling.SpellingPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, net.sourceforge.jazzy, - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.browser;bundle-version="[3.7.2,3.8.0)", - org.xmind.core.usagedata;bundle-version="[3.7.2,3.8.0)" + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.browser;bundle-version="[3.7.3,3.8.0)", + org.xmind.core.usagedata;bundle-version="[3.7.3,3.8.0)" Bundle-RequiredExecutionEnvironment: J2SE-1.5 Bundle-ActivationPolicy: lazy Export-Package: org.xmind.ui, diff --git a/bundles/org.xmind.ui.spelling/pom.xml b/bundles/org.xmind.ui.spelling/pom.xml index bd326dda9..8ce7876d4 100644 --- a/bundles/org.xmind.ui.spelling/pom.xml +++ b/bundles/org.xmind.ui.spelling/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.spelling - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.spreadsheet/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.spreadsheet/META-INF/MANIFEST.MF index b87106e00..41f5b205b 100644 --- a/bundles/org.xmind.ui.spreadsheet/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.spreadsheet/META-INF/MANIFEST.MF @@ -2,12 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.spreadsheet;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.internal.spreadsheet.SpreadsheetUIPlugin Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, - org.xmind.ui;bundle-version="[3.7.2,3.8.0)", - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)", + org.xmind.ui;bundle-version="[3.7.3,3.8.0)", + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)", org.xmind.core.runtime, org.xmind.core.usagedata Eclipse-LazyStart: true diff --git a/bundles/org.xmind.ui.spreadsheet/icons/add_column.svg b/bundles/org.xmind.ui.spreadsheet/icons/add_column.svg new file mode 100644 index 000000000..5180fda9f --- /dev/null +++ b/bundles/org.xmind.ui.spreadsheet/icons/add_column.svg @@ -0,0 +1,32 @@ + + + + add column + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.spreadsheet/icons/add_row.svg b/bundles/org.xmind.ui.spreadsheet/icons/add_row.svg new file mode 100644 index 000000000..9ecdbc469 --- /dev/null +++ b/bundles/org.xmind.ui.spreadsheet/icons/add_row.svg @@ -0,0 +1,32 @@ + + + + add row + Created with Sketch. + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/bundles/org.xmind.ui.spreadsheet/pom.xml b/bundles/org.xmind.ui.spreadsheet/pom.xml index 8e6246b14..7fc5ae513 100644 --- a/bundles/org.xmind.ui.spreadsheet/pom.xml +++ b/bundles/org.xmind.ui.spreadsheet/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.spreadsheet - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.spreadsheet/src/org/xmind/ui/internal/spreadsheet/AddColumnInfoItemContributor.java b/bundles/org.xmind.ui.spreadsheet/src/org/xmind/ui/internal/spreadsheet/AddColumnInfoItemContributor.java index c8b06501f..a67659755 100644 --- a/bundles/org.xmind.ui.spreadsheet/src/org/xmind/ui/internal/spreadsheet/AddColumnInfoItemContributor.java +++ b/bundles/org.xmind.ui.spreadsheet/src/org/xmind/ui/internal/spreadsheet/AddColumnInfoItemContributor.java @@ -157,6 +157,10 @@ public IAction createAction(ITopicPart topicPart, ITopic topic) { return null; } + public String getSVGFilePath(ITopic topic, IAction action) { + return "platform:/plugin/org.xmind.ui.spreadsheet/icons/add_column.svg"; //$NON-NLS-1$ + } + private boolean isStructureAlgorithmId(IBranchPart branch, String expectedValue) { String id = (String) MindMapUtils.getCache(branch, diff --git a/bundles/org.xmind.ui.spreadsheet/src/org/xmind/ui/internal/spreadsheet/AddRowInfoItemContributor.java b/bundles/org.xmind.ui.spreadsheet/src/org/xmind/ui/internal/spreadsheet/AddRowInfoItemContributor.java index 123751d0e..0770e72ab 100644 --- a/bundles/org.xmind.ui.spreadsheet/src/org/xmind/ui/internal/spreadsheet/AddRowInfoItemContributor.java +++ b/bundles/org.xmind.ui.spreadsheet/src/org/xmind/ui/internal/spreadsheet/AddRowInfoItemContributor.java @@ -153,6 +153,10 @@ public IAction createAction(ITopicPart topicPart, ITopic topic) { return null; } + public String getSVGFilePath(ITopic topic, IAction action) { + return "platform:/plugin/org.xmind.ui.spreadsheet/icons/add_row.svg"; //$NON-NLS-1$ + } + private boolean isStructureAlgorithmId(IBranchPart branch, String expectedValue) { String id = (String) MindMapUtils.getCache(branch, diff --git a/bundles/org.xmind.ui.toolkit/META-INF/MANIFEST.MF b/bundles/org.xmind.ui.toolkit/META-INF/MANIFEST.MF index 6b93c9dc9..b8b1db57f 100644 --- a/bundles/org.xmind.ui.toolkit/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui.toolkit/META-INF/MANIFEST.MF @@ -2,7 +2,7 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui.toolkit;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.internal.ToolkitPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui;visibility:=reexport, diff --git a/bundles/org.xmind.ui.toolkit/pom.xml b/bundles/org.xmind.ui.toolkit/pom.xml index a305fc5ad..285357b62 100644 --- a/bundles/org.xmind.ui.toolkit/pom.xml +++ b/bundles/org.xmind.ui.toolkit/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui.toolkit - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/internal/statushandlers/RuntimeErrorDialog.java b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/internal/statushandlers/RuntimeErrorDialog.java index d843d65d4..a6ce231dc 100644 --- a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/internal/statushandlers/RuntimeErrorDialog.java +++ b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/internal/statushandlers/RuntimeErrorDialog.java @@ -20,6 +20,7 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Label; import org.eclipse.swt.widgets.Shell; import org.eclipse.swt.widgets.Text; @@ -41,7 +42,7 @@ public class RuntimeErrorDialog extends Dialog { public RuntimeErrorDialog(int style, StatusAdapter statusAdapter, String dialogTitle, IErrorReporter reporter) { - super((Shell) null); + super(Display.getDefault().getActiveShell()); this.details = new StatusDetails(statusAdapter); this.dialogTitle = dialogTitle; this.reporter = reporter == null ? DefaultErrorReporter.getInstance() diff --git a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/io/DownloadJob.java b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/io/DownloadJob.java index 4e42b17e7..91cc16c0f 100644 --- a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/io/DownloadJob.java +++ b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/io/DownloadJob.java @@ -17,6 +17,7 @@ import java.io.InputStream; import java.io.InterruptedIOException; import java.io.OutputStream; +import java.net.HttpURLConnection; import java.net.URL; import java.net.URLConnection; @@ -35,7 +36,6 @@ * location. * * @author Frank Shaka - * */ public class DownloadJob extends Job { @@ -119,7 +119,6 @@ protected IStatus validateConnection(URLConnection connection) { /** * Executes this download job. - * *

* This implementation delegates the actual download job to * {@link #runSafely(IProgressMonitor)} and interprets its exceptions to @@ -168,17 +167,34 @@ private IStatus runSafely(IProgressMonitor monitor) throws Exception { URL url = new URL(sourceURL); URLConnection connection = url.openConnection(); - setURLConnection(connection); - if (monitor.isCanceled()) - return cancelStatus(); - setupConnection(connection); - if (monitor.isCanceled()) - return cancelStatus(); + while (true) { + setURLConnection(connection); + if (monitor.isCanceled()) + return cancelStatus(); - connection.connect(); - if (monitor.isCanceled()) - return cancelStatus(); + setupConnection(connection); + if (monitor.isCanceled()) + return cancelStatus(); + + connection.connect(); + if (monitor.isCanceled()) + return cancelStatus(); + + /// auto redirect + int responseCode = ((HttpURLConnection) connection) + .getResponseCode(); + if (responseCode == HttpURLConnection.HTTP_MOVED_PERM + || responseCode == HttpURLConnection.HTTP_MOVED_TEMP) { + String newLocation = connection.getHeaderField("Location"); //$NON-NLS-1$ + connection = new URL(newLocation).openConnection(); + + if (monitor.isCanceled()) + return cancelStatus(); + } else { + break; + } + } IStatus consumed = validateConnection(connection); if (consumed != null) @@ -312,4 +328,4 @@ protected void canceling() { } } -} \ No newline at end of file +} diff --git a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/io/WebImageManager.java b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/io/WebImageManager.java index e7ee04a02..cf34aa715 100644 --- a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/io/WebImageManager.java +++ b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/io/WebImageManager.java @@ -16,6 +16,7 @@ import org.eclipse.core.runtime.Status; import org.eclipse.core.runtime.jobs.Job; import org.xmind.ui.internal.ToolkitPlugin; +import org.xmind.ui.util.JobPool; /** * @author Shawn Liu @@ -50,7 +51,7 @@ public static interface WebImageCallback { private WebImageManager() { } - public void requestWebImage(final String imageUrl, + public void requestWebImage(final String imageUrl, JobPool jobPool, final WebImageCallback callback) { if (callback == null) { return; @@ -78,7 +79,12 @@ protected IStatus run(IProgressMonitor monitor) { job.setSystem(true); job.setUser(false); - job.schedule(); + + if (jobPool != null) { + jobPool.scheduleJob(job, null); + } else { + job.schedule(); + } } private String createWebImageFile(String imageUrl) { diff --git a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/properties/PropertiesEditor.java b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/properties/PropertiesEditor.java index 46f7afe12..3a600bb42 100644 --- a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/properties/PropertiesEditor.java +++ b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/properties/PropertiesEditor.java @@ -25,6 +25,7 @@ import org.eclipse.jface.resource.JFaceResources; import org.eclipse.jface.util.IPropertyChangeListener; import org.eclipse.jface.util.PropertyChangeEvent; +import org.eclipse.jface.util.Util; import org.eclipse.jface.viewers.IInputSelectionProvider; import org.eclipse.jface.viewers.ISelection; import org.eclipse.jface.viewers.ISelectionChangedListener; @@ -38,10 +39,13 @@ import org.eclipse.swt.events.DisposeListener; import org.eclipse.swt.graphics.Color; import org.eclipse.swt.graphics.Font; +import org.eclipse.swt.graphics.Point; import org.eclipse.swt.layout.GridData; import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Control; +import org.eclipse.swt.widgets.Event; +import org.eclipse.swt.widgets.Listener; import org.eclipse.swt.widgets.Menu; import org.xmind.ui.util.Chainability; import org.xmind.ui.util.IChained; @@ -64,8 +68,8 @@ public class PropertiesEditor implements IInputSelectionProvider { public static final String FONT_ENTRY_SELECTED = "org.xmind.ui.font.PropertiesEditor.entry.selected"; //$NON-NLS-1$ - private static final class Section implements PropertyChangeListener, - IChained

{ + private static final class Section + implements PropertyChangeListener, IChained
{ private final PropertiesEditor editor; @@ -132,8 +136,8 @@ public Iterator entries() { } public void propertyChange(java.beans.PropertyChangeEvent evt) { - if (PropertyEditingSection.PROP_EXPANDED.equals(evt - .getPropertyName())) { + if (PropertyEditingSection.PROP_EXPANDED + .equals(evt.getPropertyName())) { editor.reflow(); } } @@ -207,7 +211,8 @@ public ISelection getSelection() { public void setSelection(ISelection selection) { } - public void addSelectionChangedListener(ISelectionChangedListener listener) { + public void addSelectionChangedListener( + ISelectionChangedListener listener) { listeners.add(listener); } @@ -223,6 +228,7 @@ public void create(Composite parent) { container.setExpandVertical(true); container.setMinWidth(200); container.setMinHeight(40); + addHorizontalScrollSupport(container); container.addControlListener(new ControlListener() { public void controlResized(ControlEvent e) { @@ -247,6 +253,24 @@ public void controlMoved(ControlEvent e) { refresh(); } + // add horizontal scroll support for windows + private void addHorizontalScrollSupport(final ScrolledComposite sc) { + if (Util.isWindows()) { + sc.addListener(SWT.MouseHorizontalWheel, new Listener() { + + public void handleEvent(Event event) { + if (!sc.isDisposed()) { + int offset = event.count; + offset = -(int) (Math.sqrt(Math.abs(offset)) * offset); + + Point origin = sc.getOrigin(); + sc.setOrigin(origin.x + offset, origin.y); + } + } + }); + } + } + public void setColorFontOverrides(String id, String overridedId) { if (overridedId == null) { colorFontOverrides.remove(id); @@ -272,10 +296,11 @@ public void propertyChange(PropertyChangeEvent event) { String colorId = event.getProperty(); if (getColorFontId(COLOR_BACKGROUND).equals(colorId)) { updateBackgroundColor(); - } else if (getColorFontId(COLOR_CATEGORY_TITLE).equals(colorId)) { + } else if (getColorFontId(COLOR_CATEGORY_TITLE) + .equals(colorId)) { updateCategoryTitlesColor(); - } else if (getColorFontId(COLOR_ENTRY_FOREGROUND).equals( - colorId)) { + } else if (getColorFontId(COLOR_ENTRY_FOREGROUND) + .equals(colorId)) { updateEntriesForegroundColor(); } else if (getColorFontId(COLOR_ENTRY_SELECTED_BACKGROUND) .equals(colorId)) { @@ -304,10 +329,10 @@ public void propertyChange(PropertyChangeEvent event) { JFaceResources.getFontRegistry().addListener(fontChangeListener); container.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { - JFaceResources.getColorRegistry().removeListener( - colorChangeListener); - JFaceResources.getFontRegistry().removeListener( - fontChangeListener); + JFaceResources.getColorRegistry() + .removeListener(colorChangeListener); + JFaceResources.getFontRegistry() + .removeListener(fontChangeListener); } }); @@ -326,8 +351,8 @@ protected void updateColorsFonts() { } private void updateBackgroundColor() { - Color color = JFaceResources.getColorRegistry().get( - getColorFontId(COLOR_BACKGROUND)); + Color color = JFaceResources.getColorRegistry() + .get(getColorFontId(COLOR_BACKGROUND)); container.setBackground(color); getContents().setBackground(color); Iterator
sections = sections(); @@ -339,8 +364,8 @@ private void updateBackgroundColor() { } private void updateCategoryTitlesColor() { - Color color = JFaceResources.getColorRegistry().get( - getColorFontId(COLOR_CATEGORY_TITLE)); + Color color = JFaceResources.getColorRegistry() + .get(getColorFontId(COLOR_CATEGORY_TITLE)); Iterator
sections = sections(); while (sections.hasNext()) { Section section = sections.next(); @@ -351,8 +376,8 @@ private void updateCategoryTitlesColor() { } private void updateEntriesForegroundColor() { - Color color = JFaceResources.getColorRegistry().get( - getColorFontId(COLOR_ENTRY_FOREGROUND)); + Color color = JFaceResources.getColorRegistry() + .get(getColorFontId(COLOR_ENTRY_FOREGROUND)); Iterator entries = entries(); while (entries.hasNext()) { entries.next().setForeground(color); @@ -360,8 +385,8 @@ private void updateEntriesForegroundColor() { } private void updateCategoryTitlesFont() { - Font font = JFaceResources.getFontRegistry().get( - getColorFontId(FONT_CATEGORY_TITLE)); + Font font = JFaceResources.getFontRegistry() + .get(getColorFontId(FONT_CATEGORY_TITLE)); Iterator
sections = sections(); while (sections.hasNext()) { Section section = sections.next(); @@ -372,8 +397,8 @@ private void updateCategoryTitlesFont() { } private void updateEntriesFont() { - Font font = JFaceResources.getFontRegistry().get( - getColorFontId(FONT_ENTRY)); + Font font = JFaceResources.getFontRegistry() + .get(getColorFontId(FONT_ENTRY)); Iterator entries = entries(); while (entries.hasNext()) { entries.next().setFont(font); @@ -381,8 +406,8 @@ private void updateEntriesFont() { } private void updateEntriesSelectedBackgroundColor() { - Color color = JFaceResources.getColorRegistry().get( - getColorFontId(COLOR_ENTRY_SELECTED_BACKGROUND)); + Color color = JFaceResources.getColorRegistry() + .get(getColorFontId(COLOR_ENTRY_SELECTED_BACKGROUND)); Iterator entries = entries(); while (entries.hasNext()) { entries.next().setSelectedBackground(color); @@ -390,8 +415,8 @@ private void updateEntriesSelectedBackgroundColor() { } private void updateEntriesSelectedForegroundColor() { - Color color = JFaceResources.getColorRegistry().get( - getColorFontId(COLOR_ENTRY_SELECTED_FOREGROUND)); + Color color = JFaceResources.getColorRegistry() + .get(getColorFontId(COLOR_ENTRY_SELECTED_FOREGROUND)); Iterator entries = entries(); while (entries.hasNext()) { entries.next().setSelectedForeground(color); @@ -399,8 +424,8 @@ private void updateEntriesSelectedForegroundColor() { } private void updateEntriesSelectedFont() { - Font font = JFaceResources.getFontRegistry().get( - getColorFontId(FONT_ENTRY_SELECTED)); + Font font = JFaceResources.getFontRegistry() + .get(getColorFontId(FONT_ENTRY_SELECTED)); Iterator entries = entries(); while (entries.hasNext()) { entries.next().setSelectedFont(font); @@ -408,8 +433,8 @@ private void updateEntriesSelectedFont() { } protected Iterator entries() { - return Chainability.iterate(firstSection == null ? null - : firstSection.firstEntry, null); + return Chainability.iterate( + firstSection == null ? null : firstSection.firstEntry, null); } protected Iterator
sections() { @@ -495,8 +520,8 @@ protected void addEditingEntry(IPropertyDescriptor descriptor) { if (section.firstEntry == null || section.lastEntry == null) { section.firstEntry = entry; if (section.getPrevious() != null) { - Chainability - .insertAfter(section.getPrevious().lastEntry, entry); + Chainability.insertAfter(section.getPrevious().lastEntry, + entry); } } else { Chainability.insertAfter(section.lastEntry, entry); @@ -509,8 +534,8 @@ private void createSectionControls() { return; Composite parent = getContents(); - if (firstSection.getNext() == null - && (firstSection.title == null || "".equals(firstSection.title))) { //$NON-NLS-1$ + if (firstSection.getNext() == null && (firstSection.title == null + || "".equals(firstSection.title))) { //$NON-NLS-1$ Iterator it = firstSection.entries(); while (it.hasNext()) { PropertyEditingEntry entry = it.next(); @@ -523,8 +548,8 @@ private void createSectionControls() { Section section = sectionIt.next(); section.create(parent); if (section.section != null) { - section.section.getControl().setLayoutData( - createSectionLayoutData()); + section.section.getControl() + .setLayoutData(createSectionLayoutData()); } } } @@ -612,9 +637,8 @@ protected void fireSelectionChanged() { ISelection selection = getSelection(); for (Object listener : listeners.getListeners()) { if (listener instanceof ISelectionChangedListener) { - ((ISelectionChangedListener) listener) - .selectionChanged(new SelectionChangedEvent(this, - selection)); + ((ISelectionChangedListener) listener).selectionChanged( + new SelectionChangedEvent(this, selection)); } } } diff --git a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/resources/ImageReference.java b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/resources/ImageReference.java index 6af682ffa..65fad9d8c 100644 --- a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/resources/ImageReference.java +++ b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/resources/ImageReference.java @@ -86,8 +86,12 @@ private void disposeImage() { public synchronized Image getImage() { if (image == null || image.isDisposed()) { - image = descriptor.createImage(returnMissingImageOnError, - device); + try { + image = descriptor.createImage(returnMissingImageOnError, + device); + } catch (SWTException e) { + image = null; + } } return image; } diff --git a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/util/JobPool.java b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/util/JobPool.java new file mode 100644 index 000000000..637fa9ef0 --- /dev/null +++ b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/util/JobPool.java @@ -0,0 +1,139 @@ +package org.xmind.ui.util; + +import java.util.Queue; +import java.util.concurrent.ConcurrentLinkedQueue; + +import org.eclipse.core.runtime.IStatus; +import org.eclipse.core.runtime.Status; +import org.eclipse.core.runtime.jobs.IJobChangeEvent; +import org.eclipse.core.runtime.jobs.Job; +import org.eclipse.core.runtime.jobs.JobChangeAdapter; +import org.eclipse.osgi.util.NLS; +import org.xmind.ui.internal.ToolkitPlugin; + +public class JobPool { + + private static boolean DEBUG = false; + + private static final int DEFAULT_RETRY_NUM = 0; + + private static final int DEFAULT_RUNNING_MAX_NUM = 5; + + private static class JobTask { + + final Job job; + + final Runnable onFinish; + + public JobTask(Job job, Runnable onFinish) { + this.job = job; + this.onFinish = onFinish; + } + } + + private Queue waitingJobs = new ConcurrentLinkedQueue(); + + private int retryNum = DEFAULT_RETRY_NUM; + + private int runningMaxNum = DEFAULT_RUNNING_MAX_NUM; + + private int runningJobCount = 0; + + public JobPool() { + } + + public int getRetryNum() { + return retryNum; + } + + public void setRetryNum(int retryNum) { + this.retryNum = retryNum; + } + + public int getRunningMaxNum() { + return runningMaxNum; + } + + public void setRunningMaxNum(int runningMaxNum) { + this.runningMaxNum = runningMaxNum; + } + + public void scheduleJob(final Job job, final Runnable onFinish) { + waitingJobs.offer(new JobTask(job, onFinish)); + scheduleNext(); + } + + public void cancelRemaining() { + waitingJobs.clear(); + } + + private synchronized void scheduleNext() { + if (runningJobCount < runningMaxNum) { + JobTask task = waitingJobs.poll(); + if (task != null) { + try { + startJob(task.job, task.onFinish); + } catch (Throwable e) { + log(e, "Error occurred while job running..."); //$NON-NLS-1$ + } + runningJobCount++; + } + } + } + + private void startJob(final Job job, final Runnable onFinish) { + final int[] retryCount = new int[] { 0 }; + job.addJobChangeListener(new JobChangeAdapter() { + @Override + public void done(IJobChangeEvent event) { + super.done(event); + int status = event.getJob().getResult().getSeverity(); + if (status != IStatus.OK && status != IStatus.CANCEL) { + if (++retryCount[0] < retryNum) { + job.schedule(); + if (DEBUG) + System.out.println("Retry failed [try=" //$NON-NLS-1$ + + (retryCount[0] + 1) + "]."); //$NON-NLS-1$ + return; + } else { + if (DEBUG) + System.out.println(NLS.bind( + "Job failed after {0} retries.", retryNum)); //$NON-NLS-1$ + } + } else { + if (DEBUG) { + if (status == IStatus.OK) + System.out.println("Job succeeded."); //$NON-NLS-1$ + else + System.out.println("Job canceled."); //$NON-NLS-1$ + } + } + + try { + if (onFinish != null) { + try { + onFinish.run(); + } catch (Throwable e) { + log(e, "Error occurred while calling back on job finished."); //$NON-NLS-1$ + } + } + } finally { + runningJobCount--; + scheduleNext(); + } + } + }); + job.schedule(); + if (DEBUG) + System.out.println("New job start [try=" + (retryCount[0] + 1) //$NON-NLS-1$ + + "]."); //$NON-NLS-1$ + } + + public static void log(Throwable exception, String message) { + ToolkitPlugin.getDefault().getLog() + .log(new Status( + exception == null ? IStatus.INFO : IStatus.ERROR, + ToolkitPlugin.PLUGIN_ID, message, exception)); + } + +} diff --git a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/viewers/CategorizedViewer.java b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/viewers/CategorizedViewer.java index 4e3ef4390..2eee4937d 100644 --- a/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/viewers/CategorizedViewer.java +++ b/bundles/org.xmind.ui.toolkit/src/org/xmind/ui/viewers/CategorizedViewer.java @@ -24,6 +24,7 @@ import org.eclipse.core.runtime.Assert; import org.eclipse.jface.resource.JFaceResources; +import org.eclipse.jface.util.Util; import org.eclipse.jface.viewers.IColorProvider; import org.eclipse.jface.viewers.ILabelProvider; import org.eclipse.jface.viewers.ISelection; @@ -101,12 +102,31 @@ private ScrolledForm createContainer(Composite parent, int style) { form.setBackground(parent.getBackground()); form.setForeground(parent.getForeground()); form.setFont(JFaceResources.getHeaderFont()); + addHorizontalScrollSupport(form); container = form; configureContainer(container); return container; } + // add horizontal scroll support for windows + private void addHorizontalScrollSupport(final ScrolledForm form) { + if (Util.isWindows()) { + form.addListener(SWT.MouseHorizontalWheel, new Listener() { + + public void handleEvent(Event event) { + if (!form.isDisposed()) { + int offset = event.count; + offset = -(int) (Math.sqrt(Math.abs(offset)) * offset); + + Point origin = form.getOrigin(); + form.setOrigin(origin.x + offset, origin.y); + } + } + }); + } + } + protected WidgetFactory createWidgetFactory(Display display) { return new WidgetFactory(display); } diff --git a/bundles/org.xmind.ui/META-INF/MANIFEST.MF b/bundles/org.xmind.ui/META-INF/MANIFEST.MF index 1f652082f..f23e71b9e 100644 --- a/bundles/org.xmind.ui/META-INF/MANIFEST.MF +++ b/bundles/org.xmind.ui/META-INF/MANIFEST.MF @@ -2,13 +2,13 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %pluginName Bundle-SymbolicName: org.xmind.ui;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.ui.internal.XmindUIPlugin Bundle-Vendor: %providerName Require-Bundle: org.eclipse.ui, org.eclipse.core.runtime, - org.xmind.ui.mindmap;bundle-version="[3.7.2,3.8.0)";visibility:=reexport, - org.xmind.ui.toolkit;bundle-version="[3.7.2,3.8.0)" + org.xmind.ui.mindmap;bundle-version="[3.7.3,3.8.0)";visibility:=reexport, + org.xmind.ui.toolkit;bundle-version="[3.7.3,3.8.0)" Eclipse-LazyStart: true Export-Package: org.xmind.ui.internal;x-friends:="org.xmind.ui" Bundle-RequiredExecutionEnvironment: J2SE-1.5 diff --git a/bundles/org.xmind.ui/pom.xml b/bundles/org.xmind.ui/pom.xml index 81c20c3ee..9a61f552c 100644 --- a/bundles/org.xmind.ui/pom.xml +++ b/bundles/org.xmind.ui/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.plugins org.xmind.ui - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/bundles/org.xmind.ui/schema/shareOptions.exsd b/bundles/org.xmind.ui/schema/shareOptions.exsd index 7b6b7adde..cbed7e4d8 100644 --- a/bundles/org.xmind.ui/schema/shareOptions.exsd +++ b/bundles/org.xmind.ui/schema/shareOptions.exsd @@ -111,6 +111,21 @@ + + + + + + + + + + + + + + + diff --git a/features/org.xmind.cathy.feature/feature.xml b/features/org.xmind.cathy.feature/feature.xml index 6504fb600..4ad7d6e9a 100644 --- a/features/org.xmind.cathy.feature/feature.xml +++ b/features/org.xmind.cathy.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/features/org.xmind.cathy.feature/pom.xml b/features/org.xmind.cathy.feature/pom.xml index 3bee66494..7a421f278 100644 --- a/features/org.xmind.cathy.feature/pom.xml +++ b/features/org.xmind.cathy.feature/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.features org.xmind.cathy.feature - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-feature org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/features/org.xmind.cathy.platform.feature/feature.xml b/features/org.xmind.cathy.platform.feature/feature.xml index b4171bcb0..a92514ce5 100644 --- a/features/org.xmind.cathy.platform.feature/feature.xml +++ b/features/org.xmind.cathy.platform.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/features/org.xmind.cathy.platform.feature/pom.xml b/features/org.xmind.cathy.platform.feature/pom.xml index b0c7a1c93..8775890ee 100644 --- a/features/org.xmind.cathy.platform.feature/pom.xml +++ b/features/org.xmind.cathy.platform.feature/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.features org.xmind.cathy.platform.feature - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-feature org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/features/org.xmind.graphicsio.feature/feature.xml b/features/org.xmind.graphicsio.feature/feature.xml index 8ced3729e..838f8cac4 100644 --- a/features/org.xmind.graphicsio.feature/feature.xml +++ b/features/org.xmind.graphicsio.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/features/org.xmind.graphicsio.feature/pom.xml b/features/org.xmind.graphicsio.feature/pom.xml index 8ea350dec..8568d9063 100644 --- a/features/org.xmind.graphicsio.feature/pom.xml +++ b/features/org.xmind.graphicsio.feature/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.features org.xmind.graphicsio.feature - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-feature org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/features/org.xmind.hebe.feature/feature.xml b/features/org.xmind.hebe.feature/feature.xml index 3087793c7..c97a86895 100644 --- a/features/org.xmind.hebe.feature/feature.xml +++ b/features/org.xmind.hebe.feature/feature.xml @@ -2,7 +2,7 @@ diff --git a/features/org.xmind.hebe.feature/pom.xml b/features/org.xmind.hebe.feature/pom.xml index eb2050337..baabb796c 100644 --- a/features/org.xmind.hebe.feature/pom.xml +++ b/features/org.xmind.hebe.feature/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.features org.xmind.hebe.feature - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-feature org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/pom.xml b/pom.xml index fa8fc8869..327112904 100644 --- a/pom.xml +++ b/pom.xml @@ -5,7 +5,7 @@ 4.0.0 org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT pom diff --git a/releng/org.xmind.cathy.product/META-INF/MANIFEST.MF b/releng/org.xmind.cathy.product/META-INF/MANIFEST.MF index 6113602a6..3853cb52c 100644 --- a/releng/org.xmind.cathy.product/META-INF/MANIFEST.MF +++ b/releng/org.xmind.cathy.product/META-INF/MANIFEST.MF @@ -2,5 +2,5 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: XMind Products Bundle-SymbolicName: org.xmind.products -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: XMind Ltd. diff --git a/releng/org.xmind.cathy.product/cathy.product b/releng/org.xmind.cathy.product/cathy.product index dc5fde8b1..66ee428c2 100644 --- a/releng/org.xmind.cathy.product/cathy.product +++ b/releng/org.xmind.cathy.product/cathy.product @@ -1,7 +1,7 @@ - + diff --git a/releng/org.xmind.cathy.product/pom.xml b/releng/org.xmind.cathy.product/pom.xml index 2e241e359..2abd1ca01 100644 --- a/releng/org.xmind.cathy.product/pom.xml +++ b/releng/org.xmind.cathy.product/pom.xml @@ -5,13 +5,13 @@ 4.0.0 org.xmind.releng org.xmind.cathy.product - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-repository org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/releng/org.xmind.cathy.repository/category.xml b/releng/org.xmind.cathy.repository/category.xml index 6bde93184..db8f42626 100644 --- a/releng/org.xmind.cathy.repository/category.xml +++ b/releng/org.xmind.cathy.repository/category.xml @@ -1,15 +1,15 @@ - + - + - + - + diff --git a/releng/org.xmind.cathy.repository/pom.xml b/releng/org.xmind.cathy.repository/pom.xml index 3a7aee217..68485041c 100644 --- a/releng/org.xmind.cathy.repository/pom.xml +++ b/releng/org.xmind.cathy.repository/pom.xml @@ -8,7 +8,7 @@ org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/releng/org.xmind.cathy.target/pom.xml b/releng/org.xmind.cathy.target/pom.xml index d7893b33e..b2cd8b678 100644 --- a/releng/org.xmind.cathy.target/pom.xml +++ b/releng/org.xmind.cathy.target/pom.xml @@ -8,7 +8,7 @@ org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ diff --git a/tests/org.xmind.core.runtime.tests/META-INF/MANIFEST.MF b/tests/org.xmind.core.runtime.tests/META-INF/MANIFEST.MF index c68db4933..86a54f574 100644 --- a/tests/org.xmind.core.runtime.tests/META-INF/MANIFEST.MF +++ b/tests/org.xmind.core.runtime.tests/META-INF/MANIFEST.MF @@ -2,10 +2,10 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.xmind.core.runtime.tests;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Vendor: %Bundle-Vendor Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Require-Bundle: org.eclipse.core.runtime, org.junit, - org.xmind.core.runtime;bundle-version="[3.7.2,3.8.0)" + org.xmind.core.runtime;bundle-version="[3.7.3,3.8.0)" diff --git a/tests/org.xmind.core.runtime.tests/pom.xml b/tests/org.xmind.core.runtime.tests/pom.xml index 0f2b8c49d..dd5f397ea 100644 --- a/tests/org.xmind.core.runtime.tests/pom.xml +++ b/tests/org.xmind.core.runtime.tests/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.tests org.xmind.core.runtime.tests - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-test-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ \ No newline at end of file diff --git a/tests/org.xmind.core.tests/META-INF/MANIFEST.MF b/tests/org.xmind.core.tests/META-INF/MANIFEST.MF index 14dc1e2f0..26ebf6837 100644 --- a/tests/org.xmind.core.tests/META-INF/MANIFEST.MF +++ b/tests/org.xmind.core.tests/META-INF/MANIFEST.MF @@ -2,12 +2,12 @@ Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: %Bundle-Name Bundle-SymbolicName: org.xmind.core.tests;singleton:=true -Bundle-Version: 3.7.2.qualifier +Bundle-Version: 3.7.3.qualifier Bundle-Activator: org.xmind.core.internal.tests.TestPluginForXMindCore Bundle-Vendor: %Bundle-Vendor Require-Bundle: org.eclipse.core.runtime, org.junit, - org.xmind.core;bundle-version="[3.7.2,3.8.0)" + org.xmind.core;bundle-version="[3.7.3,3.8.0)" Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Bundle-ActivationPolicy: lazy Export-Package: org.xmind.core.internal.experiments;x-internal:=true, diff --git a/tests/org.xmind.core.tests/pom.xml b/tests/org.xmind.core.tests/pom.xml index 74bfb08e3..35b43a0e5 100644 --- a/tests/org.xmind.core.tests/pom.xml +++ b/tests/org.xmind.core.tests/pom.xml @@ -5,12 +5,12 @@ 4.0.0 org.xmind.cathy.tests org.xmind.core.tests - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT eclipse-test-plugin org.xmind.releng org.xmind.cathy.releng - 3.7.2-SNAPSHOT + 3.7.3-SNAPSHOT ../../ \ No newline at end of file