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

      }
      if (dialog.getSuggestedValue().length() > 0)
      {
        SuggestedValueType suggestedValueType = FacesConfigFactory.eINSTANCE
          .createSuggestedValueType();
        suggestedValueType.setTextContent(dialog.getSuggestedValue());
        newAttribute.setSuggestedValue(suggestedValueType);
      }
      Command addCommand = AddCommand.create(getEditingDomain(), 
        getInput(), null, newAttribute);
      if (addCommand.canExecute()) {
        getEditingDomain().getCommandStack().execute(addCommand);
      }
    }
  }
  
  private void editButtonSelected()
  {
    AttributeType attribute = (AttributeType)((IStructuredSelection)tableViewer
      .getSelection()).getFirstElement();
    
    Assert.isNotNull(attribute);
    
    Shell shell = EditorPlugin.getActiveShell();
    
    AddEditAttributeDialog dialog = new AddEditAttributeDialog(shell, false);
    dialog.setProject((IProject)getPage().getEditor().getAdapter(
      IProject.class));
    if (attribute.getAttributeName() != null) {
      dialog.setAttributeName(attribute.getAttributeName()
        .getTextContent());
    }
    if (attribute.getAttributeClass() != null) {
      dialog.setAttributeClass(attribute.getAttributeClass()
        .getTextContent());
    }
    if (attribute.getDefaultValue() != null) {
      dialog.setDefaultValue(attribute.getDefaultValue()
        .getTextContent());
    }
    if (attribute.getSuggestedValue() != null) {
      dialog.setSuggestedValue(attribute.getSuggestedValue()
        .getTextContent());
    }
    if (dialog.open() == 0)
    {
      List commands = new ArrayList(4);
      if (attribute.getAttributeName() != null)
      {
        Command cmd1 = SetCommand.create(getEditingDomain(), 
          attribute.getAttributeName(), 
          FacesConfigPackage.eINSTANCE
          .getAttributeNameType_TextContent(), dialog
          .getAttributeName());
        commands.add(cmd1);
      }
      else if (dialog.getAttributeName().length() > 0)
      {
        AttributeNameType attributeNameType = FacesConfigFactory.eINSTANCE
          .createAttributeNameType();
        attributeNameType.setTextContent(dialog.getAttributeName());
        
        Command cmd2 = AddCommand.create(getEditingDomain(), 
          attribute, FacesConfigPackage.eINSTANCE
          .getAttributeType_AttributeName(), 
          attributeNameType);
        commands.add(cmd2);
      }
      if (attribute.getAttributeClass() != null)
      {
        Command cmd3 = SetCommand.create(getEditingDomain(), 
          attribute.getAttributeClass(), 
          FacesConfigPackage.eINSTANCE
          .getAttributeClassType_TextContent(), dialog
          .getAttributeClass());
        commands.add(cmd3);
      }
      else if (dialog.getAttributeClass().length() > 0)
      {
        AttributeClassType attributeClassType = FacesConfigFactory.eINSTANCE
          .createAttributeClassType();
        attributeClassType.setTextContent(dialog.getAttributeClass());
        
        Command cmd4 = AddCommand.create(getEditingDomain(), 
          attribute, FacesConfigPackage.eINSTANCE
          .getAttributeType_AttributeClass(), 
          attributeClassType);
        commands.add(cmd4);
      }
      if (attribute.getDefaultValue() != null)
      {
        Command cmd5 = SetCommand.create(getEditingDomain(), 
          attribute.getDefaultValue(), 
          FacesConfigPackage.eINSTANCE
          .getDefaultValueType_TextContent(), dialog
          .getDefaultValue());
        commands.add(cmd5);
      }
      else if (dialog.getDefaultValue().length() > 0)
      {
        DefaultValueType defaultValueType = FacesConfigFactory.eINSTANCE
          .createDefaultValueType();
        defaultValueType.setTextContent(dialog.getDefaultValue());
        Command cmd6 = AddCommand.create(getEditingDomain(), 
          attribute, FacesConfigPackage.eINSTANCE
          .getAttributeType_DefaultValue(), 
          defaultValueType);
        commands.add(cmd6);
      }
      if (attribute.getSuggestedValue() != null)
      {
        Command cmd7 = SetCommand.create(getEditingDomain(), 
          attribute.getSuggestedValue(), 
          FacesConfigPackage.eINSTANCE
          .getSuggestedValueType_TextContent(), dialog
          .getSuggestedValue());
        commands.add(cmd7);
      }
      else if (dialog.getSuggestedValue().length() > 0)
      {
        SuggestedValueType suggestedValueType = FacesConfigFactory.eINSTANCE
          .createSuggestedValueType();
        suggestedValueType.setTextContent(dialog.getSuggestedValue());
        Command cmd8 = AddCommand.create(getEditingDomain(), 
          attribute, FacesConfigPackage.eINSTANCE
          .getAttributeType_SuggestedValue(), 
          suggestedValueType);
        commands.add(cmd8);
      }
      CompoundCommand command = new CompoundCommand(commands);
      if (command.canExecute())
      {
        getEditingDomain().getCommandStack().execute(command);
        tableViewer.refresh(attribute);
      }
    }
  }
  
  private void removeButtonSelected()
  {
    AttributeType attribute = (AttributeType)((IStructuredSelection)tableViewer
      .getSelection()).getFirstElement();
    
    Assert.isNotNull(attribute);
    
    Command removeCommand = RemoveCommand.create(getEditingDomain(), 
      getInput(), null, attribute);
    if (removeCommand.canExecute())
    {
      getEditingDomain().getCommandStack().execute(removeCommand);
      refreshAll();
    }
  }
  
  public ISelection getSelection()
  {
    return tableViewer.getSelection();
  }
  
  public void setSelection(ISelection selection)
  {
    tableViewer.setSelection(selection);
  }
}

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

import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
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.StringDialogField;
import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

class ComponentGeneralSection$1
  implements IDialogFieldApplyListener
{
  ComponentGeneralSection$1(ComponentGeneralSection paramComponentGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    String newDisplayNameValue = ((StringDialogField)field)
      .getText().trim();
    Command cmd = null;
    ComponentType component = (ComponentType)this$0.getInput();
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (component.getDisplayName().size() > 0)
    {
      DisplayNameType displayName = 
        (DisplayNameType)component.getDisplayName().get(0);
      cmd = SetCommand.create(editingDomain, displayName, 
        FacesConfigPackage.eINSTANCE
        .getDisplayNameType_TextContent(), 
        newDisplayNameValue);
    }
    else
    {
      DisplayNameType displayNameType = FacesConfigFactory.eINSTANCE
        .createDisplayNameType();
      displayNameType.setTextContent(newDisplayNameValue);
      
      displayNameType.eAdapters().add(
        ComponentGeneralSection.access$0(this$0));
      cmd = AddCommand.create(editingDomain, component, 
        FacesConfigPackage.eINSTANCE
        .getComponentType_DisplayName(), 
        displayNameType);
    }
    if (cmd.canExecute()) {
      editingDomain.getCommandStack().execute(cmd);
    }
  }
}

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

import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
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.StringDialogField;
import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.jst.jsf.facesconfig.ui.util.ModelUtil;

class ComponentGeneralSection$2
  implements IDialogFieldApplyListener
{
  ComponentGeneralSection$2(ComponentGeneralSection paramComponentGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    String newDescriptionValue = ((StringDialogField)field)
      .getText().trim();
    
    newDescriptionValue = 
      ModelUtil.escapeEntities(newDescriptionValue);
    Command cmd = null;
    ComponentType component = (ComponentType)this$0.getInput();
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (component.getDescription().size() > 0)
    {
      DescriptionType description = 
        (DescriptionType)component.getDescription().get(0);
      cmd = SetCommand.create(editingDomain, description, 
        FacesConfigPackage.eINSTANCE
        .getDescriptionType_TextContent(), 
        newDescriptionValue);
    }
    else
    {
      DescriptionType description = FacesConfigFactory.eINSTANCE
        .createDescriptionType();
      description.setTextContent(newDescriptionValue);
      
      description.eAdapters().add(
        ComponentGeneralSection.access$0(this$0));
      
      cmd = AddCommand.create(editingDomain, component, 
        FacesConfigPackage.eINSTANCE
        .getComponentType_Description(), 
        description);
    }
    if (cmd.canExecute()) {
      editingDomain.getCommandStack().execute(cmd);
    }
  }
}

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

import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
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.StringDialogField;
import org.eclipse.jst.jsf.facesconfig.emf.ComponentTypeType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

class ComponentGeneralSection$3
  implements IDialogFieldApplyListener
{
  ComponentGeneralSection$3(ComponentGeneralSection paramComponentGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    ComponentTypeType componentType = FacesConfigFactory.eINSTANCE
      .createComponentTypeType();
    componentType
      .setTextContent(((StringDialogField)field)
      .getText());
    
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (editingDomain != null)
    {
      Command command = SetCommand.create(editingDomain, 
        this$0.getInput(), FacesConfigPackage.eINSTANCE
        .getComponentType_ComponentType(), 
        componentType);
      if (command.canExecute()) {
        editingDomain.getCommandStack().execute(command);
      }
    }
  }
}

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

import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
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.StringDialogField;
import org.eclipse.jst.jsf.facesconfig.emf.ComponentClassType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

class ComponentGeneralSection$4
  implements IDialogFieldApplyListener
{
  ComponentGeneralSection$4(ComponentGeneralSection paramComponentGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    ComponentClassType componentClass = FacesConfigFactory.eINSTANCE
      .createComponentClassType();
    componentClass
      .setTextContent(((StringDialogField)field)
      .getText());
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (editingDomain != null)
    {
      Command command = SetCommand.create(editingDomain, 
        this$0.getInput(), FacesConfigPackage.eINSTANCE
        .getComponentType_ComponentClass(), 
        componentClass);
      if (command.canExecute()) {
        editingDomain.getCommandStack().execute(command);
      }
    }
  }
}

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

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

class ComponentGeneralSection$ComponentGeneralAdapter
  extends AdapterImpl
{
  ComponentGeneralSection$ComponentGeneralAdapter(ComponentGeneralSection paramComponentGeneralSection) {}
  
  public boolean isAdapterForType(Object type)
  {
    if (type == ComponentGeneralSection.class) {
      return true;
    }
    return false;
  }
  
  public void notifyChanged(Notification msg)
  {
    if ((msg.getEventType() == 3) || 
      (msg.getEventType() == 4) || 
      (msg.getEventType() == 1)) {
      if ((msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getComponentType_ComponentClass()) || 
        (msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getComponentType_ComponentType()) || 
        (msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getComponentType_DisplayName()) || 
        (msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getComponentType_Description())) {
        this$0.refresh();
      } else if ((msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getDisplayNameType_TextContent()) || 
        (msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getDescriptionType_TextContent())) {
        this$0.refresh();
      }
    }
  }
}

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

import org.eclipse.core.resources.IProject;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.util.EcoreUtil;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
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.IDialogFieldApplyListener;
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.emf.ComponentClassType;
import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
import org.eclipse.jst.jsf.facesconfig.emf.ComponentTypeType;
import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.jst.jsf.facesconfig.ui.page.IFacesConfigPage;
import org.eclipse.jst.jsf.facesconfig.ui.util.ModelUtil;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;

public class ComponentGeneralSection
  extends AbstractFacesConfigSection
{
  private StringDialogField displayNameField;
  private StringDialogField descriptionField;
  private StringDialogField componentTypeField;
  private ClassButtonDialogField componentClassField;
  private ComponentGeneralAdapter componentGeneralAdapter;
  
  public ComponentGeneralSection(Composite parent, IManagedForm managedForm, IFacesConfigPage page, FormToolkit toolkit)
  {
    super(parent, managedForm, page, toolkit, null, null);
    getSection()
      .setText(EditorMessages.ComponentGeneralSection_Name);
    getSection().setDescription(
      EditorMessages.ComponentGeneralSection_Description);
  }
  
  protected void createContents(Composite container, FormToolkit toolkit)
  {
    int numberOfColumns = 4;
    GridLayout layout = new GridLayout(numberOfColumns, false);
    container.setLayout(layout);
    GridData td = new GridData(768);
    container.setLayoutData(td);
    
    toolkit.paintBordersFor(container);
    displayNameField = new StringDialogField();
    displayNameField
      .setLabelText(EditorMessages.ComponentGeneralSection_Label_DisplayName);
    displayNameField.doFillIntoGrid(toolkit, container, numberOfColumns);
    
    displayNameField
      .setDialogFieldApplyListener(new IDialogFieldApplyListener()
      {
        public void dialogFieldApplied(DialogField field)
        {
          String newDisplayNameValue = ((StringDialogField)field)
            .getText().trim();
          Command cmd = null;
          ComponentType component = (ComponentType)getInput();
          EditingDomain editingDomain = getEditingDomain();
          if (component.getDisplayName().size() > 0)
          {
            DisplayNameType displayName = 
              (DisplayNameType)component.getDisplayName().get(0);
            cmd = SetCommand.create(editingDomain, displayName, 
              FacesConfigPackage.eINSTANCE
              .getDisplayNameType_TextContent(), 
              newDisplayNameValue);
          }
          else
          {
            DisplayNameType displayNameType = FacesConfigFactory.eINSTANCE
              .createDisplayNameType();
            displayNameType.setTextContent(newDisplayNameValue);
            
            displayNameType.eAdapters().add(
              ComponentGeneralSection.this.getComponentGeneralAdapter());
            cmd = AddCommand.create(editingDomain, component, 
              FacesConfigPackage.eINSTANCE
              .getComponentType_DisplayName(), 
              displayNameType);
          }
          if (cmd.canExecute()) {
            editingDomain.getCommandStack().execute(cmd);
          }
        }
      });
    descriptionField = new StringDialogField(2);
    descriptionField
      .setLabelText(EditorMessages.ComponentGeneralSection_Label_Description);
    descriptionField.doFillIntoGrid(toolkit, container, numberOfColumns);
    
    descriptionField
      .setDialogFieldApplyListener(new IDialogFieldApplyListener()
      {
        public void dialogFieldApplied(DialogField field)
        {
          String newDescriptionValue = ((StringDialogField)field)
            .getText().trim();
          
          newDescriptionValue = 
            ModelUtil.escapeEntities(newDescriptionValue);
          Command cmd = null;
          ComponentType component = (ComponentType)getInput();
          EditingDomain editingDomain = getEditingDomain();
          if (component.getDescription().size() > 0)
          {
            DescriptionType description = 
              (DescriptionType)component.getDescription().get(0);
            cmd = SetCommand.create(editingDomain, description, 
              FacesConfigPackage.eINSTANCE
              .getDescriptionType_TextContent(), 
              newDescriptionValue);
          }
          else
          {
            DescriptionType description = FacesConfigFactory.eINSTANCE
              .createDescriptionType();
            description.setTextContent(newDescriptionValue);
            
            description.eAdapters().add(
              ComponentGeneralSection.this.getComponentGeneralAdapter());
            
            cmd = AddCommand.create(editingDomain, component, 
              FacesConfigPackage.eINSTANCE
              .getComponentType_Description(), 
              description);
          }
          if (cmd.canExecute()) {
            editingDomain.getCommandStack().execute(cmd);
          }
        }
      });
    componentTypeField = new StringDialogField();
    componentTypeField
      .setLabelText(EditorMessages.ComponentGeneralSection_Label_ComponentType);
    componentTypeField.doFillIntoGrid(toolkit, container, numberOfColumns);
    componentTypeField
      .setDialogFieldApplyListener(new IDialogFieldApplyListener()
      {
        public void dialogFieldApplied(DialogField field)
        {
          ComponentTypeType componentType = FacesConfigFactory.eINSTANCE
            .createComponentTypeType();
          componentType
            .setTextContent(((StringDialogField)field)
            .getText());
          
          EditingDomain editingDomain = getEditingDomain();
          if (editingDomain != null)
          {
            Command command = SetCommand.create(editingDomain, 
              getInput(), FacesConfigPackage.eINSTANCE
              .getComponentType_ComponentType(), 
              componentType);
            if (command.canExecute()) {
              editingDomain.getCommandStack().execute(command);
            }
          }
        }
      });
    componentClassField = new ClassButtonDialogField(null);
    componentClassField
      .setLabelText(EditorMessages.ComponentGeneralSection_Label_ComponentClass);
    componentClassField.doFillIntoGrid(toolkit, container, numberOfColumns);
    LayoutUtil.setHorizontalGrabbing(componentClassField.getTextControl(
      toolkit, container));
    componentClassField.setProject(
      (IProject)getPage().getEditor().getAdapter(IProject.class));
    componentClassField
      .setDialogFieldApplyListener(new IDialogFieldApplyListener()
      {
        public void dialogFieldApplied(DialogField field)
        {
          ComponentClassType componentClass = FacesConfigFactory.eINSTANCE
            .createComponentClassType();
          componentClass
            .setTextContent(((StringDialogField)field)
            .getText());
          EditingDomain editingDomain = getEditingDomain();
          if (editingDomain != null)
          {
            Command command = SetCommand.create(editingDomain, 
              getInput(), FacesConfigPackage.eINSTANCE
              .getComponentType_ComponentClass(), 
              componentClass);
            if (command.canExecute()) {
              editingDomain.getCommandStack().execute(command);
            }
          }
        }
      });componentClassField
      .setSuperClassName("javax.faces.component.UIComponent");
  }
  
  public void refreshAll()
  {
    refresh();
  }
  
  public void refresh()
  {
    super.refresh();
    Object input = getInput();
    if ((input instanceof ComponentType))
    {
      ComponentType component = (ComponentType)input;
      refreshControls(component);
    }
  }
  
  private void refreshControls(ComponentType component)
  {
    if (component.getDisplayName().size() > 0)
    {
      DisplayNameType displayName = 
        (DisplayNameType)component.getDisplayName().get(0);
      displayNameField.setTextWithoutUpdate(displayName
        .getTextContent());
    }
    else
    {
      displayNameField.setTextWithoutUpdate("");
    }
    if (component.getDescription().size() > 0)
    {
      DescriptionType description = 
        (DescriptionType)component.getDescription().get(0);
      String descriptionString = description.getTextContent();
      descriptionString = ModelUtil.unEscapeEntities(descriptionString);
      descriptionField.setTextWithoutUpdate(descriptionString);
    }
    else
    {
      descriptionField.setTextWithoutUpdate("");
    }
    if (component.getComponentType() != null) {
      componentTypeField.setTextWithoutUpdate(component
        .getComponentType().getTextContent());
    } else {
      componentTypeField.setTextWithoutUpdate("");
    }
    if (component.getComponentClass() != null) {
      componentClassField.setTextWithoutUpdate(component
        .getComponentClass().getTextContent());
    } else {
      componentClassField.setTextWithoutUpdate("");
    }
  }
  
  protected void addAdaptersOntoInput(Object newInput)
  {
    ComponentType component = (ComponentType)newInput;
    if (EcoreUtil.getExistingAdapter(component, 
      ComponentGeneralSection.class) == null) {
      component.eAdapters().add(getComponentGeneralAdapter());
    }
    if (component.getDisplayName().size() > 0)
    {
      DisplayNameType displayName = 
        (DisplayNameType)component.getDisplayName().get(0);
      if (EcoreUtil.getExistingAdapter(displayName, 
        ComponentGeneralSection.class) == null) {
        displayName.eAdapters().add(getComponentGeneralAdapter());
      }
    }
    if (component.getDescription().size() > 0)
    {
      DescriptionType description = 
        (DescriptionType)component.getDescription().get(0);
      if (EcoreUtil.getExistingAdapter(description, 
        ComponentGeneralSection.class) == null) {
        description.eAdapters().add(getComponentGeneralAdapter());
      }
    }
  }
  
  protected void removeAdaptersFromInput(Object oldInput)
  {
    ComponentType component = (ComponentType)oldInput;
    if (EcoreUtil.getExistingAdapter(component, 
      ComponentGeneralSection.class) != null) {
      component.eAdapters().remove(getComponentGeneralAdapter());
    }
    if (component.getDisplayName().size() > 0)
    {
      DisplayNameType displayName = 
        (DisplayNameType)component.getDisplayName().get(0);
      if (EcoreUtil.getExistingAdapter(displayName, 
        ComponentGeneralSection.class) != null) {
        displayName.eAdapters().remove(getComponentGeneralAdapter());
      }
    }
    if (component.getDescription().size() > 0)
    {
      DescriptionType description = 
        (DescriptionType)component.getDescription().get(0);
      if (EcoreUtil.getExistingAdapter(description, 
        ComponentGeneralSection.class) != null) {
        description.eAdapters().remove(getComponentGeneralAdapter());
      }
    }
  }
  
  private Adapter getComponentGeneralAdapter()
  {
    if (componentGeneralAdapter == null) {
      componentGeneralAdapter = new ComponentGeneralAdapter();
    }
    return componentGeneralAdapter;
  }
  
  class ComponentGeneralAdapter
    extends AdapterImpl
  {
    ComponentGeneralAdapter() {}
    
    public boolean isAdapterForType(Object type)
    {
      if (type == ComponentGeneralSection.class) {
        return true;
      }
      return false;
    }
    
    public void notifyChanged(Notification msg)
    {
      if ((msg.getEventType() == 3) || 
        (msg.getEventType() == 4) || 
        (msg.getEventType() == 1)) {
        if ((msg.getFeature() == FacesConfigPackage.eINSTANCE
          .getComponentType_ComponentClass()) || 
          (msg.getFeature() == FacesConfigPackage.eINSTANCE
          .getComponentType_ComponentType()) || 
          (msg.getFeature() == FacesConfigPackage.eINSTANCE
          .getComponentType_DisplayName()) || 
          (msg.getFeature() == FacesConfigPackage.eINSTANCE
          .getComponentType_Description())) {
          refresh();
        } else if ((msg.getFeature() == FacesConfigPackage.eINSTANCE
          .getDisplayNameType_TextContent()) || 
          (msg.getFeature() == FacesConfigPackage.eINSTANCE
          .getDescriptionType_TextContent())) {
          refresh();
        }
      }
    }
  }
}

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

import org.eclipse.emf.ecore.EClass;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

class ComponentMasterSection$1
  extends ViewerFilter
{
  ComponentMasterSection$1(ComponentMasterSection paramComponentMasterSection) {}
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    return 
      FacesConfigPackage.eINSTANCE.getComponentType().isInstance(element);
  }
}

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

import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jst.jsf.facesconfig.emf.ComponentType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.jst.jsf.facesconfig.ui.page.FacesConfigMasterDetailPage;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.IManagedForm;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;

public class ComponentMasterSection
  extends FacesConfigMasterSection
{
  public ComponentMasterSection(Composite parent, IManagedForm managedForm, FormToolkit toolkit, FacesConfigMasterDetailPage page)
  {
    super(parent, managedForm, toolkit, page, null, null);
    getSection().setText(EditorMessages.ComponentMasterSection_Name);
    getSection().setDescription(
      EditorMessages.ComponentMasterSection_Description);
  }
  
  protected void configViewer(StructuredViewer structuredViewer)
  {
    super.configViewer(structuredViewer);
    structuredViewer.addFilter(new ViewerFilter()
    {
      public boolean select(Viewer viewer, Object parentElement, Object element)
      {
        return 
          FacesConfigPackage.eINSTANCE.getComponentType().isInstance(element);
      }
    });
  }
  
  protected void addButtonSelected(SelectionEvent e)
  {
    ComponentType component = FacesConfigFactory.eINSTANCE
      .createComponentType();
    
    Command command = AddCommand.create(getEditingDomain(), 
      getInput(), FacesConfigPackage.eINSTANCE
      .getFacesConfigType_Component(), component);
    if (command.canExecute())
    {
      getEditingDomain().getCommandStack().execute(command);
      IStructuredSelection selection = new StructuredSelection(component);
      getStructuredViewer().refresh();
      getStructuredViewer().setSelection(selection);
    }
  }
}

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

import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
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.StringDialogField;
import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

class ConverterGeneralSection$1
  implements IDialogFieldApplyListener
{
  ConverterGeneralSection$1(ConverterGeneralSection paramConverterGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    String newDisplayNameValue = ((StringDialogField)field)
      .getText().trim();
    Command cmd = null;
    ConverterType Converter = (ConverterType)this$0.getInput();
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (Converter.getDisplayName().size() > 0)
    {
      DisplayNameType displayName = 
        (DisplayNameType)Converter.getDisplayName().get(0);
      cmd = SetCommand.create(editingDomain, displayName, 
        FacesConfigPackage.eINSTANCE
        .getDisplayNameType_TextContent(), 
        newDisplayNameValue);
    }
    else
    {
      DisplayNameType displayNameType = FacesConfigFactory.eINSTANCE
        .createDisplayNameType();
      displayNameType.setTextContent(newDisplayNameValue);
      
      displayNameType.eAdapters().add(
        ConverterGeneralSection.access$0(this$0));
      cmd = AddCommand.create(editingDomain, Converter, 
        FacesConfigPackage.eINSTANCE
        .getConverterType_DisplayName(), 
        displayNameType);
    }
    if (cmd.canExecute()) {
      editingDomain.getCommandStack().execute(cmd);
    }
  }
}

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

import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
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.StringDialogField;
import org.eclipse.jst.jsf.facesconfig.emf.ConverterType;
import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.jst.jsf.facesconfig.ui.util.ModelUtil;

class ConverterGeneralSection$2
  implements IDialogFieldApplyListener
{
  ConverterGeneralSection$2(ConverterGeneralSection paramConverterGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    String newDescriptionValue = ((StringDialogField)field)
      .getText().trim();
    
    newDescriptionValue = 
      ModelUtil.escapeEntities(newDescriptionValue);
    Command cmd = null;
    ConverterType Converter = (ConverterType)this$0.getInput();
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (Converter.getDescription().size() > 0)
    {
      DescriptionType description = 
        (DescriptionType)Converter.getDescription().get(0);
      cmd = SetCommand.create(editingDomain, description, 
        FacesConfigPackage.eINSTANCE
        .getDescriptionType_TextContent(), 
        newDescriptionValue);
    }
    else
    {
      DescriptionType description = FacesConfigFactory.eINSTANCE
        .createDescriptionType();
      description.setTextContent(newDescriptionValue);
      
      description.eAdapters().add(
        ConverterGeneralSection.access$0(this$0));
      cmd = AddCommand.create(editingDomain, Converter, 
        FacesConfigPackage.eINSTANCE
        .getConverterType_Description(), 
        description);
    }
    if (cmd.canExecute()) {
      editingDomain.getCommandStack().execute(cmd);
    }
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
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.StringDialogField;
import org.eclipse.jst.jsf.facesconfig.emf.ConverterIdType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

class ConverterGeneralSection$3
  implements IDialogFieldApplyListener
{
  ConverterGeneralSection$3(ConverterGeneralSection paramConverterGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    ConverterIdType converterIdType = FacesConfigFactory.eINSTANCE
      .createConverterIdType();
    
    converterIdType
      .setTextContent(((StringDialogField)field)
      .getText());
    
    EditingDomain editingDomain = this$0.getEditingDomain();
    List commands = new ArrayList(2);
    Command cmd1 = SetCommand.create(editingDomain, 
      this$0.getInput(), FacesConfigPackage.eINSTANCE
      .getConverterType_ConverterForClass(), 
      SetCommand.UNSET_VALUE);
    commands.add(cmd1);
    Command cmd2 = SetCommand.create(editingDomain, 
      this$0.getInput(), FacesConfigPackage.eINSTANCE
      .getConverterType_ConverterId(), 
      converterIdType);
    commands.add(cmd2);
    Command command = new CompoundCommand(commands);
    if ((editingDomain != null) && 
      (command.canExecute()))
    {
      editingDomain.getCommandStack().execute(command);
      this$0.refresh();
    }
  }
}

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

import java.util.ArrayList;
import java.util.List;
import org.eclipse.emf.common.command.Command;
import org.eclipse.emf.common.command.CommandStack;
import org.eclipse.emf.common.command.CompoundCommand;
import org.eclipse.emf.edit.command.SetCommand;
import org.eclipse.emf.edit.domain.EditingDomain;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.IDialogFieldApplyListener;
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