Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/infra/gmfdiag/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/partialEditing/IActionContributor.java')
-rw-r--r--plugins/infra/gmfdiag/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/partialEditing/IActionContributor.java47
1 files changed, 47 insertions, 0 deletions
diff --git a/plugins/infra/gmfdiag/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/partialEditing/IActionContributor.java b/plugins/infra/gmfdiag/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/partialEditing/IActionContributor.java
new file mode 100644
index 00000000000..b144cd697ad
--- /dev/null
+++ b/plugins/infra/gmfdiag/org.eclipse.xtext.gmf.glue/src/org/eclipse/xtext/gmf/glue/partialEditing/IActionContributor.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2010 itemis AG (http://www.itemis.eu) and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *******************************************************************************/
+package org.eclipse.xtext.gmf.glue.partialEditing;
+
+import java.util.List;
+
+import com.google.inject.Binding;
+import com.google.inject.Inject;
+import com.google.inject.Injector;
+import com.google.inject.Singleton;
+import com.google.inject.TypeLiteral;
+
+/**
+ *
+ */
+public interface IActionContributor {
+ /**
+ * hook used to contribute any actions on editor start up.
+ * @param editor
+ */
+ public void contributeActions(PartialModelEditor editor);
+
+
+ /**
+ * composite action contributor delegating call to all registered {@link IActionContributor}
+ */
+ @Singleton
+ public class CompositeImpl implements IActionContributor {
+
+ @Inject
+ private Injector injector;
+
+ public void contributeActions(PartialModelEditor editor) {
+ List<Binding<IActionContributor>> bindingsByType = injector.findBindingsByType(TypeLiteral.get(IActionContributor.class));
+ for (Binding<IActionContributor> binding : bindingsByType) {
+ IActionContributor actionContributor = injector.getInstance(binding.getKey());
+ actionContributor.contributeActions(editor);
+ }
+ }
+
+ }
+} \ No newline at end of file

Back to the top