Search in sources :

Example 1 with SourceFile

use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.

the class DebugCLI method module2ClassName.

/**
	 * Convert a module to class name.  This is used
	 * by the ExpressionCache to find variables
	 * that live at royale package scope.   That
	 * is variables such as mx.core.Component.
	 */
public String module2ClassName(int moduleId) {
    String pkg = null;
    try {
        SourceFile file = m_fileInfo.getFile(moduleId);
        pkg = file.getPackageName();
    } catch (Exception npe) {
    // didn't work ignore it.
    }
    return pkg;
}
Also used : SourceFile(flash.tools.debugger.SourceFile) VersionException(flash.tools.debugger.VersionException) PlayerFaultException(flash.tools.debugger.expression.PlayerFaultException) ParseException(java.text.ParseException) NotSupportedException(flash.tools.debugger.NotSupportedException) PlayerDebugException(flash.tools.debugger.PlayerDebugException) NotSuspendedException(flash.tools.debugger.NotSuspendedException) EOFException(java.io.EOFException) SuspendedException(flash.tools.debugger.SuspendedException) FileNotFoundException(java.io.FileNotFoundException) InProgressException(flash.tools.debugger.InProgressException) NoResponseException(flash.tools.debugger.NoResponseException) SocketException(java.net.SocketException) NoSuchVariableException(flash.tools.debugger.expression.NoSuchVariableException) SocketTimeoutException(java.net.SocketTimeoutException) NoSuchElementException(java.util.NoSuchElementException) IOException(java.io.IOException) NotConnectedException(flash.tools.debugger.NotConnectedException)

Example 2 with SourceFile

use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.

the class DebugCLI method listFilesMatching.

void listFilesMatching(StringBuffer sb, String match) {
    SourceFile[] sourceFiles = m_fileInfo.getFiles(match);
    for (int j = 0; j < sourceFiles.length; j++) {
        SourceFile sourceFile = sourceFiles[j];
        sb.append(sourceFile.getName());
        sb.append('#');
        sb.append(sourceFile.getId());
        sb.append(m_newline);
    }
}
Also used : SourceFile(flash.tools.debugger.SourceFile)

Example 3 with SourceFile

use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.

the class DebugCLI method parseFileName.

private int parseFileName(String partialFileName) throws NoMatchException, AmbiguousException {
    SourceFile[] sourceFiles = m_fileInfo.getFiles(partialFileName);
    int nSourceFiles = sourceFiles.length;
    if (nSourceFiles == 0) {
        Map args = new HashMap();
        //$NON-NLS-1$
        args.put("name", partialFileName);
        //$NON-NLS-1$
        throw new NoMatchException(getLocalizationManager().getLocalizedTextString("noSourceFileWithSpecifiedName", args));
    } else if (nSourceFiles > 1) {
        //$NON-NLS-1$
        String s = getLocalizationManager().getLocalizedTextString("ambiguousMatchingFilenames") + m_newline;
        for (int i = 0; i < nSourceFiles; i++) {
            SourceFile sourceFile = sourceFiles[i];
            //$NON-NLS-1$ //$NON-NLS-2$
            s += " " + sourceFile.getName() + "#" + sourceFile.getId();
            if (i < nSourceFiles - 1)
                s += m_newline;
        }
        throw new AmbiguousException(s);
    }
    return sourceFiles[0].getId();
}
Also used : HashMap(java.util.HashMap) SourceFile(flash.tools.debugger.SourceFile) Map(java.util.Map) HashMap(java.util.HashMap)

Example 4 with SourceFile

use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.

the class DebugCLI method buildFileList.

void buildFileList(StringBuffer sb, boolean authoredFilesOnly) {
    SourceFile[] ar = m_fileInfo.getFileList();
    if (ar == null) {
        //$NON-NLS-1$
        err(getLocalizationManager().getLocalizedTextString("noSourceFilesFound"));
        return;
    }
    Vector authoredFiles = new Vector();
    Vector frameworkFiles = new Vector();
    Vector syntheticFiles = new Vector();
    Vector actionsFiles = new Vector();
    for (int i = 0; i < ar.length; i++) {
        SourceFile m = ar[i];
        int fileType = getFileType(m);
        int id = m.getId();
        //$NON-NLS-1$
        String entry = m.getName() + "#" + id;
        switch(fileType) {
            case SYNTHETIC_FILE:
                syntheticFiles.add(entry);
                break;
            case FRAMEWORK_FILE:
                frameworkFiles.add(entry);
                break;
            case ACTIONS_FILE:
                actionsFiles.add(entry);
                break;
            case AUTHORED_FILE:
                authoredFiles.add(entry);
                break;
        }
    }
    int wrapAt = propertyGet(FILE_LIST_WRAP);
    if (!authoredFilesOnly) {
        if (actionsFiles.size() > 0) {
            appendStrings(sb, actionsFiles, (actionsFiles.size() > wrapAt));
        }
        if (frameworkFiles.size() > 0) {
            //$NON-NLS-1$
            sb.append("---" + m_newline);
            appendStrings(sb, frameworkFiles, (frameworkFiles.size() > wrapAt));
        }
        if (syntheticFiles.size() > 0) {
            //$NON-NLS-1$
            sb.append("---" + m_newline);
            appendStrings(sb, syntheticFiles, (syntheticFiles.size() > wrapAt));
        }
        //$NON-NLS-1$
        sb.append("---" + m_newline);
    }
    appendStrings(sb, authoredFiles, (authoredFiles.size() > wrapAt));
}
Also used : SourceFile(flash.tools.debugger.SourceFile) Vector(java.util.Vector)

Example 5 with SourceFile

use of flash.tools.debugger.SourceFile in project intellij-plugins by JetBrains.

the class DebugCLI method appendFrameInfo.

/**
	 * Spit out frame information for a given frame number 
	 */
boolean appendFrameInfo(StringBuffer sb, Frame ctx, int frameNumber, boolean showThis, boolean showFileId) throws PlayerDebugException {
    boolean validFrame = true;
    // some formatting properties
    int i = frameNumber;
    Location loc = ctx.getLocation();
    SourceFile file = loc.getFile();
    int line = loc.getLine();
    //$NON-NLS-1$
    String name = (file == null) ? "<null>" : file.getName();
    String sig = ctx.getCallSignature();
    String func = extractFunctionName(sig);
    // file == null or line < 0 appears to be a terminator for stack info
    if (file == null && line < 0) {
        validFrame = false;
    } else {
        Variable[] var = ctx.getArguments(m_session);
        Variable dis = ctx.getThis(m_session);
        boolean displayArgs = (func != null) || (var != null);
        sb.append('#');
        FieldFormat.formatLong(sb, i, 3);
        sb.append(' ');
        if (showThis && dis != null) {
            ExpressionCache.appendVariable(sb, dis);
            //$NON-NLS-1$
            sb.append(".");
        }
        if (func != null)
            sb.append(func);
        if (displayArgs) {
            sb.append('(');
            for (int j = 0; j < var.length; j++) {
                Variable v = var[j];
                sb.append(v.getName());
                sb.append('=');
                ExpressionCache.appendVariableValue(sb, v.getValue());
                if ((j + 1) < var.length)
                    //$NON-NLS-1$
                    sb.append(", ");
            }
            //$NON-NLS-1$
            sb.append(")");
            //$NON-NLS-1$
            sb.append(getLocalizationManager().getLocalizedTextString("atFilename"));
        }
        sb.append(name);
        // if this file is currently being filtered put the source file id after it
        if (file != null && (showFileId || !m_fileInfo.inFileList(file))) {
            sb.append('#');
            sb.append(file.getId());
        }
        sb.append(':');
        sb.append(line);
    }
    return validFrame;
}
Also used : Variable(flash.tools.debugger.Variable) SourceFile(flash.tools.debugger.SourceFile) Location(flash.tools.debugger.Location)

Aggregations

SourceFile (flash.tools.debugger.SourceFile)30 Location (flash.tools.debugger.Location)15 HashMap (java.util.HashMap)13 InProgressException (flash.tools.debugger.InProgressException)9 Map (java.util.Map)9 ParseException (java.text.ParseException)7 NotConnectedException (flash.tools.debugger.NotConnectedException)6 SwfInfo (flash.tools.debugger.SwfInfo)5 PlayerDebugException (flash.tools.debugger.PlayerDebugException)4 DSwfInfo (flash.tools.debugger.concrete.DSwfInfo)4 NoResponseException (flash.tools.debugger.NoResponseException)3 ArrayList (java.util.ArrayList)3 SourceBreakpoint (com.nextgenactionscript.vscode.debug.requests.SourceBreakpoint)2 Breakpoint (com.nextgenactionscript.vscode.debug.responses.Breakpoint)2 Frame (flash.tools.debugger.Frame)2 NotSupportedException (flash.tools.debugger.NotSupportedException)2 NotSuspendedException (flash.tools.debugger.NotSuspendedException)2 SuspendedException (flash.tools.debugger.SuspendedException)2 Variable (flash.tools.debugger.Variable)2 VersionException (flash.tools.debugger.VersionException)2