Examples of ExtendedUndoableEditSupport


Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

     * @return boolean true if any inputs were unburnt
     */
    boolean doUnburnAutomaticallyBurnedInputsUserAction(Gem gem) {

        // Increment the update level to aggregate any burns with connection change edits.
        ExtendedUndoableEditSupport undoableEditSupport = tableTop.getUndoableEditSupport();
        undoableEditSupport.beginUpdate();
       
        boolean anyUnburnt = false;

        int numInputs = gem.getNInputs();
        for (int i = 0; i < numInputs; i++) {
            Gem.PartInput input = gem.getInputPart(i);
            if (getBurnStatus(input) == AutoburnLogic.BurnStatus.AUTOMATICALLY_BURNT) {
                doSetInputBurnStatusUserAction(input, AutoburnLogic.BurnStatus.NOT_BURNT);
                anyUnburnt = true;
            }
        }

        if (anyUnburnt) {
            // Decrement the update level.  This will post the edit if the level is zero.
            undoableEditSupport.endUpdate();
            updateForBurn();
        } else {
            // Discard the edit because nothing happened.
            undoableEditSupport.endUpdateNoPost();
        }

        return anyUnburnt;
    }
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

                message = GemCutter.getResourceString("UnburnWarning");
            } else {
                message = GemCutter.getResourceString("BurnWarning");
            }
           
            ExtendedUndoableEditSupport undoableEditSupport = tableTop.getUndoableEditSupport();

            // Show the warning.  Ask what to do..
            int option = JOptionPane.showConfirmDialog(tableTop.getTableTopPanel(), message, titleString,
                                                       JOptionPane.YES_NO_OPTION, javax.swing.JOptionPane.WARNING_MESSAGE);

            // only do anything if the user answered yes.
            if (option == JOptionPane.YES_OPTION) {
                // Increment the update level to aggregate the edits.
                undoableEditSupport.beginUpdate();

                // disconnect the output and change the burnt state.
                Connection conn = dConn.getConnection();
                tableTop.doDisconnectUserAction(conn);
                doSetInputBurnStatusUserAction(inputToBurn, inputToBurn.isBurnt() ? AutoburnLogic.BurnStatus.NOT_BURNT : AutoburnLogic.BurnStatus.MANUALLY_BURNT);
                updateForBurn();

                // Decrement the update level.  This will post the edit if the level is zero.
                undoableEditSupport.endUpdate();
           
                return true;

            } else {
                // un-highlight the output connection
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

     * @param gem the gem whose args to set autoburnt
     * @param argumentsToBurn the array of argument indices to burn, with respect to the inputs of the gem
     */
    private void doAutoburnUserAction(Gem gem, int[] argumentsToBurn) {

        ExtendedUndoableEditSupport undoableEditSupport = tableTop.getUndoableEditSupport();

        // Increment the update level to aggregate any burns.
        undoableEditSupport.beginUpdate();
       
        // set the burnable inputs
        int numBurntArgs = argumentsToBurn.length;
        for (int i = 0; i < numBurntArgs; i++) {
            int argIndex = argumentsToBurn[i];
            Gem.PartInput input = gem.getInputPart(argIndex);
            doSetInputBurnStatusUserAction(input, AutoburnLogic.BurnStatus.AUTOMATICALLY_BURNT);
        }

        if (numBurntArgs > 0) {
            // Decrement the update level.  This will post the edit if the level is zero.
            undoableEditSupport.endUpdate();
            updateForBurn();
        } else {
            // Discard the edit because nothing happened.
            undoableEditSupport.endUpdateNoPost();
        }
    }
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

        collectorArgumentStateEditable = new CollectorArgumentStateEditable(gemGraph);
        targetDisplayedCollector = createDisplayedGem(gemGraph.getTargetCollector(), new Point());

        gemEventListener = new GemEventListener();
        codeGemEditHandler = new TableTopCodeGemEditHandler();
        undoableEditSupport = new ExtendedUndoableEditSupport(this);
        burnManager = new TableTopBurnManager(this);

        // Add the gem event listener as a state change listener.
        addStateChangeListener(gemEventListener);
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            stopIntellicutPanel();
            return;
        }

        // Increment the update level for the edit undo.  This will aggregate any gem addition, connection, and burnings..
        ExtendedUndoableEditSupport tableTopUndoableEditSupport = gemCutter.getTableTop().getUndoableEditSupport();
        tableTopUndoableEditSupport.beginUpdate();
       
        // Get a new displayed gem.
        Object selectedItem = ((IntellicutListEntry) intellicutPanel.getIntellicutList().getSelectedValue()).getData();
        DisplayedGem newDisplayedGem = getDisplayedGem(selectedItem, location);

        // Connect the gem.
        gemCutter.getIntellicutManager().attemptIntellicutAutoConnect(newDisplayedGem);
        gemCutter.getIntellicutManager().stopIntellicut();
       
        tableTopUndoableEditSupport.endUpdate();

        // Move the new gem into view and repaint the table top.
        gemCutter.getTableTopPanel().scrollRectToVisible(newDisplayedGem.getBounds())
        gemCutter.getTableTopPanel().repaint();
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

               
                showMonitor();
                setStatus(GemCutterMessages.getString("CalculatingModificationsStatus"));
               
                try {
                    ExtendedUndoableEditSupport undoableEditSupport = tableTop.getUndoableEditSupport();
                    undoableEditSupport.beginUpdate();
           
                    CompilerMessageLogger logger = new MessageLogger();
                    typeDeclsAdder.calculateModifications(logger);
                   
                    if(logger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
                        closeMonitor();
                        showCompilationErrors(logger, getResourceString("ErrorWhileCalculatingModifications"));
                        return;
                    }
                   
                    incrementProgress();
                    setStatus(GemCutterMessages.getString("ApplyingModificationsStatus"));
                   
                    typeDeclsAdder.apply(logger);
                   
                    if(logger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
                        closeMonitor();
                        showCompilationErrors(logger, getResourceString("ErrorWhileApplyingModifications"));
                        return;
                    }
                   
                    incrementProgress();
                    setStatus(GemCutterMessages.getString("RecompilingStatus"));
   
                    recompileWorkspace(true);
                   
                    if(logger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
                        closeMonitor();
                        showCompilationErrors(logger, getResourceString("ErrorWhileRecompiling"));
                        return;
                    }
                                       
                    incrementProgress();
                    setStatus(GemCutterMessages.getString("SuccessStatus"));
   
                    UndoableRefactoringEdit addTypeDeclsEdit = new UndoableRefactoringEdit(GemCutter.this, typeDeclsAdder, GemCutterMessages.getString("AddTypedeclsPresentationName"));
                    undoableEditSupport.setEditName(addTypeDeclsEdit.getPresentationName());
                    undoableEditSupport.postEdit(addTypeDeclsEdit);
           
                    // End the update.
                    undoableEditSupport.endUpdate();
                   
                    // Make sure that the dialog is active for long enough to be visible
                    try {
                        sleep(750);
                    } catch(InterruptedException e) {
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

               
                showMonitor();
                setStatus(GemCutterMessages.getString("CalculatingModificationsStatus"));
               
                try {
                    ExtendedUndoableEditSupport undoableEditSupport = tableTop.getUndoableEditSupport();
                    undoableEditSupport.beginUpdate();
           
                    CompilerMessageLogger logger = new MessageLogger();
                    importCleaner.calculateModifications(logger);
                   
                    if(logger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
                        closeMonitor();
                        showCompilationErrors(logger, getResourceString("ErrorWhileCalculatingModifications"));
                        return;
                    }
                   
                    incrementProgress();
                    setStatus(GemCutterMessages.getString("ApplyingModificationsStatus"));
                   
                    importCleaner.apply(logger);
                   
                    if(logger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
                        closeMonitor();
                        showCompilationErrors(logger, getResourceString("ErrorWhileApplyingModifications"));
                        return;
                    }
                   
                    incrementProgress();
                    setStatus(GemCutterMessages.getString("RecompilingStatus"));
   
                    recompileWorkspace(true);
                   
                    if(logger.getMaxSeverity().compareTo(CompilerMessage.Severity.ERROR) >= 0) {
                        closeMonitor();
                        showCompilationErrors(logger, getResourceString("ErrorWhileRecompiling"));
                        return;
                    }
                   
                    incrementProgress();
                    setStatus(GemCutterMessages.getString("SuccessStatus"));
   
                    UndoableRefactoringEdit cleanImportsEdit = new UndoableRefactoringEdit(GemCutter.this, importCleaner, GemCutterMessages.getString("CleanImportsPresentationName"));
                    undoableEditSupport.setEditName(cleanImportsEdit.getPresentationName());
                    undoableEditSupport.postEdit(cleanImportsEdit);
           
                    // End the update.
                    undoableEditSupport.endUpdate();
                   
                    // Make sure that the dialog is active for long enough to be visible
                    try {
                        sleep(750);
                    } catch(InterruptedException e) {
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

        if (gemCutter == null) {
            throw new NullPointerException();
        }
       
        this.gemCutter = gemCutter;
        this.undoableEditSupport = new ExtendedUndoableEditSupport(this);
    }
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            this.collector = collector;
        }
       
        public void actionPerformed(ActionEvent evt) {
            DisplayedGem dGem = tableTop.createDisplayedReflectorGem(currentPopupLocation, collector);
            ExtendedUndoableEditSupport editSupport = tableTop.getUndoableEditSupport();
           
            editSupport.beginUpdate();
            tableTop.doAddGemUserAction(dGem, currentPopupLocation);
            editSupport.setEditName(GemCutterMessages.getString("UndoText_Add", dGem.getDisplayText()));
            editSupport.endUpdate();
        }
View Full Code Here

Examples of org.openquark.gems.client.utilities.ExtendedUndoableEditSupport

            // popups should not be shown in most drag states
            popupShouldShow = false;
           
            // find the drag mode appropriate to the place on which we initiated the drag
            DragMode nextMode = getDragModeForDragOrigin();
            ExtendedUndoableEditSupport undoableEditSupport = tableTop.getUndoableEditSupport();

            if (nextMode == TableTopDragMode.GEMDRAGGING && SwingUtilities.isLeftMouseButton(e)) {

                if (e.isControlDown()) {
                    // Ensure that the gem beneath the cursor is selected when we begin the drag.
                    DisplayedGem clickedGem = tableTop.getGemUnder(pressedAt);
                    tableTop.selectDisplayedGem(clickedGem, false);
                    tableTop.setFocusedDisplayedGem(clickedGem);
                    shiftSelectionAnchorGem = clickedGem;
                   
                    repaint();
                    nextMode = TableTopDragMode.CTRLDRAGGING;
                }

                // dragging gems around
                setDragMode(nextMode);
               
                // Create the dragList of selected Gems
                dragList = tableTop.getSelectedDisplayedGems();
               
            } else if (nextMode == TableTopDragMode.CONNECTING) {

                // connecting up gems
                dragMode = nextMode;

                // Increment the update level to aggregate any burns with connection change edits.
                undoableEditSupport.beginUpdate();
               
            } else if (nextMode == TableTopDragMode.DISCONNECTING) {
               
                // disconnecting gems
                dragMode = nextMode;

                // Increment the update level to aggregate any unburns with connection change edits.
                undoableEditSupport.beginUpdate();
               
                // Get the part which the user pressed.  Should be connectable!
                DisplayedPartConnectable partPressed =
                    (DisplayedPartConnectable)tableTop.getGemPartUnder(pressedAt);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.