diff --git a/api.visual/apichanges.xml b/api.visual/apichanges.xml
--- a/api.visual/apichanges.xml
+++ b/api.visual/apichanges.xml
@@ -686,7 +686,7 @@
GraphLayoutFactory.createHierarchicalGraphLayout added two additional
calls to allow configuration of inverted and layout spacing.
-
+
@@ -703,6 +703,21 @@
+
+
+
+ Added interface that extends EditorController for ability to query for invocation type
+
+
+
+
+
+ InplaceEditorProvider.TypedEditorController
+ contains getEditorInvocationType()
which returns invocation type
+ (MOUSE
, KEY
, CODE
).
+
+
+
diff --git a/api.visual/manifest.mf b/api.visual/manifest.mf
--- a/api.visual/manifest.mf
+++ b/api.visual/manifest.mf
@@ -1,6 +1,6 @@
Manifest-Version: 1.0
OpenIDE-Module: org.netbeans.api.visual
OpenIDE-Module-Localizing-Bundle: org/netbeans/modules/visual/resources/Bundle.properties
-OpenIDE-Module-Specification-Version: 2.14
+OpenIDE-Module-Specification-Version: 2.16
AutoUpdate-Essential-Module: true
diff --git a/api.visual/src/org/netbeans/api/visual/action/InplaceEditorProvider.java b/api.visual/src/org/netbeans/api/visual/action/InplaceEditorProvider.java
--- a/api.visual/src/org/netbeans/api/visual/action/InplaceEditorProvider.java
+++ b/api.visual/src/org/netbeans/api/visual/action/InplaceEditorProvider.java
@@ -112,6 +112,47 @@
}
/**
+ * This is an interface that extends EditorController for ability to query for invocation type.
+ * @since 2.16
+ */
+ interface TypedEditorController extends EditorController {
+
+ /**
+ * Returns a type of editor invocation
+ * @return invocation type
+ * @since 2.16
+ */
+ EditorInvocationType getEditorInvocationType ();
+
+ }
+
+ /**
+ * Represents a type of in-place editor action invocation.
+ * @since 2.16
+ */
+ enum EditorInvocationType {
+
+ /**
+ * Invoked by mouse.
+ * @since 2.16
+ */
+ MOUSE,
+
+ /**
+ * Invoked by keyboard.
+ * @since 2.16
+ */
+ KEY,
+
+ /**
+ * Invoked by ActionFactory.getInplaceEditorController (inplaceEditorAction).openEditor(widget)
method.
+ * @since 2.16
+ */
+ CODE,
+
+ }
+
+ /**
* Called to notify about opening an in-place editor.
* @param controller the editor controller
* @param widget the widget where the editor is opened
diff --git a/api.visual/src/org/netbeans/modules/visual/action/InplaceEditorAction.java b/api.visual/src/org/netbeans/modules/visual/action/InplaceEditorAction.java
--- a/api.visual/src/org/netbeans/modules/visual/action/InplaceEditorAction.java
+++ b/api.visual/src/org/netbeans/modules/visual/action/InplaceEditorAction.java
@@ -55,12 +55,13 @@
/**
* @author David Kaspar
*/
-public final class InplaceEditorAction extends WidgetAction.LockedAdapter implements InplaceEditorProvider.EditorController {
+public final class InplaceEditorAction extends WidgetAction.LockedAdapter implements InplaceEditorProvider.TypedEditorController {
private InplaceEditorProvider provider;
private C editor = null;
private Widget widget = null;
private Rectangle rectangle = null;
+ private InplaceEditorProvider.EditorInvocationType invocationType;
public InplaceEditorAction(InplaceEditorProvider provider) {
this.provider = provider;
@@ -70,15 +71,17 @@
return editor != null;
}
+ @Override
public State mouseClicked(Widget widget, WidgetMouseEvent event) {
if (event.getButton() == MouseEvent.BUTTON1 && event.getClickCount() == 2) {
- if (openEditor(widget)) {
+ if (openEditor(widget, InplaceEditorProvider.EditorInvocationType.MOUSE)) {
return State.createLocked(widget, this);
}
}
return State.REJECTED;
}
+ @Override
public State mousePressed(Widget widget, WidgetMouseEvent event) {
// if (editor != null)
// closeEditor (true);
@@ -94,6 +97,7 @@
return State.REJECTED;
}
+ @Override
public State mouseReleased(Widget widget, WidgetAction.WidgetMouseEvent event) {
// if (editor != null)
// closeEditor (true);
@@ -109,9 +113,10 @@
return State.REJECTED;
}
+ @Override
public State keyPressed(Widget widget, WidgetKeyEvent event) {
if (event.getKeyChar() == KeyEvent.VK_ENTER) {
- if (openEditor(widget)) {
+ if (openEditor(widget, InplaceEditorProvider.EditorInvocationType.KEY)) {
return State.createLocked(widget, this);
}
}
@@ -123,6 +128,10 @@
}
public final boolean openEditor(Widget widget) {
+ return openEditor (widget, InplaceEditorProvider.EditorInvocationType.CODE);
+ }
+
+ private boolean openEditor (Widget widget, InplaceEditorProvider.EditorInvocationType invocationType) {
if (editor != null) {
return false;
}
@@ -131,8 +140,10 @@
if (component == null) {
return false;
}
+ this.invocationType = invocationType;
editor = provider.createEditorComponent(this, widget);
if (editor == null) {
+ this.invocationType = null;
return false;
}
this.widget = widget;
@@ -204,7 +215,7 @@
editor = null;
widget = null;
rectangle = null;
-
+ invocationType = null;
}
public void notifyEditorComponentBoundsChanged() {
@@ -268,4 +279,9 @@
editor.setBounds(rectangle);
editor.repaint();
}
+
+ public InplaceEditorProvider.EditorInvocationType getEditorInvocationType () {
+ return invocationType;
+ }
+
}