Commit a0c8df3a authored by Alexander Diewald's avatar Alexander Diewald

Merge remote-tracking branch 'origin/master' into 3994

parents 17acf307 89a062ce
ContextMenuUtil.java 6d270ba4c239c35ee487192427d02797e73ee109 GREEN
CurvedLinkLayoutedContentAnchorangeController.java e22faedbe98c3dab660b5d2df8ebd004e116c5ba GREEN
CurvedLinkLayoutedDiagramAnchorangeController.java f2e5e2a7cc9b6a070871e200e57371286bb15222 GREEN
EObjectDiagramController.java 18cbb2f092409adeb728233dae6e084faf357d6d GREEN
EObjectEllipticResizableContentControllerBase.java 958d3856daf5337cd75d0a6f163a27dcc8717160 GREEN
EObjectDiagramController.java 27b008c02e174d66184ba8ad76ae81b082f1069f GREEN
EObjectEllipticResizableContentControllerBase.java f12e8f5a646a23fe428ed4768bf041c8b885ec81 GREEN
EObjectModelChangeProvider.java f4b60cebb088a5c81ca92a41614e1a5d40030502 GREEN
EObjectRectangularResizableContentControllerBase.java 7cbc3e89b7b74106d56b8b4f845087e96e13d109 GREEN
EObjectRectangularResizableContentControllerBase.java cde6c13659611d927691c03ecd2621cff2414b03 GREEN
KernelServiceBasedModelChangeProviderBase.java 8d1f8ef79ecd383ff74e5a2bbcf24345aabe70af GREEN
LayoutedContentAnchorageController.java 83f066a151dd2984c4bef64daf8165a0cd53b00f GREEN
LayoutedCurveLinkBendPointController.java d963a5e227de7bd8ba910c733df2ac7acf4fa1fa GREEN
......@@ -13,5 +12,5 @@ LayoutedEllipticResizableContentController.java 1c50e80121512de7ae1f2ba09e0e1f4d
LayoutedLineLinkBendPointController.java f49c994a0c90612c44ec83d42cf858e476662e1f GREEN
LayoutedLinkBendPointController.java d06736b49b6ac9a073237b989895469891500e7f GREEN
LayoutedRectangularResizableContentController.java 341f4a7da0d69360d7026af6d9b3d44dfd7d9bb1 GREEN
ModelElementFXEditorUIProviderBase.java b81bf7fc945d40f1f842876f07ba70799ab65f6d GREEN
ModelElementFXEditorUIProviderBase.java 6bdd31d033228315e99c973b4986cdabc135ec9f GREEN
NamedCommentedLayoutModelChangeProvider.java 223e82c1b1cba842f6fae115182f5d0c6acb44b0 GREEN
......@@ -15,10 +15,10 @@ package org.fortiss.tooling.base.ui.editor.fx.controller;
import static java.lang.Math.max;
import static java.util.Objects.requireNonNull;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createAutoLayoutMenu;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createDisplayMenu;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createElementCompositionContext;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createPrototypeMenu;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createAutoLayoutMenu;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createDisplayMenu;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createElementCompositionContext;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createPrototypeMenu;
import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.canCompose;
import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.compose;
......
......@@ -15,8 +15,8 @@ package org.fortiss.tooling.base.ui.editor.fx.controller;
import static java.lang.Math.max;
import static java.util.Objects.requireNonNull;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createElementCompositionContext;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createPrototypeMenu;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createElementCompositionContext;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createPrototypeMenu;
import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.canCompose;
import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.compose;
......
......@@ -17,9 +17,9 @@ import static java.lang.Math.max;
import static java.util.Objects.requireNonNull;
import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_SHAPE_MINIMUM_HEIGHT;
import static org.fortiss.tooling.base.layout.DefaultLayoutConstants.DEFAULT_SHAPE_MINIMUM_WIDTH;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createElementCompositionContext;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createPrototypeMenu;
import static org.fortiss.tooling.base.ui.editor.fx.visual.CoordinateCorrections.RECTANGLE_INSETS;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createElementCompositionContext;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createPrototypeMenu;
import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.canCompose;
import static org.fortiss.tooling.base.ui.utils.FXDNDUtils.compose;
......
......@@ -15,7 +15,7 @@
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.editor.fx.controller;
import static org.fortiss.tooling.base.ui.editor.fx.controller.ContextMenuUtil.createPrototypeMenu;
import static org.fortiss.tooling.base.ui.utils.ContextMenuUtils.createPrototypeMenu;
import org.eclipse.jface.viewers.IStructuredSelection;
import org.eclipse.jface.viewers.StructuredSelection;
......
AbstractNameEditingSupport.java c57336a0e0da18711a1610ca667dfea76728807f GREEN
ActionUtils.java 322f43d4f92f992daef8ac88eb0f9197c840c89b GREEN
ContextMenuUtils.java 434d6b7aad095ce726caa4de42913391ed6e6832 GREEN
DragAndDropBaseUtils.java d375377f9124f6113b2a295e6b0e09ac8966e564 GREEN
EllipseLayoutUIUtils.java 4dd9dbd96a45e8c455c019caa19e4a50f18336af GREEN
FXDNDUtils.java 6ce94e239e68f9e2b3cc0524b072606f4a120076 GREEN
......
......@@ -13,7 +13,7 @@
| See the License for the specific language governing permissions and |
| limitations under the License. |
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.base.ui.editor.fx.controller;
package org.fortiss.tooling.base.ui.utils;
import static org.fortiss.tooling.base.utils.LayoutModelElementFactory.createPoint;
......@@ -42,7 +42,7 @@ import javafx.scene.control.MenuItem;
*
* @author hoelzl
*/
public final class ContextMenuUtil {
public final class ContextMenuUtils {
/** Creates the menu populated with composable prototypes. */
public static List<MenuItem> createPrototypeMenu(EObject target,
IElementCompositionContext context) {
......@@ -70,6 +70,21 @@ public final class ContextMenuUtil {
return result;
}
/** Creates a delete menu entry */
public static MenuItem createDeleteMenu(EObject target) {
IElementCompositorService ecs = IElementCompositorService.getInstance();
ICommandStackService css = ICommandStackService.getInstance();
MenuItem deleteMenuItem = new MenuItem("Delete");
deleteMenuItem.setOnAction(evt -> {
css.runAsCommand(target, () -> {
ecs.decompose(target);
});
});
return deleteMenuItem;
}
/** Creates an auto-layout menu entry for {@link IHierarchicElement}s. */
public static MenuItem createAutoLayoutMenu(IHierarchicElement target) {
final String MENU_NAME = "Automatic layout";
......
DynamicTreeContentProviderBase.java 6760a6dc5721175b1dada8f30fd9da05f7bcc4b3 GREEN
DynamicTreeItem.java 75dc5534b119ffdb3c10a65810c2a0f330b7955e GREEN
DynamicTreeTableUIProviderBase.java f4fd20e3d267bc39a33a3bbb18416312779ea886 GREEN
DynamicTreeTableUIProviderBase.java ea7de1e0fd824b61b46010d2317f93422bab6144 GREEN
DynamicTreeTableViewer.java 431ac62cbd6ad7df25852fce1b5a62a05ba510e3 GREEN
DynamicTreeUIProviderBase.java e9b68607683de279d0cb8712a28dc131c5c33ece GREEN
DynamicTreeViewer.java e9f19d16a2a7e5a1b03b8a8b543453ac7eb6a051 GREEN
DynamicTreeViewer.java 725f41f4fb4b6bfa813f010fb9083ab02eea164a GREEN
DynamicTreeViewerBase.java a2013538b62d86f6a09efdf2cd78babac2072484 GREEN
IDoubleClickHandler.java 447f7769dead9a106b3ea3139ef0da51eb0b9a89 GREEN
......@@ -13,15 +13,20 @@
*******************************************************************************/
package org.fortiss.tooling.common.ui.javafx.control.treetableview;
import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX;
import javafx.scene.Node;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.TextField;
import javafx.scene.control.TreeItem;
import javafx.scene.control.TreeTableCell;
import javafx.scene.control.TreeTableColumn;
import javafx.scene.control.cell.TextFieldTreeTableCell;
import javafx.scene.input.Dragboard;
import javafx.scene.input.KeyCode;
import javafx.scene.input.KeyEvent;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.util.Callback;
import javafx.util.converter.DefaultStringConverter;
......@@ -233,15 +238,44 @@ public abstract class DynamicTreeTableUIProviderBase<T> {
@Override
protected void updateItem(String item, boolean empty) {
super.updateItem(item, empty);
ContextMenu menu = null;
Node icon = null;
if(!empty && item != null) {
T data = this.getTreeTableRow().getItem();
menu = createContextMenu(data, colIndex);
icon = getIconNode(data, colIndex);
menu = createContextMenu(data, colIndex);
if(IS_OS_LINUX && menu != null) {
// JFX-builtin handling is non-operation in Linux.
addContextMenuHandler(menu, data);
}
}
this.setContextMenu(menu);
this.setGraphic(icon);
this.setContextMenu(menu);
}
/**
* Adds a handler for showing the context menu. Duplicate of the same method in
* {@link DynamicTreeViewer} due to the absence of proper selection interfaces in
* JFX.
*/
private void addContextMenuHandler(ContextMenu menu, T element) {
getTreeTableView().addEventHandler(MouseEvent.MOUSE_RELEASED, e -> {
if(e.getButton() == MouseButton.SECONDARY) {
TreeItem<T> selected =
getTreeTableView().getSelectionModel().getSelectedItem();
// We must check the element since all rows are evaluated.
if(selected != null && selected.getValue() == element) {
menu.show(this, e.getScreenX(), e.getScreenY());
e.consume();
}
} else {
// any other click cause hiding menu
menu.hide();
}
});
}
};
cell.textProperty().bind(cell.itemProperty());
......
......@@ -15,6 +15,8 @@
*******************************************************************************/
package org.fortiss.tooling.common.ui.javafx.control.treetableview;
import static org.apache.commons.lang3.SystemUtils.IS_OS_LINUX;
import javafx.beans.value.ChangeListener;
import javafx.scene.control.ContextMenu;
import javafx.scene.control.TreeCell;
......@@ -23,6 +25,7 @@ import javafx.scene.control.TreeView;
import javafx.scene.input.ClipboardContent;
import javafx.scene.input.DragEvent;
import javafx.scene.input.Dragboard;
import javafx.scene.input.MouseButton;
import javafx.scene.input.MouseEvent;
import javafx.scene.input.TransferMode;
......@@ -127,6 +130,11 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> {
ContextMenu menu = null;
if(!empty && item != null) {
menu = uiProvider.createContextMenu(item);
if(IS_OS_LINUX && menu != null) {
// JFX-builtin handling is non-operation in Linux.
addContextMenuHandler(menu, item);
}
this.setText(uiProvider.getLabel(item));
this.setGraphic(uiProvider.getIconNode(item));
this.setOnDragDetected(evt -> {
......@@ -149,6 +157,28 @@ public final class DynamicTreeViewer<T> extends DynamicTreeViewerBase<T> {
});
}
/**
* Adds a handler for showing the context menu. Duplicate of the same method in
* {@link DynamicTreeTableUIProviderBase} due to the absence of proper selection interfaces in
* JFX.
*/
private void addContextMenuHandler(ContextMenu menu, T element) {
view.addEventHandler(MouseEvent.MOUSE_RELEASED, e -> {
if(e.getButton() == MouseButton.SECONDARY) {
TreeItem<T> selected = view.getSelectionModel().getSelectedItem();
// We must check the element since all rows are evaluated.
if(selected != null && selected.getValue() == element) {
menu.show(view, e.getScreenX(), e.getScreenY());
e.consume();
}
} else {
// any other click cause hiding menu
menu.hide();
}
});
}
/** Called when an item in the tree is dragged. */
private void dragDetected(MouseEvent evt, TreeCell<T> cell, T item) {
ClipboardContent cbContent = uiProvider.getDragClipboardContent(item);
......
......@@ -8,10 +8,10 @@ FXEditorBase.java 40caf638c7b4c02da5aece0d9d58883bce630e76 GREEN
IListPropertySection.java 8bb00fe7959583e794ff9437b7a77404c9a9e70f GREEN
LWFXEFEditorBase.java 86fb5b558794ffa6471ca343934592b6fa4277f6 GREEN
ModelEditorBindingBase.java b9b1a1c5a48a6e677d1f57ad55a6126d9703c4b5 GREEN
ModelElementHandlerBase.java d0efc1e9ca2fbbefb861f1ae8176ad9ec08a08a8 GREEN
ModelElementHandlerBase.java fbd38bcaec6615bcc95be7fdb847f85577c8cd47 GREEN
MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN
NamedCommentedModelElementHandlerBase.java 681b98b50b362f01abb7a36f108f4f11b9e51829 GREEN
PropertySectionBase.java 20fb1daea544123ea941743aafeb9ac59daf5356 GREEN
PropertySectionBase.java a768b0b8f833999d31bdca1cf727f6bc48acc837 GREEN
TutorialStepUIAtomicBase.java cea2a158158b476de2108d2309afcf47f217b6d9 GREEN
TutorialStepUIAtomicWithWhitelistBase.java a9788ae514f62d27169c737ef59fb583234b5d43 GREEN
TutorialStepUICompositeBase.java 8225210eacb5b88de47d78280c5819f572f00ffa GREEN
......
......@@ -22,8 +22,10 @@ import static org.fortiss.tooling.kernel.utils.LoggingUtils.warning;
import static org.fortiss.tooling.kernel.utils.ResourceUtils.getResourceURI;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.jface.resource.ImageDescriptor;
......@@ -53,6 +55,9 @@ public abstract class ModelElementHandlerBase<T extends EObject>
/** Stores the icon image. */
private Map<ImageDescriptor, Image> iconImages = new HashMap<ImageDescriptor, Image>();
/** Caches the known elements without icon. */
private Set<String> elementsWithOutIcons = new HashSet<>();
/** {@inheritDoc} */
@Override
public String getDescription(T element) {
......@@ -76,11 +81,14 @@ public abstract class ModelElementHandlerBase<T extends EObject>
if(pluginId == null || iconPath == null) {
String elementTypeName =
element != null ? element.getClass().getCanonicalName() : "<null>";
String pluginIdName = pluginId != null ? pluginId : "<null>";
String iconPathName = iconPath != null ? iconPath : "<null>";
warning(ToolingKernelUIActivator.getDefault(),
"Failed to load icon for " + elementTypeName + ". Plugin ID: " + pluginIdName +
", icon path: " + iconPathName);
if(!elementsWithOutIcons.contains(elementTypeName)) {
String pluginIdName = pluginId != null ? pluginId : "<null>";
String iconPathName = iconPath != null ? iconPath : "<null>";
warning(ToolingKernelUIActivator.getDefault(),
"Failed to load icon for " + elementTypeName + ". Plugin ID: " +
pluginIdName + ", icon path: " + iconPathName);
elementsWithOutIcons.add(elementTypeName);
}
return null;
}
return imageDescriptorFromBundle(pluginId, iconPath).orElse(null);
......
......@@ -374,7 +374,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* digits to be used in the String representation.
*/
private void bindBigDecimalValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator, NumberFormat nf) {
IValidator<?> numberValidator, NumberFormat nf) {
nf.setGroupingUsed(false);
performComplexTextBinding(dbc, text, observedValue, fromBigDecimal(nf), toBigDecimal(nf),
......@@ -386,7 +386,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* digits to be used in the String representation.
*/
protected void bindBigDecimalValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator) {
IValidator<?> numberValidator) {
NumberFormat nf = getNumberInstance();
bindBigDecimalValue(text, observedValue, numberValidator, nf);
......@@ -397,7 +397,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* used in the String representation.
*/
protected void bindBigDecimalValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator, int maxFractionDigits) {
IValidator<?> numberValidator, int maxFractionDigits) {
NumberFormat nf = getNumberInstance();
nf.setMaximumFractionDigits(maxFractionDigits);
......@@ -426,7 +426,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* to be used in the String representation.
*/
protected void bindDoubleValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator) {
IValidator<?> numberValidator) {
performComplexTextBinding(dbc, text, observedValue, fromDouble(false), toDouble(false),
FLOAT_VALIDATOR, numberValidator);
}
......@@ -436,7 +436,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
* used in the String representation.
*/
protected void bindDoubleValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator, int maxFractionDigits) {
IValidator<?> numberValidator, int maxFractionDigits) {
NumberFormat nf = getNumberInstance();
nf.setMaximumFractionDigits(maxFractionDigits);
......@@ -456,7 +456,7 @@ public abstract class PropertySectionBase extends AbstractPropertySection {
/** Binds a integer value. */
protected void bindIntegerValue(Control text, IObservableValue<?> observedValue,
IValidator numberValidator) {
IValidator<?> numberValidator) {
performComplexTextBinding(dbc, text, observedValue, fromInteger(false), toInteger(false),
INT_VALIDATOR, numberValidator);
}
......
ICommandLineSwitchHandler.java 1df397bf5b1a2af7040f5e73bfe7f3bd239d47c5 YELLOW
ICommandLineSwitchHandler.java 1df397bf5b1a2af7040f5e73bfe7f3bd239d47c5 GREEN
IConnectionCompositor.java 82188750593a08df75a5f21fd91d4b41f72593fd GREEN
IConstraintChecker.java a6d76e332ece919adb990397dd5ef6aaa542ea7d GREEN
IEclipseResourcePostLoadProvider.java e842bb7485ef27917092ffc60af8a57e475d01d6 GREEN
......
CommandLineInterfaceService.java 6b5c94c52702f773c60b181eff52204ab379b248 YELLOW
CommandLineInterfaceService.java 6b5c94c52702f773c60b181eff52204ab379b248 GREEN
CommandStackService.java 957bda69b5feb91f002aed4d25ed334e92801e7e GREEN
ConnectionCompositorService.java d69a60cd7a3d06e91d24fd32b9c00125ea71e0dd GREEN
ConstraintCheckerService.java 459b5eb717598e7e8bb71a0c87e57ea85cb00e4b GREEN
......@@ -8,7 +8,7 @@ LibraryPrototypeProvider.java b77eddbdca78f561ffb1233e98817be361c690ae GREEN
LibraryService.java d22671ba820466062852c15873698adf28960d94 GREEN
LoggingService.java da784259f7b456b54bf75c41ec268f64919ce78d GREEN
MigrationService.java 2f800eac9793aa736089a802bbfc2c4c1c09770d GREEN
PersistencyService.java 2e3936012a9b7217a293cbe8272ffa5f02518045 YELLOW
PersistencyService.java 2e3936012a9b7217a293cbe8272ffa5f02518045 GREEN
PrototypeService.java cf8e6fa96ba9c2f65b24400054ed68e93238a975 GREEN
ToolingKernelInternal.java f6e7114825748683c7f1d040b41ab854a6c4d79b GREEN
TransformationService.java 3cdb86fe920158f93cd9466c6ef9697b2dd8ca7f GREEN
......
ICommandLineInterfaceService.java b8b67b758f9af720968279ef7af9e2ef4f393f62 YELLOW
ICommandLineInterfaceService.java c3e3ba08b2a1b8125b43abd1c29b7dc0a0be2b80 GREEN
ICommandStackService.java 678dcd1a6ab435ed0870fa2a9ec48ce47f25a187 GREEN
IConnectionCompositorService.java 0cdf4568b2cd3e95ea195df90a84699eff36442b GREEN
IConstraintCheckerService.java 291e53297aaea213e07e78f63350938ee2c7b155 GREEN
......
......@@ -27,7 +27,7 @@ import org.fortiss.tooling.kernel.internal.CommandLineInterfaceService;
*/
public interface ICommandLineInterfaceService {
/** Returns the internal implemenation of the {@link ICommandLineInterfaceService}. */
/** Returns the internal implementation of the {@link ICommandLineInterfaceService}. */
public static ICommandLineInterfaceService getInstance() {
return CommandLineInterfaceService.getInstance();
}
......
CompositionUtils.java 34c0a191bd0fb4176c94b4d61abb5c88a679d5e8 GREEN
EMFResourceUtils.java 8d878ffbe17ad916699bf6c2ac64fd4a1498c215 YELLOW
EMFResourceUtils.java 68e6712a52349548bf85346900b17aa65b5f0ea9 GREEN
EcoreSerializerBase.java 0a0c2969d793d2e68094c55c8f7b0a662ef6e5d5 GREEN
EcoreUtils.java 18416b5c214410a02eb35596fd807a1cc27d6b35 GREEN
ExtensionPointUtils.java 7ce63242b49eb9a7cd4eaadd223f5ebce1dfd75b GREEN
......
......@@ -136,7 +136,7 @@ public final class EMFResourceUtils {
ResourceSet rset = new ResourceSetImpl();
Resource r;
r = rset.createResource(uri);
r.load(EMFResourceUtils.buildOptionsMap());
r.load(buildOptionsMap());
Map<EObject, AnyType> unknownFeatures = r instanceof XMIResource
? ((XMIResource)r).getEObjectToExtensionMap() : new HashMap<EObject, AnyType>();
if(!r.getContents().isEmpty()) {
......
Markdown is supported
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