Package org.erlide.tracing.core.mvc.model

Examples of org.erlide.tracing.core.mvc.model.TracePattern


        return true;
    }

    @Override
    public Object getValue(final Object element, final String property) {
        final TracePattern pattern = (TracePattern) element;
        switch (TracePatternColumn.valueOf(property)) {
        case ENABLED:
            return new Boolean(pattern.isEnabled());
        case MODULE_NAME:
            return pattern.getModuleName();
        case FUNCTION_NAME:
            return pattern.getFunctionName();
        case LOCAL:
            return new Boolean(pattern.isLocal());
        case ARITY:
            if (pattern.getArity() < 0) {
                return "";
            }
            return String.valueOf(pattern.getArity());
        case MATCH_SPEC:
            return pattern.getMatchSpec();
        default:
            return null;
        }
    }
View Full Code Here


        }
    }

    @Override
    public void modify(final Object element, final String property, final Object value) {
        final TracePattern pattern = (TracePattern) ((TableItem) element).getData();
        switch (TracePatternColumn.valueOf(property)) {
        case ENABLED:
            pattern.setEnabled((Boolean) value);
            break;
        case MODULE_NAME:
            pattern.setModuleName((String) value);
            break;
        case FUNCTION_NAME:
            pattern.setFunctionName((String) value);
            break;
        case LOCAL:
            pattern.setLocal((Boolean) value);
            break;
        case ARITY:
            if (value == null || "".equals(value)) {
                pattern.setArity(-1);
            } else {
                try {
                    final Integer arity = Integer.valueOf((String) value);
                    if (arity >= 0) {
                        pattern.setArity(arity.intValue());
                    }
                } catch (final NumberFormatException e) {
                }
            }
            break;
        case MATCH_SPEC:
            pattern.setMatchSpec((MatchSpec) value);
            break;
        default:
        }
        tableViewer.refresh();
    }
View Full Code Here

public class TracePatternLabelProvider extends LabelProvider implements
        ITableLabelProvider {

    @Override
    public Image getColumnImage(final Object element, final int index) {
        final TracePattern pattern = (TracePattern) element;
        if (index == TracePatternColumn.ENABLED.ordinal()) {
            if (pattern.isEnabled()) {
                return Activator.getDefault().getImageRegistry()
                        .get(Images.CHECKED.toString());
            }
            return Activator.getDefault().getImageRegistry()
                    .get(Images.UNCHECKED.toString());
        } else if (index == TracePatternColumn.LOCAL.ordinal()) {
            if (pattern.isLocal()) {
                return Activator.getDefault().getImageRegistry()
                        .get(Images.CHECKED.toString());
            }
            return Activator.getDefault().getImageRegistry()
                    .get(Images.UNCHECKED.toString());
View Full Code Here

        }
    }

    @Override
    public String getColumnText(final Object element, final int index) {
        final TracePattern tracePattern = (TracePattern) element;
        switch (TracePatternColumn.getByIndex(index)) {
        case ENABLED:
            break;
        case MODULE_NAME:
            return tracePattern.getModuleName();
        case FUNCTION_NAME:
            return tracePattern.getFunctionName();
        case ARITY:
            if (tracePattern.getArity() < 0) {
                return "";
            }
            return String.valueOf(tracePattern.getArity());
        case LOCAL:
            break;
        case MATCH_SPEC:
            return tracePattern.getMatchSpec().getFunctionString();
        default:
            break;
        }
        return "";
    }
View Full Code Here

            final Object firstElement = ((ITreeSelection) selection).getFirstElement();

            if (firstElement instanceof IErlFunction) {
                final IErlFunction function = (IErlFunction) firstElement;
                final TracePattern tracePattern = new TracePattern(true);
                tracePattern.setFunctionName(function.getFunctionName());
                tracePattern.setModuleName(ErlangEngine.getInstance()
                        .getModelUtilService().getModule(function).getModuleName());
                tracePattern.setArity(function.getArity());
                TraceBackend.getInstance().removeTracePattern(tracePattern);
            }
        }
        return null;
    }
View Full Code Here

            final Object firstElement = ((ITreeSelection) selection).getFirstElement();

            if (firstElement instanceof IErlFunction) {
                final IErlFunction function = (IErlFunction) firstElement;
                final TracePattern tracePattern = new TracePattern(true);
                tracePattern.setFunctionName(function.getFunctionName());
                tracePattern.setModuleName(ErlangEngine.getInstance()
                        .getModelUtilService().getModule(function).getModuleName());
                tracePattern.setLocal(true);
                tracePattern.setEnabled(true);
                TraceBackend.getInstance().addTracePattern(tracePattern);
            }
        }
        return null;
    }
View Full Code Here

            final Object firstElement = ((ITreeSelection) selection).getFirstElement();

            if (firstElement instanceof IErlFunction) {
                final IErlFunction function = (IErlFunction) firstElement;
                final TracePattern tracePattern = new TracePattern(true);
                tracePattern.setFunctionName(function.getFunctionName());
                tracePattern.setModuleName(ErlangEngine.getInstance()
                        .getModelUtilService().getModule(function).getModuleName());
                TraceBackend.getInstance().removeTracePattern(tracePattern);
            }
        }
        return null;
View Full Code Here

            final Object firstElement = ((ITreeSelection) selection).getFirstElement();

            if (firstElement instanceof IErlFunction) {
                final IErlFunction function = (IErlFunction) firstElement;
                final TracePattern tracePattern = new TracePattern(true);
                tracePattern.setFunctionName(function.getFunctionName());
                tracePattern.setModuleName(ErlangEngine.getInstance()
                        .getModelUtilService().getModule(function).getModuleName());
                tracePattern.setArity(function.getArity());
                tracePattern.setLocal(true);
                tracePattern.setEnabled(true);
                TraceBackend.getInstance().addTracePattern(tracePattern);
            }
        }
        return null;
    }
View Full Code Here

                .getImage(ISharedImages.IMG_OBJ_ADD));
        button.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                TraceBackend.getInstance().addTracePattern(new TracePattern(true));
            }
        });

        // "Remove" button
        button = new Button(container, SWT.PUSH | SWT.CENTER);
        button.setText("Remove pattern");
        button.setToolTipText("Remove selected trace pattern");
        button.setImage(PlatformUI.getWorkbench().getSharedImages()
                .getImage(ISharedImages.IMG_TOOL_DELETE));
        button.addSelectionListener(new SelectionAdapter() {

            @Override
            public void widgetSelected(final SelectionEvent e) {
                final TracePattern tracePattern = (TracePattern) ((IStructuredSelection) functionsTableViewer
                        .getSelection()).getFirstElement();
                if (tracePattern != null) {
                    TraceBackend.getInstance().removeTracePattern(tracePattern);
                }
            }
View Full Code Here

TOP

Related Classes of org.erlide.tracing.core.mvc.model.TracePattern

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.