Commit ce112aee authored by Florian Hölzl's avatar Florian Hölzl
Browse files

Replaced *Service.INSTANCE with *Service.getInstance().

refs 2597
parent f75a611e
......@@ -98,7 +98,7 @@ public abstract class AnnotationEditingSupportBase extends EditingSupport {
final AnnotationEntry annotationEntry = (AnnotationEntry)element;
ITopLevelElement modelContext =
IPersistencyService.INSTANCE.getTopLevelElementFor(annotationEntry
IPersistencyService.getInstance().getTopLevelElementFor(annotationEntry
.getModelElement());
modelContext.runAsCommand(new Runnable() {
......
......@@ -138,7 +138,7 @@ public class MultiSelectionEditingSupport extends AnnotationEditingSupportBase {
final AnnotationEntry entry = (AnnotationEntry)element;
ITopLevelElement modelContext =
IPersistencyService.INSTANCE.getTopLevelElementFor(entry.getModelElement());
IPersistencyService.getInstance().getTopLevelElementFor(entry.getModelElement());
modelContext.runAsCommand(new Runnable() {
@Override
......
......@@ -127,7 +127,7 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
Object notifier = notification.getNotifier();
if((notifier instanceof EObject) &&
(IPersistencyService.INSTANCE.getTopLevelElementFor((EObject)notifier) != null)) {
(IPersistencyService.getInstance().getTopLevelElementFor((EObject)notifier) != null)) {
// Ignore update requests for elements that are not hooked to a top-level
// element, e.g. SET events that are fired when a component is removed (before
// the actual REMOVE event). Otherwise, the AnnotationValueService would create
......@@ -198,7 +198,7 @@ public abstract class AnnotationViewPartBase extends ViewPart implements ISelect
*/
private void addAnnotationEntry(Collection<AnnotationEntry> annotationEntries,
IModelElement modelElement) {
AnnotationEntry entry = IAnnotationValueService.INSTANCE.getAnnotationEntry(modelElement);
AnnotationEntry entry = IAnnotationValueService.getInstance().getAnnotationEntry(modelElement);
if(!entry.isEmpty()) {
annotationEntries.add(entry);
......
......@@ -226,7 +226,7 @@ public class CreateAnnotationInstanceColumn extends ViewerColumn {
// for the input key provided by the user. A write transaction / a switch to the
// model context is required to modify the from the GUI context.
ITopLevelElement modelContext =
IPersistencyService.INSTANCE.getTopLevelElementFor(columnSpecAnnEntry
IPersistencyService.getInstance().getTopLevelElementFor(columnSpecAnnEntry
.getModelElement());
modelContext.runAsCommand(new Runnable() {
......@@ -264,7 +264,7 @@ public class CreateAnnotationInstanceColumn extends ViewerColumn {
}
AnnotationEntry entry =
IAnnotationValueService.INSTANCE
IAnnotationValueService.getInstance()
.getAnnotationEntry(columnSpecAnnEntry
.getModelElement());
......
......@@ -267,7 +267,7 @@ public class GenericAnnotationView extends AnnotationViewPartBase {
super.update(modelElement);
// ensure that selected model element is visible in annotation view
AnnotationEntry entry = IAnnotationValueService.INSTANCE.getAnnotationEntry(modelElement);
AnnotationEntry entry = IAnnotationValueService.getInstance().getAnnotationEntry(modelElement);
assert (entry.getModelElement() == modelElement);
tableViewer.reveal(entry);
......
......@@ -75,7 +75,7 @@ public class ModelElementTreeContentProvider extends TreeContentProviderBase {
*/
public List<? extends EObject> getChildren(EObject parentElement) {
IModelElementHandler<EObject> base =
IModelElementHandlerService.INSTANCE.getModelElementHandler(parentElement);
IModelElementHandlerService.getInstance().getModelElementHandler(parentElement);
if(base != null) {
return base.getSubnodes(parentElement);
}
......
......@@ -71,7 +71,7 @@ public class ViewerElementCompositionDropAdapter extends ViewerDropAdapter {
extractDroppedEObject(CompositionServiceLocalDNDTransfer.getInstance()
.getObject());
return IElementCompositorService.INSTANCE
return IElementCompositorService.getInstance()
.canCompose((EObject)lastTarget, dropped, null);
}
return false;
......@@ -83,11 +83,11 @@ public class ViewerElementCompositionDropAdapter extends ViewerDropAdapter {
if(lastTarget instanceof EObject) {
final EObject target = (EObject)lastTarget;
final EObject dropped = DragAndDropUtils.extractDroppedEObject(data);
if(IElementCompositorService.INSTANCE.canCompose(target, dropped, null)) {
if(IElementCompositorService.getInstance().canCompose(target, dropped, null)) {
runAsCommand(target, new Runnable() {
@Override
public void run() {
IElementCompositorService.INSTANCE.compose(target, dropped, null);
IElementCompositorService.getInstance().compose(target, dropped, null);
}
});
return true;
......
......@@ -49,6 +49,6 @@ public class AllocationDiagramEditorBase<T extends EObject> extends CommonDiagra
super.select(editpart);
}
}
}, IAllocationEditPartFactoryService.INSTANCE);
}, IAllocationEditPartFactoryService.getInstance());
}
}
......@@ -267,7 +267,7 @@ abstract class CommonDiagramEditorBase<T extends EObject> extends GEFEditorBase<
/** Creates the context menu. */
private void createContextMenu() {
MenuManager menuManager = IContextMenuService.INSTANCE.createDefaultContextMenu(this);
MenuManager menuManager = IContextMenuService.getInstance().createDefaultContextMenu(this);
Menu contextMenu = menuManager.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(contextMenu);
......@@ -321,7 +321,7 @@ abstract class CommonDiagramEditorBase<T extends EObject> extends GEFEditorBase<
}
});
if(ILibraryService.INSTANCE.isLibraryElementShadow(editedObject) ||
if(ILibraryService.getInstance().isLibraryElementShadow(editedObject) ||
(editedObject instanceof ILibraryElementReference)) {
((ScalableRootEditPart)viewer.getRootEditPart()).deactivate();
}
......@@ -436,7 +436,7 @@ abstract class CommonDiagramEditorBase<T extends EObject> extends GEFEditorBase<
* TODO: remove
*/
protected EditPartFactory createEditPartFactory() {
return IEditPartFactoryService.INSTANCE;
return IEditPartFactoryService.getInstance();
}
/**
......@@ -525,7 +525,7 @@ abstract class CommonDiagramEditorBase<T extends EObject> extends GEFEditorBase<
((EObjectActionBase)action).refresh(element);
}
}
IActionService.INSTANCE.refresh();
IActionService.getInstance().refresh();
}
/** {@inheritDoc} */
......
......@@ -40,6 +40,6 @@ public class DiagramEditorBase<T extends EObject> extends CommonDiagramEditorBas
/** Constructor. */
public DiagramEditorBase() {
super(new ScrollingGraphicalViewer(), IEditPartFactoryService.INSTANCE);
super(new ScrollingGraphicalViewer(), IEditPartFactoryService.getInstance());
}
}
......@@ -99,7 +99,7 @@ public class DiagramKeyHandler extends KeyHandler {
return false;
final ILayoutedModelElement model =
(ILayoutedModelElement)viewer.getFocusEditPart().getModel();
ITopLevelElement topLevel = IPersistencyService.INSTANCE.getTopLevelElementFor(model);
ITopLevelElement topLevel = IPersistencyService.getInstance().getTopLevelElementFor(model);
final Point scrollCoeff = computeScrollCoeff(event);
scrollCoeff.scale(DEFAULT_GRID_SIZE);
topLevel.runAsCommand(new Runnable() {
......
......@@ -54,7 +54,7 @@ public abstract class GEFEditorBase<T extends EObject> extends
// object is deleted if it does not have a parent and is not a
// top-level element
if(getEditedObject().eContainer() == null &&
IPersistencyService.INSTANCE.getTopLevelElementFor(getEditedObject()) != null) {
IPersistencyService.getInstance().getTopLevelElementFor(getEditedObject()) != null) {
getSite().getPage().closeEditor(GEFEditorBase.this, false);
}
}
......
......@@ -127,7 +127,7 @@ public abstract class ConnectionEditPartBase<T extends ConnectionSegmentBase> ex
this.layoutConfiguration = layoutConfiguration;
setModel(modelElement);
this.modelElementHandler =
(IModelElementHandler<T>)IModelElementHandlerService.INSTANCE
(IModelElementHandler<T>)IModelElementHandlerService.getInstance()
.getModelElementHandler(modelElement);
this.relationshipLabel = new Label(determineRelationshipLabelFigureText()) {
/** {@inheritDoc} */
......@@ -190,14 +190,14 @@ public abstract class ConnectionEditPartBase<T extends ConnectionSegmentBase> ex
if(decorationFigure.getParent() != null && decorationBounds != null) {
decorationFigure.getParent().setConstraint(decorationFigure, decorationBounds);
ESeverity severity = IMarkerService.INSTANCE.getHighestViolationSeverity(getModel());
ESeverity severity = IMarkerService.getInstance().getHighestViolationSeverity(getModel());
Image icon = getMarkerServiceDecorationIcon(severity, useSmallDecorationImage());
decorationFigure.setIcon(icon);
if(icon != null) {
String message = "";
Collection<IConstraintViolation<? extends EObject>> violations =
IMarkerService.INSTANCE.getViolations(getModel());
IMarkerService.getInstance().getViolations(getModel());
for(IConstraintViolation<? extends EObject> viol : violations) {
if(viol.getSeverity() == severity) {
message = viol.getExplanation();
......@@ -249,7 +249,7 @@ public abstract class ConnectionEditPartBase<T extends ConnectionSegmentBase> ex
/** {@inheritDoc} */
@Override
protected void refreshVisuals() {
connection.setToolTip(new Label(IModelElementHandlerService.INSTANCE
connection.setToolTip(new Label(IModelElementHandlerService.getInstance()
.getWrappedNameDescription(getModel())));
refreshBendpoints();
}
......
......@@ -81,7 +81,7 @@ public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INam
nameLabel.setFont(DEFAULT_TITLE_FONT);
nameLabel.setTextAlignment(PositionConstants.LEFT | PositionConstants.TOP);
nameLabel.setTextPlacement(PositionConstants.EAST);
nameLabel.setIcon(IModelElementHandlerService.INSTANCE.getModelElementHandler(getModel())
nameLabel.setIcon(IModelElementHandlerService.getInstance().getModelElementHandler(getModel())
.getIcon(getModel()));
return nameLabel;
}
......@@ -135,11 +135,11 @@ public abstract class ElementEditPartBase<T extends ILayoutedModelElement & INam
if(req.getType() == RequestConstants.REQ_OPEN) {
EObject eo = getModel();
IModelElementHandler<EObject> handler =
IModelElementHandlerService.INSTANCE.getModelElementHandler(eo);
IModelElementHandlerService.getInstance().getModelElementHandler(eo);
if(handler != null) {
eo = handler.handleOpenModelElementRequest(eo);
}
IModelEditorBindingService.INSTANCE.openInEditor(eo);
IModelEditorBindingService.getInstance().openInEditor(eo);
}
super.performRequest(req);
}
......
......@@ -74,7 +74,7 @@ public abstract class GraphicalEditPartBase<T extends EObject> extends AbstractG
protected GraphicalEditPartBase(T modelElement) {
setModel(modelElement);
this.modelElementHandler =
(IModelElementHandler<T>)IModelElementHandlerService.INSTANCE
(IModelElementHandler<T>)IModelElementHandlerService.getInstance()
.getModelElementHandler(modelElement);
}
......
......@@ -192,7 +192,7 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ex
if(labelFigure != null && labelFigure.getParent() != null) {
labelFigure.setText(determineLabelFigureText());
if(labelFigure.getIcon() != null) {
labelFigure.setIcon(IModelElementHandlerService.INSTANCE.getModelElementHandler(
labelFigure.setIcon(IModelElementHandlerService.getInstance().getModelElementHandler(
getModel()).getIcon(getModel()));
}
Rectangle labelBounds = determineLabelFigureBounds();
......@@ -207,8 +207,8 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ex
/** Returns the current tooltip description. */
protected String getBaseFigureTooltip() {
String message = IModelElementHandlerService.INSTANCE.getWrappedNameDescription(getModel());
ESeverity sev = IMarkerService.INSTANCE.getHighestViolationSeverity(getModel());
String message = IModelElementHandlerService.getInstance().getWrappedNameDescription(getModel());
ESeverity sev = IMarkerService.getInstance().getHighestViolationSeverity(getModel());
switch(sev) {
case ERROR:
message = getViolationMessage(sev);
......@@ -228,7 +228,7 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ex
if(decorationFigure.getParent() != null && decorationBounds != null) {
decorationFigure.getParent().setConstraint(decorationFigure, decorationBounds);
ESeverity severity = IMarkerService.INSTANCE.getHighestViolationSeverity(getModel());
ESeverity severity = IMarkerService.getInstance().getHighestViolationSeverity(getModel());
decorationFigure.setIcon(getMarkerServiceDecorationIcon(severity,
useSmallDecorationImage()));
}
......@@ -238,7 +238,7 @@ public abstract class PositionedEditPartBase<T extends ILayoutedModelElement> ex
private String getViolationMessage(ESeverity sev) {
String message = "Constraints violation in scope.";
Collection<IConstraintViolation<? extends EObject>> violations =
IMarkerService.INSTANCE.getViolations(getModel());
IMarkerService.getInstance().getViolations(getModel());
for(IConstraintViolation<? extends EObject> viol : violations) {
if(viol.getSeverity() == sev) {
message = viol.getExplanation();
......
......@@ -113,7 +113,7 @@ public abstract class AllocationElementEditPartBase<T extends ILayoutedModelElem
nameLabel.setFont(DEFAULT_TITLE_FONT);
nameLabel.setTextAlignment(PositionConstants.LEFT | PositionConstants.TOP);
nameLabel.setTextPlacement(PositionConstants.EAST);
nameLabel.setIcon(IModelElementHandlerService.INSTANCE.getModelElementHandler(getModel())
nameLabel.setIcon(IModelElementHandlerService.getInstance().getModelElementHandler(getModel())
.getIcon(getModel()));
return nameLabel;
}
......
......@@ -128,7 +128,7 @@ public abstract class AllocationSubDiagramEditPartBase<T extends INamedCommented
nameLabel.setFont(DEFAULT_TITLE_FONT);
nameLabel.setTextAlignment(PositionConstants.LEFT | PositionConstants.TOP);
nameLabel.setTextPlacement(PositionConstants.EAST);
nameLabel.setIcon(IModelElementHandlerService.INSTANCE.getModelElementHandler(getModel())
nameLabel.setIcon(IModelElementHandlerService.getInstance().getModelElementHandler(getModel())
.getIcon(getModel()));
return nameLabel;
}
......@@ -233,18 +233,18 @@ public abstract class AllocationSubDiagramEditPartBase<T extends INamedCommented
RootEditPart root = getRoot();
Rectangle rectangle = new Rectangle(reduce);
if(isTargetDiagram()) {
IAllocationPositionService.INSTANCE.setMinTargetPos(root, new Point(minX, minY));
IAllocationPositionService.getInstance().setMinTargetPos(root, new Point(minX, minY));
reduce.resize(DEFAULT_GRID_SIZE, DEFAULT_GRID_SIZE);
IAllocationPositionService.INSTANCE.setTargetAllocationBounds(root, rectangle);
IAllocationPositionService.getInstance().setTargetAllocationBounds(root, rectangle);
Rectangle sourceBounds =
IAllocationPositionService.INSTANCE.getSourceAllocationBounds(root);
IAllocationPositionService.getInstance().getSourceAllocationBounds(root);
return new Rectangle(reduce.x, sourceBounds.y + sourceBounds.height, reduce.width +
minX, reduce.height + 20);
}
// if sub diagram is the source diagram
IAllocationPositionService.INSTANCE.setMinSourcePos(root, new Point(minX, minY));
IAllocationPositionService.getInstance().setMinSourcePos(root, new Point(minX, minY));
reduce.resize(DEFAULT_GRID_SIZE, DEFAULT_GRID_SIZE);
IAllocationPositionService.INSTANCE.setSourceAllocationBounds(root, rectangle);
IAllocationPositionService.getInstance().setSourceAllocationBounds(root, rectangle);
return reduce;
}
......@@ -361,7 +361,7 @@ public abstract class AllocationSubDiagramEditPartBase<T extends INamedCommented
if(decorationFigure.getParent() != null && decorationBounds != null) {
decorationFigure.getParent().setConstraint(decorationFigure, decorationBounds);
ESeverity severity = IMarkerService.INSTANCE.getHighestViolationSeverity(getModel());
ESeverity severity = IMarkerService.getInstance().getHighestViolationSeverity(getModel());
decorationFigure.setIcon(getMarkerServiceDecorationIcon(severity,
useSmallDecorationImage()));
}
......
......@@ -32,8 +32,14 @@ import org.eclipse.gef.RootEditPart;
public interface IAllocationPositionService {
/** Singleton instance. */
@Deprecated
static IAllocationPositionService INSTANCE = new AllocationPositionService();
/** Returns the service instance. */
public static IAllocationPositionService getInstance() {
return INSTANCE;
}
/** Returns the top left most position of the source elements. */
Point getMinSourcePos(RootEditPart root);
......
......@@ -42,7 +42,7 @@ public class AllocationConnectCommand extends ConnectCommand {
@Override
public boolean canExecute() {
if(context instanceof AllocationConnectionDragContext) {
return IConnectionCompositorService.INSTANCE.canConnect(context.getSource(),
return IConnectionCompositorService.getInstance().canConnect(context.getSource(),
context.getTarget(),
((AllocationConnectionDragContext)context).getAllocationRoot(), context);
}
......@@ -54,7 +54,7 @@ public class AllocationConnectCommand extends ConnectCommand {
public void execute() {
if(context instanceof AllocationConnectionDragContext) {
EObject commonParent = ((AllocationConnectionDragContext)context).getAllocationRoot();
IConnectionCompositorService.INSTANCE.connect(context.getSource(), context.getTarget(),
IConnectionCompositorService.getInstance().connect(context.getSource(), context.getTarget(),
commonParent, context);
} else {
super.execute();
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment