use of javax.swing.event.UndoableEditListener 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.UndoableEditListener 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.UndoableEditListener 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.UndoableEditListener 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.UndoableEditListener in project vcell by virtualcell.
the class EventPanel method getDelayTextField.
// private InputVerifier delayInputVerifier = new InputVerifier() {
// @Override
// public boolean verify(JComponent input) {
// boolean bValid = true;
// Exception delayException = null;
// boolean bTextNotEmpty = getDelayTextField().getText() != null && getDelayTextField().getText().trim().length() > 0;
// try{
// if (bTextNotEmpty) {
// //Use createDelay to check validity
// createDelay(getBioEvent(),getDelayTextField().getText(),getSimulationContext(),getRdbtnTrigTime().isSelected());
// }
// }catch(Exception e){
// bValid = false;
// delayException = e;
// // e.printStackTrace();
// }
// if (bValid) {
// getDelayTextField().setBorder(UIManager.getBorder("TextField.border"));
// getDelayTextField().setToolTipText(null);
// enableTriggerRadioButtons(bTextNotEmpty);
// } else {
// getDelayTextField().setBorder(GuiConstants.ProblematicTextFieldBorder);
// getDelayTextField().setToolTipText("Error parse 'delay': "+delayException.getMessage());
// enableTriggerRadioButtons(false);
// // SwingUtilities.invokeLater(new Runnable() {
// // public void run() {
// // getDelayTextField().requestFocus();
// // }
// // });
// }
// return bValid;
// }
// };
// ActionListener editTimerActionListener = new ActionListener() {
// private String lastEdit = null;
// @Override
// public void actionPerformed(ActionEvent e) {
// if(!delayTextField.isPopupVisible()){
//
// }
// }
// };
// Timer editTimer;
private TextFieldAutoCompletion getDelayTextField() {
if (delayTextField == null) {
try {
delayTextField = new TextFieldAutoCompletion();
delayTextField.setName("DelayTextField");
KeyboardFocusManager.getCurrentKeyboardFocusManager().addPropertyChangeListener(new PropertyChangeListener() {
@Override
public void propertyChange(PropertyChangeEvent evt) {
// System.out.println(evt);
if (evt.getPropertyName().equals("focusOwner") && evt.getNewValue() == delayTextField) {
// System.out.println("-----I got Focus "+delayTextField.hashCode()+" "+(getBioEvent()==null?null:getBioEvent().hashCode()));
} else if (evt.getPropertyName().equals("focusOwner") && evt.getOldValue() == delayTextField && evt.getNewValue() != delayTextField) {
// System.out.println("-----I lost Focus "+bErrorDialog+" "+delayTextField.hashCode()+" autolist visible="+delayTextField.isPopupVisible()+" "+(getBioEvent()==null?null:getBioEvent().hashCode()));
if (!delayTextField.isPopupVisible()) {
try {
setNewDelay(getBioEvent(), getDelayTextField().getText(), getSimulationContext(), getRdbtnTrigTime().isSelected());
} catch (Exception e) {
e.printStackTrace();
}
// System.out.println("set new delay="+(getBioEvent()==null?null:getBioEvent().getDelay()));
}
}
// System.out.println(EventPanel.this.hashCode()+" "+evt);
}
});
delayTextField.getDocument().addUndoableEditListener(new UndoableEditListener() {
@Override
public void undoableEditHappened(UndoableEditEvent e) {
if (delayTextField.getText() != null && delayTextField.getText().length() > 0) {
enableTriggerRadioButtons(true);
} else {
enableTriggerRadioButtons(false);
}
// delayInputVerifier.verify(delayTextField);
}
});
// delayTextField.addMouseListener(new MouseAdapter() {
// @Override
// public void mouseExited(MouseEvent e) {
// super.mouseExited(e);
// if(!delayTextField.isPopupVisible()){
// delayInputVerifier.verify(delayTextField);
// }else{
// System.out.println("-----MouseExit");
// }
// }
// });
delayTextField.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
updateDelay();
}
});
//
// delayTextField.setInputVerifier(delayInputVerifier);
} catch (java.lang.Throwable e) {
e.printStackTrace(System.out);
}
}
return delayTextField;
}
Aggregations