Package com.subgraph.vega.ui.http.intercept.config

Source Code of com.subgraph.vega.ui.http.intercept.config.BreakpointEnabledEditingSupport

/*******************************************************************************
* Copyright (c) 2011 Subgraph.
* 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:
*     Subgraph - initial API and implementation
******************************************************************************/
package com.subgraph.vega.ui.http.intercept.config;

import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.CheckboxCellEditor;
import org.eclipse.jface.viewers.EditingSupport;
import org.eclipse.jface.viewers.TableViewer;
import org.eclipse.swt.SWT;

import com.subgraph.vega.api.model.conditions.IHttpCondition;

public class BreakpointEnabledEditingSupport extends EditingSupport {
  private final TableViewer viewer;

  public BreakpointEnabledEditingSupport(TableViewer viewer) {
    super(viewer);
    this.viewer = viewer;
  }

  @Override
  protected CellEditor getCellEditor(Object element) {
    return new CheckboxCellEditor(null, SWT.CHECK);// | SWT.READ_ONLY);
  }

  @Override
  protected boolean canEdit(Object element) {
    return true;
  }

  @Override
  protected Object getValue(Object element) {
    return ((IHttpCondition)element).isEnabled();
  }

  @Override
  protected void setValue(Object element, Object value) {
    ((IHttpCondition) element).setEnabled((Boolean) value);
    viewer.refresh();
  }

}
TOP

Related Classes of com.subgraph.vega.ui.http.intercept.config.BreakpointEnabledEditingSupport

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.