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

.add(link);
    }
    sourceConnections.clear();
    for (int i = 0; i < targetConnections.size(); i++)
    {
      PageflowLink link = (PageflowLink)targetConnections.get(i);
      PageflowNode source = (PageflowNode)targetConnectionSources.get(i);
      PageflowNode target = (PageflowNode)targetConnectionTargets.get(i);
      link.setSource(source);
      link.setTarget(target);
      
      parent.getLinks().add(link);
      node.getInlinks().add(link);
      link.getSource().getOutlinks().add(link);
    }
    targetConnections.clear();
  }
  
  public void setChild(PageflowNode c)
  {
    child = c;
  }
  
  public void setParent(Pageflow p)
  {
    parent = p;
  }
}

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

class EMFCommandGEFAdapter
  extends org.eclipse.gef.commands.Command
{
  private org.eclipse.emf.common.command.Command emfCommand;
  
  public EMFCommandGEFAdapter(org.eclipse.emf.common.command.Command emfCommand)
  {
    this.emfCommand = emfCommand;
  }
  
  public boolean canExecute()
  {
    if (emfCommand == null) {
      return false;
    }
    return emfCommand.canExecute();
  }
  
  public boolean canUndo()
  {
    if (emfCommand == null) {
      return false;
    }
    return emfCommand.canUndo();
  }
  
  public void dispose()
  {
    if (emfCommand == null) {
      return;
    }
    emfCommand.dispose();
  }
  
  public void execute()
  {
    if (emfCommand == null) {
      return;
    }
    emfCommand.execute();
  }
  
  public String getLabel()
  {
    if (emfCommand == null) {
      return null;
    }
    return emfCommand.getLabel();
  }
  
  public void redo()
  {
    if (emfCommand == null) {
      return;
    }
    emfCommand.redo();
  }
  
  public void undo()
  {
    if (emfCommand == null) {
      return;
    }
    emfCommand.undo();
  }
  
  org.eclipse.emf.common.command.Command getEMFCommand()
  {
    return emfCommand;
  }
}

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

import java.util.EventObject;
import org.eclipse.emf.common.command.BasicCommandStack;
import org.eclipse.emf.common.command.CommandStackListener;
import org.eclipse.gef.commands.CommandStack;
import org.eclipse.jface.text.IDocument;
import org.eclipse.wst.sse.core.StructuredModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IModelManager;
import org.eclipse.wst.sse.core.internal.provisional.IStructuredModel;
import org.eclipse.wst.sse.core.internal.provisional.text.IStructuredDocument;
import org.eclipse.wst.sse.core.internal.undo.IStructuredTextUndoManager;

public class EMFCommandStackGEFAdapter
  extends CommandStack
  implements CommandStackListener
{
  private BasicCommandStack emfCommandStack;
  private IStructuredModel model;
  
  public EMFCommandStackGEFAdapter(IDocument doc)
  {
    model = StructuredModelManager.getModelManager().getExistingModelForEdit(doc);
    if (model == null) {
      model = StructuredModelManager.getModelManager().getModelForEdit((IStructuredDocument)doc);
    }
    emfCommandStack = ((BasicCommandStack)model.getUndoManager().getCommandStack());
    emfCommandStack.addCommandStackListener(this);
  }
  
  public void dispose()
  {
    model.releaseFromEdit();
    super.dispose();
  }
  
  public boolean canRedo()
  {
    if (emfCommandStack == null) {
      return false;
    }
    return emfCommandStack.canRedo();
  }
  
  public boolean canUndo()
  {
    if (emfCommandStack == null) {
      return false;
    }
    return emfCommandStack.canUndo();
  }
  
  public void execute(org.eclipse.gef.commands.Command command)
  {
    if (!(command instanceof EMFCommandGEFAdapter)) {
      return;
    }
    org.eclipse.emf.common.command.Command emfCommand = ((EMFCommandGEFAdapter)command)
      .getEMFCommand();
    if (emfCommand != null) {
      emfCommandStack.execute(emfCommand);
    }
  }
  
  public void flush()
  {
    if (emfCommandStack == null) {
      return;
    }
    emfCommandStack.flush();
  }
  
  public org.eclipse.gef.commands.Command getRedoCommand()
  {
    if ((emfCommandStack == null) || (emfCommandStack.getRedoCommand() == null)) {
      return null;
    }
    return new EMFCommandGEFAdapter(emfCommandStack.getRedoCommand());
  }
  
  public org.eclipse.gef.commands.Command getUndoCommand()
  {
    if ((emfCommandStack == null) || (emfCommandStack.getUndoCommand() == null)) {
      return null;
    }
    return new EMFCommandGEFAdapter(emfCommandStack.getUndoCommand());
  }
  
  public boolean isDirty()
  {
    if (emfCommandStack == null) {
      return false;
    }
    return emfCommandStack.isSaveNeeded();
  }
  
  public void markSaveLocation()
  {
    if (emfCommandStack == null) {
      return;
    }
    emfCommandStack.saveIsDone();
    super.markSaveLocation();
  }
  
  public void redo()
  {
    if (emfCommandStack == null) {
      return;
    }
    emfCommandStack.redo();
  }
  
  public void undo()
  {
    if (emfCommandStack == null) {
      return;
    }
    emfCommandStack.undo();
  }
  
  public void commandStackChanged(EventObject event)
  {
    notifyListeners();
  }
}

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

abstract interface IPreExecuteCommand
{
  public abstract boolean preExecute();
}

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

import java.util.Map;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EPackage.Registry;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages;
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.PageflowLinkBendpoint;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPackage;

public class MoveBendpointCommand
  extends BendpointCommand
{
  private PageflowLinkBendpoint oldBendpoint;
  
  public MoveBendpointCommand()
  {
    super(PageflowMessages.Pageflow_Commands_MoveBendpointCommand_Label);
  }
  
  public void execute()
  {
    Map registry = EPackage.Registry.INSTANCE;
    String pageflowURI = "http://www.sybase.com/suade/pageflow";
    PageflowPackage pageflowPackage = 
      (PageflowPackage)registry.get(pageflowURI);
    PageflowFactory factory = pageflowPackage.getPageflowFactory();
    PageflowLinkBendpoint _newBendpoint = factory.createPFLinkBendpoint();
    
    _newBendpoint.setRelativeDimensions(getFirstRelativeDimension(), 
      getSecondRelativeDimension());
    setOldBendpoint((PageflowLinkBendpoint)getPFLink().getBendPoints().get(
      getIndex()));
    
    getPFLink().setBendpoint(getIndex(), _newBendpoint);
    super.execute();
  }
  
  protected PageflowLinkBendpoint getOldBendpoint()
  {
    return oldBendpoint;
  }
  
  public void setOldBendpoint(PageflowLinkBendpoint bp)
  {
    oldBendpoint = bp;
  }
  
  public void undo()
  {
    super.undo();
    getPFLink().setBendpoint(getIndex(), getOldBendpoint());
  }
}

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

import org.eclipse.core.resources.IFile;
import org.eclipse.jst.jsf.common.ui.internal.guiutils.Alerts;
import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;

class OpenEditorCommand$1
  implements Runnable
{
  OpenEditorCommand$1(OpenEditorCommand paramOpenEditorCommand, IFile paramIFile) {}
  
  public void run()
  {
    IDE.setDefaultEditor(val$file, null);
    try
    {
      IWorkbenchPage page = PlatformUI.getWorkbench()
        .getActiveWorkbenchWindow().getActivePage();
      IEditorDescriptor desc = IDE.getEditorDescriptor(val$file);
      page.openEditor(new FileEditorInput(val$file), 
        desc.getId(), true, 3);
    }
    catch (PartInitException e)
    {
      OpenEditorCommand.access$0().error(
        "Pageflow.PageflowEditor.Error.canNotOpenEditor4JSF", 
        e);
      
      EditorPlugin.getAlerts()
        .error(
        "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle", 
        "Pageflow.PageflowEditor.Error.CanNotOpenEditor4JSF");
    }
  }
}

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

import org.eclipse.core.resources.IFile;
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.ecore.EObject;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.commands.Command;
import org.eclipse.jst.jsf.common.ui.internal.guiutils.Alerts;
import org.eclipse.jst.jsf.common.ui.internal.logging.Logger;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.jst.jsf.facesconfig.ui.FacesConfigEditor;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;
import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.ui.IEditorDescriptor;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.ide.IDE;
import org.eclipse.ui.part.FileEditorInput;

public class OpenEditorCommand
  extends Command
{
  private EditPart part;
  private static final Logger log = EditorPlugin.getLogger(FacesConfigEditor.class);
  
  public boolean canExecute()
  {
    return true;
  }
  
  public OpenEditorCommand(EditPart part)
  {
    super(PageflowMessages.Pageflow_Commands_OpenEditorCommand_Label);
    this.part = part;
  }
  
  private void executeOpenPFPage()
  {
    IWorkspaceRoot workspaceRoot = ResourcesPlugin.getWorkspace().getRoot();
    String pagePath = ((PageflowPage)part.getModel()).getPath();
    if ((pagePath != null) && (pagePath.length() > 0))
    {
      String resourceName = WebrootUtil.getProjectPath((EObject)part
        .getModel(), pagePath);
      Path resourcePath = new Path(resourceName);
      if (resourcePath.getFileExtension() != null)
      {
        IFile file = (IFile)workspaceRoot
          .findMember(resourcePath);
        openExistingJSFFile(file);
      }
      else
      {
        EditorPlugin.getAlerts().error(
          "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle", 
          "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFFolderInfo");
      }
    }
    else
    {
      EditorPlugin.getAlerts().error(
        "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle", 
        "Pageflow.PageflowEditor.Alert.confirmCreateNewJSFFile");
    }
  }
  
  private void openExistingJSFFile(final IFile file)
  {
    if ((file != null) && (file.exists()))
    {
      Display display = PlatformUI.getWorkbench()
        .getActiveWorkbenchWindow().getShell().getDisplay();
      display.asyncExec(new Runnable()
      {
        public void run()
        {
          IDE.setDefaultEditor(file, null);
          try
          {
            IWorkbenchPage page = PlatformUI.getWorkbench()
              .getActiveWorkbenchWindow().getActivePage();
            IEditorDescriptor desc = IDE.getEditorDescriptor(file);
            page.openEditor(new FileEditorInput(file), 
              desc.getId(), true, 3);
          }
          catch (PartInitException e)
          {
            OpenEditorCommand.log.error(
              "Pageflow.PageflowEditor.Error.canNotOpenEditor4JSF", 
              e);
            
            EditorPlugin.getAlerts()
              .error(
              "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle", 
              "Pageflow.PageflowEditor.Error.CanNotOpenEditor4JSF");
          }
        }
      });
    }
    else
    {
      String pagePath = ((PageflowPage)part.getModel()).getPath();
      
      EditorPlugin.getAlerts().error(
        "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFTitle", 
        "Pageflow.PageflowEditor.Alert.errorOpenEditor4JSFInfo", 
        pagePath);
    }
  }
  
  public void execute()
  {
    if ((part.getModel() instanceof PageflowPage)) {
      executeOpenPFPage();
    }
  }
}

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

import java.util.List;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.emf.common.util.EList;
import org.eclipse.gef.commands.Command;
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.PageflowNode;

public class OrphanChildCommand
  extends Command
{
  private Point oldLocation;
  private Pageflow pageflow;
  private PageflowNode child;
  private int index;
  
  public OrphanChildCommand()
  {
    super(PageflowMessages.Pageflow_Commands_OrphanChildCommand_Label);
  }
  
  public void execute()
  {
    List children = pageflow.getNodes();
    index = children.indexOf(child);
    oldLocation = new Point(child.getX(), child.getY());
    pageflow.getNodes().remove(child);
  }
  
  public void redo()
  {
    pageflow.getNodes().remove(child);
  }
  
  public void undo()
  {
    child.setX(oldLocation.x);
    child.setY(oldLocation.y);
    pageflow.getNodes().add(index, child);
  }
  
  public void setChild(PageflowNode child)
  {
    this.child = child;
  }
  
  public void setParent(Pageflow parent)
  {
    pageflow = parent;
  }
}

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

import org.eclipse.gef.commands.Command;
import org.eclipse.gef.commands.CommandStack;

public class PreExecuteCommandStack
  extends CommandStack
{
  public void execute(Command command)
  {
    if ((command == null) || (!command.canExecute())) {
      return;
    }
    if (((command instanceof IPreExecuteCommand)) && 
      (!((IPreExecuteCommand)command).preExecute())) {
      return;
    }
    super.execute(command);
  }
}

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

import org.eclipse.emf.common.util.EList;
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.util.PageflowValidation;

public class ReconnectConnectionCommand
  extends ConnectionCommand
{
  public boolean canExecute()
  {
    if ((link == null) || (link.eContainer() == null)) {
      return false;
    }
    if ((oldSource != null) && (source != null) && (oldTarget != null) && 
      (target != null) && 
      (!PageflowValidation.getInstance().isValidLinkForCreation(
      source, target))) {
      return false;
    }
    if ((oldSource != null) && (source != null) && 
      (!PageflowValidation.getInstance().isValidLinkForCreation(
      source, oldTarget))) {
      return false;
    }
    if ((oldTarget != null) && (target != null) && 
      (!PageflowValidation.getInstance().isValidLinkForCreation(
      oldSource, target))) {
      return false;
    }
    return true;
  }
  
  public void doExecute()
  {
    String outcome = null;String action = null;String largeIcon = null;String smallIcon = null;
    boolean isRedirect = false;
    outcome = link.getOutcome();
    action = link.getFromaction();
    isRedirect = link.isRedirect();
    largeIcon = link.getLargeicon();
    smallIcon = link.getSmallicon();
    if ((oldSource != null) && (source != null)) {
      link.setSource(source);
    }
    if ((oldTarget != null) && (target != null)) {
      link.setTarget(target);
    }
    link.setOutcome(outcome);
    link.setFromaction(action);
    link.setLargeicon(largeIcon);
    link.setSmallicon(smallIcon);
    link.setRedirect(isRedirect);
  }
  
  public void undo()
  {
    if (canExecute())
    {
      if ((oldSource != null) && (source != null))
      {
        if (link.getSource() != null) {
          link.getSource().getOutlinks().remove(link);
        }
        source.getOutlinks().remove(link);
        link.setSource(oldSource);
      }
      if ((oldTarget != null) && (target != null))
      {
        if (link.getTarget() != null) {
          link.getTarget().getInlinks().remove(link);
        }
        target.getInlinks().remove(link);
        link.setTarget(oldTarget);
      }
    }
  }
}

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

import org.eclipse.gef.commands.Command;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowNode;

public class RenameNodeCommand
  extends Command
{
  private PageflowNode node;
  private String name;
  private String oldName;
  
  public void execute()
  {
    node.setName(name);
  }
  
  public void setName(String string)
  {
    name = string;
  }
  
  public void setOldName(String string)
  {
    oldName = string;
  }
  
  public void setSource(PageflowNode node)
  {
    this.node = node;
  }
  
  public void undo()
  {
    node.setName(oldName);
  }
}

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

import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.draw2d.geometry.Point;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.commands.Command;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement;

public class SetConstraintCommand
  extends Command
{
  private static final String COMMAND_LABEL_LOCATION = PageflowMessages.SetConstraintCommand_Location;
  private static final String COMMAND_LABEL_RESIZE = PageflowMessages.SetConstraintCommand_Resize;
  private Point newPos;
  private Dimension newSize;
  private Point oldPos;
  private Dimension oldSize;
  private PageflowElement part;
  
  public void execute()
  {
    oldSize = new Dimension(part.getWidth(), part.getHeight());
    oldPos = new Point(part.getX(), part.getY());
    part.setX(newPos.x);
    part.setY(newPos.y);
    part.setHeight(newSize.height);
    part.setWidth(newSize.width);
  }
  
  public void redo()
  {
    part.setX(newPos.x);
    part.setY(newPos.y);
    part.setHeight(newSize.height);
    part.setWidth(newSize.width);
  }
  
  public void undo()
  {
    part.setX(oldPos.x);
    part.setY(oldPos.y);
    part.setHeight(oldSize.height);
    part.setWidth(oldSize.width);
  }
  
  public String getLabel()
  {
    if (oldSize.equals(newSize)) {
      return COMMAND_LABEL_LOCATION;
    }
    return COMMAND_LABEL_RESIZE;
  }
  
  public void setLocation(Rectangle r)
  {
    setLocation(r.getLocation());
    setSize(r.getSize());
  }
  
  public void setLocation(Point p)
  {
    newPos = p;
  }
  
  public void setPart(PageflowElement part)
  {
    this.part = part;
  }
  
  public void setSize(Dimension p)
  {
    newSize = p;
  }
}

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

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.SimpleLoweredBorder;
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;

public class ConfigurableRootEditPart
  extends ScalableFreeformRootEditPart
  implements IFigurePreference
{
  protected IFigure createFigure()
  {
    IFigure fig = super.createFigure();
    fig.setOpaque(true);
    fig.setBorder(new SimpleLoweredBorder());
    return fig;
  }
  
  public void setForegroundColor(Color c)
  {
    getFigure().setForegroundColor(c);
  }
  
  public void setBackgroundColor(Color c)
  {
    getFigure().setBackgroundColor(c);
  }
  
  public void setFont(Font f)
  {
    getFigure().setFont(f);
  }
}

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

import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Rectangle;
import org.eclipse.gef.tools.CellEditorLocator;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Text;

class DirectEditCellEditorLocator
  implements CellEditorLocator
{
  private Label label;
  
  public DirectEditCellEditorLocator(Label label)
  {
    setLabel(label);
  }
  
  public void relocate(CellEditor celleditor)
  {
    Text text = (Text)celleditor.getControl();
    Point pref = text.computeSize(-1, -1);
    
    Rectangle rect = label.getTextBounds().getCopy();
    label.translateToAbsolute(rect);
    int width;
    int width;
    if (x > width) {
      width = x;
    } else {
      width = width;
    }
    int height;
    int height;
    if (y > height) {
      height = y;
    } else {
      height = height;
    }
    text.setBounds(x - 1, y - 1, width + 1, height + 1);
  }
  
  protected Label getLabel()
  {
    return label;
  }
  
  protected void setLabel(Label label)
  {
    this.label = label;
  }
}

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

import org.eclipse.core.resources.IResource;
import org.eclipse.jface.text.source.Annotation;

public abstract interface IAnnotationEditPart
{
  public abstract void addAnnotation(Annotation paramAnnotation);
  
  public abstract void removeAnnotation();
  
  public abstract IResource getMarkerResource();
}

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

import org.eclipse.swt.graphics.Color;

public abstract interface IConnectionPreference
  extends IFigurePreference
{
  public abstract void setLineWidth(int paramInt);
  
  public abstract void setLabelVisible(boolean paramBoolean);
  
  public abstract void setLabelForegroundColor(Color paramColor);
  
  public abstract void setLabelBackgroundColor(Color paramColor);
  
  public abstract void setConnectionRouterStyle(int paramInt);
}

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

import org.eclipse.swt.graphics.Color;
import org.eclipse.swt.graphics.Font;

public abstract interface IFigurePreference
{
  public abstract void setForegroundColor(Color paramColor);
  
  public abstract void setBackgroundColor(Color paramColor);
  
  public abstract void setFont(Font paramFont);
}

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

import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.swt.graphics.Color;

public abstract interface ILayerPanePreference
  extends IFigurePreference
{
  public static final int LINE_ROUTING_MANUAL = 0;
  public static final int LINE_ROUTING_MANHATTAN = 1;
  
  public abstract void setGridVisible(boolean paramBoolean);
  
  public abstract void setGridSpacing(Dimension paramDimension);
  
  public abstract void setGridForegroundColor(Color paramColor);
  
  public abstract void setConnectionRouterStyle(int paramInt);
}

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

public abstract interface INodePreference
  extends IFigurePreference
{
  public abstract void setTextPlacement(int paramInt);
}

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

public abstract interface PFValidator
{
  public abstract void validate();
}

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

import org.eclipse.emf.common.notify.Notification;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.PFBatchAdapter;

class PageflowContainerEditPart$1
  extends PFBatchAdapter
{
  PageflowContainerEditPart$1(PageflowContainerEditPart paramPageflowContainerEditPart) {}
  
  public void doNotifyChanged(Notification notification)
  {
    int type = notification.getEventType();
    switch (type)
    {
    case 3: 
    case 4: 
    case 5: 
    case 6: 
      PageflowContainerEditPart.access$0(this$0);
      break;
    case 1: 
      PageflowContainerEditPart.access$1(this$0);
    }
    super.notifyChanged(notification);
  }
}

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

class PageflowContainerEditPart$2
  implements Runnable
{
  PageflowContainerEditPart$2(PageflowContainerEditPart paramPageflowContainerEditPart) {}
  
  public void run()
  {
    PageflowContainerEditPart.access$2(this$0);
  }
}

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

class PageflowContainerEditPart$3
  implements Runnable
{
  PageflowContainerEditPart$3(PageflowContainerEditPart paramPageflowContainerEditPart) {}
  
  public void run()
  {
    this$0.refreshVisuals();
  }
}

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

import org.eclipse.draw2d.IFigure;
import org.eclipse.emf.common.notify.Adapter;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PageflowContainerEditPolicy;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpolicy.PageflowXYLayoutEditPolicy;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.PFBatchAdapter;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

abstract class PageflowContainerEditPart
  extends PageflowElementEditPart
{
  public PageflowContainerEditPart(PageflowElement element)
  {
    super(element);
  }
  
  protected IFigure createFigure()
  {
    return null;
  }
  
  protected void createEditPolicies()
  {
    installEditPolicy("ContainerEditPolicy", 
      new PageflowContainerEditPolicy());
    installEditPolicy("LayoutEditPolicy", 
      new PageflowXYLayoutEditPolicy());
  }
  
  public Adapter createEMFAdapter()
  {
    new PFBatchAdapter()
    {
      public void doNotifyChanged(Notification notification)
      {
        int type = notification.getEventType();
        switch (type)
        {
        case 3: 
        case 4: 
        case 5: 
        case 6: 
          PageflowContainerEditPart.this.refreshChildrenOnUIThread();
          break;
        case 1: 
          PageflowContainerEditPart.this.refreshVisualsOnUIThread();
        }
        super.notifyChanged(notification);
      }
    };
  }
  
  private void refreshChildrenOnUIThread()
  {
    if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) {
      refreshChildren();
    } else {
      PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
      {
        public void run()
        {
          refreshChildren();
        }
      });
    }
  }
  
  private void refreshVisualsOnUIThread()
  {
    if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) {
      refreshVisuals();
    } else {
      PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
      {
        public void run()
        {
          refreshVisuals();
        }
      });
    }
  }
}

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

import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;

class PageflowDirectEditManager$1
  implements VerifyListener
{
  PageflowDirectEditManager$1(PageflowDirectEditManager paramPageflowDirectEditManager) {}
  
  public void verifyText(VerifyEvent event)
  {
    Text text_ = (Text)PageflowDirectEditManager.access$0(this$0).getControl();
    String oldText = text_.getText();
    
    String leftText = oldText.substring(0, start);
    
    String rightText = oldText.substring(end, oldText
      .length());
    
    GC gc = new GC(text_);
    Point size = gc.textExtent(leftText + text + rightText);
    gc.dispose();
    if (x != 0) {
      size = text_.computeSize(x, -1);
    }
    PageflowDirectEditManager.access$0(this$0).getControl().setSize(x, y);
  }
}

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

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.Label;
import org.eclipse.draw2d.geometry.Dimension;
import org.eclipse.gef.GraphicalEditPart;
import org.eclipse.gef.tools.CellEditorLocator;
import org.eclipse.gef.tools.DirectEditManager;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.swt.events.VerifyEvent;
import org.eclipse.swt.events.VerifyListener;
import org.eclipse.swt.graphics.Font;
import org.eclipse.swt.graphics.FontData;
import org.eclipse.swt.graphics.GC;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Text;

final class PageflowDirectEditManager
  extends DirectEditManager
{
  private Font scaledFont;
  private VerifyListener verifyListener;
  private final Label label;
  
  public PageflowDirectEditManager(GraphicalEditPart source, Class editorType, CellEditorLocator locator, Label label)
  {
    super(source, editorType, locator);
    this.label = label;
  }
  
  protected void bringDown()
  {
    Font disposeFont = scaledFont;
    scaledFont = null;
    super.bringDown();
    if ((disposeFont != null) && (!disposeFont.isDisposed())) {
      disposeFont.dispose();
    }
  }
  
  protected void initCellEditor()
  {
    Text text = (Text)getCellEditor().getControl();
    verifyListener = new VerifyListener()
    {
      public void verifyText(VerifyEvent event)
      {
        Text text_ = (Text)getCellEditor().getControl();
        String oldText = text_.getText();
        
        String leftText = oldText.substring(0, start);
        
        String rightText = oldText.substring(end, oldText
          .length());
        
        GC gc = new GC(text_);
        Point size = gc.textExtent(leftText + text + rightText);
        gc.dispose();
        if (x != 0) {
          size = text_.computeSize(x, -1);
        }
        getCellEditor().getControl().setSize(x, y);
      }
    };
    text.addVerifyListener(verifyListener);
    
    String initialLabelText = label.getText();
    getCellEditor().setValue(initialLabelText);
    IFigure figure = getEditPart().getFigure();
    Font figureFont = figure.getFont();
    
    FontData data = figureFont.getFontData()[0];
    Dimension fontSize = new Dimension(0, data.getHeight());
    label.translateToAbsolute(fontSize);
    data.setHeight(height);
    if ((scaledFont != null) && (!scaledFont.isDisposed())) {
      scaledFont.dispose();
    }
    scaledFont = new Font(figureFont.getDevice(), data);
    
    text.setFont(scaledFont);
    text.selectAll();
  }
  
  protected void unhookListeners()
  {
    super.unhookListeners();
    Text text = (Text)getCellEditor().getControl();
    text.removeVerifyListener(verifyListener);
    verifyListener = null;
  }
}

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

class PageflowEditPart$1$1
  implements Runnable
{
  PageflowEditPart$1$1(PageflowEditPart.1 param1) {}
  
  public void run()
  {
    PageflowEditPart.1.access$0(this$1).refreshChildren();
  }
}

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

class PageflowEditPart$1$2
  implements Runnable
{
  PageflowEditPart$1$2(PageflowEditPart.1 param1) {}
  
  public void run()
  {
    PageflowEditPart.1.access$0(this$1).refreshChildren();
    PageflowEditPart.1.access$0(this$1).refreshVisuals();
  }
}

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

class PageflowEditPart$1$3
  implements Runnable
{
  PageflowEditPart$1$3(PageflowEditPart.1 param1) {}
  
  public void run()
  {
    PageflowEditPart.1.access$0(this$1).refreshChildren();
    PageflowEditPart.1.access$0(this$1).refreshVisuals();
  }
}

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

import java.util.List;
import org.eclipse.emf.common.notify.Notification;
import org.eclipse.emf.common.util.TreeIterator;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.Pageflow;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.synchronization.PFBatchAdapter;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;

class PageflowEditPart$1
  extends PFBatchAdapter
{
  PageflowEditPart$1(PageflowEditPart paramPageflowEditPart) {}
  
  public void doNotifyChanged(Notification notification)
  {
    int type = notification.getEventType();
    switch (type)
    {
    case 3: 
    case 4: 
    case 5: 
    case 6: 
      if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread()) {
        this$0.refreshChildren();
      } else {
        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
        {
          public void run()
          {
            this$0.refreshChildren();
          }
        });
      }
      break;
    case 1: 
      if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread())
      {
        this$0.refreshChildren();
        this$0.refreshVisuals();
      }
      else
      {
        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
        {
          public void run()
          {
            this$0.refreshChildren();
            this$0.refreshVisuals();
          }
        });
      }
      break;
    case 12: 
      restore((Pageflow)this$0.getModel());
      if (Thread.currentThread() == PlatformUI.getWorkbench().getDisplay().getThread())
      {
        this$0.refreshChildren();
        this$0.refreshVisuals();
      }
      else
      {
        PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable()
        {
          public void run()
          {
            this$0.refreshChildren();
            this$0.refreshVisuals();
          }
        });
      }
      break;
    case 11: 
      postPone((Pageflow)this$0.getModel());
    }
  }
  
  protected void restore(Pageflow pageflow)
  {
    TreeIterator nodes = pageflow.eAllContents();
    while (nodes.hasNext()) {
      setPostpone((EObject)nodes.next(), false);
    }
    setPostpone(pageflow, false);
  }
  
  void setPostpone(EObject node, boolean enable)
  {
    List adapters = node.eAdapters();
    for (int i = 0; i < adapters.size(); i++) {
      if ((adapters.get(i) instanceof PFBatchAdapter)) {
        ((PFBatchAdapter)adapters.get(i)).setNeedPostpone(enable);
      }
    }
  }
  
  protected void postPone(Pageflow pageflow)
  {
    TreeIterator nodes = pageflow.eAllContents();
    while (nodes.hasNext()) {
      setPostpone((EObject)nodes.next(), true);
    }
    setPostpone(pageflow, true);
  }
}

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

import java.util.ArrayList;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import org.eclipse.draw2d.BendpointConnectionRouter;
import org.eclipse.draw2d.ConnectionLayer;
import org.eclipse.draw2d.Fan
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