Package javax.swing.undo

Examples of javax.swing.undo.StateEdit


     *            the module name, or null
     */
    void changeQualificationToArgument(String qualificationName,
            ModuleName qualificationModuleOrNull) {

        StateEdit stateEdit = null;
        PartInput[] oldInputs = null;
        if (recordingEditStates) {
            stateEdit = new StateEdit(CodeGemEditor.this, GemCutter.getResourceString("UndoText_CodeGemArgFormChange"));
            oldInputs = codeGem.getInputParts();
        }

        // Add qualification to free variables
        varNamesWhichAreArgs.add(qualificationName);
        if (qualificationModuleOrNull == null || !qualificationModuleOrNull.equals(perspective.getWorkingModuleName())) {
            userQualifiedIdentifiers.removeQualification(qualificationName, SourceIdentifier.Category.TOP_LEVEL_FUNCTION_OR_CLASS_METHOD);
        }

        // re-evaluate the gem based on the new variable form
        doSyntaxSmarts();

        if (recordingEditStates) {
            stateEdit.end();
            if (editHandler != null) {
                editHandler.definitionEdited(this, oldInputs, stateEdit);
            }
        }
    }
View Full Code Here


     *            identifier form
     */
    void changeQualificationModule(String unqualifiedName,
            ModuleName newModule, SourceIdentifier.Category qualificationForm) {

        StateEdit stateEdit = null;
        PartInput[] oldInputs = null;
        if (recordingEditStates) {
            stateEdit = new StateEdit(CodeGemEditor.this, GemCutter.getResourceString("UndoText_CodeGemQualificationModuleChange"));
            oldInputs = codeGem.getInputParts();
        }

        // If we are switching to the current module, make sure all arguments
        // are switched also
        if (newModule.equals(perspective.getWorkingModuleName())) {
            varNamesWhichAreArgs.remove(unqualifiedName);
        }

        // Change the module mapping

        CodeQualificationMap qualificationMap = userQualifiedIdentifiers;
        qualificationMap.removeQualification(unqualifiedName, qualificationForm);
        qualificationMap.putQualification(unqualifiedName, newModule, qualificationForm);

        // re-evaluate the gem based on the new variable form
        doSyntaxSmarts();

        if (recordingEditStates) {
            stateEdit.end();
            if (editHandler != null) {
                editHandler.definitionEdited(this, oldInputs, stateEdit);
            }
        }
    }
View Full Code Here

                // Get the state of the recording edits flag
                final boolean recordingEdits = CodeGemEditor.this.recordingEditStates;

                // The following objects will hold the current editor state

                final StateEdit stateEdit = new StateEdit(CodeGemEditor.this, GemCutter.getResourceString("UndoText_CodeChange"));
                final PartInput[] oldInputs = codeGem.getInputParts();

                // We will disable the recording edits flag while the renaming occurs.
                // Once renaming completes, we commit an edit if the renaming is
                // not canceled, then reenable the recording edits flag.

                // Because the editor has a parseTimer checking code every PARSE_TIMER_PERIOD ms,
                // we cannot enable recording edits flag before this time (since an edit state may be
                // recorded). Thus we will enable the recording edit states flag only after the next
                // possible parseTimer tick, by use of the following timer.

                final Timer editEnableTimer = new Timer(PARSE_TIMER_PERIOD + 1,
                        new ActionListener() {
                            public void actionPerformed(ActionEvent e) {

                                CodeGemEditor.this.recordingEditStates = recordingEdits;
                            }
                        });
                editEnableTimer.setRepeats(false);

                // Prepare commit/cancel listener for the symbol renamer

                AdvancedCALEditor.SymbolRenamerListener renameListener = new AdvancedCALEditor.SymbolRenamerListener() {

                    public void renameCanceled(String oldName) {

                        // Abort the state edit
                        stateEdit.die();

                        // Enable recording edits after the next parse tick
                        editEnableTimer.start();
                    }

                    public void renameDone(String oldName, String newName) {

                        // Post the edit to the edit handler.
                        stateEdit.end();
                        if (CodeGemEditor.this.editHandler != null) {
                            CodeGemEditor.this.editHandler.definitionEdited(CodeGemEditor.this, oldInputs, stateEdit);
                        }

                        // Enable recording edits after the next parse tick
View Full Code Here

     * @see org.openquark.gems.client.navigator.NavFrameOwner#editMetadata(org.openquark.gems.client.navigator.NavAddress)
     */
    public void editMetadata(NavAddress address) {
        navFrame.editMetadata(address);
        currentEditAddress = address;
        stateEdit = new StateEdit(new MetadataStateEditable(address));
    }
View Full Code Here

        undoableEditSupport.beginUpdate();
        undoableEditSupport.setEditName(GemCutter.getResourceString("UndoText_ChangeGemProperties"));
        undoableEditSupport.postEdit(stateEdit);
        undoableEditSupport.endUpdate();

        stateEdit = new StateEdit(new MetadataStateEditable(address));
       
        updateInputNames(address);
        nameCheckTableTop();
       
        navFrame.refreshMetadata(currentEditAddress);
View Full Code Here

                    throw new IllegalStateException("failed to restore saved metadata state");
                }

                // Update the state edit if the currently edited metadata was changed.
                if (address.equals(currentEditAddress)) {
                    stateEdit = new StateEdit(new MetadataStateEditable(address));
                }

                // Check the table top names once the undo completes.
                // We need to do it after the undo so GemGraph checking is enabled again.
                SwingUtilities.invokeLater(new Runnable() {
View Full Code Here

TOP

Related Classes of javax.swing.undo.StateEdit

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.