Package org.openquark.cal.services

Examples of org.openquark.cal.services.GemEntity


            } else if (e.getSource() == viewProperties) {
               
                IntellicutListEntry item = (IntellicutListEntry) intellicutPanel.getIntellicutList().getSelectedValue();
               
                if (item.getData() instanceof GemEntity) {
                    GemEntity gemEntity = (GemEntity) item.getData();
                    gemCutter.getNavigatorOwner().displayMetadata(gemEntity, true);
                }               
            }
        }
View Full Code Here


   
    /**
     * A regression test for TypeExpr.toSourceModel().
     */
    public void testToSourceModelNotFavoringPreferredNames() {
        final GemEntity entity = leccCALServices.getGemEntity(QualifiedName.make("Cal.Test.JUnitSupport.TypeExpr_Test_Support", "allPairs"));
       
        final String typeString = entity.getTypeExpr().toString(false, ScopedEntityNamingPolicy.FULLY_QUALIFIED);
        final SourceModel.TypeSignature typeSourceModel = entity.getTypeExpr().toSourceModel(false, ScopedEntityNamingPolicy.FULLY_QUALIFIED);
        final String typeStringFromSourceModel = typeSourceModel.toSourceText();
       
        assertEquals(typeString, typeStringFromSourceModel);
    }
View Full Code Here

   
    /**
     * A regression test for TypeExpr.toSourceModel().
     */
    public void testToSourceModelFavoringPreferredNames() {
        final GemEntity entity = leccCALServices.getGemEntity(QualifiedName.make("Cal.Test.JUnitSupport.TypeExpr_Test_Support", "allPairs"));
       
        final String typeString = entity.getTypeExpr().toString(true, ScopedEntityNamingPolicy.FULLY_QUALIFIED);
        final SourceModel.TypeSignature typeSourceModel = entity.getTypeExpr().toSourceModel(true, ScopedEntityNamingPolicy.FULLY_QUALIFIED);
        final String typeStringFromSourceModel = typeSourceModel.toSourceText();
       
        assertEquals(typeString, typeStringFromSourceModel);
    }
View Full Code Here

        intellicutPanel.loadListModel();
        intellicutPanel.setBorder(null);
        intellicutPanel.setMoveable(false);
       
        // Select the correct item in the list.
        GemEntity gemEntity = (GemEntity) getValueNode().getValue();
        IntellicutListEntry listEntry = adapter.getListEntryForData(gemEntity);
       
        if (listEntry != null) {
            intellicutPanel.getIntellicutList().setSelectedValue(listEntry, true);
        } else {
View Full Code Here

       
        IntellicutListEntry listEntry = (IntellicutListEntry) intellicutPanel.getIntellicutList().getSelectedValue();

        if (listEntry != null) {
           
            GemEntity gemEntity = (GemEntity) listEntry.getData();
            ModuleTypeInfo currentModuleInfo = valueEditorManager.getPerspective().getWorkingModuleTypeInfo();
            TypeExpr valueNodeType = getValueNode().getTypeExpr();
            TypeExpr functionType = gemEntity.getTypeExpr();
            TypeExpr unifiedType;
           
            try {
                unifiedType = TypeExpr.unify(valueNodeType, functionType, currentModuleInfo);
            } catch (TypeException e) {
View Full Code Here

        Collection<GemEntity> drawingGems = calHelper.findGemsOfType("Cal.Experimental.Graphics.Drawing.Graphics -> Cal.Experimental.Graphics.Drawing.Graphics");

        final JComboBox drawFnCombo = new JComboBox(new Vector<GemEntity>(drawingGems));
        drawFnCombo.addActionListener(new ActionListener() {
                public void actionPerformed(ActionEvent e) {
                    GemEntity gemEntity = (GemEntity) drawFnCombo.getSelectedItem();
                    currentDrawExpr = Expr.makeGemCall(gemEntity.getName());
                    repaint();
                }
            });
        drawFnCombo.setRenderer(new DefaultListCellRenderer() {
            private static final long serialVersionUID = -2433581223714718290L;

                @Override
                public Component getListCellRendererComponent(
                        JList list,
                        Object value,
                        int index,
                        boolean isSelected,
                        boolean cellHasFocus) {
                    JLabel label = (JLabel) super.getListCellRendererComponent(list, value, index, isSelected, cellHasFocus);
   
                    GemEntity gemEntity = (GemEntity) value;
                    label.setText(gemEntity.getName().getQualifiedName());
                    return label;
                }
            });

        // Set the initial drawing gem.
        if (drawingGems.isEmpty()) {
            throw new BusinessObjectsException("No drawing gems are available.");
        }
        GemEntity initialDrawGem = drawingGems.iterator().next();
        currentDrawExpr = Expr.makeGemCall(initialDrawGem.getName());

        this.getContentPane().setLayout(new BorderLayout());
        this.getContentPane().add(drawFnCombo, BorderLayout.NORTH);
        this.getContentPane().add(new DrawPanel());
       
View Full Code Here

     * Tests the version of getAutoburnInfo() that takes a gem entity.
     */
    public void testAutoburnGemEntity() {
       
        // We'll use List.map for the source entity and [a] -> [b] for the destination
        GemEntity gemEntity = calServices.getCALWorkspace().getGemEntity(CAL_List.Functions.map);
        TypeExpr destType = calServices.getTypeFromString(testModule, "[a] -> [b]");
       
        AutoburnInfo autoburnInfo = AutoburnLogic.getAutoburnInfo(destType, gemEntity, calServices.getTypeCheckInfo(testModule));
        assertEquals(AutoburnLogic.AutoburnUnifyStatus.UNAMBIGUOUS, autoburnInfo.getAutoburnUnifyStatus());
       
View Full Code Here

        Icon overlayImage = getBurnImageForEntry(listEntry);

        // Add scope decal (public, protected, private) underneath if entry is scoped
        if (listData instanceof GemEntity) {
            // Uses cache to store icons already combined
            GemEntity entity = (GemEntity) listData;
            Icon baseGemIcon = null;
            Icon overlayIcon = overlayImage;
            Map<Icon, Icon> cache = null;

            if (entity.getScope().isPublic()) {
                cache = imageCache_public;
                baseGemIcon = scopePublicIcon_shifted;

            } else if (entity.getScope().isProtected()) {
                cache = imageCache_protected;
                baseGemIcon = scopeProtectedIcon_shifted;

            } else { // entity.getScope().isPrivate()
                cache = imageCache_private;
View Full Code Here

    private Icon getIconWithoutBurnStatus(IntellicutListEntry listEntry) {

        Object listData = listEntry.getData();

        if (listData instanceof GemEntity) {
            GemEntity entity = (GemEntity) listData;
            if (entity.getScope().isPublic()) {
                return scopePublicIcon;
            } else if (entity.getScope().isProtected()) {
                return scopeProtectedIcon;
            } else {
                return scopePrivateIcon;
            }
        } else if (listData instanceof CollectorGem) {
View Full Code Here

        String emptyModuleStatusStr = "";   // The string that will be displayed in the status text if the module is empty
       
        if( entityType == EntityType.Gem ) {
           
            for (int i = 0, n = module.getNGemEntities(); i < n; i++) {
                GemEntity entity = module.getNthGemEntity(i);           
                entityList.add(entity.getName().getUnqualifiedName());
            }
            emptyModuleComboStr = GemCutter.getResourceString("RNRD_EmptyModuleComboGem");
            emptyModuleStatusStr = GemCutter.getResourceString("RNRD_EmptyModuleStatusGem");
           
        } else if ( entityType == EntityType.TypeConstructor ) {
View Full Code Here

TOP

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

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.