use of javax.swing.event.UndoableEditEvent in project jadx by skylot.
the class TextStandardActions method registerListeners.
private void registerListeners() {
textComponent.addMouseListener(new MouseAdapter() {
public void mouseReleased(MouseEvent e) {
if (e.getModifiers() == InputEvent.BUTTON3_MASK && e.getSource() == textComponent) {
process(e);
}
}
});
textComponent.getDocument().addUndoableEditListener(new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent event) {
undoManager.addEdit(event.getEdit());
}
});
}
use of javax.swing.event.UndoableEditEvent in project enclojure by EricThorsen.
the class ReplPanel method createReplEditorPane.
public void createReplEditorPane() {
try {
Var createReplEditorPaneFn = RT.var("org.enclojure.ide.repl.repl-panel", "create-repl-editor-pane");
_replEditorPane = (JEditorPane) createReplEditorPaneFn.invoke(this);
} catch (Exception ex) {
Logger.getLogger(ReplPanel.class.getName()).log(Level.SEVERE, null, ex);
}
// ??_replEditorPane.setInheritsPopupMenu(true);
jScrollPaneRepl.setViewportView(_replEditorPane);
_replEditorPane.getDocument().addUndoableEditListener(new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent e) {
_undoManager.addEdit(e.getEdit());
}
});
_replEditorPane.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyTyped(java.awt.event.KeyEvent evt) {
processCharInput(evt);
}
public void keyPressed(java.awt.event.KeyEvent evt) {
processKeyInput(evt);
}
});
}
use of javax.swing.event.UndoableEditEvent in project vcell by virtualcell.
the class VirtualFrapMainFrame method initiateComponents.
/**
* Initiation of the UI components that is shown in the main window
*/
protected void initiateComponents(DocumentWindowManager documentWindowManager) {
toolBar = new ToolBar();
toolBar.setNewAndRunButtonVisible(false);
ToolBarHandler th = new ToolBarHandler();
toolBar.addToolBarHandler(th);
mb = new JMenuBar();
frapStudyPanel = new FRAPStudyPanel();
frapStudyPanel.addUndoableEditListener(new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent e) {
if (e.getEdit().canUndo()) {
lastUndoableEdit = e.getEdit();
mUndo.setText(UNDO_ACTION_COMMAND + " " + e.getEdit().getUndoPresentationName());
mUndo.setEnabled(true);
} else {
lastUndoableEdit = null;
mUndo.setText(UNDO_ACTION_COMMAND);
mUndo.setEnabled(false);
}
}
});
// System.setProperty(PropertyLoader.primarySimDataDirProperty, localWorkspace.getDefaultWorkspaceDirectory());
// System.setProperty(PropertyLoader.secondarySimDataDirProperty, localWorkspace.getDefaultWorkspaceDirectory());
System.setProperty(PropertyLoader.exportBaseDirInternalProperty, localWorkspace.getDefaultSimDataDirectory());
System.setProperty(PropertyLoader.exportBaseURLProperty, "file://" + localWorkspace.getDefaultSimDataDirectory());
frapStudyPanel.setLocalWorkspace(localWorkspace);
frapStudyPanel.setFRAPWorkspace(frapWorkspace);
frapStudyPanel.setDocumentWindowManager(documentWindowManager);
// add components to the main frame
getContentPane().setLayout(new BorderLayout());
getContentPane().add(toolBar, BorderLayout.NORTH);
getContentPane().add(statusBarNew, BorderLayout.SOUTH);
getContentPane().add(frapStudyPanel);
}
use of javax.swing.event.UndoableEditEvent in project vcell by virtualcell.
the class AddShapeJPanel method init.
private void init() {
cylAxisButtonGroup.add(cylXRadioButton);
cylAxisButtonGroup.add(cylYRadioButton);
cylAxisButtonGroup.add(cylZRadioButton);
cylXRadioButton.addActionListener(shapeTypeComboBoxActionListener);
cylYRadioButton.addActionListener(shapeTypeComboBoxActionListener);
cylZRadioButton.addActionListener(shapeTypeComboBoxActionListener);
comboBox.addActionListener(shapeTypeComboBoxActionListener);
copyExpressionTextButton.setEnabled(false);
populateShapeTypeComboBox(1);
UndoableEditListener undoableEditListener = new UndoableEditListener() {
public void undoableEditHappened(UndoableEditEvent e) {
setAnalyticExprLabel();
}
};
circleCenterTextField.getDocument().addUndoableEditListener(undoableEditListener);
circleRadiusTextField.getDocument().addUndoableEditListener(undoableEditListener);
boxLCTextField.getDocument().addUndoableEditListener(undoableEditListener);
boxUCTextField.getDocument().addUndoableEditListener(undoableEditListener);
ellipseCenterTextField.getDocument().addUndoableEditListener(undoableEditListener);
axisRadiiTextField.getDocument().addUndoableEditListener(undoableEditListener);
cylStartPointTextField.getDocument().addUndoableEditListener(undoableEditListener);
cylRadiusTextField.getDocument().addUndoableEditListener(undoableEditListener);
cylLengthTextField.getDocument().addUndoableEditListener(undoableEditListener);
manualTextField.getDocument().addUndoableEditListener(undoableEditListener);
setAnalyticExprLabel();
}
use of javax.swing.event.UndoableEditEvent in project pcgen by PCGen.
the class ExtendedHTMLDocument method removeElements.
/**
* Removes elements. Used by Swing.
*
* @param e the element to remove
* @param index the element position
* @param count how many to remove
*
* @throws BadLocationException if there are not elements enough
*
* @see Content#remove(int, int)
*/
public void removeElements(Element e, int index, int count) throws BadLocationException {
writeLock();
int start = e.getElement(index).getStartOffset();
int end = e.getElement((index + count) - 1).getEndOffset();
try {
Element[] removed = new Element[count];
Element[] added = EMPTY_ELEMENT_ARRAY;
for (int counter = 0; counter < count; counter++) {
removed[counter] = e.getElement(counter + index);
}
DefaultDocumentEvent dde = new DefaultDocumentEvent(start, end - start, EventType.REMOVE);
((AbstractDocument.BranchElement) e).replace(index, removed.length, added);
dde.addEdit(new ElementEdit(e, index, removed, added));
UndoableEdit u = getContent().remove(start, end - start);
if (u != null) {
dde.addEdit(u);
}
postRemoveUpdate(dde);
dde.end();
fireRemoveUpdate(dde);
if (u != null) {
fireUndoableEditUpdate(new UndoableEditEvent(this, dde));
}
} finally {
writeUnlock();
}
}
Aggregations