Search in sources :

Example 1 with OutputNode

use of org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.OutputNode in project core by jcryptool.

the class EditorDragListener method dragSetData.

public void dragSetData(DragSourceEvent event) {
    Object selected = viewer.getTree().getSelection()[0].getData();
    if (selected instanceof InputNode) {
        InputNode node = (InputNode) selected;
        // $NON-NLS-1$
        LogUtil.logInfo("Input: " + node.getInput());
        if (!node.getInput().equals("-1") && !node.getInput().equals(Messages.InputType)) {
            // $NON-NLS-1$
            EditorInputTransfer.EditorInputData data = EditorInputTransfer.createEditorInputData(IOperationsConstants.ID_HEX_EDITOR, // $NON-NLS-1$
            new PathEditorInput(node.getInput()));
            event.data = new EditorInputTransfer.EditorInputData[] { data };
        }
    } else if (selected instanceof OutputNode) {
        OutputNode node = (OutputNode) selected;
        // $NON-NLS-1$
        LogUtil.logInfo("Output: " + node.getOutput());
        if (!node.getOutput().equals("-1") && !node.getOutput().equals("<Editor>")) {
            // $NON-NLS-1$
            EditorInputTransfer.EditorInputData data = EditorInputTransfer.createEditorInputData(IOperationsConstants.ID_HEX_EDITOR, // $NON-NLS-1$
            new PathEditorInput(node.getOutput()));
            event.data = new EditorInputTransfer.EditorInputData[] { data };
        }
    }
}
Also used : InputNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.InputNode) EditorInputTransfer(org.eclipse.ui.part.EditorInputTransfer) OutputNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.OutputNode) PathEditorInput(org.jcryptool.core.operations.util.PathEditorInput)

Example 2 with OutputNode

use of org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.OutputNode in project core by jcryptool.

the class EditorDragListener method dragStart.

public void dragStart(DragSourceEvent event) {
    Object selected = viewer.getTree().getSelection()[0].getData();
    // $NON-NLS-1$
    LogUtil.logInfo("Selected for drag: " + selected.getClass().getName());
    if (!(selected instanceof InputNode) && !(selected instanceof OutputNode)) {
        event.doit = false;
        return;
    }
    if (selected instanceof InputNode) {
        InputNode node = (InputNode) selected;
        if (node.getInput().equals("-1") || node.getInput().equals(Messages.InputType)) {
            // $NON-NLS-1$
            // $NON-NLS-1$
            LogUtil.logInfo("not doing it");
            event.doit = false;
        }
    } else if (selected instanceof OutputNode) {
        OutputNode node = (OutputNode) selected;
        if (!node.getOutput().equals("-1") && !node.getOutput().equals("<Editor>")) {
            // $NON-NLS-1$
            // $NON-NLS-1$
            LogUtil.logInfo("not doing it");
            event.doit = false;
        }
    }
}
Also used : InputNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.InputNode) OutputNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.OutputNode)

Example 3 with OutputNode

use of org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.OutputNode in project core by jcryptool.

the class FlexiProviderOperationsView method hookContextMenu.

// private IExtendedOperationDescriptor currentOperation;
private void hookContextMenu() {
    // $NON-NLS-1$
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            if (viewer.getTree().getSelection().length > 0) {
                Object selection = viewer.getTree().getSelection()[0].getData();
                if (selection instanceof TreeNode) {
                    currentEntryNode = getCurrentEntryNode((TreeNode) selection);
                }
                if (selection instanceof EntryNode) {
                    fillEntryNodeContextMenu(manager);
                } else if (selection instanceof OperationsNode) {
                    if (displayOperationContextMenu(currentEntryNode)) {
                        fillEncryptDecryptNodeContextMenu(manager);
                    }
                } else if (selection instanceof InputNode) {
                    fillInputContextMenu(manager);
                } else if (selection instanceof OutputNode) {
                    fillOutputContextMenu(manager);
                } else if (selection instanceof SignatureNode) {
                    fillSignatureOutputContextMenu(manager);
                } else if (selection instanceof KeyNode) {
                    fillKeyNodeContextMenu(manager);
                }
            }
        }
    });
    Menu menu = menuMgr.createContextMenu(viewer.getControl());
    viewer.getControl().setMenu(menu);
    getSite().registerContextMenu("org.jcryptool.crypto.flexiprovider.operations.popup", menuMgr, viewer);
}
Also used : InputNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.InputNode) OutputNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.OutputNode) TreeNode(org.jcryptool.crypto.flexiprovider.ui.nodes.TreeNode) ITreeNode(org.jcryptool.crypto.flexiprovider.ui.nodes.ITreeNode) MenuManager(org.eclipse.jface.action.MenuManager) IMenuManager(org.eclipse.jface.action.IMenuManager) EntryNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.EntryNode) KeyNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.keys.KeyNode) IMenuManager(org.eclipse.jface.action.IMenuManager) OperationsNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.ops.OperationsNode) Menu(org.eclipse.swt.widgets.Menu) SignatureNode(org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.SignatureNode) IMenuListener(org.eclipse.jface.action.IMenuListener)

Aggregations

InputNode (org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.InputNode)3 OutputNode (org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.OutputNode)3 IMenuListener (org.eclipse.jface.action.IMenuListener)1 IMenuManager (org.eclipse.jface.action.IMenuManager)1 MenuManager (org.eclipse.jface.action.MenuManager)1 Menu (org.eclipse.swt.widgets.Menu)1 EditorInputTransfer (org.eclipse.ui.part.EditorInputTransfer)1 PathEditorInput (org.jcryptool.core.operations.util.PathEditorInput)1 EntryNode (org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.EntryNode)1 SignatureNode (org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.io.SignatureNode)1 KeyNode (org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.keys.KeyNode)1 OperationsNode (org.jcryptool.crypto.flexiprovider.operations.ui.views.nodes.ops.OperationsNode)1 ITreeNode (org.jcryptool.crypto.flexiprovider.ui.nodes.ITreeNode)1 TreeNode (org.jcryptool.crypto.flexiprovider.ui.nodes.TreeNode)1