Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta')
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/AttributeDescriptor.java204
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/BindingHandlerDelegate.java116
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/EditorCreator.java112
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeCellEditorFactory.java68
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeDescriptor.java105
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IBindingHandler.java70
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/ICMRegistry.java34
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IElementDescriptor.java66
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IValueType.java60
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CMRegistry.java206
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java77
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFacRegistryReader.java77
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFactoryRegistry.java201
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/DefaultEditorCreator.java226
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/ElementDescReader.java433
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/ElementDescriptor.java122
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/LocaleFallback.java106
-rw-r--r--jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/SimpleCMRegistry.java72
18 files changed, 0 insertions, 2355 deletions
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/AttributeDescriptor.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/AttributeDescriptor.java
deleted file mode 100644
index 724decab2..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/AttributeDescriptor.java
+++ /dev/null
@@ -1,204 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.StringTokenizer;
-
-import org.eclipse.jst.jsf.common.ui.internal.utils.StringUtil;
-
-/**
- * @author mengbo
- */
-public class AttributeDescriptor implements IAttributeDescriptor {
- private String _attributeName;
-
- private String _category;
-
- private String _valueType;
-
- private String _typeParameter;
-
- private String _labelString;
-
- private String _defaultValue;
-
- private String _description;
-
- private Map _parameterMap;
-
- private Map _options;
-
- private boolean _required;
-
- /**
- *
- */
- public AttributeDescriptor() {
- super();
- }
-
- public AttributeDescriptor(String attrName) {
- this.setAttributeName(attrName);
- }
-
- public void setAttributeName(String attributeName) {
- this._attributeName = attributeName;
- }
-
- public void setCategory(String category) {
- this._category = category;
- }
-
- public void setValueType(String valueType) {
- this._valueType = valueType;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.IAttributeDescriptor#getAttributeName()
- */
- public String getAttributeName() {
- return _attributeName;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.IAttributeDescriptor#getDescription()
- */
- public String getDescription() {
- return _description;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.IAttributeDescriptor#getCategory()
- */
- public String getCategory() {
- return _category;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.IAttributeDescriptor#getValueType()
- */
- public String getValueType() {
- return _valueType;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.IAttributeDescriptor#getOptions()
- */
- public Map getOptions() {
- return _options;
- }
-
- public void setDescription(String description) {
- _description = description;
- }
-
- public void setOptions(Map map, String defaultValue) {
- _options = map;
- _defaultValue = defaultValue;
- }
-
- /**
- * @return Returns the typeParameter.
- */
- public String getTypeParameter() {
- return _typeParameter;
- }
-
- /**
- * @param typeParameter
- * The typeParameter to set.
- */
- public void setTypeParameter(String typeParameter) {
- this._typeParameter = typeParameter;
- _parameterMap = null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor#getLabelString()
- */
- public String getLabelString() {
- if (_labelString == null) {
- _labelString = StringUtil.splitVariable(getAttributeName());
- }
- return _labelString;
- }
-
- /**
- * @param labelString
- * The labelString to set.
- */
- public void setLabelString(String labelString) {
- this._labelString = labelString;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor#getParameterByName(java.lang.String)
- */
- public String getParameterByName(String name) {
- if (_parameterMap == null) {
- parseParameter();
- }
- Object value = _parameterMap.get(name);
- return value == null ? "" : value.toString();
- }
-
- /**
- *
- */
- private void parseParameter() {
- _parameterMap = new HashMap();
- if (_typeParameter == null) {
- return;
- }
- StringTokenizer tokenizer = new StringTokenizer(_typeParameter, "||");
- while (tokenizer.hasMoreTokens()) {
- String parameterEntry = tokenizer.nextToken();
- int index = parameterEntry.indexOf('=');
- if (index != -1) {
- _parameterMap.put(parameterEntry.substring(0, index),
- parameterEntry.substring(index + 1));
- }
- }
- }
-
- public String getDefaultValue() {
- return _defaultValue;
- }
-
- public void setDefaultValue(String value) {
- _defaultValue = value;
- }
-
- public boolean isRequired() {
- return _required;
- }
-
- public void setRequired(boolean required) {
- this._required = required;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/BindingHandlerDelegate.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/BindingHandlerDelegate.java
deleted file mode 100644
index ec88bcf5b..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/BindingHandlerDelegate.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.jst.pagedesigner.utils.StructuredModelUtil;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMModel;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public class BindingHandlerDelegate implements IBindingHandler {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.IBindingHandler#handleBinding(org.eclipse.swt.widgets.Shell,
- * org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode,
- * org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement,
- * java.lang.String)
- */
- public String handleBinding(Shell shell, IDOMNode ancester,
- IDOMElement element, String currentValue) {
- IBindingHandler handler = getDelegatedHandler(ancester, element);
- if (handler != null) {
- return handler
- .handleBinding(shell, ancester, element, currentValue);
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.IBindingHandler#isEnabled(org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode,
- * org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement)
- */
- // public boolean isEnabled(IDOMNode ancester, IDOMElement element)
- // {
- // IBindingHandler handler = getDelegatedHandler(ancester, element);
- // return (handler == null) ? false : handler.isEnabled(ancester, element);
- // }
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.IBindingHandler#isEnabled(org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode,
- * org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement,
- * java.lang.String, java.lang.String,
- * org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor)
- */
- public boolean isEnabled(IDOMNode ancester, IDOMElement element,
- String uri, String tagName, IAttributeDescriptor attr) {
- IBindingHandler handler = getDelegatedHandler(ancester, element);
- return (handler == null) ? false : handler.isEnabled(ancester, element,
- uri, tagName, attr);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.IBindingHandler#getImage()
- */
- public Image getImage() {
- return PDPlugin.getDefault().getImage("PD_Binding.gif");
- }
-
- public Image getDisabledImage() {
- return PDPlugin.getDefault().getImage("PD_Binding_disabled.gif");
- }
-
- private IBindingHandler getDelegatedHandler(IDOMNode ancester,
- IDOMElement element) {
- IProject project = getProject(ancester, element);
- if (project != null) {
- Object obj = project.getAdapter(IBindingHandler.class);
- if (obj instanceof IBindingHandler) {
- return (IBindingHandler) obj;
- }
- }
-
- return null;
- }
-
- private IProject getProject(IDOMNode ancester, IDOMElement element) {
- IDOMModel model = getModel(ancester, element);
- if (model != null) {
- return StructuredModelUtil.getProjectFor(model);
- }
- return null;
- }
-
- private IDOMModel getModel(IDOMNode ancester, IDOMElement element) {
- if (ancester != null) {
- return ancester.getModel();
- } else if (element != null) {
- return element.getModel();
- } else {
- return null;
- }
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/EditorCreator.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/EditorCreator.java
deleted file mode 100644
index c436fdbaa..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/EditorCreator.java
+++ /dev/null
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
-import org.eclipse.jst.pagedesigner.meta.internal.DefaultEditorCreator;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public abstract class EditorCreator {
- static EditorCreator _instance;
-
- static IBindingHandler _defaultHandler = new BindingHandlerDelegate();
-
- public static interface CellEditorHolder {
- public CellEditor createCellEditor(Composite parent);
- }
-
- /**
- * Create a dialog field without databinding using the specified attribute
- * descriptor.
- *
- * @param attr
- * @return
- */
- public abstract DialogField createDialogField(IAttributeDescriptor attr);
-
- /**
- * Create a dialog field that will have databinding support. Basically, this
- * method will create a normal dialog field using the attribute descriptor,
- * then make a wrapper on it.
- *
- * @param uri
- * the namespace uri
- * @param tagName
- * the local tag name
- * @param attr
- * @param handler
- * if null, system default mechanism will be used.
- * @return
- */
- public abstract DialogField createDialogFieldWithWrapper(String uri,
- String tagName, IAttributeDescriptor attr, IBindingHandler handler);
-
- /**
- * Create a cell editor.
- *
- * @param parent
- * @param attr
- * @param element
- * @return
- */
- public abstract CellEditor createCellEditor(Composite parent,
- IAttributeDescriptor attr, IDOMElement element);
-
- /**
- * Create a cell editor that will have databinding support.
- *
- * @param parent
- * @param attr
- * @param element
- * @param handler
- * if null, system default mechanism will be used.
- * @return
- */
- public abstract CellEditor createCellEditorWithWrapper(Composite parent,
- IAttributeDescriptor attr, IDOMElement element,
- IBindingHandler handler);
-
- /**
- * Create a cell edtior that will have databinding support. This method
- * don't provide an attribute descriptor, but it provide a CellEditorHolder
- * to create whatever normal cell editor it wants.
- *
- * @param parent
- * @param attr
- * could be null
- * @param holder
- * @param element
- * @param handler
- * if null, system default mechanism will be used.
- * @return
- */
- public abstract CellEditor createCellEditorWithWrapper(Composite parent,
- IAttributeDescriptor attr, CellEditorHolder holder,
- IDOMElement element, IBindingHandler handler);
-
- public static EditorCreator getInstance() {
- if (_instance == null) {
- _instance = new DefaultEditorCreator();
- }
- return _instance;
- }
-
- public IBindingHandler getSystemDefaultBindingHandler() {
- return _defaultHandler;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeCellEditorFactory.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeCellEditorFactory.java
deleted file mode 100644
index 105395a7c..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeCellEditorFactory.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
-import org.eclipse.swt.widgets.Composite;
-import org.w3c.dom.Element;
-
-/**
- * Factory for creating CellEditors to edit element attributes.
- *
- * @author mengbo
- */
-public interface IAttributeCellEditorFactory {
- /**
- * create cell editor
- *
- * @param parent
- * @param attr
- * @param ele
- * @return null means failed to create cell editor
- */
- public CellEditor createCellEditor(Composite parent,
- IAttributeDescriptor attr, Element ele);
-
- /**
- * Normally, the DialogField for an attribute may appear in the following
- * places.
- * <ol>
- * <li>In the Quick Editor properties view, used to edit an element.
- * <li>In a dialog to edit an element
- * <li>In a dialog, to create an element
- * </ol>
- *
- * It is the caller's responsibility to add valueChanged listener to the
- * dialog field to decide how to apply the value.
- *
- * It is also the caller's responsibility to set the initial value of the
- * field.
- *
- * The field should always be an instanceof <code>ISupportTextValue</code>,
- * it could also optionally implement <code>IElementContextable</code>
- *
- * @param attr
- * the attribute descriptor, meta data
- * @return A dialog field. null means this factory can't create one.
- *
- * @see org.eclipse.jst.jsf.common.ui.internal.dialogfield.ISupportTextValue
- */
- public DialogField createDialogField(IAttributeDescriptor attr);
-
- /**
- * The value types supported by this factory.
- *
- * @return null means this factory can behave as default factory.
- */
- public String[] getSupportedValueTypes();
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeDescriptor.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeDescriptor.java
deleted file mode 100644
index 16532190e..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IAttributeDescriptor.java
+++ /dev/null
@@ -1,105 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta;
-
-import java.util.Map;
-
-/**
- *
- * @author mengbo
- */
-public interface IAttributeDescriptor {
- public static final String PARAMETER_SUFFIX = "suffix";
-
- public static final String PARAMETER_STYLE = "style";
-
- public static final String PARAMETER_SUPER_TYPE = "superType";
-
- public static final String PARAMETER_SEPARATOR = "separator";
-
- public static final String PARAMETER_DEFAULT = "default";
-
- /**
- * get the name of the attribute.
- *
- * @return
- */
- public String getAttributeName();
-
- /**
- * Returns a brief description of this property. This localized string is
- * shown to the user when this property is selected. and it is used as
- * tooltip of the property now.
- *
- * @return a brief description, or <code>null</code> if none
- */
- public String getDescription();
-
- /**
- * return the category for this attribute.
- *
- * @return
- */
- public String getCategory();
-
- /**
- * value type is used to construct the cell editor.
- *
- * @return
- */
- public String getValueType();
-
- /**
- * Some value type contains additional parameter information. For example,
- * if valueType is CLASSNAME, the typeParameter could be super
- * interface/super class name.
- *
- * NOTE: if valueType is ENUMERATION, caller should use
- * <code>getOptions()</code>
- *
- * @return null if there is no type parameter.
- */
- public String getTypeParameter();
-
- public String getParameterByName(String name);
-
- /**
- * when the value type is "enumeration", this method will be called to
- * construct the drop downlist.
- *
- * The Map will be (key->display string)
- *
- * @return
- */
- public Map getOptions();
-
- /**
- * Gets the default value of Options
- *
- * @return
- */
- public String getDefaultValue();
-
- /**
- * A human readable string as the label of the attribute.
- *
- * @return
- */
- public String getLabelString();
-
- /**
- * Indicate whether the attribute is required.
- *
- * @return
- */
- public boolean isRequired();
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IBindingHandler.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IBindingHandler.java
deleted file mode 100644
index a93a7804b..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IBindingHandler.java
+++ /dev/null
@@ -1,70 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta;
-
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Shell;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMNode;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public interface IBindingHandler {
- /**
- * This handler should open a dialog to accept user input.
- *
- * @param shell
- * @param ancester
- * @param element
- * @param currentValue
- * @return null means user canceled the operation.
- */
- public String handleBinding(Shell shell, IDOMNode ancester,
- IDOMElement element, String currentValue);
-
- /**
- * Whether should the binding be enabled for the specified element context.
- * element could be null.
- *
- * @param ancester
- * @param element
- * @param uri
- * @param tagName
- * @param attr
- * could be null.
- * @return
- */
- public boolean isEnabled(IDOMNode ancester, IDOMElement element,
- String uri, String tagName, IAttributeDescriptor attr);
-
- /**
- * given the meta data of an attribute, to see whether should enable binding
- * handler for it.
- *
- * @param uri
- * @param tagName
- * @param attr
- * @return
- */
- // public boolean isEnabled(String uri, String tagName, IAttributeDescriptor
- // attr);
- /**
- * Image used for the small button.
- *
- * @return
- */
- public Image getImage();
-
- public Image getDisabledImage();
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/ICMRegistry.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/ICMRegistry.java
deleted file mode 100644
index 060795a11..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/ICMRegistry.java
+++ /dev/null
@@ -1,34 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta;
-
-/**
- *
- * @author mengbo
- */
-public interface ICMRegistry {
- /**
- * get the URI supported by this registry.
- *
- * @return null if this is the global registry that support all the URI.
- */
- public String getSupportedURI();
-
- /**
- * get element descriptor by URI and tagname.
- *
- * @param uri
- * @param tagname
- * @return
- */
- public IElementDescriptor getElementDescriptor(String uri, String tagname);
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IElementDescriptor.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IElementDescriptor.java
deleted file mode 100644
index 78a819ca2..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IElementDescriptor.java
+++ /dev/null
@@ -1,66 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta;
-
-/**
- *
- * @author mengbo
- */
-public interface IElementDescriptor {
- /**
- * get the tagname
- *
- * @return
- */
- public String getTagName();
-
- /**
- * get the namespace URI
- *
- * @return
- */
- public String getNamespaceURI();
-
- /**
- * get all attribute descriptors
- *
- * @return
- */
- public IAttributeDescriptor[] getAttributeDescriptors();
-
- public IAttributeDescriptor getAttributeDescriptor(String attributeName);
-
- /**
- * get attribute descriptor by name
- *
- * @param attrname
- * @return
- */
- // public IAttributeDescriptor getAttributeDescriptor(String attrname);
- /**
- * get reference. The ElementDescriptor being referenced may provide more
- * information. For example, &lt;h:inputText&gt; may reference
- * &lt;input&gt;. So those attribute descriptor not provided by
- * &lt;h:inputText&gt; could still be provided by &lt;input&gt;.
- *
- * @return
- */
- public IElementDescriptor getReference();
-
- /**
- * if this element have eclipse help topic, then could use this method to
- * return a context id.
- *
- * @return could be null
- */
- public String getHelpContextID();
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IValueType.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IValueType.java
deleted file mode 100644
index f6e930cb4..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/IValueType.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta;
-
-/**
- * All value types will be upcased.
- *
- * @author mengbo
- */
-public interface IValueType {
- // shared for html and jsf
- public static final String CSSSTYLE = "CSSSTYLE";
-
- public static final String CSSCLASS = "CSSCLASS";
-
- public static final String CSSID = "CSSID";
-
- public static final String ENUMERATED = "ENUMERATED";
-
- public static final String BOOLEAN = "BOOLEAN";
-
- public static final String RELATIVEPATH = "RELATIVEPATH";
-
- public static final String WEBPATH = "WEBPATH";
-
- public static final String COLOR = "COLOR";
-
- public static final String NAMED_BOOLEAN = "NAMED-BOOLEAN";
-
- // for jsf only
- public static final String METHODBINDING = "METHODBINDING";
-
- public static final String CLASSNAME = "CLASSNAME";
-
- // new types
- public static final String LINK = "LINK";
-
- public static final String JAVASCRIPT = "JAVASCRIPT";
-
- public static final String PROPERTYBINDING = "PROPERTYBINDING";
-
- public static final String TIMEZONE = "TIMEZONE";
-
- public static final String CLASSPATH_RESOURCE = "CLASSPATH_RESOURCE";
-
- public static final String CURRENCYCODE = "CURRENCYCODE";
-
- public static final String LOCALE = "LOCALE";
-
- public static final String MULTICHOICE = "MULTICHOICE";
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CMRegistry.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CMRegistry.java
deleted file mode 100644
index 42309579f..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CMRegistry.java
+++ /dev/null
@@ -1,206 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta.internal;
-
-import java.lang.reflect.InvocationTargetException;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.IConfigurationElement;
-import org.eclipse.core.runtime.IExtensionPoint;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.Platform;
-import org.eclipse.jface.dialogs.ProgressMonitorDialog;
-import org.eclipse.jface.operation.IRunnableWithProgress;
-import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
-import org.eclipse.jst.jsf.core.internal.tld.ITLDConstants;
-import org.eclipse.jst.pagedesigner.IJMTConstants;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.jst.pagedesigner.meta.ICMRegistry;
-import org.eclipse.jst.pagedesigner.meta.IElementDescriptor;
-import org.osgi.framework.Bundle;
-
-/**
- * XXX: temp implementation. In the future, will need add more things to allow
- * other plugins to contribute things.
- *
- * @author mengbo
- */
-public class CMRegistry implements ICMRegistry {
- static Logger _log = PDPlugin.getLogger(CMRegistry.class);
-
- private Map _htmlMap = new HashMap();
-
- private Map _jspMap = new HashMap();
-
- private List _contributedRegistries = new ArrayList();
-
- private static CMRegistry _instance = null;
-
- public static ICMRegistry getInstance() {
- if (_instance == null) {
- _instance = new CMRegistry();
- }
- return _instance;
- }
-
- /**
- *
- */
- private CMRegistry() {
- ProgressMonitorDialog progress = new ProgressMonitorDialog(null);
- try {
- progress.run(true, false, new IRunnableWithProgress() {
- public void run(IProgressMonitor monitor)
- throws InvocationTargetException {
- try {
- monitor
- .beginTask(
- PDPlugin
- .getResourceString("CMRegistry.ReadConfigration"),
- IProgressMonitor.UNKNOWN);
- monitor
- .subTask(PDPlugin
- .getResourceString("CMRegistry.HTMLConfigration"));
- loadCM("configs/cm/html.xml", _htmlMap);
- monitor
- .subTask(PDPlugin
- .getResourceString("CMRegistry.JSPConfigration"));
- loadCM("configs/cm/jsp.xml", _jspMap);
- monitor
- .subTask(PDPlugin
- .getResourceString("CMRegistry.OtherConfigration"));
- readExtensions();
- } finally {
- monitor.done();
- }
- }
- });
- } catch (InvocationTargetException e) {
- // ignore
- } catch (InterruptedException e) {
- // ignore
- }
- }
-
- /**
- *
- */
- private void readExtensions() {
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
- .getExtensionPoint(PDPlugin.getPluginId(),
- IJMTConstants.EXTENSION_POINT_CMREGISTRY);
- IConfigurationElement[] eles = extensionPoint
- .getConfigurationElements();
-
- for (int i = 0; i < eles.length; i++) {
- if (eles[i].getName().equals("registry")) {
- String uri = eles[i].getAttribute("uri");
- if (uri == null || uri.length() == 0) {
- // no uri, skip
- continue;
- }
- String configFile = eles[i].getAttribute("configFile");
- if (configFile != null && configFile.length() > 0) {
- String bundleName = eles[i].getDeclaringExtension()
- .getContributor().getName();
- try {
- Bundle bundle = Platform.getBundle(bundleName);
- URL cmFileUrl = bundle.getEntry(configFile);
- SimpleCMRegistry reg = new SimpleCMRegistry(uri,
- cmFileUrl);
- _contributedRegistries.add(reg);
- } catch (Exception ex) {
- // will not happen. skip
- ex.printStackTrace();
- }
- }
- String className = eles[i].getAttribute("class");
- if (className != null && className.length() > 0) {
- try {
- Object obj = eles[i].createExecutableExtension("class");
-
- if (obj instanceof ICMRegistry) {
- _contributedRegistries.add(obj);
- }
- } catch (CoreException e) {
- // ignore the exception
- e.printStackTrace();
- }
- }
- }
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.ICMRegistry#getSupportedURI()
- */
- public String getSupportedURI() {
- return null;
- }
-
- private void loadCM(String fileName, Map map) {
- try {
- URL url = PDPlugin.getDefault().getBundle().getEntry(fileName);
- ElementDescReader reader = new ElementDescReader(url);
- reader.readElements(map);
- } catch (Exception e) {
- _log.error("Error loading " + fileName + ": " + e.getMessage());
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.ICMRegistry#getElementDescriptor(java.lang.String,
- * java.lang.String)
- */
- public IElementDescriptor getElementDescriptor(String uri, String tagname) {
- if (uri == null) {
- uri = ITLDConstants.URI_HTML;
- }
- if (ITLDConstants.URI_HTML.equals(uri)) {
- IElementDescriptor desc = getHTMLElementDescriptor(tagname);
- if (desc != null) {
- return desc;
- }
- }
- if (ITLDConstants.URI_JSP.equals(uri)) {
- return getJSPElementDescriptor(tagname);
- }
- for (int i = 0, size = _contributedRegistries.size(); i < size; i++) {
- ICMRegistry reg = (ICMRegistry) _contributedRegistries.get(i);
- if (uri.equals(reg.getSupportedURI())) {
- IElementDescriptor ret = reg.getElementDescriptor(uri, tagname);
- if (ret != null) {
- return ret;
- }
- }
- }
-
- return null;
- }
-
- private IElementDescriptor getHTMLElementDescriptor(String tagname) {
- return (IElementDescriptor) _htmlMap.get(tagname.toLowerCase());
- }
-
- private IElementDescriptor getJSPElementDescriptor(String tagname) {
- return (IElementDescriptor) _jspMap.get(tagname.toLowerCase());
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java
deleted file mode 100644
index 1696c7c81..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CategoryNameComparator.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta.internal;
-
-import java.util.Comparator;
-import java.util.HashSet;
-
-import org.eclipse.jst.pagedesigner.properties.ITabbedPropertiesConstants;
-
-/**
- * @author mengbo
- */
-public class CategoryNameComparator implements Comparator {
- static HashSet _pairs = new HashSet();
-
- private static CategoryNameComparator _instance = new CategoryNameComparator();
-
- static class Pair {
- String s1;
-
- String s2;
-
- Pair(String a, String b) {
- s1 = a;
- s2 = b;
- }
-
- public int hashCode() {
- return s1.hashCode() + s2.hashCode();
- }
-
- public boolean equals(Object o) {
- if (o instanceof Pair) {
- Pair p = (Pair) o;
- return s1.equals(p.s1) && s2.equals(p.s2);
- }
- return false;
- }
- }
-
- public static void addPair(String s1, String s2) {
- _pairs.add(new Pair(s1, s2));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
- */
- public int compare(Object o1, Object o2) {
- if (o1.equals(o2))
- return 0;
-
- if (ITabbedPropertiesConstants.OTHER_CATEGORY.equals(o1))
- return 1;
- if (ITabbedPropertiesConstants.OTHER_CATEGORY.equals(o2))
- return -1;
-
- Pair p = new Pair((String) o1, (String) o2);
- if (_pairs.contains(p))
- return -1;
- return 1;
- }
-
- public static CategoryNameComparator getInstance() {
- return _instance;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFacRegistryReader.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFacRegistryReader.java
deleted file mode 100644
index 20b98a9e6..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFacRegistryReader.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta.internal;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.eclipse.core.runtime.CoreException;
-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.jst.pagedesigner.IJMTConstants;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.jst.pagedesigner.meta.IAttributeCellEditorFactory;
-
-/**
- * Read the registry to find out all the CellEditorFactory.
- *
- * @author mengbo
- */
-public class CellEditorFacRegistryReader {
- static IAttributeCellEditorFactory[] _factories = null;
-
- public static synchronized IAttributeCellEditorFactory[] getAllFactories() {
- if (_factories == null) {
- _factories = readAllFactories();
- }
- return _factories;
-
- }
-
- private static IAttributeCellEditorFactory[] readAllFactories() {
- List result = new ArrayList();
- IExtensionPoint extensionPoint = Platform.getExtensionRegistry()
- .getExtensionPoint(PDPlugin.getPluginId(),
- IJMTConstants.EXTENSION_POINT_PAGEDESIGNER);
- IExtension[] extensions = extensionPoint.getExtensions();
-
- for (int i = 0; i < extensions.length; i++) {
- IExtension ext = extensions[i];
- IConfigurationElement[] facs = ext.getConfigurationElements();
-
- for (int j = 0; j < facs.length; j++) {
- if (facs[j].getName().equals(
- IJMTConstants.ATTRIBUTE_CELLEDITOR_FACTORY)) {
- facs[j].getAttribute("class");
- Object obj;
- try {
- obj = facs[j].createExecutableExtension("class");
-
- if (obj instanceof IAttributeCellEditorFactory) {
- result.add(obj);
- }
- } catch (CoreException e) {
- // ignore the exception
- e.printStackTrace();
- }
- }
- }
- }
- IAttributeCellEditorFactory[] ret = new IAttributeCellEditorFactory[result
- .size()];
- result.toArray(ret);
- return ret;
- }
-
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFactoryRegistry.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFactoryRegistry.java
deleted file mode 100644
index 158c98da1..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/CellEditorFactoryRegistry.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta.internal;
-
-import java.lang.reflect.Field;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
-import org.eclipse.jst.jsf.common.ui.internal.dialogfield.ISupportTextValue;
-import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringDialogField;
-import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.jst.pagedesigner.meta.IAttributeCellEditorFactory;
-import org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor;
-import org.eclipse.jst.pagedesigner.meta.IValueType;
-import org.eclipse.jst.pagedesigner.properties.celleditors.CellEditorFactory;
-import org.eclipse.swt.widgets.Composite;
-import org.w3c.dom.Element;
-
-/**
- * CellEditorFactoryRegistry also read information from plugin.xml extension to
- * allow other plugins to contribute new kinds of cell editors.
- *
- * @author mengbo
- */
-public class CellEditorFactoryRegistry {
- private static final Logger _log = PDPlugin
- .getLogger(CellEditorFactoryRegistry.class);
-
- private static CellEditorFactoryRegistry _instance;
-
- private Map _factoryMap = new HashMap();
-
- private List _defaultFactories = new ArrayList();
-
- public static CellEditorFactoryRegistry getInstance() {
- if (_instance == null) {
- _instance = new CellEditorFactoryRegistry();
- }
- return _instance;
- }
-
- private CellEditorFactoryRegistry() {
- IAttributeCellEditorFactory[] facs = CellEditorFacRegistryReader
- .getAllFactories();
- if (facs != null) {
- for (int i = 0; i < facs.length; i++) {
- addCellEditorFactory(facs[i]);
- }
- }
- addCellEditorFactory(new CellEditorFactory());
- }
-
- public void addCellEditorFactory(IAttributeCellEditorFactory fac) {
- String[] types = fac.getSupportedValueTypes();
- if (types == null || types.length == 0) {
- _defaultFactories.add(fac);
- } else {
- for (int i = 0; i < types.length; i++) {
- _factoryMap.put(types[i].toUpperCase(), fac);
- }
- }
- }
-
- public CellEditor createCellEditor(Composite parent,
- IAttributeDescriptor attr, Element element) {
- String type = attr.getValueType();
- if (type == null || type.length() == 0)
- return null;
- type = type.toUpperCase();
-
- CellEditor result = null;
- IAttributeCellEditorFactory fac = (IAttributeCellEditorFactory) _factoryMap
- .get(type);
- if (fac != null) {
- result = fac.createCellEditor(parent, attr, element);
- }
- if (result == null) {
- for (int i = 0, size = _defaultFactories.size(); i < size; i++) {
- result = ((IAttributeCellEditorFactory) _defaultFactories
- .get(i)).createCellEditor(parent, attr, element);
- if (result != null)
- break;
- }
- }
- return result;
- }
-
- /**
- *
- * @param attr
- * @param context
- * @param ele
- * @return will never be null
- */
- public DialogField createDialogField(IAttributeDescriptor attr) {
- String type = attr.getValueType();
- if (type == null || type.length() == 0) {
- DialogField result = createTextDialogField(attr);
- result.setLabelText(attr.getLabelString() + ":"); //$NON-NLS-1$
- return result;
- }
- type = type.toUpperCase();
-
- DialogField result = null;
- IAttributeCellEditorFactory fac = (IAttributeCellEditorFactory) _factoryMap
- .get(type);
- if (fac != null) {
- result = fac.createDialogField(attr);
- }
- if (result == null) {
- for (int i = 0, size = _defaultFactories.size(); i < size; i++) {
- result = ((IAttributeCellEditorFactory) _defaultFactories
- .get(i)).createDialogField(attr);
- if (result != null) {
- break;
- }
- }
- }
- if (result == null) {
- result = createTextDialogField(attr);
- }
- if (!(result instanceof ISupportTextValue)) {
- result = createTextDialogField(attr);
- }
- result.setLabelText(attr.getLabelString() + ":"); //$NON-NLS-1$
- return result;
- }
-
- /**
- * @param attr
- * @param context
- * @param ele
- * @return
- */
- public DialogField createTextDialogField(IAttributeDescriptor attr) {
- StringDialogField field = new StringDialogField();
- field.setLabelText(attr.getLabelString());
- field.setRequired(attr.isRequired());
- field.setToolTip(attr.getDescription());
- return field;
- }
-
- /**
- * This is NOT a product method. It should only be used by testing code.
- *
- * @return
- */
- public String[] getAllValueTypes() {
- Set valueTypes = new HashSet();
- for (Iterator iter = _factoryMap.values().iterator(); iter.hasNext();) {
- IAttributeCellEditorFactory fac = (IAttributeCellEditorFactory) iter
- .next();
- String[] supportedTypes = fac.getSupportedValueTypes();
-
- if (supportedTypes != null) {
- for (int i = 0; i < supportedTypes.length; i++) {
- valueTypes.add(supportedTypes[i]);
- }
- }
- }
- // add those default ones.
- Field[] fields = IValueType.class.getFields();
- for (int i = 0; i < fields.length; i++) {
- int modifiers = fields[i].getModifiers();
- if (Modifier.isStatic(modifiers) && Modifier.isFinal(modifiers)) {
- if (fields[i].getType() == String.class) {
- try {
- valueTypes.add(fields[i].get(null));
- } catch (IllegalArgumentException ex) {
- // "Error in fields retrieving:"
- _log.info("CellEditorFactoryRegistry.Info.2", ex); //$NON-NLS-1$
- } catch (IllegalAccessException ex) {
- // "Error in fields retrieving:"
- _log.info("CellEditorFactoryRegistry.Info.3", ex); //$NON-NLS-1$
- }
- }
- }
- }
- String[] ret = new String[valueTypes.size()];
- valueTypes.toArray(ret);
- return ret;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/DefaultEditorCreator.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/DefaultEditorCreator.java
deleted file mode 100644
index 71fbc24a6..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/DefaultEditorCreator.java
+++ /dev/null
@@ -1,226 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta.internal;
-
-import org.eclipse.jface.viewers.CellEditor;
-import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
-import org.eclipse.jst.jsf.core.internal.tld.CMUtil;
-import org.eclipse.jst.pagedesigner.meta.EditorCreator;
-import org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor;
-import org.eclipse.jst.pagedesigner.meta.IBindingHandler;
-import org.eclipse.jst.pagedesigner.properties.celleditors.CellEditorWrapper;
-import org.eclipse.jst.pagedesigner.ui.dialogfields.DialogFieldWrapper;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public class DefaultEditorCreator extends EditorCreator {
- static IAttributeDescriptor _staticAttr;
-
- static IDOMElement _staticElement;
-
- static IBindingHandler _staticHandler;
-
- static CellEditorHolder _staticHolder;
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.EditorCreator#createCellEditor(org.eclipse.swt.widgets.Composite,
- * org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor,
- * org.w3c.dom.Element)
- */
- public CellEditor createCellEditor(Composite parent,
- IAttributeDescriptor attr, IDOMElement element) {
- return CellEditorFactoryRegistry.getInstance().createCellEditor(parent,
- attr, element);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.EditorCreator#createDialogField(org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor)
- */
- public DialogField createDialogField(IAttributeDescriptor attr) {
- return CellEditorFactoryRegistry.getInstance().createDialogField(attr);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.EditorCreator#createCellEditorWithWrapper(org.eclipse.swt.widgets.Composite,
- * org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor,
- * org.w3c.dom.Element,
- * org.eclipse.jst.pagedesigner.meta.IBindingHandler,
- * org.eclipse.swt.graphics.Image)
- */
- public CellEditor createCellEditorWithWrapper(Composite parent,
- IAttributeDescriptor attr, final IDOMElement element,
- IBindingHandler handler1) {
- final IBindingHandler handler = (handler1 == null ? getSystemDefaultBindingHandler()
- : handler1);
- String uri = CMUtil.getElementNamespaceURI(element);
- String tagName = element.getLocalName();
- if (!handler.isEnabled(element, element, uri, tagName, attr)) {
- // should not enabled, so directly return original cell editor
- return createCellEditor(parent, attr, element);
- }
- try {
- // since "createWrappedCellEditor()" and "getBindingImage()" is
- // called from the constructor of CellEditorWrapper, at that time,
- // can't reference this DefaultEditorCreator and final fields yet,
- // so use static variable for it.
- _staticAttr = attr;
- _staticElement = element;
- _staticHandler = handler;
-
- return new CellEditorWrapper(parent) {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.properties.celleditors.CellEditorWrapper#createWrappedCellEditor(org.eclipse.swt.widgets.Composite)
- */
- protected CellEditor createWrappedCellEditor(Composite cell) {
- return EditorCreator.getInstance().createCellEditor(cell,
- _staticAttr, _staticElement);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.properties.celleditors.CellEditorWrapper#openDialogBox(org.eclipse.swt.widgets.Control)
- */
- protected Object openDialogBox(Control cellEditorWindow) {
- return handler.handleBinding(cellEditorWindow.getShell(),
- element, element, convertToString(this.getValue()));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.properties.celleditors.CellEditorWrapper#getBindingImage()
- */
- protected Image getBindingImage() {
- return _staticHandler.getImage();
- }
- };
- } finally {
- _staticAttr = null;
- _staticElement = null;
- _staticHandler = null;
- _staticHolder = null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.EditorCreator#createCellEditorWithWrapper(org.eclipse.swt.widgets.Composite,
- * org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor,
- * org.eclipse.jst.pagedesigner.meta.EditorCreator.CellEditorHolder,
- * org.eclipse.wst.xml.core.internal.provisional.document.IDOMElement,
- * org.eclipse.jst.pagedesigner.meta.IBindingHandler)
- */
- public CellEditor createCellEditorWithWrapper(Composite parent,
- IAttributeDescriptor attr, CellEditorHolder holder,
- final IDOMElement element, IBindingHandler handler1) {
- final IBindingHandler handler = (handler1 == null ? getSystemDefaultBindingHandler()
- : handler1);
- String uri = CMUtil.getElementNamespaceURI(element);
- String tagName = element.getLocalName();
- if (!handler.isEnabled(element, element, uri, tagName, attr)) {
- // should not enabled, so directly return original cell editor
- return holder.createCellEditor(parent);
- }
- try {
- // since "createWrappedCellEditor()" and "getBindingImage()" is
- // called from the constructor of CellEditorWrapper, at that time,
- // can't reference this DefaultEditorCreator and final fields yet,
- // so use static variable for it.
- _staticElement = element;
- _staticHandler = handler;
- _staticHolder = holder;
-
- return new CellEditorWrapper(parent) {
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.properties.celleditors.CellEditorWrapper#createWrappedCellEditor(org.eclipse.swt.widgets.Composite)
- */
- protected CellEditor createWrappedCellEditor(Composite cell) {
- return _staticHolder.createCellEditor(cell);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.properties.celleditors.CellEditorWrapper#openDialogBox(org.eclipse.swt.widgets.Control)
- */
- protected Object openDialogBox(Control cellEditorWindow) {
- return handler.handleBinding(cellEditorWindow.getShell(),
- element, element, convertToString(this.getValue()));
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.properties.celleditors.CellEditorWrapper#getBindingImage()
- */
- protected Image getBindingImage() {
- return _staticHandler.getImage();
- }
- };
- } finally {
- _staticAttr = null;
- _staticElement = null;
- _staticHandler = null;
- _staticHolder = null;
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.EditorCreator#createDialogFieldWithWrapper(java.lang.String,
- * java.lang.String,
- * org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor,
- * org.eclipse.jst.pagedesigner.meta.IBindingHandler)
- */
- public DialogField createDialogFieldWithWrapper(String uri, String tagName,
- IAttributeDescriptor attr, IBindingHandler handler1) {
- final IBindingHandler handler = (handler1 == null ? getSystemDefaultBindingHandler()
- : handler1);
- DialogField field = createDialogField(attr);
- // if (field instanceof StringButtonDialogField)
- // {
- // ((StringButtonDialogField) field).setButtonLabel("...");
- // }
- DialogFieldWrapper wrapper = new DialogFieldWrapper(field, handler
- .getImage(), handler.getDisabledImage(), uri, tagName, attr,
- handler);
- wrapper.setDatabindingEnabled(true);
-
- return wrapper;
- }
-
- private String convertToString(Object value) {
- if (value == null) {
- return null;
- }
- return value.toString();
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/ElementDescReader.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/ElementDescReader.java
deleted file mode 100644
index 7fc17650b..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/ElementDescReader.java
+++ /dev/null
@@ -1,433 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta.internal;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.net.URL;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-import java.util.PropertyResourceBundle;
-import java.util.ResourceBundle;
-import java.util.Set;
-import java.util.StringTokenizer;
-
-import javax.xml.parsers.DocumentBuilder;
-import javax.xml.parsers.DocumentBuilderFactory;
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
-import org.eclipse.jst.jsf.common.ui.internal.utils.ResourceUtils;
-import org.eclipse.jst.pagedesigner.PDPlugin;
-import org.eclipse.jst.pagedesigner.meta.AttributeDescriptor;
-import org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor;
-import org.w3c.dom.Document;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-import org.xml.sax.SAXException;
-
-/**
- * @author mengbo
- */
-public class ElementDescReader {
- private static Logger _log = PDPlugin.getLogger(ElementDescReader.class);
-
- private Map _definedCategoryMap = new HashMap();
-
- private Map _definedAttributeMap = new HashMap();
-
- private URL _url;
-
- private String[] _optimizedLocales = null;
-
- public ElementDescReader(URL url) {
- this._url = url;
- }
-
- /**
- * Read xml information and fill the map
- *
- * @param stream
- * xml file stream
- * @param map
- * @throws ParserConfigurationException
- * @throws FactoryConfigurationError
- * @throws SAXException
- * @throws IOException
- */
- public void readElements(Map map) throws ParserConfigurationException,
- FactoryConfigurationError, SAXException, IOException {
- DocumentBuilder builder = DocumentBuilderFactory.newInstance()
- .newDocumentBuilder();
- InputStream stream = this._url.openStream();
- Document doc = builder.parse(stream);
- ResourceUtils.ensureClosed(stream);
-
- Element taglib = doc.getDocumentElement();
- String nameSpace = taglib.getAttribute("uri");
-
- NodeList list = doc.getElementsByTagName("tag");
- if (list != null && list.getLength() != 0) {
- int size = list.getLength();
- for (int i = 0; i < size; i++) {
- Element tag = (Element) list.item(i);
- ElementDescriptor desc = new ElementDescriptor();
- desc.setTagName(tag.getAttribute("name"));
- desc.setNamespaceURI(nameSpace);
-
- // support for help context id.
- desc.setHelpContextID(tag.getAttribute("helpContextId"));
-
- NodeList children = tag.getChildNodes();
- // first calculate category and refered category quantity
- NodeList cateNodes = tag.getElementsByTagName("category");
- NodeList referedCateNodes = tag
- .getElementsByTagName("referedcategory");
- int cateNum = 0;
- if (cateNodes != null) {
- cateNum += cateNodes.getLength();
- }
- if (referedCateNodes != null) {
- cateNum += referedCateNodes.getLength();
- }
-
- if (cateNum > 0) {
- int length = children.getLength();
- String[] cates = new String[cateNum];
- List attrList = new ArrayList();
- int realCate = 0;
- for (int j = 0; j < length; j++) {
- Node node = children.item(j);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element element = (Element) node;
- String tagName = element.getTagName();
- if ("category".equals(tagName)
- || "referedcategory".equals(tagName)) {
- String categoryName = element
- .getAttribute("name");
- if (categoryName != null
- && !"".equals(categoryName)) {
- cates[realCate++] = categoryName;
- parseCategory(element, element, attrList);
- } else {
- Element definedCategory = handleReference(
- doc, element, true);
- String labelKey = definedCategory
- .getAttribute("displaylabel");
- if (labelKey != null
- && !"".equals(labelKey)) {
- cates[realCate++] = getValue(labelKey);
- } else {
- cates[realCate++] = calculateDisplayLabel(definedCategory);
- }
-
- parseCategory(element, definedCategory,
- attrList);
- }
- }
- }
-
- }
-
- // for sort categories
- for (int m = 0, len = cates.length; m < len; m++) {
- for (int j = m + 1; j < len; j++) {
- CategoryNameComparator.addPair(cates[m], cates[j]);
- }
- }
- desc.setAttributeDescriptors(attrList);
- }
-
- map.put(desc.getTagName(), desc);
- }
- }
- }
-
- private String calculateDisplayLabel(Element definedElement) {
- String label = definedElement.getAttribute("displaylabel");
- return getValue(label);
- }
-
- private void parseCategory(Element category, Element definedCategory,
- List attrList) {
- String cateLabel = calculateDisplayLabel(definedCategory);
- // if the category is a referedcategory tag
- if (category != definedCategory) {
- String labelKey = category.getAttribute("displaylabel");
- if (labelKey != null && !"".equals(labelKey)) {
- cateLabel = getValue(labelKey);
- }
- }
- handleAttributes(definedCategory, cateLabel, attrList);
- if (category == definedCategory) {
- return;
- }
-
- // the category should be a referedcategory tag
- // include/add more attributes to category
- NodeList includes = category.getElementsByTagName("includeattrs");
- if (includes != null && includes.getLength() != 0) {
- Element includeAttrsTag = (Element) includes.item(0);
- handleAttributes(includeAttrsTag, cateLabel, attrList);
-
- // handle attribute override
- HashMap tempMap = new HashMap();
- Iterator itor = attrList.iterator();
- while (itor.hasNext()) {
- AttributeDescriptor adp = (AttributeDescriptor) itor.next();
- tempMap.put(adp.getAttributeName(), adp);
- }
- int listSize = attrList.size();
- int mapSize = tempMap.size();
- if (listSize != mapSize) {
- attrList.clear();
- Set set = tempMap.keySet();
- Iterator setor = set.iterator();
- while (setor.hasNext()) {
- String atName = (String) setor.next();
- AttributeDescriptor ad = (AttributeDescriptor) tempMap
- .get(atName);
- attrList.add(ad);
- }
- }
-
- }
-
- // exclude attributes from category
- NodeList excludes = category.getElementsByTagName("excludeattrs");
- if (excludes != null && excludes.getLength() != 0) {
- String displayNames = ((Element) excludes.item(0))
- .getAttribute("refs");
- StringTokenizer tokenizer = new StringTokenizer(displayNames, ", ");
-
- while (tokenizer.hasMoreTokens()) {
- String name = tokenizer.nextToken();
- Iterator itr = attrList.iterator();
- while (itr.hasNext()) {
- IAttributeDescriptor atr = (IAttributeDescriptor) itr
- .next();
- String atrName = atr.getAttributeName();
- if (name.equals(atrName)) {
- attrList.remove(atr);
- break;
- }
- }
- }
- }
- }
-
- /**
- * handle all attribute element and referedattribute element under the root
- * element
- *
- * @param root
- * @param cateLabel
- * @param list
- */
- private void handleAttributes(Element root, String cateLabel, List attrList) {
- NodeList allNodes = root.getChildNodes();
- NodeList attrNodes = root.getElementsByTagName("attribute");
- NodeList referedattrNodes = root
- .getElementsByTagName("referedattribute");
- int attrNum = 0;
- if (attrNodes != null) {
- attrNum += attrNodes.getLength();
- }
- if (referedattrNodes != null) {
- attrNum += referedattrNodes.getLength();
- }
-
- if (attrNum > 0) {
- int incAttrLength = allNodes.getLength();
- for (int i = 0; i < incAttrLength; i++) {
- Node node = allNodes.item(i);
- if (node.getNodeType() == Node.ELEMENT_NODE) {
- Element incAttr = (Element) node;
- String tagName = incAttr.getTagName();
- if ("attribute".equals(tagName)
- || "referedattribute".equals(tagName)) {
- String incAtrName = incAttr.getAttribute("name");
- Element refAttr = incAttr;
- if (incAtrName == null || "".equals(incAtrName)) {
- incAttr = handleReference(root.getOwnerDocument(),
- incAttr, false);
- }
- AttributeDescriptor attrDesc = parseAttribute(
- cateLabel, incAttr);
- String overrideName = refAttr
- .getAttribute("overridename");
- if (overrideName != null
- && !"".equalsIgnoreCase(overrideName)) {
- attrDesc.setAttributeName(overrideName);
- }
- String ovDisplayLabel = refAttr
- .getAttribute("displaylabel");
- if (ovDisplayLabel != null
- && !"".equalsIgnoreCase(ovDisplayLabel)) {
- attrDesc.setLabelString(getValue(ovDisplayLabel));
- }
- attrList.add(attrDesc);
- }
-
- }
-
- }
- }
- }
-
- private Element handleReference(Document doc, Element refElment,
- boolean isCategory) {
- String refName = refElment.getAttribute("ref");
- if (isCategory) {
- if (_definedCategoryMap.get(refName) != null) {
- Element definedCategory = (Element) _definedCategoryMap
- .get(refName);
- return definedCategory;
- }
- } else {
- if (_definedAttributeMap.get(refName) != null) {
- Element definedAttribute = (Element) _definedAttributeMap
- .get(refName);
- return definedAttribute;
- }
- }
-
- NodeList catgs = null;
- if (isCategory) {
- NodeList defineCates = doc.getElementsByTagName("categories");
- Element firstCate = (Element) defineCates.item(0);
- catgs = firstCate.getElementsByTagName("category");
- } else {
- NodeList defineCates = doc.getElementsByTagName("attributes");
- Element firstCate = (Element) defineCates.item(0);
- catgs = firstCate.getElementsByTagName("attribute");
- }
- int cateLen = catgs.getLength();
- Element definedElement = null;
- for (int n = 0; n < cateLen; n++) {
- String cateName = ((Element) catgs.item(n)).getAttribute("name");
- if (refName.equals(cateName) && !"".equals(refName)) {
- definedElement = (Element) catgs.item(n);
- break;
- }
- }
- if (isCategory) {
- _definedCategoryMap.put(refName, definedElement);
- } else {
- _definedAttributeMap.put(refName, definedElement);
- }
- return definedElement;
- }
-
- private AttributeDescriptor parseAttribute(String categoryName,
- Element attribute) {
- AttributeDescriptor attrDesc = new AttributeDescriptor();
- attrDesc.setCategory(categoryName);
-
- attrDesc.setAttributeName(attribute.getAttribute("name"));
- attrDesc.setDescription(attribute.getAttribute("description"));
- attrDesc.setValueType(attribute.getAttribute("type"));
- attrDesc.setRequired(attribute.hasAttribute("required"));
- attrDesc.setTypeParameter(attribute.getAttribute("typeparam"));
- String labelKey = attribute.getAttribute("displaylabel");
- attrDesc.setLabelString(getValue(labelKey));
-
- NodeList optionNodes = attribute.getElementsByTagName("option");
- if (optionNodes != null && optionNodes.getLength() != 0) {
- HashMap optionMap = new HashMap();
- int opLength = optionNodes.getLength();
- String defaultValue = null;
- for (int m = 0; m < opLength; m++) {
- Element optNode = (Element) optionNodes.item(m);
- String key = optNode.getAttribute("key");
- String value = optNode.getAttribute("value");
- if (value == null || value.length() == 0) {
- value = key;
- }
- if (optNode.hasAttribute("default")) {
- defaultValue = value;
- }
- optionMap.put(key, value);
- }
- attrDesc.setOptions(optionMap, defaultValue);
- }
-
- return attrDesc;
- }
-
- private String getValue(String key) {
- if (key != null && key.startsWith("%")) {
- String cmStr = this._url.toString();
- String propBaseStr = cmStr.substring(0, cmStr.lastIndexOf("."));
-
- String[] localeOptions = LocaleFallback.fallBack(Locale
- .getDefault());
- String[] options = localeOptions;
- if (_optimizedLocales != null) {
- options = _optimizedLocales;
- }
- for (int i = 0, size = options.length; i < size; i++) {
- StringBuffer sb = new StringBuffer();
- sb.append(propBaseStr);
- sb.append(options[i]);
- sb.append(".properties");
- String str = sb.toString();
-
- ResourceBundle rb = null;
- try {
- URL propUrl = new URL(str);
- rb = new PropertyResourceBundle(propUrl.openStream());
- } catch (Exception e1) {
- // we don't handle the exception here,since it is in a
- // fallback route,it is possible of not exist
- // _log.info("Info.ElementDescReader.ReadPropertyFile",
- // str);
- continue;
- }
- if (_optimizedLocales == null) {
- setOptimizedLocales(localeOptions, i);
- }
-
- String rbKey = key.substring(1);
- String value = null;
- try {
- value = rb.getString(rbKey);
- } catch (Exception e) {
- _log.info("Info.ElementDescReader.ReadPropertyFile.Key",
- rbKey, str, null);
- continue;
- }
-
- if (value != null) {
- return value;
- }
-
- }
- return null;
- }
- return key;
- }
-
- private void setOptimizedLocales(String[] originalLocales, int startPoint) {
- int size = originalLocales.length - startPoint;
- _optimizedLocales = new String[size];
- for (int i = 0; i < size; i++) {
- _optimizedLocales[i] = originalLocales[i + startPoint];
- }
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/ElementDescriptor.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/ElementDescriptor.java
deleted file mode 100644
index 8a87c0099..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/ElementDescriptor.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta.internal;
-
-import java.util.List;
-
-import org.eclipse.jst.pagedesigner.meta.IAttributeDescriptor;
-import org.eclipse.jst.pagedesigner.meta.IElementDescriptor;
-
-/**
- * @author mengbo
- */
-public class ElementDescriptor implements IElementDescriptor {
- String _tagName;
-
- String _namespaceURI;
-
- IAttributeDescriptor[] _attrs;
-
- private String _helpContextID;
-
- /**
- *
- */
- public ElementDescriptor() {
- super();
- // TODO Auto-generated constructor stub
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.IElementDescriptor#getTagName()
- */
- public String getTagName() {
- return _tagName;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.IElementDescriptor#getNamespaceURI()
- */
- public String getNamespaceURI() {
- return _namespaceURI;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.IElementDescriptor#getAttributeDescriptors()
- */
- public IAttributeDescriptor[] getAttributeDescriptors() {
- return _attrs;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.cm.IElementDescriptor#getReference()
- */
- public IElementDescriptor getReference() {
- return null;
- }
-
- public void setNamespaceURI(String namespaceURI) {
- this._namespaceURI = namespaceURI;
- }
-
- public void setTagName(String tagName) {
- this._tagName = tagName;
- }
-
- public void setAttributeDescriptors(List attrs) {
- if (attrs == null || attrs.isEmpty()) {
- _attrs = new IAttributeDescriptor[0];
- } else {
- _attrs = new IAttributeDescriptor[attrs.size()];
- attrs.toArray(_attrs);
- }
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.IElementDescriptor#getAttributeDescriptor(java.lang.String)
- */
- public IAttributeDescriptor getAttributeDescriptor(String attributeName) {
- if (_attrs != null) {
- for (int i = 0; i < _attrs.length; i++) {
- IAttributeDescriptor descriptor = _attrs[i];
- if (descriptor.getAttributeName().equalsIgnoreCase(
- attributeName)) {
- return descriptor;
- }
- }
- }
- return null;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.IElementDescriptor#getHelpContextID()
- */
- public String getHelpContextID() {
- return _helpContextID;
- }
-
- public void setHelpContextID(String contextid) {
- _helpContextID = contextid;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/LocaleFallback.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/LocaleFallback.java
deleted file mode 100644
index fa62e9497..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/LocaleFallback.java
+++ /dev/null
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta.internal;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Locale;
-import java.util.Map;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public class LocaleFallback {
- private static Map map = new HashMap();
-
- public static synchronized String[] fallBack(Locale locale) {
- if (map.get(locale) != null) {
- return (String[]) map.get(locale);
- }
- // first compute the fallback locales according to the input locale
- List inputLocaleList = calculateLocaleNames(locale);
- String[] ins = reverseList(inputLocaleList);
- // then compute the fallback locales accroding to the system default
- // locale
- int defsSize = 0;
- String[] defs = null;
- if (!locale.equals(Locale.getDefault())) {
- List defLocaleList = calculateLocaleNames(Locale.getDefault());
- defs = reverseList(defLocaleList);
- defsSize = defs.length;
- }
-
- int insSize = ins.length;
- int size = insSize + defsSize;
-
- String[] options = new String[size + 1];
- for (int i = 0; i < size; i++) {
- if (i < insSize) {
- options[i] = ins[i];
- } else {
- options[i] = defs[i - insSize];
- }
- }
- // last add blank string in order to search the base file
- options[size] = "";
- map.put(locale, options);
-
- return options;
-
- }
-
- private static List calculateLocaleNames(Locale locale) {
- List list = new ArrayList();
- StringBuffer item;
-
- String language = locale.getLanguage();
- String country = locale.getCountry();
- String variant = locale.getVariant();
-
- int languageLength = language.length();
- int countryLength = country.length();
- int variantLength = variant.length();
-
- if (languageLength == 0 && countryLength == 0 && variantLength == 0) {
- // The locale is "", "", "".
- return list;
- }
- item = new StringBuffer();
- item = item.append('_').append(language);
- list.add(item.toString());
-
- if (countryLength == 0 && variantLength == 0) {
- return list;
- }
- item.append('_').append(country);
- list.add(item.toString());
-
- if (variantLength == 0) {
- return list;
- }
- item.append('_').append(variantLength);
- list.add(item.toString());
-
- return list;
- }
-
- private static String[] reverseList(List list) {
- int size = list.size();
- String[] vals = new String[size];
- for (int i = 0; i < size; i++) {
- vals[i] = (String) list.get(size - 1 - i);
- }
- return vals;
- }
-}
diff --git a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/SimpleCMRegistry.java b/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/SimpleCMRegistry.java
deleted file mode 100644
index 6c198f4f1..000000000
--- a/jsf/plugins/org.eclipse.jst.pagedesigner/src/org/eclipse/jst/pagedesigner/meta/internal/SimpleCMRegistry.java
+++ /dev/null
@@ -1,72 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2006 Sybase, Inc. 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:
- * Sybase, Inc. - initial API and implementation
- *******************************************************************************/
-package org.eclipse.jst.pagedesigner.meta.internal;
-
-import java.io.IOException;
-import java.net.URL;
-import java.util.HashMap;
-import java.util.Map;
-
-import javax.xml.parsers.FactoryConfigurationError;
-import javax.xml.parsers.ParserConfigurationException;
-
-import org.eclipse.jst.pagedesigner.meta.ICMRegistry;
-import org.eclipse.jst.pagedesigner.meta.IElementDescriptor;
-import org.xml.sax.SAXException;
-
-/**
- * @author mengbo
- * @version 1.5
- */
-public class SimpleCMRegistry implements ICMRegistry {
- String _uri;
-
- Map _map = new HashMap();
-
- /**
- * @throws IOException
- * @throws SAXException
- * @throws FactoryConfigurationError
- * @throws ParserConfigurationException
- *
- */
- public SimpleCMRegistry(String uri, URL cmFileUrl)
- throws ParserConfigurationException, FactoryConfigurationError,
- SAXException, IOException {
- this._uri = uri;
- ElementDescReader reader = new ElementDescReader(cmFileUrl);
- reader.readElements(_map);
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.ICMRegistry#getSupportedURI()
- */
- public String getSupportedURI() {
- return _uri;
- }
-
- /*
- * (non-Javadoc)
- *
- * @see org.eclipse.jst.pagedesigner.meta.ICMRegistry#getElementDescriptor(java.lang.String,
- * java.lang.String)
- */
- public IElementDescriptor getElementDescriptor(String uri, String tagname) {
- if (uri.equals(_uri)) {
- return (IElementDescriptor) _map.get(tagname);
- }
- return null;
- }
-
-}

Back to the top