Exemplo n.º 1
0
 public SearchPatternData tryErlangTextSelection(
     final SearchPatternData initData0, final IEditorPart activePart) throws ErlModelException {
   final AbstractErlangEditor erlangEditor = (AbstractErlangEditor) activePart;
   final IErlModule module = erlangEditor.getModule();
   SearchPatternData initData = initData0;
   if (module != null) {
     final ISelection ssel = erlangEditor.getSite().getSelectionProvider().getSelection();
     final ITextSelection textSel = (ITextSelection) ssel;
     final int offset = textSel.getOffset();
     OpenResult res;
     try {
       res =
           ErlangEngine.getInstance()
               .getService(OpenService.class)
               .open(
                   module.getScannerName(),
                   offset,
                   ErlangEngine.getInstance().getModelUtilService().getImportsAsList(module),
                   "",
                   ErlangEngine.getInstance().getModel().getPathVars());
     } catch (final RpcException e) {
       res = null;
     }
     ErlLogger.debug("searchPage(open) " + res);
     initData = determineInitValuesFrom(module, offset, res);
   }
   return initData;
 }
 @Override
 public IStructuredSelection findSelection(final IEditorInput input) {
   try {
     final IErlModule module = ErlModelUtils.getModule(input);
     if (module != null) {
       final IResource resource = module.getCorrespondingResource();
       if (resource != null) {
         return new StructuredSelection(resource);
       }
       return new StructuredSelection(module);
     }
   } catch (final CoreException e) {
   }
   return StructuredSelection.EMPTY;
 }
  public void interpretOrDeinterpret(final IErlModule module, final boolean checked) {
    if (erlangDebugTarget == null) {
      ErlLogger.warn("erlangDebugTarget is null ?!?!");
      return;
    }
    final String moduleWoExtension = module.getModuleName();
    final IProject project =
        ErlangEngine.getInstance().getModelUtilService().getProject(module).getWorkspaceProject();
    final boolean interpret = checked;

    if (erlangDebugTarget.getInterpretedModules().contains(moduleWoExtension) != interpret) {
      // FIXME this isn't correct!!!
      erlangDebugTarget.interpret(project, moduleWoExtension, distributed, interpret);
    }
    addRemove(module, checked);
  }