Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElement.java')
-rw-r--r--plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElement.java115
1 files changed, 115 insertions, 0 deletions
diff --git a/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElement.java b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElement.java
new file mode 100644
index 00000000000..8696a73b925
--- /dev/null
+++ b/plugins/infra/internationalization/org.eclipse.papyrus.infra.editor.welcome.internationalization/src/org/eclipse/papyrus/infra/editor/welcome/internationalization/modelelements/InternationalizationWelcomeModelElement.java
@@ -0,0 +1,115 @@
+/*****************************************************************************
+ * Copyright (c) 2016 CEA LIST 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:
+ * Nicolas FAUVERGUE (ALL4TEC) nicolas.fauvergue@all4tec.net - Initial API and implementation
+ *
+ *****************************************************************************/
+
+package org.eclipse.papyrus.infra.editor.welcome.internationalization.modelelements;
+
+import org.eclipse.core.databinding.observable.IObservable;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.emf.edit.domain.EditingDomain;
+import org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement;
+
+/**
+ * The internationalization welcome model element.
+ */
+public class InternationalizationWelcomeModelElement extends EMFModelElement {
+
+ /**
+ * The private storage identifier.
+ */
+ private final String PRIVATE_STORAGE = "privateStorage"; //$NON-NLS-1$
+
+ /**
+ * The useInternationalization identifier.
+ */
+ private final String USE_INTERNATIONALIZATION = "useInternationalization"; //$NON-NLS-1$
+
+ /**
+ * The language identifier.
+ */
+ private final String LANGUAGE = "language"; //$NON-NLS-1$
+
+ /**
+ * Constructor.
+ *
+ * @param source
+ * The source eObject.
+ * @param domain
+ * The current editing domain.
+ */
+ public InternationalizationWelcomeModelElement(final EObject source, final EditingDomain domain) {
+ super(source, domain);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#doGetObservable(java.lang.String)
+ */
+ @Override
+ protected IObservable doGetObservable(final String propertyPath) {
+ IObservable result = null;
+
+ switch (propertyPath) {
+ case PRIVATE_STORAGE:
+ result = new PrivateInternationalizationPreferenceObservableValue(domain);
+ break;
+ case USE_INTERNATIONALIZATION:
+ result = new UseInternationalizationObservableValue(domain);
+ break;
+ case LANGUAGE:
+ result = new LanguageObservableValue(domain);
+ break;
+ default:
+ break;
+ }
+
+ return null != result ? result : super.doGetObservable(propertyPath);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#isFeatureEditable(java.lang.String)
+ */
+ @Override
+ protected boolean isFeatureEditable(final String propertyPath) {
+ boolean result;
+
+ switch (propertyPath) {
+ case PRIVATE_STORAGE:
+ result = true;
+ break;
+ case USE_INTERNATIONALIZATION:
+ result = true;
+ break;
+ case LANGUAGE:
+ result = true;
+ break;
+ default:
+ result = super.isFeatureEditable(propertyPath);
+ break;
+ }
+
+ return result;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @see org.eclipse.papyrus.infra.properties.ui.modelelement.EMFModelElement#isElementEditable()
+ */
+ @Override
+ protected boolean isElementEditable() {
+ return true;
+ }
+}

Back to the top