Example #1
0
  private void rehighlightNode(@NotNull MPSTreeNode node, @NotNull Feature feature) {
    unhighlightNode(node);

    SModel model = SModelRepository.getInstance().getModelDescriptor(feature.getModelReference());
    if (model instanceof EditableSModel && !(model.isReadOnly())) {
      if (feature instanceof ModelFeature) {
        // do not try to compute changes in case we need only model status
        TreeMessage message = getMessage((ModelFeature) feature);
        if (message != null) {
          node.addTreeMessage(message);
        }
        return;
      }

      EditableSModel emd = (EditableSModel) model;
      myRegistry.getCurrentDifference(emd).setEnabled(true);

      ModelChange change = myMap.get(feature);
      if (change == null) {
        change = myMap.getAddedAncestorValue(feature);
      }
      if (change != null) {
        node.addTreeMessage(getMessage(change, emd));
      } else if (myMap.isAncestorOfAddedFeature(feature)) {
        node.addTreeMessage(getMessage(FileStatus.MODIFIED));
      }
    }
  }
Example #2
0
  protected void renameModels(String oldName, String newName, boolean moveModels) {
    // if module name is a prefix of it's model's name - rename the model, too
    for (SModel m : getModels()) {
      if (m.isReadOnly()
          || !m.getName().getNamespace().startsWith(oldName)
          || !(m instanceof EditableSModel)) {
        continue;
      }

      SModelName newModelName =
          new SModelName(
              newName + m.getName().getNamespace().substring(oldName.length()),
              m.getName().getSimpleName(),
              m.getName().getStereotype());
      ((EditableSModel) m).rename(newModelName.getValue(), moveModels);
    }
  }