org.eclipse.jst.jsf.ui_1.3.2.v201104251204

16:45:57.102 INFO  jd.cli.Main - Decompiling org.eclipse.jst.jsf.ui_1.3.2.v201104251204.jar
package org.eclipse.jst.jsf.ui.internal;

import java.io.PrintStream;
import org.eclipse.osgi.framework.debug.FrameworkDebugOptions;
import org.eclipse.osgi.service.debug.DebugOptions;

public final class JSFUITraceOptions
{
  public static final boolean ENABLED;
  public static final boolean TRACE_METADATAGEN;
  private static final String KEY_DEBUG_ENABLED = "/debug";
  private static final String KEY_DESIGNTIME = "/metadatagen";
  
  static
  {
    DebugOptions debugOptions = FrameworkDebugOptions.getDefault();
    
    ENABLED = (debugOptions != null) && 
      (debugOptions.getBooleanOption("org.eclipse.jst.jsf.ui/debug", 
      false));
    if (ENABLED) {
      TRACE_METADATAGEN = debugOptions.getBooleanOption(
        "org.eclipse.jst.jsf.ui/metadatagen", false);
    } else {
      TRACE_METADATAGEN = false;
    }
  }
  
  public static void log(String message)
  {
    System.out.println(message);
  }
  
  public static void log(String msg, Throwable t)
  {
    System.out.printf("%s: Exception Trace:\n\n", new Object[] { msg });
    t.printStackTrace(System.out);
    System.out.print("\n\n\n");
  }
}

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

import java.net.MalformedURLException;
import java.net.URL;
import org.eclipse.core.runtime.ILog;
import org.eclipse.core.runtime.Status;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.resource.ImageRegistry;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;

public class JSFUiPlugin
  extends AbstractUIPlugin
{
  public static final String PLUGIN_ID = "org.eclipse.jst.jsf.ui";
  private static JSFUiPlugin plugin;
  
  public JSFUiPlugin()
  {
    plugin = this;
  }
  
  public void start(BundleContext context)
    throws Exception
  {
    super.start(context);
  }
  
  public void stop(BundleContext context)
    throws Exception
  {
    super.stop(context);
    plugin = null;
  }
  
  public static JSFUiPlugin getDefault()
  {
    return plugin;
  }
  
  public static ImageDescriptor getImageDescriptor(String path)
  {
    path = "icons/" + path;
    return AbstractUIPlugin.imageDescriptorFromPlugin("org.eclipse.jst.jsf.ui", path);
  }
  
  public Image getImage(String name)
  {
    if (name == null) {
      return null;
    }
    ImageRegistry images = getImageRegistry();
    Image image = images.get(name);
    if (image == null) {
      try
      {
        URL pluginBase = getBundle().getEntry("/");
        ImageDescriptor id = ImageDescriptor.createFromURL(new URL(
          pluginBase, "icons/" + name));
        images.put(name, id);
        
        image = images.get(name);
      }
      catch (MalformedURLException ee)
      {
        log(4, "Loading image", ee);
      }
    }
    return image;
  }
  
  public String getPluginID()
  {
    return "org.eclipse.jst.jsf.ui";
  }
  
  public static void log(int severity, String message, Throwable ex)
  {
    getDefault().getLog().log(new Status(severity, "org.eclipse.jst.jsf.ui", 0, message, ex));
  }
  
  public static void log(int severity, String message)
  {
    log(severity, message, null);
  }
}

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

import org.eclipse.osgi.util.NLS;

public class Messages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.ui.internal.messages";
  public static String JSFFacetInstallPage_JSFImplementationLibrariesFrame;
  public static String JSFFacetInstallPage_JSFComponentLibrariesFrame;
  public static String JSFFacetInstallPage_title;
  public static String JSFFacetInstallPage_description;
  public static String JSFFacetInstallPage_JSFImplLabel;
  public static String JSFFacetInstallPage_Add1;
  public static String JSFFacetInstallPage_Add2;
  public static String JSFFacetInstallPage_DeployJarsLabel;
  public static String JSFFacetInstallPage_ConfigureServletLabel;
  public static String JSFFacetInstallPage_JSFConfigLabel;
  public static String JSFFacetInstallPage_JSFServletNameLabel;
  public static String JSFFacetInstallPage_JSFServletClassNameLabel;
  public static String JSFFacetInstallPage_JSFURLMappingLabel;
  public static String JSFFacetInstallPage_PatternDialogTitle;
  public static String JSFFacetInstallPage_PatternDialogDesc;
  public static String JSFFacetInstallPage_Remove;
  public static String JSFFacetInstallPage_PatternEmptyMsg;
  public static String JSFFacetInstallPage_PatternSpecifiedMsg;
  public static String JSFFacetInstallPage_ErrorNoWebAppDataModel;
  public static String JSFLibrariesPreferencePage_DEFAULT_IMPL_DESC;
  public static String JSFLibrariesPreferencePage_DefinedJSFLibraries;
  public static String JSFLibrariesPreferencePage_IMPL_DESC;
  public static String JSFLibrariesPreferencePage_MISSING_DESC;
  public static String JSFLibrariesPreferencePage_New;
  public static String JSFLibrariesPreferencePage_Edit;
  public static String JSFLibrariesPreferencePage_Remove;
  public static String JSFLibrariesPreferencePage_CannotRemovePluginProvidedTitle;
  public static String JSFLibrariesPreferencePage_CannotRemovePluginProvidedMessage;
  public static String JSFLibrariesPreferencePage_MakeDefault;
  public static String JSFLibrariesPreferencePage_Description;
  public static String JSFLibrariesPreferencePage_CannotModifyPluginProvidedTitle;
  public static String JSFLibrariesPreferencePage_CannotModifyPluginProvidedMessage;
  public static String JSFLibraryConfigControl_Add;
  public static String JSFLibraryConfigControl_AddAll;
  public static String JSFLibraryConfigControl_ImplementationLibrary;
  public static String JSFLibraryConfigControl_NewComponentLibrary;
  public static String JSFLibraryConfigControl_NullProject;
  public static String JSFLibraryConfigControl_DeployJAR;
  public static String JSFLibraryConfigControl_Remove;
  public static String JSFLibraryConfigControl_RemoveAll;
  public static String JSFLibraryConfigControl_TH_Deploy;
  public static String JSFLibraryConfigControl_TH_LibraryName;
  public static String JSFLibraryContainerWizardPage_PageName;
  public static String JSFLibraryContainerWizardPage_Title;
  public static String JSFLibraryContainerWizardPage_Description;
  public static String JSFLibraryContainerWizardPage_WarningNoJSFFacet;
  public static String JSFLibraryContainerWizardPage_JSFLibraries;
  public static String JSFLibraryContainerWizardPage_Add;
  public static String JSFLibraryContainerWizardPage_Edit;
  public static String JSFLibraryContainerWizardPage_ErrorInitializing;
  public static String JSFLibraryContainerWizardPage_ImplAlreadyPresent;
  public static String JSFLibraryContainerWizardPage_SelectOneImpl;
  public static String JSFLibraryContainerWizardPage_EditLibrary_DescriptionText;
  public static String JSFLibraryPropertyPage_No_JSF_Facet_Installed;
  public static String JSFLibraryPropertyPage_No_JSF_Implementation_Lib_Selected;
  public static String JSFLibraryWizard_DESCRIPTION;
  public static String JSFLibraryWizard_CreateJSFLibrary;
  public static String JSFLibraryWizard_EditJSFLibrary;
  public static String JSFLibraryWizard_JSFLibrary;
  public static String JSFLibraryWizard_JSFLibraryWizard_DontShowThisAgain_CheckBoxLabel;
  public static String JSFLibraryWizard_LibraryName;
  public static String JSFLibraryWizard_VersionSupported;
  public static String JSFLibraryWizard_LibraryJars;
  public static String JSFLibraryWizard_DeployJars;
  public static String JSFLibraryWizard_Add;
  public static String JSFLibraryWizard_Remove;
  public static String JSFLibraryWizard_ExtJarFileDialogTitle;
  public static String JSFLibraryWizard_ValidateNoJars;
  public static String JSFLibraryWizard_ValidateNoLibraryName;
  public static String JSFLibraryWizard_ValidateExistingLibraryName;
  public static String JSFValidationPreferencePage_ELPrefPanel_Title;
  public static String JSFValidationPreferencePage_ELPrefPanel_BuildValidationCheckBoxTitle;
  public static String JSFValidationPreferencePage_ELPrefPanel_IncrementalValidationCheckBoxTitle;
  public static String JSFLibraryEditControl_ImplVersion_UNKNOWN;
  public static String JSFPreferences_RootPage_Description;
  public static String Hyperlink_Open_JavaType;
  public static String Hyperlink_Open_JavaMethod;
  public static String Hyperlink_Open_JavaFile;
  public static String Hyperlink_Open_JavaElement;
  
  static
  {
    NLS.initializeMessages("org.eclipse.jst.jsf.ui.internal.messages", Messages.class);
  }
}

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

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

class JSFLibraryContainerWizardPage$1
  extends SelectionAdapter
{
  JSFLibraryContainerWizardPage$1(JSFLibraryContainerWizardPage paramJSFLibraryContainerWizardPage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    JSFLibraryContainerWizardPage.access$3(this$0, null);
  }
}

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

import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class JSFLibraryContainerWizardPage$2
  extends SelectionAdapter
{
  JSFLibraryContainerWizardPage$2(JSFLibraryContainerWizardPage paramJSFLibraryContainerWizardPage) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    StructuredSelection sel = (StructuredSelection)JSFLibraryContainerWizardPage.access$4(this$0).getSelection();
    if (((sel == null) || (sel.isEmpty())) && (JSFLibraryContainerWizardPage.access$5(this$0) != null))
    {
      JSFLibrary jsfLib = JSFLibraryContainerWizardPage.access$6(this$0, JSFLibraryContainerWizardPage.access$5(this$0));
      sel = new StructuredSelection(jsfLib);
    }
    JSFLibraryContainerWizardPage.access$3(this$0, sel);
  }
}

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

import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary;
import org.eclipse.swt.widgets.Button;

class JSFLibraryContainerWizardPage$3
  implements ISelectionChangedListener
{
  JSFLibraryContainerWizardPage$3(JSFLibraryContainerWizardPage paramJSFLibraryContainerWizardPage, Button paramButton) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    setEditButton(event.getSelection());
  }
  
  private void setEditButton(ISelection selection)
  {
    IStructuredSelection sel = (IStructuredSelection)selection;
    val$editButton.setVisible(sel.size() == 1);
    if (sel.size() == 1)
    {
      JSFLibrary lib = (JSFLibrary)sel.getFirstElement();
      boolean pp = lib instanceof PluginProvidedJSFLibrary;
      val$editButton.setEnabled(!pp);
      if (JSFLibraryContainerWizardPage.access$0(this$0))
      {
        JSFLibraryContainerWizardPage.access$4(this$0).setAllChecked(false);
        JSFLibraryContainerWizardPage.access$4(this$0).setChecked(lib, true);
      }
    }
  }
}

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

import java.util.Map;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ICheckable;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;

class JSFLibraryContainerWizardPage$4
  implements ICheckStateListener
{
  JSFLibraryContainerWizardPage$4(JSFLibraryContainerWizardPage paramJSFLibraryContainerWizardPage) {}
  
  public void checkStateChanged(CheckStateChangedEvent e)
  {
    if (!JSFLibraryContainerWizardPage.access$0(this$0))
    {
      if (JSFLibraryContainerWizardPage.access$2(this$0).get(((JSFLibrary)e.getElement()).getID()) != null) {
        if (JSFLibraryContainerWizardPage.access$5(this$0) == null) {
          e.getCheckable().setChecked(e.getElement(), true);
        } else {
          JSFLibraryContainerWizardPage.access$4(this$0).setAllChecked(true);
        }
      }
    }
    else
    {
      JSFLibraryContainerWizardPage.access$4(this$0).setAllChecked(false);
      JSFLibraryContainerWizardPage.access$4(this$0).setChecked(e.getElement(), true);
      if (JSFLibraryContainerWizardPage.access$0(this$0)) {
        JSFLibraryContainerWizardPage.access$4(this$0).setSelection(new StructuredSelection(e.getElement()));
      }
    }
    JSFLibraryContainerWizardPage.access$7(this$0);
  }
}

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

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;
import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin;
import org.eclipse.jst.jsf.ui.internal.Messages;
import org.eclipse.swt.graphics.Image;

class JSFLibraryContainerWizardPage$JSFLibrariesListLabelProvider
  implements ILabelProvider
{
  Image libImg;
  
  public Image getImage(Object element)
  {
    if (libImg == null)
    {
      ImageDescriptor libImgDesc = JSFUiPlugin.getImageDescriptor("obj16/library_obj.gif");
      libImg = libImgDesc.createImage();
    }
    return libImg;
  }
  
  public String getText(Object element)
  {
    if ((element instanceof JSFLibrary))
    {
      JSFLibrary lib = (JSFLibrary)element;
      if (lib.isImplementation()) {
        return lib.getLabel() + " " + Messages.JSFLibrariesPreferencePage_IMPL_DESC;
      }
      return lib.getLabel();
    }
    return null;
  }
  
  public void dispose()
  {
    if (libImg != null) {
      libImg.dispose();
    }
  }
  
  public void addListener(ILabelProviderListener listener) {}
  
  public boolean isLabelProperty(Object element, String property)
  {
    return false;
  }
  
  public void removeListener(ILabelProviderListener listener) {}
}

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

import java.util.Comparator;
import java.util.List;
import java.util.Map;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;

class JSFLibraryContainerWizardPage$JSFLibrariesTableViewerAdapter
  extends ViewerComparator
  implements IStructuredContentProvider, ISelectionChangedListener, IDoubleClickListener
{
  private Object input;
  
  private JSFLibraryContainerWizardPage$JSFLibrariesTableViewerAdapter(JSFLibraryContainerWizardPage paramJSFLibraryContainerWizardPage) {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
  {
    input = newInput;
  }
  
  public void dispose() {}
  
  public Object[] getElements(Object inputElement)
  {
    return ((List)input).toArray();
  }
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    if (JSFLibraryContainerWizardPage.access$0(this$0)) {
      this$0.setPageComplete(this$0.isPageComplete());
    }
  }
  
  public void doubleClick(DoubleClickEvent event)
  {
    JSFLibraryContainerWizardPage.access$1(this$0, event);
  }
  
  public int compare(Viewer viewer, Object e1, Object e2)
  {
    JSFLibrary lib1 = (JSFLibrary)e1;
    JSFLibrary lib2 = (JSFLibrary)e2;
    
    boolean lib1Sel = JSFLibraryContainerWizardPage.access$2(this$0).get(lib1.getID()) != null;
    boolean lib2Sel = JSFLibraryContainerWizardPage.access$2(this$0).get(lib2.getID()) != null;
    if (((lib1Sel) && (lib2Sel)) || ((!lib1Sel) && (!lib2Sel))) {
      return getComparator().compare(lib1.getLabel(), lib2.getLabel());
    }
    if (lib1Sel) {
      return -1;
    }
    return 1;
  }
}

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

import java.util.ArrayList;
import java.util.Collection;
import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.jdt.core.IClasspathEntry;
import org.eclipse.jdt.core.IJavaProject;
import org.eclipse.jdt.core.JavaCore;
import org.eclipse.jdt.ui.wizards.IClasspathContainerPage;
import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension;
import org.eclipse.jdt.ui.wizards.IClasspathContainerPageExtension2;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.CheckStateChangedEvent;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.ICheckStateListener;
import org.eclipse.jface.viewers.ICheckable;
import org.eclipse.jface.viewers.IDoubleClickListener;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.jface.wizard.WizardDialog;
import org.eclipse.jface.wizard.WizardPage;
import org.eclipse.jst.jsf.core.internal.jsflibraryconfig.JSFLibraryRegistryUtil;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistry;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.PluginProvidedJSFLibrary;
import org.eclipse.jst.jsf.core.jsfappconfig.JSFAppConfigUtils;
import org.eclipse.jst.jsf.core.jsflibraryconfiguration.JSFLibraryConfigurationHelper;
import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin;
import org.eclipse.jst.jsf.ui.internal.Messages;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
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.Table;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.IWorkbenchWizard;
import org.eclipse.ui.PlatformUI;

/**
 * @deprecated
 */
public class JSFLibraryContainerWizardPage
  extends WizardPage
  implements IClasspathContainerPage, IClasspathContainerPageExtension, IClasspathContainerPageExtension2
{
  private CheckboxTableViewer lv;
  private JSFLibrariesTableViewerAdapter lvAdapter;
  private JSFLibrariesListLabelProvider lvLabelProvider;
  private boolean isJSFProject = false;
  private IClasspathEntry containerEntry;
  private IClasspathEntry[] currentEntries;
  private Map _currentLibs;
  private JSFLibrary currentLib;
  private IProject _iproject;
  
  public JSFLibraryContainerWizardPage()
  {
    super(Messages.JSFLibraryContainerWizardPage_PageName);
    setTitle(Messages.JSFLibraryContainerWizardPage_Title);
    setDescription(Messages.JSFLibraryContainerWizardPage_Description);
    
    setImageDescriptor(JSFUiPlugin.getImageDescriptor("full/wizban/addlibrary_wiz.gif"));
  }
  
  public void initialize(IJavaProject project, IClasspathEntry[] currentEntries_)
  {
    currentEntries = currentEntries_;
    
    _iproject = project.getProject();
    isJSFProject = JSFAppConfigUtils.isValidJSFProject(_iproject);
  }
  
  public boolean finish()
  {
    return true;
  }
  
  public IClasspathEntry[] getNewContainers()
  {
    IPath cp = new Path("org.eclipse.jst.jsf.core.internal.jsflibrarycontainer");
    List res = new ArrayList();
    Object[] items = lv.getCheckedElements();
    for (int i = 0; i < items.length; i++)
    {
      JSFLibrary jsfLib = (JSFLibrary)items[i];
      if (getSelectedJSFLibariesForProject().get(jsfLib.getID()) == null)
      {
        IPath path = cp.append(new Path(jsfLib.getID()));
        IClasspathEntry entry = JavaCore.newContainerEntry(path);
        
        res.add(entry);
      }
    }
    return (IClasspathEntry[])res.toArray(new IClasspathEntry[0]);
  }
  
  public boolean isPageComplete()
  {
    if (!isJSFProject) {
      return false;
    }
    if ((isEditReference()) && (!selectionHasChanged())) {
      return false;
    }
    return isValid();
  }
  
  private boolean isValid()
  {
    return (isCheckedItems()) && (getErrorMessage() == null);
  }
  
  private boolean selectionHasChanged()
  {
    JSFLibrary lib = getCurrentLibrarySelection();
    if (lib == null) {
      return false;
    }
    return getJSFLibraryForEdit(containerEntry) != lib;
  }
  
  private JSFLibrary getCurrentLibrarySelection()
  {
    JSFLibrary lib = null;
    StructuredSelection ssel = (StructuredSelection)lv.getSelection();
    if ((ssel != null) && (!ssel.isEmpty())) {
      lib = (JSFLibrary)ssel.getFirstElement();
    }
    return lib;
  }
  
  private boolean isCheckedItems()
  {
    return lv.getCheckedElements().length > 0;
  }
  
  public IClasspathEntry getSelection()
  {
    IClasspathEntry entry = null;
    if (isEditReference())
    {
      if (lv.getCheckedElements().length == 0) {
        return containerEntry;
      }
      JSFLibrary lib = (JSFLibrary)lv.getCheckedElements()[0];
      if (lib != null)
      {
        if (lib == getJSFLibraryForEdit(containerEntry)) {
          return containerEntry;
        }
        IPath path = new Path("org.eclipse.jst.jsf.core.internal.jsflibrarycontainer").append(new Path(lib.getID()));
        entry = JavaCore.newContainerEntry(path, containerEntry.getAccessRules(), containerEntry.getExtraAttributes(), containerEntry.isExported());
      }
    }
    return entry;
  }
  
  public void setSelection(IClasspathEntry containerEntry)
  {
    this.containerEntry = containerEntry;
  }
  
  public void createControl(Composite parent)
  {
    Composite c = new Composite(parent, 0);
    c.setLayout(new GridLayout(2, false));
    c.setLayoutData(new GridData(1808));
    if (!isJSFProject)
    {
      Label warning = new Label(c, 0);
      warning.setText(Messages.JSFLibraryContainerWizardPage_WarningNoJSFFacet);
      setControl(c);
      return;
    }
    Label lblViewer = new Label(c, 0);
    lblViewer.setText(Messages.JSFLibraryContainerWizardPage_JSFLibraries);
    GridData gd1 = new GridData(1);
    horizontalSpan = 2;
    lblViewer.setLayoutData(gd1);
    
    lv = createTableViewer(c);
    lv.getControl().setLayoutData(new GridData(1808));
    
    lvAdapter = new JSFLibrariesTableViewerAdapter(null);
    lvLabelProvider = new JSFLibrariesListLabelProvider(null);
    lv.setContentProvider(lvAdapter);
    lv.setLabelProvider(lvLabelProvider);
    lv.addSelectionChangedListener(lvAdapter);
    lv.addDoubleClickListener(lvAdapter);
    lv.setComparator(lvAdapter);
    
    Composite buttons = new Composite(c, 0);
    buttons.setLayout(new GridLayout(1, false));
    buttons.setLayoutData(new GridData(1040));
    
    Button addButton = new Button(buttons, 0);
    addButton.setText(Messages.JSFLibraryContainerWizardPage_Add);
    addButton.setLayoutData(new GridData(3));
    addButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        JSFLibraryContainerWizardPage.this.openJSFLibraryWizard(null);
      }
    });
    final Button editButton = new Button(buttons, 0);
    editButton.setText(Messages.JSFLibraryContainerWizardPage_Edit);
    editButton.setLayoutData(new GridData(3));
    editButton.addSelectionListener(new SelectionAdapter()
    {
      public void widgetSelected(SelectionEvent e)
      {
        StructuredSelection sel = (StructuredSelection)lv.getSelection();
        if (((sel == null) || (sel.isEmpty())) && (containerEntry != null))
        {
          JSFLibrary jsfLib = JSFLibraryContainerWizardPage.this.getJSFLibraryForEdit(containerEntry);
          sel = new StructuredSelection(jsfLib);
        }
        JSFLibraryContainerWizardPage.this.openJSFLibraryWizard(sel);
      }
    });
    editButton.setVisible(false);
    lv.addSelectionChangedListener(new ISelectionChangedListener()
    {
      public void selectionChanged(SelectionChangedEvent event)
      {
        setEditButton(event.getSelection());
      }
      
      private void setEditButton(ISelection selection)
      {
        IStructuredSelection sel = (IStructuredSelection)selection;
        editButton.setVisible(sel.size() == 1);
        if (sel.size() == 1)
        {
          JSFLibrary lib = (JSFLibrary)sel.getFirstElement();
          boolean pp = lib instanceof PluginProvidedJSFLibrary;
          editButton.setEnabled(!pp);
          if (JSFLibraryContainerWizardPage.this.isEditReference())
          {
            lv.setAllChecked(false);
            lv.setChecked(lib, true);
          }
        }
      }
    });
    setControl(c);
    if (isEditReference())
    {
      JSFLibrary lib = getJSFLibraryForEdit(containerEntry);
      lv.setInput(getAllUnselectedJSFLibrariesExceptReferencedLib(lib));
      selectAndCheckCurrentLib(lib);
      setDescription(Messages.JSFLibraryContainerWizardPage_EditLibrary_DescriptionText);
    }
    else
    {
      lv.setInput(getAllJSFLibraries());
      lv.setCheckedElements(getSelectedJSFLibariesForProject().values().toArray(new Object[0]));
    }
  }
  
  private void selectAndCheckCurrentLib(JSFLibrary lib)
  {
    if (lib != null)
    {
      StructuredSelection ssel = new StructuredSelection(lib);
      lv.setSelection(ssel);
      lv.setChecked(lib, true);
    }
  }
  
  private Object getAllUnselectedJSFLibrariesExceptReferencedLib(JSFLibrary referenceLib)
  {
    List allLibs = getAllJSFLibraries();
    Collection selLibs = getSelectedJSFLibariesForProject().values();
    for (Iterator it = selLibs.iterator(); it.hasNext();)
    {
      JSFLibrary aLib = (JSFLibrary)it.next();
      int i = allLibs.indexOf(aLib);
      if ((i >= 0) && ((referenceLib == null) || ((aLib != null) && (!aLib.getID().equals(referenceLib.getID()))))) {
        allLibs.remove(i);
      }
    }
    return allLibs;
  }
  
  private List getJSFLibraryEntries(IClasspathEntry[] entries)
  {
    List jsfLibs = new ArrayList();
    for (int i = 0; i < entries.length; i++)
    {
      IClasspathEntry entry = entries[i];
      if (JSFLibraryConfigurationHelper.isJSFLibraryContainer(entry))
      {
        JSFLibrary lib = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibraryByID(getLibraryId(entry));
        if (lib != null) {
          jsfLibs.add(lib);
        }
      }
    }
    return jsfLibs;
  }
  
  private String getLibraryId(IClasspathEntry entry)
  {
    return entry.getPath().segment(1);
  }
  
  private void openJSFLibraryWizard(IStructuredSelection element)
  {
    IWorkbenchWizard wizard = new JSFLibraryWizard();
    IWorkbench wb = PlatformUI.getWorkbench();
    wizard.init(wb, element);
    WizardDialog dialog = new WizardDialog(wb.getActiveWorkbenchWindow().getShell(), wizard);
    int ret = dialog.open();
    if (ret == 0)
    {
      if (containerEntry == null)
      {
        lv.setInput(getAllJSFLibraries());
      }
      else
      {
        lv.setInput(getAllUnselectedJSFLibrariesExceptReferencedLib(getJSFLibraryForEdit(containerEntry)));
        lv.refresh(true);
      }
      lv.refresh();
    }
  }
  
  private CheckboxTableViewer createTableViewer(Composite parent)
  {
    Table table = new Table(parent, 2850);
    table.setFont(parent.getFont());
    CheckboxTableViewer tableViewer = new CheckboxTableViewer(table);
    tableViewer.addCheckStateListener(new ICheckStateListener()
    {
      public void checkStateChanged(CheckStateChangedEvent e)
      {
        if (!JSFLibraryContainerWizardPage.this.isEditReference())
        {
          if (JSFLibraryContainerWizardPage.this.getSelectedJSFLibariesForProject().get(((JSFLibrary)e.getElement()).getID()) != null) {
            if (containerEntry == null) {
              e.getCheckable().setChecked(e.getElement(), true);
            } else {
              lv.setAllChecked(true);
            }
          }
        }
        else
        {
          lv.setAllChecked(false);
          lv.setChecked(e.getElement(), true);
          if (JSFLibraryContainerWizardPage.this.isEditReference()) {
            lv.setSelection(new StructuredSelection(e.getElement()));
          }
        }
        JSFLibraryContainerWizardPage.this.validate();
      }
    });
    return tableViewer;
  }
  
  private Map getSelectedJSFLibariesForProject()
  {
    if (_currentLibs == null)
    {
      List allLibs = getAllJSFLibraries();
      List curLibs = getJSFLibraryEntries(currentEntries);
      _currentLibs = new HashMap(curLibs.size());
      for (Iterator it = curLibs.iterator(); it.hasNext();)
      {
        JSFLibrary lib = (JSFLibrary)it.next();
        int index = getIndex(allLibs, lib);
        if (index >= 0) {
          _currentLibs.put(lib.getID(), allLibs.get(index));
        }
      }
    }
    return _currentLibs;
  }
  
  private List getAllJSFLibraries()
  {
    List allLibs = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getAllJSFLibraries();
    
    return allLibs;
  }
  
  private JSFLibrary getJSFLibraryForEdit(IClasspathEntry containerEntry_)
  {
    if (currentLib == null)
    {
      String id = getLibraryId(containerEntry_);
      currentLib = JSFLibraryRegistryUtil.getInstance().getJSFLibraryRegistry().getJSFLibraryByID(id);
    }
    return currentLib;
  }
  
  private int getIndex(List libs, JSFLibrary lib)
  {
    for (int i = 0; i < libs.size(); i++) {
      if (lib.getID().equals(((JSFLibrary)libs.get(i)).getID())) {
        return i;
      }
    }
    return -1;
  }
  
  private class JSFLibrariesTableViewerAdapter
    extends ViewerComparator
    implements IStructuredContentProvider, ISelectionChangedListener, IDoubleClickListener
  {
    private Object input;
    
    private JSFLibrariesTableViewerAdapter() {}
    
    public void inputChanged(Viewer viewer, Object oldInput, Object newInput)
    {
      input = newInput;
    }
    
    public void dispose() {}
    
    public Object[] getElements(Object inputElement)
    {
      return ((List)input).toArray();
    }
    
    public void selectionChanged(SelectionChangedEvent event)
    {
      if (JSFLibraryContainerWizardPage.this.isEditReference()) {
        setPageComplete(isPageComplete());
      }
    }
    
    public void doubleClick(DoubleClickEvent event)
    {
      JSFLibraryContainerWizardPage.this.doDoubleClick(event);
    }
    
    public int compare(Viewer viewer, Object e1, Object e2)
    {
      JSFLibrary lib1 = (JSFLibrary)e1;
      JSFLibrary lib2 = (JSFLibrary)e2;
      
      boolean lib1Sel = JSFLibraryContainerWizardPage.this.getSelectedJSFLibariesForProject().get(lib1.getID()) != null;
      boolean lib2Sel = JSFLibraryContainerWizardPage.this.getSelectedJSFLibariesForProject().get(lib2.getID()) != null;
      if (((lib1Sel) && (lib2Sel)) || ((!lib1Sel) && (!lib2Sel))) {
        return getComparator().compare(lib1.getLabel(), lib2.getLabel());
      }
      if (lib1Sel) {
        return -1;
      }
      return 1;
    }
  }
  
  private static class JSFLibrariesListLabelProvider
    implements ILabelProvider
  {
    Image libImg;
    
    public Image getImage(Object element)
    {
      if (libImg == null)
      {
        ImageDescriptor libImgDesc = JSFUiPlugin.getImageDescriptor("obj16/library_obj.gif");
        libImg = libImgDesc.createImage();
      }
      return libImg;
    }
    
    public String getText(Object element)
    {
      if ((element instanceof JSFLibrary))
      {
        JSFLibrary lib = (JSFLibrary)element;
        if (lib.isImplementation()) {
          return lib.getLabel() + " " + Messages.JSFLibrariesPreferencePage_IMPL_DESC;
        }
        return lib.getLabel();
      }
      return null;
    }
    
    public void dispose()
    {
      if (libImg != null) {
        libImg.dispose();
      }
    }
    
    public void addListener(ILabelProviderListener listener) {}
    
    public boolean isLabelProperty(Object element, String property)
    {
      return false;
    }
    
    public void removeListener(ILabelProviderListener listener) {}
  }
  
  private void validate()
  {
    setErrorMessage(null);
    int implChosenCount = implSelectedCount();
    if (implChosenCount > 1) {
      setErrorMessage(Messages.JSFLibraryContainerWizardPage_ImplAlreadyPresent);
    }
    setPageComplete(isPageComplete());
  }
  
  private boolean isEditReference()
  {
    return containerEntry != null;
  }
  
  private int implSelectedCount()
  {
    int count = 0;
    for (int i = 0; i < lv.getCheckedElements().length; i++)
    {
      JSFLibrary lib = (JSFLibrary)lv.getCheckedElements()[i];
      if (lib.isImplementation()) {
        count++;
      }
    }
    return count;
  }
  
  private void doDoubleClick(DoubleClickEvent event)
  {
    StructuredSelection ssel = (StructuredSelection)event.getSelection();
    if ((ssel != null) && 
      (!((JSFLibrary)ssel.getFirstElement() instanceof PluginProvidedJSFLibrary))) {
      openJSFLibraryWizard((IStructuredSelection)event.getSelection());
    }
  }
}

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

import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.viewers.IStructuredContentProvider;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;

class JSFLibraryEditControl$1
  implements IStructuredContentProvider
{
  JSFLibraryEditControl$1(JSFLibraryEditControl paramJSFLibraryEditControl) {}
  
  public Object[] getElements(Object inputElement)
  {
    if ((inputElement instanceof JSFLibrary)) {
      return 
        ((JSFLibrary)inputElement).getArchiveFiles().toArray();
    }
    return new Object[0];
  }
  
  public void dispose() {}
  
  public void inputChanged(Viewer viewer, Object oldInput, Object newInput) {}
}

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

import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile;
import org.eclipse.jst.jsf.ui.internal.JSFUiPlugin;
import org.eclipse.jst.jsf.ui.internal.Messages;
import org.eclipse.swt.graphics.Image;

class JSFLibraryEditControl$2
  implements ILabelProvider
{
  private Image jarImg = null;
  
  JSFLibraryEditControl$2(JSFLibraryEditControl paramJSFLibraryEditControl) {}
  
  public Image getImage(Object element)
  {
    if (jarImg == null)
    {
      ImageDescriptor desc = JSFUiPlugin.getImageDescriptor("obj16/jar_obj.gif");
      jarImg = desc.createImage();
    }
    return jarImg;
  }
  
  public String getText(Object element)
  {
    StringBuffer labelBuf = new StringBuffer();
    if ((element instanceof ArchiveFile))
    {
      ArchiveFile archive = (ArchiveFile)element;
      labelBuf.append(archive.getName());
      if (!archive.exists()) {
        labelBuf.append(Messages.JSFLibrariesPreferencePage_MISSING_DESC);
      }
      labelBuf.append(" - ").append(archive.getPath());
    }
    return labelBuf.toString();
  }
  
  public void addListener(ILabelProviderListener listener) {}
  
  public void dispose()
  {
    if (jarImg != null) {
      jarImg.dispose();
    }
  }
  
  public boolean isLabelProperty(Object element, String property)
  {
    return false;
  }
  
  public void removeListener(ILabelProviderListener listener) {}
}

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

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

class JSFLibraryEditControl$3
  implements ISelectionChangedListener
{
  JSFLibraryEditControl$3(JSFLibraryEditControl paramJSFLibraryEditControl) {}
  
  public void selectionChanged(SelectionChangedEvent event)
  {
    JSFLibraryEditControl.access$0(this$0);
  }
}

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

import org.eclipse.emf.common.util.EList;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.ArchiveFile;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibrary;
import org.eclipse.jst.jsf.core.internal.jsflibraryregistry.JSFLibraryRegistryFactory;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;

class JSFLibraryEditControl$4
  extends SelectionAdapter
{
  JSFLibraryEditControl$4(JSFLibraryEditControl paramJSFLibraryEditControl) {}
  
  public void widgetSelected(SelectionEvent e)
  {
    String cur = null;
    String[] chosenJars = JSFLibraryEditControl.access$1(this$0, cur);
    if (chosenJars != null)
    {
      for (int i = 0; i < chosenJars.length; i++)
      {
        String
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