Search in sources :

Example 1 with CaptureType

use of com.android.tools.idea.profiling.capture.CaptureType in project android by JetBrains.

the class CapturesTreeStructure method update.

public void update() {
    CaptureService service = CaptureService.getInstance(myProject);
    myRoot.clear();
    Map<CaptureType, CaptureTypeNode> types = Maps.newHashMap();
    for (CaptureType type : service.getTypes()) {
        CaptureTypeNode typeNode = myTypeNodes.get(type);
        if (typeNode == null) {
            typeNode = new CaptureTypeNode(type);
        }
        types.put(type, typeNode);
        myRoot.addType(typeNode);
    }
    myTypeNodes = types;
    Map<Capture, CaptureNode> captures = Maps.newHashMap();
    for (Map.Entry<CaptureType, Collection<Capture>> entry : service.getCapturesByType().asMap().entrySet()) {
        CaptureTypeNode typeNode = myTypeNodes.get(entry.getKey());
        typeNode.clear();
        for (Capture capture : entry.getValue()) {
            CaptureNode captureNode = myCaptureNodes.get(capture);
            if (captureNode == null) {
                captureNode = new CaptureNode(myProject, capture);
            } else {
                captureNode.update();
            }
            captures.put(capture, captureNode);
            typeNode.addCapture(captureNode);
        }
    }
    myCaptureNodes = captures;
}
Also used : CaptureType(com.android.tools.idea.profiling.capture.CaptureType) CaptureNode(com.android.tools.idea.profiling.view.nodes.CaptureNode) CaptureService(com.android.tools.idea.profiling.capture.CaptureService) Collection(java.util.Collection) CaptureTypeNode(com.android.tools.idea.profiling.view.nodes.CaptureTypeNode) Map(java.util.Map) Capture(com.android.tools.idea.profiling.capture.Capture)

Example 2 with CaptureType

use of com.android.tools.idea.profiling.capture.CaptureType in project android by JetBrains.

the class CapturesToolWindowFixture method openFile.

public void openFile(@NotNull final String fileName) throws IOException {
    String pathName = null;
    CaptureType[] captureTypes = CaptureTypeService.getInstance().getCaptureTypes();
    for (CaptureType captureType : captureTypes) {
        if (captureType instanceof FileCaptureType) {
            FileCaptureType fileCaptureType = (FileCaptureType) captureType;
            if (fileCaptureType.isValidCapture(fileName)) {
                pathName = fileCaptureType.getName();
                break;
            }
        }
    }
    if (pathName != null) {
        final String finalPathName = pathName;
        Wait.seconds(1).expecting("the file to be recognized").until(() -> {
            try {
                String fileToSelect = finalPathName + "/" + fileName;
                myTreeFixture.selectPath(fileToSelect);
                // TODO: Use mouse clicks instead of the keyboard when the fixture responds correctly to double clicks,
                //       as this will better model how users interact with the feature in practice.
                myTreeFixture.pressAndReleaseKey(KeyPressInfo.keyCode(KeyEvent.VK_ENTER));
                return true;
            } catch (LocationUnavailableException e) {
                return false;
            }
        });
    }
}
Also used : FileCaptureType(com.android.tools.idea.profiling.capture.FileCaptureType) CaptureType(com.android.tools.idea.profiling.capture.CaptureType) FileCaptureType(com.android.tools.idea.profiling.capture.FileCaptureType) LocationUnavailableException(org.fest.swing.exception.LocationUnavailableException)

Aggregations

CaptureType (com.android.tools.idea.profiling.capture.CaptureType)2 Capture (com.android.tools.idea.profiling.capture.Capture)1 CaptureService (com.android.tools.idea.profiling.capture.CaptureService)1 FileCaptureType (com.android.tools.idea.profiling.capture.FileCaptureType)1 CaptureNode (com.android.tools.idea.profiling.view.nodes.CaptureNode)1 CaptureTypeNode (com.android.tools.idea.profiling.view.nodes.CaptureTypeNode)1 Collection (java.util.Collection)1 Map (java.util.Map)1 LocationUnavailableException (org.fest.swing.exception.LocationUnavailableException)1