Package org.openquark.cal.services

Examples of org.openquark.cal.services.Perspective


            if (typeConsApp == null || typeConsApp.isFunctionType()) {
                return null;
            }
           
            // Check visibility of the type.. (should we do this?)
            Perspective perspective = getValueNodeBuilderHelper().getPerspective();
            if (perspective.getTypeConstructor(typeConsApp.getName()) == null) {
                return null;
            }
           
            if (dataConstructor == null) {
                // No data constructor provided - we have to pick one, and create a default value.
               
                // If the perspective's working module has changed, the typeExprToNodeMap is no longer valid.
                if (perspective.getWorkingModule() != workingModule) {
                    workingModule = perspective.getWorkingModule();
                    typeExprToNodeMap.clear();
                }
               
                // TODOEL: ~HACK - we use the string-ified value as a key because we want it equals() in the map.
                String typeExprString = typeExpr.toString();
           
                // First, check if we've previously created a value node for this expression.
                if (typeExprToNodeMap.containsKey(typeExprString)) {

                    // We've already found a value node for this type, so just return it.
                    // If we're currently in the process of finding a value node for it, then this
                    // will end up returning null. That's ok since it indicates to the caller that
                    // there is a cycle.
                    DataConstructorValueNode valueNode = typeExprToNodeMap.get(typeExprString);
                    return valueNode != null ? valueNode.copyValueNode(typeExpr) : null;
               
                } else {
                    // Add a signal that we are building a value node for this type.
                    typeExprToNodeMap.put(typeExprString, null);
                }
               
                // Iterate over the visible data constructors.
                DataConstructor[] dataConsArray = perspective.getDataConstructorsForType(typeConsApp.getName());
               
                if (dataConsArray != null) {

                    for (final DataConstructor element : dataConsArray) {
View Full Code Here


                        return TypeExpr.canPatternMatch(gemType, returnTypeExpr, moduleTypeInfo);
                    }
                };
                gemViewer.addFilter(filter);

                Perspective newPerspective = new Perspective(perspective.getWorkspace(), perspective.getWorkingModule());
                newPerspective.setGemEntityViewer(gemViewer);

                Set<GemEntity> matchingGems = newPerspective.getVisibleGemEntities();

                // Extract the gem names from the list.
                List<String> gemNames = new ArrayList<String>();
                for (final GemEntity gemEntity : matchingGems) {
                    gemNames.add(gemEntity.getName().getQualifiedName());
View Full Code Here

                        return TypeExpr.canPatternMatch(gemType, returnTypeExpr, moduleTypeInfo);
                    }
                };
                gemViewer.addFilter(filter);

                Perspective newPerspective = new Perspective(perspective.getWorkspace(), perspective.getWorkingModule());
                newPerspective.setGemEntityViewer(gemViewer);

                Set<GemEntity> matchingGems = newPerspective.getVisibleGemEntities();

                // Extract the gem names from the list.
                List<String> gemNames = new ArrayList<String>();
                for (final GemEntity gemEntity : matchingGems) {
                    gemNames.add(gemEntity.getName().getQualifiedName());
View Full Code Here

        // Create the perspective
        CALWorkspace workspace = workspaceManager.getWorkspace();
        ModuleName workingModuleName = getInitialWorkingModuleName(workspace);
        MetaModule initialWorkingModule = workspace.getMetaModule(workingModuleName);
        perspective = new Perspective(workspace, initialWorkingModule);

        // Set the initial preferred working module name.
        setInitialPreferredWorkingModuleName();
       
        // Populate the gem browser and navigator.
View Full Code Here

                                newWorkingModuleName = getInitialWorkingModuleName(workspace);
                            }
                           
                            // Create the perspective
                            MetaModule initialWorkingModule = workspace.getMetaModule(newWorkingModuleName);
                            perspective = new Perspective(workspace, initialWorkingModule);
                           
                            // Clear the TableTop before resetting the runners, so that value editors can be closed
                            // by the original ValueEditorHierarchyManager.
                            newTableTop();
                           
View Full Code Here

        super(editorSection, key, title, description);
       
        contentPanel.setOpaque(false);
        contentPanel.setLayout(new GridLayout(1, 2));
       
        Perspective perspective = getEditorSection().getEditorPanel().getNavigatorOwner().getPerspective();
        NavTreeModel model = new NavTreeModel();
        model.load(perspective, TreeViewDisplayMode.FLAT_ABBREVIATED);
        otherFeatures.setModel(model);
        otherFeatures.collapseToModules();
        otherFeatures.getSelectionModel().setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
View Full Code Here

            MetaModule targetMetaModule = workspace.getMetaModule(typeCheckInfo.getModuleName());
           
            GemViewer gemViewer = new GemViewer();
            gemViewer.addFilter(new UnorderedTypeMatchFilter(inputExpr, outputExpr, targetMetaModule.getTypeInfo(), true));

            Perspective perspective = new Perspective(workspace, targetMetaModule);
            perspective.setGemEntityViewer(gemViewer);
           
            return getVisibleGemsFromPerspective(perspective);  
        }
View Full Code Here

    public ExpressionPanel(NavFrameOwner owner) {
       
        this.owner = owner;

        // set default module to be as defined by perspective
        Perspective perspective = owner.getPerspective();
        this.moduleTypeInfo = perspective.getWorkingModuleTypeInfo();
       
        // Create and initialize components
       
        this.calEditor = new AdvancedCALEditor(moduleTypeInfo, perspective.getWorkspace());
        this.codeSyntaxListener = new GemCodeSyntaxListener(perspective);
        try {
            this.calEditor.addCALSyntaxStyleListener(codeSyntaxListener);
        } catch (TooManyListenersException e) {
            // The only effect this has on the editor is that custom text coloring does not work;
View Full Code Here

     * @return a combo box with the <code>ModuleName</code>s of all modules in the perspective
     */
    public static JComboBox getModuleContextComboBox(NavFrameOwner owner) {
       
        List<ModuleName> modules = new ArrayList<ModuleName>();
        Perspective perspective = owner.getPerspective();
       
        // get names of visible modules
        for (final MetaModule metaModule : perspective.getVisibleMetaModules()) {
            modules.add(metaModule.getName());
        }
       
        // get names of invisible modules
        for (final MetaModule metaModule : perspective.getInvisibleMetaModules()) {
            modules.add(metaModule.getName());
        }
       
        // sort alphabetically
        Collections.sort(modules);
View Full Code Here

TOP

Related Classes of org.openquark.cal.services.Perspective

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.