Skip to content
Snippets Groups Projects
Commit c523da86 authored by Florian Hölzl's avatar Florian Hölzl
Browse files

added container to marker service

refs 503
parent 32f39c68
Branches cbmd
No related tags found
No related merge requests found
...@@ -32,9 +32,9 @@ import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils; ...@@ -32,9 +32,9 @@ import org.fortiss.tooling.kernel.ui.util.EObjectSelectionUtils;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @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. */ /** Stores the use-raw-eobject flag. */
private final boolean useRawEObject; private final boolean useRawEObject;
...@@ -54,7 +54,7 @@ final class DoubleClick implements IDoubleClickListener { ...@@ -54,7 +54,7 @@ final class DoubleClick implements IDoubleClickListener {
public void doubleClick(DoubleClickEvent event) { public void doubleClick(DoubleClickEvent event) {
// delegate to the editor service // delegate to the editor service
if (event.getSelection() instanceof IStructuredSelection) { if (event.getSelection() instanceof IStructuredSelection) {
EObject element = EObjectSelectionUtils.getFirstElement(event EObject element = getDoubleClickedElement((IStructuredSelection) event
.getSelection()); .getSelection());
if (element != null) { if (element != null) {
if (!useRawEObject) { if (!useRawEObject) {
...@@ -69,4 +69,13 @@ final class DoubleClick implements IDoubleClickListener { ...@@ -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);
}
} }
...@@ -34,6 +34,7 @@ import org.eclipse.jface.action.IToolBarManager; ...@@ -34,6 +34,7 @@ import org.eclipse.jface.action.IToolBarManager;
import org.eclipse.jface.action.Separator; import org.eclipse.jface.action.Separator;
import org.eclipse.jface.viewers.CellLabelProvider; import org.eclipse.jface.viewers.CellLabelProvider;
import org.eclipse.jface.viewers.ColumnViewerToolTipSupport; import org.eclipse.jface.viewers.ColumnViewerToolTipSupport;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.ITreeContentProvider; import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer; import org.eclipse.jface.viewers.Viewer;
import org.eclipse.jface.viewers.ViewerCell; import org.eclipse.jface.viewers.ViewerCell;
...@@ -55,7 +56,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService; ...@@ -55,7 +56,7 @@ import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: 3A3C17AFE1D3C603961CA52C19450897 * @ConQAT.Rating YELLOW Hash: 866C76878D04BE1CF9B23DC9FFEE49C8
*/ */
public class MarkerViewPart extends ViewPart { public class MarkerViewPart extends ViewPart {
...@@ -199,7 +200,18 @@ public class MarkerViewPart extends ViewPart { ...@@ -199,7 +200,18 @@ public class MarkerViewPart extends ViewPart {
ColumnViewerToolTipSupport ColumnViewerToolTipSupport
.enableFor(gui.getProjectColumn().getViewer()); .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); gui.getTreeViewer().setInput(IMarkerService.INSTANCE);
createToggleActions(); createToggleActions();
...@@ -266,5 +278,4 @@ public class MarkerViewPart extends ViewPart { ...@@ -266,5 +278,4 @@ public class MarkerViewPart extends ViewPart {
refresh(); refresh();
} }
} }
} }
...@@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.extension.data.IConstraintViolation; ...@@ -29,7 +29,7 @@ import org.fortiss.tooling.kernel.extension.data.IConstraintViolation;
* @author hoelzl * @author hoelzl
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating YELLOW Hash: CC17BC4ED54FFD8211F02C90443F77C8 * @ConQAT.Rating YELLOW Hash: 1FC553699663AB6CFD50E2B4D17B5276
*/ */
public class ConstraintViolationBase<T extends EObject> implements public class ConstraintViolationBase<T extends EObject> implements
IConstraintViolation<T> { IConstraintViolation<T> {
...@@ -37,6 +37,9 @@ public class ConstraintViolationBase<T extends EObject> implements ...@@ -37,6 +37,9 @@ public class ConstraintViolationBase<T extends EObject> implements
/** Stores the model element. */ /** Stores the model element. */
private final T source; private final T source;
/** Stores the container element. */
private final EObject container;
/** Stores the explanation */ /** Stores the explanation */
private final String explanation; private final String explanation;
...@@ -45,10 +48,17 @@ public class ConstraintViolationBase<T extends EObject> implements ...@@ -45,10 +48,17 @@ public class ConstraintViolationBase<T extends EObject> implements
/** Constructor. */ /** Constructor. */
public ConstraintViolationBase(T source, ESeverity severity, public ConstraintViolationBase(T source, ESeverity severity,
String explanation) { String explanation, EObject container) {
this.source = source; this.source = source;
this.explanation = explanation; this.explanation = explanation;
this.severity = severity; this.severity = severity;
this.container = container;
}
/** Constructor. */
public ConstraintViolationBase(T source, ESeverity severity,
String explanation) {
this(source, severity, explanation, source);
} }
/** {@inheritDoc} */ /** {@inheritDoc} */
...@@ -57,6 +67,12 @@ public class ConstraintViolationBase<T extends EObject> implements ...@@ -57,6 +67,12 @@ public class ConstraintViolationBase<T extends EObject> implements
return source; return source;
} }
/** {@inheritDoc} */
@Override
public EObject getContainer() {
return container;
}
/** {@inheritDoc} */ /** {@inheritDoc} */
@Override @Override
public String getExplanation() { public String getExplanation() {
......
...@@ -37,13 +37,19 @@ import org.fortiss.tooling.kernel.extension.base.ConstraintViolationBase; ...@@ -37,13 +37,19 @@ import org.fortiss.tooling.kernel.extension.base.ConstraintViolationBase;
* @author hoelzlf * @author hoelzlf
* @author $Author$ * @author $Author$
* @version $Rev$ * @version $Rev$
* @ConQAT.Rating GREEN Hash: EF654287282639CBC759ADFE6688688F * @ConQAT.Rating YELLOW Hash: 04141B3BFD9B4AE78321DA1CE292E144
*/ */
public interface IConstraintViolation<T extends EObject> extends IAdaptable { public interface IConstraintViolation<T extends EObject> extends IAdaptable {
/** Returns the source of the constraint violation. */ /** Returns the source of the constraint violation. */
T getSource(); 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. */ /** Returns the severity of the constraint violation. */
ESeverity getSeverity(); ESeverity getSeverity();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment