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

textResolver resolver = 
        IStructuredDocumentContextResolverFactory2.INSTANCE.getTaglibContextResolverFromDelegates(context);
      prefix = resolver.getTagPrefixForURI(taglibURI);
    }
    return prefix;
  }
  
  public List getElementsByTagNameNS(String namespace, String elementName)
  {
    List nodes = null;
    if (getDocument() != null)
    {
      NodeList listNodes = null;
      if (namespace != null) {
        listNodes = getDocument().getElementsByTagName(
          namespace + ":" + elementName);
      } else {
        listNodes = getDocument().getElementsByTagName(elementName);
      }
      if ((listNodes != null) && (listNodes.getLength() > 0))
      {
        nodes = new ArrayList();
        for (int i = 0; i < listNodes.getLength(); i++) {
          nodes.add(listNodes.item(i));
        }
      }
    }
    return nodes;
  }
  
  private IModelManager getModelManager()
  {
    if (modelManager == null) {
      modelManager = StructuredModelManager.getModelManager();
    }
    return modelManager;
  }
  
  private IStructuredModel getModel(IFile file)
    throws IOException, CoreException
  {
    return getModelManager().getModelForRead(file);
  }
  
  private Document getDocument()
  {
    if ((document == null) && 
      (model != null) && ((model instanceof IDOMModel))) {
      document = ((IDOMModel)model).getDocument();
    }
    return document;
  }
  
  public void releaseModel()
  {
    if (model != null) {
      model.releaseFromRead();
    }
  }
}

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

public class JSPUtil
{
  /* Error */
  public static java.util.List getActionListInJSPFile(String jspFileName)
  {
    // Byte code:
    //   0: new 44	java/util/ArrayList
    //   3: dup
    //   4: invokespecial 84	java/util/ArrayList:<init>	()V
    //   7: astore_1
    //   8: aload_0
    //   9: astore_2
    //   10: aload_2
    //   11: ifnull +160 -> 171
    //   14: aload_2
    //   15: invokevirtual 83	java/lang/String:length	()I
    //   18: ifle +153 -> 171
    //   21: new 50	org/eclipse/core/runtime/Path
    //   24: dup
    //   25: aload_2
    //   26: invokespecial 86	org/eclipse/core/runtime/Path:<init>	(Ljava/lang/String;)V
    //   29: astore_3
    //   30: invokestatic 85	org/eclipse/core/resources/ResourcesPlugin:getWorkspace	()Lorg/eclipse/core/resources/IWorkspace;
    //   33: invokeinterface 94 1 0
    //   38: aload_3
    //   39: invokeinterface 95 2 0
    //   44: astore 4
    //   46: aload 4
    //   48: ifnull +123 -> 171
    //   51: aload 4
    //   53: invokeinterface 93 1 0
    //   58: ifeq +113 -> 171
    //   61: aconst_null
    //   62: astore 5
    //   64: new 51	org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter
    //   67: dup
    //   68: invokespecial 87	org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter:<init>	()V
    //   71: astore 5
    //   73: aload 5
    //   75: aload 4
    //   77: invokevirtual 89	org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter:initialize	(Lorg/eclipse/core/resources/IFile;)Z
    //   80: ifeq +81 -> 161
    //   83: aload 5
    //   85: getstatic 81	org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter:JSF_HTML_TAGLIB	Ljava/lang/String;
    //   88: invokevirtual 90	org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter:getTagLibPrefix	(Ljava/lang/String;)Ljava/lang/String;
    //   91: astore 6
    //   93: aload 5
    //   95: aload 6
    //   97: ldc 1
    //   99: invokevirtual 91	org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter:getElementsByTagNameNS	(Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;
    //   102: astore 7
    //   104: aload 7
    //   106: ifnull +12 -> 118
    //   109: aload_1
    //   110: aload 7
    //   112: invokeinterface 92 2 0
    //   117: pop
    //   118: aload 5
    //   120: aload 6
    //   122: ldc 2
    //   124: invokevirtual 91	org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter:getElementsByTagNameNS	(Ljava/lang/String;Ljava/lang/String;)Ljava/util/List;
    //   127: astore 8
    //   129: aload 8
    //   131: ifnull +30 -> 161
    //   134: aload_1
    //   135: aload 8
    //   137: invokeinterface 92 2 0
    //   142: pop
    //   143: goto +18 -> 161
    //   146: astore 9
    //   148: aload 5
    //   150: ifnull +8 -> 158
    //   153: aload 5
    //   155: invokevirtual 88	org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter:releaseModel	()V
    //   158: aload 9
    //   160: athrow
    //   161: aload 5
    //   163: ifnull +8 -> 171
    //   166: aload 5
    //   168: invokevirtual 88	org/eclipse/jst/jsf/facesconfig/ui/pageflow/util/JSPDomAdapter:releaseModel	()V
    //   171: aload_1
    //   172: areturn
    // Line number table:
    //   Java source line #38	-> byte code offset #0
    //   Java source line #42	-> byte code offset #8
    //   Java source line #43	-> byte code offset #10
    //   Java source line #45	-> byte code offset #21
    //   Java source line #46	-> byte code offset #30
    //   Java source line #47	-> byte code offset #38
    //   Java source line #46	-> byte code offset #39
    //   Java source line #49	-> byte code offset #46
    //   Java source line #51	-> byte code offset #61
    //   Java source line #54	-> byte code offset #64
    //   Java source line #56	-> byte code offset #73
    //   Java source line #59	-> byte code offset #83
    //   Java source line #60	-> byte code offset #85
    //   Java source line #59	-> byte code offset #91
    //   Java source line #63	-> byte code offset #93
    //   Java source line #64	-> byte code offset #95
    //   Java source line #63	-> byte code offset #99
    //   Java source line #65	-> byte code offset #104
    //   Java source line #66	-> byte code offset #109
    //   Java source line #69	-> byte code offset #118
    //   Java source line #70	-> byte code offset #120
    //   Java source line #69	-> byte code offset #124
    //   Java source line #71	-> byte code offset #129
    //   Java source line #72	-> byte code offset #134
    //   Java source line #76	-> byte code offset #146
    //   Java source line #77	-> byte code offset #148
    //   Java source line #79	-> byte code offset #153
    //   Java source line #81	-> byte code offset #158
    //   Java source line #77	-> byte code offset #161
    //   Java source line #79	-> byte code offset #166
    //   Java source line #84	-> byte code offset #171
    // Local variable table:
    //   start	length	slot	name	signature
    //   0	173	0	jspFileName	String
    //   7	165	1	actions	java.util.List
    //   9	17	2	physicalJspPath	String
    //   29	10	3	jspPath	org.eclipse.core.runtime.IPath
    //   44	32	4	jspFile	org.eclipse.core.resources.IFile
    //   62	105	5	jspAdapter	JSPDomAdapter
    //   91	30	6	prefix	String
    //   102	9	7	buttonActions	java.util.List
    //   127	9	8	linkActions	java.util.List
    //   146	13	9	localObject	Object
    // Exception table:
    //   from	to	target	type
    //   64	146	146	finally
  }
}

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

import org.eclipse.gef.requests.CreationFactory;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;

public class ModelCreationFactory
  implements CreationFactory
{
  private Class targetClass;
  
  public ModelCreationFactory(Class targetClass)
  {
    this.targetClass = targetClass;
  }
  
  public Object getNewObject()
  {
    PageflowFactory factory = PageflowModelManager.getFactory();
    
    Object result = null;
    if (targetClass.equals(PageflowLink.class)) {
      result = factory.createPFLink();
    } else if (targetClass.equals(PageflowPage.class)) {
      result = factory.createPFPage();
    }
    return result;
  }
  
  public Object getObjectType()
  {
    return targetClass;
  }
}

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

import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;

class PageflowAdapterFactory$1
  extends PageflowSwitch
{
  PageflowAdapterFactory$1(PageflowAdapterFactory paramPageflowAdapterFactory) {}
  
  public Object casePageflow(Pageflow object)
  {
    return this$0.createPageflowAdapter();
  }
  
  public Object casePageflowNode(PageflowNode object)
  {
    return this$0.createPageflowNodeAdapter();
  }
  
  public Object casePFLink(PageflowLink object)
  {
    return this$0.createPFLinkAdapter();
  }
  
  public Object casePageflowElement(PageflowElement object)
  {
    return this$0.createPageflowElementAdapter();
  }
  
  public Object casePFPage(PageflowPage object)
  {
    return this$0.createPFPageAdapter();
  }
  
  public Object casePFLinkBendpoint(PageflowLinkBendpoint object)
  {
    return this$0.createPFLinkBendpointAdapter();
  }
  
  public Object defaultCase(EObject object)
  {
    return this$0.createEObjectAdapter();
  }
}

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

import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notifier;
import org.eclipse.emf.common.notify.impl.AdapterFactoryImpl;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;

public class PageflowAdapterFactory
  extends AdapterFactoryImpl
{
  protected static PageflowPackage modelPackage;
  
  public PageflowAdapterFactory()
  {
    if (modelPackage == null) {
      modelPackage = PageflowPackage.eINSTANCE;
    }
  }
  
  public boolean isFactoryForType(Object object)
  {
    if (object == modelPackage) {
      return true;
    }
    if ((object instanceof EObject)) {
      return ((EObject)object).eClass().getEPackage() == modelPackage;
    }
    return false;
  }
  
  protected PageflowSwitch modelSwitch = new PageflowSwitch()
  {
    public Object casePageflow(Pageflow object)
    {
      return createPageflowAdapter();
    }
    
    public Object casePageflowNode(PageflowNode object)
    {
      return createPageflowNodeAdapter();
    }
    
    public Object casePFLink(PageflowLink object)
    {
      return createPFLinkAdapter();
    }
    
    public Object casePageflowElement(PageflowElement object)
    {
      return createPageflowElementAdapter();
    }
    
    public Object casePFPage(PageflowPage object)
    {
      return createPFPageAdapter();
    }
    
    public Object casePFLinkBendpoint(PageflowLinkBendpoint object)
    {
      return createPFLinkBendpointAdapter();
    }
    
    public Object defaultCase(EObject object)
    {
      return createEObjectAdapter();
    }
  };
  
  public Adapter createAdapter(Notifier target)
  {
    return (Adapter)modelSwitch.doSwitch((EObject)target);
  }
  
  public Adapter createPageflowAdapter()
  {
    return null;
  }
  
  public Adapter createPageflowNodeAdapter()
  {
    return null;
  }
  
  public Adapter createPFLinkAdapter()
  {
    return null;
  }
  
  public Adapter createPageflowElementAdapter()
  {
    return null;
  }
  
  public Adapter createPFActionAdapter()
  {
    return null;
  }
  
  public Adapter createPFPageAdapter()
  {
    return null;
  }
  
  public Adapter createPFBeginAdapter()
  {
    return null;
  }
  
  public Adapter createPFEndAdapter()
  {
    return null;
  }
  
  public Adapter createPFLinkBendpointAdapter()
  {
    return null;
  }
  
  public Adapter createEObjectAdapter()
  {
    return null;
  }
}

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

import java.util.Iterator;
import java.util.List;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.jface.text.source.Annotation;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.IAnnotationEditPart;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PFValidator;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowElementEditPart;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowLinkEditPart;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowNodeEditPart;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;

public class PageflowAnnotationUtil
{
  public static void validatePageflow(GraphicalEditPart containerPart)
  {
    if (containerPart == null) {
      return;
    }
    Iterator iterChild = containerPart.getChildren().iterator();
    Iterator iterLinks;
    for (; iterChild.hasNext(); iterLinks.hasNext())
    {
      PageflowElementEditPart element = 
        (PageflowElementEditPart)iterChild.next();
      if ((element instanceof PFValidator)) {
        ((PFValidator)element).validate();
      }
      iterLinks = element.getSourceConnections().iterator();
      continue;
      PageflowLinkEditPart link = 
        (PageflowLinkEditPart)iterLinks.next();
      link.validate();
    }
  }
  
  public static void validatePage(PageflowNodeEditPart pagePart)
  {
    if ((pagePart != null) && (pagePart.getParent() != null)) {
      return;
    }
    String errorMessage = null;
    
    removeAnnotation(pagePart);
    
    errorMessage = PageflowValidation.getInstance().getNotifyMessage(
      (PageflowPage)pagePart.getModel());
    if (errorMessage != null) {
      addAnnotation(pagePart, errorMessage);
    } else {
      removeAnnotation(pagePart);
    }
  }
  
  public static void validateLink(PageflowLinkEditPart linkPart)
  {
    if ((linkPart != null) && (linkPart.getParent() != null))
    {
      String errorMessage = null;
      
      removeAnnotation(linkPart);
      
      errorMessage = PageflowValidation.getInstance().isValidLink(
        (PageflowLink)linkPart.getModel());
      if (errorMessage != null) {
        addAnnotation(linkPart, errorMessage);
      } else {
        removeAnnotation(linkPart);
      }
    }
  }
  
  private static void addAnnotation(GraphicalEditPart editPart, String message)
  {
    if ((editPart != null) && ((editPart instanceof IAnnotationEditPart)))
    {
      Annotation annotation = new Annotation("org.eclipse.core.resources.problemmarker", false, 
        message);
      ((IAnnotationEditPart)editPart).addAnnotation(annotation);
    }
  }
  
  private static void removeAnnotation(GraphicalEditPart editPart)
  {
    if ((editPart != null) && ((editPart instanceof IAnnotationEditPart))) {
      ((IAnnotationEditPart)editPart).removeAnnotation();
    }
  }
}

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

import java.io.IOException;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.EPackage.Registry;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.resource.Resource.Factory.Registry;
import org.eclipse.emf.ecore.resource.ResourceSet;
import org.eclipse.emf.ecore.resource.impl.ResourceSetImpl;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.impl.PageflowPackageImpl;

public class PageflowModelManager
{
  private Resource resourcePageflow = null;
  private IPath pathPageflow = null;
  private static PageflowFactory pageflowFactory = null;
  private Pageflow pageflow = null;
  private ResourceSet resourceSet = null;
  private static HashMap defaultSaveOptions = new HashMap();
  
  static
  {
    defaultSaveOptions.put("ENCODING", "UTF-8");
  }
  
  public Resource getResource(IPath path)
  {
    if (resourcePageflow == null)
    {
      pathPageflow = path;
      ResourceSet resSet = getResourceSet();
      resourcePageflow = resSet.getResource(URI.createPlatformResourceURI(path
        .toString(), false), true);
    }
    return resourcePageflow;
  }
  
  public Pageflow getModel()
  {
    if (pageflow == null)
    {
      EList l = resourcePageflow.getContents();
      Iterator i = l.iterator();
      while (i.hasNext())
      {
        Object o = i.next();
        if ((o instanceof Pageflow)) {
          pageflow = ((Pageflow)o);
        }
      }
    }
    return pageflow;
  }
  
  private Resource createResource(IPath path)
  {
    if (resourcePageflow == null)
    {
      pathPageflow = path;
      ResourceSet resSet = getResourceSet();
      resourcePageflow = resSet.createResource(URI.createPlatformResourceURI(path
        .toString(), false));
    }
    return resourcePageflow;
  }
  
  private ResourceSet getResourceSet()
  {
    if (resourceSet == null)
    {
      PageflowPackageImpl.init();
      
      Resource.Factory.Registry reg = Resource.Factory.Registry.INSTANCE;
      Map regMap = reg.getExtensionToFactoryMap();
      
      regMap.put("pageflow", new PageflowResourceFactoryImpl());
      
      resourceSet = new ResourceSetImpl();
    }
    return resourceSet;
  }
  
  public static PageflowFactory getFactory()
  {
    if (pageflowFactory == null)
    {
      Map registry = EPackage.Registry.INSTANCE;
      String pageflowURI = "http://www.sybase.com/suade/pageflow";
      PageflowPackage pageflowPackage = 
        (PageflowPackage)registry.get(pageflowURI);
      pageflowFactory = pageflowPackage.getPageflowFactory();
    }
    return pageflowFactory;
  }
  
  public Pageflow createPageflow(IPath path)
  {
    createResource(path);
    
    Map registry = EPackage.Registry.INSTANCE;
    String pageflowURI = "http://www.sybase.com/suade/pageflow";
    PageflowPackage nPackage = (PageflowPackage)registry.get(pageflowURI);
    PageflowFactory nFactory = nPackage.getPageflowFactory();
    pageflow = nFactory.createPageflow();
    
    resourcePageflow.getContents().add(pageflow);
    return pageflow;
  }
  
  public void load(IPath path)
  {
    getResource(path);
  }
  
  public void reload(IPath path)
  {
    getResource(path).unload();
    load(path);
  }
  
  public void save(IPath path)
    throws IOException
  {
    if (!pathPageflow.toString().equalsIgnoreCase(path.toString()))
    {
      pathPageflow = path;
      URI fileURI = URI.createPlatformResourceURI(path.toString(), false);
      resourcePageflow.setURI(fileURI);
    }
    resourcePageflow.save(defaultSaveOptions);
  }
  
  public IPath getPath()
  {
    return pathPageflow;
  }
  
  public PageflowPage foundPage(String webPath)
  {
    PageflowPage page = null;
    if (getModel() != null)
    {
      Iterator iterNodes = getModel().getNodes().iterator();
      while (iterNodes.hasNext())
      {
        PageflowNode node = (PageflowNode)iterNodes.next();
        if (((node instanceof PageflowPage)) && 
          (((PageflowPage)node).getPath().equalsIgnoreCase(webPath)))
        {
          page = (PageflowPage)node;
          break;
        }
      }
    }
    return page;
  }
  
  public static IPath makePageflowPath(IPath pathFacesConfig)
  {
    String[] segs = pathFacesConfig.removeFileExtension().segments();
    IPath pageflowPath = new Path(segs[0]).makeAbsolute();
    pageflowPath = pageflowPath.append(".metadata");
    for (int i = 1; i < segs.length; i++) {
      pageflowPath = pageflowPath.append(segs[i]);
    }
    pageflowPath = pageflowPath.addFileExtension("pageflow");
    return pageflowPath;
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.gef.requests.CreationFactory;
import org.eclipse.jst.jsf.common.ui.internal.guiutils.Alerts;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowFactory;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;
import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil;

public class PageflowResourceFactory
  implements CreationFactory
{
  private IResource resource;
  
  public PageflowResourceFactory(IResource resource)
  {
    this.resource = resource;
  }
  
  public Object getNewObject()
  {
    if (resource == null) {
      return null;
    }
    String strWebPath = WebrootUtil.getWebPath(resource.getFullPath());
    if (strWebPath.length() > 0)
    {
      PageflowFactory factory = PageflowModelManager.getFactory();
      Object result = factory.createPFPage();
      PageflowPage page = (PageflowPage)result;
      page.setPath(strWebPath);
      page.setName(WebrootUtil.getPageNameFromWebPath(strWebPath));
      return page;
    }
    EditorPlugin.getAlerts().error(
      "Pageflow.Error.DNDResourceTitle", 
      
      EditorPlugin.getResourceString("Pageflow.Error.InvalidResource") + 
      resource.getName());
    
    return null;
  }
  
  public Object getObjectType()
  {
    return resource;
  }
}

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

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceFactoryImpl;

public class PageflowResourceFactoryImpl
  extends XMLResourceFactoryImpl
{
  public Resource createResource(URI uri)
  {
    Resource result = new PageflowResourceImpl(uri);
    return result;
  }
}

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

import org.eclipse.emf.common.util.URI;
import org.eclipse.emf.ecore.xmi.impl.XMLResourceImpl;

public class PageflowResourceImpl
  extends XMLResourceImpl
{
  public PageflowResourceImpl(URI uri)
  {
    super(uri);
  }
}

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

import java.util.List;
import org.eclipse.emf.ecore.EClass;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLinkBendpoint;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;

public class PageflowSwitch
{
  protected static PageflowPackage modelPackage;
  
  public PageflowSwitch()
  {
    if (modelPackage == null) {
      modelPackage = PageflowPackage.eINSTANCE;
    }
  }
  
  public Object doSwitch(EObject theEObject)
  {
    return doSwitch(theEObject.eClass(), theEObject);
  }
  
  protected Object doSwitch(EClass theEClass, EObject theEObject)
  {
    if (theEClass.eContainer() == modelPackage) {
      return doSwitch(theEClass.getClassifierID(), theEObject);
    }
    List eSuperTypes = theEClass.getESuperTypes();
    return eSuperTypes.isEmpty() ? defaultCase(theEObject) : doSwitch(
      (EClass)eSuperTypes.get(0), theEObject);
  }
  
  protected Object doSwitch(int classifierID, EObject theEObject)
  {
    switch (classifierID)
    {
    case 0: 
      Pageflow pageflow = (Pageflow)theEObject;
      Object result = casePageflow(pageflow);
      if (result == null) {
        result = casePageflowElement(pageflow);
      }
      if (result == null) {
        result = defaultCase(theEObject);
      }
      return result;
    case 2: 
      PageflowLink pfLink = (PageflowLink)theEObject;
      Object result = casePFLink(pfLink);
      if (result == null) {
        result = casePageflowElement(pfLink);
      }
      if (result == null) {
        result = defaultCase(theEObject);
      }
      return result;
    case 5: 
      PageflowPage pfPage = (PageflowPage)theEObject;
      Object result = casePFPage(pfPage);
      if (result == null) {
        result = casePageflowNode(pfPage);
      }
      if (result == null) {
        result = casePageflowElement(pfPage);
      }
      if (result == null) {
        result = defaultCase(theEObject);
      }
      return result;
    case 8: 
      PageflowLinkBendpoint pfLinkBendpoint = (PageflowLinkBendpoint)theEObject;
      Object result = casePFLinkBendpoint(pfLinkBendpoint);
      if (result == null) {
        result = defaultCase(theEObject);
      }
      return result;
    }
    return defaultCase(theEObject);
  }
  
  public Object casePageflow(Pageflow object)
  {
    return null;
  }
  
  public Object casePageflowNode(PageflowNode object)
  {
    return null;
  }
  
  public Object casePFLink(PageflowLink object)
  {
    return null;
  }
  
  public Object casePageflowElement(PageflowElement object)
  {
    return null;
  }
  
  public Object casePFPage(PageflowPage object)
  {
    return null;
  }
  
  public Object casePFLinkBendpoint(PageflowLinkBendpoint object)
  {
    return null;
  }
  
  public Object defaultCase(EObject object)
  {
    return null;
  }
}

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

import org.eclipse.emf.common.util.EList;
import org.eclipse.jst.jsf.facesconfig.emf.DescriptionType;
import org.eclipse.jst.jsf.facesconfig.emf.DisplayNameType;
import org.eclipse.jst.jsf.facesconfig.emf.IconType;
import org.eclipse.jst.jsf.facesconfig.emf.LargeIconType;
import org.eclipse.jst.jsf.facesconfig.emf.NavigationCaseType;
import org.eclipse.jst.jsf.facesconfig.emf.NavigationRuleType;
import org.eclipse.jst.jsf.facesconfig.emf.SmallIconType;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;

public class PageflowTransform
{
  private static PageflowTransform transform;
  
  public static PageflowTransform getInstance()
  {
    if (transform == null) {
      transform = new PageflowTransform();
    }
    return transform;
  }
  
  public void updatePageflowSourcePage(PageflowPage sourcePage, NavigationRuleType navigationRuleFC)
  {
    if ((navigationRuleFC.getDescription() != null) && 
      (navigationRuleFC.getDescription().size() > 0))
    {
      String description = 
        ((DescriptionType)navigationRuleFC.getDescription().get(0)).getTextContent();
      sourcePage.setComment(description);
    }
    if ((navigationRuleFC.getDisplayName() != null) && 
      (navigationRuleFC.getDisplayName().size() > 0))
    {
      String displayName = 
        ((DisplayNameType)navigationRuleFC.getDisplayName().get(0)).getTextContent();
      sourcePage.setName(displayName);
    }
    if ((navigationRuleFC.getIcon() != null) && 
      (navigationRuleFC.getIcon().size() > 0))
    {
      boolean largeUpdated = false;
      boolean smallUpdated = false;
      for (int i = 0; i < navigationRuleFC.getIcon().size(); i++)
      {
        IconType icon = (IconType)navigationRuleFC.getIcon().get(i);
        if ((!largeUpdated) && (icon.getLargeIcon() != null))
        {
          sourcePage.setLargeicon(icon.getLargeIcon()
            .getTextContent());
          largeUpdated = true;
        }
        if ((!smallUpdated) && (icon.getSmallIcon() != null))
        {
          sourcePage.setSmallicon(icon.getSmallIcon()
            .getTextContent());
          smallUpdated = true;
        }
        if ((largeUpdated) && (smallUpdated)) {
          return;
        }
      }
    }
  }
  
  public void updatePageflowTargetPage(PageflowPage targetPage, NavigationCaseType navigationCaseFC)
  {
    if ((navigationCaseFC.getDescription() != null) && 
      (navigationCaseFC.getDescription().size() > 0))
    {
      String description = 
        ((DescriptionType)navigationCaseFC.getDescription().get(0)).getTextContent();
      targetPage.setComment(description);
    }
    if ((navigationCaseFC.getDisplayName() != null) && 
      (navigationCaseFC.getDisplayName().size() > 0))
    {
      String displayName = 
        ((DisplayNameType)navigationCaseFC.getDisplayName().get(0)).getTextContent();
      targetPage.setName(displayName);
    }
    if ((navigationCaseFC.getIcon() != null) && 
      (navigationCaseFC.getIcon().size() > 0))
    {
      boolean largeUpdated = false;
      boolean smallUpdated = false;
      for (int i = 0; i < navigationCaseFC.getIcon().size(); i++)
      {
        IconType icon = (IconType)navigationCaseFC.getIcon().get(0);
        if ((!largeUpdated) && (icon.getLargeIcon() != null))
        {
          targetPage.setLargeicon(icon.getLargeIcon()
            .getTextContent());
          largeUpdated = true;
        }
        if ((!smallUpdated) && (icon.getSmallIcon() != null))
        {
          targetPage.setSmallicon(icon.getSmallIcon()
            .getTextContent());
          smallUpdated = true;
        }
        if ((largeUpdated) && (smallUpdated)) {
          return;
        }
      }
    }
  }
  
  public static void updatePageflowModelInfo(Pageflow newPageflow, Pageflow oldPageflow)
  {
    if ((newPageflow == null) || (oldPageflow == null)) {
      return;
    }
    newPageflow.setName(oldPageflow.getName());
    newPageflow.setComment(oldPageflow.getComment());
    newPageflow.setConfigfile(oldPageflow.getConfigfile());
  }
}

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

import java.util.Iterator;
import org.eclipse.core.resources.IResource;
import org.eclipse.core.resources.IWorkspace;
import org.eclipse.core.resources.IWorkspaceRoot;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
import org.eclipse.emf.common.util.EList;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;
import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil;
import org.eclipse.osgi.util.NLS;

public class PageflowValidation
{
  private static PageflowValidation instance;
  
  public static PageflowValidation getInstance()
  {
    if (instance == null) {
      instance = new PageflowValidation();
    }
    return instance;
  }
  
  public boolean isValidLinkForCreation(PageflowNode source, PageflowNode target)
  {
    if ((source == null) || (target == null)) {
      return false;
    }
    return true;
  }
  
  public boolean isValidLinkForProperty(PageflowLink link)
  {
    return true;
  }
  
  public boolean isValidLinkForNavigationRule(PageflowLink link)
  {
    return true;
  }
  
  public String isValidLink(PageflowLink link)
  {
    String errorMessage = null;
    if (((link.getSource() instanceof PageflowPage)) && 
      ((link.getTarget() instanceof PageflowPage)))
    {
      String outcome = link.getOutcome();
      if ((outcome != null) && (outcome.length() >= 0))
      {
        String webPath = ((PageflowPage)link.getSource()).getPath();
        if (webPath != null)
        {
          String projectPath = WebrootUtil.getProjectPath(link, 
            webPath);
          
          Path resourcePath = new Path(projectPath);
          IWorkspaceRoot workspaceRoot = 
            ResourcesPlugin.getWorkspace().getRoot();
          IResource resource = workspaceRoot
            .findMember(resourcePath);
          if ((resource == null) || (!resource.exists())) {
            errorMessage = 
              NLS.bind(
              PageflowMessages.Pageflow_Validation_UndefinedOutcome, 
              outcome, webPath);
          }
        }
        else
        {
          errorMessage = PageflowMessages.Pageflow_Validation_MissingSourcePage;
        }
      }
    }
    return errorMessage;
  }
  
  public boolean isExistedPage(Pageflow pageflow, PageflowPage page)
  {
    if ((pageflow == null) || (page == null) || (page.getPath() == null)) {
      return false;
    }
    return isExistedPage(pageflow, page.getPath());
  }
  
  public boolean isExistedPage(Pageflow pageflow, String pagePath)
  {
    if ((pageflow == null) || (pagePath == null)) {
      return false;
    }
    Iterator iter = pageflow.getNodes().iterator();
    while (iter.hasNext())
    {
      PageflowNode existedNode = (PageflowNode)iter.next();
      if (((existedNode instanceof PageflowPage)) && 
        (((PageflowPage)existedNode).getPath() != null)) {
        if (((PageflowPage)existedNode).getPath().equalsIgnoreCase(pagePath)) {
          return true;
        }
      }
    }
    return false;
  }
  
  public String getNotifyMessage(PageflowPage page)
  {
    String errorMessage = null;
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    String pagePath = page.getPath();
    if ((pagePath != null) && (pagePath.length() > 0))
    {
      String resourceName = WebrootUtil.getProjectPath(page, pagePath);
      Path resourcePath = new Path(resourceName);
      
      IResource resource = workspaceRoot.findMember(resourcePath);
      if ((resource != null) && (resource.exists()))
      {
        if ((resourcePath.getFileExtension() != null) && 
          (!WebrootUtil.isValidWebFile(resourcePath))) {
          errorMessage = 
            NLS.bind(
            PageflowMessages.Pageflow_Validation_InvalidWebPage, 
            pagePath);
        }
      }
      else {
        errorMessage = NLS.bind(
          PageflowMessages.Pageflow_Validation_NotExitedWebPage, 
          pagePath);
      }
    }
    else
    {
      errorMessage = PageflowMessages.Pageflow_Validation_MissingWebPage;
    }
    return errorMessage;
  }
  
  public static boolean isValidActionEL(String actionEL)
  {
    if ((actionEL != null) && (actionEL.length() > 3)) {
      if (actionEL.substring(0, 2).equalsIgnoreCase("#{")) {
        if (actionEL.substring(actionEL.length() - 1, actionEL.length()).equalsIgnoreCase("}")) {
          return true;
        }
      }
    }
    return false;
  }
  
  public static String getManagedBeanforAction(String actionEL)
  {
    String managedBeanName = null;
    if (isValidActionEL(actionEL))
    {
      actionEL = actionEL.substring(2, actionEL.length() - 1);
      String[] actionParts = actionEL.split("[.]");
      managedBeanName = actionParts[0];
    }
    return managedBeanName;
  }
}

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

import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.RotatableDecoration;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.draw2d.geometry.Transform;
import org.eclipse.jface.resource.FontRegistry;
import org.eclipse.jface.resource.JFaceResources;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.Image;

class BaseFigureDecorator
  extends Label
  implements RotatableDecoration
{
  protected static int DEFAULT_DECORATOR_POSITION = 12;
  private Point location = new Point();
  private Transform transform = new Transform();
  private int position;
  
  public BaseFigureDecorator(Image image)
  {
    position = DEFAULT_DECORATOR_POSITION;
    
    setIcon(image);
    
    setSize(getPreferredSize());
  }
  
  public BaseFigureDecorator(Image image, String tooltip)
  {
    position = DEFAULT_DECORATOR_POSITION;
    
    setIcon(image);
    
    setSize(getPreferredSize());
    
    setToolTip(new Label(tooltip));
  }
  
  public BaseFigureDecorator(Image image, String tooltip, int position)
  {
    this.position = position;
    
    setIcon(image);
    
    setSize(getPreferredSize());
    
    setToolTip(new Label(tooltip));
  }
  
  public Font getFont()
  {
    Font localFont = getLocalFont();
    if (localFont == null)
    {
      localFont = JFaceResources.getFontRegistry().get(
        "org.eclipse.jface.defaultfont");
      
      setFont(localFont);
    }
    return localFont;
  }
  
  public int getPosition()
  {
    return position;
  }
  
  public void setPosition(int position)
  {
    this.position = position;
  }
  
  public void setToolTipText(String tooltip)
  {
    super.setToolTip(new Label(tooltip));
  }
  
  public String getToolTipText()
  {
    Label label = (Label)super.getToolTip();
    
    return label.getText();
  }
  
  public void setLocation(Point p)
  {
    bounds = null;
    
    location.setLocation(p);
    
    transform.setTranslation(x, y);
  }
  
  public Rectangle getBounds()
  {
    if (bounds == null)
    {
      if (prefSize == null) {
        getPreferredSize();
      }
      int w = prefSize.width;
      
      int h = prefSize.height;
      
      Point p = location;
      
      bounds = new Rectangle(x - w / 2, y - h / 2, w, h).getExpanded(
        w, h);
    }
    return bounds;
  }
  
  protected boolean useLocalCoordinates()
  {
    return false;
  }
  
  public void setScale(double x, double y)
  {
    bounds = null;
    
    trans
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