コード例 #1
0
 /* (non-Javadoc)
  * @see org.eclipse.ui.views.properties.IPropertySource#getPropertyValue(java.lang.Object)
  */
 public Object getPropertyValue(Object id) {
   if (m_inst.isOrphaned()) {
     return "";
   }
   if (id.equals("Descrip")) {
     return m_inst.getDescrip().replace('\n', '/');
   } else if (id.equals("GuardCondition")) {
     return m_inst.getGuardcondition();
   }
   return null;
 }
コード例 #2
0
  /* (non-Javadoc)
   * @see org.eclipse.ui.views.properties.IPropertySource#setPropertyValue(java.lang.Object, java.lang.Object)
   */
  public void setPropertyValue(Object id, Object value) {
    boolean value_changed = false;
    String trans_name = "";
    Transaction tr = null;
    Ooaofooa modelRoot = (Ooaofooa) m_inst.getModelRoot();
    TransactionManager tm = TransactionManager.getSingleton();
    try {
      if (id.equals("Descrip")) {
        if (!value.toString().equals(m_inst.getDescrip())) {
          trans_name = "Change in property: 'Descrip' of Fork Join Node"; // $NON-NLS-1$
          tr = tm.startTransaction(trans_name, Ooaofooa.getDefaultInstance());
          value_changed = true;
          m_inst.setDescrip(value.toString());
        }
      } else if (id.equals("GuardCondition")) {
        if (!value.toString().equals(m_inst.getGuardcondition())) {
          trans_name = "Change in property: 'GuardCondition' of Fork Join Node"; // $NON-NLS-1$
          tr = tm.startTransaction(trans_name, Ooaofooa.getDefaultInstance());
          value_changed = true;
          m_inst.setGuardcondition(value.toString());
        }
      }

      // catch all exceptions and cancel the transaction
    } catch (Exception e) {
      // this can be null if there was
      // an exception starting the
      // transaction
      if (tr != null) {
        tm.cancelTransaction(tr, e);
        tr = null;
      }
      CorePlugin.logError("Transaction: " + trans_name + " could not complete", e);
    }
    if (tr != null) {
      if (value_changed) tm.endTransaction(tr);
      else tm.cancelTransaction(tr);
    }
  }