use of org.eclipse.gef.requests.LocationRequest in project whole by wholeplatform.
the class E4TreeViewer method createControl.
@Override
public Control createControl(Composite parent) {
Tree tree = (Tree) super.createControl(parent);
tree.addMouseListener(new MouseAdapter() {
@Override
public void mouseDoubleClick(MouseEvent event) {
Point point = new Point(event.x, event.y);
EditPart editPart = findObjectAt(point);
if (editPart != null) {
LocationRequest request = new LocationRequest(RequestConstants.REQ_DIRECT_EDIT);
request.setLocation(point);
editPart.performRequest(request);
}
}
});
return tree;
}
use of org.eclipse.gef.requests.LocationRequest in project webtools.sourceediting by eclipse.
the class XSDSimpleTypeEditPart method performRequest.
public void performRequest(Request request) {
if (request.getType() == RequestConstants.REQ_OPEN) {
Object model = getModel();
if (request instanceof LocationRequest) {
LocationRequest locationRequest = (LocationRequest) request;
Point p = locationRequest.getLocation();
if (getStructureFigure().hitTestHeader(p)) {
//
if (model instanceof XSDSimpleTypeDefinitionAdapter) {
XSDSimpleTypeDefinitionAdapter adapter = (XSDSimpleTypeDefinitionAdapter) model;
XSDSimpleTypeDefinition st = (XSDSimpleTypeDefinition) adapter.getTarget();
IWorkbench workbench = PlatformUI.getWorkbench();
IWorkbenchWindow workbenchWindow = workbench.getActiveWorkbenchWindow();
IEditorPart editorPart = workbenchWindow.getActivePage().getActiveEditor();
Object schema = editorPart.getAdapter(XSDSchema.class);
ActionRegistry registry = getEditorActionRegistry(editorPart);
if (registry != null) {
if (schema == st.getSchema()) {
IAction action = registry.getAction(SetInputToGraphView.ID);
action.run();
} else {
IAction action = registry.getAction(OpenInNewEditor.ID);
action.run();
}
}
}
}
}
}
}
use of org.eclipse.gef.requests.LocationRequest in project webtools.sourceediting by eclipse.
the class TopLevelComponentEditPart method performRequest.
public void performRequest(Request request) {
// Do not open on or set focus on direct edit type
if (request.getType() == RequestConstants.REQ_OPEN) {
Object model = getModel();
if (model instanceof IGraphElement) {
if (((IGraphElement) model).isFocusAllowed()) {
if (request instanceof LocationRequest) {
LocationRequest locationRequest = (LocationRequest) request;
Point p = locationRequest.getLocation();
if (hitTest(labelHolder, p)) {
performDrillDownAction();
}
}
}
} else if (model instanceof XSDSchemaDirectiveAdapter) {
if (request instanceof LocationRequest) {
LocationRequest locationRequest = (LocationRequest) request;
Point p = locationRequest.getLocation();
if (hitTest(labelHolder, p)) {
XSDSchemaDirective dir = (XSDSchemaDirective) ((XSDSchemaDirectiveAdapter) model).getTarget();
String schemaLocation = "";
// force load of imported schema
if (dir instanceof XSDImportImpl) {
((XSDImportImpl) dir).importSchema();
}
if (dir.getResolvedSchema() != null) {
schemaLocation = URIHelper.removePlatformResourceProtocol(dir.getResolvedSchema().getSchemaLocation());
if (schemaLocation != null) {
OpenOnSelectionHelper.openXSDEditor(dir.getResolvedSchema());
}
}
}
}
}
}
}
use of org.eclipse.gef.requests.LocationRequest in project archi by archimatetool.
the class SelectionTool method createHoverRequest.
/**
* Creates the hover request (a {@link LocationRequest}) and sets its type
* to {@link RequestConstants#REQ_SELECTION_HOVER}.
*/
protected void createHoverRequest() {
hoverRequest = new LocationRequest();
hoverRequest.setType(RequestConstants.REQ_SELECTION_HOVER);
}
use of org.eclipse.gef.requests.LocationRequest in project webtools.sourceediting by eclipse.
the class BaseFieldEditPart method performRequest.
public void performRequest(Request request) {
if (((IADTObject) getModel()).isReadOnly() || isFileReadOnly()) {
return;
}
if (request.getType() == RequestConstants.REQ_DIRECT_EDIT || request.getType() == RequestConstants.REQ_OPEN) {
IFieldFigure fieldFigure = getFieldFigure();
Object model = getModel();
if (request instanceof LocationRequest) {
LocationRequest locationRequest = (LocationRequest) request;
Point p = locationRequest.getLocation();
if (hitTest(fieldFigure.getTypeLabel(), p)) {
TypeReferenceDirectEditManager manager = new TypeReferenceDirectEditManager((IField) model, this, fieldFigure.getTypeLabel());
TypeUpdateCommand typeUpdateCommand = new TypeUpdateCommand();
typeUpdateCommand.setDelegate(manager);
adtDirectEditPolicy.setUpdateCommand(typeUpdateCommand);
manager.show();
} else if (hitTest(fieldFigure.getNameLabel(), p)) {
directEditNameField();
}
} else {
directEditNameField();
}
}
}
Aggregations