Author: bfitzpat
Date: 2010-04-28 10:15:51 -0400 (Wed, 28 Apr 2010)
New Revision: 21782
Removed:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseField.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ButtonFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ComboBoxField.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ComboFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/CompositeEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/IFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/INamedElement.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ITaggedFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/LabelFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/PushButtonField.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextField.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextFieldEditor.java
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossLibraryListFieldEditor.java
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossRuntimeListFieldEditor.java
Log:
OPEN - issue JBIDE-5522: Refactor WS and ESB preference UI framework to use the shared
code in common.ui
https://jira.jboss.org/jira/browse/JBIDE-5522
Modified: trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF
===================================================================
--- trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF 2010-04-28
13:58:42 UTC (rev 21781)
+++ trunk/esb/plugins/org.jboss.tools.esb.project.ui/META-INF/MANIFEST.MF 2010-04-28
14:15:51 UTC (rev 21782)
@@ -34,7 +34,8 @@
org.eclipse.jdt.ui;bundle-version="3.4.1",
org.jboss.ide.eclipse.as.ui;bundle-version="1.0.0",
org.jboss.ide.eclipse.as.wtp.core;bundle-version="1.0.0",
- org.jboss.ide.eclipse.as.core;bundle-version="1.0.0"
+ org.jboss.ide.eclipse.as.core;bundle-version="1.0.0",
+ org.jboss.tools.common.ui;bundle-version="3.1.0"
Bundle-ActivationPolicy: lazy
Bundle-Vendor: %Bundle-Vendor.0
Export-Package: org.jboss.tools.esb.project.ui
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseField.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseField.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseField.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Grid Qian
- */
-public abstract class BaseField {
-
- public static final String PROPERTY_NAME = "value"; //$NON-NLS-1$
-
- private PropertyChangeSupport pcs = new PropertyChangeSupport(this);
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- pcs.addPropertyChangeListener(listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- pcs.removePropertyChangeListener(listener);
- }
-
- public void firePropertyChange(Object oldValue, Object newValue) {
- pcs.firePropertyChange(PROPERTY_NAME, oldValue, newValue);
- }
-
- abstract public Control getControl();
-}
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseFieldEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/BaseFieldEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,251 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import java.beans.PropertyChangeListener;
-import java.beans.PropertyChangeSupport;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Map;
-import java.util.Set;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Label;
-import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
-
-/**
- * @author Grid Qian
- */
-public abstract class BaseFieldEditor implements IFieldEditor {
-
- PropertyChangeSupport pcs = new PropertyChangeSupport(this);
-
- Set<DisposeListener> disposeListeners = new HashSet<DisposeListener>();
-
- private Object value = new Object();
-
- private String labelText;
-
- private String nameText = null;
-
- Label labelControl = null;
-
- protected Map<Object, Object> data = null;
-
- private boolean enabled = true;
-
- /**
- *
- * @param name
- * @param label
- * @param defaultValue
- */
- public BaseFieldEditor(String name, String label,Object defaultValue) {
- this.value = defaultValue;
- this.labelText = label;
- this.nameText = name;
- }
-
- /**
- *
- * @param parent
- */
- public void doFillIntoGrid(Object parent) {
- Assert.isTrue(parent instanceof Composite,
JBossESBUIMessages.Error_JBoss_Basic_Editor_Composite);
- Assert.isTrue(((Composite)parent).getLayout() instanceof
GridLayout,JBossESBUIMessages.Error_JBoss_Basic_Editor_Support);
- Composite aComposite = (Composite) parent;
- final Control[] controls = (Control[])getEditorControls(aComposite);
- GridLayout gl = (GridLayout)((Composite)parent).getLayout();
-
- doFillIntoGrid(aComposite,gl.numColumns);
- if(controls.length>0) {
- controls[0].addDisposeListener(new DisposeListener(){
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- controls[0].removeDisposeListener(this);
- }
- });
- }
- }
-
- /**
- * @param composite
- * @param numColumns
- */
- protected void doFillIntoGrid(Composite composite, int numColumns) {
-
- }
-
- public void addPropertyChangeListener(PropertyChangeListener listener) {
- pcs.addPropertyChangeListener(listener);
- }
-
- public void removePropertyChangeListener(PropertyChangeListener listener) {
- pcs.removePropertyChangeListener(listener);
- }
-
- /**
- *
- * @param parent
- * @return
- */
- public Label createLabelControl(Composite parent) {
- if(labelControl==null) {
- labelControl = new Label(parent,SWT.NO_BACKGROUND);
- labelControl.setText(this.labelText);
- } else if(parent!=null) {
- if(labelControl.getParent()!=parent)
- throw new
IllegalArgumentException(JBossESBUIMessages.Error_JBoss_Basic_Editor_Different);
- }
- return labelControl;
- }
-
- public Label getLabelControl() {
- return createLabelControl(null);
- }
-
- public abstract Object[] getEditorControls(Object composite);
-
- public abstract Object[] getEditorControls();
-
- public Control[] getSwtControls() {
- return (Control[])getEditorControls();
- }
-
- public abstract int getNumberOfControls();
-
- public Object getValue() {
- return value;
- }
-
- public String getValueAsString() {
- return getValue().toString();
- }
-
- public boolean isEnabled() {
- return this.enabled ;
- }
-
- public void setEnabled(boolean enabled) {
- this.enabled = enabled;
- Control[] controls = getSwtControls();
- if(controls==null) {
- return;
- }
- for(int i=0;i<controls.length;i++) {
- Control control = controls[i];
- control.setEnabled(enabled);
- if(control instanceof Composite) {
- setEnabled((Composite)control, enabled);
- }
- }
- }
-
- private void setEnabled(Composite composite, boolean enabled) {
- Control[] controls = composite.getChildren();
- for(int i=0;i<controls.length;i++) {
- Control control = controls[i];
- control.setEnabled(enabled);
- if(control instanceof Composite) {
- setEnabled((Composite)control, enabled);
- }
- }
- }
-
- public boolean setFocus() {
- return true;
- }
-
- /**
- *
- * @param newValue
- */
- public void setValue(Object newValue) {
- Object oldValue = value;
- value = newValue;
- pcs.firePropertyChange(nameText,oldValue,newValue);
- }
-
- public void setValueAsString(String stringValue) {
- value = stringValue;
- }
-
- public String getName() {
- return nameText;
- }
-
- public void dispose() {
- PropertyChangeListener[] listeners = pcs.getPropertyChangeListeners();
- for (int i = 0; i < listeners.length; i++) {
- PropertyChangeListener propertyChangeListener = listeners[i];
- pcs.removePropertyChangeListener(propertyChangeListener);
- }
- }
-
- public void dispose(DisposeEvent e) {
- dispose();
- for (DisposeListener disposeListener : disposeListeners) {
- disposeListener.widgetDisposed(e);
- }
- disposeListeners.clear();
- }
-
- public void addDisposeListener(DisposeListener listener) {
- disposeListeners.add(listener);
- }
-
- public void removeDisposeListener(DisposeListener listener) {
- disposeListeners.remove(listener);
- }
-
- public String getLabelText() {
- return labelText;
- }
-
- /**
- *
- * @param labelText
- */
- public void setLabelText(String labelText) {
- this.labelText = labelText;
- }
-
- private boolean editable = true;
-
- public boolean isEditable() {
- return editable;
- }
-
- public void setEditable(boolean aEditable) {
- this.editable = aEditable;
- }
-
- public Object getData(Object key) {
- if(data==null) {
- return null;
- }
- return data.get(key);
- }
-
- public void setData(Object key, Object value) {
- if(data==null) {
- data = new HashMap<Object, Object>();
- }
- data.put(key, value);
- }
-}
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ButtonFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ButtonFieldEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ButtonFieldEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,112 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import org.eclipse.jface.action.Action;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.events.SelectionListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
-
-/**
- * @author Grid Qian
- */
-public class ButtonFieldEditor extends BaseFieldEditor {
-
- PushButtonField button= null;
- int style;
-
- private ButtonPressedAction buttonAction = new
ButtonPressedAction(JBossESBUIMessages.JBoss_Button_Field_Editor_Browse) {
- @Override
- public void run() {
- throw new
RuntimeException(JBossESBUIMessages.Error_JBoss_Button_Field_Editor_Not_Implemented_Yet);
- }
- };
-
- public ButtonFieldEditor(String name, String label, int style) {
- super(name, label, new Object());
- this.style = style;
- }
-
- public ButtonFieldEditor(String name, ButtonPressedAction action, Object defaultValue)
{
- super(name, action.getText(), defaultValue);
- buttonAction = action;
- buttonAction.setFieldEditor(this);
- }
-
- @Override
- public void doFillIntoGrid(Object parent) {
- }
-
- @Override
- public Object[] getEditorControls() {
- if(button==null) {
- return null;
- }
- return new Control[]{button.getControl()};
- }
-
- @Override
- public boolean isEditable() {
- return false;
- }
-
- public void save(Object object) {
- }
-
- @Override
- public void setEditable(boolean ediatble) {
- }
-
- @Override
- public Object[] getEditorControls(Object composite) {
- if(button==null && composite!=null) {
- button = new PushButtonField((Composite)composite, style, buttonAction);
- setEnabled(isEnabled());
- }
- return new Control[]{button.getControl()};
- }
-
- public ButtonPressedAction getButtonaction() {
- return buttonAction;
- }
-
- public static class ButtonPressedAction extends Action implements SelectionListener{
-
- private IFieldEditor editor = null;
-
- public ButtonPressedAction(String label) {
- super(label);
- }
-
- public void setFieldEditor(IFieldEditor newEditor) {
- editor = newEditor;
- }
-
- public IFieldEditor getFieldEditor() {
- return editor;
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void widgetSelected(SelectionEvent e) {
- run();
- }
- }
-
- @Override
- public int getNumberOfControls() {
- return 1;
- }
-}
\ No newline at end of file
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ComboBoxField.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ComboBoxField.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ComboBoxField.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,147 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
-import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.StructuredSelection;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Display;
-
-/**
- * @author eskimo
- *
- */
-public class ComboBoxField extends BaseField implements ISelectionChangedListener {
-
- ComboViewer comboControl = null;
- List values = new ArrayList();
-
- public ComboBoxField(Composite parent,List values, ILabelProvider labelProvider,
- Object value, boolean flatStyle) {
- this(parent, values, value, flatStyle);
- comboControl.setLabelProvider(labelProvider);
- }
-
- public ComboBoxField(Composite parent,List values, Object value, boolean editable) {
- this.values = values;
- /*
- * Used combo box instead of custom combobox(CCombo),
- * CCombo looks ugly under MAC OS X
- */
- Combo combo;
- if(editable==true) {
-
- combo = new Combo(parent, SWT.DROP_DOWN);
- } else {
- combo = new Combo(parent, SWT.READ_ONLY);
- }
- combo.setBackground(Display.getDefault().getSystemColor(SWT.COLOR_WHITE));
- comboControl = new ComboViewer(combo);
- comboControl.setContentProvider(new IStructuredContentProvider() {
-
- public void dispose() {
- }
-
- public void inputChanged(Viewer viewer, Object oldInput,
- Object newInput) {
- }
-
- public Object[] getElements(Object inputElement) {
- return ComboBoxField.this.values.toArray();
- }
- });
-
- comboControl.addSelectionChangedListener(this);
- comboControl.getCombo().addModifyListener(new ModifyListener() {
- public void modifyText(ModifyEvent e) {
- firePropertyChange(new Object(), comboControl.getCombo().getText());
- }});
- comboControl.setLabelProvider(new ILabelProvider() {
- public void addListener(ILabelProviderListener listener) {
- }
-
- public void dispose() {
- }
-
- public boolean isLabelProperty(Object element, String property) {
- return false;
- }
-
- public void removeListener(ILabelProviderListener listener) {
- }
-
- public Image getImage(Object element) {
- return null;
- }
-
- public String getText(Object element) {
- return element.toString();
- }
- });
- comboControl.setInput(values);
- comboControl.setSelection(new StructuredSelection(value), true);
- }
-
- public void widgetDefaultSelected(SelectionEvent e) {
- }
-
- public void selectionChanged(SelectionChangedEvent event) {
- firePropertyChange("",
((StructuredSelection)event.getSelection()).getFirstElement()); //$NON-NLS-1$
- }
-
- public Combo getComboControl() {
- return comboControl.getCombo();
- }
-
- @Override
- public Control getControl() {
- return getComboControl();
- }
-
- public void setValue(Object newValue) {
- comboControl.setSelection(new StructuredSelection(newValue));
- comboControl.getCombo().setText(newValue.toString());
- }
-
- public void setTags(String[] tags,String value) {
- values = Arrays.asList(tags);
- comboControl.removeSelectionChangedListener(this);
- comboControl.refresh(true);
- comboControl.addPostSelectionChangedListener(this);
- comboControl.setSelection(new StructuredSelection(value));
- }
- /*
- * We can't modify combo, change style of this object,
- * if we such functionality please use CCombo
- *
- */
- public void setEditable(
- boolean ediatble) {
- //comboControl.getCCombo().setEditable(false);
- }
-}
\ No newline at end of file
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ComboFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ComboFieldEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ComboFieldEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,121 +0,0 @@
-
-/*******************************************************************************
- * Copyright (c) 2007 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-public class ComboFieldEditor extends BaseFieldEditor implements
ITaggedFieldEditor,PropertyChangeListener{
-
- List values = null;
-
- boolean editable = false;
-
- public ComboFieldEditor(String name, String label, List values,Object
defaultValue,boolean editableSelection) {
- super(name, label, defaultValue);
- this.values = Collections.unmodifiableList(values);
- this.editable = editableSelection;
- }
-
- private ComboBoxField comboField;
-
- @Override
- public Object[] getEditorControls(Object composite) {
- return new Control[] {getComboControl((Composite)composite)};
- }
-
- @Override
- public void doFillIntoGrid(Object parent) {
- }
-
- public Control getComboControl(Composite composite) {
- if(comboField == null) {
- comboField = new ComboBoxField(composite,values,getValue(),editable);
- comboField.addPropertyChangeListener(this);
- final Combo combo =comboField.getComboControl();
- combo.addDisposeListener(new DisposeListener(){
- public void widgetDisposed(DisposeEvent e) {
- dispose(e);
- combo.removeDisposeListener(this);
- }
- });
- } else if(composite!=null) {
- Assert.isTrue(comboField.getControl().getParent()==composite);
- }
- return comboField.getControl();
- }
-
- @Override
- public Object[] getEditorControls() {
- return new Control[]{comboField.getControl()};
- }
-
- public void save(Object object) {
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- setValue(evt.getNewValue());
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#getTags()
- */
- public String[] getTags() {
- return comboField.getComboControl().getItems();
- }
-
- /* (non-Javadoc)
- * @see
org.jboss.tools.seam.ui.widget.editor.ITaggedFieldEditor#setTags(java.lang.String[])
- */
- public void setTags(String[] tags) {
- comboField.setTags(tags,getValueAsString());
- }
-
- /* (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.BaseFieldEditor#getNumberOfControls()
- */
- @Override
- public int getNumberOfControls() {
- return 1;
- }
-
- /*
- * (non-Javadoc)
- * @see org.jboss.tools.seam.ui.widget.editor.CompositeEditor#setEditable(boolean)
- */
- @Override
- public void setEditable(boolean ediatble) {
- super.setEditable(ediatble);
- comboField.setEditable(ediatble);
- }
-
- public void setValue(Object newValue) {
- if(newValue==null) {
- return;
- }
- super.setValue(newValue);
- if(comboField!=null) {
- comboField.removePropertyChangeListener(this);
- comboField.setValue(newValue.toString());
- comboField.addPropertyChangeListener(this);
- }
- }
-}
\ No newline at end of file
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/CompositeEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/CompositeEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/CompositeEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,166 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.List;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Combo;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
-
-/**
- * @author Grid Qian
- */
-public class CompositeEditor extends BaseFieldEditor implements PropertyChangeListener {
-
- public CompositeEditor(String name, String label, Object defaultValue) {
- super(name, label, defaultValue);
- }
-
- @Override
- public void doFillIntoGrid(Object parent) {
- Assert.isTrue(parent instanceof Composite,
- JBossESBUIMessages.Error_JBoss_Basic_Editor_Composite);
- Assert.isTrue(((Composite) parent).getLayout() instanceof GridLayout,
- JBossESBUIMessages.Error_JBoss_Basic_Editor_Support);
-
- Composite aComposite = (Composite) parent;
- final Control[] controls = (Control[]) getEditorControls(aComposite);
- GridLayout gl = (GridLayout) ((Composite) parent).getLayout();
-
- for (int i = 0; i < controls.length; i++) {
- GridData gd = new GridData();
- gd.horizontalSpan = i == 1 ? gl.numColumns - controls.length + 1 : 1;
- if (controls[i] instanceof Combo && i == (controls.length - 1)) {
- gd.horizontalAlignment = SWT.BEGINNING;
- } else {
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = (i == 1);
- }
-
- controls[i].setLayoutData(gd);
- controls[i].setEnabled(isEnabled());
-
- if(i==0) {
- controls[i].addDisposeListener(new DisposeListener(){
- public void widgetDisposed(DisposeEvent e) {
- dispose();
- controls[0].removeDisposeListener(this);
- }
- });
- }
- }
- }
-
- List<Control> controls = new ArrayList<Control>();
-
- @Override
- public Object[] getEditorControls() {
- if(controls.size()>0) return controls.toArray();
- else throw new
IllegalStateException(JBossESBUIMessages.JBoss_Composite_Editor_This_Method_Can_Be_Invoked);
- }
-
- @Override
- public Object[] getEditorControls(Object parent) {
- for (IFieldEditor editor : editors) {
- controls.addAll(Arrays.asList((Control[])editor.getEditorControls(parent)));
- }
- return controls.toArray(new Control[]{});
- }
-
- @Override
- public int getNumberOfControls() {
- return editors.size();
- }
-
- @Override
- public boolean isEditable() {
- return true;
- }
-
- public void save(Object object) {
- }
-
- @Override
- public void setEditable(boolean ediatble) {
- }
-
- List<IFieldEditor> editors = new ArrayList<IFieldEditor>();
-
- public CompositeEditor addFieldEditors(IFieldEditor[] editors) {
- this.editors.addAll( Arrays.asList(editors));
- for (IFieldEditor editor : Arrays.asList(editors)) {
- editor.addPropertyChangeListener(this);
- }
- return this;
- }
-
- @Override
- public void setValue(Object newValue) {
- for (IFieldEditor editor : editors) {
- editor.removePropertyChangeListener(this);
- editor.setValue(newValue);
- editor.addPropertyChangeListener(this);
- }
- super.setValue(newValue);
- }
-
- public void propertyChange(PropertyChangeEvent event) {
- for (IFieldEditor editor : editors) {
- if(event.getSource()!=editor) {
- editor.removePropertyChangeListener(this);
- editor.setValue(event.getNewValue());
- editor.addPropertyChangeListener(this);
- }
- }
- super.setValue(event.getNewValue());
- }
-
- @Override
- public void setEnabled(boolean set) {
- for (IFieldEditor editor : editors) {
- editor.setEnabled(set);
- }
- }
-
- public List<IFieldEditor> getEditors() {
- return Collections.unmodifiableList(editors);
- }
-
- public IFieldEditor getEditorByName(String name) {
- for (IFieldEditor editor : editors) {
- if(name.equals(editor.getName())) {
- return editor;
- }
- }
- return null;
- }
-
- public void setData(Object key, Object value) {
- super.setData(key, value);
- for (IFieldEditor editor : editors) {
- editor.setData(key, value);
- }
- }
-}
\ No newline at end of file
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/IFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/IFieldEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/IFieldEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,106 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import java.beans.PropertyChangeListener;
-
-import org.eclipse.swt.events.DisposeEvent;
-import org.eclipse.swt.events.DisposeListener;
-
-/**
- * @author Grid Qian
- */
-public interface IFieldEditor extends INamedElement {
-
- /**
- *
- * @param composite
- */
- public Object[] getEditorControls(Object composite);
-
- public Object[] getEditorControls();
-
- public int getNumberOfControls();
-
- /**
- *
- * @param parent
- */
- public void doFillIntoGrid(Object parent);
-
- /**
- *
- * @param listener
- */
- public void addPropertyChangeListener(PropertyChangeListener listener);
-
- /**
- *
- * @param listener
- */
- public void addDisposeListener(DisposeListener listener);
-
- /**
- *
- * @param listener
- */
- public void removeDisposeListener(DisposeListener listener);
-
- /**
- *
- * @param listener
- */
- public void removePropertyChangeListener(PropertyChangeListener listener);
-
- public boolean isEditable();
-
- /**
- *
- * @param aEdiatble
- */
- public void setEditable(boolean aEdiatble);
-
- public boolean setFocus();
-
- public boolean isEnabled();
-
- /**
- *
- * @param enabled
- */
- public void setEnabled(boolean enabled);
-
- public void dispose();
-
- /**
- *
- * @param e
- */
- public void dispose(DisposeEvent e);
-
- /**
- * Sets the application defined property of this editor
- *
- * @param data
- * @param key
- */
- public void setData(Object key, Object data);
-
- /**
- * Gets the application defined property of this editor
- *
- * @param key
- * @return
- */
- public Object getData(Object key);
-
-}
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/INamedElement.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/INamedElement.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/INamedElement.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,29 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-/**
- * @author Grid Qian
- */
-public interface INamedElement {
-
- public abstract String getName();
-
- public abstract Object getValue();
-
- public abstract void setValue(Object newValue);
-
- public abstract String getValueAsString();
-
- public abstract void setValueAsString(String aValue);
-
-}
\ No newline at end of file
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ITaggedFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ITaggedFieldEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/ITaggedFieldEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,26 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2007 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-public interface ITaggedFieldEditor extends IFieldEditor {
-
- /**
- *
- * @return
- */
- public String[] getTags();
-
- /**
- *
- * @param tags
- */
- public void setTags(String[] tags);
-}
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossLibraryListFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossLibraryListFieldEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossLibraryListFieldEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -48,6 +48,7 @@
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.FileDialog;
import org.eclipse.swt.widgets.Group;
+import org.jboss.tools.common.ui.widget.editor.BaseFieldEditor;
import org.jboss.tools.esb.core.runtime.JBossESBRuntime;
import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
import org.jboss.tools.esb.project.ui.preference.JBossESBUIPlugin;
@@ -197,7 +198,7 @@
}
protected void createListView(Composite parent) {
- listView = new TreeViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
+ listView = new TreeViewer(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL |
SWT.MULTI);
listView.getTree().setLayoutData(new GridData(GridData.FILL_BOTH));
listView.setContentProvider(new ITreeContentProvider() {
Modified:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossRuntimeListFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossRuntimeListFieldEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/JBossRuntimeListFieldEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -15,7 +15,6 @@
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -66,6 +65,13 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacet;
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
+import org.jboss.tools.common.ui.widget.editor.BaseFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.ButtonFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.ComboFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.CompositeEditor;
+import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.LabelFieldEditor;
+import org.jboss.tools.common.ui.widget.editor.TextFieldEditor;
import org.jboss.tools.esb.core.ESBProjectConstant;
import org.jboss.tools.esb.core.runtime.JBossESBRuntime;
import org.jboss.tools.esb.core.runtime.JBossRuntimeManager;
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/LabelFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/LabelFieldEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/LabelFieldEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,69 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-
-/**
- * @author Grid Qian
- */
-public class LabelFieldEditor extends BaseFieldEditor {
-
- public LabelFieldEditor(String name, String label) {
- super(name, label, ""); //$NON-NLS-1$
- }
-
- @Override
- public void doFillIntoGrid(Object parent) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public Object[] getEditorControls(Object composite) {
- // TODO Auto-generated method stub
- return new Control[]{createLabelControl((Composite)composite)};
- }
-
- @Override
- public Object[] getEditorControls() {
- return getEditorControls(null);
- }
-
- @Override
- public boolean isEditable() {
- // TODO Auto-generated method stub
- return false;
- }
-
- public void save(Object object) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setEditable(boolean ediatble) {
- // TODO Auto-generated method stub
-
- }
-
- @Override
- public void setValue(Object value) {
- }
-
- @Override
- public int getNumberOfControls() {
- // TODO Auto-generated method stub
- return 1;
- }
-}
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/PushButtonField.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/PushButtonField.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/PushButtonField.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,41 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import org.eclipse.swt.widgets.Button;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import
org.jboss.tools.esb.project.ui.preference.controls.ButtonFieldEditor.ButtonPressedAction;
-
-/**
- * @author Grid Qian
- *
- */
-public class PushButtonField extends BaseField {
-
- Button button;
-
- /**
- *
- */
- @Override
- public Control getControl() {
- return button;
- }
-
-
- public PushButtonField(Composite composite, int style, ButtonPressedAction listener) {
- button = new Button(composite, style);
- button.setText(listener.getText());
- button.addSelectionListener(listener);
- }
-}
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextField.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextField.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextField.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,44 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import org.eclipse.swt.events.ModifyEvent;
-import org.eclipse.swt.events.ModifyListener;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-
-/**
- * @author Grid Qian
- */
-public class TextField extends BaseField implements ModifyListener{
-
-
- Text textField = null;
-
- public TextField(Composite parent, int style) {
- textField = new Text(parent,style);
- textField.addModifyListener(this);
- }
-
- public void modifyText(ModifyEvent e) {
- firePropertyChange(new Object(),((Text)e.widget).getText().trim());
- }
-
- public Text getTextControl() {
- return textField;
- }
-
- public Control getControl() {
- return getTextControl();
- }
-}
Deleted:
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextFieldEditor.java
===================================================================
---
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextFieldEditor.java 2010-04-28
13:58:42 UTC (rev 21781)
+++
trunk/esb/plugins/org.jboss.tools.esb.project.ui/src/org/jboss/tools/esb/project/ui/preference/controls/TextFieldEditor.java 2010-04-28
14:15:51 UTC (rev 21782)
@@ -1,210 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2008 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:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-
-package org.jboss.tools.esb.project.ui.preference.controls;
-
-import java.beans.PropertyChangeEvent;
-import java.beans.PropertyChangeListener;
-import java.util.Collection;
-
-import org.eclipse.core.runtime.Assert;
-import org.eclipse.swt.SWT;
-import org.eclipse.swt.layout.GridData;
-import org.eclipse.swt.layout.GridLayout;
-import org.eclipse.swt.widgets.Composite;
-import org.eclipse.swt.widgets.Control;
-import org.eclipse.swt.widgets.Text;
-import org.jboss.tools.esb.project.ui.messages.JBossESBUIMessages;
-
-/**
- *
- * @author Grid Qian
- *
- */
-public class TextFieldEditor extends BaseFieldEditor implements PropertyChangeListener{
-
- public static final int UNLIMITED = -1;
-
- protected int style = -1;
-
- /**
- *
- * @param name
- * @param aLabelText
- * @param defaultvalue
- */
- public TextFieldEditor(String name,String aLabelText,String defaultvalue) {
- super(name, aLabelText, defaultvalue);
- }
-
- /**
- *
- * @param name
- * @param aLabelText
- * @param defaultvalue
- * @param editable
- */
- public TextFieldEditor(String name,String aLabelText,String defaultvalue,boolean
editable) {
- super(name, aLabelText, defaultvalue);
- setEditable(editable);
- }
-
- protected TextField fTextField = null;
-
- protected int fWidthInChars = 0;
-
- @Override
- public Object[] getEditorControls() {
- return new Control[] {getTextControl()};
- }
-
- @Override
- public void doFillIntoGrid(Object aParent) {
- Assert.isTrue(aParent instanceof Composite,
JBossESBUIMessages.Error_JBoss_Basic_Editor_Composite);
- Assert.isTrue(((Composite)aParent).getLayout() instanceof
GridLayout,JBossESBUIMessages.Error_JBoss_Basic_Editor_Support);
- Composite aComposite = (Composite) aParent;
- getEditorControls(aComposite);
- GridLayout gl = (GridLayout)((Composite)aParent).getLayout();
- getTextControl(aComposite);
-
- GridData gd = new GridData();
-
- gd.horizontalSpan = gl.numColumns - 1;
- gd.horizontalAlignment = GridData.FILL;
- gd.grabExcessHorizontalSpace = true;
-
- fTextField.getTextControl().setLayoutData(gd);
- }
-
- /**
- *
- * @param parent
- * @return
- */
- public Text getTextControl(Composite parent) {
- if (fTextField == null) {
- fTextField = new TextField(parent, getInitialStyle());
- Text textField = fTextField.getTextControl();
- textField.setFont(parent.getFont());
- textField.setText(getValue().toString());
- textField.setEditable(isEditable());
- textField.setEnabled(isEnabled());
- fTextField.addPropertyChangeListener(this);
- } else if (parent!=null){
- Assert.isTrue(parent==fTextField.getTextControl().getParent());
- }
- return fTextField.getTextControl();
- }
-
- protected void updateWidgetValues() {
- setValueAsString(getValueAsString());
- }
-
- protected int getInitialStyle() {
- if(this.style >= 0) return style;
- return SWT.SINGLE | SWT.BORDER;
- }
-
- /*
- * @param value
- * @return
- */
- @SuppressWarnings({ "unchecked", "unused" })
- private String checkCollection(Object value){
-
- return value != null && (((Collection)value).size() > 0) ?
prepareCollectionToString((Collection)value) : ""; //$NON-NLS-1$
- }
-
- /*
- * @param collection
- * @return
- */
- @SuppressWarnings("unchecked")
- private String prepareCollectionToString(Collection collection)
- {
- String stringValue = ""; //$NON-NLS-1$
- Object[] objects = collection.toArray();
- for(int i = 0; i < objects.length; i++){
- stringValue += objects[i];
- if(i < objects.length - 1)
- stringValue += " "; //$NON-NLS-1$
- }
- return stringValue;
- }
-
-
- /*
- * @param value
- * @return
- */
- @SuppressWarnings("unused")
- private String checkSimple(Object value){
- return (value != null) ? value.toString() : ""; //$NON-NLS-1$
- }
-
- @Override
- public int getNumberOfControls() {
- return 2;
- }
-
- /**
- * Returns this field editor's text control.
- *
- * @return the text control, or <code>null</code> if no
- * text field is created yet
- */
- protected Text getTextControl() {
- return fTextField!=null?fTextField.getTextControl():null;
- }
-
- @Override
- public boolean setFocus() {
- boolean setfocus = false;
- if(fTextField!=null && !fTextField.getTextControl().isDisposed())
- setfocus = fTextField.getTextControl().setFocus();
- return setfocus;
- }
-
- @Override
- public Object[] getEditorControls(Object composite) {
- return new Control[]{getTextControl((Composite)composite)};
- }
-
- /**
- *
- * @param object
- */
- public void save(Object object) {
- }
-
- /**
- *
- */
- @Override
- public void setValue(Object newValue) {
- super.setValue(newValue);
- if(fTextField!=null){
- fTextField.removePropertyChangeListener(this);
- fTextField.getTextControl().setText(newValue.toString());
- fTextField.addPropertyChangeListener(this);
- }
- }
-
- @Override
- public void setEditable(boolean aEditable) {
- super.setEditable(aEditable);
- if(getTextControl()!=null) getTextControl().setEditable(aEditable);
- }
-
- public void propertyChange(PropertyChangeEvent evt) {
- super.setValue(evt.getNewValue());
- }
-}
\ No newline at end of file