Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorgan E. Cook2015-11-18 21:18:33 +0000
committerdonald.g.dunne2015-12-04 21:29:20 +0000
commitd8f97318dab7e03709ac2353c654273293b06ccb (patch)
tree53cb4ae26e85a98bee7661d5d478a2fb89951fbb /plugins
parentf4c5d449969bb1cca005a4f3e0d3d5441bba3f48 (diff)
downloadorg.eclipse.osee-d8f97318dab7e03709ac2353c654273293b06ccb.tar.gz
org.eclipse.osee-d8f97318dab7e03709ac2353c654273293b06ccb.tar.xz
org.eclipse.osee-d8f97318dab7e03709ac2353c654273293b06ccb.zip
refactor: Update to artifact search GUI
Change-Id: I305e3a4a20b27e746126ad670319d9eb585ed1a0 Signed-off-by: Morgan E. Cook <Morgan.e.cook@boeing.com> Signed-off-by: donald.g.dunne <donald.g.dunne@boeing.com>
Diffstat (limited to 'plugins')
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeExistsSearch.java34
-rw-r--r--plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeNotExistsSearch.java34
-rw-r--r--plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/StringLabelProvider.java4
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ToStringViewerSorter.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactSearchPage.java252
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java18
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeExistsFilter.java26
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeNotExistsFilter.java24
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/NotInRelationFilter.java5
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchContentProvider.java36
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java2
13 files changed, 247 insertions, 203 deletions
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeExistsSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeExistsSearch.java
index 28c9d106d92..ae12e336bac 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeExistsSearch.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeExistsSearch.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact.search;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -18,31 +20,45 @@ import org.eclipse.osee.framework.jdk.core.util.Conditions;
* @author John Misinco
*/
public class AttributeExistsSearch implements ISearchPrimitive {
- private final IAttributeType attributeType;
+ private final List<IAttributeType> attributeTypes;
- public AttributeExistsSearch(IAttributeType attributeType) {
- Conditions.checkNotNull(attributeType, "attributeType");
- this.attributeType = attributeType;
+ public AttributeExistsSearch(List<IAttributeType> attributeTypes) {
+ Conditions.checkNotNull(attributeTypes, "attributeTypes");
+ this.attributeTypes = attributeTypes;
}
@Override
public String toString() {
- return "Attribute type: \"" + attributeType + "\"";
+ return "Attribute type: \"" + attributeTypes + "\"";
}
@Override
public String getStorageString() {
- return attributeType.getGuid().toString();
+ StringBuilder storageString = new StringBuilder();
+
+ for (IAttributeType attrType : attributeTypes) {
+ storageString.append(attrType.getGuid().toString());
+ storageString.append(",");
+ }
+ storageString.deleteCharAt(storageString.length() - 1);
+ return storageString.toString();
+
}
public static AttributeExistsSearch getPrimitive(String storageString) {
- IAttributeType type = TokenFactory.createAttributeType(Long.valueOf(storageString), "SearchAttrType");
- return new AttributeExistsSearch(type);
+ ArrayList<IAttributeType> attributeTypes = new ArrayList<>();
+
+ for (String attributeTypeId : storageString.split(",")) {
+ attributeTypes.add(TokenFactory.createAttributeType(Long.valueOf(attributeTypeId), "SearchAttrType"));
+ }
+
+ return new AttributeExistsSearch(attributeTypes);
+
}
@Override
public void addToQuery(QueryBuilderArtifact builder) {
- builder.andExists(attributeType);
+ builder.andExists(attributeTypes);
}
}
diff --git a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeNotExistsSearch.java b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeNotExistsSearch.java
index 5784f2eb6ea..80cc55bedf2 100644
--- a/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeNotExistsSearch.java
+++ b/plugins/org.eclipse.osee.framework.skynet.core/src/org/eclipse/osee/framework/skynet/core/artifact/search/AttributeNotExistsSearch.java
@@ -10,6 +10,8 @@
*******************************************************************************/
package org.eclipse.osee.framework.skynet.core.artifact.search;
+import java.util.ArrayList;
+import java.util.List;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.TokenFactory;
import org.eclipse.osee.framework.jdk.core.util.Conditions;
@@ -18,36 +20,42 @@ import org.eclipse.osee.framework.jdk.core.util.Conditions;
* @author John Misinco
*/
public class AttributeNotExistsSearch implements ISearchPrimitive {
- private static final String TOKEN = ";";
- private final IAttributeType attributeType;
+ private final List<IAttributeType> attributeTypes;
- public AttributeNotExistsSearch(IAttributeType attributeType) {
- Conditions.checkNotNull(attributeType, "attributeType");
- this.attributeType = attributeType;
+ public AttributeNotExistsSearch(List<IAttributeType> attributeTypes) {
+ Conditions.checkNotNull(attributeTypes, "attributeTypes");
+ this.attributeTypes = attributeTypes;
}
@Override
public String toString() {
- return "Attribute Not Exists type: \"" + attributeType + "\"";
+ return "Attribute Not Exists type: \"" + attributeTypes + "\"";
}
@Override
public String getStorageString() {
- return "DNE" + TOKEN + attributeType.getGuid().toString();
+ StringBuilder storageString = new StringBuilder();
+
+ for (IAttributeType attrType : attributeTypes) {
+ storageString.append(attrType.getGuid().toString());
+ storageString.append(",");
+ }
+ storageString.deleteCharAt(storageString.length() - 1);
+ return storageString.toString();
}
public static AttributeNotExistsSearch getPrimitive(String storageString) {
- String[] values = storageString.split(TOKEN);
- if (values.length < 2) {
- throw new IllegalStateException("Value for " + InRelationSearch.class.getSimpleName() + " not parsable");
+ ArrayList<IAttributeType> attributeTypes = new ArrayList<>();
+
+ for (String attributeTypeId : storageString.split(",")) {
+ attributeTypes.add(TokenFactory.createAttributeType(Long.valueOf(attributeTypeId), "SearchAttrType"));
}
- IAttributeType type = TokenFactory.createAttributeType(Long.valueOf(values[1]), "SearchAttrType");
- return new AttributeNotExistsSearch(type);
+ return new AttributeNotExistsSearch(attributeTypes);
}
@Override
public void addToQuery(QueryBuilderArtifact builder) {
- builder.andNotExists(attributeType);
+ builder.andNotExists(attributeTypes);
}
}
diff --git a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/StringLabelProvider.java b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/StringLabelProvider.java
index 46497602d54..339eb051574 100644
--- a/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/StringLabelProvider.java
+++ b/plugins/org.eclipse.osee.framework.ui.plugin/src/org/eclipse/osee/framework/ui/plugin/util/StringLabelProvider.java
@@ -28,6 +28,10 @@ public class StringLabelProvider implements ILabelProvider {
@Override
public String getText(Object arg0) {
+ if(arg0 instanceof String)
+ {
+ return (String) arg0;
+ }
return arg0.toString();
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ToStringViewerSorter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ToStringViewerSorter.java
index 2508aa55d6a..16ef6680001 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ToStringViewerSorter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/ToStringViewerSorter.java
@@ -12,6 +12,7 @@ package org.eclipse.osee.framework.ui.skynet;
import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerSorter;
+import org.eclipse.osee.framework.jdk.core.type.Named;
/**
* @author Donald G. Dunne
@@ -25,6 +26,8 @@ public class ToStringViewerSorter extends ViewerSorter {
@SuppressWarnings("unchecked")
@Override
public int compare(Viewer viewer, Object e1, Object e2) {
- return getComparator().compare(e1.toString(), e2.toString());
+ String s1 = e1 instanceof Named ? ((Named) e1).getName() : e1.toString();
+ String s2 = e2 instanceof Named ? ((Named) e2).getName() : e2.toString();
+ return getComparator().compare(s1, s2);
}
}
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 55a3fdd4f49..e3d24f9904d 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
@@ -20,21 +20,14 @@ import org.eclipse.core.runtime.IStatus;
import org.eclipse.jface.dialogs.DialogPage;
import org.eclipse.jface.dialogs.IDialogSettings;
import org.eclipse.jface.viewers.ComboViewer;
-import org.eclipse.jface.viewers.ILabelProvider;
-import org.eclipse.jface.viewers.ILabelProviderListener;
import org.eclipse.jface.viewers.ISelectionChangedListener;
-import org.eclipse.jface.viewers.IStructuredContentProvider;
-import org.eclipse.jface.viewers.ListViewer;
import org.eclipse.jface.viewers.SelectionChangedEvent;
-import org.eclipse.jface.viewers.Viewer;
-import org.eclipse.jface.viewers.ViewerSorter;
import org.eclipse.osee.framework.core.data.IArtifactType;
import org.eclipse.osee.framework.core.data.IAttributeType;
import org.eclipse.osee.framework.core.data.IOseeBranch;
import org.eclipse.osee.framework.core.enums.PermissionEnum;
import org.eclipse.osee.framework.core.model.type.RelationType;
import org.eclipse.osee.framework.help.ui.OseeHelpContext;
-import org.eclipse.osee.framework.jdk.core.type.Named;
import org.eclipse.osee.framework.jdk.core.type.OseeCoreException;
import org.eclipse.osee.framework.logging.OseeLevel;
import org.eclipse.osee.framework.logging.OseeLog;
@@ -44,7 +37,10 @@ import org.eclipse.osee.framework.skynet.core.artifact.BranchManager;
import org.eclipse.osee.framework.skynet.core.attribute.AttributeTypeManager;
import org.eclipse.osee.framework.skynet.core.relation.RelationTypeManager;
import org.eclipse.osee.framework.ui.plugin.util.AWorkbench;
+import org.eclipse.osee.framework.ui.plugin.util.ArrayTreeContentProvider;
import org.eclipse.osee.framework.ui.plugin.util.HelpUtil;
+import org.eclipse.osee.framework.ui.plugin.util.StringLabelProvider;
+import org.eclipse.osee.framework.ui.skynet.ToStringViewerSorter;
import org.eclipse.osee.framework.ui.skynet.access.AccessControlService;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModel;
@@ -52,7 +48,9 @@ import org.eclipse.osee.framework.ui.skynet.search.filter.FilterModelList;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
import org.eclipse.osee.framework.ui.skynet.search.page.AbstractArtifactSearchViewPage;
import org.eclipse.osee.framework.ui.skynet.util.DbConnectionExceptionComposite;
+import org.eclipse.osee.framework.ui.skynet.util.NamedLabelProvider;
import org.eclipse.osee.framework.ui.skynet.widgets.XBranchSelectWidget;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.FilteredCheckboxTree;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.HyperLinkLabel;
import org.eclipse.search.ui.IReplacePage;
@@ -63,11 +61,11 @@ import org.eclipse.search.ui.ISearchResultViewPart;
import org.eclipse.search.ui.NewSearchUI;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.StackLayout;
+import org.eclipse.swt.custom.StyledText;
import org.eclipse.swt.events.ModifyEvent;
import org.eclipse.swt.events.ModifyListener;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Button;
@@ -95,7 +93,10 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
private StackLayout selectionLayout;
private static FilterTableViewer filterviewer;
private Composite artifactTypeControls;
- private ListViewer artifactTypeList;
+ private FilteredCheckboxTree artifactTypeList;
+
+ private Composite attributeTypeControls;
+ private FilteredCheckboxTree attributeTypeList;
private XBranchSelectWidget branchSelect;
@@ -105,6 +106,7 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
private final Matcher storageStringMatcher = storageStringPattern.matcher("");
private final Matcher notSearchPrimitiveMatcher = notSearchPrimitivePattern.matcher("");
+ private StyledText textDescription;
@Override
public void createControl(Composite parent) {
@@ -120,7 +122,7 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
branchSelect.setSelection(BranchManager.getLastBranch());
branchSelect.createWidgets(mainComposite, 2);
branchSelect.addListener(new BranchSelectListener(branchSelect));
-
+
addFilterControls(mainComposite);
addTableControls(mainComposite);
addFilterListeners();
@@ -171,21 +173,25 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
}
private void createArtifactTypeSearchControls(Composite optionsComposite) {
- artifactTypeControls = new Composite(optionsComposite, SWT.NONE);
+ artifactTypeControls = new Composite(optionsComposite, SWT.MULTI);
artifactTypeControls.setLayout(new GridLayout(1, true));
- artifactTypeList = new ListViewer(artifactTypeControls);
- GridData gd = new GridData();
- gd.heightHint = 100;
- artifactTypeList.getList().setLayoutData(gd);
- artifactTypeList.setContentProvider(new SearchContentProvider());
- artifactTypeList.setLabelProvider(new SearchLabelProvider());
- artifactTypeList.setSorter(new SearchSorter());
-
+ Label typeLabel = new Label(artifactTypeControls, SWT.HORIZONTAL);
+ typeLabel.setText("Artifact Types:");
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.heightHint = 125;
+
+ artifactTypeList = new FilteredCheckboxTree(artifactTypeControls,
+ SWT.CHECK | SWT.MULTI | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+ artifactTypeList.getViewer().getTree().setLayoutData(gd);
+ artifactTypeList.getViewer().setContentProvider(new ArrayTreeContentProvider());
+ artifactTypeList.getViewer().setLabelProvider(new StringLabelProvider());
+ artifactTypeList.getViewer().setSorter(new ToStringViewerSorter());
+ artifactTypeList.getViewer().setInput(ArtifactTypeManager.getValidArtifactTypes(getSelectedBranch()));
try {
for (IArtifactType artType : ArtifactTypeManager.getValidArtifactTypes(getSelectedBranch())) {
- artifactTypeList.add(artType);
- artifactTypeList.setData(artType.getName(), artType);
+ artifactTypeList.getViewer().add(artifactTypeControls, artType);
+ artifactTypeList.getViewer().setData(artType.getName(), artType);
}
} catch (Exception ex) {
OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, "Error encountered while getting list of artifact types",
@@ -205,11 +211,11 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
final ComboViewer relationTypeList = new ComboViewer(relationControls, SWT.DROP_DOWN | SWT.READ_ONLY);
relationTypeList.setContentProvider(new SearchContentProvider());
- relationTypeList.setLabelProvider(new SearchLabelProvider());
- relationTypeList.setSorter(new SearchSorter());
+ relationTypeList.setLabelProvider(new NamedLabelProvider());
+ relationTypeList.setSorter(new ToStringViewerSorter());
final ComboViewer relationSideList = new ComboViewer(relationControls, SWT.DROP_DOWN | SWT.READ_ONLY);
relationSideList.setContentProvider(new SearchContentProvider());
- relationSideList.setLabelProvider(new StringSearchLabelProvider());
+ relationSideList.setLabelProvider(new StringLabelProvider());
try {
for (RelationType linkDescriptor : RelationTypeManager.getValidTypes(getSelectedBranch())) {
@@ -250,31 +256,28 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
private void createAttributeSearchControls(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));
-
+ attributeControls.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, 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());
-
+ attributeTypeList.setLabelProvider(new StringLabelProvider());
+ attributeTypeList.setSorter(new ToStringViewerSorter());
+
Label valueLabel = new Label(attributeControls, SWT.HORIZONTAL);
valueLabel.setText("Attribute Value:");
-
Text attributeValue = new Text(attributeControls, SWT.BORDER);
attributeValue.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
-
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);
+ 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);
@@ -299,38 +302,34 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
}
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));
+ attributeTypeControls = new Composite(optionsComposite, SWT.MULTI);
+ attributeTypeControls.setLayout(new GridLayout(1, true));
- Label typeLabel = new Label(attributeControls, SWT.HORIZONTAL);
+ Label typeLabel = new Label(attributeTypeControls, 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());
-
+ attributeTypeList = new FilteredCheckboxTree(attributeTypeControls,
+ SWT.CHECK | SWT.MULTI | SWT.READ_ONLY | SWT.H_SCROLL | SWT.V_SCROLL | SWT.BORDER);
+
+ GridData gd = new GridData(SWT.FILL, SWT.FILL, true, true);
+ gd.heightHint = 125;
+ attributeTypeList.getViewer().getTree().setLayoutData(gd);
+ attributeTypeList.getViewer().setContentProvider(new ArrayTreeContentProvider());
+ attributeTypeList.getViewer().setLabelProvider(new StringLabelProvider());
+ attributeTypeList.getViewer().setSorter(new ToStringViewerSorter());
+ List<IAttributeType> list =
+ new ArrayList<IAttributeType>(AttributeTypeManager.getValidAttributeTypes(getSelectedBranch()));
+ attributeTypeList.getViewer().setInput(list);
try {
for (IAttributeType type : AttributeTypeManager.getValidAttributeTypes(getSelectedBranch())) {
- attributeTypeList.add(type);
- attributeTypeList.setData(type.getName(), type);
+ attributeTypeList.getViewer().add(attributeTypeControls, type);
+ attributeTypeList.getViewer().setData(type.getName(), type);
}
} catch (Exception ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP,
- "Error encountered while getting list of attribute types", 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));
- addToSearchTypeList(new AttributeNotExistsFilter(attributeControls, attributeTypeList));
+ addToSearchTypeList(new AttributeExistsFilter(attributeTypeControls, attributeTypeList));
+ addToSearchTypeList(new AttributeNotExistsFilter(attributeTypeControls, attributeTypeList));
}
private void addFilterControls(Composite mainComposite) {
@@ -338,23 +337,27 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
filterGroup.setText("Create a Filter");
filterGroup.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
filterGroup.setLayout(new GridLayout());
-
+
Composite composite = new Composite(filterGroup, SWT.BORDER);
composite.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
composite.setLayout(new GridLayout(2, false));
-
+
+ Composite text = new Composite(filterGroup, SWT.NONE);
+ text.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, false));
+ text.setLayout(new GridLayout());
+
searchTypeList = new ComboViewer(composite, SWT.DROP_DOWN | SWT.READ_ONLY);
searchTypeList.setContentProvider(new SearchContentProvider());
- searchTypeList.setLabelProvider(new StringSearchLabelProvider());
- searchTypeList.setSorter(new SearchSorter());
+ searchTypeList.setLabelProvider(new StringLabelProvider());
+ searchTypeList.setSorter(new ToStringViewerSorter());
selectionLayout = new StackLayout();
Composite optionsComposite = new Composite(filterGroup, SWT.BORDER);
optionsComposite.setLayout(new GridLayout());
optionsComposite.setLayoutData(new GridData(SWT.FILL, SWT.BEGINNING, true, false));
-
optionsComposite.setLayout(selectionLayout);
+
createAttributeSearchControls(optionsComposite);
createAttributeExistsControls(optionsComposite);
createArtifactTypeSearchControls(optionsComposite);
@@ -368,6 +371,13 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
lastSearchTypeListSelected = searchTypeList.getCombo().getSelectionIndex();
}
});
+
+ textDescription = new StyledText(text, SWT.NONE);
+ textDescription.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
+ textDescription.setEditable(true);
+ SearchFilter searchFilter = (SearchFilter) searchTypeList.getData(searchTypeList.getCombo().getText());
+ addTextDescription(searchFilter);
+
addButton = new Button(filterGroup, SWT.PUSH);
addButton.setLayoutData(new GridData(SWT.BEGINNING, SWT.BEGINNING, true, false));
addButton.setText("Add Filter");
@@ -379,6 +389,8 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
public void widgetSelected(SelectionEvent e) {
SearchFilter searchFilter = (SearchFilter) searchTypeList.getData(searchTypeList.getCombo().getText());
searchFilter.addFilterTo(filterviewer);
+ attributeTypeList.clearChecked();
+ artifactTypeList.clearChecked();
updateOKStatus();
}
});
@@ -389,6 +401,14 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
updateWidgets();
}
});
+
+ artifactTypeList.getCheckboxTreeViewer().addSelectionChangedListener(new ISelectionChangedListener() {
+
+ @Override
+ public void selectionChanged(SelectionChangedEvent event) {
+ updateWidgets();
+ }
+ });
}
private void updateWidgets() {
@@ -396,6 +416,17 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
addButton.setEnabled(searchFilter.isValid());
selectionLayout.topControl = searchFilter.optionsControl;
selectionLayout.topControl.getParent().layout();
+ addTextDescription(searchFilter);
+ }
+
+ private void addTextDescription(SearchFilter searchFilter)
+ {
+ String searchDesc = searchFilter.getSearchDescription();
+ if (searchDesc == null) {
+ textDescription.setText(" ");
+ } else {
+ textDescription.setText(searchDesc);
+ }
}
private void addTableControls(Composite composite) {
@@ -567,97 +598,4 @@ public class ArtifactSearchPage extends DialogPage implements ISearchPage, IRepl
}
}
- public class SearchLabelProvider implements ILabelProvider {
-
- @Override
- public Image getImage(Object arg0) {
- return null;
- }
-
- @Override
- public String getText(Object obj) {
- return ((Named) obj).getName();
- }
-
- @Override
- public void addListener(ILabelProviderListener arg0) {
- // do nothing
- }
-
- @Override
- public void dispose() {
- // do nothing
- }
-
- @Override
- public boolean isLabelProperty(Object arg0, String arg1) {
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener arg0) {
- // do nothing
- }
- }
-
- public class StringSearchLabelProvider implements ILabelProvider {
-
- @Override
- public Image getImage(Object arg0) {
- return null;
- }
-
- @Override
- public String getText(Object obj) {
- return (String) obj;
- }
-
- @Override
- public void addListener(ILabelProviderListener arg0) {
- // do nothing
- }
-
- @Override
- public void dispose() {
- // do nothing
- }
-
- @Override
- public boolean isLabelProperty(Object arg0, String arg1) {
- return false;
- }
-
- @Override
- public void removeListener(ILabelProviderListener arg0) {
- // do nothing
- }
- }
-
- public class SearchContentProvider implements IStructuredContentProvider {
- @Override
- public Object[] getElements(Object arg0) {
- return ((ArrayList<?>) arg0).toArray();
- }
-
- @Override
- public void dispose() {
- // do nothing
- }
-
- @Override
- public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
- // do nothing
- }
- }
-
- public class SearchSorter extends ViewerSorter {
- @SuppressWarnings("unchecked")
- @Override
- public int compare(Viewer viewer, Object e1, Object e2) {
- String s1 = e1 instanceof Named ? ((Named) e1).getName() : e1.toString();
- String s2 = e2 instanceof Named ? ((Named) e2).getName() : e2.toString();
- return getComparator().compare(s1, s2);
- }
- }
-
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java
index fd2481c44f4..20fd9a92c2e 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/ArtifactTypeFilter.java
@@ -10,8 +10,6 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.search;
-import org.eclipse.jface.viewers.ListViewer;
-import java.util.List;
import java.util.Collection;
import java.util.List;
import org.eclipse.osee.framework.core.data.IArtifactType;
@@ -19,23 +17,24 @@ import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.skynet.core.artifact.search.ArtifactTypeSearch;
import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.FilteredCheckboxTree;
import org.eclipse.swt.widgets.Control;
/**
* @author Ryan D. Brooks
*/
public class ArtifactTypeFilter extends SearchFilter {
- private final ListViewer searchTypeList;
+ private final FilteredCheckboxTree checkBoxList;
- public ArtifactTypeFilter(Control optionsControl, ListViewer searchTypeList) {
+ public ArtifactTypeFilter(Control optionsControl, FilteredCheckboxTree checkBoxList) {
super("Artifact Type", optionsControl);
- this.searchTypeList = searchTypeList;
+ this.checkBoxList = checkBoxList;
}
@Override
public void addFilterTo(FilterTableViewer filterViewer) {
- List<?> artifactTypesObj = searchTypeList.getStructuredSelection().toList();
- List<IArtifactType> artifactTypes = Collections.castAll(artifactTypesObj);
+ Collection<IArtifactType> artTypes = checkBoxList.getChecked();
+ List<IArtifactType> artifactTypes = Collections.castAll(artTypes);
ISearchPrimitive primitive = new ArtifactTypeSearch(artifactTypes);
filterViewer.addItem(primitive, getFilterName(), artifactTypes.toString(), "");
@@ -51,4 +50,9 @@ public class ArtifactTypeFilter extends SearchFilter {
ISearchPrimitive primitive = ArtifactTypeSearch.getPrimitive(storageString);
filterViewer.addItem(primitive, getFilterName(), type, value);
}
+
+ @Override
+ public String getSearchDescription() {
+ return "Using multiple artifact types in the same filter will return artifacts matching any of the types." + "\nUsing separate artifact type filters will only return artifacts matching all of the types.";
+ }
} \ No newline at end of file
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
index bc472031dcf..4988665b1d5 100644
--- 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
@@ -10,32 +10,34 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.search;
-import org.eclipse.jface.viewers.ComboViewer;
+import java.util.Collection;
+import java.util.List;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
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.osee.framework.ui.skynet.widgets.dialog.FilteredCheckboxTree;
import org.eclipse.swt.widgets.Control;
/**
* @author John Misinco
*/
public class AttributeExistsFilter extends SearchFilter {
- private final ComboViewer attributeTypeList;
+ private final FilteredCheckboxTree attributeTypeList;
- public AttributeExistsFilter(Control optionsControl, ComboViewer attributeTypeList) {
+ public AttributeExistsFilter(Control optionsControl, FilteredCheckboxTree attributeTypeList) {
super("Attribute Exists", optionsControl);
this.attributeTypeList = attributeTypeList;
}
@Override
public void addFilterTo(FilterTableViewer filterViewer) {
- String typeName = attributeTypeList.getCombo().getText();
+ Collection<IAttributeType> attrTypes = attributeTypeList.getChecked();
+ List<IAttributeType> attributeTypes = Collections.castAll(attrTypes);
- IAttributeType attributeType = (IAttributeType) attributeTypeList.getData(typeName);
- ISearchPrimitive primitive = new AttributeExistsSearch(attributeType);
- filterViewer.addItem(primitive, getFilterName(), typeName, Strings.EMPTY_STRING);
+ ISearchPrimitive primitive = new AttributeExistsSearch(attributeTypes);
+ filterViewer.addItem(primitive, getFilterName(), attributeTypes.toString(), "");
}
@Override
@@ -49,4 +51,12 @@ public class AttributeExistsFilter extends SearchFilter {
filterViewer.addItem(primitive, getFilterName(), type, value);
}
+ @Override
+ public String getSearchDescription() {
+ return "Using multiple attribute types in the same filter will return artifacts where at least one does exist."
+ + "\nUsing separate attribute type filters will only return artifacts where all the attribute types do exist.";
+ }
+
}
+
+ \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeNotExistsFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeNotExistsFilter.java
index 2edda427c86..c39b7cf6565 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeNotExistsFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeNotExistsFilter.java
@@ -10,32 +10,34 @@
*******************************************************************************/
package org.eclipse.osee.framework.ui.skynet.search;
-import org.eclipse.jface.viewers.ComboViewer;
+import java.util.Collection;
+import java.util.List;
import org.eclipse.osee.framework.core.data.IAttributeType;
-import org.eclipse.osee.framework.jdk.core.util.Strings;
+import org.eclipse.osee.framework.jdk.core.util.Collections;
import org.eclipse.osee.framework.skynet.core.artifact.search.AttributeNotExistsSearch;
import org.eclipse.osee.framework.skynet.core.artifact.search.ISearchPrimitive;
import org.eclipse.osee.framework.ui.skynet.search.filter.FilterTableViewer;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.FilteredCheckboxTree;
import org.eclipse.swt.widgets.Control;
/**
* @author John Misinco
*/
public class AttributeNotExistsFilter extends SearchFilter {
- private final ComboViewer attributeTypeList;
+ private final FilteredCheckboxTree attributeTypeList;
- public AttributeNotExistsFilter(Control optionsControl, ComboViewer attributeTypeList) {
+ public AttributeNotExistsFilter(Control optionsControl, FilteredCheckboxTree attributeTypeList) {
super("Attribute Not Exists", optionsControl);
this.attributeTypeList = attributeTypeList;
}
@Override
public void addFilterTo(FilterTableViewer filterViewer) {
- String typeName = attributeTypeList.getCombo().getText();
+ Collection<IAttributeType> attrTypes = attributeTypeList.getChecked();
+ List<IAttributeType> attributeTypes = Collections.castAll(attrTypes);
- IAttributeType attributeType = (IAttributeType) attributeTypeList.getData(typeName);
- ISearchPrimitive primitive = new AttributeNotExistsSearch(attributeType);
- filterViewer.addItem(primitive, getFilterName(), typeName, Strings.EMPTY_STRING);
+ ISearchPrimitive primitive = new AttributeNotExistsSearch(attributeTypes);
+ filterViewer.addItem(primitive, getFilterName(), attributeTypes.toString(), "");
}
@Override
@@ -49,4 +51,10 @@ public class AttributeNotExistsFilter extends SearchFilter {
filterViewer.addItem(primitive, getFilterName(), type, value);
}
+ @Override
+ public String getSearchDescription() {
+ return "Using multiple attribute types in the same filter will return artifacts where at least one does not exist."
+ + "\nUsing separate attribute type filters will only return artifacts where all the attribute types do not exist.";
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java
index 675a3b47a6d..5f7d4255db4 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/AttributeValueFilter.java
@@ -52,4 +52,9 @@ public class AttributeValueFilter extends SearchFilter {
filterViewer.addItem(primitive, getFilterName(), type, value);
}
+ @Override
+ public String getSearchDescription() {
+ return "Using the attribute type and entering a value will return all artifacts that contain the attribute with the specified value.";
+ }
+
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java
index 83748e5b5a8..b614a5e3ddf 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/InRelationFilter.java
@@ -58,4 +58,9 @@ public class InRelationFilter extends SearchFilter {
ISearchPrimitive primitive = InRelationSearch.getPrimitive(storageString);
filterViewer.addItem(primitive, getFilterName(), type, value);
}
+
+ @Override
+ public String getSearchDescription() {
+ return "This search will return all artifacts in the selected relation";
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/NotInRelationFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/NotInRelationFilter.java
index 6a6c7b8bbc4..af6a01f72aa 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/NotInRelationFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/NotInRelationFilter.java
@@ -58,4 +58,9 @@ public class NotInRelationFilter extends SearchFilter {
ISearchPrimitive primitive = NotInRelationSearch.getPrimitive(storageString);
filterViewer.addItem(primitive, getFilterName(), type, value);
}
+
+ @Override
+ public String getSearchDescription() {
+ return "This search will return all artifacts not in the selected relation";
+ }
}
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchContentProvider.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchContentProvider.java
new file mode 100644
index 00000000000..2af69495cee
--- /dev/null
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchContentProvider.java
@@ -0,0 +1,36 @@
+/*******************************************************************************
+ * Copyright (c) 2015 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 java.util.ArrayList;
+import org.eclipse.jface.viewers.IStructuredContentProvider;
+import org.eclipse.jface.viewers.Viewer;
+
+/**
+ * @author Morgan E. Cook
+ */
+
+public class SearchContentProvider implements IStructuredContentProvider {
+ @Override
+ public Object[] getElements(Object arg0) {
+ return ((ArrayList<?>) arg0).toArray();
+ }
+
+ @Override
+ public void dispose() {
+ // do nothing
+ }
+
+ @Override
+ public void inputChanged(Viewer arg0, Object arg1, Object arg2) {
+ // do nothing
+ }
+} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java
index 818aa1a5b6d..5ac5cda6689 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/search/SearchFilter.java
@@ -34,6 +34,8 @@ public abstract class SearchFilter {
protected String getFilterName() {
return filterName;
}
+
+ public abstract String getSearchDescription();
public abstract void loadFromStorageString(FilterTableViewer filterViewer, String type, String value, String storageString, boolean isNotEnabled);

Back to the top