Package net.sourceforge.syncyoursecrets.model.pw

Examples of net.sourceforge.syncyoursecrets.model.pw.PWTableEntry


   * @see org.eclipse.jface.viewers.ICellModifier#getValue(java.lang.Object,
   *      java.lang.String)
   */
  public Object getValue(Object element, String property) {
    if (element instanceof PWTableEntry) {
      PWTableEntry tEntry = (PWTableEntry) element;

      // Find the index of the column
      if (PWTableEditor.KEY_COLUMN.equals(property)) {
        return tEntry.getName();
      } else if (PWTableEditor.VALUE_COLUMN.equals(property)) {
        return tEntry.getContent();
      } else {
        throw new SysRuntimeException(
            "Invalid attempt to get value for unknown property "
                + property);
      }
View Full Code Here


  public void modify(Object element, String property, Object value) {
    TableItem item = (TableItem) element;
    Object target = item.getData();

    if (target instanceof PWTableEntry) {
      PWTableEntry tEntry = (PWTableEntry) target;

      // Find the index of the column
      if (PWTableEditor.KEY_COLUMN.equals(property)) {
        tEntry.setName((String) value);
      } else if (PWTableEditor.VALUE_COLUMN.equals(property)) {
        try {
          tEntry.setContent((String) value);
        } catch (ElementDeletedException ex) {
          String msg = "Entry was already deleted and should not be shown here, this is a bug";
          logger.fatal(msg, ex);
          throw new SysRuntimeException(msg, ex);
        }
View Full Code Here

   * @see org.eclipse.jface.viewers.ITableLabelProvider#getColumnText(java.lang
   *      .Object, int)
   */
  public String getColumnText(Object element, int columnIndex) {
    if (element instanceof PWTableEntry) {
      PWTableEntry tEntry = (PWTableEntry) element;

      switch (columnIndex) {
      case 0: // COMPLETED_COLUMN
        return tEntry.getName();

      case 1:
        return tEntry.getContent();

      default:
        throw new SysRuntimeException(
            "Invalid attempt to get text from column "
                + columnIndex + ". This is a bug, sorry.");
View Full Code Here

   */
  @Override
  public int compare(Viewer viewer, Object e1, Object e2) {

    if (e1 instanceof PWTableEntry && e2 instanceof PWTableEntry) {
      PWTableEntry entry1 = (PWTableEntry) e1;
      PWTableEntry entry2 = (PWTableEntry) e2;

      return entry1.getName().compareTo(entry2.getName());
    }

    return super.compare(viewer, e1, e2);
  }
View Full Code Here

   * Adds a new table entry.
   */
  public void addTableEntry() {
    logger.debug("entering addTableEntry");
    try {
      PWTableEntry tEntry = new PWTableEntry("key");
      tEntry.setContent("value");
      this.pwTable.add(tEntry);

      viewer.refresh();
    } catch (SysGenericException ex) {
      String msg = "Creating table entry failed, this is a bug";
View Full Code Here

    delete.addSelectionListener(new SelectionAdapter() {

      // Remove the selection and refresh the view
      public void widgetSelected(SelectionEvent e) {
        logger.debug("Pushed Delete TableEntry Button");
        PWTableEntry tEntry = (PWTableEntry) ((IStructuredSelection) tableViewer
            .getSelection()).getFirstElement();
        if (tEntry != null) {
          pwTableContentProvider.deleteTableEntry(tEntry);

        } else {
View Full Code Here

TOP

Related Classes of net.sourceforge.syncyoursecrets.model.pw.PWTableEntry

Copyright © 2018 www.massapicom. 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.