Skip to main content
summaryrefslogtreecommitdiffstats
blob: f3b4614c3eebcd6f1e4255089d311eed67a8ebd9 (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
/**
 * Copyright (c) 2004 - 2011 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:
 *    Victor Roldan Betancort - initial API and implementation
 *    Eike Stepper - maintenance
 */
package org.eclipse.emf.cdo.internal.ui.actions;

import org.eclipse.emf.cdo.internal.ui.LegacyModeRegistry;
import org.eclipse.emf.cdo.session.CDOSession;

import org.eclipse.net4j.util.ui.actions.SafeAction;

/**
 * @author Victor Roldan Betancort
 */
public class ToggleLegacyModeDefaultAction extends SafeAction
{
  private static final String TITLE = "Legacy Mode";

  private static final String TOOL_TIP = "Toggles the default for legacy mode";

  private CDOSession session;

  public ToggleLegacyModeDefaultAction(CDOSession session)
  {
    super(TITLE, AS_CHECK_BOX);
    setToolTipText(TOOL_TIP);
    this.session = session;
    setChecked(LegacyModeRegistry.isLegacyEnabled(session));
  }

  @Override
  protected void safeRun() throws Exception
  {
    LegacyModeRegistry.setLegacyEnabled(session, !LegacyModeRegistry.isLegacyEnabled(session));
  }
}

Back to the top