Skip to main content
summaryrefslogtreecommitdiffstats
blob: e94aecff56fd52c417f34e40c3507d58461f1bd8 (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
58
/*******************************************************************************
 * Copyright (c) 2004, 2008 Donald G. Dunne 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:
�*����Donald G. Dunne - initial API and implementation
�*******************************************************************************/
package org.eclipse.osee.ats.workdef.viewer;

import org.eclipse.gef.palette.MarqueeToolEntry;
import org.eclipse.gef.palette.PaletteContainer;
import org.eclipse.gef.palette.PaletteRoot;
import org.eclipse.gef.palette.PaletteToolbar;
import org.eclipse.gef.palette.PanningSelectionToolEntry;
import org.eclipse.gef.palette.ToolEntry;

/**
 * Utility class that can create a GEF Palette.
 *
 * @see #createPalette()
 * @author Donald G. Dunne
 */
final class AtsWorkDefConfigEditorPaletteFactory {

   /**
    * Creates the PaletteRoot and adds all palette elements. Use this factory method to create a new palette for your
    * graphical editor.
    *
    * @return a new PaletteRoot
    */
   static PaletteRoot createPalette(AtsWorkDefConfigEditor editor) {
      PaletteRoot palette = new PaletteRoot();
      palette.add(createToolsGroup(palette, editor));
      return palette;
   }

   /** Create the "Tools" group. */
   private static PaletteContainer createToolsGroup(PaletteRoot palette, AtsWorkDefConfigEditor editor) {
      PaletteToolbar toolbar = new PaletteToolbar("Tools");

      // Add a selection tool to the group
      ToolEntry tool = new PanningSelectionToolEntry();
      toolbar.add(tool);
      palette.setDefaultEntry(tool);

      // Add a marquee tool to the group
      toolbar.add(new MarqueeToolEntry());
      return toolbar;
   }

   private AtsWorkDefConfigEditorPaletteFactory() {
      // Utility class
   }

}

Back to the top