Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 5a1e580b1c6d339de12d09d4f0b4f2f7ddfe178b (plain) (blame)
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
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * Copyright (c) 2011, 2012 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.emf.cdo.dawn.gmf.stylizer;

import org.eclipse.emf.cdo.dawn.appearance.DawnElementStylizer;
import org.eclipse.emf.cdo.dawn.appearance.IDawnElementStylizerFactory;
import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicConnectionEditPartStylizerImpl;
import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicGraphicalEditPartStylizerImpl;
import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicNodeEditPartStylizerImpl;
import org.eclipse.emf.cdo.dawn.gmf.appearance.impl.DawnBasicTextAwareEditPartStylizerImpl;

import org.eclipse.gef.ConnectionEditPart;
import org.eclipse.gef.NodeEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.DiagramEditPart;
import org.eclipse.gmf.runtime.diagram.ui.editparts.ITextAwareEditPart;

/**
 * @author Martin Fluegge
 */
public class DawnGMFElementStylizerFactory implements IDawnElementStylizerFactory
{
  public DawnElementStylizer getElementStylizer(Object object)
  {
    DawnElementStylizer stylizer = null;
    if (object instanceof ConnectionEditPart)
    {
      stylizer = new DawnBasicConnectionEditPartStylizerImpl();
    }
    else if (object instanceof NodeEditPart)
    {
      stylizer = new DawnBasicNodeEditPartStylizerImpl();
    }
    else if (object instanceof DiagramEditPart)
    {
      stylizer = new DawnBasicNodeEditPartStylizerImpl();
    }
    else if (object instanceof ITextAwareEditPart)
    {
      stylizer = new DawnBasicTextAwareEditPartStylizerImpl();
    }
    else
    {
      // In the case that there is no match we use a simple border styled stylizer.
      stylizer = new DawnBasicGraphicalEditPartStylizerImpl();
    }

    return stylizer;
  }
}

Back to the top