summaryrefslogtreecommitdiff
path: root/propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/LocalePropertyEditor.java
diff options
context:
space:
mode:
Diffstat (limited to 'propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/LocalePropertyEditor.java')
-rw-r--r--propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/LocalePropertyEditor.java69
1 files changed, 69 insertions, 0 deletions
diff --git a/propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/LocalePropertyEditor.java b/propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/LocalePropertyEditor.java
new file mode 100644
index 0000000..9a6563d
--- /dev/null
+++ b/propertysheet/src/org/eclipse/wb/internal/core/model/property/editor/LocalePropertyEditor.java
@@ -0,0 +1,69 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Google, Inc.
+ * 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:
+ * Google, Inc. - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.wb.internal.core.model.property.editor;
+
+import org.eclipse.wb.internal.core.model.property.Property;
+
+import java.util.Locale;
+
+/**
+ * {@link PropertyEditor} for {@link Locale}.
+ *
+ * @author sablin_aa
+ * @coverage core.model.property.editor
+ */
+public final class LocalePropertyEditor extends TextDialogPropertyEditor {
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Instance
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ public static final PropertyEditor INSTANCE = new LocalePropertyEditor();
+
+ private LocalePropertyEditor() {
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Presentation
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ @Override
+ protected String getText(Property property) throws Exception {
+ Object value = property.getValue();
+ if (value instanceof Locale) {
+ return ((Locale) value).getDisplayName();
+ }
+ // unknown value
+ return null;
+ }
+
+ ////////////////////////////////////////////////////////////////////////////
+ //
+ // Editing
+ //
+ ////////////////////////////////////////////////////////////////////////////
+ @Override
+ protected void openDialog(Property property) throws Exception {
+ Object value = property.getValue();
+// ChooseLocaleDialog localeDialog;
+// if (value instanceof Locale) {
+// localeDialog = new ChooseLocaleDialog(DesignerPlugin.getShell(), (Locale) value);
+// } else {
+// localeDialog = new ChooseLocaleDialog(DesignerPlugin.getShell(), null);
+// }
+// // open dialog
+// if (localeDialog.open() == Window.OK) {
+// property.setValue(localeDialog.getSelectedLocale().getLocale());
+// }
+ System.out.println("TODO: Custom locale chooser here");
+ }
+} \ No newline at end of file