Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet')
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java38
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeExistsFilter.java52
2 files changed, 87 insertions, 3 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java
index 2af6622c6e8..1bcdebbc43f 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java
@@ -273,13 +273,44 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
new Label(attributeControls, SWT.NONE); // spacerLabelSoTheNextOneWillBeInColumnTwo
- Label wildLabel = new Label(attributeControls, SWT.NONE);
- wildLabel.setText("(* = any string, \\* = literal *)");
-
ATTRIBUTE_VALUE_FILTER = new AttributeValueFilter(attributeControls, attributeTypeList, attributeValue);
addToSearchTypeList(ATTRIBUTE_VALUE_FILTER);
}
+ private void createAttributeExistsControls(Composite optionsComposite) {
+ Composite attributeControls = new Composite(optionsComposite, SWT.NONE);
+ attributeControls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ attributeControls.setLayout(new GridLayout(2, false));
+
+ Label typeLabel = new Label(attributeControls, SWT.HORIZONTAL);
+ typeLabel.setText("Attribute Type:");
+
+ final ComboViewer attributeTypeList = new ComboViewer(attributeControls, SWT.DROP_DOWN | SWT.READ_ONLY);
+ attributeTypeList.setContentProvider(new SearchContentProvider());
+ attributeTypeList.setLabelProvider(new SearchLabelProvider());
+ attributeTypeList.setSorter(new SearchSorter());
+
+ try {
+ for (IAttributeType type : AttributeTypeManager.getValidAttributeTypes(getSelectedBranch())) {
+ attributeTypeList.add(type);
+ attributeTypeList.setData(type.getName(), type);
+ }
+ } catch (Exception ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP,
+ "Error encountered while getting list of attribute types", ex);
+ }
+ attributeTypeList.getCombo().setVisibleItemCount(Math.min(attributeTypeList.getCombo().getItemCount(), 15));
+ attributeTypeList.getCombo().select(lastAttributeTypeListSelected);
+ attributeTypeList.addSelectionChangedListener(new ISelectionChangedListener() {
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ lastAttributeTypeListSelected = attributeTypeList.getCombo().getSelectionIndex();
+ }
+ });
+
+ addToSearchTypeList(new AttributeExistsFilter(attributeControls, attributeTypeList));
+ }
+
private void addFilterControls(Composite mainComposite) {
Group filterGroup = new Group(mainComposite, SWT.NONE);
filterGroup.setText("Create a Filter");
@@ -303,6 +334,7 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
optionsComposite.setLayout(selectionLayout);
createAttributeSearchControls(optionsComposite);
+ createAttributeExistsControls(optionsComposite);
createArtifactTypeSearchControls(optionsComposite);
createRelationSearchControls(optionsComposite);
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeExistsFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeExistsFilter.java
new file mode 100644
index 00000000000..bc472031dcf
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeExistsFilter.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2014 Boeing.
+ * 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
+ *
+ * Contributors:
+ * Boeing - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.osee.framework.ui.skynet.search;
+
+import org.eclipse.jface.viewers.ComboViewer;
+import org.eclipse.osee.framework.core.data.IAttributeType;
+import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.skynet.core.artifact.search.AttributeExistsSearch;
+import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
+import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
+import org.eclipse.swt.widgets.Control;
+
+/**
+ * @author John Misinco
+ */
+public class AttributeExistsFilter extends SearchFilter {
+ private final ComboViewer attributeTypeList;
+
+ public AttributeExistsFilter(Control optionsControl, ComboViewer attributeTypeList) {
+ super("Attribute Exists", optionsControl);
+ this.attributeTypeList = attributeTypeList;
+ }
+
+ @Override
+ public void addFilterTo(FilterTableViewer filterViewer) {
+ String typeName = attributeTypeList.getCombo().getText();
+
+ IAttributeType attributeType = (IAttributeType) attributeTypeList.getData(typeName);
+ ISearchPrimitive primitive = new AttributeExistsSearch(attributeType);
+ filterViewer.addItem(primitive, getFilterName(), typeName, Strings.EMPTY_STRING);
+ }
+
+ @Override
+ public boolean isValid() {
+ return true;
+ }
+
+ @Override
+ public void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled) {
+ ISearchPrimitive primitive = AttributeExistsSearch.getPrimitive(storageString);
+ filterViewer.addItem(primitive, getFilterName(), type, value);
+ }
+
+}

Back to the top