org.eclipse.jst.jsf.facesconfig.ui_1.2.2.v201103292152

er.okPressed();
  }
  
  public String getDescription()
  {
    return description;
  }
  
  public String getDisplayName()
  {
    return displayName;
  }
  
  public String getFacetName()
  {
    return facetName;
  }
  
  public void setDescription(String description)
  {
    this.description = description;
  }
  
  public void setDisplayName(String displayName)
  {
    this.displayName = displayName;
  }
  
  public void setFacetName(String facetName)
  {
    this.facetName = facetName;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditFacetDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.jst.jsf.common.ui.internal.dialogfield.ComboDialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener;

class AddEditManagedPropertyDialog$1
  implements IDialogFieldApplyListener
{
  AddEditManagedPropertyDialog$1(AddEditManagedPropertyDialog paramAddEditManagedPropertyDialog) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    this$0.handleNameSelection(((ComboDialogField)field).getText());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditManagedPropertyDialog.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener;

class AddEditManagedPropertyDialog$2
  implements IDialogFieldApplyListener
{
  AddEditManagedPropertyDialog$2(AddEditManagedPropertyDialog paramAddEditManagedPropertyDialog) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    AddEditManagedPropertyDialog.access$0(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditManagedPropertyDialog.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.jst.jsf.common.ui.internal.dialogfield.ComboDialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IStringButtonAdapter;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringButtonDialogField;

class AddEditManagedPropertyDialog$3
  implements IStringButtonAdapter
{
  AddEditManagedPropertyDialog$3(AddEditManagedPropertyDialog paramAddEditManagedPropertyDialog) {}
  
  public void changeControlPressed(DialogField field)
  {
    this$0.handleChangeValue(AddEditManagedPropertyDialog.access$1(this$0).getText(), 
      ((StringButtonDialogField)field).getText());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditManagedPropertyDialog.3
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringButtonDialogField;

class AddEditManagedPropertyDialog$4
  implements IDialogFieldApplyListener
{
  AddEditManagedPropertyDialog$4(AddEditManagedPropertyDialog paramAddEditManagedPropertyDialog) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    AddEditManagedPropertyDialog.access$2(this$0, ((StringButtonDialogField)field).getText());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditManagedPropertyDialog.4
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import java.util.ArrayList;
import java.util.List;
import org.eclipse.core.resources.IProject;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.jdt.core.IType;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.ClassButtonDialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.ComboDialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IStringButtonAdapter;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.LayoutUtil;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringButtonDialogField;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.ListEntriesType;
import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanClassType;
import org.eclipse.jst.jsf.facesconfig.emf.ManagedBeanType;
import org.eclipse.jst.jsf.facesconfig.emf.ManagedPropertyType;
import org.eclipse.jst.jsf.facesconfig.emf.MapEntriesType;
import org.eclipse.jst.jsf.facesconfig.emf.PropertyClassType;
import org.eclipse.jst.jsf.facesconfig.emf.PropertyNameType;
import org.eclipse.jst.jsf.facesconfig.emf.ValueType;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.jst.jsf.facesconfig.ui.page.IFacesConfigPage;
import org.eclipse.jst.jsf.facesconfig.ui.section.AbstractFacesConfigSection;
import org.eclipse.jst.jsf.facesconfig.ui.util.JavaBeanProperty;
import org.eclipse.jst.jsf.facesconfig.ui.util.JavaBeanUtils;
import org.eclipse.jst.jsf.facesconfig.ui.util.JavaClassUtils;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.editor.FormEditor;

public class AddEditManagedPropertyDialog
  extends Dialog
{
  private static final int MIN_DIALOG_WIDTH = 300;
  private static final int DEFAULT_CONTROL_WIDTH = 200;
  private ComboDialogField nameField;
  private ClassButtonDialogField classField;
  private ComboDialogField valueTypeField;
  private StringButtonDialogField valueField;
  private IProject project;
  private String propertyName;
  private String propertyClass;
  private String valueType;
  private Object valueObject;
  private ManagedBeanType managedBean;
  private List beanPropertyList;
  private ManagedPropertyType managedProperty;
  private Composite parent;
  private static final String[] valueTypes = { "value", 
    "null-value", 
    "map-entries", 
    "list-entries" };
  private boolean isNew;
  private AbstractFacesConfigSection section;
  
  public AddEditManagedPropertyDialog(Shell parentShell, ManagedBeanType managedBean, AbstractFacesConfigSection section)
  {
    super(parentShell);
    isNew = true;
    this.managedBean = managedBean;
    this.section = section;
  }
  
  public AddEditManagedPropertyDialog(Shell parentShell, ManagedPropertyType managedProperty, AbstractFacesConfigSection section)
  {
    super(parentShell);
    isNew = false;
    this.managedProperty = managedProperty;
    managedBean = ((ManagedBeanType)managedProperty.eContainer());
    this.section = section;
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    if (isNew) {
      newShell.setText(EditorMessages.AddEditManagedPropertyDialog_Add);
    } else {
      newShell.setText(EditorMessages.AddEditManagedPropertyDialog_Edit);
    }
  }
  
  protected Control createDialogArea(Composite parent_)
  {
    Composite container = new Composite(parent_, 4);
    parent = container;
    GridLayout layout = new GridLayout();
    numColumns = 2;
    marginWidth = (marginHeight = 5);
    container.setLayout(layout);
    GridData gd = new GridData(1808);
    container.setLayoutData(gd);
    
    nameField = new ComboDialogField(2060);
    
    nameField.setLabelText(EditorMessages.ManagedBeanPropertyEditDialog_PropertyName);
    
    int propertyCount = 0;
    beanPropertyList = getBeanPropertyList(managedBean);
    if (beanPropertyList != null) {
      propertyCount = beanPropertyList.size();
    }
    if (propertyCount > 0)
    {
      String[] propertyNames = new String[propertyCount];
      for (int i = 0; i < propertyCount; i++)
      {
        JavaBeanProperty property = 
          (JavaBeanProperty)beanPropertyList.get(i);
        propertyNames[i] = property.getName();
      }
      nameField.setItems(propertyNames);
    }
    nameField.setDialogFieldApplyListener(new IDialogFieldApplyListener()
    {
      public void dialogFieldApplied(DialogField field)
      {
        handleNameSelection(((ComboDialogField)field).getText());
      }
    });
    classField = new ClassButtonDialogField(null);
    classField.setProject(getProject());
    classField.setLabelText(EditorMessages.ManagedBeanPropertyEditDialog_PropertyClass);
    
    valueTypeField = new ComboDialogField(2060);
    
    valueTypeField.setLabelText(EditorMessages.ManagedBeanPropertyEditDialog_ValueType);
    
    valueTypeField.setItems(valueTypes);
    valueTypeField
      .setDialogFieldApplyListener(new IDialogFieldApplyListener()
      {
        public void dialogFieldApplied(DialogField field)
        {
          AddEditManagedPropertyDialog.this.updateValueStatus();
        }
      });
    valueField = new StringButtonDialogField(new IStringButtonAdapter()
    {
      public void changeControlPressed(DialogField field)
      {
        handleChangeValue(valueTypeField.getText(), 
          ((StringButtonDialogField)field).getText());
      }
    });
    valueField.setLabelText(EditorMessages.ManagedBeanPropertyEditDialog_Value);
    valueField.setButtonLabel(EditorMessages.UI_Button_Edit_more);
    
    valueField.setDialogFieldApplyListener(new IDialogFieldApplyListener()
    {
      public void dialogFieldApplied(DialogField field)
      {
        valueObject = ((StringButtonDialogField)field).getText();
      }
    });
    GridData data = new GridData(1808);
    container.setLayoutData(data);
    
    int numberOfColumns = 5;
    GridLayout gl = new GridLayout(numberOfColumns, false);
    container.setLayout(gl);
    
    nameField.doFillIntoGrid(null, container, numberOfColumns);
    LayoutUtil.setWidthHint(nameField.getComboControl(null, container), 
      200);
    
    classField.doFillIntoGrid(null, container, numberOfColumns - 1);
    data = new GridData(4, 16777216, false, false);
    horizontalSpan = 2;
    classField.getChangeControl(null, container).setLayoutData(data);
    LayoutUtil.setWidthHint(classField.getTextControl(null, container), 
      200);
    
    valueTypeField.doFillIntoGrid(null, container, numberOfColumns);
    
    valueField.doFillIntoGrid(null, container, numberOfColumns);
    
    LayoutUtil.setHorizontalGrabbing(classField.getTextControl(null, 
      container));
    
    valueTypeField.selectItem(0);
    if ((!isNew) && (managedProperty != null)) {
      initFields();
    }
    return container;
  }
  
  private void initFields()
  {
    if (managedProperty.getPropertyName() != null) {
      nameField.setText(managedProperty.getPropertyName()
        .getTextContent());
    }
    if (managedProperty.getPropertyClass() != null) {
      classField.setText(managedProperty.getPropertyClass()
        .getTextContent());
    }
    if (managedProperty.getValue() != null)
    {
      valueTypeField.setText(valueTypes[0]);
      valueField.setText(managedProperty.getValue().getTextContent());
    }
    else if (managedProperty.getNullValue() != null)
    {
      valueTypeField.setText(valueTypes[1]);
    }
    else if (managedProperty.getMapEntries() != null)
    {
      valueTypeField.setText(valueTypes[2]);
    }
    else if (managedProperty.getListEntries() != null)
    {
      valueTypeField.setText(valueTypes[3]);
    }
    else
    {
      valueTypeField.setText(valueTypes[0]);
    }
    updateValueStatus();
  }
  
  protected void handleNameSelection(String text)
  {
    int propertyCount = 0;
    if (beanPropertyList != null) {
      propertyCount = beanPropertyList.size();
    }
    if (propertyCount > 0) {
      for (int i = 0; i < propertyCount; i++)
      {
        JavaBeanProperty property = 
          (JavaBeanProperty)beanPropertyList.get(i);
        if (property.getName().equals(text.trim()))
        {
          classField.setText(property.getQualifiedType());
          break;
        }
      }
    }
  }
  
  private void updateValueStatus()
  {
    if (valueField == null) {
      return;
    }
    valueObject = null;
    if (valueTypeField.getText().equalsIgnoreCase(
      "null-value"))
    {
      valueField.setEnabled(false);
      valueObject = FacesConfigFactory.eINSTANCE.createNullValueType();
    }
    else if ((valueTypeField.getText().equalsIgnoreCase(
      "map-entries")) || 
      (valueTypeField.getText().equalsIgnoreCase(
      "list-entries")))
    {
      valueField.getTextControl(null, parent).setEditable(false);
      valueField.setEnabled(true);
    }
    else
    {
      valueObject = valueField.getText();
      valueField.getTextControl(null, parent).setEditable(true);
      valueField.setEnabled(true);
    }
  }
  
  protected void handleChangeValue(String valueType_, String value)
  {
    if (valueType_.equalsIgnoreCase("value")) {
      handleChangeLongStringValue(value);
    } else if (valueType_.equalsIgnoreCase("map-entries")) {
      handleChangeMapEntries();
    } else if (valueType_.equalsIgnoreCase("list-entries")) {
      handleChangeListEntries();
    }
  }
  
  private void handleChangeLongStringValue(String value)
  {
    EditValueDialog valueDialog = new EditValueDialog(
      EditorPlugin.getActiveShell(), value);
    if (valueDialog.open() == 0)
    {
      valueField.setText((String)valueDialog.getResultData());
      valueObject = valueDialog.getResultData();
    }
  }
  
  private void handleChangeMapEntries()
  {
    MapEntriesType mapEntries;
    MapEntriesType mapEntries;
    if ((valueObject instanceof MapEntriesType))
    {
      mapEntries = (MapEntriesType)valueObject;
    }
    else
    {
      MapEntriesType mapEntries;
      if ((isNew) || (managedProperty.getMapEntries() == null)) {
        mapEntries = FacesConfigFactory.eINSTANCE.createMapEntriesType();
      } else {
        mapEntries = (MapEntriesType)EcoreUtil.copy(managedProperty
          .getMapEntries());
      }
    }
    EditMapEntriesDialog dialog = new EditMapEntriesDialog(
      EditorPlugin.getActiveShell(), mapEntries, section);
    if (dialog.open() == 0) {
      valueObject = dialog.getMapEntries();
    } else if ((!isNew) && (managedProperty.getMapEntries() != null)) {
      valueObject = EcoreUtil.copy(managedProperty
        .getMapEntries());
    }
  }
  
  private void handleChangeListEntries()
  {
    ListEntriesType listEntries;
    ListEntriesType listEntries;
    if ((valueObject instanceof ListEntriesType))
    {
      listEntries = (ListEntriesType)valueObject;
    }
    else
    {
      ListEntriesType listEntries;
      if ((isNew) || (managedProperty.getListEntries() == null)) {
        listEntries = FacesConfigFactory.eINSTANCE.createListEntriesType();
      } else {
        listEntries = (ListEntriesType)EcoreUtil.copy(managedProperty
          .getListEntries());
      }
    }
    EditListEntriesDialog dialog = new EditListEntriesDialog(
      EditorPlugin.getActiveShell(), listEntries, section);
    if (dialog.open() == 0) {
      valueObject = dialog.getListEntries();
    } else if ((!isNew) && (managedProperty.getListEntries() != null)) {
      valueObject = EcoreUtil.copy(managedProperty
        .getListEntries());
    }
  }
  
  private List getBeanPropertyList(ManagedBeanType managedBean_)
  {
    if (managedBean_.getManagedBeanClass() == null) {
      return null;
    }
    String beanClassName = managedBean_.getManagedBeanClass()
      .getTextContent();
    IType classType = JavaClassUtils.getType(getProject(), beanClassName);
    if (classType == null) {
      return null;
    }
    List list = new ArrayList();
    JavaBeanProperty[] properties = 
      JavaBeanUtils.getBeanProperties(classType);
    if (properties != null) {
      for (int i = 0; i < properties.length; i++) {
        list.add(properties[i]);
      }
    }
    return list;
  }
  
  protected Point getInitialSize()
  {
    Point shellSize = super.getInitialSize();
    return new Point(Math.max(
      convertHorizontalDLUsToPixels(300), x), 
      y);
  }
  
  public IProject getProject()
  {
    if (project == null) {
      project = ((IProject)section.getPage().getEditor().getAdapter(
        IProject.class));
    }
    return project;
  }
  
  protected void okPressed()
  {
    propertyName = nameField.getText();
    propertyClass = classField.getText();
    valueType = valueTypeField.getText();
    
    super.okPressed();
  }
  
  public String getPropertyClass()
  {
    return propertyClass;
  }
  
  public void setAttributeClass(String attributeClass)
  {
    propertyClass = attributeClass;
  }
  
  public String getPropertyName()
  {
    return propertyName;
  }
  
  public void setAttributeName(String attributeName)
  {
    propertyName = attributeName;
  }
  
  public String getValueType()
  {
    return valueType;
  }
  
  public void setValueType(String defaultValue)
  {
    valueType = defaultValue;
  }
  
  public void setProject(IProject project)
  {
    this.project = project;
  }
  
  public Object getValueObject()
  {
    return valueObject;
  }
  
  public void setValueObject(Object valueObject)
  {
    this.valueObject = valueObject;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditManagedPropertyDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringDialogField;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;

class AddEditMapEntryDialog$1
  extends SelectionAdapter
{
  AddEditMapEntryDialog$1(AddEditMapEntryDialog paramAddEditMapEntryDialog) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    AddEditMapEntryDialog.access$0(this$0).setEnabled(!AddEditMapEntryDialog.access$1(this$0).getSelection());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditMapEntryDialog.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.LayoutUtil;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringDialogField;
import org.eclipse.jst.jsf.common.ui.internal.guiutils.SWTUtils;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class AddEditMapEntryDialog
  extends Dialog
{
  private static final int MIN_DIALOG_WIDTH = 300;
  private static final int VALUE_DEFAULT_LINENUMS = 10;
  private boolean isNew;
  private StringDialogField keyField;
  private Button nullValueTypeButton;
  private StringDialogField valueField;
  private String key;
  private String value;
  private boolean isNullValue;
  
  public AddEditMapEntryDialog(Shell parentShell, boolean isNew)
  {
    super(parentShell);
    this.isNew = isNew;
  }
  
  public AddEditMapEntryDialog(Shell parentShell, String attributeName, String attributeClass, String defaultValue, String suggestedValue)
  {
    super(parentShell);
    isNew = false;
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    if (isNew) {
      newShell.setText(EditorMessages.MapEntryEditPage_Title);
    } else {
      newShell.setText(EditorMessages.MapEntryEditPage_Title);
    }
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite container = new Composite(parent, 4);
    GridData gd = new GridData(1808);
    container.setLayoutData(gd);
    
    GridLayout gl = new GridLayout();
    verticalSpacing = 0;
    numColumns = 1;
    container.setLayout(gl);
    
    layoutKeySection(container);
    layoutValueSection(container);
    if (!isNew) {
      initFields();
    }
    return container;
  }
  
  private void initFields()
  {
    keyField.setText(key);
    if (isNullValue)
    {
      nullValueTypeButton.setSelection(true);
      valueField.setText("");
      valueField.setEnabled(false);
    }
    else
    {
      nullValueTypeButton.setSelection(false);
      valueField.setEnabled(true);
      valueField.setText(value);
    }
  }
  
  public void layoutKeySection(Composite parent)
  {
    keyField = new StringDialogField();
    keyField.setLabelText(EditorMessages.MapEntryEditGroup_Key);
    
    Composite keySection = SWTUtils.createComposite(parent, 0);
    
    GridData gd = new GridData(768);
    keySection.setLayoutData(gd);
    
    int numberOfColumns = 3;
    GridLayout gl = new GridLayout(numberOfColumns, false);
    keySection.setLayout(gl);
    
    keyField.doFillIntoGrid(null, keySection, numberOfColumns);
    
    LayoutUtil.setGrabHorizontal(keyField.getTextControl(null, keySection), 
      true);
  }
  
  public void layoutValueSection(Composite parent)
  {
    Composite valueSection = SWTUtils.createComposite(parent, 0);
    
    GridData gd = new GridData(1808);
    valueSection.setLayoutData(gd);
    
    int numberOfColumns = 3;
    GridLayout gl = new GridLayout(numberOfColumns, false);
    verticalSpacing = 10;
    marginHeight = 10;
    valueSection.setLayout(gl);
    
    nullValueTypeButton = SWTUtils.createCheckBox(valueSection, 
      EditorMessages.AddEditMapEntryDialog_NullValue, 2);
    
    nullValueTypeButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        valueField.setEnabled(!nullValueTypeButton.getSelection());
      }
    });
    valueField = new StringDialogField(10);
    
    valueField.setLabelText(EditorMessages.ValueEditGroup_Value);
    valueField.doFillIntoGrid(null, valueSection, numberOfColumns);
    
    gd = (GridData)valueField.getLabelControl(null, valueSection)
      .getLayoutData();
    verticalAlignment |= 0x400;
    LayoutUtil.setHorizontalGrabbing(valueField.getTextControl(null, 
      valueSection));
    
    gd = (GridData)valueField.getTextControl(null, valueSection)
      .getLayoutData();
    verticalAlignment |= 0x410;
  }
  
  protected Point getInitialSize()
  {
    Point shellSize = super.getInitialSize();
    return new Point(Math.max(
      convertHorizontalDLUsToPixels(300), x), 
      y);
  }
  
  protected void okPressed()
  {
    key = keyField.getText().trim();
    value = valueField.getText().trim();
    isNullValue = nullValueTypeButton.getSelection();
    super.okPressed();
  }
  
  public boolean isNullValue()
  {
    return isNullValue;
  }
  
  public void setNullValue(boolean isNullValue)
  {
    this.isNullValue = isNullValue;
  }
  
  public String getKey()
  {
    return key;
  }
  
  public void setKey(String key)
  {
    this.key = key;
  }
  
  public String getValue()
  {
    return value;
  }
  
  public void setValue(String value)
  {
    this.value = value;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditMapEntryDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.ClassButtonDialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.LayoutUtil;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringDialogField;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.swt.graphics.Point;
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.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;

public class AddEditPropertyDialog
  extends Dialog
{
  private static final int MIN_DIALOG_WIDTH = 300;
  private StringDialogField propertyNameField;
  private ClassButtonDialogField propertyClassField;
  private StringDialogField defaultValueField;
  private StringDialogField suggestedValueField;
  private IProject project;
  private boolean isNew;
  private String propertyName;
  private String propertyClass;
  private String defaultValue;
  private String suggestedValue;
  
  public AddEditPropertyDialog(Shell parentShell, boolean isNew)
  {
    super(parentShell);
    this.isNew = isNew;
  }
  
  public AddEditPropertyDialog(Shell parentShell, String propertyName, String propertyClass, String defaultValue, String suggestedValue)
  {
    super(parentShell);
    this.propertyName = propertyName;
    this.propertyClass = propertyClass;
    this.defaultValue = defaultValue;
    this.suggestedValue = suggestedValue;
    isNew = false;
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    if (isNew) {
      newShell.setText(EditorMessages.PropertySection_Dialog_Title_Add);
    } else {
      newShell.setText(EditorMessages.PropertySection_Dialog_Title_Edit);
    }
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite container = new Composite(parent, 4);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    marginWidth = (marginHeight = 5);
    container.setLayout(layout);
    GridData gd = new GridData(1808);
    container.setLayoutData(gd);
    
    TabFolder tabFolder = new TabFolder(container, 4);
    tabFolder.setLayoutData(gd);
    TabItem generalTabItem = new TabItem(tabFolder, 0);
    generalTabItem
      .setText(EditorMessages.PropertySection_Dialog_Tab_General);
    Control control = createGeneralTabControl(generalTabItem.getParent());
    generalTabItem.setControl(control);
    return container;
  }
  
  private Control createGeneralTabControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 5;
    composite.setLayout(layout);
    GridData gd = new GridData(1808);
    composite.setLayoutData(gd);
    composite.setFont(parent.getFont());
    
    propertyNameField = new StringDialogField();
    
    propertyNameField
      .setLabelText(EditorMessages.PropertySection_Dialog_PropertyName);
    
    propertyClassField = new ClassButtonDialogField(getProject());
    
    propertyClassField
      .setLabelText(EditorMessages.PropertySection_Dialog_PropertyClass);
    
    propertyClassField.setAutoOpenResource(false);
    
    defaultValueField = new StringDialogField();
    defaultValueField
      .setLabelText(EditorMessages.PropertySection_Dialog_DefaultValue);
    
    suggestedValueField = new StringDialogField();
    suggestedValueField
      .setLabelText(EditorMessages.PropertySection_Dialog_SuggestedValue);
    
    GridData data = new GridData(1808);
    composite.setLayoutData(data);
    
    int numberOfColumns = 4;
    GridLayout gl = new GridLayout(numberOfColumns, false);
    composite.setLayout(gl);
    
    propertyNameField.doFillIntoGrid(null, composite, numberOfColumns);
    
    propertyClassField.doFillIntoGrid(null, composite, numberOfColumns);
    
    defaultValueField.doFillIntoGrid(null, composite, numberOfColumns);
    
    suggestedValueField.doFillIntoGrid(null, composite, numberOfColumns);
    
    LayoutUtil.setHorizontalGrabbing(propertyClassField.getTextControl(
      null, composite));
    
    propertyNameField.setText(propertyName);
    propertyClassField.setText(propertyClass);
    defaultValueField.setText(defaultValue);
    suggestedValueField.setText(suggestedValue);
    
    return composite;
  }
  
  protected Point getInitialSize()
  {
    Point shellSize = super.getInitialSize();
    return new Point(Math.max(
      convertHorizontalDLUsToPixels(300), x), 
      y);
  }
  
  private IProject getProject()
  {
    return project;
  }
  
  protected void okPressed()
  {
    propertyName = propertyNameField.getText();
    propertyClass = propertyClassField.getText();
    defaultValue = defaultValueField.getText();
    suggestedValue = suggestedValueField.getText();
    
    super.okPressed();
  }
  
  public String getDefaultValue()
  {
    return defaultValue;
  }
  
  public void setDefaultValue(String defaultValue)
  {
    this.defaultValue = defaultValue;
  }
  
  public String getPropertyClass()
  {
    return propertyClass;
  }
  
  public void setPropertyClass(String propertyClass)
  {
    this.propertyClass = propertyClass;
  }
  
  public String getPropertyName()
  {
    return propertyName;
  }
  
  public void setPropertyName(String propertyName)
  {
    this.propertyName = propertyName;
  }
  
  public String getSuggestedValue()
  {
    return suggestedValue;
  }
  
  public void setSuggestedValue(String suggestedValue)
  {
    this.suggestedValue = suggestedValue;
  }
  
  public void setProject(IProject project)
  {
    this.project = project;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditPropertyDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IStringButtonAdapter;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringButtonDialogField;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.jst.jsf.facesconfig.ui.page.IFacesConfigPage;
import org.eclipse.swt.widgets.Shell;

class AddEditRendererDialog$1
  implements IStringButtonAdapter
{
  AddEditRendererDialog$1(AddEditRendererDialog paramAddEditRendererDialog) {}
  
  public void changeControlPressed(DialogField field)
  {
    Shell shell = EditorPlugin.getActiveShell();
    ComponentListDialog dialog = new ComponentListDialog(
      shell, 
      AddEditRendererDialog.access$0(this$0), 
      AddEditRendererDialog.access$0(this$0).getInput(), 
      EditorMessages.RendererSection_Dialog_ComponentFamilyCaption, 
      EditorMessages.RendererSection_Dialog_ComponentFamilyLabel);
    if (dialog.open() == 0) {
      AddEditRendererDialog.access$1(this$0).setText(dialog.getValue());
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditRendererDialog.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.core.resources.IProject;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.ClassButtonDialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IStringButtonAdapter;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.LayoutUtil;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringButtonDialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.StringDialogField;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.jst.jsf.facesconfig.ui.page.IFacesConfigPage;
import org.eclipse.swt.graphics.Point;
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.Shell;
import org.eclipse.swt.widgets.TabFolder;
import org.eclipse.swt.widgets.TabItem;

public class AddEditRendererDialog
  extends Dialog
{
  private static final int MIN_DIALOG_WIDTH = 300;
  private StringDialogField rendererNameField;
  private ClassButtonDialogField rendererClassField;
  private StringButtonDialogField componentFamilyField;
  private StringDialogField renderTypeField;
  private IProject project;
  private String rendererName;
  private String rendererClass;
  private String componentFamily;
  private String rendererType;
  private boolean isNew;
  private IFacesConfigPage page;
  
  public AddEditRendererDialog(Shell parentShell, IFacesConfigPage page, boolean isNew)
  {
    super(parentShell);
    this.page = page;
    this.isNew = isNew;
  }
  
  public AddEditRendererDialog(Shell parentShell, String rendererName, String rendererClass, String componentFamily, String renderType)
  {
    super(parentShell);
    this.rendererName = rendererName;
    this.rendererClass = rendererClass;
    this.componentFamily = componentFamily;
    rendererType = renderType;
    isNew = false;
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    if (isNew) {
      newShell.setText(EditorMessages.RendererSection_Dialog_Title_Add);
    } else {
      newShell.setText(EditorMessages.RendererSection_Dialog_Title_Edit);
    }
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite container = new Composite(parent, 4);
    GridLayout layout = new GridLayout();
    numColumns = 2;
    marginWidth = (marginHeight = 5);
    container.setLayout(layout);
    GridData gd = new GridData(1808);
    container.setLayoutData(gd);
    
    TabFolder tabFolder = new TabFolder(container, 4);
    tabFolder.setLayoutData(gd);
    TabItem generalTabItem = new TabItem(tabFolder, 0);
    generalTabItem
      .setText(EditorMessages.RendererSection_Dialog_Tab_General);
    Control control = createGeneralTabControl(generalTabItem.getParent());
    generalTabItem.setControl(control);
    return container;
  }
  
  private Control createGeneralTabControl(Composite parent)
  {
    Composite composite = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    numColumns = 5;
    composite.setLayout(layout);
    GridData gd = new GridData(1808);
    composite.setLayoutData(gd);
    composite.setFont(parent.getFont());
    
    rendererNameField = new StringDialogField();
    rendererNameField
      .setLabelText(EditorMessages.RendererSection_Dialog_DisplayName);
    
    rendererClassField = new ClassButtonDialogField(getProject());
    
    rendererClassField
      .setLabelText(EditorMessages.RendererSection_Dialog_RendererClass);
    rendererClassField.setProject(getProject());
    rendererClassField.setSuperClassName("javax.faces.render.Renderer");
    rendererClassField.setAutoOpenResource(false);
    
    componentFamilyField = new StringButtonDialogField(
      new IStringButtonAdapter()
      {
        public void changeControlPressed(DialogField field)
        {
          Shell shell = EditorPlugin.getActiveShell();
          ComponentListDialog dialog = new ComponentListDialog(
            shell, 
            page, 
            page.getInput(), 
            EditorMessages.RendererSection_Dialog_ComponentFamilyCaption, 
            EditorMessages.RendererSection_Dialog_ComponentFamilyLabel);
          if (dialog.open() == 0) {
            componentFamilyField.setText(dialog.getValue());
          }
        }
      });componentFamilyField
      .setLabelText(EditorMessages.RendererSection_Dialog_ComponentFamilyValue);
    
    renderTypeField = new StringDialogField();
    
    renderTypeField
      .setLabelText(EditorMessages.RendererSection_Dialog_TypeValue);
    
    GridData data = new GridData(1808);
    composite.setLayoutData(data);
    
    int numberOfColumns = 4;
    GridLayout gl = new GridLayout(numberOfColumns, false);
    composite.setLayout(gl);
    
    rendererNameField.doFillIntoGrid(null, composite, numberOfColumns);
    
    componentFamilyField.doFillIntoGrid(null, composite, numberOfColumns);
    
    renderTypeField.doFillIntoGrid(null, composite, numberOfColumns);
    
    rendererClassField.doFillIntoGrid(null, composite, numberOfColumns);
    
    LayoutUtil.setHorizontalGrabbing(rendererClassField.getTextControl(
      null, composite));
    
    rendererNameField.setText(rendererName);
    rendererClassField.setText(rendererClass);
    componentFamilyField.setText(componentFamily);
    renderTypeField.setText(rendererType);
    
    return composite;
  }
  
  protected Point getInitialSize()
  {
    Point shellSize = super.getInitialSize();
    return new Point(Math.max(
      convertHorizontalDLUsToPixels(300), x), 
      y);
  }
  
  public IProject getProject()
  {
    return project;
  }
  
  protected void okPressed()
  {
    rendererName = rendererNameField.getText();
    rendererClass = rendererClassField.getText();
    componentFamily = componentFamilyField.getText();
    rendererType = renderTypeField.getText();
    
    super.okPressed();
  }
  
  public String getRendererClass()
  {
    return rendererClass;
  }
  
  public void setRendererClass(String rendererClass)
  {
    this.rendererClass = rendererClass;
  }
  
  public String getRendererName()
  {
    return rendererName;
  }
  
  public void setRendererName(String rendererName)
  {
    this.rendererName = rendererName;
  }
  
  public String getComponentFamily()
  {
    return componentFamily;
  }
  
  public void setComponentFamily(String componentFamily)
  {
    this.componentFamily = componentFamily;
  }
  
  public String getRendererType()
  {
    return rendererType;
  }
  
  public void setRendererType(String rendererType)
  {
    this.rendererType = rendererType;
  }
  
  public void setProject(IProject project)
  {
    this.project = project;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditRendererDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.dialog;

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jst.jsf.common.ui.internal.guiutils.SWTUtils;
import org.eclipse.jst.jsf.facesconfig.ui.page.IFacesConfigPage;
import org.eclipse.swt.graphics.Point;
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.Shell;
import org.eclipse.swt.widgets.Text;
import org.eclipse.ui.forms.editor.FormEditor;

public class CommonListDialog
  extends Dialog
  implements ISelectionChangedListener, ISelectionProvider
{
  private static final int MIN_DIALOG_WIDTH = 300;
  private Text inputText;
  private StructuredViewer structuredViewer;
  private String value;
  private IFacesConfigPage page;
  private Object input;
  private String label;
  private String caption;
  private static final
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40

Further reading...

For more information on Java 1.5 Tiger, you may find Java 1.5 Tiger, A developer's Notebook by D. Flanagan and B. McLaughlin from O'Reilly of interest.

New!JAR listings


Copyright 2006-2017. Infinite Loop Ltd