Ejemplo n.º 1
0
 @Override
 protected void performAction(ItemWsNode context) {
   WorkspaceItem<TsVariables> cur = (WorkspaceItem<TsVariables>) context.getItem();
   if (cur != null && !cur.isReadOnly()) {
     // create the input dialog
     String oldName = cur.getDisplayName(), newName;
     VarsName nd = new VarsName(cur.getFamily(), NAME_MESSAGE, RENAME_TITLE, oldName);
     nd.addPropertyChangeListener(
         new PropertyChangeListener() {
           @Override
           public void propertyChange(PropertyChangeEvent evt) {
             if (evt.getPropertyName().equals(NotifyDescriptor.PROP_DETAIL)) {}
           }
         });
     if (DialogDisplayer.getDefault().notify(nd) != NotifyDescriptor.OK_OPTION) {
       return;
     }
     newName = nd.getInputText();
     if (newName.equals(oldName)) return;
     ProcessingContext.getActiveContext().getTsVariableManagers().rename(oldName, newName);
     cur.setDisplayName(newName);
     WorkspaceFactory.Event ev =
         new WorkspaceFactory.Event(
             cur.getOwner(), cur.getId(), WorkspaceFactory.Event.ITEMRENAMED);
     WorkspaceFactory.getInstance().notifyEvent(ev);
   }
 }
Ejemplo n.º 2
0
 @Override
 protected boolean enable(ItemWsNode context) {
   WorkspaceItem<?> cur = context.getItem();
   return cur != null && !cur.isReadOnly();
 }