mirror of
https://github.com/bancika/diy-layout-creator
synced 2026-11-10 17:22:09 +10:00
Ctrl + click doesn't add components to the selection in MacOS
This commit is contained in:
@@ -617,9 +617,9 @@ public class Presenter implements IPlugInPort {
|
|||||||
IDIYComponent<?> topComponent = components.get(0);
|
IDIYComponent<?> topComponent = components.get(0);
|
||||||
// If ctrl is pressed just toggle the component under mouse
|
// If ctrl is pressed just toggle the component under mouse
|
||||||
// cursor.
|
// cursor.
|
||||||
if (!Utils.isMac() && ctrlDown) {
|
if (ctrlDown) {
|
||||||
if (newSelection.contains(topComponent)) {
|
if (newSelection.contains(topComponent)) {
|
||||||
newSelection.removeAll(findAllGroupedComponents(topComponent));
|
newSelection.removeAll(findAllGroupedComponents(topComponent));
|
||||||
} else {
|
} else {
|
||||||
newSelection.addAll(findAllGroupedComponents(topComponent));
|
newSelection.addAll(findAllGroupedComponents(topComponent));
|
||||||
}
|
}
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -47,7 +47,6 @@ import javax.swing.SwingUtilities;
|
|||||||
import org.apache.log4j.Logger;
|
import org.apache.log4j.Logger;
|
||||||
import org.diylc.appframework.miscutils.ConfigurationManager;
|
import org.diylc.appframework.miscutils.ConfigurationManager;
|
||||||
import org.diylc.appframework.miscutils.IConfigListener;
|
import org.diylc.appframework.miscutils.IConfigListener;
|
||||||
import org.diylc.appframework.miscutils.Utils;
|
|
||||||
import org.diylc.common.BadPositionException;
|
import org.diylc.common.BadPositionException;
|
||||||
import org.diylc.common.EventType;
|
import org.diylc.common.EventType;
|
||||||
import org.diylc.common.IComponentTransformer;
|
import org.diylc.common.IComponentTransformer;
|
||||||
@@ -136,23 +135,31 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
if (canvasPanel == null) {
|
if (canvasPanel == null) {
|
||||||
canvasPanel = new CanvasPanel(plugInPort);
|
canvasPanel = new CanvasPanel(plugInPort);
|
||||||
canvasPanel.addMouseListener(new MouseAdapter() {
|
canvasPanel.addMouseListener(new MouseAdapter() {
|
||||||
|
|
||||||
|
private MouseEvent pressedEvent;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
|
plugInPort.mouseClicked(e.getPoint(), e.getButton(), e.isControlDown(), e.isShiftDown(), e.isAltDown(),
|
||||||
|
e.getClickCount());
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mousePressed(MouseEvent e) {
|
public void mousePressed(MouseEvent e) {
|
||||||
|
LOG.info("Pressed: " + e.isPopupTrigger());
|
||||||
canvasPanel.requestFocus();
|
canvasPanel.requestFocus();
|
||||||
mouseReleased(e);
|
pressedEvent = e;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void mouseReleased(final MouseEvent e) {
|
public void mouseReleased(final MouseEvent e) {
|
||||||
|
|
||||||
// Invoke the rest of the code later so we get the chance to
|
// Invoke the rest of the code later so we get the chance to
|
||||||
// process selection messages.
|
// process selection messages.
|
||||||
SwingUtilities.invokeLater(new Runnable() {
|
SwingUtilities.invokeLater(new Runnable() {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run() {
|
public void run() {
|
||||||
if (plugInPort.getNewComponentTypeSlot() == null && e.isPopupTrigger()) {
|
if (plugInPort.getNewComponentTypeSlot() == null && (e.isPopupTrigger() || pressedEvent.isPopupTrigger())) {
|
||||||
// Enable actions.
|
// Enable actions.
|
||||||
boolean enabled = !plugInPort.getSelectedComponents().isEmpty();
|
boolean enabled = !plugInPort.getSelectedComponents().isEmpty();
|
||||||
getCutAction().setEnabled(enabled);
|
getCutAction().setEnabled(enabled);
|
||||||
@@ -192,8 +199,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void keyPressed(KeyEvent e) {
|
public void keyPressed(KeyEvent e) {
|
||||||
if (plugInPort.keyPressed(e.getKeyCode(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
|
if (plugInPort.keyPressed(e.getKeyCode(), e.isControlDown(), e.isShiftDown(), e.isAltDown())) {
|
||||||
e.isShiftDown(), e.isAltDown())) {
|
|
||||||
e.consume();
|
e.consume();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -204,17 +210,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
@Override
|
@Override
|
||||||
public void mouseMoved(MouseEvent e) {
|
public void mouseMoved(MouseEvent e) {
|
||||||
canvasPanel.setCursor(plugInPort.getCursorAt(e.getPoint()));
|
canvasPanel.setCursor(plugInPort.getCursorAt(e.getPoint()));
|
||||||
plugInPort.mouseMoved(e.getPoint(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(), e.isShiftDown(),
|
plugInPort.mouseMoved(e.getPoint(), e.isControlDown(), e.isShiftDown(), e.isAltDown());
|
||||||
e.isAltDown());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
canvasPanel.addMouseListener(new MouseAdapter() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseClicked(MouseEvent e) {
|
|
||||||
plugInPort.mouseClicked(e.getPoint(), e.getButton(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(),
|
|
||||||
e.isShiftDown(), e.isAltDown(), e.getClickCount());
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -250,7 +246,7 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
|
|
||||||
boolean wheelZoom = ConfigurationManager.getInstance().readBoolean(IPlugInPort.WHEEL_ZOOM_KEY, false);
|
boolean wheelZoom = ConfigurationManager.getInstance().readBoolean(IPlugInPort.WHEEL_ZOOM_KEY, false);
|
||||||
|
|
||||||
if (wheelZoom || (Utils.isMac() ? e.isMetaDown() : e.isControlDown())) {
|
if (wheelZoom || e.isControlDown()) {
|
||||||
|
|
||||||
Point mousePos = getCanvasPanel().getMousePosition(true);
|
Point mousePos = getCanvasPanel().getMousePosition(true);
|
||||||
|
|
||||||
@@ -271,10 +267,10 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
}
|
}
|
||||||
plugInPort.setZoomLevel(newZoom = availableZoomLevels[i]);
|
plugInPort.setZoomLevel(newZoom = availableZoomLevels[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
Rectangle2D selectionBounds = plugInPort.getSelectionBounds(true);
|
Rectangle2D selectionBounds = plugInPort.getSelectionBounds(true);
|
||||||
Rectangle visibleRect = scrollPane.getVisibleRect();
|
Rectangle visibleRect = scrollPane.getVisibleRect();
|
||||||
|
|
||||||
JScrollBar horizontal = scrollPane.getHorizontalScrollBar();
|
JScrollBar horizontal = scrollPane.getHorizontalScrollBar();
|
||||||
JScrollBar vertical = scrollPane.getVerticalScrollBar();
|
JScrollBar vertical = scrollPane.getVerticalScrollBar();
|
||||||
|
|
||||||
@@ -283,8 +279,8 @@ public class CanvasPlugin implements IPlugIn, ClipboardOwner {
|
|||||||
Point desiredPos =
|
Point desiredPos =
|
||||||
new Point((int) (1d * mousePos.x / oldZoom * newZoom), (int) (1d * mousePos.y / oldZoom * newZoom));
|
new Point((int) (1d * mousePos.x / oldZoom * newZoom), (int) (1d * mousePos.y / oldZoom * newZoom));
|
||||||
int dx = desiredPos.x - mousePos.x;
|
int dx = desiredPos.x - mousePos.x;
|
||||||
int dy = desiredPos.y - mousePos.y;
|
int dy = desiredPos.y - mousePos.y;
|
||||||
horizontal.setValue(horizontal.getValue() + dx);
|
horizontal.setValue(horizontal.getValue() + dx);
|
||||||
vertical.setValue(vertical.getValue() + dy);
|
vertical.setValue(vertical.getValue() + dy);
|
||||||
} else {
|
} else {
|
||||||
// center to selection
|
// center to selection
|
||||||
|
|||||||
+171
-177
@@ -1,184 +1,178 @@
|
|||||||
/*
|
/*
|
||||||
|
*
|
||||||
|
* DIY Layout Creator (DIYLC). Copyright (c) 2009-2018 held jointly by the individual authors.
|
||||||
|
*
|
||||||
|
* This file is part of DIYLC.
|
||||||
|
*
|
||||||
|
* DIYLC is free software: you can redistribute it and/or modify it under the terms of the GNU
|
||||||
|
* General Public License as published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* DIYLC is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even
|
||||||
|
* the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
|
||||||
|
* Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License along with DIYLC. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
package org.diylc.swing.plugins.toolbox;
|
||||||
|
|
||||||
DIY Layout Creator (DIYLC).
|
import java.awt.Container;
|
||||||
Copyright (c) 2009-2018 held jointly by the individual authors.
|
import java.awt.Dimension;
|
||||||
|
import java.awt.FlowLayout;
|
||||||
|
import java.awt.event.ActionEvent;
|
||||||
|
import java.awt.event.ActionListener;
|
||||||
|
import java.awt.event.KeyAdapter;
|
||||||
|
import java.awt.event.KeyEvent;
|
||||||
|
import java.awt.event.MouseAdapter;
|
||||||
|
import java.awt.event.MouseEvent;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
This file is part of DIYLC.
|
import javax.swing.BorderFactory;
|
||||||
|
import javax.swing.JButton;
|
||||||
|
import javax.swing.JLabel;
|
||||||
|
import javax.swing.JMenuItem;
|
||||||
|
import javax.swing.JOptionPane;
|
||||||
|
import javax.swing.JPopupMenu;
|
||||||
|
import javax.swing.SwingUtilities;
|
||||||
|
import javax.swing.border.Border;
|
||||||
|
import javax.swing.border.EmptyBorder;
|
||||||
|
|
||||||
DIYLC is free software: you can redistribute it and/or modify
|
import org.diylc.common.ComponentType;
|
||||||
it under the terms of the GNU General Public License as published by
|
import org.diylc.common.IPlugInPort;
|
||||||
the Free Software Foundation, either version 3 of the License, or
|
import org.diylc.core.IDIYComponent;
|
||||||
(at your option) any later version.
|
import org.diylc.core.Template;
|
||||||
|
import org.diylc.images.IconLoader;
|
||||||
|
import org.diylc.swingframework.openide.DropDownButtonFactory;
|
||||||
|
|
||||||
DIYLC is distributed in the hope that it will be useful,
|
/**
|
||||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* Factory that creates {@link JButton}s which display component type icons and instantiates the
|
||||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* component when clicked.
|
||||||
GNU General Public License for more details.
|
*
|
||||||
|
* @author Branislav Stojkovic
|
||||||
|
*/
|
||||||
|
public class ComponentButtonFactory {
|
||||||
|
|
||||||
You should have received a copy of the GNU General Public License
|
public static int MARGIN = 3;
|
||||||
along with DIYLC. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
|
|
||||||
*/
|
public static JButton create(final IPlugInPort plugInPort, final ComponentType componentType, final JPopupMenu menu) {
|
||||||
package org.diylc.swing.plugins.toolbox;
|
JButton button = DropDownButtonFactory.createDropDownButton(componentType.getIcon(), menu);
|
||||||
|
|
||||||
import java.awt.Container;
|
button.setBorder(BorderFactory.createEmptyBorder(MARGIN + 1, MARGIN + 1, MARGIN, MARGIN));
|
||||||
import java.awt.Dimension;
|
|
||||||
import java.awt.FlowLayout;
|
button.setToolTipText("<html><b>" + componentType.getName() + "</b><br>" + componentType.getDescription()
|
||||||
import java.awt.event.ActionEvent;
|
+ "<br>Author: " + componentType.getAuthor() + "<br><br>Right click to select all components of this type"
|
||||||
import java.awt.event.ActionListener;
|
+ "</html>");
|
||||||
import java.awt.event.KeyAdapter;
|
button.addActionListener(new ActionListener() {
|
||||||
import java.awt.event.KeyEvent;
|
|
||||||
import java.awt.event.MouseAdapter;
|
@Override
|
||||||
import java.awt.event.MouseEvent;
|
public void actionPerformed(ActionEvent e) {
|
||||||
import java.util.ArrayList;
|
plugInPort.setNewComponentTypeSlot(componentType, null);
|
||||||
import java.util.List;
|
}
|
||||||
|
});
|
||||||
import javax.swing.BorderFactory;
|
|
||||||
import javax.swing.JButton;
|
button.addMouseListener(new MouseAdapter() {
|
||||||
import javax.swing.JLabel;
|
|
||||||
import javax.swing.JMenuItem;
|
@Override
|
||||||
import javax.swing.JOptionPane;
|
public void mousePressed(MouseEvent e) {
|
||||||
import javax.swing.JPopupMenu;
|
if (e.getButton() == MouseEvent.BUTTON3) {
|
||||||
import javax.swing.SwingUtilities;
|
List<IDIYComponent<?>> components = plugInPort.getCurrentProject().getComponents();
|
||||||
import javax.swing.border.Border;
|
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>();
|
||||||
import javax.swing.border.EmptyBorder;
|
for (IDIYComponent<?> component : components) {
|
||||||
|
if (componentType.getInstanceClass().equals(component.getClass())) {
|
||||||
import org.diylc.appframework.miscutils.Utils;
|
newSelection.add(component);
|
||||||
import org.diylc.common.ComponentType;
|
}
|
||||||
import org.diylc.common.IPlugInPort;
|
}
|
||||||
import org.diylc.core.IDIYComponent;
|
// Ctrl appends selection
|
||||||
import org.diylc.core.Template;
|
if (e.isControlDown()) {
|
||||||
import org.diylc.images.IconLoader;
|
newSelection.addAll(plugInPort.getSelectedComponents());
|
||||||
import org.diylc.swingframework.openide.DropDownButtonFactory;
|
}
|
||||||
|
plugInPort.updateSelection(newSelection);
|
||||||
/**
|
plugInPort.setNewComponentTypeSlot(null, null);
|
||||||
* Factory that creates {@link JButton}s which display component type icons and instantiates the
|
plugInPort.refresh();
|
||||||
* component when clicked.
|
}
|
||||||
*
|
}
|
||||||
* @author Branislav Stojkovic
|
});
|
||||||
*/
|
|
||||||
public class ComponentButtonFactory {
|
button.addKeyListener(new KeyAdapter() {
|
||||||
|
|
||||||
public static int MARGIN = 3;
|
@Override
|
||||||
|
public void keyPressed(KeyEvent e) {
|
||||||
public static JButton create(final IPlugInPort plugInPort, final ComponentType componentType, final JPopupMenu menu) {
|
plugInPort.keyPressed(e.getKeyCode(), e.isControlDown(), e.isShiftDown(), e.isAltDown());
|
||||||
JButton button = DropDownButtonFactory.createDropDownButton(componentType.getIcon(), menu);
|
}
|
||||||
|
});
|
||||||
button.setBorder(BorderFactory.createEmptyBorder(MARGIN + 1, MARGIN + 1, MARGIN, MARGIN));
|
return button;
|
||||||
|
}
|
||||||
button.setToolTipText("<html><b>" + componentType.getName() + "</b><br>" + componentType.getDescription()
|
|
||||||
+ "<br>Author: " + componentType.getAuthor() + "<br><br>Right click to select all components of this type"
|
public static JMenuItem createTemplateItem(final IPlugInPort plugInPort, final Template template,
|
||||||
+ "</html>");
|
final ComponentType componentType) {
|
||||||
button.addActionListener(new ActionListener() {
|
final JMenuItem item = new JMenuItem(template.getName()) {
|
||||||
|
|
||||||
@Override
|
private static final long serialVersionUID = 1L;
|
||||||
public void actionPerformed(ActionEvent e) {
|
|
||||||
plugInPort.setNewComponentTypeSlot(componentType, null);
|
// Customize item size to fit the delete button
|
||||||
}
|
public java.awt.Dimension getPreferredSize() {
|
||||||
});
|
Dimension d = super.getPreferredSize();
|
||||||
|
return new Dimension(d.width + 32, d.height);
|
||||||
button.addMouseListener(new MouseAdapter() {
|
}
|
||||||
|
};
|
||||||
@Override
|
item.addActionListener(new ActionListener() {
|
||||||
public void mousePressed(MouseEvent e) {
|
|
||||||
if (e.getButton() == MouseEvent.BUTTON3) {
|
@Override
|
||||||
List<IDIYComponent<?>> components = plugInPort.getCurrentProject().getComponents();
|
public void actionPerformed(ActionEvent e) {
|
||||||
List<IDIYComponent<?>> newSelection = new ArrayList<IDIYComponent<?>>();
|
plugInPort.setNewComponentTypeSlot(componentType, template);
|
||||||
for (IDIYComponent<?> component : components) {
|
}
|
||||||
if (componentType.getInstanceClass().equals(component.getClass())) {
|
});
|
||||||
newSelection.add(component);
|
|
||||||
}
|
JLabel label = new JLabel(template.isDefaultFlag() ? IconLoader.PinGreen.getIcon() : IconLoader.PinGrey.getIcon());
|
||||||
}
|
label.setToolTipText(template.isDefaultFlag() ? "Remove default variant" : "Set default variant");
|
||||||
// Ctrl appends selection
|
label.addMouseListener(new MouseAdapter() {
|
||||||
if (Utils.isMac() ? e.isMetaDown() : e.isControlDown()) {
|
|
||||||
newSelection.addAll(plugInPort.getSelectedComponents());
|
@Override
|
||||||
}
|
public void mouseClicked(MouseEvent e) {
|
||||||
plugInPort.updateSelection(newSelection);
|
// Hide the menu
|
||||||
plugInPort.setNewComponentTypeSlot(null, null);
|
Container c = item.getParent();
|
||||||
plugInPort.refresh();
|
if (c != null && c instanceof JPopupMenu) {
|
||||||
}
|
JPopupMenu m = (JPopupMenu) c;
|
||||||
}
|
m.setVisible(false);
|
||||||
});
|
}
|
||||||
|
plugInPort.setTemplateDefault(componentType.getCategory(), componentType.getName(), template.getName(),
|
||||||
button.addKeyListener(new KeyAdapter() {
|
!template.isDefaultFlag());
|
||||||
|
e.consume();
|
||||||
@Override
|
}
|
||||||
public void keyPressed(KeyEvent e) {
|
});
|
||||||
plugInPort.keyPressed(e.getKeyCode(), Utils.isMac() ? e.isMetaDown() : e.isControlDown(), e.isShiftDown(),
|
Border margin = new EmptyBorder(4, 0, 0, 0);
|
||||||
e.isAltDown());
|
label.setBorder(margin);
|
||||||
}
|
item.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
||||||
});
|
item.add(label);
|
||||||
return button;
|
|
||||||
}
|
label = new JLabel(IconLoader.Garbage.getIcon());
|
||||||
|
label.setToolTipText("Delete variant");
|
||||||
public static JMenuItem createTemplateItem(final IPlugInPort plugInPort, final Template template,
|
label.addMouseListener(new MouseAdapter() {
|
||||||
final ComponentType componentType) {
|
|
||||||
final JMenuItem item = new JMenuItem(template.getName()) {
|
@Override
|
||||||
|
public void mouseClicked(MouseEvent e) {
|
||||||
private static final long serialVersionUID = 1L;
|
// Hide the menu
|
||||||
|
Container c = item.getParent();
|
||||||
// Customize item size to fit the delete button
|
if (c != null && c instanceof JPopupMenu) {
|
||||||
public java.awt.Dimension getPreferredSize() {
|
JPopupMenu m = (JPopupMenu) c;
|
||||||
Dimension d = super.getPreferredSize();
|
m.setVisible(false);
|
||||||
return new Dimension(d.width + 32, d.height);
|
}
|
||||||
}
|
int result =
|
||||||
};
|
JOptionPane.showConfirmDialog(SwingUtilities.getRoot(item), "Are you sure you want to delete variant \""
|
||||||
item.addActionListener(new ActionListener() {
|
+ template.getName() + "\"", "Delete", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
||||||
|
if (result != JOptionPane.YES_OPTION) {
|
||||||
@Override
|
return;
|
||||||
public void actionPerformed(ActionEvent e) {
|
}
|
||||||
plugInPort.setNewComponentTypeSlot(componentType, template);
|
plugInPort.deleteTemplate(componentType.getCategory(), componentType.getName(), template.getName());
|
||||||
}
|
e.consume();
|
||||||
});
|
}
|
||||||
|
});
|
||||||
JLabel label = new JLabel(template.isDefaultFlag() ? IconLoader.PinGreen.getIcon() : IconLoader.PinGrey.getIcon());
|
margin = new EmptyBorder(4, 2, 0, 0);
|
||||||
label.setToolTipText(template.isDefaultFlag() ? "Remove default variant" : "Set default variant");
|
label.setBorder(margin);
|
||||||
label.addMouseListener(new MouseAdapter() {
|
item.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
||||||
|
item.add(label);
|
||||||
@Override
|
return item;
|
||||||
public void mouseClicked(MouseEvent e) {
|
}
|
||||||
// Hide the menu
|
}
|
||||||
Container c = item.getParent();
|
|
||||||
if (c != null && c instanceof JPopupMenu) {
|
|
||||||
JPopupMenu m = (JPopupMenu) c;
|
|
||||||
m.setVisible(false);
|
|
||||||
}
|
|
||||||
plugInPort.setTemplateDefault(componentType.getCategory(), componentType.getName(), template.getName(),
|
|
||||||
!template.isDefaultFlag());
|
|
||||||
e.consume();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Border margin = new EmptyBorder(4, 0, 0, 0);
|
|
||||||
label.setBorder(margin);
|
|
||||||
item.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
|
||||||
item.add(label);
|
|
||||||
|
|
||||||
label = new JLabel(IconLoader.Garbage.getIcon());
|
|
||||||
label.setToolTipText("Delete variant");
|
|
||||||
label.addMouseListener(new MouseAdapter() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void mouseClicked(MouseEvent e) {
|
|
||||||
// Hide the menu
|
|
||||||
Container c = item.getParent();
|
|
||||||
if (c != null && c instanceof JPopupMenu) {
|
|
||||||
JPopupMenu m = (JPopupMenu) c;
|
|
||||||
m.setVisible(false);
|
|
||||||
}
|
|
||||||
int result =
|
|
||||||
JOptionPane.showConfirmDialog(SwingUtilities.getRoot(item), "Are you sure you want to delete variant \""
|
|
||||||
+ template.getName() + "\"", "Delete", JOptionPane.YES_NO_OPTION, JOptionPane.WARNING_MESSAGE);
|
|
||||||
if (result != JOptionPane.YES_OPTION) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
plugInPort.deleteTemplate(componentType.getCategory(), componentType.getName(), template.getName());
|
|
||||||
e.consume();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
margin = new EmptyBorder(4, 2, 0, 0);
|
|
||||||
label.setBorder(margin);
|
|
||||||
item.setLayout(new FlowLayout(FlowLayout.RIGHT, 0, 0));
|
|
||||||
item.add(label);
|
|
||||||
return item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -2052,8 +2052,12 @@
|
|||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
<org.diylc.appframework.update.Change>
|
<org.diylc.appframework.update.Change>
|
||||||
<changeType>BUG_FIX</changeType>
|
<changeType>BUG_FIX</changeType>
|
||||||
<description>Clicking on a building block twice in a row inside the component tree would make the components go back to the top-left corner of the layout</description>
|
<description>Clicking on a building block in the component tree sometimes makes the components go back to the top-left corner of the layout</description>
|
||||||
</org.diylc.appframework.update.Change>
|
</org.diylc.appframework.update.Change>
|
||||||
|
<org.diylc.appframework.update.Change>
|
||||||
|
<changeType>BUG_FIX</changeType>
|
||||||
|
<description>Ctrl + click doesn't add components to the selection in MacOS</description>
|
||||||
|
</org.diylc.appframework.update.Change>
|
||||||
</changes>
|
</changes>
|
||||||
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
<url>https://github.com/bancika/diy-layout-creator/releases</url>
|
||||||
</org.diylc.appframework.update.Version>
|
</org.diylc.appframework.update.Version>
|
||||||
|
|||||||
Reference in New Issue
Block a user