Search in sources :

Example 26 with OtpErlangString

use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.

the class GlobalParameters method hasQuickCheck.

/**
 * Checks if QuickCheck is installed in the current machine.
 *
 * @return true if QC is installed, else false
 */
public static boolean hasQuickCheck() {
    if (GlobalParameters.isQCchecked) {
        return GlobalParameters.hasQuickCheck;
    }
    final RpcResult res = Activator.getDefault().getBackend().call_noexception("code", "which", "a", "eqc");
    if (!res.isOk()) {
        return false;
    }
    if (res.getValue() instanceof OtpErlangString) {
        GlobalParameters.hasQuickCheck = true;
        GlobalParameters.isQCchecked = true;
    } else {
        GlobalParameters.isQCchecked = true;
        GlobalParameters.hasQuickCheck = false;
    }
    return GlobalParameters.hasQuickCheck;
}
Also used : RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 27 with OtpErlangString

use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.

the class RenameFunctionRefactoring method getDefaultValue.

@Override
public String getDefaultValue() {
    final IErlMemberSelection sel = (IErlMemberSelection) GlobalParameters.getWranglerSelection();
    if (sel == null) {
        return "";
    }
    final RpcResult res = WranglerBackendManager.getRefactoringBackend().callWithoutParser("get_fun_name_eclipse", "siixi", sel.getFilePath(), sel.getSelectionRange().getStartLine(), sel.getSelectionRange().getStartCol(), sel.getSearchPath(), GlobalParameters.getTabWidth());
    if (res.getValue().getClass().equals(OtpErlangString.class)) {
        return ((OtpErlangString) res.getValue()).stringValue();
    }
    return "";
}
Also used : IErlMemberSelection(org.erlide.wrangler.refactoring.selection.IErlMemberSelection) RpcResult(org.erlide.runtime.rpc.RpcResult) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 28 with OtpErlangString

use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.

the class UserRefactoring method prepareUserInput.

protected OtpErlangList prepareUserInput() {
    final OtpErlangObject[] params = new OtpErlangObject[parValues.size()];
    int i = 0;
    for (final String val : parValues) {
        params[i] = new OtpErlangString(val);
        i++;
    }
    return new OtpErlangList(params);
}
Also used : OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) OtpErlangObject(com.ericsson.otp.erlang.OtpErlangObject) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 29 with OtpErlangString

use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.

the class AbstractErlSelection method getSearchPath.

@Override
public OtpErlangList getSearchPath() {
    final IProject project = file.getProject();
    final IErlModel model = ErlangEngine.getInstance().getModel();
    final IErlProject actualProject = model.getErlangProject(project);
    final IPath projectLocation = actualProject.getWorkspaceProject().getLocation();
    final Collection<IPath> sourcDirs = actualProject.getProperties().getSourceDirs();
    final OtpErlangString[] searchPath = new OtpErlangString[sourcDirs.size()];
    int i = 0;
    for (final IPath src : sourcDirs) {
        searchPath[i++] = new OtpErlangString(projectLocation.append(src).toOSString());
    }
    return new OtpErlangList(searchPath);
}
Also used : IErlProject(org.erlide.engine.model.root.IErlProject) IErlModel(org.erlide.engine.model.root.IErlModel) IPath(org.eclipse.core.runtime.IPath) OtpErlangList(com.ericsson.otp.erlang.OtpErlangList) IProject(org.eclipse.core.resources.IProject) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Example 30 with OtpErlangString

use of com.ericsson.otp.erlang.OtpErlangString in project erlide_eclipse by erlang.

the class TraceBackend method loadDataFromFile.

/**
 * Loads traces from active result set (
 * {@link #setActiveResultSet(TracingResultsNode)}). Index of last trace
 * which will be loaded is <code>max(number_of_traces, endIndex)</code>.
 *
 * @param theStartIndex
 *            number of first trace
 * @param endIndex
 *            number of last trace
 */
public void loadDataFromFile(final long theStartIndex, final long endIndex) {
    if (!tracing && !loading) {
        synchronized (this) {
            if (!tracing && !loading) {
                try {
                    loading = true;
                    loadingFileInfo = false;
                    startIndex = theStartIndex;
                    handler = new TraceEventHandler();
                    getBackend(true);
                    TraceCollections.getTracesList().clear();
                    tracerBackend.getRuntime().registerEventListener(handler);
                    final OtpErlangLong start = new OtpErlangLong(theStartIndex);
                    final OtpErlangLong stop = new OtpErlangLong(endIndex);
                    tracerBackend.getOtpRpc().call(Constants.ERLANG_HELPER_MODULE, TraceBackend.FUN_LOAD, "sii", new OtpErlangString(activeResultSet.getFileName()), start, stop);
                } catch (final RpcException e) {
                    ErlLogger.error(e);
                    errorObject = e;
                    finishLoading(TracingStatus.EXCEPTION_THROWN);
                }
            }
        }
    }
}
Also used : OtpErlangLong(com.ericsson.otp.erlang.OtpErlangLong) RpcException(org.erlide.runtime.rpc.RpcException) OtpErlangString(com.ericsson.otp.erlang.OtpErlangString)

Aggregations

OtpErlangString (com.ericsson.otp.erlang.OtpErlangString)56 OtpErlangObject (com.ericsson.otp.erlang.OtpErlangObject)36 OtpErlangList (com.ericsson.otp.erlang.OtpErlangList)31 OtpErlangTuple (com.ericsson.otp.erlang.OtpErlangTuple)22 OtpErlangAtom (com.ericsson.otp.erlang.OtpErlangAtom)15 ArrayList (java.util.ArrayList)9 RpcResult (org.erlide.runtime.rpc.RpcResult)8 OtpErlangLong (com.ericsson.otp.erlang.OtpErlangLong)7 RpcException (org.erlide.runtime.rpc.RpcException)7 Test (org.junit.Test)7 OtpErlangRangeException (com.ericsson.otp.erlang.OtpErlangRangeException)6 OtpErlangBinary (com.ericsson.otp.erlang.OtpErlangBinary)5 IPath (org.eclipse.core.runtime.IPath)5 ErlModelException (org.erlide.engine.model.ErlModelException)5 IErlElement (org.erlide.engine.model.IErlElement)5 WranglerRpcParsingException (org.erlide.wrangler.refactoring.exception.WranglerRpcParsingException)5 IErlMemberSelection (org.erlide.wrangler.refactoring.selection.IErlMemberSelection)5 CoreException (org.eclipse.core.runtime.CoreException)4 WranglerException (org.erlide.wrangler.refactoring.exception.WranglerException)4 Map (java.util.Map)3