Search in sources :

Example 1 with IOperationChangedListener

use of org.jcryptool.crypto.flexiprovider.operations.ui.listeners.IOperationChangedListener in project core by jcryptool.

the class OperationsManager method importOperation.

public void importOperation(String fileName) {
    try {
        // $NON-NLS-1$
        LogUtil.logInfo("1");
        IFileStore store = EFS.getStore(URIUtil.toURI(fileName));
        // $NON-NLS-1$
        LogUtil.logInfo("2");
        InputStream is = store.openInputStream(SWT.NONE, null);
        // $NON-NLS-1$
        LogUtil.logInfo("3");
        SAXBuilder sax = new SAXBuilder();
        // $NON-NLS-1$
        LogUtil.logInfo("4");
        Document doc = sax.build(is);
        // $NON-NLS-1$
        LogUtil.logInfo("5");
        is.close();
        // $NON-NLS-1$
        LogUtil.logInfo("6");
        ExportRootElement root = new ExportRootElement(doc.getRootElement());
        // $NON-NLS-1$
        LogUtil.logInfo("7");
        IFlexiProviderOperation importEntry = root.getEntryNode();
        // $NON-NLS-1$
        LogUtil.logInfo("8");
        newOperations.put(importEntry.getTimestamp(), importEntry);
        // $NON-NLS-1$
        LogUtil.logInfo("9");
        Iterator<IOperationChangedListener> it = listeners.iterator();
        while (it.hasNext()) {
            it.next().addOperation();
        }
        // $NON-NLS-1$
        LogUtil.logInfo("10");
    } catch (CoreException e) {
        LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "CoreException while importing an operation", e, true);
    } catch (JDOMException e) {
        LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "JDOMException while importing an operation", e, true);
    } catch (IOException e) {
        LogUtil.logError(FlexiProviderOperationsPlugin.PLUGIN_ID, "IOException while importing an operation", e, false);
    }
}
Also used : SAXBuilder(org.jdom.input.SAXBuilder) CoreException(org.eclipse.core.runtime.CoreException) ExportRootElement(org.jcryptool.crypto.flexiprovider.operations.xml.ExportRootElement) InputStream(java.io.InputStream) IFileStore(org.eclipse.core.filesystem.IFileStore) IOException(java.io.IOException) Document(org.jdom.Document) IOperationChangedListener(org.jcryptool.crypto.flexiprovider.operations.ui.listeners.IOperationChangedListener) JDOMException(org.jdom.JDOMException) IFlexiProviderOperation(org.jcryptool.crypto.flexiprovider.descriptors.IFlexiProviderOperation)

Example 2 with IOperationChangedListener

use of org.jcryptool.crypto.flexiprovider.operations.ui.listeners.IOperationChangedListener in project core by jcryptool.

the class OperationsManager method addOperation.

public void addOperation(AlgorithmDescriptor operation) {
    // $NON-NLS-1$
    LogUtil.logInfo("adding algorithm descriptor: " + operation.getClass().getName());
    long timestamp = System.currentTimeMillis();
    // $NON-NLS-1$
    newOperations.put(timestamp, new EntryNode("no name", timestamp, operation));
    Iterator<IOperationChangedListener> it = listeners.iterator();
    while (it.hasNext()) {
        it.next().addOperation();
    }
    // $NON-NLS-1$
    LogUtil.logInfo("operation 2.0 added");
}
Also used : EntryNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.EntryNode) IOperationChangedListener(org.jcryptool.crypto.flexiprovider.operations.ui.listeners.IOperationChangedListener)

Aggregations

IOperationChangedListener (org.jcryptool.crypto.flexiprovider.operations.ui.listeners.IOperationChangedListener)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 IFileStore (org.eclipse.core.filesystem.IFileStore)1 CoreException (org.eclipse.core.runtime.CoreException)1 IFlexiProviderOperation (org.jcryptool.crypto.flexiprovider.descriptors.IFlexiProviderOperation)1 EntryNode (org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.EntryNode)1 ExportRootElement (org.jcryptool.crypto.flexiprovider.operations.xml.ExportRootElement)1 Document (org.jdom.Document)1 JDOMException (org.jdom.JDOMException)1 SAXBuilder (org.jdom.input.SAXBuilder)1