Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: b087e837a7b8873cfbff6eb5451d92599dcde418 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
/**
 * Copyright (c) 2002-2012 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 - Initial API and implementation
 */
package org.eclipse.emf.common;


import org.eclipse.emf.common.util.ResourceLocator;
import org.eclipse.emf.common.util.URI;

import com.google.gwt.core.shared.GWT;


/**
 * The <b>Plugin</b> for the model EMF.Common library.
 * EMF must run 
 * within an Eclipse workbench,
 * within a headless Eclipse workspace,
 * or just stand-alone as part of some other application.
 * To support this, all resource access should be directed to the resource locator,
 * which can redirect the service as appropriate to the runtime.
 * During stand-alone invocation no plugin initialization takes place.
 * In this case, common.resources.jar must be on the CLASSPATH.
 * @see #INSTANCE
 */
public final class CommonPlugin extends EMFPlugin 
{
  /**
   * The singleton instance of the plugin.
   */
  public static final CommonPlugin INSTANCE = new CommonPlugin();

  /**
   * Creates the singleton instance.
   */
  private CommonPlugin()
  {
    super(new ResourceLocator[] {});
  }

  @Override
  public ResourceLocator getPluginResourceLocator()
  {
    return null;
  }

  protected static final CommonPluginProperties PROPERTIES = GWT.create(CommonPluginProperties.class);

  @Override
  public String getString(String key, boolean translate)
  {
    if ("_UI_AbstractCommand_label".equals(key)) return PROPERTIES.abstractCommandLabel();
    else if ("_UI_AbstractCommand_description".equals(key)) return PROPERTIES.abstractCommandDescription();
    else if ("_UI_CommandWrapper_label".equals(key)) return PROPERTIES.commandWrapperLabel();
    else if ("_UI_CommandWrapper_description".equals(key)) return PROPERTIES.commandWrapperDescription();
    else if ("_UI_CompoundCommand_label".equals(key)) return PROPERTIES.compoundCommandLabel();
    else if ("_UI_CompoundCommand_description".equals(key)) return PROPERTIES.compoundCommandDescription();
    else if ("_UI_IdentityCommand_label".equals(key)) return PROPERTIES.identityCommandLabel();
    else if ("_UI_IdentityCommand_description".equals(key)) return PROPERTIES.identityCommandDescription();
    else if ("_UI_UnexecutableCommand_label".equals(key)) return PROPERTIES.unexecutableCommandLabel();
    else if ("_UI_UnexecutableCommand_description".equals(key)) return PROPERTIES.unexecutableCommandDescription();
    else if ("_UI_IgnoreException_exception".equals(key)) return PROPERTIES.ignoreExceptionException();
    else if ("_UI_NullLogEntry_exception".equals(key)) return PROPERTIES.nullLogEntryException();
    else if ("_UI_OK_diagnostic_0".equals(key)) return PROPERTIES.okDiagnostic0();
    else if ("_UI_Cancel_diagnostic_0".equals(key)) return PROPERTIES.cancelDiagnostic0();
    else return key;
  }

  @Override
  public String getString(String key, Object [] substitutions, boolean translate)
  {
    if ("_EXC_Method_not_implemented".equals(key)) return PROPERTIES.excMethodNotImplemented(substitutions[0]);
    else if ("_UI_StringResourceNotFound_exception".equals(key)) return PROPERTIES.stringResourceNotFoundException(substitutions[0]);
    else if ("_UI_ImageResourceNotFound_exception".equals(key)) return PROPERTIES.imageResourceNotFoundException(substitutions[0]);
    else return key;
  }

  /**
   * Use the platform, if available, to convert to a local URI.
   */
  public static URI asLocalURI(URI uri)
  {
    return uri;
  }

  /**
   * Use the platform, if available, to resolve the URI.
   */
  public static URI resolve(URI uri)
  {
    return uri;
  }
}

Back to the top