Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRĂ¼diger Herrmann2009-09-30 12:18:44 +0000
committerRĂ¼diger Herrmann2009-09-30 12:18:44 +0000
commit5580de8396bdcd53af24645174b3e818bc1abd2e (patch)
treec0832afaf65693e58a6767dc8b8315fa5b220344 /bundles/org.eclipse.rap.ui/src
parent9b78f15d1416fd64c2220c4442ab72659b71f84f (diff)
downloadorg.eclipse.rap-5580de8396bdcd53af24645174b3e818bc1abd2e.tar.gz
org.eclipse.rap-5580de8396bdcd53af24645174b3e818bc1abd2e.tar.xz
org.eclipse.rap-5580de8396bdcd53af24645174b3e818bc1abd2e.zip
Moved RAP replated classes into an namespace of their own
Diffstat (limited to 'bundles/org.eclipse.rap.ui/src')
-rw-r--r--bundles/org.eclipse.rap.ui/src/org/eclipse/rap/ui/internal/RAPHttpContext.java (renamed from bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/RAPHttpContext.java)6
-rw-r--r--bundles/org.eclipse.rap.ui/src/org/eclipse/rap/ui/internal/ResourceTranslatorHelper.java (renamed from bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/ResourceTranslatorHelper.java)57
-rwxr-xr-xbundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/UIPlugin.java1
3 files changed, 18 insertions, 46 deletions
diff --git a/bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/RAPHttpContext.java b/bundles/org.eclipse.rap.ui/src/org/eclipse/rap/ui/internal/RAPHttpContext.java
index 8b5b6d971a..64f92035f4 100644
--- a/bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/RAPHttpContext.java
+++ b/bundles/org.eclipse.rap.ui/src/org/eclipse/rap/ui/internal/RAPHttpContext.java
@@ -8,8 +8,7 @@
* Contributors:
* Innoopract Informationssysteme GmbH - initial API and implementation
******************************************************************************/
-
-package org.eclipse.ui.internal;
+package org.eclipse.rap.ui.internal;
import java.io.IOException;
import java.net.URL;
@@ -24,7 +23,8 @@ import org.osgi.service.http.HttpContext;
// NOTE: This was added to org.eclipse.rap.ui to avoid starting
// the workbench bundle before the context is established. The latter
// uses the context already on startup
-public class RAPHttpContext implements HttpContext {
+public final class RAPHttpContext implements HttpContext {
+
private final Bundle bundle;
public RAPHttpContext() {
diff --git a/bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/ResourceTranslatorHelper.java b/bundles/org.eclipse.rap.ui/src/org/eclipse/rap/ui/internal/ResourceTranslatorHelper.java
index 7ff71ab998..48d2b3772d 100644
--- a/bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/ResourceTranslatorHelper.java
+++ b/bundles/org.eclipse.rap.ui/src/org/eclipse/rap/ui/internal/ResourceTranslatorHelper.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2002-2007 Innoopract Informationssysteme GmbH.
+ * Copyright (c) 2002, 2009 Innoopract Informationssysteme GmbH.
* 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
@@ -7,9 +7,9 @@
*
* Contributors:
* Innoopract Informationssysteme GmbH - initial API and implementation
+ * EclipseSource - ongoing development
******************************************************************************/
-
-package org.eclipse.ui.internal;
+package org.eclipse.rap.ui.internal;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
@@ -32,21 +32,20 @@ import org.osgi.framework.ServiceReference;
* <code>{@link RWT#getLocale()}</code>.
*
* <p>Note that this functionality only takes effect if the
- * 'org.eclipse.rap.equinox.registry' fragment is available.</p>
+ * <code>org.eclipse.rap.equinox.registry<code> fragment is available.</p>
*/
-class ResourceTranslatorHelper {
+public final class ResourceTranslatorHelper {
+
private static final Class[] PARAM_TYPE_ALGORITHM
= new Class[] { Runnable.class };
private static final String METHOD_SET_TRANSLATOR_ALGORITHM
= "setTranslatorAlgorithm"; //$NON-NLS-1$
- private static final String METHOD_GET_BUNDLE_CONTEXT
- = "getBundleContext"; //$NON-NLS-1$
private static final String FIELD_ALGORITHM_IO = "algorithmIO"; //$NON-NLS-1$
- private static Class CLASS_REGISTRY_FACTORY = RegistryFactory.class;
+ private static final Class CLASS_REGISTRY_FACTORY = RegistryFactory.class;
/**
- * Plugable runnable that handles translation of externalized labels
+ * Pluggable runnable that handles translation of externalized labels
* of extension declarations.
*/
private static final class TranslatorAlgorithm implements Runnable {
@@ -54,19 +53,8 @@ class ResourceTranslatorHelper {
public void run() {
String result = getKey();
ResourceBundle bundle = null;
- try {
- if( ContextProvider.hasContext() ) {
- bundle = getResourceBundle();
- }
- } catch( final Exception shouldNotHappen ) {
- // TODO [fappel]: I use reflection to get the bundle context since this
- // is not available in 3.2. We do not support the
- // NLS patch fragment in 3.2 but unfortunately our build
- // process for 3.2 fails. As we will skip support for
- // 3.2 soon, this seems to be the easiest solution.
- // Remove reflection usage after 3.2 support has been
- // skipped.
- shouldNotHappen.printStackTrace();
+ if( ContextProvider.hasContext() ) {
+ bundle = getResourceBundle();
}
if( bundle != null ) {
result = ResourceTranslator.getResourceString( null, getKey(), bundle );
@@ -74,13 +62,9 @@ class ResourceTranslatorHelper {
getIOHandle().set( result );
}
- private ResourceBundle getResourceBundle()
- throws NoSuchMethodException,
- IllegalAccessException,
- InvocationTargetException
- {
+ private ResourceBundle getResourceBundle() {
Bundle bundle = Platform.getBundle( getSymbolicName() );
- BundleContext bundleContext = getBundleContext( bundle );
+ BundleContext bundleContext = bundle.getBundleContext();
String id = BundleLocalization.class.getName();
ServiceReference reference = bundleContext.getServiceReference( id );
BundleLocalization localization
@@ -88,16 +72,6 @@ class ResourceTranslatorHelper {
return localization.getLocalization( bundle, RWT.getLocale().toString() );
}
- private BundleContext getBundleContext( final Bundle bundle )
- throws NoSuchMethodException,
- IllegalAccessException,
- InvocationTargetException
- {
- Method getBundleContext
- = Bundle.class.getDeclaredMethod( METHOD_GET_BUNDLE_CONTEXT, null );
- return ( BundleContext )getBundleContext.invoke( bundle, null );
- }
-
private String getKey() {
return ( ( String[] )getIOHandle().get() )[ 0 ];
}
@@ -120,14 +94,11 @@ class ResourceTranslatorHelper {
}
- static void registerAlgorithm() {
+ public static void registerAlgorithm() {
if( isRWTLocalSpecificTranslationAllowed() ) {
try {
- Object[] param = new Object[] {
- new TranslatorAlgorithm()
- };
+ Object[] param = new Object[] { new TranslatorAlgorithm() };
getAlgorithmSetter().invoke( null, param );
-
} catch( final Exception shouldNotHappen ) {
shouldNotHappen.printStackTrace();
}
diff --git a/bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/UIPlugin.java b/bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/UIPlugin.java
index 43469d5887..738ed9cb1f 100755
--- a/bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/UIPlugin.java
+++ b/bundles/org.eclipse.rap.ui/src/org/eclipse/ui/internal/UIPlugin.java
@@ -13,6 +13,7 @@ package org.eclipse.ui.internal;
import org.eclipse.core.runtime.Assert;
import org.eclipse.jface.preference.IPreferenceStore;
import org.eclipse.jface.resource.ImageRegistry;
+import org.eclipse.rap.ui.internal.ResourceTranslatorHelper;
import org.eclipse.ui.internal.util.PrefUtil;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;

Back to the top