org.eclipse.jst.jsf.common.ui_1.2.100.v201104061711

return new Object[] { _folder };
    }
    return new Object[] { _project };
  }
  
  protected boolean isValidSelection(Object selection)
  {
    if ((selection instanceof Object[]))
    {
      int i = 0;
      for (int n = ((Object[])selection).length; i < n; i++) {
        if (isValidElement(((Object[])selection)[i])) {
          return true;
        }
      }
      return false;
    }
    return isValidElement(selection);
  }
  
  private boolean isValidElement(Object selection)
  {
    if ((selection instanceof IFile))
    {
      if (isSuffixBlank()) {
        return true;
      }
      if ((_suffixs != null) && 
        (Arrays.asList(_suffixs).contains(
        ((IFile)selection).getFileExtension()
        .toLowerCase()))) {
        return true;
      }
    }
    return false;
  }
  
  public Object[] getResult()
  {
    Object[] objects = super.getResult();
    if ((objects == null) || (objects.length == 0)) {
      return null;
    }
    List list = new ArrayList();
    for (int i = 0; i < objects.length; i++) {
      if ((objects[i] instanceof IFile)) {
        list.add(objects[i]);
      }
    }
    return list.toArray();
  }
  
  public void setSuffixs(String[] suffixs)
  {
    _suffixs = convertTolowercase(suffixs);
    _filter.setSuffixs(_suffixs);
    setStatusMessage(getStatusMessage());
  }
  
  private String[] convertTolowercase(String[] suffixs)
  {
    if (suffixs != null)
    {
      String[] newSuffixs = new String[suffixs.length];
      for (int i = 0; i < suffixs.length; i++) {
        newSuffixs[i] = suffixs[i].toLowerCase();
      }
      return newSuffixs;
    }
    return null;
  }
  
  public String getResourceDescription()
  {
    return _resourceDescription;
  }
  
  public void setResourceDescription(String sourceDescription)
  {
    _resourceDescription = sourceDescription;
    setStatusMessage(getStatusMessage());
  }
  
  private boolean isSuffixBlank()
  {
    boolean isSuffixBlank = false;
    if (_suffixs == null)
    {
      isSuffixBlank = true;
    }
    else
    {
      int count = 0;
      int i = 0;
      for (int size = _suffixs.length; i < size; i++) {
        if ((_suffixs[i] != null) && (!"".equals(_suffixs[i])))
        {
          count++;
          break;
        }
      }
      if (count == 0) {
        isSuffixBlank = true;
      }
    }
    return isSuffixBlank;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.dialogs.CommonResourceDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.dialogs;

import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.jface.wizard.IWizard;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Shell;

public class CommonWizardDialog
  extends WizardDialog
{
  public CommonWizardDialog(Shell parentShell, IWizard newWizard)
  {
    super(parentShell, newWizard);
  }
  
  protected void createButtonsForButtonBar(Composite parent)
  {
    super.createButtonsForButtonBar(parent);
    
    IWizard wizard = getWizard();
    if (!wizard.needsPreviousAndNextButtons()) {
      getButton(16).setText(
        IDialogConstants.OK_LABEL);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.dialogs.CommonWizardDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.dialogs;

import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJarEntryResource;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.ui.StandardJavaElementContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;

class ResourceOnClasspathDialog$ResourceOnClasspathFilter
  extends ViewerFilter
{
  StandardJavaElementContentProvider _javaContentProvider;
  
  public ResourceOnClasspathDialog$ResourceOnClasspathFilter(ResourceOnClasspathDialog paramResourceOnClasspathDialog, StandardJavaElementContentProvider contentProvider)
  {
    _javaContentProvider = contentProvider;
  }
  
  public void setSuffixs(String[] suffixs)
  {
    ResourceOnClasspathDialog.access$0(this$0, suffixs);
  }
  
  public void setJavaContentProvider(StandardJavaElementContentProvider contentProvider)
  {
    _javaContentProvider = contentProvider;
  }
  
  public void setJavaProject(IJavaProject project)
  {
    ResourceOnClasspathDialog.access$1(this$0, project);
  }
  
  public boolean select(Viewer viewer, Object parentElement, Object element)
  {
    if ((element instanceof IJavaProject))
    {
      String currentProjectName = ((IJavaProject)element)
        .getProject().getFullPath().toString().trim();
      String projectName = ResourceOnClasspathDialog.access$2(this$0).getProject().getFullPath()
        .toString().trim();
      if (projectName.equalsIgnoreCase(currentProjectName)) {
        return true;
      }
      return false;
    }
    if ((element instanceof IResource))
    {
      if ((ResourceOnClasspathDialog.access$2(this$0) != null) && 
        (!ResourceOnClasspathDialog.access$2(this$0).isOnClasspath((IResource)element))) {
        return false;
      }
      if (((element instanceof IFile)) && 
        (Arrays.asList(ResourceOnClasspathDialog.access$3(this$0)).contains(
        ((IFile)element).getFileExtension()))) {
        return true;
      }
      return false;
    }
    if ((element instanceof IJarEntryResource))
    {
      String ext = ((IJarEntryResource)element).getFullPath()
        .getFileExtension();
      if ((ext != null) && (Arrays.asList(ResourceOnClasspathDialog.access$3(this$0)).contains(ext))) {
        return true;
      }
      return false;
    }
    if (!(element instanceof IJavaElement)) {
      return false;
    }
    if ((ResourceOnClasspathDialog.access$2(this$0) != null) && 
      (!ResourceOnClasspathDialog.access$2(this$0).isOnClasspath((IJavaElement)element))) {
      return false;
    }
    IJavaElement javaElement = (IJavaElement)element;
    Object[] children = (Object[])null;
    switch (javaElement.getElementType())
    {
    case 3: 
      children = _javaContentProvider.getChildren(javaElement);
      break;
    case 12: 
      return true;
    case 4: 
      children = _javaContentProvider.getChildren(javaElement);
      break;
    case 6: 
      if (Arrays.asList(ResourceOnClasspathDialog.access$3(this$0)).contains(
        "class")) {
        return true;
      }
      return false;
    case 5: 
      String ext = javaElement.getPath().getFileExtension();
      if ((ext != null) && (Arrays.asList(ResourceOnClasspathDialog.access$3(this$0)).contains(ext))) {
        return true;
      }
      return false;
    case 7: 
    case 8: 
    case 9: 
    case 10: 
    case 11: 
    default: 
      return false;
    }
    for (int i = 0; i < children.length; i++) {
      if (select(viewer, javaElement, children[i])) {
        return true;
      }
    }
    return false;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.dialogs.ResourceOnClasspathDialog.ResourceOnClasspathFilter
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.dialogs;

import java.io.File;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IContainer;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.IPath;
import org.eclipse.jdt.core.IJarEntryResource;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ui.JavaElementLabelProvider;
import org.eclipse.jdt.ui.StandardJavaElementContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin;
import org.eclipse.jst.jsf.common.ui.internal.utils.PathUtil;
import org.eclipse.swt.widgets.Shell;

public class ResourceOnClasspathDialog
  extends TreeViewerSelectionDialog
{
  private static final String STATUS_MESSAGE = JSFUICommonPlugin.getResourceString("Dialog.ResourceOnClasspathDialog.StatusMessage");
  private IJavaProject _javaProject;
  private String[] _suffixs;
  private ResourceOnClasspathFilter _filter;
  
  class ResourceOnClasspathFilter
    extends ViewerFilter
  {
    StandardJavaElementContentProvider _javaContentProvider;
    
    public ResourceOnClasspathFilter(StandardJavaElementContentProvider contentProvider)
    {
      _javaContentProvider = contentProvider;
    }
    
    public void setSuffixs(String[] suffixs)
    {
      _suffixs = suffixs;
    }
    
    public void setJavaContentProvider(StandardJavaElementContentProvider contentProvider)
    {
      _javaContentProvider = contentProvider;
    }
    
    public void setJavaProject(IJavaProject project)
    {
      _javaProject = project;
    }
    
    public boolean select(Viewer viewer, Object parentElement, Object element)
    {
      if ((element instanceof IJavaProject))
      {
        String currentProjectName = ((IJavaProject)element)
          .getProject().getFullPath().toString().trim();
        String projectName = _javaProject.getProject().getFullPath()
          .toString().trim();
        if (projectName.equalsIgnoreCase(currentProjectName)) {
          return true;
        }
        return false;
      }
      if ((element instanceof IResource))
      {
        if ((_javaProject != null) && 
          (!_javaProject.isOnClasspath((IResource)element))) {
          return false;
        }
        if (((element instanceof IFile)) && 
          (Arrays.asList(_suffixs).contains(
          ((IFile)element).getFileExtension()))) {
          return true;
        }
        return false;
      }
      if ((element instanceof IJarEntryResource))
      {
        String ext = ((IJarEntryResource)element).getFullPath()
          .getFileExtension();
        if ((ext != null) && (Arrays.asList(_suffixs).contains(ext))) {
          return true;
        }
        return false;
      }
      if (!(element instanceof IJavaElement)) {
        return false;
      }
      if ((_javaProject != null) && 
        (!_javaProject.isOnClasspath((IJavaElement)element))) {
        return false;
      }
      IJavaElement javaElement = (IJavaElement)element;
      Object[] children = (Object[])null;
      switch (javaElement.getElementType())
      {
      case 3: 
        children = _javaContentProvider.getChildren(javaElement);
        break;
      case 12: 
        return true;
      case 4: 
        children = _javaContentProvider.getChildren(javaElement);
        break;
      case 6: 
        if (Arrays.asList(_suffixs).contains(
          "class")) {
          return true;
        }
        return false;
      case 5: 
        String ext = javaElement.getPath().getFileExtension();
        if ((ext != null) && (Arrays.asList(_suffixs).contains(ext))) {
          return true;
        }
        return false;
      case 7: 
      case 8: 
      case 9: 
      case 10: 
      case 11: 
      default: 
        return false;
      }
      for (int i = 0; i < children.length; i++) {
        if (select(viewer, javaElement, children[i])) {
          return true;
        }
      }
      return false;
    }
  }
  
  public void setSuffixs(String[] suffixs)
  {
    _suffixs = suffixs;
    _filter.setSuffixs(suffixs);
  }
  
  public ResourceOnClasspathDialog(Shell parentShell, IJavaProject project)
  {
    super(parentShell, STATUS_MESSAGE);
    
    StandardJavaElementContentProvider contentProvider = new StandardJavaElementContentProvider();
    setContentProvider(contentProvider);
    setLabelProvider(new JavaElementLabelProvider());
    _filter = new ResourceOnClasspathFilter(contentProvider);
    setFilter(_filter);
    
    _javaProject = project;
  }
  
  public Object[] getResult()
  {
    Object[] objects = super.getResult();
    if ((objects == null) || (objects.length == 0)) {
      return null;
    }
    IPath path = PathUtil.getPathOnClasspath(_javaProject, objects[0]);
    String result = null;
    if (path.segmentCount() == 0) {
      return new Object[] { "" };
    }
    path = path.removeFileExtension();
    result = path.toOSString();
    result = result.replace(File.separatorChar, '.');
    return new Object[] { result };
  }
  
  protected boolean isValidSelection(Object selection)
  {
    String extension = PathUtil.getPathOnClasspath(_javaProject, selection)
      .getFileExtension();
    return (extension != null) && (Arrays.asList(_suffixs).contains(extension));
  }
  
  protected Object findInputElement()
  {
    Object input = ResourcesPlugin.getWorkspace();
    if ((input instanceof IWorkspace)) {
      return JavaCore.create(((IWorkspace)input).getRoot());
    }
    if ((input instanceof IContainer))
    {
      IJavaElement element = JavaCore.create((IContainer)input);
      if ((element != null) && (element.exists())) {
        return element;
      }
      return input;
    }
    return JavaCore.create(ResourcesPlugin.getWorkspace().getRoot());
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.dialogs.ResourceOnClasspathDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.dialogs;

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

class TreeViewerSelectionDialog$1
  implements ISelectionChangedListener
{
  TreeViewerSelectionDialog$1(TreeViewerSelectionDialog paramTreeViewerSelectionDialog) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    TreeViewerSelectionDialog.access$1(TreeViewerSelectionDialog.access$0(this$0, 
      (IStructuredSelection)event.getSelection()));
    TreeViewerSelectionDialog.access$2(this$0);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.dialogs.TreeViewerSelectionDialog.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.dialogs;

import org.eclipse.core.resources.IFile;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;

class TreeViewerSelectionDialog$2
  implements IDoubleClickListener
{
  TreeViewerSelectionDialog$2(TreeViewerSelectionDialog paramTreeViewerSelectionDialog) {}
  
  public void doubleClick(DoubleClickEvent event)
  {
    ISelection selection = event.getSelection();
    if ((selection instanceof IStructuredSelection))
    {
      Object item = ((IStructuredSelection)selection)
        .getFirstElement();
      if ((item instanceof IFile)) {
        this$0.okPressed();
      } else if (TreeViewerSelectionDialog.access$3(this$0).getExpandedState(item)) {
        TreeViewerSelectionDialog.access$3(this$0).collapseToLevel(item, 1);
      } else {
        TreeViewerSelectionDialog.access$3(this$0).expandToLevel(item, 1);
      }
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.dialogs.TreeViewerSelectionDialog.2
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.dialogs;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import org.eclipse.core.resources.IFile;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.TreeViewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.viewers.ViewerFilter;
import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.jst.jsf.common.ui.JSFUICommonPlugin;
import org.eclipse.swt.graphics.Image;
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.ui.dialogs.SelectionDialog;
import org.eclipse.ui.part.DrillDownComposite;

public abstract class TreeViewerSelectionDialog
  extends SelectionDialog
{
  private static final String DEFAULT_TITLE = JSFUICommonPlugin.getResourceString("Dialog.TreeViewerSelectionDialog.DefaultTitle");
  public static final int STYLE_NONE = 0;
  private static final int STYLE_INFORMATION = 1;
  private static final int STYLE_ERROR = 2;
  private static final int STYLE_WARNING = 3;
  private static final int SIZING_SELECTION_PANE_HEIGHT = 300;
  private static final int SIZING_SELECTION_PANE_WIDTH = 320;
  private String _title = DEFAULT_TITLE;
  private static Object[] _selection;
  private ITreeContentProvider _contentProvider;
  private ILabelProvider _labelProvider;
  private ViewerFilter _filter;
  private Label _statusImage;
  private Label _statusLabel;
  private String _statusMessage;
  private TreeViewer _treeViewer;
  private int _style;
  private ViewerSorter _viewerSorter = null;
  private ViewerComparator _viewerComparator = null;
  
  public TreeViewerSelectionDialog(Shell parentShell, String statusMessage, int style)
  {
    super(parentShell);
    _statusMessage = statusMessage;
    _style = style;
    setShellStyle(67696);
  }
  
  public TreeViewerSelectionDialog(Shell parentShell, String statusMessage)
  {
    this(parentShell, statusMessage, 0);
  }
  
  public void setTitle(String title)
  {
    super.setTitle(title);
    _title = title;
  }
  
  protected void createTreeViewer(Composite parent)
  {
    DrillDownComposite drillDown = new DrillDownComposite(parent, 
      2048);
    GridData spec = new GridData(1808);
    widthHint = 320;
    heightHint = 300;
    drillDown.setLayoutData(spec);
    _treeViewer = new TreeViewer(drillDown, _style);
    drillDown.setChildTree(_treeViewer);
  }
  
  private void setTreeViewerProviders()
  {
    _treeViewer.setContentProvider(_contentProvider);
    _treeViewer.setLabelProvider(_labelProvider);
    if (_viewerSorter == null) {
      _viewerSorter = new ViewerSorter();
    }
    _treeViewer.setSorter(_viewerSorter);
    if (_viewerComparator != null) {
      _treeViewer.setComparator(_viewerComparator);
    }
    _treeViewer.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        TreeViewerSelectionDialog._selection = TreeViewerSelectionDialog.this.getSelectedElements(
          (IStructuredSelection)event.getSelection());
        TreeViewerSelectionDialog.this.updateStatus();
      }
    });
    _treeViewer.addDoubleClickListener(new IDoubleClickListener()
    {
      public void doubleClick(DoubleClickEvent event)
      {
        ISelection selection = event.getSelection();
        if ((selection instanceof IStructuredSelection))
        {
          Object item = ((IStructuredSelection)selection)
            .getFirstElement();
          if ((item instanceof IFile)) {
            okPressed();
          } else if (_treeViewer.getExpandedState(item)) {
            _treeViewer.collapseToLevel(item, 1);
          } else {
            _treeViewer.expandToLevel(item, 1);
          }
        }
      }
    });
    _treeViewer.setInput(findInputElement());
    if (_filter != null) {
      _treeViewer.addFilter(_filter);
    }
  }
  
  protected void createTreeViewerComposite(Composite parent)
  {
    Composite treeViewerComposite = new Composite(parent, 0);
    GridLayout layout = new GridLayout();
    marginWidth = 0;
    treeViewerComposite.setLayout(layout);
    
    GridData gridData = new GridData(768);
    horizontalSpan = 2;
    treeViewerComposite.setLayoutData(gridData);
    Label label = new Label(treeViewerComposite, 64);
    label.setText(_title);
    label.setFont(treeViewerComposite.getFont());
    createTreeViewer(treeViewerComposite);
    Dialog.applyDialogFont(treeViewerComposite);
  }
  
  public void setSelectedElement(Object[] selection)
  {
    if (selection == null) {
      return;
    }
    for (int i = 0; i < selection.length; i++) {
      if (_selection[i] != null) {
        _treeViewer.expandToLevel(_selection[i], 1);
      }
    }
    _treeViewer.setSelection(new StructuredSelection(selection), true);
  }
  
  protected Control createDialogArea(Composite parent)
  {
    Composite area = (Composite)super.createDialogArea(parent);
    GridLayout gridLayout = new GridLayout();
    numColumns = 2;
    area.setLayout(gridLayout);
    
    createTreeViewerComposite(area);
    
    _statusImage = createLabel(area);
    _statusImage.setImage(getMessageImage(2));
    _statusLabel = createLabel(area);
    
    setTreeViewerProviders();
    
    return dialogArea;
  }
  
  private Label createLabel(Composite parent)
  {
    Label label = new Label(parent, 16384);
    GridData data = new GridData();
    horizontalSpan = 1;
    horizontalAlignment = 4;
    label.setLayoutData(data);
    label.setText(_statusMessage == null ? "" : _statusMessage);
    return label;
  }
  
  private Object[] getSelectedElements(IStructuredSelection selection)
  {
    return selection.toArray();
  }
  
  public void setContentProvider(ITreeContentProvider provider)
  {
    _contentProvider = provider;
  }
  
  public void setLabelProvider(ILabelProvider provider)
  {
    _labelProvider = provider;
  }
  
  public void setFilter(ViewerFilter filter)
  {
    _filter = filter;
  }
  
  public void setViewerSorter(ViewerSorter sorter)
  {
    _viewerSorter = sorter;
  }
  
  public void setViewerComparator(ViewerComparator viewerComparator)
  {
    _viewerComparator = viewerComparator;
  }
  
  public void setStatusMessage(String message)
  {
    _statusMessage = message;
  }
  
  private void updateStatus()
  {
    Object selection = _selection;
    if ((_selection != null) && (_selection.length == 1)) {
      selection = _selection[0];
    }
    if (isValidSelection(selection))
    {
      _statusImage.setVisible(false);
      _statusLabel.setText("");
      getOkButton().setEnabled(true);
    }
    else
    {
      _statusImage.setVisible(true);
      _statusImage.setImage(getMessageImage(2));
      _statusImage.redraw();
      _statusLabel.setText(_statusMessage);
      getOkButton().setEnabled(false);
    }
  }
  
  protected Image getMessageImage(int imageType)
  {
    switch (imageType)
    {
    case 2: 
      return JFaceResources.getImage("dialog_message_error_image");
    case 3: 
      return JFaceResources.getImage("dialog_messasge_warning_image");
    case 1: 
      return JFaceResources.getImage("dialog_messasge_info_image");
    }
    return null;
  }
  
  protected void okPressed()
  {
    List chosenContainerPathList = new ArrayList();
    if (_selection != null) {
      chosenContainerPathList.addAll(Arrays.asList(_selection));
    }
    setResult(chosenContainerPathList);
    super.okPressed();
  }
  
  protected Control createContents(Composite parent)
  {
    Control control = super.createContents(parent);
    if (_selection != null) {
      setSelectedElement(_selection);
    }
    return control;
  }
  
  protected abstract boolean isValidSelection(Object paramObject);
  
  protected abstract Object findInputElement();
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.dialogs.TreeViewerSelectionDialog
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.form;

import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.FormToolkit;

public abstract class AbstractDetailsForm
{
  private FormToolkit _toolkit;
  
  public void refresh() {}
  
  public final void initialize(FormToolkit toolkit)
  {
    _toolkit = toolkit;
    doInitialize();
  }
  
  protected void doInitialize() {}
  
  public abstract void dispose();
  
  public abstract void commit(boolean paramBoolean);
  
  protected abstract void doUpdateSelection(Object paramObject);
  
  public abstract Control getControl();
  
  public void selectionChanged(ISelection selection)
  {
    if ((selection instanceof IStructuredSelection))
    {
      Object selectionObj = ((IStructuredSelection)selection)
        .getFirstElement();
      doUpdateSelection(selectionObj);
    }
  }
  
  public abstract void createContents(Composite paramComposite);
  
  protected final FormToolkit getToolkit()
  {
    return _toolkit;
  }
  
  public boolean isDirty()
  {
    return false;
  }
  
  public boolean isStale()
  {
    return true;
  }
  
  public abstract void setFocus();
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.form.AbstractDetailsForm
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.form;

import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.widgets.Composite;

class AbstractMasterDetailBlock$1
  implements Runnable
{
  AbstractMasterDetailBlock$1(AbstractMasterDetailBlock paramAbstractMasterDetailBlock, AbstractDetailsForm paramAbstractDetailsForm, SelectionChangedEvent paramSelectionChangedEvent) {}
  
  public void run()
  {
    AbstractDetailsForm oldPage = AbstractMasterDetailBlock.access$0(this$0);
    AbstractMasterDetailBlock.access$1(this$0, val$fpage);
    if ((oldPage != null) && (oldPage.isDirty())) {
      oldPage.commit(false);
    }
    if (val$fpage.isStale()) {
      val$fpage.refresh();
    }
    AbstractMasterDetailBlock.access$0(this$0).selectionChanged(val$event.getSelection());
    
    access$2this$0).topControl = AbstractMasterDetailBlock.access$0(this$0).getControl();
    AbstractMasterDetailBlock.access$3(this$0).layout();
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterDetailBlock.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.form;

import java.util.List;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.swt.custom.BusyIndicator;
import org.eclipse.swt.custom.SashForm;
import org.eclipse.swt.custom.StackLayout;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;

public abstract class AbstractMasterDetailBlock
  implements ISelectionChangedListener
{
  private AbstractMasterForm _masterForm;
  private Composite _detailsPanel;
  private AbstractDetailsForm _curPage;
  private FormToolkit _toolkit;
  private StackLayout _detailLayout;
  private List<AbstractDetailsForm> _detailForms;
  private BlankDetailsForm _blankDetails;
  
  public final void dispose()
  {
    _masterForm.dispose();
    for (AbstractDetailsForm detailsForm : _detailForms) {
      detailsForm.dispose();
    }
    doDispose();
  }
  
  protected void doDispose() {}
  
  public final void createContent(FormToolkit toolkit, Form form)
  {
    _toolkit = toolkit;
    
    GridLayout layout = new GridLayout();
    marginWidth = 5;
    marginHeight = 5;
    form.getBody().setLayout(layout);
    SashForm sashForm = new SashForm(form.getBody(), 0);
    
    _toolkit.adapt(sashForm, false, false);
    sashForm.setMenu(form.getBody().getMenu());
    sashForm.setLayoutData(new GridData(1808));
    initializeMasterPart(_toolkit, sashForm);
    createDetailsPart(sashForm);
    
    _masterForm.createHead(form);
    createToolBarActions(form);
    form.updateToolBar();
  }
  
  protected abstract AbstractMasterForm createMasterPart(FormToolkit paramFormToolkit);
  
  private void initializeMasterPart(FormToolkit toolkit, Composite parent)
  {
    _masterForm = createMasterPart(toolkit);
    _masterForm.initialize(this);
    _masterForm.createClientArea(parent);
  }
  
  private void createToolBarActions(Form form)
  {
    _masterForm.contributeActions(form.getToolBarManager());
  }
  
  private void createDetailsPart(Composite parent)
  {
    _detailsPanel = new Composite(parent, 0);
    _detailLayout = new StackLayout();
    _detailsPanel.setLayout(_detailLayout);
    
    _detailForms = createDetailPages();
    for (AbstractDetailsForm detailForm : _detailForms)
    {
      detailForm.initialize(_toolkit);
      detailForm.createContents(_detailsPanel);
    }
    _blankDetails = new BlankDetailsForm();
    _blankDetails.initialize(_toolkit);
    _blankDetails.createContents(_detailsPanel);
    
    _curPage = _blankDetails;
    _detailLayout.topControl = _curPage.getControl();
    _detailsPanel.layout();
  }
  
  public final void selectionChanged(final SelectionChangedEvent event)
  {
    Object selectedObj = ((IStructuredSelection)event.getSelection())
      .getFirstElement();
    AbstractDetailsForm page = selectPage(selectedObj);
    if (page != null)
    {
      final AbstractDetailsForm fpage = page;
      BusyIndicator.showWhile(_detailsPanel.getDisplay(), new Runnable()
      {
        public void run()
        {
          AbstractDetailsForm oldPage = _curPage;
          _curPage = fpage;
          if ((oldPage != null) && (oldPage.isDirty())) {
            oldPage.commit(false);
          }
          if (fpage.isStale()) {
            fpage.refresh();
          }
          _curPage.selectionChanged(event.getSelection());
          
          _detailLayout.topControl = _curPage.getControl();
          _detailsPanel.layout();
        }
      });
    }
  }
  
  protected abstract List<AbstractDetailsForm> createDetailPages();
  
  protected abstract AbstractDetailsForm doSelectPage(Object paramObject);
  
  private AbstractDetailsForm selectPage(Object forModel)
  {
    AbstractDetailsForm clientForm = doSelectPage(forModel);
    if (clientForm != null) {
      return clientForm;
    }
    return _blankDetails;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterDetailBlock
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.form;

import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;

class AbstractMasterForm$1
  implements DisposeListener
{
  AbstractMasterForm$1(AbstractMasterForm paramAbstractMasterForm) {}
  
  public void widgetDisposed(DisposeEvent e)
  {
    if (AbstractMasterForm.access$0(this$0) != null)
    {
      AbstractMasterForm.access$0(this$0).dispose();
      AbstractMasterForm.access$1(this$0, null);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterForm.1
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.form;

import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.ToolBarManager;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.swt.events.DisposeEvent;
import org.eclipse.swt.events.DisposeListener;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.ToolBar;
import org.eclipse.ui.forms.widgets.Form;
import org.eclipse.ui.forms.widgets.FormToolkit;

public abstract class AbstractMasterForm
{
  private final FormToolkit _toolkit;
  private ISelectionChangedListener _listener;
  private ToolBarManager _toolBarManager;
  
  protected AbstractMasterForm(FormToolkit toolkit)
  {
    _toolkit = toolkit;
  }
  
  public final void initialize(ISelectionChangedListener listener)
  {
    _listener = listener;
    doInitialize();
  }
  
  protected void doInitialize() {}
  
  public abstract Control createClientArea(Composite paramComposite);
  
  public final void createHead(Form form)
  {
    Composite head = form.getHead();
    Composite container = getToolkit().createComposite(head);
    container.setLayout(new RowLayout());
    
    contributeToHeadArea(getToolkit(), container);
    
    _toolBarManager = new ToolBarManager(8388608);
    ToolBar toolbar = _toolBarManager.createControl(container);
    
    toolbar.setBackground(form.getHead().getBackground());
    toolbar.setForeground(form.getHead().getForeground());
    
    container.addDisposeListener(new DisposeListener()
    {
      public void widgetDisposed(DisposeEvent e)
      {
        if (_toolBarManager != null)
        {
          _toolBarManager.dispose();
          _toolBarManager = null;
        }
      }
    });
    form.setHeadClient(container);
  }
  
  protected void contributeToHeadArea(FormToolkit toolkit, Composite container) {}
  
  public final void contributeActions(IToolBarManager formManager)
  {
    contributeActions(formManager, _toolBarManager);
  }
  
  protected void contributeActions(IToolBarManager formManager, IToolBarManager localManager) {}
  
  public void dispose() {}
  
  protected final FormToolkit getToolkit()
  {
    return _toolkit;
  }
  
  protected final ISelectionChangedListener getListener()
  {
    return _listener;
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.form.AbstractMasterForm
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.form;

import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;

public final class AbstractXMLSectionsDetailsForm$XMLTextSection
{
  private final Section _section;
  private FormText _formText;
  
  public AbstractXMLSectionsDetailsForm$XMLTextSection(FormToolkit toolkit, Composite parent, String title)
  {
    _section = toolkit.createSection(parent, 
      20);
    
    _section.setLayoutData(new RowData());
    _section.setText(title);
    
    _formText = toolkit.createFormText(_section, true);
    _formText.setText("", false, false);
    
    _section.setClient(_formText);
  }
  
  public void setText(String text, boolean parseTags, boolean expandURLs)
  {
    _formText.setText(text, parseTags, expandURLs);
  }
  
  public Control getControl()
  {
    return _section;
  }
  
  public void refresh()
  {
    _section.getParent().layout(true, true);
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm.XMLTextSection
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.form;

import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.swt.layout.RowData;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.FormText;
import org.eclipse.ui.forms.widgets.FormToolkit;
import org.eclipse.ui.forms.widgets.Section;

public abstract class AbstractXMLSectionsDetailsForm
  extends AbstractDetailsForm
{
  private Map<Object, XMLTextSection> _textSections;
  private Composite _detailFormComposite;
  
  public final void createContents(Composite parent)
  {
    _detailFormComposite = getToolkit().createComposite(parent, 0);
    RowLayout rowLayout = new RowLayout(512);
    fill = true;
    _detailFormComposite.setLayout(rowLayout);
    
    _textSections = 
      Collections.unmodifiableMap(new HashMap(
      createXMLTextSections(_detailFormComposite)));
    
    Set<XMLTextSection> expandedSections = getInitiallyExpanded(_textSections);
    
    Iterator localIterator = _textSections.entrySet().iterator();
    while (localIterator.hasNext())
    {
      Map.Entry<? extends Object, XMLTextSection> entry = (Map.Entry)localIterator.next();
      
      XMLTextSection section = (XMLTextSection)entry.getValue();
      if (expandedSections.contains(section)) {
        _section.setExpanded(true);
      }
    }
  }
  
  protected abstract Map<? extends Object, XMLTextSection> createXMLTextSections(Composite paramComposite);
  
  protected abstract Set<XMLTextSection> getInitiallyExpanded(Map<Object, XMLTextSection> paramMap);
  
  public Control getControl()
  {
    return _detailFormComposite;
  }
  
  public final void selectionChanged(ISelection selection)
  {
    if ((selection instanceof IStructuredSelection))
    {
      Object selectionObj = ((IStructuredSelection)selection)
        .getFirstElement();
      doUpdateSelection(selectionObj);
    }
  }
  
  public void commit(boolean onSave) {}
  
  public void dispose() {}
  
  public void setFocus() {}
  
  protected static final class XMLTextSection
  {
    private final Section _section;
    private FormText _formText;
    
    public XMLTextSection(FormToolkit toolkit, Composite parent, String title)
    {
      _section = toolkit.createSection(parent, 
        20);
      
      _section.setLayoutData(new RowData());
      _section.setText(title);
      
      _formText = toolkit.createFormText(_section, true);
      _formText.setText("", false, false);
      
      _section.setClient(_formText);
    }
    
    public void setText(String text, boolean parseTags, boolean expandURLs)
    {
      _formText.setText(text, parseTags, expandURLs);
    }
    
    public Control getControl()
    {
      return _section;
    }
    
    public void refresh()
    {
      _section.getParent().layout(true, true);
    }
  }
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.form.AbstractXMLSectionsDetailsForm
 * Java Class Version: 5 (49.0)
 * JD-Core Version:    0.7.1
 */
package org.eclipse.jst.jsf.common.ui.internal.form;

import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.forms.widgets.FormToolkit;

public final class BlankDetailsForm
  extends AbstractDetailsForm
{
  private Composite _emptyPanel;
  
  public void createContents(Composite parent)
  {
    _emptyPanel = getToolkit().createComposite(parent);
  }
  
  public Control getControl()
  {
    return _emptyPanel;
  }
  
  protected void doUpdateSelection(Object newSelection) {}
  
  public void commit(boolean onSave) {}
  
  public void dispose() {}
  
  public void setFocus() {}
}

/* Location:
 * Qualified Name:     org.eclipse.jst.jsf.common.ui.internal.form.BlankDetailsForm
 * Java Class 
1 2 3 4 5 6 7 8 9 10 11

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