Beispiel #1
0
  /*
   * Method declared on SelectionChangedAction.
   */
  @Override
  public void run(final IStructuredSelection selection) {
    final IErlElement element = getErlElement(selection, false);
    if (element == null || !element.exists()) {
      showOperationUnavailableDialog();
      return;
    }
    // else if (element == RETURN_WITHOUT_BEEP) {
    // return;
    // }

    run(element);
  }
 /**
  * Load the model from the given file, if possible.
  *
  * @param modelFile The IFile which contains the persisted model
  */
 public Object getParent(final Object element) {
   if (element instanceof IErlElement) {
     final IErlElement elt = (IErlElement) element;
     final IErlElement parent = elt.getParent();
     if (parent instanceof IErlModule) {
       final IErlModule mod = (IErlModule) parent;
       try {
         return mod.getCorrespondingResource();
       } catch (final ErlModelException e) {
         ErlLogger.warn(e);
       }
     }
   }
   return null;
 }