Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes #1843

Merged
merged 2 commits into from
Apr 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,13 @@ public PopupEditor(JComponent parent, String title, String text) {
setResizable(false);
JPanel panel = new JPanel(new MigLayout("fill, wrap 2, inset 2, gap 6, wmin 200, hmin 48", "[70%][30%]"));
textField = new TextField(text);
textField.setSelectionStart(0);
textField.setSelectionEnd(text.length());
textField.setFont(new Font(Font.MONOSPACED, Font.PLAIN, 16));
textField.addKeyListener(new KeyListener() {
@Override
public void keyTyped(KeyEvent e) {
}

@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
dispose();
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
notifyListenersAndDispose();
}
}

@Override
public void keyReleased(KeyEvent e) {
}
});
textField.addKeyListener(new PopupEditorKeyListener());
JButton button = new JButton("Set");
button.setMinimumSize(new Dimension(10, 10));
button.addActionListener((event) -> notifyListenersAndDispose());
button.addActionListener(event -> notifyListenersAndDispose());

panel.add(textField, "grow");
panel.add(button, "grow");
Expand Down Expand Up @@ -103,4 +88,25 @@ public void dispose() {
public interface PopupEditorListener {
void onValue(String value);
}

private class PopupEditorKeyListener implements KeyListener {
@Override
public void keyTyped(KeyEvent e) {
// Not used
}

@Override
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ESCAPE) {
dispose();
} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
notifyListenersAndDispose();
}
}

@Override
public void keyReleased(KeyEvent e) {
// Not used
}
}
}
1 change: 1 addition & 0 deletions ugs-core/src/resources/MessagesBundle_en_US.properties
Original file line number Diff line number Diff line change
Expand Up @@ -589,6 +589,7 @@ platform.plugin.jog.stepSmaller = Smaller
platform.plugin.jog.stealKeyboardFocus = Making sure that keyboard controls are active
platform.window.edit.macros = Edit macros...
platform.action.outline = Outline
platform.action.outline.tooltip = Move the machine around the model using the current depth
platform.plugin.joystick.activate = Activate joystick
platform.plugin.joystick.buttonControls = Button controls:
platform.plugin.joystick.analogControls = Analog controls:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public OutlineAction() {
putValue(SMALL_ICON, ImageUtilities.loadImageIcon(ICON_BASE, false));
putValue("menuText", LocalizingService.OutlineTitle);
putValue(NAME, LocalizingService.OutlineTitle);
putValue(Action.SHORT_DESCRIPTION, LocalizingService.OutlineToolTip);
setEnabled(isEnabled());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,8 @@ public class LocalizingService {

public final static String OutlineTitleKey = "platform.action.outline";
public final static String OutlineTitle = Localization.getString(OutlineTitleKey, lang);
public final static String OutlineToolTipKey = "platform.action.outline.tooltip";
public final static String OutlineToolTip = Localization.getString(OutlineToolTipKey, lang);
public final static String OutlineWindowPath = MENU_MACHINE_ACTIONS;
public final static String OutlineActionId = "com.willwinder.ugs.nbp.core.actions.OutlineAction";
public final static String OutlineCategory = CATEGORY_PROGRAM;
Expand Down