Author: scabanovich
Date: 2007-07-13 02:16:10 -0400 (Fri, 13 Jul 2007)
New Revision: 2417
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementAdapterFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java
Log:
EXIN-218 Properties of component added.
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamComponentProperties.java 2007-07-13
06:16:10 UTC (rev 2417)
@@ -0,0 +1,68 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.views.properties;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.jboss.tools.seam.core.ISeamComponent;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamComponentProperties extends SeamElementProperties {
+ enum Precedence {
+ BUILT_IN(0),
+ FRAMEWORK(10),
+ APPLICATION(20),
+ DEPLOYMENT(30),
+ MOCK(40);
+
+ int value;
+
+ Precedence(int value) {
+ this.value = value;
+ }
+
+ static String getStringValue(int v) {
+ for (int i = 0; i < Precedence.values().length; i++) {
+ if(v == Precedence.values()[i].value) return Precedence.values()[i].toString();
+ }
+ return "" + v;
+ }
+ }
+
+ ISeamComponent element;
+
+ static IPropertyDescriptor[] DESCRIPTORS = {
+ NAME_DESCRIPTOR, SCOPE_DESCRIPTOR, CLASS_DESCRIPTOR, PRECEDENCE_DESCRIPTOR
+ };
+
+ public SeamComponentProperties(ISeamComponent element) {
+ this.element = element;
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return DESCRIPTORS;
+ }
+
+ public Object getPropertyValue(Object id) {
+ if(NAME.equals(id)) {
+ return element.getName();
+ } else if(SCOPE.equals(id)) {
+ return element.getScope().toString();
+ } else if(CLASS.equals(id)) {
+ return element.getClassName();
+ } else if(PRECEDENCE.equals(id)) {
+ return Precedence.getStringValue(element.getPrecedence());
+ }
+ return null;
+ }
+
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementAdapterFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementAdapterFactory.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementAdapterFactory.java 2007-07-13
06:16:10 UTC (rev 2417)
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.views.properties;
+
+import org.eclipse.core.runtime.IAdapterFactory;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.jboss.tools.seam.core.ISeamComponent;
+import org.jboss.tools.seam.core.ISeamElement;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamElementAdapterFactory implements IAdapterFactory {
+
+ private static Class[] PROPERTIES = new Class[] {
+ IPropertySource.class,
+ };
+
+ public Object getAdapter(Object object, Class key) {
+ if(!(object instanceof ISeamElement)) return null;
+ ISeamElement element = (ISeamElement)object;
+ if (IPropertySource.class.equals(key)) {
+ return getProperties(element);
+ }
+ return null;
+ }
+
+ public Class[] getAdapterList() {
+ return PROPERTIES;
+ }
+
+ private IPropertySource getProperties(ISeamElement element) {
+ if(element instanceof ISeamComponent) {
+ return new SeamComponentProperties((ISeamComponent)element);
+ }
+ return null;
+ }
+
+}
Added:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java
(rev 0)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/views/properties/SeamElementProperties.java 2007-07-13
06:16:10 UTC (rev 2417)
@@ -0,0 +1,59 @@
+/*******************************************************************************
+ * Copyright (c) 2007 Exadel, Inc. and Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is 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:
+ * Exadel, Inc. and Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.seam.ui.views.properties;
+
+import org.eclipse.ui.views.properties.IPropertyDescriptor;
+import org.eclipse.ui.views.properties.IPropertySource;
+import org.eclipse.ui.views.properties.PropertyDescriptor;
+
+/**
+ * @author Viacheslav Kabanovich
+ */
+public class SeamElementProperties implements IPropertySource {
+ static String NAME = "name";
+ static String SCOPE = "scope";
+ static String CLASS = "class";
+ static String PRECEDENCE = "precedence";
+ static String INSTALLED = "installed";
+ static String STATEFUL = "stateful";
+
+
+ static IPropertyDescriptor NAME_DESCRIPTOR = new PropertyDescriptor(NAME, NAME);
+ static IPropertyDescriptor SCOPE_DESCRIPTOR = new PropertyDescriptor(SCOPE, SCOPE);
+ static IPropertyDescriptor CLASS_DESCRIPTOR = new PropertyDescriptor(CLASS, CLASS);
+ static IPropertyDescriptor PRECEDENCE_DESCRIPTOR = new PropertyDescriptor(PRECEDENCE,
PRECEDENCE);
+
+ public SeamElementProperties() {
+ }
+
+ public Object getEditableValue() {
+ return this;
+ }
+
+ public IPropertyDescriptor[] getPropertyDescriptors() {
+ return null;
+ }
+
+ public Object getPropertyValue(Object id) {
+ return null;
+ }
+
+ public boolean isPropertySet(Object id) {
+ return false;
+ }
+
+ public void resetPropertyValue(Object id) {
+ }
+
+ public void setPropertyValue(Object id, Object value) {
+ }
+
+}