Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2011-02-10 14:06:15 -0500
committerRyan D. Brooks2011-02-10 14:06:15 -0500
commit374ec5a62d0b17e5ee16af63ba33b19b02574c17 (patch)
treeb9554f6bea6bd4290486b6643f1987c35f05f046 /plugins/org.eclipse.osee.ats.dsl.ui/src
parent4b713df8ad6ffa3e3fac09066f35eb6015685461 (diff)
downloadorg.eclipse.osee-374ec5a62d0b17e5ee16af63ba33b19b02574c17.tar.gz
org.eclipse.osee-374ec5a62d0b17e5ee16af63ba33b19b02574c17.tar.xz
org.eclipse.osee-374ec5a62d0b17e5ee16af63ba33b19b02574c17.zip
feature: Add ATS Xtext plugins
Diffstat (limited to 'plugins/org.eclipse.osee.ats.dsl.ui/src')
-rw-r--r--plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/AtsDslUiModule.java15
-rw-r--r--plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/contentassist/AtsDslProposalProvider.java142
-rw-r--r--plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/labeling/AtsDslDescriptionLabelProvider.java27
-rw-r--r--plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/labeling/AtsDslLabelProvider.java34
-rw-r--r--plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/outline/AtsDslOutlineTreeProvider.java13
-rw-r--r--plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/quickfix/AtsDslQuickfixProvider.java19
6 files changed, 250 insertions, 0 deletions
diff --git a/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/AtsDslUiModule.java b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/AtsDslUiModule.java
new file mode 100644
index 0000000000..a391d9775e
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/AtsDslUiModule.java
@@ -0,0 +1,15 @@
+/*
+ * generated by Xtext
+ */
+package org.eclipse.osee.ats.dsl.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+
+/**
+ * Use this class to register components to be used within the IDE.
+ */
+public class AtsDslUiModule extends org.eclipse.osee.ats.dsl.ui.AbstractAtsDslUiModule {
+ public AtsDslUiModule(AbstractUIPlugin plugin) {
+ super(plugin);
+ }
+}
diff --git a/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/contentassist/AtsDslProposalProvider.java b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/contentassist/AtsDslProposalProvider.java
new file mode 100644
index 0000000000..955f3a807f
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/contentassist/AtsDslProposalProvider.java
@@ -0,0 +1,142 @@
+/*
+ * generated by Xtext
+ */
+package org.eclipse.osee.ats.dsl.ui.contentassist;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.List;
+import java.util.logging.Level;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.jface.text.contentassist.ICompletionProposal;
+import org.eclipse.osee.ats.dsl.ui.internal.AtsDslActivator;
+import org.eclipse.osee.framework.core.exception.OseeCoreException;
+import org.eclipse.osee.framework.core.model.type.AttributeType;
+import org.eclipse.osee.framework.logging.OseeLog;
+import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
+import org.eclipse.xtext.Assignment;
+import org.eclipse.xtext.ui.editor.contentassist.ContentAssistContext;
+import org.eclipse.xtext.ui.editor.contentassist.ICompletionProposalAcceptor;
+
+/**
+ * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#contentAssist on how to customize content assistant
+ */
+public class AtsDslProposalProvider extends AbstractAtsDslProposalProvider {
+
+ @Override
+ public void completeToState_Options(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if (acceptor.canAcceptMoreProposals()) {
+ for (String stateName : Arrays.asList("AsDefault", "AsReturn", "OverrideAttributeValidation")) {
+ String displayProposalAs = stateName;
+ ICompletionProposal proposal = createCompletionProposal(stateName, displayProposalAs, null, context);
+ acceptor.accept(proposal);
+ }
+ }
+ }
+
+ @Override
+ public void completeStateDef_PageType(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if (acceptor.canAcceptMoreProposals()) {
+ for (String stateName : Arrays.asList("Working", "Completed", "Cancelled")) {
+ String displayProposalAs = stateName;
+ ICompletionProposal proposal = createCompletionProposal(stateName, displayProposalAs, null, context);
+ acceptor.accept(proposal);
+ }
+ }
+ }
+
+ @Override
+ public void completeStateDef_Rules(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if (acceptor.canAcceptMoreProposals()) {
+ List<String> rules =
+ Arrays.asList("RequireStateHourSpentPrompt", "AddDecisionValidateBlockingReview",
+ "AddDecisionValidateNonBlockingReview", "AllowTransitionWithWorkingBranch", "ForceAssigneesToTeamLeads",
+ "RequireTargetedVersion", "AllowPriviledgedEditToTeamMember",
+ "AllowPriviledgedEditToTeamMemberAndOriginator", "AllowPriviledgedEditToAll", "AllowEditToAll",
+ "AllowAssigneeToAll");
+ Collections.sort(rules);
+ for (String stateName : rules) {
+ String displayProposalAs = stateName;
+ ICompletionProposal proposal = createCompletionProposal(stateName, displayProposalAs, null, context);
+ acceptor.accept(proposal);
+ }
+ }
+ }
+
+ @Override
+ public void completeWidgetDef_Option(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ provideWidgetOptions(context, acceptor);
+ }
+
+ private void provideWidgetOptions(ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if (acceptor.canAcceptMoreProposals()) {
+ List<String> rules =
+ Arrays.asList("REQUIRED_FOR_TRANSITION", "NOT_REQUIRED_FOR_TRANSITION", "REQUIRED_FOR_COMPLETION",
+ "NOT_REQUIRED_FOR_COMPLETION", "ENABLED", "NOT_ENABLED", "EDITABLE", "NOT_EDITABLE", "MULTI_SELECT",
+ "HORIZONTAL_LABEL", "VERTICAL_LABEL", "LABEL_AFTER", "LABEL_BEFORE", "NO_LABEL", "SORTED",
+ "ADD_DEFAULT_VALUE", "NO_DEFAULT_VALUE", "BEGIN_COMPOSITE_4", "BEGIN_COMPOSITE_6", "BEGIN_COMPOSITE_8",
+ "BEGIN_COMPOSITE_10", "END_COMPOSITE", "FILL_NONE", "FILL_HORIZONTALLY", "FILL_VERTICALLY",
+ "ALIGN_LEFT", "ALIGN_RIGHT", "ALIGN_CENTER");
+ for (String stateName : rules) {
+ String displayProposalAs = stateName;
+ ICompletionProposal proposal = createCompletionProposal(stateName, displayProposalAs, null, context);
+ acceptor.accept(proposal);
+ }
+ }
+ }
+
+ @Override
+ public void completeWidgetDef_XWidgetName(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if (acceptor.canAcceptMoreProposals()) {
+ List<String> rules =
+ Arrays.asList("XTextDam", "XComboBooleanDam", "XComboDam(option,option,option)",
+ "XComboDam(OPTIONS_FROM_ATTRIBUTE_VALIDITY)", "XCheckboxDam", "XFloatDam", "XIntegerDam", "XLabel");
+ for (String stateName : rules) {
+ String proposalValue = "\"" + stateName + "\"";
+ String displayProposalAs = proposalValue;
+ ICompletionProposal proposal = createCompletionProposal(proposalValue, displayProposalAs, null, context);
+ acceptor.accept(proposal);
+ }
+ }
+ }
+
+ @Override
+ public void completeAttrWidget_Option(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ super.completeAttrWidget_Option(model, assignment, context, acceptor);
+ provideWidgetOptions(context, acceptor);
+ }
+
+ @Override
+ public void completeWidgetDef_AttributeName(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ super.completeWidgetDef_AttributeName(model, assignment, context, acceptor);
+ provideAttributeNameOptions(context, acceptor);
+ }
+
+ private void provideAttributeNameOptions(ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ if (acceptor.canAcceptMoreProposals()) {
+ try {
+ List<String> attrs = new ArrayList<String>();
+ for (AttributeType type : AttributeTypeManager.getAllTypes()) {
+ attrs.add(type.getName());
+ }
+ Collections.sort(attrs);
+ for (String attrName : attrs) {
+ String displayProposalAs = attrName;
+ ICompletionProposal proposal =
+ createCompletionProposal("\"" + attrName + "\"", displayProposalAs, null, context);
+ acceptor.accept(proposal);
+ }
+ } catch (OseeCoreException ex) {
+ OseeLog.log(AtsDslActivator.class, Level.SEVERE, ex);
+ }
+ }
+ }
+
+ @Override
+ public void completeAttrWidget_AttributeName(EObject model, Assignment assignment, ContentAssistContext context, ICompletionProposalAcceptor acceptor) {
+ super.completeAttrWidget_AttributeName(model, assignment, context, acceptor);
+ provideAttributeNameOptions(context, acceptor);
+ }
+
+}
diff --git a/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/labeling/AtsDslDescriptionLabelProvider.java b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/labeling/AtsDslDescriptionLabelProvider.java
new file mode 100644
index 0000000000..4a130ecfe9
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/labeling/AtsDslDescriptionLabelProvider.java
@@ -0,0 +1,27 @@
+/*
+* generated by Xtext
+*/
+package org.eclipse.osee.ats.dsl.ui.labeling;
+
+import org.eclipse.xtext.ui.label.DefaultDescriptionLabelProvider;
+
+/**
+ * Provides labels for a IEObjectDescriptions and IResourceDescriptions.
+ *
+ * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
+ */
+public class AtsDslDescriptionLabelProvider extends DefaultDescriptionLabelProvider {
+
+/*
+ //Labels and icons can be computed like this:
+
+ String text(IEObjectDescription ele) {
+ return "my "+ele.getName();
+ }
+
+ String image(IEObjectDescription ele) {
+ return ele.getEClass().getName() + ".gif";
+ }
+*/
+
+}
diff --git a/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/labeling/AtsDslLabelProvider.java b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/labeling/AtsDslLabelProvider.java
new file mode 100644
index 0000000000..083f557c98
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/labeling/AtsDslLabelProvider.java
@@ -0,0 +1,34 @@
+/*
+* generated by Xtext
+*/
+package org.eclipse.osee.ats.dsl.ui.labeling;
+
+import org.eclipse.emf.edit.ui.provider.AdapterFactoryLabelProvider;
+import org.eclipse.xtext.ui.label.DefaultEObjectLabelProvider;
+
+import com.google.inject.Inject;
+
+/**
+ * Provides labels for a EObjects.
+ *
+ * see http://www.eclipse.org/Xtext/documentation/latest/xtext.html#labelProvider
+ */
+public class AtsDslLabelProvider extends DefaultEObjectLabelProvider {
+
+ @Inject
+ public AtsDslLabelProvider(AdapterFactoryLabelProvider delegate) {
+ super(delegate);
+ }
+
+/*
+ //Labels and icons can be computed like this:
+
+ String text(MyModel ele) {
+ return "my "+ele.getName();
+ }
+
+ String image(MyModel ele) {
+ return "MyModel.gif";
+ }
+*/
+}
diff --git a/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/outline/AtsDslOutlineTreeProvider.java b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/outline/AtsDslOutlineTreeProvider.java
new file mode 100644
index 0000000000..2cf5a3194c
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/outline/AtsDslOutlineTreeProvider.java
@@ -0,0 +1,13 @@
+/*
+ * generated by Xtext
+ */
+package org.eclipse.osee.ats.dsl.ui.outline;
+
+import org.eclipse.xtext.ui.editor.outline.impl.DefaultOutlineTreeProvider;
+
+/**
+ * customization of the default outline structure
+ */
+public class AtsDslOutlineTreeProvider extends DefaultOutlineTreeProvider {
+ //
+}
diff --git a/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/quickfix/AtsDslQuickfixProvider.java b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/quickfix/AtsDslQuickfixProvider.java
new file mode 100644
index 0000000000..ee0b12a208
--- /dev/null
+++ b/plugins/org.eclipse.osee.ats.dsl.ui/src/org/eclipse/osee/ats/dsl/ui/quickfix/AtsDslQuickfixProvider.java
@@ -0,0 +1,19 @@
+
+package org.eclipse.osee.ats.dsl.ui.quickfix;
+
+import org.eclipse.xtext.ui.editor.quickfix.DefaultQuickfixProvider;
+
+public class AtsDslQuickfixProvider extends DefaultQuickfixProvider {
+
+// @Fix(MyJavaValidator.INVALID_NAME)
+// public void capitalizeName(final Issue issue, IssueResolutionAcceptor acceptor) {
+// acceptor.accept(issue, "Capitalize name", "Capitalize the name.", "upcase.png", new IModification() {
+// public void apply(IModificationContext context) throws BadLocationException {
+// IXtextDocument xtextDocument = context.getXtextDocument();
+// String firstLetter = xtextDocument.get(issue.getOffset(), 1);
+// xtextDocument.replace(issue.getOffset(), 1, firstLetter.toUpperCase());
+// }
+// });
+// }
+
+}

Back to the top