diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/DoubleClick.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/DoubleClick.java index ff01af8df96c2724bb04f6d27f31a8c3581d3760..5216ba294438d64cfa8ae171048ea25657c2dd78 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/DoubleClick.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/DoubleClick.java @@ -32,9 +32,9 @@ import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 9CA90CD57A8A52498079F8A88484E68B + * @ConQAT.Rating YELLOW Hash: 720EFC814AF5BECE52D4786E4591A76D */ -final class DoubleClick implements IDoubleClickListener { +class DoubleClick implements IDoubleClickListener { /** Stores the use-raw-eobject flag. */ private final boolean useRawEObject; @@ -54,7 +54,7 @@ final class DoubleClick implements IDoubleClickListener { public void doubleClick(DoubleClickEvent event) { // delegate to the editor service if (event.getSelection() instanceof IStructuredSelection) { - EObject element = EObjectSelectionUtils.getFirstElement(event + EObject element = getDoubleClickedElement((IStructuredSelection) event .getSelection()); if (element != null) { if (!useRawEObject) { @@ -69,4 +69,13 @@ final class DoubleClick implements IDoubleClickListener { } } } + + /** + * Returns the element to be considered the target of the double click. + * Sub-classes may override. The default uses the first element of the given + * selection. + */ + protected EObject getDoubleClickedElement(IStructuredSelection selection) { + return EObjectSelectionUtils.getFirstElement(selection); + } } diff --git a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java index b40ec9ff51952a11afedeb4d2d2d523bf0f6625a..0528930c351e9c969a780d9f1419d49e6cfb3af5 100644 --- a/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java +++ b/org.fortiss.tooling.kernel.ui/trunk/src/org/fortiss/tooling/kernel/ui/internal/views/MarkerViewPart.java @@ -34,6 +34,7 @@ import org.eclipse.jface.action.IToolBarManager; import org.eclipse.jface.action.Separator; import org.eclipse.jface.viewers.CellLabelProvider; import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; +import org.eclipse.jface.viewers.IStructuredSelection; import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.ViewerCell; @@ -55,7 +56,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: 3A3C17AFE1D3C603961CA52C19450897 + * @ConQAT.Rating YELLOW Hash: 866C76878D04BE1CF9B23DC9FFEE49C8 */ public class MarkerViewPart extends ViewPart { @@ -199,7 +200,18 @@ public class MarkerViewPart extends ViewPart { ColumnViewerToolTipSupport .enableFor(gui.getProjectColumn().getViewer()); - gui.getTreeViewer().addDoubleClickListener(new DoubleClick(true)); + gui.getTreeViewer().addDoubleClickListener(new DoubleClick(true) { + /** {@inheritDoc} */ + @Override + protected EObject getDoubleClickedElement( + IStructuredSelection selection) { + if (selection.getFirstElement() instanceof IConstraintViolation) { + return ((IConstraintViolation<EObject>) selection + .getFirstElement()).getContainer(); + } + return super.getDoubleClickedElement(selection); + } + }); gui.getTreeViewer().setInput(IMarkerService.INSTANCE); createToggleActions(); @@ -266,5 +278,4 @@ public class MarkerViewPart extends ViewPart { refresh(); } } - } diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/ConstraintViolationBase.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/ConstraintViolationBase.java index ff024fbdbe1de51ad3fed6e917168b478ec92004..1d909ec8e34b010d31deae7d496f86f0f8489005 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/ConstraintViolationBase.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/base/ConstraintViolationBase.java @@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.extension.data.IConstraintViolation; * @author hoelzl * @author $Author$ * @version $Rev$ - * @ConQAT.Rating YELLOW Hash: CC17BC4ED54FFD8211F02C90443F77C8 + * @ConQAT.Rating YELLOW Hash: 1FC553699663AB6CFD50E2B4D17B5276 */ public class ConstraintViolationBase<T extends EObject> implements IConstraintViolation<T> { @@ -37,6 +37,9 @@ public class ConstraintViolationBase<T extends EObject> implements /** Stores the model element. */ private final T source; + /** Stores the container element. */ + private final EObject container; + /** Stores the explanation */ private final String explanation; @@ -45,10 +48,17 @@ public class ConstraintViolationBase<T extends EObject> implements /** Constructor. */ public ConstraintViolationBase(T source, ESeverity severity, - String explanation) { + String explanation, EObject container) { this.source = source; this.explanation = explanation; this.severity = severity; + this.container = container; + } + + /** Constructor. */ + public ConstraintViolationBase(T source, ESeverity severity, + String explanation) { + this(source, severity, explanation, source); } /** {@inheritDoc} */ @@ -57,6 +67,12 @@ public class ConstraintViolationBase<T extends EObject> implements return source; } + /** {@inheritDoc} */ + @Override + public EObject getContainer() { + return container; + } + /** {@inheritDoc} */ @Override public String getExplanation() { diff --git a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/IConstraintViolation.java b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/IConstraintViolation.java index d3898856cb44e9236630c352809e3d32a90b9a7b..1e239d16f071cef85f8107103252f1f93d50cca4 100644 --- a/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/IConstraintViolation.java +++ b/org.fortiss.tooling.kernel/trunk/src/org/fortiss/tooling/kernel/extension/data/IConstraintViolation.java @@ -37,13 +37,19 @@ import org.fortiss.tooling.kernel.extension.base.ConstraintViolationBase; * @author hoelzlf * @author $Author$ * @version $Rev$ - * @ConQAT.Rating GREEN Hash: EF654287282639CBC759ADFE6688688F + * @ConQAT.Rating YELLOW Hash: 04141B3BFD9B4AE78321DA1CE292E144 */ public interface IConstraintViolation<T extends EObject> extends IAdaptable { /** Returns the source of the constraint violation. */ T getSource(); + /** + * Returns the container object used for fixing this violation (i.e. the + * object to be opened an editor for). + */ + EObject getContainer(); + /** Returns the severity of the constraint violation. */ ESeverity getSeverity();