Skip to main content

This CGIT instance is deprecated, and repositories have been moved to Gitlab or Github. See the repository descriptions for specific locations.

summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordavid_williams2010-11-04 02:21:22 +0000
committerdavid_williams2010-11-04 02:21:22 +0000
commit1404863cac51c98ceb391ecc93e009aee9c4707a (patch)
treed0747ce9ff1f6182afc56b5db926e6fbbdcb5739 /plugins/org.eclipse.wst.common.emf/workbench
parenta90db45f5e521a88f43200cc502f89a2c757898c (diff)
downloadwebtools.common-201011040300.tar.gz
webtools.common-201011040300.tar.xz
webtools.common-201011040300.zip
This commit was manufactured by cvs2svn to create tag 'v201011040300'.v201011040300
Diffstat (limited to 'plugins/org.eclipse.wst.common.emf/workbench')
-rw-r--r--plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/ResourceSynchronizedIsLoadingAdapter.java127
-rw-r--r--plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/ResourceSynchronizedIsLoadingAdapterFactory.java33
-rw-r--r--plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/EcoreUtilitiesPlugin.java92
-rw-r--r--plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/PackageURIMapReader.java71
-rw-r--r--plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/PluginRendererFactoryDefaultHandler.java41
5 files changed, 0 insertions, 364 deletions
diff --git a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/ResourceSynchronizedIsLoadingAdapter.java b/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/ResourceSynchronizedIsLoadingAdapter.java
deleted file mode 100644
index f7c691944..000000000
--- a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/ResourceSynchronizedIsLoadingAdapter.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2009 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Oct 26, 2004
- */
-package org.eclipse.wst.common.internal.emf;
-
-import org.eclipse.core.runtime.jobs.ILock;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.emf.common.notify.Notification;
-import org.eclipse.emf.common.notify.Notifier;
-import org.eclipse.emf.ecore.resource.Resource;
-import org.eclipse.wst.common.internal.emf.utilities.ResourceIsLoadingAdapter;
-import org.eclipse.wst.common.internal.emf.plugin.EcoreUtilitiesPlugin;
-
-
-
-/**
- * The ResourceSynchronizedIsLoadingAdapter is used to synchronize the loading
- * of EMF resources. This is the Eclipse version of ResourceIsLoadingAdapter,
- * and uses the Eclipse ILock technology to acquire a semaphore until the
- * Resource is loaded. the waitForResourceToLoad() method will pause until
- * either (a) the Resource has loaded, the Adapter is notified, and the
- * semaphore is released or (b) the DELAY timeout is exceeded, which prevents
- * full deadlock.
- *
- * @author mdelder
- */
-public class ResourceSynchronizedIsLoadingAdapter extends ResourceIsLoadingAdapter {
-
- private final ILock loadingLock;
-
- /**
- * The delay is default to 5 minutes. This is the upward threshhold. The
- * lock will wait up to DELAY milliseconds to acquire the lock, and bail
- * if not. It does not mean that it will wait DELAY milliseconds always.
- * In general, the wait should be almost instantaneous -- just as long as
- * document loading remains speedy.
- */
- private static final long DELAY = 300000;
-
- public ResourceSynchronizedIsLoadingAdapter() {
- loadingLock = Job.getJobManager().newLock();
- if (loadingLock != null)
- loadingLock.acquire();
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.internal.emf.utilities.ResourceIsLoadingAdapter#waitForResourceToLoad()
- */
- @Override
- public void waitForResourceToLoad() {
-
- if (loadingLock == null)
- return;
-
- boolean lockAcquired = false;
- try {
- if (loadingLock != null)
- if (!(lockAcquired = loadingLock.acquire(DELAY)))
- logWarning();
- }
- catch (InterruptedException e) {
- // ignore, just continue
- }
- finally {
- if (lockAcquired)
- loadingLock.release();
- }
-
- }
-
-
- /**
- *
- */
- private void logWarning() {
- Notifier target = getTarget();
- if (target == null || !(target instanceof Resource)) {
- Resource resource = (Resource) target;
- EcoreUtilitiesPlugin.logError("[WARNING] Could not acquire Semaphore Lock for Resource: \"" + resource.getURI() + "\" in " + getClass()); //$NON-NLS-1$//$NON-NLS-2$
- }
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.internal.emf.utilities.ResourceIsLoadingAdapter#notifyChanged(org.eclipse.emf.common.notify.Notification)
- */
- @Override
- public void notifyChanged(Notification notification) {
-
- if (notification.getNotifier() != null) {
- // listen for the remove of the loading adapter
- if (isSetLoadedResourceNotification(notification)) {
- if (loadingLock != null)
- loadingLock.release();
- removeIsLoadingSupport();
- }
- }
- }
-
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.wtp.internal.emf.utilities.ResourceIsLoadingAdapter#forceRelease()
- */
- @Override
- public void forceRelease() {
- if (loadingLock != null && loadingLock.getDepth() > 0)
- loadingLock.release();
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/ResourceSynchronizedIsLoadingAdapterFactory.java b/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/ResourceSynchronizedIsLoadingAdapterFactory.java
deleted file mode 100644
index 901b3b69e..000000000
--- a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/ResourceSynchronizedIsLoadingAdapterFactory.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2005, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Oct 26, 2004
- */
-package org.eclipse.wst.common.internal.emf;
-
-import org.eclipse.wst.common.internal.emf.utilities.ResourceIsLoadingAdapter;
-import org.eclipse.wst.common.internal.emf.utilities.ResourceIsLoadingAdapterFactory;
-
-
-/**
- * @author mdelder
- */
-public class ResourceSynchronizedIsLoadingAdapterFactory extends ResourceIsLoadingAdapterFactory {
-
-
- /* (non-Javadoc)
- * @see com.ibm.wtp.internal.emf.utilities.ResourceIsLoadingAdapterFactory#createResourceIsLoadingAdapter()
- */
- @Override
- public ResourceIsLoadingAdapter createResourceIsLoadingAdapter() {
- return new ResourceSynchronizedIsLoadingAdapter();
- }
-}
diff --git a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/EcoreUtilitiesPlugin.java b/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/EcoreUtilitiesPlugin.java
deleted file mode 100644
index 1f19437a0..000000000
--- a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/EcoreUtilitiesPlugin.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2006 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-/*
- * Created on Jun 9, 2003
- *
- * To change the template for this generated file go to
- * Window>Preferences>Java>Code Generation>Code and Comments
- */
-package org.eclipse.wst.common.internal.emf.plugin;
-
-import org.eclipse.core.runtime.Plugin;
-import org.eclipse.wst.common.internal.emf.ResourceSynchronizedIsLoadingAdapterFactory;
-import org.eclipse.wst.common.internal.emf.resource.RendererFactory;
-import org.eclipse.wst.common.internal.emf.utilities.ResourceIsLoadingAdapterFactory;
-import org.osgi.framework.BundleContext;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Platform;
-import java.lang.Throwable;
-import org.eclipse.core.runtime.CoreException;
-
-/**
- * @author DABERG
- *
- * To change the template for this generated type comment go to Window>Preferences>Java>Code
- * Generation>Code and Comments
- */
-public class EcoreUtilitiesPlugin extends Plugin {
- //the ID for this plugin (added automatically by logging quickfix)
- public static final String PLUGIN_ID = "org.eclipse.wst.common.emf"; //$NON-NLS-1$
- public static final String ID = "org.eclipse.wst.common.emf"; //$NON-NLS-1$
- public static final String TRANSLATOR_EXTENSTION_POINT = "translatorExtension"; //$NON-NLS-1$
-
- /**
- * @param descriptor
- */
- public EcoreUtilitiesPlugin() {
- super();
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.core.runtime.Plugin#startup()
- */
- @Override
- public void start(BundleContext context) throws Exception {
- super.start(context);
- RendererFactory.setDefaultHandler(PluginRendererFactoryDefaultHandler.INSTANCE);
- PackageURIMapReader reader = new PackageURIMapReader();
- reader.processExtensions();
- //use a synchronized loading adapter factory
- ResourceIsLoadingAdapterFactory.INSTANCE = new ResourceSynchronizedIsLoadingAdapterFactory();
- }
-
- public static IStatus createStatus(int severity, String message, Throwable exception) {
- return new Status(severity, PLUGIN_ID, message, exception);
- }
-
- public static IStatus createStatus(int severity, String message) {
- return createStatus(severity, message, null);
- }
-
- public static void logError(Throwable exception) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, exception.getMessage(), exception));
- }
-
- public static void logError(CoreException exception) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( exception.getStatus() );
- }
-
- public static void logError(String message) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.ERROR, message));
- }
-
- public static void logWarning(String message) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log(createStatus(IStatus.WARNING, message));
- }
-
- public static void logWarning(Throwable exception) {
- Platform.getLog(Platform.getBundle(PLUGIN_ID)).log( createStatus(IStatus.WARNING, exception.getMessage(), exception));
- }
-
-}
diff --git a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/PackageURIMapReader.java b/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/PackageURIMapReader.java
deleted file mode 100644
index d1c39b043..000000000
--- a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/PackageURIMapReader.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.emf.plugin;
-
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtension;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.wst.common.internal.emf.resource.CompatibilityPackageMappingRegistry;
-
-/**
- * This reader will read the packageURIMap extension point and populate the
- * CompatibilityPackageMappingRegistry.
- *
- * The packageURIMap will have the following configuration element.
- *
- * <map prefix="somePackagePrefix" uri="somePackageURI"/>
- *
- */
-public class PackageURIMapReader {
- private static final String URI_ATT_NAME = "uri"; //$NON-NLS-1$
- private static final String PREFIX_ATT_NAME = "prefix"; //$NON-NLS-1$
- private static final String EXTENSION_POINT_NAME = "packageURIMap"; //$NON-NLS-1$
-
- /**
- *
- */
- public PackageURIMapReader() {
- super();
- }
-
- private IExtensionPoint getExtensionPoint() {
- return Platform.getExtensionRegistry().getExtensionPoint(EcoreUtilitiesPlugin.ID, EXTENSION_POINT_NAME);
- }
-
- /**
- * Call this method to read and process all of the packageURIMap extensions. *
- */
- public void processExtensions() {
- CompatibilityPackageMappingRegistry reg = CompatibilityPackageMappingRegistry.INSTANCE;
- IExtension[] extensions = getExtensionPoint().getExtensions();
- for (int i = 0; i < extensions.length; i++)
- processExtension(extensions[i], reg);
- }
-
- /**
- * @param extension
- */
- private void processExtension(IExtension extension, CompatibilityPackageMappingRegistry reg) {
- IConfigurationElement[] configs = extension.getConfigurationElements();
- for (int i = 0; i < configs.length; i++)
- processConfiguration(configs[i], reg);
- }
-
- /**
- * @param element
- */
- private void processConfiguration(IConfigurationElement element, CompatibilityPackageMappingRegistry reg) {
- String prefix = element.getAttribute(PREFIX_ATT_NAME);
- String uri = element.getAttribute(URI_ATT_NAME);
- reg.registerPrefixToPackageURI(prefix, uri);
- }
-}
diff --git a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/PluginRendererFactoryDefaultHandler.java b/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/PluginRendererFactoryDefaultHandler.java
deleted file mode 100644
index 4ad9dc97b..000000000
--- a/plugins/org.eclipse.wst.common.emf/workbench/org/eclipse/wst/common/internal/emf/plugin/PluginRendererFactoryDefaultHandler.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2003, 2005 IBM Corporation and others.
- * All rights reserved. This program and the accompanying materials
- * are made available under the terms of the Eclipse Public License v1.0
- * which accompanies this distribution, and is available at
- * http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * IBM Corporation - initial API and implementation
- *******************************************************************************/
-package org.eclipse.wst.common.internal.emf.plugin;
-
-import org.eclipse.wst.common.core.util.UIContextDetermination;
-import org.eclipse.wst.common.internal.emf.resource.EMF2DOMRendererFactoryDefaultHandler;
-import org.eclipse.wst.common.internal.emf.resource.RendererFactory;
-
-public class PluginRendererFactoryDefaultHandler extends EMF2DOMRendererFactoryDefaultHandler {
-
- static final PluginRendererFactoryDefaultHandler INSTANCE = new PluginRendererFactoryDefaultHandler();
- static final String EXT_POINT_NAME = "rendererFactory"; //$NON-NLS-1$
-
- /**
- *
- */
- protected PluginRendererFactoryDefaultHandler() {
-
- }
-
- /*
- * (non-Javadoc)
- *
- * @see com.ibm.etools.emf2xml.EMF2DOMRendererFactoryDefaultHandler#getDefaultRendererFactory()
- */
- @Override
- public RendererFactory getDefaultRendererFactory() {
- RendererFactory aFactory = (RendererFactory) UIContextDetermination.createInstance(EXT_POINT_NAME);
- return aFactory == null ? super.getDefaultRendererFactory() : aFactory;
- }
-
-
-}

Back to the top