From eee36969255fda8c0ff1be8fe176f10c0a2b294d Mon Sep 17 00:00:00 2001 From: Edgar Mueller Date: Thu, 28 May 2015 12:12:41 +0200 Subject: [PATCH] Bug 466617 - Extension points do not work Fixed org.eclipse.emf.emfstore.client.workspaceInitObserver extension point, also fixed typo Change-Id: I35efa0ea646a556ec8bbfd3d861888c224e6d718 --- .../client/model/ESWorkspaceProviderImpl.java | 27 ++++++++++--------- .../client/model/WorkspaceLocator.java | 5 ++-- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/ESWorkspaceProviderImpl.java b/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/ESWorkspaceProviderImpl.java index b87ca5f7f..3a1ce1bf4 100644 --- a/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/ESWorkspaceProviderImpl.java +++ b/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/ESWorkspaceProviderImpl.java @@ -80,7 +80,9 @@ * @author jfaltermeier */ public final class ESWorkspaceProviderImpl implements ESWorkspaceProvider, ESCommitObserver, ESUpdateObserver, - ESShareObserver, ESCheckoutObserver, ESDisposable { +ESShareObserver, ESCheckoutObserver, ESDisposable { + + private static final String WORKSPACE_INIT_EXT_POINT_ID = "org.eclipse.emf.emfstore.client.workspaceInitObserver"; //$NON-NLS-1$ /** * This thread local variable stores the ESWorkspaceProviderImpl associated with this thread. @@ -90,8 +92,7 @@ public final class ESWorkspaceProviderImpl implements ESWorkspaceProvider, ESCom * threads associated with them. When new threads are started this this threadlocal variable * is inherited by the newly created thread. */ - private static final ThreadLocal WS_THREAD_LOCAL = - new InheritableThreadLocal(); + private static final ThreadLocal WS_THREAD_LOCAL = new InheritableThreadLocal(); private static final String DEFAULT_WORKSPACE_ID = "default"; //$NON-NLS-1$ @@ -173,8 +174,7 @@ public void setName(String name) { */ public static ESWorkspaceProviderImpl getInstance() { if (WS_THREAD_LOCAL.get() == null) { - if (defaultInstance == null) - { + if (defaultInstance == null) { try { defaultInstance = new ESWorkspaceProviderImpl(DEFAULT_WORKSPACE_ID); defaultInstance.initialize(); @@ -515,12 +515,13 @@ void initialize() { * Notifies all {@link ESWorkspaceInitObserver} that the workspace initialization is complete. */ void notifyPostWorkspaceInitiators() { - for (final ESExtensionElement element : new ESExtensionPoint("org.eclipse.emf.emfstore.client.notify.postinit", //$NON-NLS-1$ - true).getExtensionElements()) { + final List extensionElements = new ESExtensionPoint(WORKSPACE_INIT_EXT_POINT_ID, true) + .getExtensionElements(); + for (final ESExtensionElement element : extensionElements) { try { - element.getClass("class", ESWorkspaceInitObserver.class).workspaceInitComplete( //$NON-NLS-1$ - currentWorkspace - .toAPI()); + element + .getClass("class", ESWorkspaceInitObserver.class) //$NON-NLS-1$ + .workspaceInitComplete(currentWorkspace.toAPI()); } catch (final ESExtensionPointException e) { WorkspaceUtil.logException(e.getMessage(), e); } @@ -601,7 +602,8 @@ protected void doRun() { } catch (final IOException e) { WorkspaceUtil.logException( Messages.ESWorkspaceProviderImpl_Create_Workspace_Failed - + Configuration.getFileInfo().getWorkspaceDirectory(), e); + + Configuration.getFileInfo().getWorkspaceDirectory(), + e); } return workspace; } @@ -697,7 +699,8 @@ public void shareDone(ESLocalProject localProject) { * @see org.eclipse.emf.emfstore.client.observer.ESUpdateObserver#inspectChanges(org.eclipse.emf.emfstore.client.ESLocalProject, * java.util.List, org.eclipse.core.runtime.IProgressMonitor) */ - public boolean inspectChanges(ESLocalProject project, List changePackages, IProgressMonitor monitor) { + public boolean inspectChanges(ESLocalProject project, List changePackages, + IProgressMonitor monitor) { return true; } diff --git a/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/WorkspaceLocator.java b/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/WorkspaceLocator.java index 6195914f0..0c3a4c3b1 100644 --- a/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/WorkspaceLocator.java +++ b/bundles/org.eclipse.emf.emfstore.client/src/org/eclipse/emf/emfstore/internal/client/model/WorkspaceLocator.java @@ -26,8 +26,7 @@ private WorkspaceLocator() { } - private static final Map WORKSPACE_PROVIDER_MAP = - new LinkedHashMap(); + private static final Map WORKSPACE_PROVIDER_MAP = new LinkedHashMap(); /** * Creates a workspace and associates it with the given ID. @@ -65,7 +64,7 @@ private static ESWorkspaceProviderImpl createWorkspace(String workspaceProviderI } /** - * Checks whether a workspace provier exists for the given identifier. + * Checks whether a workspace provider exists for the given identifier. * * @param workspaceProviderId * the workspace provider identifier