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

iewer.setContents(contents);
    propertyChange(null);
  }
  
  public Object getAdapter(Class type)
  {
    if (type == IContentOutlinePage.class) {
      return getOutlinePage();
    }
    if (type == CommandStack.class) {
      return getCommandStack();
    }
    if (type == ActionRegistry.class) {
      return getActionRegistry();
    }
    if (type == IPropertySheetPage.class) {
      return getPropertySheetPage();
    }
    if (type == ZoomManager.class) {
      return getZoomManager(getGraphicalViewer());
    }
    return super.getAdapter(type);
  }
  
  protected PageflowEditorOutlinePage getOutlinePage()
  {
    PageflowEditorOutlinePage outlinePage = new PageflowEditorOutlinePage(
      this);
    outlinePage.initialize(this);
    return outlinePage;
  }
  
  protected IPropertySheetPage getPropertySheetPage()
  {
    if (undoablePropertySheetPage == null)
    {
      undoablePropertySheetPage = new PropertySheetPage();
      
      undoablePropertySheetPage
        .setRootEntry(new UndoablePropertySheetEntry(
        (CommandStack)getAdapter(CommandStack.class)));
    }
    return undoablePropertySheetPage;
  }
  
  protected SelectionSynchronizer getSelectionSynchronizer()
  {
    if (synchronizer == null) {
      synchronizer = new SelectionSynchronizer();
    }
    return synchronizer;
  }
  
  protected KeyHandler getSharedKeyHandler()
  {
    if (sharedKeyHandler == null)
    {
      sharedKeyHandler = new KeyHandler();
      
      sharedKeyHandler
        .put(KeyStroke.getPressed('', 127, 0), 
        getActionRegistry().getAction(
        ActionFactory.DELETE.getId()));
      sharedKeyHandler.put(KeyStroke.getPressed(16777227, 0), 
        getActionRegistry().getAction(
        "org.eclipse.gef.direct_edit"));
    }
    return sharedKeyHandler;
  }
  
  protected ISelectionListener getSelectionListener()
  {
    return selectionListener;
  }
  
  public void propertyChange(PropertyChangeEvent event)
  {
    String property = event == null ? null : event.getProperty();
    
    propagateProperty(property, viewer.getRootEditPart());
  }
  
  private void propagateProperty(String property, EditPart part)
  {
    processPropertyChange(property, part);
    if ((part instanceof GraphicalEditPart))
    {
      Iterator iterConns = ((GraphicalEditPart)part)
        .getSourceConnections().iterator();
      while (iterConns.hasNext())
      {
        EditPart child = (EditPart)iterConns.next();
        propagateProperty(property, child);
      }
    }
    Iterator iter = part.getChildren().iterator();
    while (iter.hasNext())
    {
      EditPart child = (EditPart)iter.next();
      propagateProperty(property, child);
    }
  }
  
  private void processPropertyChange(String property, EditPart part)
  {
    IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
    if ((property != null) && 
      (property.equals("UseSystemColors"))) {
      property = null;
    }
    if ((property == null) || ("SnapToGrid".equals(property)))
    {
      boolean bSnapToGrid = store.getBoolean("SnapToGrid");
      if ((part instanceof ILayerPanePreference)) {
        ((ILayerPanePreference)part).setGridVisible(bSnapToGrid);
      }
    }
    if ((property == null) || ("GridWidth".equals(property)) || 
      ("GridHeight".equals(property)))
    {
      Dimension gridSpacing = new Dimension(store
        .getInt("GridWidth"), store
        .getInt("GridHeight"));
      if ((part instanceof ILayerPanePreference)) {
        ((ILayerPanePreference)part).setGridSpacing(gridSpacing);
      }
    }
    if ((property == null) || ("GridColor".equals(property)))
    {
      Color gridFgColor = GEMPreferences.getColor(store, 
        "GridColor");
      if ((part instanceof ILayerPanePreference)) {
        ((ILayerPanePreference)part).setGridForegroundColor(gridFgColor);
      }
    }
    if ((property == null) || ("CanvasColor".equals(property)))
    {
      Color containerBgColor = GEMPreferences.getColor(store, 
        "CanvasColor");
      if ((part instanceof IFigurePreference)) {
        ((IFigurePreference)part).setBackgroundColor(containerBgColor);
      }
    }
    if ((property == null) || ("LineWidth".equals(property)))
    {
      int linkLineWidth = store.getInt("LineWidth");
      if ((part instanceof IConnectionPreference)) {
        ((IConnectionPreference)part).setLineWidth(linkLineWidth);
      }
    }
    if ((property == null) || ("LineColor".equals(property)))
    {
      Color linkLineColor = GEMPreferences.getColor(store, 
        "LineColor");
      if ((part instanceof IConnectionPreference)) {
        ((IConnectionPreference)part).setForegroundColor(linkLineColor);
      }
    }
    if ((property == null) || 
      ("ShowLineLabels".equals(property)))
    {
      boolean bLinkLabelVisible = store
        .getBoolean("ShowLineLabels");
      if ((part instanceof IConnectionPreference)) {
        ((IConnectionPreference)part).setLabelVisible(bLinkLabelVisible);
      }
    }
    if ((property == null) || ("LineLabelFont".equals(property)) || 
      ("LineLabelFontColor".equals(property)))
    {
      Font linkLabelFont = getLinkLabelFont();
      Color linkLabelFgColor = GEMPreferences.getColor(store, 
        "LineLabelFontColor");
      if ((part instanceof IConnectionPreference))
      {
        ((IConnectionPreference)part).setFont(linkLabelFont);
        ((IConnectionPreference)part)
          .setLabelForegroundColor(linkLabelFgColor);
      }
    }
    if ((property == null) || 
      ("LineLabelColor".equals(property)))
    {
      Color linkLabelBgColor = GEMPreferences.getColor(store, 
        "LineLabelColor");
      if ((part instanceof IConnectionPreference)) {
        ((IConnectionPreference)part).setLabelBackgroundColor(linkLabelBgColor);
      }
    }
    if ((property == null) || ("LineRouting".equals(property)))
    {
      String connectionStyle = store
        .getString("LineRouting");
      int style;
      int style;
      if ("Manhattan".equals(connectionStyle)) {
        style = 1;
      } else {
        style = 0;
      }
      if ((part instanceof ILayerPanePreference)) {
        ((ILayerPanePreference)part).setConnectionRouterStyle(style);
      } else if ((part instanceof IConnectionPreference)) {
        ((IConnectionPreference)part).setConnectionRouterStyle(style);
      }
    }
    if ((property == null) || 
      ("FigureLabelFont".equals(property)) || 
      ("FigureLabelFontColor".equals(property)))
    {
      Font nodeLabelFont = getNodeLabelFont();
      Color nodeLabelFgColor = GEMPreferences.getColor(store, 
        "FigureLabelFontColor");
      if ((part instanceof INodePreference))
      {
        ((INodePreference)part).setFont(nodeLabelFont);
        ((INodePreference)part).setForegroundColor(nodeLabelFgColor);
      }
    }
    if ((property == null) || ("LabelPlacement".equals(property)))
    {
      int placement = 4;
      String nodeLabelPlacement = store
        .getString("LabelPlacement");
      if ("Top".equals(nodeLabelPlacement)) {
        placement = 1;
      } else if ("Bottom".equals(nodeLabelPlacement)) {
        placement = 4;
      } else if ("Left".equals(nodeLabelPlacement)) {
        placement = 8;
      } else if ("Right".equals(nodeLabelPlacement)) {
        placement = 16;
      }
      if ((part instanceof INodePreference)) {
        ((INodePreference)part).setTextPlacement(placement);
      }
    }
  }
  
  private Font getLinkLabelFont()
  {
    FontRegistry registry = JFaceResources.getFontRegistry();
    IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
    FontData fontData = PreferenceConverter.getFontData(store, 
      "LineLabelFont");
    if (!registry.get(fontData.toString()).equals(registry.defaultFont())) {
      return registry.get(fontData.toString());
    }
    registry.put(fontData.toString(), new FontData[] { fontData });
    return registry.get(fontData.toString());
  }
  
  private Font getNodeLabelFont()
  {
    FontRegistry registry = JFaceResources.getFontRegistry();
    IPreferenceStore store = EditorPlugin.getDefault().getPreferenceStore();
    FontData fontData = PreferenceConverter.getFontData(store, 
      "FigureLabelFont");
    if (!registry.get(fontData.toString()).equals(registry.defaultFont())) {
      return registry.get(fontData.toString());
    }
    registry.put(fontData.toString(), new FontData[] { fontData });
    return registry.get(fontData.toString());
  }
  
  public void gotoMarker(IMarker marker)
  {
    Object id = null;
    try
    {
      id = marker.getAttribute("location");
    }
    catch (CoreException e)
    {
      log.error(
        "Pageflow.PageflowEditor.Error.invalidMarkerAttribute", 
        e);
    }
    if ((id instanceof String))
    {
      GraphicalEditPart part = EditPartMarkerUtil.findEditPart(
        (GraphicalEditPart)getGraphicalViewer().getRootEditPart(), 
        (String)id);
      if (part != null)
      {
        getGraphicalViewer().reveal(part);
        getGraphicalViewer().select(part);
        return;
      }
    }
  }
  
  public void webPageChanged(IPath fullPath)
  {
    PageflowPage page = getPageflowManager().foundPage(
      WebrootUtil.getWebPath(fullPath));
    if ((page != null) && (getGraphicalViewer() != null) && 
      (getGraphicalViewer().getRootEditPart() != null))
    {
      GraphicalEditPart pagePart = EditPartMarkerUtil.findEditPart(
        (GraphicalEditPart)getGraphicalViewer().getRootEditPart(), 
        page.getId());
      
      PageflowAnnotationUtil.validatePage((PageflowNodeEditPart)pagePart);
    }
  }
  
  private ImageDescriptor getImageDescriptorForView(String viewid)
  {
    IConfigurationElement[] elements = Platform.getExtensionRegistry()
      .getConfigurationElementsFor("org.eclipse.ui.views");
    for (int i = 0; i < elements.length; i++)
    {
      String name = elements[i].getName();
      String id = elements[i].getAttribute("id");
      if (("view".equals(name)) && (viewid.equals(id)))
      {
        String iconPath = elements[i].getAttribute("icon");
        if (iconPath != null) {
          return AbstractUIPlugin.imageDescriptorFromPlugin(
            elements[i].getDeclaringExtension().getContributor().getName(), 
            iconPath);
        }
      }
    }
    return null;
  }
}

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

import org.eclipse.gef.ContextMenuProvider;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.ui.actions.ActionRegistry;
import org.eclipse.gef.ui.actions.GEFActionConstants;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IMenuManager;
import org.eclipse.jface.action.MenuManager;
import org.eclipse.ui.actions.ActionFactory;

public class PageflowEditorContextMenuProvider
  extends ContextMenuProvider
{
  private final ActionRegistry actionRegistry;
  
  public PageflowEditorContextMenuProvider(EditPartViewer viewer, ActionRegistry actionRegistry)
  {
    super(viewer);
    
    this.actionRegistry = actionRegistry;
  }
  
  public void buildContextMenu(IMenuManager menuManager)
  {
    GEFActionConstants.addStandardActionGroups(menuManager);
    
    appendActionToUndoGroup(menuManager, ActionFactory.UNDO.getId());
    appendActionToUndoGroup(menuManager, ActionFactory.REDO.getId());
    
    appendActionToEditGroup(menuManager, ActionFactory.COPY.getId());
    appendActionToEditGroup(menuManager, ActionFactory.PASTE.getId());
    appendActionToEditGroup(menuManager, ActionFactory.DELETE.getId());
    
    appendActionToEditGroup(menuManager, "org.eclipse.jst.jsf.facesconfig.ui.FacesConfigEditor");
    
    appendActionToSaveGroup(menuManager, ActionFactory.SAVE.getId());
    
    appendAlignmentSubmenu(menuManager);
    
    appendShowViewSubmenu(menuManager);
  }
  
  private void appendShowViewSubmenu(IMenuManager menuManager)
  {
    MenuManager submenu = new MenuManager(
      PageflowMessages.Pageflow_Contextmenu_ShowView_Label);
    
    IAction action = getActionRegistry().getAction(
      "org.eclipse.jst.jsf.facesconfig.ui.pageflow.action.ShowPropertyViewAction");
    if ((action != null) && (action.isEnabled())) {
      submenu.add(action);
    }
    if (!submenu.isEmpty()) {
      menuManager.appendToGroup("org.eclipse.gef.group.rest", submenu);
    }
  }
  
  private void appendAlignmentSubmenu(IMenuManager menuManager)
  {
    MenuManager submenu = new MenuManager(
      PageflowMessages.Pageflow_Contextmenu_Align_Label);
    
    IAction action = getActionRegistry().getAction(
      "org.eclipse.gef.align_left");
    if ((action != null) && (action.isEnabled())) {
      submenu.add(action);
    }
    action = getActionRegistry().getAction("org.eclipse.gef.align_center");
    if ((action != null) && (action.isEnabled())) {
      submenu.add(action);
    }
    action = getActionRegistry().getAction("org.eclipse.gef.align_right");
    if ((action != null) && (action.isEnabled())) {
      submenu.add(action);
    }
    action = getActionRegistry().getAction("org.eclipse.gef.align_top");
    if ((action != null) && (action.isEnabled())) {
      submenu.add(action);
    }
    action = getActionRegistry().getAction("org.eclipse.gef.align_middle");
    if ((action != null) && (action.isEnabled())) {
      submenu.add(action);
    }
    action = getActionRegistry().getAction("org.eclipse.gef.align_bottom");
    if ((action != null) && (action.isEnabled())) {
      submenu.add(action);
    }
    if (!submenu.isEmpty()) {
      menuManager.appendToGroup("org.eclipse.gef.group.edit", submenu);
    }
  }
  
  protected ActionRegistry getActionRegistry()
  {
    return actionRegistry;
  }
  
  private void appendActionToUndoGroup(IMenuManager menu, String actionId)
  {
    IAction action = getActionRegistry().getAction(actionId);
    if ((action != null) && (action.isEnabled())) {
      menu.appendToGroup("org.eclipse.gef.group.undo", action);
    }
  }
  
  private void appendActionToEditGroup(IMenuManager menu, String actionId)
  {
    IAction action = getActionRegistry().getAction(actionId);
    if ((action != null) && (action.isEnabled())) {
      menu.appendToGroup("org.eclipse.gef.group.edit", action);
    }
  }
  
  private void appendActionToSaveGroup(IMenuManager menu, String actionId)
  {
    IAction action = getActionRegistry().getAction(actionId);
    if ((action != null) && (action.isEnabled())) {
      menu.appendToGroup("org.eclipse.gef.group.save", action);
    }
  }
}

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

import org.eclipse.jface.action.Action;

class PageflowEditorOutlinePage$1
  extends Action
{
  PageflowEditorOutlinePage$1(PageflowEditorOutlinePage paramPageflowEditorOutlinePage) {}
  
  public void run()
  {
    this$0.showPage(PageflowEditorOutlinePage.access$0(this$0));
  }
}

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

import org.eclipse.jface.action.Action;

class PageflowEditorOutlinePage$2
  extends Action
{
  PageflowEditorOutlinePage$2(PageflowEditorOutlinePage paramPageflowEditorOutlinePage) {}
  
  public void run()
  {
    this$0.showPage(PageflowEditorOutlinePage.access$1(this$0));
  }
}

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

import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartListener;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.RootEditPart;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement;

class PageflowEditorOutlinePage$ViewerContentListener
  implements EditPartListener
{
  private EditPartViewer _viewer;
  
  private PageflowEditorOutlinePage$ViewerContentListener(PageflowEditorOutlinePage paramPageflowEditorOutlinePage) {}
  
  public void setViewer(EditPartViewer viewer)
  {
    if (_viewer != null) {
      _viewer.getRootEditPart().removeEditPartListener(this);
    }
    _viewer = viewer;
    if (_viewer != null) {
      _viewer.getRootEditPart().addEditPartListener(this);
    }
  }
  
  public void childAdded(EditPart child, int index)
  {
    if ((child.getModel() instanceof PageflowElement)) {
      this$0.setOutlineContent((PageflowElement)child.getModel());
    }
  }
  
  public void partActivated(EditPart editpart) {}
  
  public void partDeactivated(EditPart editpart) {}
  
  public void removingChild(EditPart child, int index) {}
  
  public void selectedStateChanged(EditPart editpart) {}
}

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

import org.eclipse.draw2d.IFigure;
import org.eclipse.draw2d.LightweightSystem;
import org.eclipse.draw2d.MarginBorder;
import org.eclipse.draw2d.Viewport;
import org.eclipse.draw2d.parts.ScrollableThumbnail;
import org.eclipse.gef.ContextMenuProvider;
import org.eclipse.gef.EditDomain;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartListener;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.GraphicalViewer;
import org.eclipse.gef.KeyHandler;
import org.eclipse.gef.RootEditPart;
import org.eclipse.gef.editparts.ScalableFreeformRootEditPart;
import org.eclipse.gef.editparts.ScalableRootEditPart;
import org.eclipse.gef.ui.parts.SelectionSynchronizer;
import org.eclipse.gef.ui.parts.TreeViewer;
import org.eclipse.jface.action.Action;
import org.eclipse.jface.action.IAction;
import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.editpart.PageflowTreePartFactory;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowElement;
import org.eclipse.swt.widgets.Canvas;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.ui.IActionBars;
import org.eclipse.ui.part.EditorPart;
import org.eclipse.ui.part.IPageSite;
import org.eclipse.ui.part.Page;
import org.eclipse.ui.part.PageBook;
import org.eclipse.ui.views.contentoutline.IContentOutlinePage;

public class PageflowEditorOutlinePage
  extends Page
  implements IContentOutlinePage
{
  private final PageflowEditor editor;
  private PageflowElement outlineContent = null;
  private Canvas overview = null;
  private RootEditPart overviewContent = null;
  private ScrollableThumbnail thumbnail = null;
  private TreeViewer treeViewer = null;
  private Control outline = null;
  private PageBook pageBook = null;
  private IAction showOutlineAction = null;
  private IAction showOverviewAction = null;
  private LightweightSystem lws = null;
  private EditDomain editDomain = null;
  
  public PageflowEditorOutlinePage(EditorPart editor)
  {
    this.editor = ((PageflowEditor)editor);
  }
  
  public void addSelectionChangedListener(ISelectionChangedListener listener)
  {
    getTreeViewer().addSelectionChangedListener(listener);
  }
  
  public void createControl(Composite parent)
  {
    pageBook = new PageBook(parent, 0);
    
    outline = getTreeViewer().createControl(pageBook);
    configureEditPartViewer(getTreeViewer());
    
    overview = new Canvas(pageBook, 0);
    lws = new LightweightSystem(overview);
    
    IToolBarManager tbm = getSite().getActionBars().getToolBarManager();
    showOutlineAction = new Action()
    {
      public void run()
      {
        showPage(outline);
      }
    };
    showOutlineAction.setImageDescriptor(EditorPlugin.getDefault()
      .getImageDescriptor("facesconfig/Pageflow_Outline.gif"));
    tbm.add(showOutlineAction);
    showOverviewAction = new Action()
    {
      public void run()
      {
        showPage(overview);
      }
    };
    showOverviewAction.setImageDescriptor(EditorPlugin.getDefault()
      .getImageDescriptor("facesconfig/Pageflow_Outline_Overview.gif"));
    tbm.add(showOverviewAction);
    
    initializeOutlineViewer();
    
    initializeOverview();
    
    showPage(outline);
  }
  
  private void initializeOutlineViewer()
  {
    if (getEditDomain() != null) {
      getEditDomain().addViewer(getTreeViewer());
    }
    editor.getSelectionSynchronizer().addViewer(getTreeViewer());
    
    getTreeViewer().setContents(getOutlineContent());
  }
  
  protected void showPage(Control id)
  {
    if (id == outline)
    {
      showOutlineAction.setChecked(true);
      showOverviewAction.setChecked(false);
      pageBook.showPage(outline);
      if (thumbnail != null) {
        thumbnail.setVisible(false);
      }
    }
    else if (id == overview)
    {
      showOutlineAction.setChecked(false);
      showOverviewAction.setChecked(true);
      pageBook.showPage(overview);
      if (thumbnail != null) {
        thumbnail.setVisible(true);
      }
    }
  }
  
  public EditDomain getEditDomain()
  {
    return editDomain;
  }
  
  public void dispose()
  {
    editor.getSelectionSynchronizer().removeViewer(getTreeViewer());
    if (thumbnail != null) {
      thumbnail.deactivate();
    }
    super.dispose();
  }
  
  private void initializeOverview()
  {
    if (lws == null) {
      return;
    }
    if (thumbnail != null) {
      thumbnail.deactivate();
    }
    thumbnail = new ScrollableThumbnail();
    thumbnail.setBorder(new MarginBorder(3));
    lws.setContents(thumbnail);
    if (getOverviewContent() != null)
    {
      Viewport viewport = null;
      IFigure source = null;
      if ((getOverviewContent() instanceof ScalableFreeformRootEditPart))
      {
        viewport = (Viewport)((ScalableFreeformRootEditPart)getOverviewContent())
          .getFigure();
        source = ((ScalableFreeformRootEditPart)getOverviewContent())
          .getLayer("Printable Layers");
      }
      if ((getOverviewContent() instanceof ScalableRootEditPart))
      {
        viewport = (Viewport)((ScalableRootEditPart)getOverviewContent())
          .getFigure();
        source = ((ScalableRootEditPart)getOverviewContent())
          .getLayer("Printable Layers");
      }
      if ((viewport != null) && (source != null))
      {
        thumbnail.setViewport(viewport);
        thumbnail.setSource(source);
      }
    }
  }
  
  public PageflowElement getOutlineContent()
  {
    return outlineContent;
  }
  
  public Control getControl()
  {
    return pageBook;
  }
  
  public RootEditPart getOverviewContent()
  {
    return overviewContent;
  }
  
  public ISelection getSelection()
  {
    return getTreeViewer().getSelection();
  }
  
  public TreeViewer getTreeViewer()
  {
    if (treeViewer == null)
    {
      treeViewer = new TreeViewer();
      treeViewer.setEditPartFactory(new PageflowTreePartFactory());
    }
    return treeViewer;
  }
  
  public void removeSelectionChangedListener(ISelectionChangedListener listener)
  {
    getTreeViewer().removeSelectionChangedListener(listener);
  }
  
  public void setOutlineContent(PageflowElement element)
  {
    if (outlineContent != element)
    {
      outlineContent = element;
      if (getTreeViewer().getControl() != null)
      {
        getTreeViewer().setContents(element);
        if (pageBook != null) {
          if (showOverviewAction.isChecked())
          {
            showPage(outline);
            showPage(overview);
          }
          else
          {
            showPage(outline);
          }
        }
      }
    }
  }
  
  public void setFocus()
  {
    if (getControl() != null) {
      getControl().setFocus();
    }
  }
  
  public void setOverviewContent(RootEditPart part)
  {
    if (overviewContent != part)
    {
      overviewContent = part;
      
      initializeOverview();
    }
  }
  
  public void setSelection(ISelection selection)
  {
    getTreeViewer().setSelection(selection);
  }
  
  public void initialize(PageflowEditor newPage)
  {
    if (newPage.getGraphicalViewer() != null)
    {
      setOverviewContent(newPage.getGraphicalViewer().getRootEditPart());
      EditPart currentContent = newPage.getGraphicalViewer()
        .getContents();
      setOutlineContent(currentContent != null ? 
        (PageflowElement)currentContent.getModel() : 
        null);
      setEditDomain(newPage.getEditDomain());
      getViewerContentListener().setViewer(newPage.getGraphicalViewer());
    }
    else
    {
      setOverviewContent(null);
      setOutlineContent(null);
      setEditDomain(null);
    }
  }
  
  public void setEditDomain(EditDomain domain)
  {
    if (editDomain != domain)
    {
      if (getTreeViewer() != null)
      {
        if (editDomain != null) {
          editDomain.removeViewer(getTreeViewer());
        }
        if (domain != null) {
          domain.addViewer(getTreeViewer());
        }
      }
      editDomain = domain;
    }
  }
  
  private final ViewerContentListener viewerContentListener = new ViewerContentListener(null);
  
  private class ViewerContentListener
    implements EditPartListener
  {
    private EditPartViewer _viewer;
    
    private ViewerContentListener() {}
    
    public void setViewer(EditPartViewer viewer)
    {
      if (_viewer != null) {
        _viewer.getRootEditPart().removeEditPartListener(this);
      }
      _viewer = viewer;
      if (_viewer != null) {
        _viewer.getRootEditPart().addEditPartListener(this);
      }
    }
    
    public void childAdded(EditPart child, int index)
    {
      if ((child.getModel() instanceof PageflowElement)) {
        setOutlineContent((PageflowElement)child.getModel());
      }
    }
    
    public void partActivated(EditPart editpart) {}
    
    public void partDeactivated(EditPart editpart) {}
    
    public void removingChild(EditPart child, int index) {}
    
    public void selectedStateChanged(EditPart editpart) {}
  }
  
  private ViewerContentListener getViewerContentListener()
  {
    return viewerContentListener;
  }
  
  protected void configureEditPartViewer(EditPartViewer viewer)
  {
    if (viewer.getKeyHandler() != null) {
      viewer.getKeyHandler().setParent(editor.getSharedKeyHandler());
    }
    ContextMenuProvider provider = new PageflowEditorContextMenuProvider(
      viewer, editor.getActionRegistry());
    viewer.setContextMenu(provider);
    getSite().registerContextMenu(
      EditorPlugin.getPluginId() + 
      ".pageflow.editor.outlineview.contextmenu", provider, 
      getSite().getSelectionProvider());
  }
}

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

import org.eclipse.osgi.util.NLS;

public final class PageflowMessages
  extends NLS
{
  private static final String BUNDLE_NAME = "org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages";
  public static String Pageflow_Label_True;
  public static String Pageflow_Label_False;
  public static String Pageflow_Label_Saving;
  public static String Pageflow_Dialog_Label_CreateFileTitle;
  public static String Pageflow_Dialog_Label_FileNotExistedPart1;
  public static String Pageflow_Dialog_Label_FileNotExistedPart2;
  public static String Pageflow_Action_OpenEditor_Label;
  public static String Pageflow_Action_OpenEditor_ToolTip;
  public static String Pageflow_Action_ShowPropertyView_Label;
  public static String Pageflow_Action_ShowPropertyView_ToolTip;
  public static String Pageflow_Action_ShowPaletteView_Label;
  public static String Pageflow_Action_ShowPaletteView_ToolTip;
  public static String Pageflow_Action_SyncWithFacesConfig_Label;
  public static String Pageflow_Action_SyncWithFacesConfig_ToolTip;
  public static String Pageflow_Action_UpdateFacesConfig_Label;
  public static String Pageflow_Action_UpdateFacesConfig_ToolTip;
  public static String Pageflow_PaletteTool_Group_Controls;
  public static String Pageflow_PaletteTool_Select_Label;
  public static String Pageflow_PaletteTool_Select_Description;
  public static String Pageflow_PaletteTool_Marquee_Label;
  public static String Pageflow_PaletteTool_Marquee_Description;
  public static String Pageflow_PaletteTool_Link_Label;
  public static String Pageflow_PaletteTool_Link_Description;
  public static String Pageflow_PaletteTool_Group_Nodes;
  public static String Pageflow_PaletteTool_Begin_Label;
  public static String Pageflow_PaletteTool_Begin_Description;
  public static String Pageflow_PaletteTool_End_Label;
  public static String Pageflow_PaletteTool_End_Description;
  public static String Pageflow_PaletteTool_Action_Label;
  public static String Pageflow_PaletteTool_Action_Description;
  public static String Pageflow_PaletteTool_Page_Label;
  public static String Pageflow_PaletteTool_Page_Description;
  public static String Pageflow_Contextmenu_Align_Label;
  public static String Pageflow_Contextmenu_ShowView_Label;
  public static String Pageflow_Commands_AddNodeCommand_Label;
  public static String Pageflow_Commands_CreateNodeCommand_Label;
  public static String Pageflow_Commands_DeleteNodeCommand_Label;
  public static String Pageflow_Commands_ConnectionCommand_Label;
  public static String Pageflow_Commands_CreateBendpointCommand_Label;
  public static String Pageflow_Commands_MoveBendpointCommand_Label;
  public static String Pageflow_Commands_DeleteBendpointCommand_Label;
  public static String Pageflow_Commands_OpenEditorCommand_Label;
  public static String Pageflow_Commands_OrphanChildCommand_Label;
  public static String Pageflow_Commands_UpdatePageflowCommand_Label;
  public static String Pageflow_Commands_CreateNodeCommand_SelectJSPDialog_Title;
  public static String Pageflow_Commands_CreateNodeCommand_SelectJSPDialog_Description;
  public static String Pageflow_Model_Attributes_comment;
  public static String Pageflow_Model_Attributes_name;
  public static String Pageflow_Model_Attributes_largeicon;
  public static String Pageflow_Model_Attributes_smallicon;
  public static String Pageflow_Model_Attributes_action;
  public static String Pageflow_Model_Attributes_path;
  public static String Pageflow_Model_Attributes_begin;
  public static String Pageflow_Model_Attributes_end;
  public static String Pageflow_Model_Attributes_configfile;
  public static String Pageflow_Model_Attributes_source;
  public static String Pageflow_Model_Attributes_target;
  public static String Pageflow_Model_Attributes_outcome;
  public static String Pageflow_Model_Attributes_redirect;
  public static String Pageflow_Model_Attributes_fromaction;
  public static String Pageflow_Model_Attributes_referenceLink;
  public static String Pageflow_Model_Items_Pageflow;
  public static String Pageflow_Model_Items_PFPage;
  public static String Pageflow_Model_Items_PFLink;
  public static String Pageflow_Property_Action_OutcomeSelectionDialog_Choice;
  public static String Pageflow_Property_Action_OutcomeSelectionDialog_Title;
  public static String Pageflow_Property_Action_OutcomeSelectionDialog_JSPName;
  public static String Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Title;
  public static String Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTableWithJSP_Title;
  public static String Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Component;
  public static String PageflowLinkPropertySource_Title;
  public static String ProjectWebPageSelectionDialog_Description;
  public static String PageflowLinkPropertySource_Text;
  public static String Pageflow_Property_Action_OutcomeSelectionDialog_ActionListTable_Action;
  public static String Pageflow_Property_Action_OutcomeSelectionDialog_Outcome;
  public static String Pageflow_Validation_UndefinedOutcome;
  public static String Pageflow_Validation_NotExistedSourcePage;
  public static String Pageflow_Validation_MissingSourcePage;
  public static String Pageflow_Validation_InvalidWebPage;
  public static String Pageflow_Validation_NotExitedWebPage;
  public static String Pageflow_Validation_MissingWebPage;
  public static String Pageflow_Validation_MissingManagedBean;
  public static String Pageflow_Validation_MissingAction;
  public static String ExistingPagePathDialogCellEdito_LabelText;
  public static String PageflowLinkEditPart_FromAction;
  public static String PageflowLinkEditPart_FromOutcome;
  public static String PageflowContainerEditPolicy_OrphanLabel;
  public static String PageflowNode_NoRecursiveContainment;
  public static String PageflowXYLayoutEditPolicy_Add;
  public static String SetConstraintCommand_Resize;
  public static String SetConstraintCommand_Location;
  
  static
  {
    NLS.initializeMessages("org.eclipse.jst.jsf.facesconfig.ui.pageflow.PageflowMessages", PageflowMessages.class);
  }
}

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

import org.eclipse.gef.palette.CombinedTemplateCreationEntry;
import org.eclipse.gef.palette.ConnectionCreationToolEntry;
import org.eclipse.gef.palette.MarqueeToolEntry;
import org.eclipse.gef.palette.PaletteDrawer;
import org.eclipse.gef.palette.PaletteGroup;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.PaletteSeparator;
import org.eclipse.gef.palette.SelectionToolEntry;
import org.eclipse.gef.palette.ToolEntry;
import org.eclipse.jst.jsf.facesconfig.ui.EditorPlugin;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowLink;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.model.PageflowPage;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.ModelCreationFactory;

public class PageflowPaletteRoot
  extends PaletteRoot
{
  public PageflowPaletteRoot()
  {
    PaletteGroup controls = new PaletteGroup(
      PageflowMessages.Pageflow_PaletteTool_Group_Controls);
    add(controls);
    
    ToolEntry tool = new SelectionToolEntry(
      PageflowMessages.Pageflow_PaletteTool_Select_Label, 
      PageflowMessages.Pageflow_PaletteTool_Select_Description);
    
    controls.add(tool);
    
    setDefaultEntry(tool);
    
    controls.add(new MarqueeToolEntry(
      PageflowMessages.Pageflow_PaletteTool_Marquee_Label, 
      PageflowMessages.Pageflow_PaletteTool_Marquee_Description));
    
    controls.add(new PaletteSeparator());
    
    ConnectionCreationToolEntry linkEntry = new ConnectionCreationToolEntry(
      PageflowMessages.Pageflow_PaletteTool_Link_Label, 
      PageflowMessages.Pageflow_PaletteTool_Link_Description, 
      new ModelCreationFactory(PageflowLink.class), 
      EditorPlugin.getDefault().getImageDescriptor(
      "facesconfig/Pageflow_Link.gif"), 
      EditorPlugin.getDefault().getImageDescriptor(
      "facesconfig/Pageflow_Link24.gif"));
    linkEntry.setUserModificationPermission(15);
    controls.add(linkEntry);
    
    controls.add(new PaletteSeparator());
    
    PaletteDrawer nodes = new PaletteDrawer(
      PageflowMessages.Pageflow_PaletteTool_Group_Nodes);
    add(nodes);
    
    CombinedTemplateCreationEntry entry = new CombinedTemplateCreationEntry(
      PageflowMessages.Pageflow_PaletteTool_Page_Label, 
      PageflowMessages.Pageflow_PaletteTool_Page_Description, 
      PageflowPage.class, 
      new ModelCreationFactory(PageflowPage.class), 
      EditorPlugin.getDefault().getImageDescriptor(
      "facesconfig/Pageflow_Page16.gif"), 
      EditorPlugin.getDefault().getImageDescriptor(
      "facesconfig/Pageflow_Page24.gif"));
    nodes.add(entry);
  }
}

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

import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.dnd.TemplateTransferDropTargetListener;
import org.eclipse.gef.requests.CreationFactory;
import org.eclipse.jst.jsf.facesconfig.ui.pageflow.util.ModelCreationFactory;

public class PageflowTemplateTransferDropTargetListener
  extends TemplateTransferDropTargetListener
{
  public PageflowTemplateTransferDropTargetListener(EditPartViewer viewer)
  {
    super(viewer);
  }
  
  protected CreationFactory getFactory(Object template)
  {
    if ((template instanceof Class)) {
      return new ModelCreationFactory((Class)template);
    }
    return null;
  }
}

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

import java.util.Map;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
import org.eclipse.gef.EditPart;
import org.eclipse.gef.EditPartViewer;
import org.eclipse.gef.Request;
import org.eclipse.gef.dnd.AbstractTransferDropTargetListener;
import org.eclipse.gef.requests.CreateRequest;
import org.eclipse.gef.requests.CreationFactory;
import org.eclipse.jface.util.LocalSelectionTransfer;
import org.eclipse.jface.viewers.ISelection;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jst.jsf.facesconfig.ui.util.WebrootUtil;
import org.eclipse.swt.dnd.DropTargetEvent;
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.IWorkbenchPage;
import org.eclipse.ui.IWorkbenchWindow;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.part.FileEditorInput;
import org.eclipse.ui.part.ResourceTransfer;

public abstract class ResourceTransferDropTargetListener
  extends AbstractTransferDropTargetListener
{
  private IEditorPart editor = null;
  
  public ResourceTransferDropTargetListener(EditPartViewer viewer, IEditorPart editor)
  {
    super(viewer, ResourceTransfer.getInstance());
    
    this.editor = editor;
  }
  
  protected Request createTargetRequest()
  {
    CreateRequest request = new CreateRequest();
    if (getCurrentEventdata == null)
    {
      request.setFactory(getFactory(null));
    }
    else
    {
      IResource[] resources = (IResource[])getCurrentEventdata;
      request.setFactory(getFactory(resources[0]));
    }
    return request;
  }
  
  protected final CreateRequest getCreateRequest()
  {
    return (CreateRequest)getTargetRequest();
  }
  
  protected abstract CreationFactory getFactory(Object paramObject);
  
  protected void handleDragOperationChanged()
  {
    getCurrentEventdetail = 1;
    super.handleDragOperationChanged();
  }
  
  private Object getCurrentLocalObject()
  {
    ISelection sel = LocalSelectionTransfer.getTransfer().getSelection();
    if ((sel instanceof IStructuredSelection)) {
      return ((IStructuredSelection)sel).getFirstElement();
    }
    return null;
  }
  
  protected void handleDragOver()
  {
    if (!isValidJSFFile(getCurrentLocalObject())) {
      getCurrentEventdetail = 2003;
    } else {
      getCurrentEventdetail = 1;
    }
    getCurrentEventfeedback = 24;
    super.handleDragOver();
  }
  
  protected void handleDrop()
  {
    getCurrentEventdetail = 1;
    super.handleDrop();
    if (getCurrentEventdetail == 1) {
      selectAddedObject();
    }
  }
  
  private void selectAddedObject()
  {
    Object model = getCreateRequest().getNewObject();
    if (model == null) {
      return;
    }
    EditPartViewer viewer = getV
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