Package org.openquark.cal.services

Examples of org.openquark.cal.services.GemEntity


         * @throws IOException
         * @see javax.swing.TransferHandler#importData(javax.swing.JComponent,
         *      java.awt.datatransfer.Transferable)
         */
        private boolean importGemEntity(JComponent c, Transferable t) throws UnsupportedFlavorException, IOException {
            GemEntity entity = (GemEntity)t.getTransferData(SingleGemEntityDataFlavor.getSingleGemEntityDataFlavor());

            AdvancedCALEditor editor = (AdvancedCALEditor)c;
            editor.getInputContext().endComposition();
            // TODO: If Gem Entities ever contain more than functional agents,
            // category needs to be updated
            SourceIdentifier.Category category = (entity.isDataConstructor()
                    ? SourceIdentifier.Category.DATA_CONSTRUCTOR
                    : SourceIdentifier.Category.TOP_LEVEL_FUNCTION_OR_CLASS_METHOD);
            editor.replaceSelection(" ");
            insertEditorQualification(editor, entity.getName(), category, userQualifiedIdentifiers, false);
            return true;

        }
View Full Code Here


           
            return;
        }
       
        // If this was a functional agent, then we need to update its gems on the table top.
        GemEntity entity = getPerspective().getWorkspace().getGemEntity(address.toFeatureName().toQualifiedName());
        FunctionalAgentMetadata metadata = (FunctionalAgentMetadata) NavAddressHelper.getMetadata(this, address.withAllStripped());
        ArgumentMetadata[] argMetadata = metadata.getArguments();
       
        for (final Gem gem : gemCutter.getTableTop().getGemGraph().getGems()) {
           
            if (gem instanceof FunctionalAgentGem) {
               
                GemEntity gemEntity = ((FunctionalAgentGem) gem).getGemEntity();
               
                if (gemEntity.equals(entity)) {

                    // We need to update the inputs of this gem
                    PartInput[] inputs = gem.getInputParts();
                   
                    for (int i = 0; i < inputs.length; i++) {
View Full Code Here

            Point oldLocation = displayedGemOriginals[i].getLocation();
            Point location = new Point(oldLocation.x - referenceOrigin.x, oldLocation.y - referenceOrigin.y);
          
            if (gem instanceof FunctionalAgentGem) {
                // get the SC behind this gem and produce a new one
                GemEntity gemEntity = ((FunctionalAgentGem)gem).getGemEntity();
                newDisplayedGems[i] = tableTop.createDisplayedFunctionalAgentGem(location, gemEntity);
               
            } else if (gem instanceof CodeGem) {
                 // Clone this codeGem and create a new DisplayedGem to associate with it
                 CodeGem clone = ((CodeGem)gem).makeCopy();
View Full Code Here

        ////
        /// Run checks on the specified entry points. Currently we only support functional agents with the signature [String]->()
        //
       
        // Check that the entry point exists.
        final GemEntity entryPointEntity = workspaceManager.getWorkspace().getGemEntity(entryPointName);
        if (entryPointEntity == null) {
            throw new InvalidConfigurationException(StandaloneJarBuilderMessages.getString("entryPointDoesNotExist", entryPointName.getQualifiedName()));
        }
       
        // Check that the entry point has the right type.
        final ModuleName entryPointModuleName = entryPointName.getModuleName();
        final TypeExpr entryPointType = entryPointEntity.getTypeExpr();
       
        final TypeExpr requiredType = workspaceManager.getTypeChecker().getTypeFromString("[Prelude.String] -> ()", entryPointModuleName, null);
       
        if (!TypeExpr.canPatternMatch(entryPointType, requiredType, workspaceManager.getModuleTypeInfo(entryPointModuleName))) {
            throw new InvalidConfigurationException(StandaloneJarBuilderMessages.getString("incompatibleType", entryPointName.getQualifiedName(), entryPointType.toString(), requiredType.toString()));
View Full Code Here

               
                if (navigatorOwner != null) {
   
                    final NavAddress address;
                    if (node instanceof GemTreeNode) {
                        GemEntity gemEntity = (GemEntity) node.getUserObject();
                        address = NavAddress.getAddress(gemEntity);
                        navigatorOwner.displayMetadata(address, false);
                           
                    } else if (node instanceof GemDrawer) {
                        final GemDrawer gemDrawer = (GemDrawer) node;
View Full Code Here

                newPath = new TreePath(tempNewPath);
             
            // Leaf nodes are reconstructed therefore need to compare the user objects to find the correct path.
            } else if (lastPathComponent instanceof GemTreeNode) {
              
                GemEntity lastNodeObj = (GemEntity)((GemTreeNode) lastPathComponent).getUserObject();

                if (!((BrowserTreeModel)getModel()).getShowPublicGemsOnly() || lastNodeObj.getScope().isPublic()){

                    // Finding the new tree node for the gem entity
                    GemTreeNode child = getNodeFromEntity(parentNode, lastNodeObj);
                    if (child != null){  // for the case of a search node, the child can become null
                        newPath = new TreePath(child.getPath());
View Full Code Here

     * @return the child if the child's gem entity is public.
     * Otherwise null.
     */
    private TreePath getPublicGemTreeNodePath(TreeNode parentNode, GemTreeNode oldGemTreeNode) {

        GemEntity childUserObject = (GemEntity)oldGemTreeNode.getUserObject();
                 
        if (childUserObject.getScope().isPublic()) {
            GemTreeNode sibling = getNodeFromEntity(parentNode, childUserObject);
            return new TreePath(sibling.getPath());
        }
        return null;
    }
View Full Code Here

            BrowserTreeNode node = (BrowserTreeNode) path.getLastPathComponent();
            
            if (node instanceof GemTreeNode && node.isLeaf ()) {
                BrowserTreeModel browserTreeModel = (BrowserTreeModel) getModel();
                ScopedEntityNamingPolicy namingPolicy = new UnqualifiedUnlessAmbiguous(browserTreeModel.getPerspective().getWorkingModuleTypeInfo());
                GemEntity gemEntity = (GemEntity)node.getUserObject()
                return ToolTipHelpers.getEntityToolTip(gemEntity, namingPolicy, this);
               
            } else if (node instanceof GemDrawer) {
               
                BrowserTreeModel browserTreeModel = (BrowserTreeModel)getModel();
View Full Code Here

       
            // For each path, check it's a supercombinator and add to the string
            //   Note: (for now) we don't add sc's that aren't visible..
            for (final TreePath treePath : paths) {
                // Get the fully qualified name of the supercombinator represented by this path
                GemEntity gemEntity = getEntityFromPath(treePath);
       
                // If this is non-null, emit the name
                if (gemEntity != null && ((BrowserTreeModel)getModel()).isVisibleGem(gemEntity)) {           
                    // Add the supercombinator
                    selectedGems.add(gemEntity);
View Full Code Here

           
            // Go thru the paths and see which nodes were dragged
            for (int i = 0; i < paths.length && nodes[1] == -1; i++) {

                // Get the entity represented by this path
                GemEntity gemEntity = getEntityFromPath(paths[i]);
       
                // If the sc is non-null see if it is a data constructor or just a regular sc.
                if (gemEntity != null) {
                    boolean isConstructor = gemEntity.isDataConstructor();
                    gemCount++;
                   
                    if (nodes[0] == -1) {
                        // We have found our first node so remember the details
                        nodes[0] = i;
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.