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

ry.getValue().getTextContent());
    }
    if (dialog.open() == 0)
    {
      if (mapEntry.getKey() != null)
      {
        mapEntry.getKey().setTextContent(dialog.getKey());
      }
      else
      {
        KeyType keyType = FacesConfigFactory.eINSTANCE.createKeyType();
        keyType.setTextContent(dialog.getKey());
        mapEntry.setKey(keyType);
      }
      if (dialog.isNullValue())
      {
        if (mapEntry.getValue() != null) {
          EcoreUtil.remove(mapEntry.getValue());
        }
        mapEntry.setNullValue(FacesConfigFactory.eINSTANCE
          .createNullValueType());
      }
      else
      {
        if (mapEntry.getNullValue() != null) {
          EcoreUtil.remove(mapEntry.getNullValue());
        }
        if (mapEntry.getValue() != null)
        {
          mapEntry.getValue().setTextContent(dialog.getValue());
        }
        else
        {
          ValueType value = FacesConfigFactory.eINSTANCE
            .createValueType();
          value.setTextContent(dialog.getValue());
          mapEntry.setValue(value);
        }
      }
      tableViewer.refresh(mapEntry);
    }
  }
  
  private void removeButtonSelected()
  {
    MapEntryType mapEntry = (MapEntryType)((IStructuredSelection)tableViewer
      .getSelection()).getFirstElement();
    mapEntries.getMapEntry().remove(mapEntry);
    tableViewer.refresh();
    updateButtonsStatus();
  }
  
  public void updateButtonsStatus()
  {
    if (((IStructuredSelection)tableViewer.getSelection()).size() > 0)
    {
      editButton.setEnabled(true);
      removeButton.setEnabled(true);
    }
    else
    {
      editButton.setEnabled(false);
      removeButton.setEnabled(false);
    }
  }
  
  protected void okPressed()
  {
    KeyClassType keyClass = FacesConfigFactory.eINSTANCE
      .createKeyClassType();
    keyClass.setTextContent(keyClassField.getText().trim());
    mapEntries.setKeyClass(keyClass);
    ValueClassType valueClass = FacesConfigFactory.eINSTANCE
      .createValueClassType();
    valueClass.setTextContent(valueClassField.getText().trim());
    mapEntries.setValueClass(valueClass);
    super.okPressed();
  }
  
  protected Point getInitialSize()
  {
    Point shellSize = super.getInitialSize();
    return new Point(Math.max(
      convertHorizontalDLUsToPixels(300), x), 
      y);
  }
  
  public void setProject(IProject project)
  {
    this.project = project;
  }
  
  public MapEntriesType getMapEntries()
  {
    return mapEntries;
  }
  
  public void setMapEntries(MapEntriesType mapEntries)
  {
    this.mapEntries = mapEntries;
  }
}

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

import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Text;

class EditValueDialog$1
  extends SelectionAdapter
{
  EditValueDialog$1(EditValueDialog paramEditValueDialog) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    EditValueDialog.access$0(this$0).setEnabled(!EditValueDialog.access$1(this$0).getSelection());
    EditValueDialog.access$2(this$0, EditValueDialog.access$1(this$0).getSelection());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.EditValueDialog.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.jface.dialogs.IDialogConstants;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogField;
import org.eclipse.jst.jsf.common.ui.internal.dialogfield.DialogFieldBase;
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.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.Label;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;

public class EditValueDialog
  extends Dialog
{
  private static final int VALUE_WIDTH = 380;
  private static final int VALUE_HEIGHT = 220;
  private String value;
  private Text valueText;
  private Button nullValueTypeButton;
  private boolean isNullButtonShown;
  private boolean isNullValue;
  
  public EditValueDialog(Shell parentShell, String value)
  {
    this(parentShell, false, false, value);
    this.value = value;
    isNullButtonShown = false;
  }
  
  public EditValueDialog(Shell parentShell, boolean isNullButtonShown, boolean isNullValue, String value)
  {
    super(parentShell);
    this.isNullValue = isNullValue;
    this.value = value;
    this.isNullButtonShown = isNullButtonShown;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite container = (Composite)super.createDialogArea(parent);
    GridLayout gridLayout = new GridLayout();
    numColumns = 1;
    marginHeight = 10;
    marginWidth = 10;
    container.setLayout(gridLayout);
    GridData gd = new GridData(1808);
    container.setLayoutData(gd);
    if (isNullButtonShown)
    {
      nullValueTypeButton = SWTUtils.createCheckBox(container, 
        "null-value", 2);
      nullValueTypeButton.addSelectionListener(new SelectionAdapter()
      {
        public void widgetSelected(SelectionEvent e)
        {
          valueText.setEnabled(!nullValueTypeButton.getSelection());
          isNullValue = nullValueTypeButton.getSelection();
        }
      });
    }
    DialogField valueTitle = new DialogFieldBase();
    
    valueTitle
      .setLabelText(EditorMessages.ManagedBeanPropertyEditDialog_Value);
    valueTitle.doFillIntoGrid(null, container, 1);
    
    gd = new GridData(1808);
    widthHint = 380;
    heightHint = 220;
    valueText = new Text(container, 2050);
    valueText.setLayoutData(gd);
    
    initFields();
    return container;
  }
  
  private void initFields()
  {
    if ((isNullButtonShown) && (isNullValue))
    {
      nullValueTypeButton.setSelection(true);
      valueText.setEnabled(false);
    }
    else if (value != null)
    {
      valueText.setText(value);
    }
  }
  
  protected void createValueSection(Composite container)
  {
    Composite valueSection = new Composite(container, 0);
    GridLayout gl = new GridLayout();
    
    numColumns = 2;
    valueSection.setLayout(gl);
    GridData gd = new GridData(768);
    valueSection.setLayoutData(gd);
    
    Label lblValue = new Label(valueSection, 16384);
    gd = new GridData(256);
    widthHint = 100;
    lblValue.setLayoutData(gd);
    
    lblValue
      .setText(EditorMessages.ManagedBeanPropertyEditDialog_Value);
    
    gd = new GridData(768);
    
    widthHint = 200;
    valueText = new Text(valueSection, 2048);
    valueText.setLayoutData(gd);
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    createButton(parent, 0, IDialogConstants.OK_LABEL, 
      true);
    createButton(parent, 1, 
      IDialogConstants.CANCEL_LABEL, false);
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    newShell.setText(EditorMessages.ValueEditDialog_Title);
  }
  
  protected void buttonPressed(int buttonId)
  {
    if (buttonId == 1)
    {
      setReturnCode(1);
      close();
      return;
    }
    if (buttonId == 0)
    {
      value = valueText.getText();
      setReturnCode(0);
      close();
      return;
    }
    super.buttonPressed(buttonId);
  }
  
  public Object getResultData()
  {
    return value;
  }
  
  public boolean isNullValue()
  {
    return (isNullButtonShown) && (isNullValue);
  }
}

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

import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.widgets.Text;

class ListChoiceDialog$1
  implements ModifyListener
{
  ListChoiceDialog$1(ListChoiceDialog paramListChoiceDialog) {}
  
  public void modifyText(ModifyEvent e)
  {
    ListChoiceDialog.access$1(this$0, ListChoiceDialog.access$0(this$0).getText());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.ListChoiceDialog.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.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.widgets.Text;

class ListChoiceDialog$2
  implements ISelectionChangedListener
{
  ListChoiceDialog$2(ListChoiceDialog paramListChoiceDialog) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    IStructuredSelection selection = (IStructuredSelection)event
      .getSelection();
    if (selection != null)
    {
      String text = (String)selection.getFirstElement();
      if ((text != null) && (text.length() > 0))
      {
        ListChoiceDialog.access$1(this$0, text);
        ListChoiceDialog.access$0(this$0).setText(text);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.ListChoiceDialog.2
 * 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.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jst.jsf.common.ui.internal.guiutils.SWTUtils;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.layout.GridData;
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 ListChoiceDialog
  extends Dialog
{
  private static final int TEXT_MINI_WIDTH = 350;
  private static final int TABLEVIEWER_MINI_WIDTH = 200;
  private Text inputText;
  private TableViewer tableViewer;
  private String[] items;
  private String result;
  private String labelString;
  
  public ListChoiceDialog(Shell parentShell, String[] items, String labelString)
  {
    super(parentShell);
    
    this.items = (items == null ? new String[0] : items);
    this.labelString = labelString;
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite composite = SWTUtils.createComposite(parent, 1);
    
    SWTUtils.createLabel(composite, labelString, 1);
    
    inputText = SWTUtils.createTextBox(composite, 1);
    GridData gd = new GridData(768);
    widthHint = 350;
    inputText.setLayoutData(gd);
    
    inputText.addModifyListener(new ModifyListener()
    {
      public void modifyText(ModifyEvent e)
      {
        result = inputText.getText();
      }
    });
    createTableViewer(composite);
    return composite;
  }
  
  private void createTableViewer(Composite composite)
  {
    tableViewer = new TableViewer(composite, 2816);
    
    GridData gd = new GridData(1808);
    heightHint = 200;
    tableViewer.getControl().setLayoutData(gd);
    tableViewer.add(items);
    tableViewer
      .addSelectionChangedListener(new ISelectionChangedListener()
      {
        public void selectionChanged(SelectionChangedEvent event)
        {
          IStructuredSelection selection = (IStructuredSelection)event
            .getSelection();
          if (selection != null)
          {
            String text = (String)selection.getFirstElement();
            if ((text != null) && (text.length() > 0))
            {
              result = text;
              inputText.setText(text);
            }
          }
        }
      });
  }
  
  public String getResult()
  {
    return result;
  }
}

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

import java.util.List;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
import org.eclipse.swt.widgets.Text;

class LocaleDialog$1
  extends KeyAdapter
{
  LocaleDialog$1(LocaleDialog paramLocaleDialog) {}
  
  public void keyReleased(KeyEvent e)
  {
    LocaleDialog.access$1(this$0, LocaleDialog.access$0(this$0).getText());
    LocaleDialog.access$2(this$0).resetFilters();
    LocaleDialog.access$2(this$0).addFilter(new LocaleDialog.LocaleViewerFilter(this$0, LocaleDialog.access$3(this$0)));
    LocaleDialog.access$2(this$0).add(LocaleDialog.access$4(this$0).toArray());
    this$0.updateStatus();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.LocaleDialog.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.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.widgets.Text;

class LocaleDialog$2
  implements ISelectionChangedListener
{
  LocaleDialog$2(LocaleDialog paramLocaleDialog) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    IStructuredSelection selection = (IStructuredSelection)event
      .getSelection();
    if (selection != null)
    {
      String text = (String)selection.getFirstElement();
      if ((text != null) && (text.length() > 0))
      {
        LocaleDialog.access$1(this$0, text);
        LocaleDialog.access$0(this$0).setText(text);
        this$0.updateStatus();
      }
    }
  }
}

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

import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

class LocaleDialog$LocaleViewerFilter
  extends ViewerFilter
{
  private String locale;
  
  LocaleDialog$LocaleViewerFilter(LocaleDialog paramLocaleDialog, String locale)
  {
    this.locale = locale;
  }
  
  public boolean select(Viewer v, Object parent, Object object)
  {
    if ((object instanceof String))
    {
      if ((locale == null) || (locale.length() == 0)) {
        return true;
      }
      String aLocale = (String)object;
      return aLocale.startsWith(locale);
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.LocaleDialog.LocaleViewerFilter
 * 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 java.util.Locale;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jst.jsf.common.ui.internal.guiutils.SWTUtils;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.swt.events.KeyAdapter;
import org.eclipse.swt.events.KeyEvent;
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;

public class LocaleDialog
  extends StatusDialog
{
  private Text inputText;
  private TableViewer tableViewer;
  private String newLocale;
  private List existedLocaleList;
  private List itemsList;
  private static final int TEXT_MINI_WIDTH = 350;
  private static final int TABLEVIEWER_MINI_WIDTH = 200;
  
  class LocaleViewerFilter
    extends ViewerFilter
  {
    private String locale;
    
    LocaleViewerFilter(String locale)
    {
      this.locale = locale;
    }
    
    public boolean select(Viewer v, Object parent, Object object)
    {
      if ((object instanceof String))
      {
        if ((locale == null) || (locale.length() == 0)) {
          return true;
        }
        String aLocale = (String)object;
        return aLocale.startsWith(locale);
      }
      return false;
    }
  }
  
  public LocaleDialog(Shell parentShell, List existedLocaleList)
  {
    super(parentShell);
    this.existedLocaleList = existedLocaleList;
    Locale[] locales = Locale.getAvailableLocales();
    itemsList = new ArrayList(locales.length);
    
    int i = 0;
    for (int n = locales.length; i < n; i++) {
      itemsList.add(locales[i].toString());
    }
    setStatusMessage(EditorMessages.LocaleConfigSection_Wizard_Page_AlreadyExistsError);
  }
  
  protected void configureShell(Shell newShell)
  {
    super.configureShell(newShell);
    newShell.setText(EditorMessages.LocaleConfigSection_Wizard_WindowTitle);
  }
  
  protected Control createDialogContents(Composite parent)
  {
    GridLayout layout = new GridLayout();
    marginWidth = 0;
    marginHeight = 0;
    parent.setLayout(layout);
    
    SWTUtils.createLabel(
      parent, 
      EditorMessages.LocaleConfigSection_Wizard_Page_LabelText, 
      1);
    
    inputText = SWTUtils.createTextBox(parent, 1);
    GridData gd = new GridData(768);
    widthHint = 350;
    inputText.setLayoutData(gd);
    
    inputText.addKeyListener(new KeyAdapter()
    {
      public void keyReleased(KeyEvent e)
      {
        newLocale = inputText.getText();
        tableViewer.resetFilters();
        tableViewer.addFilter(new LocaleDialog.LocaleViewerFilter(LocaleDialog.this, newLocale));
        tableViewer.add(itemsList.toArray());
        updateStatus();
      }
    });
    createTableViewer(parent);
    return parent;
  }
  
  private void createTableViewer(Composite composite)
  {
    tableViewer = new TableViewer(composite, 2816);
    
    GridData gd = new GridData(1808);
    heightHint = 200;
    tableViewer.getControl().setLayoutData(gd);
    tableViewer.add(itemsList.toArray());
    
    tableViewer
      .addSelectionChangedListener(new ISelectionChangedListener()
      {
        public void selectionChanged(SelectionChangedEvent event)
        {
          IStructuredSelection selection = (IStructuredSelection)event
            .getSelection();
          if (selection != null)
          {
            String text = (String)selection.getFirstElement();
            if ((text != null) && (text.length() > 0))
            {
              newLocale = text;
              inputText.setText(text);
              updateStatus();
            }
          }
        }
      });
  }
  
  protected boolean isValid()
  {
    if ((existedLocaleList != null) && (existedLocaleList.contains(newLocale))) {
      return false;
    }
    return true;
  }
  
  public String getResult()
  {
    return newLocale;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.LocaleDialog
 * 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.jdt.core.IJavaProject;
import org.eclipse.jst.jsf.common.ui.internal.dialogs.ResourceOnClasspathDialog;
import org.eclipse.jst.jsf.facesconfig.emf.MessageBundleType;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.swt.widgets.Shell;

public class MessageBundleSelectionDialog
  extends ResourceOnClasspathDialog
{
  private List resourceBundles;
  private String selectPropertyFileMessage = EditorMessages.MessageBundleSection_Dialog_Message_SelectPropertyFile;
  private String alreadyExistStatusMessage = EditorMessages.MessageBundleSection_Dialog_Message_AlreadyExists;
  private static final String[] PROPERTIES_FILES_SUFFIXS = { "properties" };
  
  public MessageBundleSelectionDialog(Shell parentShell, IJavaProject project, List resourceBundles)
  {
    super(parentShell, project);
    this.resourceBundles = resourceBundles;
    setSuffixs(PROPERTIES_FILES_SUFFIXS);
    
    setTitle(EditorMessages.MessageBundleSection_Dialog_Title);
    setViewerSorter(new MessageBundleViewerSorter());
  }
  
  protected boolean isValidSelection(Object selection)
  {
    if (!super.isValidSelection(selection))
    {
      setStatusMessage(selectPropertyFileMessage);
      return false;
    }
    List selectionList = new ArrayList();
    selectionList.add(selection);
    setResult(selectionList);
    Object result = super.getResult()[0];
    if (result == null)
    {
      setStatusMessage(selectPropertyFileMessage);
      return false;
    }
    String newResourceBundle = (String)result;
    if (isAlreadyExist(newResourceBundle))
    {
      setStatusMessage(alreadyExistStatusMessage);
      return false;
    }
    return true;
  }
  
  private boolean isAlreadyExist(String resourceBundleString)
  {
    if ((resourceBundleString == null) || (resourceBundleString.length() == 0)) {
      return true;
    }
    if (resourceBundles == null) {
      return false;
    }
    for (int i = 0; i < resourceBundles.size(); i++)
    {
      MessageBundleType node = (MessageBundleType)resourceBundles.get(i);
      String rbName = node.getTextContent();
      if ((rbName != null) && (rbName.equalsIgnoreCase(resourceBundleString))) {
        return true;
      }
    }
    return false;
  }
}

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

import java.text.Collator;
import org.eclipse.jdt.core.IPackageFragmentRoot;
import org.eclipse.jface.viewers.ViewerSorter;

public class MessageBundleViewerSorter
  extends ViewerSorter
{
  public MessageBundleViewerSorter() {}
  
  public MessageBundleViewerSorter(Collator collator)
  {
    super(collator);
  }
  
  public int category(Object element)
  {
    if (((element instanceof IPackageFragmentRoot)) && 
      (!((IPackageFragmentRoot)element).isArchive()))
    {
      IPackageFragmentRoot root = (IPackageFragmentRoot)element;
      if ("src".equals(root.getElementName())) {
        return 0;
      }
      return 1;
    }
    return 2;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.facesconfig.ui.dialog.MessageBundleViewerSorter
 * 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.jface.resource.JFaceResources;
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.Label;
import org.eclipse.swt.widgets.Shell;

public abstract class StatusDialog
  extends Dialog
{
  private Label statusImage;
  private Label statusLabel;
  private String statusMessage;
  
  protected StatusDialog(Shell parentShell)
  {
    super(parentShell);
  }
  
  protected abstract Control createDialogContents(Composite paramComposite);
  
  protected Control createDialogArea(Composite parent)
  {
    Composite area = (Composite)super.createDialogArea(parent);
    area.setLayout(new GridLayout(2, false));
    
    Composite contents = new Composite(area, 0);
    GridData gd = new GridData(1808);
    horizontalSpan = 2;
    contents.setLayoutData(gd);
    createDialogContents(contents);
    
    statusImage = createLabel(area);
    statusImage.setImage(
      JFaceResources.getImage("dialog_message_error_image"));
    statusLabel = createLabel(area);
    statusImage.setVisible(false);
    return area;
  }
  
  private Label createLabel(Composite parent)
  {
    Label label = new Label(parent, 16384);
    GridData data = new GridData();
    horizontalSpan = 1;
    horizontalAlignment = 4;
    label.setLayoutData(data);
    return label;
  }
  
  protected abstract boolean isValid();
  
  protected void updateStatus()
  {
    if (isValid())
    {
      statusImage.setVisible(false);
      statusLabel.setText("");
      getButton(0).setEnabled(true);
    }
    else
    {
      statusImage.setVisible(true);
      statusLabel.setText(statusMessage == null ? "" : statusMessage);
      getButton(0).setEnabled(false);
    }
  }
  
  public String getStatusMessage()
  {
    return statusMessage;
  }
  
  public void setStatusMessage(String statusMessage)
  {
    this.statusMessage = statusMessage;
  }
}

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

import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.SelectionChangedEvent;

class ComponentsPage$1
  implements ISelectionChangedListener
{
  ComponentsPage$1(ComponentsPage paramComponentsPage) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    this$0.setSelection(event.getSelection());
  }
}

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

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 ComponentsPage$1ComponentsContentOutlinePage$1
  extends ViewerFilter
{
  ComponentsPage$1ComponentsContentOutlinePage$1(ComponentsPage.1ComponentsContentOutlinePage param1ComponentsContentOutlinePage) {}
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    if (!FacesConfigPackage.eINSTANCE.getComponentType().isInstance(element)) {
      if (!FacesConfigPackage.eINSTANCE.getConverterType().isInstance(
        element)) {
        if (!FacesConfigPackage.eINSTANCE.getRenderKitType().isInstance(
          element)) {
          if (!FacesConfigPackage.eINSTANCE.getValidatorType().isInstance(
            element)) {
            if (!FacesConfigPackage.eINSTANCE.getAttributeType().isInstance(
              element)) {
              if (!FacesConfigPackage.eINSTANCE.getPropertyType().isInstance(
                element)) {
                if (!FacesConfigPackage.eINSTANCE.getFacetType().isInstance(element)) {
                  if (!FacesConfigPackage.eINSTANCE.getRendererType().isInstance(
                    element)) {
                    return false;
                  }
                }
              }
            }
          }
        }
      }
    }
    return 
    
      true;
  }
}

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

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.editor.FormEditor;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;

class ComponentsPage$1ComponentsContentOutlinePage
  extends ContentOutlinePage
{
  ComponentsPage$1ComponentsContentOutlinePage(ComponentsPage paramComponentsPage) {}
  
  public void createControl(Composite parent)
  {
    super.createControl(parent);
    TreeViewer contentOutlineViewer = getTreeViewer();
    contentOutlineViewer.addSelectionChangedListener(this);
    
    AdapterFactory adapterFactory = (AdapterFactory)this$0.getEditor()
      .getAdapter(AdapterFactory.class);
    
    contentOutlineViewer
      .setContentProvider(new AdapterFactoryContentProvider(
      adapterFactory));
    contentOutlineViewer
      .setLabelProvider(new AdapterFactoryLabelProvider(
      adapterFactory));
    contentOutlineViewer.addFilter(new ViewerFilter()
    {
      public boolean select(Viewer viewer, Object parentElement, Object element)
      {
        if (!FacesConfigPackage.eINSTANCE.getComponentType().isInstance(element)) {
          if (!FacesConfigPackage.eINSTANCE.getConverterType().isInstance(
            element)) {
            if (!FacesConfigPackage.eINSTANCE.getRenderKitType().isInstance(
              element)) {
              if (!FacesConfigPackage.eINSTANCE.getValidatorType().isInstance(
                element)) {
                if (!FacesConfigPackage.eINSTANCE.getAttributeType().isInstance(
                  element)) {
                  if (!FacesConfigPackage.eINSTANCE.getPropertyType().isInstance(
                    element)) {
                    if (!FacesConfigPackage.eINSTANCE.getFacetType().isInstance(element)) {
                      if (!FacesConfigPackage.eINSTANCE.getRendererType().isInstance(
                        element)) {
                        return false;
                      }
                    }
                  }
                }
              }
            }
          }
        }
        return 
        
          true;
      }
    });
    contentOutlineViewer.setSorter(new ViewerSorter());
    contentOutlineViewer.setInput(this$0.getInput());
  }
}

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

import org.eclipse.emf.common.notify.AdapterFactory;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryContentProvider;
import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.ISelectionProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.StructuredViewer;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jst.jsf.facesconfig.emf.AttributeType;
import org.eclipse.jst.jsf.facesconfig.emf.FacesConfigPackage;
import org.eclipse.jst.jsf.facesconfig.emf.FacetType;
import org.eclipse.jst.jsf.facesconfig.emf.PropertyType;
import org.eclipse.jst.jsf.facesconfig.emf.RendererType;
import org.eclipse.jst.jsf.facesconfig.ui.EditorMessages;
import org.eclipse.jst.jsf.facesconfig.ui.FacesConfigEditor;
import org.eclipse.jst.jsf.facesconfig.ui.page.detail.ComponentDetailsPage;
import org.eclipse.jst.jsf.facesconfig.ui.page.detail.ConverterDetailsPage;
import org.eclipse.jst.jsf.facesconfig.ui.page.detail.RenderkitDetailsPage;
import org.eclipse.jst.jsf.facesconfig.ui.page.detail.ValidatorDetailsPage;
import org.eclipse.jst.jsf.facesconfig.ui.section.ComponentMasterSection;
import org.eclipse.jst.jsf.facesconfig.ui.section.ConverterMasterSection;
import org.eclipse.jst.jsf.facesconfig.ui.section.FacesConfigMasterSection;
import org.eclipse.jst.jsf.facesconfig.ui.section.RenderkitMasterSection;
import org.eclipse.jst.jsf.facesconfig.ui.section.ValidatorMasterSection;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.IDetailsPage;
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;
import org.eclipse.ui.views.contentoutline.ContentOutlinePage;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;

public class ComponentsPage
  extends FacesConfigMasterDetailPage
{
  public static final String PAGE_ID = "org.eclipse.jst.jsf.facesconfig.ui.page.ComponentsPage";
  private IContentOutlinePage contentOutlinePage;
  
  public ComponentsPage(FacesConfigEditor editor)
  {
    super(editor, "ComponentsPage", EditorMessages.FacesConfigEditor_Components_TabName);
  }
  
  protected FacesConfigMasterSection[] createMasterSections(Composite composite, IManagedForm managedForm, FormToolkit toolkit, FacesConfigMasterDetailPage page)
  {
    FacesConfigMasterSection componentMaster = new ComponentMasterSection(
      composite, managedForm, toolkit, page);
    componentMaster.getSection().setExpanded(true);
    GridData gd = new GridData(1808);
    componentMaster.getSection().setLayoutData(gd);
    
    FacesConfigMasterSection converterMaster = new ConverterMasterSection(
      composite, managedForm, toolkit, page);
    converterMaster.getSection().setExpanded(false);
    GridData convertergd = new GridData(768);
    converterMaster.getSection().setLayoutData(convertergd);
    
    FacesConfigMasterSection renderkitMaster = new RenderkitMasterSection(
      composite, managedForm, toolkit, page);
    renderkitMaster.getSection().setExpanded(false);
    GridData renderkitgd = new GridData(768);
    renderkitMaster.getSection().setLayoutData(renderkitgd);
    
    FacesConfigMasterSection validatorMaster = new ValidatorMasterSection(
      composite, managedForm, toolkit, page);
    validatorMaster.getSection().setExpanded(false);
    GridData valicatorgd = new GridData(768);
    validatorMaster.getSection().setLayoutData(valicatorgd);
    
    return new FacesConfigMasterSection[] { componentMaster, 
      converterMaster, renderkitMaster, validatorMaster };
  }
  
  public IDetailsPage getPage(Object key)
  {
    IDetailsPage detailsPage = null;
    if ((key instanceof EClass))
    {
      EClass eClass = (EClass)key;
      if (eClass.getClassifierID() == 19) {
        detailsPage = new ComponentDetailsPage(this);
      } else if (eClass.getClassifierID() == 97) {
        detailsPage = new RenderkitDetailsPage(this);
      } else if (eClass.getClassifierID() == 24) {
        detailsPage = new ConverterDetailsPage(this);
      } else if (eClass.getClassifierID() == 112) {
        detailsPage = new ValidatorDetailsPage(this);
      }
      if ((detailsPage instanceof ISelectionProvider)) {
        ((ISelectionProvider)detailsPage).addSelectionChangedListener(this);
      }
    }
    return detailsPage;
  }
  
  public Object getAdapter(Class adapter)
  {
    if (adapter == IContentOutlinePage.class) {
      return getOutlinePage();
    }
    return super.getAdapter(adapter);
  }
  
  private IContentOutlinePage getOutlinePage()
  {
    if (contentOutlinePage == null)
    {
      contentOutlinePage = new ContentOutlinePage()
      {
        public void createControl(Composite parent)
        {
          super.createControl(parent);
          TreeViewer contentOutlineViewer = getTreeViewer();
          contentOutlineViewer.addSelectionChangedListener(this);
          
          AdapterFactory adapterFactory = (AdapterFactory)getEditor()
            .getAdapter(AdapterFactory.class);
          
          contentOutlineViewer
            .setContentProvider(new AdapterFactoryContentProvider(
            adapterFactory));
          contentOutlineViewer
            .setLabelProvider(new AdapterFactoryLabelProvider(
            adapterFactory));
          contentOutlineViewer.addFilter(new ViewerFilter()
          {
            public boolean select(Viewer viewer, Object parentElement, Object element)
            {
              if (!FacesConfigPackage.eINSTANCE.getComponentType().isInstance(element)) {
                if (!FacesConfigPackage.eINSTANCE.getConverterType().isInstance(
                  element)) {
                  if (!FacesConfigPackage.eINSTANCE.getRenderKitType().isInstance(
                    element)) {
                    if (!FacesConfigPackage.eINSTANCE.getValidatorType().isInstance(
                      element)) {
                      if (!FacesConfigPackage.eINSTANCE.getAttributeType().isInstance(
                        element)) {
                        if (!FacesConfigPackage.eINSTANCE.getPropertyType().isInstance(
                          element)) {
                          if (!FacesConfigPackage.eINSTANCE.getFacetType().isInstance(element)) {
                            if (!FacesConfigPackage.eINSTANCE.getRendererType().isInstance(
                              element)) {
                              return false;
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
              return 
              
                true;
            }
          });
          contentOutlineViewer.setSorter(new ViewerSorter());
          contentOutlineViewer.setInput(getInput());
        }
      };contentOutlinePage
        .addSelectionChangedListener(new ISelectionChangedListener()
        {
          public void selectionChanged(SelectionChangedEvent event)
          {
            setSelection(event.getSelection());
          }
        });
      addSelectionChangedListener((ContentOutlinePage)contentOutlinePage);
    }
    return contentOutlinePage;
  }
  
  public void setSelection(ISelection selection)
  {
    if ((selection instanceof IStructuredSelection))
    {
      IStructuredSelection ss = (IStructuredSelection)selection;
      IStructuredSelection currentSelection = (IStructuredSelection)
        getSelection();
      if ((!ss.isEmpty()) && 
        (!currentSelection.isEmpty()) && 
        (ss.getFirstElement() == currentSelection
        .getFirstElement())) {
        return;
      }
      EObject component = null;
      if (((ss.getFirstElement() instanceof AttributeType)) || 
        ((ss.getFirstElement() instanceof PropertyType)) || 
        ((ss.getFirstElement() instanceof FacetType)) || 
        ((ss.getFirstElement() instanceof RendererType))) {
        component = ((EObject)ss.getFirstElement()).eContainer();
      } else if ((ss.getFirstElement() instanceof EObject)) {
        component = (EObject)ss.getFirstElement();
      }
      if (component != null)
      {
        FacesConfigMasterSection section = null;
        if (FacesConfigPackage.eINSTANCE.getComponentType().isInstance(
          component)) {
          section = getFacesConfigMasterSections()[0];
        } else if (FacesConfigPackage.eINSTANCE.getConverterType().isInstance(component)) {
          section = getFacesConfigMasterSections()[1];
        } else if (FacesConfigPackage.eINSTANCE.getRenderKitType().isInstance(component)) {
          section = getFacesConfigMasterSections()[2];
        } else if (FacesConfigPackage.eINSTANCE.getValidatorType().isInstance(component)) {
          section = getFacesConfigMasterSections()[3];
        }
        if (!section.getSection().isExpanded())
        {
          closeOtherSections(section);
          GridData gd = new GridData(1808);
          section.getSection().setLayoutData(g
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