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

d cmd3 = SetCommand.create(getEditingDomain(), 
          property.getPropertyClass(), 
          FacesConfigPackage.eINSTANCE
          .getPropertyClassType_TextContent(), dialog
          .getPropertyClass());
        commands.add(cmd3);
      }
      else if (dialog.getPropertyClass().length() > 0)
      {
        PropertyClassType propertyClassType = FacesConfigFactory.eINSTANCE
          .createPropertyClassType();
        propertyClassType.setTextContent(dialog.getPropertyClass());
        
        Command cmd4 = AddCommand.create(getEditingDomain(), 
          property, FacesConfigPackage.eINSTANCE
          .getPropertyType_PropertyClass(), 
          propertyClassType);
        commands.add(cmd4);
      }
      if (property.getDefaultValue() != null)
      {
        Command cmd5 = SetCommand.create(getEditingDomain(), 
          property.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(), 
          property, FacesConfigPackage.eINSTANCE
          .getPropertyType_DefaultValue(), 
          defaultValueType);
        commands.add(cmd6);
      }
      if (property.getSuggestedValue() != null)
      {
        Command cmd7 = SetCommand.create(getEditingDomain(), 
          property.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(), 
          property, FacesConfigPackage.eINSTANCE
          .getPropertyType_SuggestedValue(), 
          suggestedValueType);
        commands.add(cmd8);
      }
      CompoundCommand command = new CompoundCommand(commands);
      if (command.canExecute())
      {
        getEditingDomain().getCommandStack().execute(command);
        tableViewer.refresh(property);
      }
    }
  }
  
  private void removeButtonSelected()
  {
    PropertyType property = (PropertyType)((IStructuredSelection)tableViewer
      .getSelection()).getFirstElement();
    
    Assert.isNotNull(property);
    
    Command removeCommand = RemoveCommand.create(getEditingDomain(), 
      getInput(), null, property);
    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.PropertySection
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.facesconfig.ui.section;

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class RendererSection$1
  extends SelectionAdapter
{
  RendererSection$1(RendererSection paramRendererSection) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    RendererSection.access$0(this$0);
  }
}

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

import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;

class RendererSection$2
  extends MouseAdapter
{
  RendererSection$2(RendererSection paramRendererSection) {}
  
  public void mouseDoubleClick(MouseEvent e)
  {
    if (((IStructuredSelection)RendererSection.access$1(this$0).getSelection()).size() > 0) {
      RendererSection.access$2(this$0);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.section.RendererSection.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.ecore.EClass;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;

class RendererSection$3
  extends ViewerFilter
{
  RendererSection$3(RendererSection paramRendererSection) {}
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    return 
      FacesConfigPackage.eINSTANCE.getRendererType().isInstance(element);
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class RendererSection$4
  extends SelectionAdapter
{
  RendererSection$4(RendererSection paramRendererSection) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    RendererSection.access$3(this$0);
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class RendererSection$5
  extends SelectionAdapter
{
  RendererSection$5(RendererSection paramRendererSection) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    RendererSection.access$2(this$0);
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class RendererSection$6
  extends SelectionAdapter
{
  RendererSection$6(RendererSection paramRendererSection) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    RendererSection.access$4(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.section.RendererSection.6
 * 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.core.resources.IProject;
import org.eclipse.core.runtime.Assert;
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.common.util.EList;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EReference;
import org.eclipse.emf.edit.command.AddCommand;
import org.eclipse.emf.edit.command.RemoveCommand;
import org.eclipse.emf.edit.command.SetCommand;
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.viewers.ColumnWeightData;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TableLayout;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jst.jsf.facesconfig.emf.ComponentFamilyType;
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.emf.RenderKitType;
import org.eclipse.jst.jsf.facesconfig.emf.RendererClassType;
import org.eclipse.jst.jsf.facesconfig.emf.RendererType;
import org.eclipse.jst.jsf.facesconfig.emf.RendererTypeType;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.jst.jsf.facesconfig.ui.dialog.AddEditRendererDialog;
import org.eclipse.jst.jsf.facesconfig.ui.page.IFacesConfigPage;
import org.eclipse.swt.events.MouseAdapter;
import org.eclipse.swt.events.MouseEvent;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
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.Shell;
import org.eclipse.swt.widgets.Table;
import org.eclipse.swt.widgets.TableColumn;
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 RendererSection
  extends AbstractFacesConfigSection
{
  private static final int TABLE_DEFAULT_HEIGHT = 160;
  private TableViewer tableViewer;
  private Button removeButton;
  private Button editButton;
  
  public RendererSection(Composite parent, IManagedForm managedForm, IFacesConfigPage page, FormToolkit toolkit)
  {
    super(parent, managedForm, page, toolkit, null, null);
    getSection().setText(EditorMessages.RendererSection_Name);
    getSection().setDescription(
      EditorMessages.RendererSection_Description);
  }
  
  protected void createContents(Composite container, FormToolkit toolkit)
  {
    GridLayout gl = new GridLayout();
    horizontalSpacing = 0;
    marginWidth = 0;
    numColumns = 2;
    container.setLayout(gl);
    GridData td = new GridData(1808);
    container.setLayoutData(td);
    
    toolkit.paintBordersFor(container);
    
    Composite RendererSection = toolkit.createComposite(container);
    GridLayout gl2 = new GridLayout();
    horizontalSpacing = 0;
    verticalSpacing = 0;
    marginWidth = 0;
    marginHeight = 0;
    numColumns = 2;
    RendererSection.setLayout(gl2);
    GridData gd = new GridData(1810);
    
    RendererSection.setLayoutData(gd);
    
    createTableSection(RendererSection, toolkit);
    createButtonsSection(RendererSection, toolkit);
  }
  
  private void createTableSection(Composite container, FormToolkit toolkit)
  {
    Composite tableContainer = toolkit.createComposite(container);
    GridData gd = new GridData(1808);
    
    tableContainer.setLayoutData(gd);
    toolkit.paintBordersFor(tableContainer);
    
    GridLayout gl = new GridLayout();
    tableContainer.setLayout(gl);
    
    Table table = new Table(tableContainer, 68352);
    
    gd = new GridData(1808);
    horizontalSpan = 1;
    heightHint = 160;
    table.setLayoutData(gd);
    
    table.setHeaderVisible(true);
    table.setLinesVisible(true);
    TableLayout layout = new TableLayout();
    table.setLayout(layout);
    
    TableColumn nameCol = new TableColumn(table, 0);
    layout.addColumnData(new ColumnWeightData(1, true));
    nameCol.setText(EditorMessages.RendererSection_Table_NameColumn);
    
    TableColumn valueCol = new TableColumn(table, 0);
    layout.addColumnData(new ColumnWeightData(1, true));
    valueCol
      .setText(EditorMessages.RendererSection_Table_ComponentFamilyColumn);
    
    TableColumn suggestedValueCol = new TableColumn(table, 0);
    layout.addColumnData(new ColumnWeightData(1, true));
    suggestedValueCol
      .setText(EditorMessages.RendererSection_Table_TypeColumn);
    
    TableColumn classCol = new TableColumn(table, 0);
    layout.addColumnData(new ColumnWeightData(1, true));
    classCol.setText(EditorMessages.RendererSection_Table_ClassColumn);
    
    table.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        RendererSection.this.updateButtons();
      }
    });
    table.addMouseListener(new MouseAdapter()
    {
      public void mouseDoubleClick(MouseEvent e)
      {
        if (((IStructuredSelection)tableViewer.getSelection()).size() > 0) {
          RendererSection.this.editButtonSelected();
        }
      }
    });
    tableViewer = new TableViewer(table);
    tableViewer.setContentProvider(new AdapterFactoryContentProvider(
      getAdapterFactory()));
    tableViewer.setLabelProvider(new AdapterFactoryLabelProvider(
      getAdapterFactory()));
    
    tableViewer.addFilter(new ViewerFilter()
    {
      public boolean select(Viewer viewer, Object parentElement, Object element)
      {
        return 
          FacesConfigPackage.eINSTANCE.getRendererType().isInstance(element);
      }
    });
    tableViewer.addSelectionChangedListener(this);
  }
  
  private void updateButtons()
  {
    if (((IStructuredSelection)tableViewer.getSelection()).size() > 0)
    {
      editButton.setEnabled(true);
      removeButton.setEnabled(true);
    }
    else
    {
      editButton.setEnabled(false);
      removeButton.setEnabled(false);
    }
  }
  
  private void createButtonsSection(Composite container, FormToolkit toolkit)
  {
    Composite operationContainer = toolkit.createComposite(container);
    GridData gd = new GridData(1042);
    
    operationContainer.setLayoutData(gd);
    GridLayout gl = new GridLayout();
    operationContainer.setLayout(gl);
    
    Button addButton = toolkit.createButton(operationContainer, 
      EditorMessages.UI_Button_Add_more, 
      8);
    gd = new GridData(770);
    
    grabExcessHorizontalSpace = false;
    addButton.setLayoutData(gd);
    
    editButton = toolkit.createButton(operationContainer, 
      EditorMessages.UI_Button_Edit_more, 
      8);
    gd = new GridData(770);
    
    grabExcessHorizontalSpace = false;
    editButton.setLayoutData(gd);
    
    removeButton = toolkit.createButton(operationContainer, 
      EditorMessages.UI_Button_Remove, 
      8);
    gd = new GridData(770);
    
    grabExcessHorizontalSpace = false;
    removeButton.setLayoutData(gd);
    
    addButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        RendererSection.this.addButtonSelected();
      }
    });
    editButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        RendererSection.this.editButtonSelected();
      }
    });
    removeButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        RendererSection.this.removeButtonSelected();
      }
    });
  }
  
  private EReference getEReference()
  {
    EReference reference = null;
    if ((getInput() instanceof RenderKitType)) {
      reference = 
        FacesConfigPackage.eINSTANCE.getRenderKitType_Renderer();
    }
    return reference;
  }
  
  public void refreshAll()
  {
    tableViewer.setInput(getInput());
    updateButtons();
  }
  
  public void refresh()
  {
    super.refresh();
    tableViewer.refresh();
    updateButtons();
  }
  
  private void addButtonSelected()
  {
    Shell shell = EditorPlugin.getActiveShell();
    
    AddEditRendererDialog dialog = new AddEditRendererDialog(shell, 
      getPage(), true);
    dialog.setProject((IProject)getPage().getEditor().getAdapter(
      IProject.class));
    if (dialog.open() == 0)
    {
      RendererType newRenderer = FacesConfigFactory.eINSTANCE
        .createRendererType();
      if (dialog.getRendererName().length() > 0)
      {
        DisplayNameType diaplayName = FacesConfigFactory.eINSTANCE
          .createDisplayNameType();
        diaplayName.setTextContent(dialog.getRendererName());
        newRenderer.getDisplayName().add(diaplayName);
      }
      if (dialog.getRendererClass().length() > 0)
      {
        RendererClassType RendererClassType = FacesConfigFactory.eINSTANCE
          .createRendererClassType();
        RendererClassType.setTextContent(dialog.getRendererClass());
        newRenderer.setRendererClass(RendererClassType);
      }
      if (dialog.getComponentFamily().length() > 0)
      {
        ComponentFamilyType componentFamilyType = FacesConfigFactory.eINSTANCE
          .createComponentFamilyType();
        componentFamilyType.setTextContent(dialog.getComponentFamily());
        newRenderer.setComponentFamily(componentFamilyType);
      }
      if (dialog.getRendererType().length() > 0)
      {
        RendererTypeType rendererType = FacesConfigFactory.eINSTANCE
          .createRendererTypeType();
        rendererType.setTextContent(dialog.getRendererType());
        newRenderer.setRendererType(rendererType);
      }
      Command addCommand = AddCommand.create(getEditingDomain(), 
        getInput(), getEReference(), newRenderer);
      if (addCommand.canExecute()) {
        getEditingDomain().getCommandStack().execute(addCommand);
      }
    }
  }
  
  private void editButtonSelected()
  {
    RendererType renderer = (RendererType)((IStructuredSelection)tableViewer
      .getSelection()).getFirstElement();
    
    Assert.isNotNull(renderer);
    
    Shell shell = EditorPlugin.getActiveShell();
    
    AddEditRendererDialog dialog = new AddEditRendererDialog(shell, 
      getPage(), false);
    dialog.setProject((IProject)getPage().getEditor().getAdapter(
      IProject.class));
    if ((renderer.getDisplayName() != null) && 
      (renderer.getDisplayName().size() > 0))
    {
      String name = ((DisplayNameType)renderer.getDisplayName().get(0))
        .getTextContent();
      if (name == null) {
        name = "";
      }
      dialog.setRendererName(name);
    }
    if (renderer.getRendererClass() != null) {
      dialog.setRendererClass(renderer.getRendererClass()
        .getTextContent());
    }
    if (renderer.getComponentFamily() != null) {
      dialog.setComponentFamily(renderer.getComponentFamily()
        .getTextContent());
    }
    if (renderer.getRendererType() != null) {
      dialog.setRendererType(renderer.getRendererType().getTextContent());
    }
    if (dialog.open() == 0)
    {
      List commands = new ArrayList(4);
      if ((renderer.getDisplayName() != null) && 
        (renderer.getDisplayName().size() > 0))
      {
        DisplayNameType diaplayName = FacesConfigFactory.eINSTANCE
          .createDisplayNameType();
        diaplayName.setTextContent(dialog.getRendererName());
        
        Command cmd1 = SetCommand.create(getEditingDomain(), 
          renderer.getDisplayName().get(0), 
          FacesConfigPackage.eINSTANCE
          .getRendererType_DisplayName(), diaplayName);
        commands.add(cmd1);
      }
      else if (dialog.getRendererName().length() > 0)
      {
        DisplayNameType displayName = FacesConfigFactory.eINSTANCE
          .createDisplayNameType();
        displayName.setTextContent(dialog.getRendererName());
        
        EList dl = renderer.getDisplayName();
        dl.add(displayName);
        Command cmd2 = AddCommand.create(getEditingDomain(), 
          renderer.getDisplayName(), FacesConfigPackage.eINSTANCE
          .getRendererType_DisplayName(), dl);
        commands.add(cmd2);
      }
      if (renderer.getRendererClass() != null)
      {
        Command cmd3 = SetCommand.create(getEditingDomain(), 
          renderer.getRendererClass(), 
          FacesConfigPackage.eINSTANCE
          .getRendererClassType_TextContent(), dialog
          .getRendererClass());
        commands.add(cmd3);
      }
      else if (dialog.getRendererClass().length() > 0)
      {
        RendererClassType RendererClassType = FacesConfigFactory.eINSTANCE
          .createRendererClassType();
        RendererClassType.setTextContent(dialog.getRendererClass());
        
        Command cmd4 = AddCommand.create(getEditingDomain(), 
          renderer, FacesConfigPackage.eINSTANCE
          .getRendererType_RendererClass(), 
          RendererClassType);
        commands.add(cmd4);
      }
      if (renderer.getComponentFamily() != null)
      {
        Command cmd5 = SetCommand.create(getEditingDomain(), 
          renderer.getComponentFamily(), 
          FacesConfigPackage.eINSTANCE
          .getDefaultValueType_TextContent(), dialog
          .getComponentFamily());
        commands.add(cmd5);
      }
      else if (dialog.getComponentFamily().length() > 0)
      {
        ComponentFamilyType componentFamily = FacesConfigFactory.eINSTANCE
          .createComponentFamilyType();
        componentFamily.setTextContent(dialog.getComponentFamily());
        Command cmd6 = AddCommand.create(getEditingDomain(), 
          renderer, FacesConfigPackage.eINSTANCE
          .getRendererType_ComponentFamily(), 
          componentFamily);
        commands.add(cmd6);
      }
      if (renderer.getRendererType() != null)
      {
        Command cmd7 = SetCommand.create(getEditingDomain(), 
          renderer.getRendererType(), 
          FacesConfigPackage.eINSTANCE
          .getSuggestedValueType_TextContent(), dialog
          .getRendererType());
        commands.add(cmd7);
      }
      else if (dialog.getRendererType().length() > 0)
      {
        RendererTypeType rendererType = FacesConfigFactory.eINSTANCE
          .createRendererTypeType();
        rendererType.setTextContent(dialog.getRendererType());
        Command cmd8 = AddCommand.create(getEditingDomain(), 
          renderer, FacesConfigPackage.eINSTANCE
          .getRendererType_RendererType(), rendererType);
        commands.add(cmd8);
      }
      CompoundCommand command = new CompoundCommand(commands);
      if (command.canExecute())
      {
        getEditingDomain().getCommandStack().execute(command);
        tableViewer.refresh(renderer);
      }
    }
  }
  
  private void removeButtonSelected()
  {
    RendererType Renderer = (RendererType)((IStructuredSelection)tableViewer
      .getSelection()).getFirstElement();
    
    Assert.isNotNull(Renderer);
    
    Command removeCommand = RemoveCommand.create(getEditingDomain(), 
      getInput(), getEReference(), Renderer);
    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.RendererSection
 * 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.DisplayNameType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;

class RenderkitGeneralSection$1
  implements IDialogFieldApplyListener
{
  RenderkitGeneralSection$1(RenderkitGeneralSection paramRenderkitGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    String newDisplayNameValue = ((StringDialogField)field)
      .getText().trim();
    Command cmd = null;
    RenderKitType Renderkit = (RenderKitType)this$0.getInput();
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (Renderkit.getDisplayName().size() > 0)
    {
      DisplayNameType displayName = 
        (DisplayNameType)Renderkit.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(
        RenderkitGeneralSection.access$0(this$0));
      
      cmd = AddCommand.create(editingDomain, Renderkit, 
        FacesConfigPackage.eINSTANCE
        .getRenderKitType_DisplayName(), 
        displayNameType);
    }
    if (cmd.canExecute()) {
      editingDomain.getCommandStack().execute(cmd);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.section.RenderkitGeneralSection.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.DescriptionType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
import org.eclipse.jst.jsf.facesconfig.ui.util.ModelUtil;

class RenderkitGeneralSection$2
  implements IDialogFieldApplyListener
{
  RenderkitGeneralSection$2(RenderkitGeneralSection paramRenderkitGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    String newDescriptionValue = ((StringDialogField)field)
      .getText().trim();
    newDescriptionValue = 
      ModelUtil.escapeEntities(newDescriptionValue);
    Command cmd = null;
    RenderKitType Renderkit = (RenderKitType)this$0.getInput();
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (Renderkit.getDescription().size() > 0)
    {
      DescriptionType description = 
        (DescriptionType)Renderkit.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(
        RenderkitGeneralSection.access$0(this$0));
      
      cmd = AddCommand.create(editingDomain, Renderkit, 
        FacesConfigPackage.eINSTANCE
        .getRenderKitType_Description(), 
        description);
    }
    if (cmd.canExecute()) {
      editingDomain.getCommandStack().execute(cmd);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.section.RenderkitGeneralSection.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.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.jst.jsf.facesconfig.emf.RenderKitIdType;

class RenderkitGeneralSection$3
  implements IDialogFieldApplyListener
{
  RenderkitGeneralSection$3(RenderkitGeneralSection paramRenderkitGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    RenderKitIdType RenderkitId = FacesConfigFactory.eINSTANCE
      .createRenderKitIdType();
    RenderkitId.setTextContent(((StringDialogField)field)
      .getText());
    
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (editingDomain != null)
    {
      Command command = SetCommand.create(editingDomain, 
        this$0.getInput(), FacesConfigPackage.eINSTANCE
        .getRenderKitType_RenderKitId(), 
        RenderkitId);
      if (command.canExecute()) {
        editingDomain.getCommandStack().execute(command);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.section.RenderkitGeneralSection.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.FacesConfigFactory;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.jst.jsf.facesconfig.emf.RenderKitClassType;

class RenderkitGeneralSection$4
  implements IDialogFieldApplyListener
{
  RenderkitGeneralSection$4(RenderkitGeneralSection paramRenderkitGeneralSection) {}
  
  public void dialogFieldApplied(DialogField field)
  {
    RenderKitClassType RenderkitClass = FacesConfigFactory.eINSTANCE
      .createRenderKitClassType();
    RenderkitClass
      .setTextContent(((StringDialogField)field)
      .getText());
    EditingDomain editingDomain = this$0.getEditingDomain();
    if (editingDomain != null)
    {
      Command command = SetCommand.create(editingDomain, 
        this$0.getInput(), FacesConfigPackage.eINSTANCE
        .getRenderKitType_RenderKitClass(), 
        RenderkitClass);
      if (command.canExecute()) {
        editingDomain.getCommandStack().execute(command);
      }
    }
  }
}

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

class RenderkitGeneralSection$RenderKitGeneralAdapter$1
  implements Runnable
{
  RenderkitGeneralSection$RenderKitGeneralAdapter$1(RenderkitGeneralSection.RenderKitGeneralAdapter paramRenderKitGeneralAdapter) {}
  
  public void run()
  {
    RenderkitGeneralSection.RenderKitGeneralAdapter.access$0(this$1).refresh();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.section.RenderkitGeneralSection.RenderKitGeneralAdapter.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.notify.Notification;
import org.eclipse.emf.common.notify.impl.AdapterImpl;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

class RenderkitGeneralSection$RenderKitGeneralAdapter
  extends AdapterImpl
{
  RenderkitGeneralSection$RenderKitGeneralAdapter(RenderkitGeneralSection paramRenderkitGeneralSection) {}
  
  public boolean isAdapterForType(Object type)
  {
    if (type == RenderkitGeneralSection.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
        .getRenderKitType_RenderKitId()) || 
        (msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getRenderKitType_RenderKitClass()) || 
        (msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getRenderKitType_Description()) || 
        (msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getRenderKitType_DisplayName())) {
        refreshInUIThread();
      } else if ((msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getDisplayNameType_TextContent()) || 
        (msg.getFeature() == FacesConfigPackage.eINSTANCE
        .getDescriptionType_TextContent())) {
        refreshInUIThread();
      }
    }
  }
  
  private void refreshInUIThread()
  {
    if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) {
      this$0.refresh();
    } else {
      PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
      {
        public void run()
        {
          this$0.refresh();
        }
      });
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.section.RenderkitGeneralSection.RenderKitGeneralAdapter
 * 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.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.emf.RenderKitClassType;
import org.eclipse.jst.jsf.facesconfig.emf.RenderKitIdType;
import org.eclipse.jst.jsf.facesconfig.emf.RenderKitType;
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.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
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 RenderkitGeneralSection
  extends AbstractFacesConfigSection
{
  private StringDialogField displayNameField;
  private StringDialogField descriptionField;
  private StringDialogField renderkitIdField;
  private ClassButtonDialogField renderkitClassField;
  private RenderKitGeneralAdapter renderKitGeneralAdapter;
  
  public RenderkitGeneralSection(Composite parent, IManagedForm managedForm, IFacesConfigPage page, FormToolkit toolkit)
  {
    super(parent, managedForm, page, toolkit, null, null);
    getSection()
      .setText(EditorMessages.RenderKitGeneralSection_Name);
    getSection().setDescription(
      EditorMessages.RenderKitGeneralSection_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.RenderKitGeneralSection_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;
          RenderKitType Renderkit = (RenderKitType)getInput();
          EditingDomain editingDomain = getEditingDomain();
          if (Renderkit.getDisplayName().size() > 0)
          {
            DisplayNameType displayName = 
              (DisplayNameType)Renderkit.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(
              RenderkitGeneralSection.this.getRenderKitGeneralAdapter());
            
            cmd = AddCommand.create(editingDomain, Renderkit, 
              FacesConfigPackage.eINSTANCE
              .getRenderKitType_DisplayName(), 
              displayNameType);
          }
          if (cmd.canExecute()) {
            editingDomain.getCommandStack().execute(cmd);
          }
        }
      });
    descriptionField = new StringDialogField(2);
    descriptionField
      .setLabelText(EditorMessages.RenderKitGeneralSection_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;
          RenderKitType Renderkit = (RenderKitType)getInput();
          EditingDomain editingDomain = getEditingDomain();
          if (Renderkit.getDescription().size() > 0)
          {
            DescriptionType description = 
              (DescriptionType)Renderkit.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(
              RenderkitGeneralSection.this.getRenderKitGeneralAdapter());
            
            cmd = AddCommand.create(editingDomain, Renderkit, 
              FacesConfigPackage.eINSTANCE
              .getRenderKitType_Description(), 
              description);
          }
          if (cmd.canExecute()) {
            editingDomain.getCommandStack().execute(cmd);
          }
        }
      });
    rend
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