Search in sources :

Example 6 with OpModelImage

use of org.eclipse.linuxtools.internal.oprofile.core.model.OpModelImage in project linuxtools by eclipse.

the class DependentProcessor method reset.

@Override
public void reset(Object callData) {
    image = new OpModelImage();
    imageList = new ArrayList<>();
}
Also used : OpModelImage(org.eclipse.linuxtools.internal.oprofile.core.model.OpModelImage)

Example 7 with OpModelImage

use of org.eclipse.linuxtools.internal.oprofile.core.model.OpModelImage in project linuxtools by eclipse.

the class DependentProcessor method endElement.

@Override
public void endElement(String name, Object callData) {
    if (name.equals(IMAGE_TAG)) {
        imageList.add(image);
        image = new OpModelImage();
    } else if (name.equals(SYMBOLS_TAG)) {
        image.setSymbols(_symbolsProcessor.getSymbols());
    } else if (name.equals(DEPENDENT_TAG)) {
        OprofileSAXHandler.getInstance(callData).pop(DEPENDENT_TAG);
    }
}
Also used : OpModelImage(org.eclipse.linuxtools.internal.oprofile.core.model.OpModelImage)

Example 8 with OpModelImage

use of org.eclipse.linuxtools.internal.oprofile.core.model.OpModelImage in project linuxtools by eclipse.

the class TestingOpModelEvent2 method getNewImage.

@Override
protected OpModelImage getNewImage() {
    /* this code mostly taken from OpxmlRunner */
    OpModelImage parsedImage = null;
    try {
        XMLReader reader = null;
        parsedImage = new OpModelImage();
        ModelDataProcessor.CallData image = new ModelDataProcessor.CallData(parsedImage);
        OprofileSAXHandler handler = OprofileSAXHandler.getInstance(image);
        // Create XMLReader
        SAXParserFactory factory = SAXParserFactory.newInstance();
        reader = factory.newSAXParser().getXMLReader();
        // Set content/error handlers
        reader.setContentHandler(handler);
        reader.setErrorHandler(handler);
        String filePath = FileLocator.toFileURL(FileLocator.find(TestPlugin.getDefault().getBundle(), new Path(REL_PATH_TO_TEST_XML), null)).getFile();
        reader.parse(new InputSource(new FileReader(filePath)));
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    } catch (SAXException e) {
        e.printStackTrace();
    } catch (ParserConfigurationException e) {
        e.printStackTrace();
    }
    return parsedImage;
}
Also used : Path(org.eclipse.core.runtime.Path) OpModelImage(org.eclipse.linuxtools.internal.oprofile.core.model.OpModelImage) InputSource(org.xml.sax.InputSource) FileNotFoundException(java.io.FileNotFoundException) OprofileSAXHandler(org.eclipse.linuxtools.internal.oprofile.core.opxml.OprofileSAXHandler) IOException(java.io.IOException) SAXException(org.xml.sax.SAXException) ModelDataProcessor(org.eclipse.linuxtools.internal.oprofile.core.opxml.modeldata.ModelDataProcessor) FileReader(java.io.FileReader) ParserConfigurationException(javax.xml.parsers.ParserConfigurationException) XMLReader(org.xml.sax.XMLReader) SAXParserFactory(javax.xml.parsers.SAXParserFactory)

Aggregations

OpModelImage (org.eclipse.linuxtools.internal.oprofile.core.model.OpModelImage)8 FileReader (java.io.FileReader)4 SAXParserFactory (javax.xml.parsers.SAXParserFactory)4 Path (org.eclipse.core.runtime.Path)4 OprofileSAXHandler (org.eclipse.linuxtools.internal.oprofile.core.opxml.OprofileSAXHandler)4 ModelDataProcessor (org.eclipse.linuxtools.internal.oprofile.core.opxml.modeldata.ModelDataProcessor)4 InputSource (org.xml.sax.InputSource)4 XMLReader (org.xml.sax.XMLReader)4 FileNotFoundException (java.io.FileNotFoundException)3 IOException (java.io.IOException)3 ParserConfigurationException (javax.xml.parsers.ParserConfigurationException)3 SAXException (org.xml.sax.SAXException)3 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 IRunnableWithProgress (org.eclipse.jface.operation.IRunnableWithProgress)1 OpModelSample (org.eclipse.linuxtools.internal.oprofile.core.model.OpModelSample)1 OpModelSymbol (org.eclipse.linuxtools.internal.oprofile.core.model.OpModelSymbol)1 Before (org.junit.Before)1 Test (org.junit.Test)1