diff options
Diffstat (limited to 'rse/plugins/org.eclipse.dstore.extra/src/org/eclipse')
13 files changed, 0 insertions, 770 deletions
diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/Activator.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/Activator.java deleted file mode 100644 index 367ae369f..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/Activator.java +++ /dev/null @@ -1,59 +0,0 @@ -/******************************************************************************** - * Copyright (c) 2006 IBM Corporation. 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - ********************************************************************************/ - -package org.eclipse.dstore.extra; - -import org.eclipse.core.runtime.Plugin; -import org.osgi.framework.BundleContext; - -/** - * The main plugin class to be used in the desktop. - */ -public class Activator extends Plugin { - - //The shared instance. - private static Activator plugin; - - /** - * The constructor. - */ - public Activator() { - plugin = this; - } - - /** - * This method is called upon plug-in activation - */ - public void start(BundleContext context) throws Exception { - super.start(context); - } - - /** - * This method is called when the plug-in is stopped - */ - public void stop(BundleContext context) throws Exception { - super.stop(context); - plugin = null; - } - - /** - * @return the shared instance of this plugin. - */ - public static Activator getDefault() { - return plugin; - } - -}
\ No newline at end of file diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/DomainEvent.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/DomainEvent.java deleted file mode 100644 index 0d7117617..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/DomainEvent.java +++ /dev/null @@ -1,103 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.extra; - -import java.util.List; - - -public class DomainEvent -{ - - - public static final int UNKNOWN= 0; - public static final int INSERT= 1; - public static final int REMOVE= 2; - public static final int STRUCTURE_CHANGE= 3; - public static final int NON_STRUCTURE_CHANGE= 4; - public static final int FILE_CHANGE=5; - - - public static final int FIRST_CUSTOM_CHANGE= 10; - public static final int LAST_CUSTOM_CHANGE= 255; - - public static final int MASK= 0xFF; - public static final int REVEAL= 0x100; - public static final int SELECT= 0x200; - - public static final int INSERT_REVEAL= INSERT | REVEAL; - public static final int INSERT_REVEAL_SELECT= INSERT_REVEAL | SELECT; - - private IDataElement _parent; - private int _type; - - public DomainEvent(int type, IDataElement parent, Object property) - { - _type = type; - _parent = parent; - } - - public DomainEvent(int type, IDataElement parent, Object property, IDataElement child) - { - _type = type; - _parent = parent; - } - - - public DomainEvent(IDomainNotifier source, int type, IDataElement parent, Object property) - { - _type = type; - _parent = parent; - } - - - public boolean equals(Object event) - { - return (((DomainEvent)event).getParent() == getParent()); - } - - public String getId() - { - return _parent.getId(); - } - - public String getName() - { - return _parent.getName(); - - } - - public int getType() - { - return _type; - } - - public IDataElement getParent() - { - return _parent; - } - - public List getChildren() - { - return _parent.getNestedData(); - } - - public int getChildrenCount() - { - return _parent.getNestedSize(); - } -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IDataElement.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IDataElement.java deleted file mode 100644 index 97d2cfa8f..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IDataElement.java +++ /dev/null @@ -1,37 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.extra; - -import java.util.List; - - -public interface IDataElement extends IElement -{ - - - String getName(); - String getType(); - String getId(); - List getNestedData(); - int getNestedSize(); - - Object getElementProperty(Object obj); - List getAssociated(String key); - - boolean isOfType(String typeStr); -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IDomainListener.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IDomainListener.java deleted file mode 100644 index 1156ce856..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IDomainListener.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.extra; - - -public interface IDomainListener -{ - - public boolean listeningTo(DomainEvent e); - public void domainChanged(DomainEvent e); -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IDomainNotifier.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IDomainNotifier.java deleted file mode 100644 index 2aff9a051..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IDomainNotifier.java +++ /dev/null @@ -1,43 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2008 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * David McKnight (IBM) - [225507][api][breaking] RSE dstore API leaks non-API types - *******************************************************************************/ - -package org.eclipse.dstore.extra; - -/** - * For DataStore domain notification - * - * @noimplement This interface is not intended to be implemented by clients. - */ -public interface IDomainNotifier { - public void addDomainListener(IDomainListener listener); - - public void fireDomainChanged(DomainEvent event); - - public boolean hasDomainListener(IDomainListener listener); - - public void removeDomainListener(IDomainListener listener); - - /** - * @since 2.1 - */ - public void enable(boolean on); - - /** - * @since 2.1 - */ - public boolean isEnabled(); -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IElement.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IElement.java deleted file mode 100644 index 6037f86b4..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/extra/IElement.java +++ /dev/null @@ -1,27 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.extra; - -import org.eclipse.core.runtime.IAdaptable; - -public interface IElement extends IAdaptable -{ - - - public Object getElementProperty(Object key); -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/DataElementActionFilter.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/DataElementActionFilter.java deleted file mode 100644 index 10a685c80..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/DataElementActionFilter.java +++ /dev/null @@ -1,70 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.internal.extra; - -import org.eclipse.dstore.extra.IDataElement; - -public class DataElementActionFilter implements org.eclipse.ui.IActionFilter { - - - // constants to be used by Eclipse Filtering and Enablement Support. - private static String _type = "type"; //$NON-NLS-1$ - private static String _name = "name"; //$NON-NLS-1$ - private static DataElementActionFilter _instance; - - public static DataElementActionFilter getInstance() { - if (_instance == null) - _instance = new DataElementActionFilter(); - return _instance; - } - - /** - * Supports Eclipse filtering and enablement. - * - * The above contribution uses the RSE pop-up extension point to contribute an action - * to any single RSE object but not anything beginning with SPECIAL. - * @see IDataElementActionFilter#testAttribute(Object, String, String) - */ - public boolean testAttribute(Object target, String name, String value) { - if (name.equals(_type) && target instanceof IDataElement) { - // support for "type" filter - IDataElement le = (IDataElement) target; - if (le.getType().equals(value) || le.isOfType(value)) - return true; - } else if (name.equals(_name) && target instanceof IDataElement) { - // support for "name" filter. - IDataElement le = (IDataElement) target; - if (value.endsWith("*")) { //$NON-NLS-1$ - // we have a wild card test, and * is the last character in the value - if (le - .getName() - .startsWith(value.substring(0, value.length() - 1))) - return true; - } else if (le.getName().equals(value)) - return true; - } - - // type and name filter do not match, or we have a filter we do not support. - return false; - } - - public static boolean matches(Class aClass) { - return (aClass == org.eclipse.ui.IActionFilter.class); - } - -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/DesktopElement.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/DesktopElement.java deleted file mode 100644 index 3c9316eff..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/DesktopElement.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.internal.extra; - -import java.util.List; - -import org.eclipse.dstore.extra.IDataElement; -import org.eclipse.jface.resource.ImageDescriptor; - - -public class DesktopElement implements org.eclipse.ui.model.IWorkbenchAdapter -{ - - - private IDataElement _element; - - public DesktopElement (IDataElement e) - { - _element = e; - } - - public IDataElement toElement(Object object) - { - IDataElement element = null; - if (object instanceof IDataElement) - { - element = (IDataElement)object; - } - else - { - element = _element; - } - return element; - } - - public Object[] getChildren(Object o) - { - IDataElement element = toElement(o); - - - List objs = element.getAssociated("contents"); //$NON-NLS-1$ - return objs.toArray(); - } - - public ImageDescriptor getImageDescriptor(Object object) - { - return null; - } - - public String getLabel(Object o) - { - return (String)_element.getElementProperty("value"); //$NON-NLS-1$ - } - - public Object getParent(Object o) - { - return null; - } - - public static boolean matches(Class aClass) - { - return (aClass == org.eclipse.ui.model.IWorkbenchAdapter.class); - } - - public static Object getPlatformAdapter(Object obj, Class aClass) - { - return org.eclipse.core.runtime.Platform.getAdapterManager().getAdapter(obj, aClass); - } -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/DomainNotifier.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/DomainNotifier.java deleted file mode 100644 index 5da3a3843..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/DomainNotifier.java +++ /dev/null @@ -1,96 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2009 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * David McKnight (IBM) - [282634] [dstore] IndexOutOfBoundsException on Disconnect - *******************************************************************************/ - -package org.eclipse.dstore.internal.extra; - -import java.util.ArrayList; - -import org.eclipse.dstore.extra.DomainEvent; -import org.eclipse.dstore.extra.IDomainListener; -import org.eclipse.dstore.extra.IDomainNotifier; - -public class DomainNotifier implements IDomainNotifier -{ - - - private ArrayList _listeners; - - private boolean _enabled; - - public DomainNotifier() - { - _listeners = new ArrayList(); - _enabled = false; - } - - - - public void enable(boolean on) - { - _enabled = on; - } - - public boolean isEnabled() - { - return _enabled; - } - - public void addDomainListener(IDomainListener listener) - { - synchronized (_listeners){ - if (!_listeners.contains(listener)) - { - _listeners.add(listener); - } - } - } - - public void fireDomainChanged(DomainEvent event) - { - if (_enabled) - { - Object[] listeners = null; - - synchronized (_listeners){ - listeners = _listeners.toArray(); - } - - for (int i = 0; i < listeners.length; i++) - { - IDomainListener listener = (IDomainListener)listeners[i]; - if ((listener != null) && listener.listeningTo(event)) - { - listener.domainChanged(event); - } - } - } - } - - public boolean hasDomainListener(IDomainListener listener) - { - synchronized (_listeners){ - return _listeners.contains(listener); - } - } - - public void removeDomainListener(IDomainListener listener) - { - synchronized (_listeners){ - _listeners.remove(listener); - } - } -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/IDataElementActionFilter.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/IDataElementActionFilter.java deleted file mode 100644 index c0b553ab7..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/IDataElementActionFilter.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.internal.extra; - -public interface IDataElementActionFilter extends org.eclipse.ui.IActionFilter -{ - - -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/IDesktopElement.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/IDesktopElement.java deleted file mode 100644 index 2829440c0..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/IDesktopElement.java +++ /dev/null @@ -1,25 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.internal.extra; - - -public interface IDesktopElement extends org.eclipse.ui.model.IWorkbenchAdapter -{ - - -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/IPropertySource.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/IPropertySource.java deleted file mode 100644 index 85605a8c6..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/IPropertySource.java +++ /dev/null @@ -1,24 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.internal.extra; - -public interface IPropertySource extends org.eclipse.ui.views.properties.IPropertySource -{ - - -} diff --git a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/PropertySource.java b/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/PropertySource.java deleted file mode 100644 index 60fee16e2..000000000 --- a/rse/plugins/org.eclipse.dstore.extra/src/org/eclipse/dstore/internal/extra/PropertySource.java +++ /dev/null @@ -1,152 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002, 2007 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 - * - * Initial Contributors: - * The following IBM employees contributed to the Remote System Explorer - * component that contains this file: David McKnight, Kushal Munir, - * Michael Berger, David Dykstal, Phil Coulthard, Don Yantzi, Eric Simpson, - * Emily Bruner, Mazen Faraj, Adrian Storisteanu, Li Ding, and Kent Hawley. - * - * Contributors: - * {Name} (company) - description of contribution. - *******************************************************************************/ - -package org.eclipse.dstore.internal.extra; - -import java.util.HashMap; -import java.util.List; - -import org.eclipse.dstore.extra.IDataElement; -import org.eclipse.ui.views.properties.IPropertyDescriptor; -import org.eclipse.ui.views.properties.TextPropertyDescriptor; - -public class PropertySource implements IPropertySource -{ - - - private IDataElement _dataElement; - private HashMap _properties; - private IPropertyDescriptor[] _descriptors; - - public PropertySource(IDataElement element) - { - _dataElement = element; - - _properties = new HashMap(); - - IDataElement descriptor = (IDataElement)element.getElementProperty("descriptor"); //$NON-NLS-1$ - - List attributes = null; - int attributesSize = 0; - if (descriptor != null) - { - attributes = descriptor.getAssociated("attributes"); //$NON-NLS-1$ - attributesSize = attributes.size(); - } - - _descriptors = new IPropertyDescriptor[attributesSize + 2]; - _descriptors[0] = new TextPropertyDescriptor("type", "type"); //$NON-NLS-1$ //$NON-NLS-2$ - _descriptors[1] = new TextPropertyDescriptor("name", "name"); //$NON-NLS-1$ //$NON-NLS-2$ - if (attributes != null) - { - for (int i = 0; i < attributesSize; i++) - { - IDataElement attribute = (IDataElement)attributes.get(i); - List types = attribute.getAssociated("attributes"); //$NON-NLS-1$ - - String type = null; - if (types.size() > 0) - type = ((IDataElement)types.get(0)).getName(); - else - type = "String"; //$NON-NLS-1$ - - _properties.put(attribute.getName(), type); - _descriptors[i+2] = new TextPropertyDescriptor(attribute.getName(), attribute.getName()); - } - } - - } - - public static boolean matches(Class aClass) - { - return (aClass == org.eclipse.ui.views.properties.IPropertySource.class); - } - - - public Object getEditableValue() - { - return this; - } - - public IPropertyDescriptor[] getPropertyDescriptors() - { - return _descriptors; - } - - public Object getPropertyValue(Object name) - { - return getPropertyValue((String)name); - } - - public Object getPropertyValue(String name) - { - Object result = null; - - // find the appropriate attribute - List attributes = _dataElement.getAssociated("attributes"); //$NON-NLS-1$ - for (int i = 0; i < attributes.size(); i++) - { - IDataElement attribute = (IDataElement)attributes.get(i); - if (attribute.getType().equals(name)) - { - result = attribute.getElementProperty("value"); //$NON-NLS-1$ - } - } - - if (result == null) - { - String type = (String)_properties.get(name); - - if (type != null && type.equals("Integer")) //$NON-NLS-1$ - result = "0"; //$NON-NLS-1$ - else if (type != null && type.equals("Float")) //$NON-NLS-1$ - result = "0.0"; //$NON-NLS-1$ - else - result = _dataElement.getElementProperty(name); - } - - return result; - } - - public boolean isPropertySet(Object property) - { - return isPropertySet((String)property); - } - - public boolean isPropertySet(String property) - { - return false; - } - - public void resetPropertyValue(Object property) - { - } - - public void resetPropertyValue(String property) - { - } - - public void setPropertyValue(Object name, Object value) - { - setPropertyValue((String)name, value); - } - - public void setPropertyValue(String name, Object value) - { - } - -} |