Пример #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);
   }
 }
Пример #2
0
 static void replace(
     GregorianCalendarManager manager,
     String oldName,
     String newName,
     IGregorianCalendarProvider newObj,
     ItemWsNode node) {
   manager.remove(oldName);
   manager.set(newName, newObj);
   node.getWorkspace().remove(node.getItem());
   node.getWorkspace().add(CalendarDocumentManager.systemItem(newName, newObj));
 }
 @Override
 public void vetoableChange(PropertyChangeEvent evt) throws PropertyVetoException {
   if (enable && ExplorerManager.PROP_SELECTED_NODES.equals(evt.getPropertyName())) {
     Node[] nodes = (Node[]) evt.getNewValue();
     if (nodes.length > 0 && ((DecoratedNode) nodes[0]).getOriginal() instanceof ItemWsNode) {
       ItemWsNode node = (ItemWsNode) ((DecoratedNode) nodes[0]).getOriginal();
       setSpecification((ISaSpecification) node.getItem().getElement());
       setIcon(node.getIcon(BeanInfo.ICON_COLOR_16x16));
     } else {
       setSpecification(null);
       setIcon(null);
     }
   }
 }
Пример #4
0
 @Override
 protected boolean enable(ItemWsNode context) {
   WorkspaceItem<?> cur = context.getItem();
   return cur != null && !cur.isReadOnly();
 }