Package com.volantis.mcs.eclipse.builder.editors.policies

Examples of com.volantis.mcs.eclipse.builder.editors.policies.PolicyEditorContext


    }

    public void setPolicyBuilder(PolicyBuilder newBuilder) {
        // Get the previously selected variant builder so that we can attempt
        // to reselect it after the change.
        PolicyEditorContext context = (PolicyEditorContext) getContext();
        Proxy previousSelectedProxy = context.getSelectedVariant();
        VariantBuilder previouslySelectedBuilder =
                previousSelectedProxy == null ?
                null : (VariantBuilder) previousSelectedProxy.getModelObject();

        Proxy policyProxy = getContext().getInteractionModel();
        policyProxy.setReadWriteState(ReadWriteState.READ_WRITE);
        // Because the merge process may have modified the existing model
        // directly before calling this method, we must force the proxy's
        // structure to be updated to ensure new variants are added and
        // appropriate change events are fired.
        policyProxy.setModelObject(newBuilder, true);
        try {
            context.getPolicyFileAccessor().updatePolicyProxyState(
                    policyProxy, context.getProject());
        } catch (PolicyFileAccessException pfae) {
            EclipseCommonPlugin.logError(ABPlugin.getDefault(),
                    getClass(), pfae);
        }

        if (previouslySelectedBuilder == null) {
            context.setSelectedVariant(null);
        } else {
            BeanProxy modelProxy = (BeanProxy) context.getInteractionModel();
            ListProxy variants = (ListProxy)
                    modelProxy.getPropertyProxy(PolicyModel.VARIANTS);
            boolean setSelection = false;
            for (int i = 0; !setSelection && i < variants.size(); i++) {
                VariantBuilder builder = (VariantBuilder)
                        variants.getItemProxy(i).getModelObject();
                if (previouslySelectedBuilder.equals(builder)) {
                    context.setSelectedVariant((BeanProxy) variants.getItemProxy(i));
                    setSelection = true;
                }
            }

            if (!setSelection) {
                context.setSelectedVariant(null);
            }
        }

        editorContext.refreshCachedDOM();
    }
View Full Code Here


    // Javadoc inherited
    public void setPolicyBuilder(PolicyBuilder newBuilder) {
        // Get the previously selected variant builder so that we can attempt
        // to reselect it after the change.
        PolicyEditorContext context = (PolicyEditorContext) getContext();
        Proxy previousSelectedProxy = context.getSelectedVariant();
        VariantBuilder previouslySelectedBuilder =
                previousSelectedProxy == null ?
                null : (VariantBuilder) previousSelectedProxy.getModelObject();

        Proxy policyProxy = getContext().getInteractionModel();
        policyProxy.setReadWriteState(ReadWriteState.READ_WRITE);
        // Because the merge process may have modified the existing model
        // directly before calling this method, we must force the proxy's
        // structure to be updated to ensure new variants are added and
        // appropriate change events are fired.
        policyProxy.setModelObject(newBuilder, true);
        try {
            context.getPolicyFileAccessor().updatePolicyProxyState(
                    policyProxy, context.getProject());
        } catch (PolicyFileAccessException pfae) {
            EclipseCommonPlugin.logError(BuilderPlugin.getDefault(),
                    getClass(), pfae);
        }

        if (previouslySelectedBuilder == null) {
            context.setSelectedVariant(null);
        } else {
            BeanProxy modelProxy = (BeanProxy) context.getInteractionModel();
            ListProxy variants = (ListProxy)
                    modelProxy.getPropertyProxy(PolicyModel.VARIANTS);
            boolean setSelection = false;
            for (int i = 0; !setSelection && i < variants.size(); i++) {
                VariantBuilder builder = (VariantBuilder)
                        variants.getItemProxy(i).getModelObject();
                if (previouslySelectedBuilder.equals(builder)) {
                    context.setSelectedVariant((BeanProxy) variants.getItemProxy(i));
                    setSelection = true;
                }
            }

            if (!setSelection) {
                context.setSelectedVariant(null);
            }
        }
    }
View Full Code Here

    }

    protected List getCategories() {
        PolicyFactory policyFactory = PolicyFactory.getDefaultInstance();

        PolicyEditorContext context = (PolicyEditorContext)getContext();

        List categories = new ArrayList();
        List categoryValues = context.getCategoryValues();
        if (categoryValues != null && !categoryValues.isEmpty()) {
            Iterator it = categoryValues.iterator();
            while (it.hasNext()) {
                String value = (String) it.next();
                CategoryReference categoryRef =
View Full Code Here

TOP

Related Classes of com.volantis.mcs.eclipse.builder.editors.policies.PolicyEditorContext

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.