Java Code Examples for javax.swing.undo.UndoManager#canUndo()

The following examples show how to use javax.swing.undo.UndoManager#canUndo() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: MutualCertificatesProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new MutualCertificates(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 2
Source File: MessageAuthenticationProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new MessageAuthentication(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 3
Source File: KerberosProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new Kerberos(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 4
Source File: STSIssuedEndorsingProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new STSIssuedEndorsing(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 5
Source File: STSIssuedSupportingTokenProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new STSIssuedSupportingToken(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 6
Source File: UsernameAuthenticationProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new UsernameAuthentication(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 7
Source File: EndorsingCertificateProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new EndorsingCertificate(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 8
Source File: SAMLAuthorizationOverSSLProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new SAMLAuthorizationOverSSL(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 9
Source File: UsernameAuthPasswordDerivedKeysProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new UsernameAuthPasswordDerivedKeys(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 10
Source File: STSIssuedProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new STSIssued(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 11
Source File: SAMLHolderOfKeyProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new SAMLHolderOfKey(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 12
Source File: TransportSecurityProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new TransportSecurity(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 13
Source File: SenderVouchesProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new SenderVouches(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 14
Source File: STSIssuedCertProfile.java    From netbeans with Apache License 2.0 6 votes vote down vote up
@Override()
public void displayConfig(WSDLComponent component, UndoManager undoManager) {
    UndoCounter undoCounter = new UndoCounter();
    WSDLModel model = component.getModel();
    
    model.addUndoableEditListener(undoCounter);

    JPanel profConfigPanel = new STSIssuedCert(component, this);
    DialogDescriptor dlgDesc = new DialogDescriptor(profConfigPanel, getDisplayName());
    Dialog dlg = DialogDisplayer.getDefault().createDialog(dlgDesc);

    dlg.setVisible(true); 
    if (dlgDesc.getValue() == DialogDescriptor.CANCEL_OPTION) {
        for (int i=0; i<undoCounter.getCounter();i++) {
            if (undoManager.canUndo()) {
                undoManager.undo();
            }
        }
    }
    
    model.removeUndoableEditListener(undoCounter);
}
 
Example 15
Source File: DocumentContentTesting.java    From netbeans with Apache License 2.0 5 votes vote down vote up
public static void undo(Context context, final int count) throws Exception {
    final UndoManager undoManager = getValidUndoManager(context);
    logUndoRedoOp(context, "UNDO", count);
    int cnt = count;
    while (undoManager.canUndo() && --cnt >= 0) {
        undoManager.undo();
        checkContent(context);
    }
    logPostUndoRedoOp(context, cnt);
}