Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorddunne2011-08-29 17:55:35 +0000
committerRyan D. Brooks2011-08-29 17:55:35 +0000
commit877ac166fe0f06144dbf122324d43baa558aa359 (patch)
tree93c90c505d021c6793517e2686fdd57790586dbf
parentd0cd34383abe134812d2d7893b1daa6bebd58981 (diff)
downloadorg.eclipse.osee-877ac166fe0f06144dbf122324d43baa558aa359.tar.gz
org.eclipse.osee-877ac166fe0f06144dbf122324d43baa558aa359.tar.xz
org.eclipse.osee-877ac166fe0f06144dbf122324d43baa558aa359.zip
feature: Convert artType MenuItem to filtered dialog in AttributesComposite
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeMenuSelectionListener.java53
-rw-r--r--plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributesComposite.java57
2 files changed, 28 insertions, 82 deletions
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeMenuSelectionListener.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeMenuSelectionListener.java
deleted file mode 100644
index fe2a8798e3c..00000000000
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributeMenuSelectionListener.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2004, 2007 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;
-
-import org.eclipse.jface.viewers.TableViewer;
-import org.eclipse.osee.framework.core.exception.OseeCoreException;
-import org.eclipse.osee.framework.core.model.type.AttributeType;
-import org.eclipse.osee.framework.logging.OseeLevel;
-import org.eclipse.osee.framework.logging.OseeLog;
-import org.eclipse.osee.framework.ui.skynet.internal.Activator;
-import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
-import org.eclipse.swt.events.SelectionAdapter;
-import org.eclipse.swt.events.SelectionEvent;
-import org.eclipse.swt.widgets.MenuItem;
-
-/**
- * @author Ryan D. Brooks
- */
-public class AttributeMenuSelectionListener extends SelectionAdapter {
- private final AttributesComposite attrsComp;
- private final TableViewer tableViewer;
- private final IDirtiableEditor editor;
-
- public AttributeMenuSelectionListener(AttributesComposite attrsComp, TableViewer tableViewer, IDirtiableEditor editor) {
- this.attrsComp = attrsComp;
- this.tableViewer = tableViewer;
- this.editor = editor;
- }
-
- @Override
- public void widgetSelected(SelectionEvent ev) {
- AttributeType attributeType = (AttributeType) ((MenuItem) ev.getSource()).getData();
- try {
- attrsComp.getArtifact().addAttribute(attributeType);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
-
- tableViewer.refresh();
- attrsComp.layout();
- attrsComp.getParent().layout();
- editor.onDirtied();
- attrsComp.notifyModifyAttribuesListeners();
- }
-} \ No newline at end of file
diff --git a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributesComposite.java b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributesComposite.java
index e0b2b8d9b5f..e809f4d6124 100644
--- a/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributesComposite.java
+++ b/plugins/org.eclipse.osee.framework.ui.skynet/src/org/eclipse/osee/framework/ui/skynet/AttributesComposite.java
@@ -11,7 +11,7 @@
package org.eclipse.osee.framework.ui.skynet;
import java.util.ArrayList;
-import java.util.logging.Level;
+import java.util.Collection;
import org.eclipse.jface.viewers.CellEditor;
import org.eclipse.jface.viewers.ColumnViewerEditor;
import org.eclipse.jface.viewers.ColumnViewerEditorActivationStrategy;
@@ -32,12 +32,11 @@ import org.eclipse.osee.framework.skynet.core.artifact.Attribute;
import org.eclipse.osee.framework.ui.plugin.util.HelpUtil;
import org.eclipse.osee.framework.ui.skynet.internal.Activator;
import org.eclipse.osee.framework.ui.skynet.widgets.cellEditor.UniversalCellEditor;
+import org.eclipse.osee.framework.ui.skynet.widgets.dialog.AttributeTypeFilteredCheckTreeDialog;
import org.eclipse.osee.framework.ui.swt.Displays;
import org.eclipse.osee.framework.ui.swt.IDirtiableEditor;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.SashForm;
-import org.eclipse.swt.events.ArmEvent;
-import org.eclipse.swt.events.ArmListener;
import org.eclipse.swt.events.MenuEvent;
import org.eclipse.swt.events.MenuListener;
import org.eclipse.swt.events.SelectionAdapter;
@@ -241,40 +240,40 @@ public class AttributesComposite extends Composite {
}
private void createAddMenuItem(Menu parentMenu) {
- MenuItem addItem = new MenuItem(parentMenu, SWT.CASCADE);
+ MenuItem addItem = new MenuItem(parentMenu, SWT.PUSH);
addItem.setText("Add");
addItem.setEnabled(true && !artifact.isReadOnly());
-
- // Update the enabled values for the popup menu each time it comes up
- addItem.addArmListener(new ArmListener() {
-
+ addItem.addSelectionListener(new SelectionAdapter() {
@Override
- public void widgetArmed(ArmEvent e) {
- MenuItem addItem = (MenuItem) e.getSource();
- for (MenuItem attrItem : addItem.getMenu().getItems()) {
- try {
- attrItem.setEnabled(artifact.getRemainingAttributeCount((IAttributeType) attrItem.getData()) > 0);
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, Level.SEVERE, ex);
+ public void widgetSelected(SelectionEvent e) {
+ Collection<IAttributeType> selectableTypes = new ArrayList<IAttributeType>();
+ try {
+ for (IAttributeType attrType : artifact.getAttributeTypes()) {
+ if (artifact.getRemainingAttributeCount(attrType) > 0) {
+ selectableTypes.add(attrType);
+ }
+ }
+ AttributeTypeFilteredCheckTreeDialog dialog =
+ new AttributeTypeFilteredCheckTreeDialog("Select Attribute Types",
+ "Select attribute types to display.");
+ dialog.setSelectableTypes(selectableTypes);
+ if (dialog.open() == 0) {
+ for (Object obj : dialog.getResult()) {
+ getArtifact().addAttribute((IAttributeType) obj);
+ }
+ tableViewer.refresh();
+ layout();
+ getParent().layout();
+ editor.onDirtied();
+ notifyModifyAttribuesListeners();
}
+
+ } catch (OseeCoreException ex) {
+ OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
}
}
});
- Menu attributesMenu = new Menu(parentMenu);
-
- try {
- SelectionAdapter listener = new AttributeMenuSelectionListener(this, tableViewer, editor);
- for (IAttributeType attributeType : artifact.getAttributeTypes()) {
- MenuItem item = new MenuItem(attributesMenu, SWT.CASCADE);
- item.setText(attributeType.getName() + " Attribute");
- item.setData(attributeType);
- item.addSelectionListener(listener);
- }
- } catch (OseeCoreException ex) {
- OseeLog.log(Activator.class, OseeLevel.SEVERE_POPUP, ex);
- }
- addItem.setMenu(attributesMenu);
}
private void createDeleteMenuItem(Menu parentMenu) {

Back to the top