Skip to main content
summaryrefslogtreecommitdiffstats
blob: 64d12b8d702e6effacf5c0c905ff2d4651f0e87a (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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
/*******************************************************************************
 * Copyright (c) 2004, 2007 Boeing.
 * 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:
 *     Boeing - initial API and implementation
 *******************************************************************************/
package org.eclipse.osee.framework.ui.service.control.view;

import org.apache.commons.lang.StringUtils;
import org.eclipse.osee.framework.plugin.core.IActionable;
import org.eclipse.osee.framework.plugin.core.config.JiniLookupGroupConfig;
import org.eclipse.osee.framework.ui.plugin.OseeUiActions;
import org.eclipse.osee.framework.ui.service.control.ControlPlugin;
import org.eclipse.osee.framework.ui.service.control.actions.HideLookupsAction;
import org.eclipse.osee.framework.ui.service.control.actions.KillServiceAction;
import org.eclipse.osee.framework.ui.service.control.actions.OpenLaunchWizard;
import org.eclipse.osee.framework.ui.service.control.actions.RefreshDataStore;
import org.eclipse.osee.framework.ui.service.control.menu.MenuBuilder;
import org.eclipse.osee.framework.ui.service.control.widgets.ManagerMain;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.part.ViewPart;

/**
 * @author Roberto E. Escobar
 */
public class ServiceManagerView extends ViewPart implements IActionable {

   public static final String VIEW_ID = "org.eclipse.osee.framework.ui.service.control.view.ServiceManagerView";
   private ManagerMain managerMain;

   @Override
   public void createPartControl(Composite parent) {
      Composite composite = new Composite(parent, SWT.NONE);
      composite.setLayout(new GridLayout());
      composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));

      managerMain = new ManagerMain(composite, SWT.NONE);

      createServicesViewerPopUp();
      createLookupViewerPopUp();

      this.setContentDescription("Jini Groups { " + StringUtils.join(JiniLookupGroupConfig.getOseeJiniServiceGroups(),
         ",") + " }");

      OseeUiActions.addBugToViewToolbar(this, this, ControlPlugin.getInstance(), VIEW_ID, "Service Manager");
   }

   private void createServicesViewerPopUp() {
      MenuBuilder menuBuilder = new MenuBuilder(this);
      menuBuilder.addAction(new OpenLaunchWizard(managerMain));
      menuBuilder.addAction(new RefreshDataStore(managerMain));
      menuBuilder.addAction(new KillServiceAction(managerMain));
      menuBuilder.contributeToActionBars();
      menuBuilder.createPopUpMenu(managerMain.getServicesViewer().getViewer());
   }

   private void createLookupViewerPopUp() {
      MenuBuilder menuBuilder = new MenuBuilder(this);
      menuBuilder.addAction(new HideLookupsAction(managerMain));
      menuBuilder.addAction(new RefreshDataStore(managerMain));
      menuBuilder.createPopUpMenu(managerMain.getLookupViewer().getViewer());
   }

   @Override
   public String getActionDescription() {
      return "";
   }

   @Override
   public void dispose() {
      super.dispose();
      if (managerMain != null) {
         managerMain.dispose();
      }

   }

   @Override
   public void setFocus() {
      managerMain.setFocus();
   }
}

Back to the top