aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLukas Ladenberger2012-03-26 08:27:42 (EDT)
committerMichael Jastram2012-04-05 05:37:25 (EDT)
commit93f2c97d24ef7135b155ed35994d50e5fbf7f3aa (patch)
treefed7a28b557cc49cafe9a30e5b54bfb782fe15e2
parent1b080292745778b4558861c30e0a6ce6da83a1fa (diff)
downloadorg.eclipse.rmf-93f2c97d24ef7135b155ed35994d50e5fbf7f3aa.zip
org.eclipse.rmf-93f2c97d24ef7135b155ed35994d50e5fbf7f3aa.tar.gz
org.eclipse.rmf-93f2c97d24ef7135b155ed35994d50e5fbf7f3aa.tar.bz2
fixed #368013 (Properties View not refreshed after setting SpecObject type to null)
-rw-r--r--org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyContentProvider.java21
-rw-r--r--org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertySheetPage.java32
-rw-r--r--org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyViewer.java22
3 files changed, 48 insertions, 27 deletions
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyContentProvider.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyContentProvider.java
index c3e532e..027ba80 100644
--- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyContentProvider.java
+++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyContentProvider.java
@@ -28,6 +28,13 @@ import org.eclipse.rmf.reqif10.SpecObject;
import org.eclipse.rmf.reqif10.SpecRelation;
import org.eclipse.rmf.reqif10.util.Reqif10Util;
+/**
+ *
+ * The agile grid content provider for the properties view.
+ *
+ * @author Lukas Ladenberger
+ *
+ */
public class ProrPropertyContentProvider extends AbstractContentProvider {
private AdapterFactoryEditingDomain editingDomain;
@@ -51,6 +58,7 @@ public class ProrPropertyContentProvider extends AbstractContentProvider {
@Override
public Object doGetContentAt(int row, int col) {
+
if (identifiable != null) {
int size = this.rows.size();
@@ -94,12 +102,13 @@ public class ProrPropertyContentProvider extends AbstractContentProvider {
/**
* Sets the current selected specification element and fetches the
- * corresponding {@link IItemPropertyDescriptor}.
+ * corresponding {@link IItemPropertyDescriptor} and builds up the structure
+ * to be displayed.
*
* @param identifiable
* the selected specification element
*/
- protected void setIdentifiable(Identifiable identifiable) {
+ protected void setContent(Identifiable identifiable) {
this.identifiable = identifiable;
@@ -110,18 +119,18 @@ public class ProrPropertyContentProvider extends AbstractContentProvider {
// Get the item property source
IItemPropertySource itemPropertySource = (IItemPropertySource) this.editingDomain
- .getAdapterFactory().adapt(this.identifiable,
+ .getAdapterFactory().adapt(identifiable,
IItemPropertySource.class);
// Get the list of item property descriptors
List<IItemPropertyDescriptor> descriptorList = itemPropertySource
- .getPropertyDescriptors(this.identifiable);
+ .getPropertyDescriptors(identifiable);
// Iterate over the item property descriptors and collect the needed
// data
for (IItemPropertyDescriptor descriptor : descriptorList) {
- String categoryName = descriptor.getCategory(this.identifiable);
+ String categoryName = descriptor.getCategory(identifiable);
if (categoryName == null)
categoryName = DEFAULT_CATEGORY_NAME;
@@ -129,7 +138,7 @@ public class ProrPropertyContentProvider extends AbstractContentProvider {
ItemCategory category;
if (!this.categories.containsKey(categoryName)) {
- category = new ItemCategory(categoryName, this.identifiable);
+ category = new ItemCategory(categoryName, identifiable);
category.addDescriptor(descriptor);
this.categories.put(categoryName, category);
} else {
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertySheetPage.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertySheetPage.java
index 7013daa..61c90c7 100644
--- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertySheetPage.java
+++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertySheetPage.java
@@ -27,6 +27,7 @@ import org.eclipse.jface.viewers.ISelectionChangedListener;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.SelectionChangedEvent;
import org.eclipse.jface.viewers.StructuredSelection;
+import org.eclipse.rmf.pror.reqif10.editor.presentation.SpecificationEditor;
import org.eclipse.rmf.reqif10.AttributeValue;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
@@ -35,10 +36,11 @@ import org.eclipse.ui.part.Page;
import org.eclipse.ui.views.properties.IPropertySheetPage;
/**
- * An alternative Property View for ProR that uses the same renderers as the
- * main Specification Editor.
*
- * @author jastram
+ * This is a custom/modified property sheet page in order to use agile grid to
+ * display the content/properties.
+ *
+ * @author Lukas Ladenberger
*
*/
public class ProrPropertySheetPage extends Page implements IPropertySheetPage {
@@ -51,19 +53,20 @@ public class ProrPropertySheetPage extends Page implements IPropertySheetPage {
private AdapterFactory adapterFactory;
- private List<AttributeValue> objectsToSelect = new ArrayList<AttributeValue>();;
+ private List<AttributeValue> objectsToSelect = new ArrayList<AttributeValue>();
public ProrPropertySheetPage(EditingDomain editingDomain,
AdapterFactory adapterFactory) {
super();
this.editingDomain = editingDomain;
this.adapterFactory = adapterFactory;
-
}
+ /**
+ * Create new ProR Properties Viewer if we don't have one yet.
+ */
@Override
public void createControl(Composite parent) {
- // Create new ProR Properties Viewer if we don't have one yet
if (viewer == null) {
viewer = new ProrPropertyViewer(parent, editingDomain,
adapterFactory);
@@ -76,16 +79,13 @@ public class ProrPropertySheetPage extends Page implements IPropertySheetPage {
}
/**
- * Handles a selection change in the entry table.
+ * This method is called if a selection was changed in the
+ * {@link ProrPropertySheetPage}.
*/
public void handleEntrySelection(ISelection selection) {
-
objectsToSelect.clear();
-
if (!selection.isEmpty() && selection instanceof IStructuredSelection) {
-
IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
if (structuredSelection.size() == 1) {
AttributeValue atrVal = (AttributeValue) structuredSelection
.getFirstElement();
@@ -96,11 +96,8 @@ public class ProrPropertySheetPage extends Page implements IPropertySheetPage {
objectsToSelect.add((AttributeValue) obj);
}
}
-
}
-
locateValueAction.setEnabled(!selection.isEmpty());
-
}
@Override
@@ -116,6 +113,10 @@ public class ProrPropertySheetPage extends Page implements IPropertySheetPage {
getControl().setFocus();
}
+ /**
+ * This method is called if a selection was changed in the
+ * {@link SpecificationEditor}.
+ */
public void selectionChanged(IWorkbenchPart part, ISelection selection) {
if (viewer == null)
@@ -146,7 +147,6 @@ public class ProrPropertySheetPage extends Page implements IPropertySheetPage {
* This method should be overridden to set the selection.
*/
protected void setSelectionToViewer(List<?> selection) {
- System.out.println(selection);
handleEntrySelection(new StructuredSelection(selection));
}
@@ -158,6 +158,7 @@ public class ProrPropertySheetPage extends Page implements IPropertySheetPage {
}
protected class LocateValueAction extends Action {
+
public LocateValueAction() {
setText(EMFEditUIPlugin.INSTANCE
.getString("_UI_LocateValue_action"));
@@ -175,6 +176,7 @@ public class ProrPropertySheetPage extends Page implements IPropertySheetPage {
public void run() {
setSelectionToViewer(objectsToSelect);
}
+
}
}
diff --git a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyViewer.java b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyViewer.java
index 73605d8..2afdda4 100644
--- a/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyViewer.java
+++ b/org.eclipse.rmf.pror.reqif10.editor/src/org/eclipse/rmf/pror/reqif10/editor/propertiesview/ProrPropertyViewer.java
@@ -23,11 +23,18 @@ import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Display;
+/**
+ *
+ * The agile grid viewer for the properties view.
+ *
+ * @author Lukas Ladenberger
+ *
+ */
public class ProrPropertyViewer extends Viewer {
private final AgileGrid agileGrid;
- private Identifiable specElement;
+ private Identifiable currentSelectedSpecElement;
private final ProrPropertyContentProvider contentProvider;
@@ -54,7 +61,7 @@ public class ProrPropertyViewer extends Viewer {
@Override
public Object getInput() {
- return specElement;
+ return currentSelectedSpecElement;
}
@Override
@@ -64,18 +71,21 @@ public class ProrPropertyViewer extends Viewer {
@Override
public void refresh() {
+ this.contentProvider.setContent(this.currentSelectedSpecElement);
agileGrid.redraw();
}
+ /**
+ * If a new selection was detected, set the corresponding input to the
+ * {@link ProrPropertyContentProvider}.
+ */
@Override
public void setInput(Object specElement) {
- // Set the input to the content provider of the agile grid
if (specElement instanceof Identifiable) {
- this.specElement = (Identifiable) specElement;
+ this.currentSelectedSpecElement = (Identifiable) specElement;
} else {
- this.specElement = null;
+ this.currentSelectedSpecElement = null;
}
- this.contentProvider.setIdentifiable(this.specElement);
refresh();
}