Skip to content

Commit

Permalink
mac keyboard shortcut added
Browse files Browse the repository at this point in the history
  • Loading branch information
md-k-sarker committed Oct 6, 2018
1 parent 4cbe34d commit 59c82ac
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 87 deletions.
3 changes: 3 additions & 0 deletions .gitignore
@@ -1,3 +1,6 @@
# intellij idea
.idea/
*.iml

# Java build artifacts class files
*.class
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Expand Up @@ -12,7 +12,7 @@

<groupId>edu.wright.dase</groupId>
<artifactId>OWLAx</artifactId>
<version>1.1.0</version>
<version>1.2.0</version>
<name>OWLAx Protege 5.0+ Plugin</name>
<description>Ontology Design Pattern Plugin for Desktop Protege 5.0+</description>
<packaging>bundle</packaging>
Expand Down
22 changes: 11 additions & 11 deletions src/main/java/com/mxgraph/swing/handler/mxKeyboardHandler.java
Expand Up @@ -57,28 +57,28 @@ protected InputMap getInputMap(int condition) {

if (OSNAME.indexOf("mac") != -1) {
map.put(KeyStroke.getKeyStroke("F2"), "edit");
map.put(KeyStroke.getKeyStroke("DELETE"), "delete");
map.put(KeyStroke.getKeyStroke("UP"), "selectParent");
map.put(KeyStroke.getKeyStroke("DOWN"), "selectChild");
map.put(KeyStroke.getKeyStroke("RIGHT"), "selectNext");
map.put(KeyStroke.getKeyStroke("LEFT"), "selectPrevious");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_DELETE, KeyEvent.META_DOWN_MASK), "delete");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_UP, KeyEvent.META_DOWN_MASK), "selectParent");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_DOWN, KeyEvent.META_DOWN_MASK), "selectChild");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_RIGHT, KeyEvent.META_DOWN_MASK), "selectNext");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_LEFT, KeyEvent.META_DOWN_MASK), "selectPrevious");
map.put(KeyStroke.getKeyStroke("PAGE_DOWN"), "enterGroup");
map.put(KeyStroke.getKeyStroke("PAGE_UP"), "exitGroup");
map.put(KeyStroke.getKeyStroke("HOME"), "home");
map.put(KeyStroke.getKeyStroke("ENTER"), "expand");
map.put(KeyStroke.getKeyStroke("BACK_SPACE"), "collapse");
map.put(KeyStroke.getKeyStroke("control A"), "selectAll");
map.put(KeyStroke.getKeyStroke("control D"), "selectNone");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_A, KeyEvent.META_DOWN_MASK), "selectAll");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_D, KeyEvent.META_DOWN_MASK), "selectNone");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_X, KeyEvent.META_DOWN_MASK), "cut");
map.put(KeyStroke.getKeyStroke("CUT"), "cut");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_C, KeyEvent.META_DOWN_MASK), "copy");
map.put(KeyStroke.getKeyStroke("COPY"), "copy");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_V, KeyEvent.META_DOWN_MASK), "paste");
map.put(KeyStroke.getKeyStroke("PASTE"), "paste");
map.put(KeyStroke.getKeyStroke("control G"), "group");
map.put(KeyStroke.getKeyStroke("control U"), "ungroup");
map.put(KeyStroke.getKeyStroke("control ADD"), "zoomIn");
map.put(KeyStroke.getKeyStroke("control SUBTRACT"), "zoomOut");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_G, KeyEvent.META_DOWN_MASK), "group");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_U, KeyEvent.META_DOWN_MASK), "ungroup");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_ADD, KeyEvent.META_DOWN_MASK), "zoomIn");
map.put(KeyStroke.getKeyStroke(KeyEvent.VK_SUBTRACT, KeyEvent.META_DOWN_MASK), "zoomOut");
} // if (OSNAME.indexOf("windows") != -1)
// windows or linux then similar keyboard
else {
Expand Down
5 changes: 2 additions & 3 deletions src/main/java/edu/wright/dase/swing/editor/EditorActions.java
Expand Up @@ -645,7 +645,7 @@ public boolean accept(File file) {
} else if (editor.getCurrentFile() != null) {
wd = editor.getCurrentFile().getParent();
} else {
wd = System.getProperty("user.dir");
wd = System.getProperty("user.home");
}

JFileChooser fc = new JFileChooser(wd);
Expand Down Expand Up @@ -685,7 +685,6 @@ public boolean accept(File file) {

try {
String ext = filename.substring(filename.lastIndexOf('.') + 1);

{
Color bg = null;

Expand Down Expand Up @@ -1471,7 +1470,7 @@ public void actionPerformed(ActionEvent e) {
mxGraph graph = editor.getGraphComponent().getGraph();

if (graph != null) {
String wd = (lastDir != null) ? lastDir : System.getProperty("user.dir");
String wd = (lastDir != null) ? lastDir : System.getProperty("user.home");

JFileChooser fc = new JFileChooser(wd);

Expand Down
120 changes: 60 additions & 60 deletions src/main/java/edu/wright/dase/swing/editor/EditorMenuBar.java
Expand Up @@ -142,59 +142,59 @@ public EditorMenuBar(final BasicGraphEditor editor) {
// Creates the view menu
menu = add(new JMenu(mxResources.get("view")));

JMenuItem item = menu.add(new TogglePropertyItem(graphComponent, mxResources.get("pageLayout"), "PageVisible",
true, new ActionListener() {
public void actionPerformed(ActionEvent e) {
if (graphComponent.isPageVisible() && graphComponent.isCenterPage()) {
graphComponent.zoomAndCenter();
} else {
graphComponent.getGraphControl().updatePreferredSize();
}
}
}));

item.addActionListener(new ActionListener() {
/*
* (non-Javadoc)
*
* @see
* java.awt.event.ActionListener#actionPerformed(java.awt.event.
* ActionEvent)
*/
public void actionPerformed(ActionEvent e) {
if (e.getSource() instanceof TogglePropertyItem) {
final mxGraphComponent graphComponent = editor.getGraphComponent();
TogglePropertyItem toggleItem = (TogglePropertyItem) e.getSource();

if (toggleItem.isSelected()) {
// Scrolls the view to the center
SwingUtilities.invokeLater(new Runnable() {
/*
* (non-Javadoc)
*
* @see java.lang.Runnable#run()
*/
public void run() {
graphComponent.scrollToCenter(true);
graphComponent.scrollToCenter(false);
}
});
} else {
// Resets the translation of the view
mxPoint tr = graphComponent.getGraph().getView().getTranslate();

if (tr.getX() != 0 || tr.getY() != 0) {
graphComponent.getGraph().getView().setTranslate(new mxPoint());
}
}
}
}
});

// menu.add(new TogglePropertyItem(graphComponent,
// mxResources.get("antialias"), "AntiAlias", true));

menu.addSeparator();
// JMenuItem item = menu.add(new TogglePropertyItem(graphComponent, mxResources.get("pageLayout"), "PageVisible",
// true, new ActionListener() {
// public void actionPerformed(ActionEvent e) {
// if (graphComponent.isPageVisible() && graphComponent.isCenterPage()) {
// graphComponent.zoomAndCenter();
// } else {
// graphComponent.getGraphControl().updatePreferredSize();
// }
// }
// }));
//
// item.addActionListener(new ActionListener() {
// /*
// * (non-Javadoc)
// *
// * @see
// * java.awt.event.ActionListener#actionPerformed(java.awt.event.
// * ActionEvent)
// */
// public void actionPerformed(ActionEvent e) {
// if (e.getSource() instanceof TogglePropertyItem) {
// final mxGraphComponent graphComponent = editor.getGraphComponent();
// TogglePropertyItem toggleItem = (TogglePropertyItem) e.getSource();
//
// if (toggleItem.isSelected()) {
// // Scrolls the view to the center
// SwingUtilities.invokeLater(new Runnable() {
// /*
// * (non-Javadoc)
// *
// * @see java.lang.Runnable#run()
// */
// public void run() {
// graphComponent.scrollToCenter(true);
// graphComponent.scrollToCenter(false);
// }
// });
// } else {
// // Resets the translation of the view
// mxPoint tr = graphComponent.getGraph().getView().getTranslate();
//
// if (tr.getX() != 0 || tr.getY() != 0) {
// graphComponent.getGraph().getView().setTranslate(new mxPoint());
// }
// }
// }
// }
// });
//
// // menu.add(new TogglePropertyItem(graphComponent,
// // mxResources.get("antialias"), "AntiAlias", true));
//
// menu.addSeparator();

menu.add(new ToggleGridItem(editor, mxResources.get("grid")));
menu.add(new ToggleRulersItem(editor, mxResources.get("rulers")));
Expand All @@ -219,14 +219,14 @@ public void run() {
menu.add(editor.bind(mxResources.get("zoomIn"), mxGraphActions.getZoomInAction()));
menu.add(editor.bind(mxResources.get("zoomOut"), mxGraphActions.getZoomOutAction()));

menu.addSeparator();
//menu.addSeparator();

menu.add(editor.bind(mxResources.get("page"), new ZoomPolicyAction(mxGraphComponent.ZOOM_POLICY_PAGE)));
menu.add(editor.bind(mxResources.get("width"), new ZoomPolicyAction(mxGraphComponent.ZOOM_POLICY_WIDTH)));
// menu.add(editor.bind(mxResources.get("page"), new ZoomPolicyAction(mxGraphComponent.ZOOM_POLICY_PAGE)));
// menu.add(editor.bind(mxResources.get("width"), new ZoomPolicyAction(mxGraphComponent.ZOOM_POLICY_WIDTH)));

menu.addSeparator();
//menu.addSeparator();

menu.add(editor.bind(mxResources.get("actualSize"), mxGraphActions.getZoomActualAction()));
//menu.add(editor.bind(mxResources.get("actualSize"), mxGraphActions.getZoomActualAction()));

// Creates the format menu
menu = add(new JMenu(mxResources.get("format")));
Expand Down Expand Up @@ -552,8 +552,8 @@ public void run() {
// }
// });

item = menu.add(new JMenuItem(mxResources.get("aboutGraphEditor")));
item.addActionListener(new ActionListener() {
JMenuItem aboutItem = menu.add(new JMenuItem(mxResources.get("aboutGraphEditor")));
aboutItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
editor.about();
}
Expand Down
Expand Up @@ -129,7 +129,7 @@ public SchemaEditorMenuBar(final BasicGraphEditor editor)
new ActionListener()
{
/**
*
*
*/
public void actionPerformed(ActionEvent e)
{
Expand Down Expand Up @@ -220,15 +220,15 @@ public void run()

menu.addSeparator();

menu.add(editor.bind(mxResources.get("page"), new ZoomPolicyAction(
mxGraphComponent.ZOOM_POLICY_PAGE)));
menu.add(editor.bind(mxResources.get("width"), new ZoomPolicyAction(
mxGraphComponent.ZOOM_POLICY_WIDTH)));
// menu.add(editor.bind(mxResources.get("page"), new ZoomPolicyAction(
// mxGraphComponent.ZOOM_POLICY_PAGE)));
// menu.add(editor.bind(mxResources.get("width"), new ZoomPolicyAction(
// mxGraphComponent.ZOOM_POLICY_WIDTH)));

menu.addSeparator();

menu.add(editor.bind(mxResources.get("actualSize"), mxGraphActions
.getZoomActualAction()));
// menu.addSeparator();
//
// menu.add(editor.bind(mxResources.get("actualSize"), mxGraphActions
// .getZoomActualAction()));

// Creates the diagram menu
menu = add(new JMenu(mxResources.get("diagram")));
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/resources/editor.properties
Expand Up @@ -203,4 +203,4 @@ noCellSelected=No cell selected.
loseChanges=Lose Changes?
noLayout=Layout unavailable
error=Error
owlaxVersion=1.0.0
owlaxVersion=1.2.0
4 changes: 2 additions & 2 deletions update.properties
@@ -1,6 +1,6 @@
id=OWLAx
version=1.1.0
download=https://github.com/md-k-sarker/OWLAx/releases/download/v1.1.0/OWLAx-1.1.0.jar?raw=true
version=1.2.0
download=https://github.com/md-k-sarker/OWLAx/releases/download/v1.2.0/OWLAx-1.2.0.jar?raw=true
name=OWLAx: OWL Axiomatizer
readme=https://raw.githubusercontent.com/md-k-sarker/OWLAx/master/plugin/binary/version-info.html
license=http://opensource.org/licenses/BSD-2-Clause
Expand Down

0 comments on commit 59c82ac

Please sign in to comment.