Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • af3/kernel
  • diewald/kernel
2 results
Show changes
Commits on Source (18)
Showing
with 149 additions and 20 deletions
org.fortiss.tooling.ext.reuse.ui/icons/af3_icon64.png

6.11 KiB

org.fortiss.tooling.ext.reuse.ui/icons/af3_logo.png

22.2 KiB

org.fortiss.tooling.ext.reuse.ui/icons/af3_logo_square.png

33.5 KiB

ReuseLibraryUIUtils.java 0f8d233c725d9dbd39ff6613a69c997786264054 GREEN
ReuseLibraryUIUtils.java fed62784975bf8e6fc1625505636e247dfb6c86e GREEN
ReuseLibraryViewUtils.java 34a852dc692ec56cb3e9fd8dcea99d64f31503b3 GREEN
......@@ -16,10 +16,12 @@
package org.fortiss.tooling.ext.reuse.ui.utils;
import static java.lang.String.join;
import static javafx.scene.control.Alert.AlertType.INFORMATION;
import static org.conqat.ide.commons.ui.dialog.MessageUtils.askQuestion;
import static org.conqat.ide.commons.ui.dialog.MessageUtils.showInfo;
import static org.conqat.ide.commons.ui.dialog.MessageUtils.showWarning;
import static org.conqat.ide.commons.ui.ui.WorkbenchUtils.getActiveWorkbenchWindow;
import static org.fortiss.tooling.common.ui.javafx.util.GraphicUtils.getFXImage;
import static org.fortiss.tooling.ext.reuse.storage.ReuseLibraryStorageManager.REUSE_PROJECT_DIR;
import static org.fortiss.tooling.ext.reuse.utils.ReuseLibraryUtilsBasics.getAllReuseSpecs;
import static org.fortiss.tooling.ext.reuse.utils.ReuseLibraryUtilsBasics.getElementInsideLibrary;
......@@ -35,8 +37,16 @@ import org.eclipse.swt.widgets.Shell;
import org.fortiss.tooling.base.model.element.IModelElement;
import org.fortiss.tooling.ext.reuse.model.ReuseElementSpec;
import org.fortiss.tooling.ext.reuse.model.ReuseLibrary;
import org.fortiss.tooling.ext.reuse.ui.ToolingReuseUIActivator;
import org.fortiss.tooling.ext.reuse.ui.dialog.SelectLibDialog;
import javafx.scene.control.Alert;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.control.DialogPane;
import javafx.scene.control.TextArea;
import javafx.scene.image.Image;
import javafx.stage.Stage;
/**
* Utility methods for {@link ReuseLibrary}s' UI.
*
......@@ -44,6 +54,12 @@ import org.fortiss.tooling.ext.reuse.ui.dialog.SelectLibDialog;
*/
public class ReuseLibraryUIUtils {
/** Standard width preference for dialog windows used in the reuse context. */
private final static Double DIALOG_WINDOW_WIDTH_PREF = 700.0;
/** Standard height preference for dialog windows used in the reuse context. */
private final static Double DIALOG_WINDOW_HEIGHT_PREF = 500.0;
/**
* Returns the selected {@link ReuseElementSpec} by user from all
* {@link ReuseElementSpec}s of the given element. Returns null if no
......@@ -231,18 +247,84 @@ public class ReuseLibraryUIUtils {
List<EObject> externalRefs = getExternalReferencesOfElement(reuseElement);
if (!externalRefs.isEmpty()) {
String infoMessage = "The following elements were found as references inside the reuse element you "
String headerText = "The following elements were found as references inside the reuse element you "
+ actionText + ".\n\nIn case of reusing this element" + currentReuseTest
+ ", these referenced elements will be needed in the new environment, too. "
+ "Therefore, you might want to add/update these reference elements as well (if not already done).\n";
String bodyText = "";
for (EObject externalRef : externalRefs) {
infoMessage += "\n- " + getReuseElementName(externalRef) + " (" + externalRef.getClass().getSimpleName()
bodyText += "\n- " + getReuseElementName(externalRef) + " (" + externalRef.getClass().getSimpleName()
+ ")";
if (getReuseElementName(externalRef).equals(getReuseElementName(reuseElement))) {
infoMessage += " [ignore this if it is actually " + sourceText + "]";
bodyText += " [ignore this if it is actually " + sourceText + "]";
}
}
showInfo(infoTitle, infoMessage);
showBasicScrollableInformation(shellTitle, headerText, bodyText);
}
}
/**
* Creates and displays a information box with only an OK button. Everything is
* already set except the text for the title, the header and the body.
*
* @param windowTitle The title of the dialog window
* @param headerText The text of the header between title and body
* @param bodyText The actual text body
*/
public static void showBasicScrollableInformation(String windowTitle, String headerText, String bodyText) {
boolean showSymbol = true;
showCustomScrollableAlert(INFORMATION, windowTitle, headerText, bodyText, showSymbol, DIALOG_WINDOW_WIDTH_PREF,
DIALOG_WINDOW_HEIGHT_PREF);
}
/**
* Creates and displays a dialog/alert message box depending on the given
* {@link AlertType}. You can customize the title, the text in the header, if
* the symbol besides the header should be displayed, the actual text body and
* the preferred size of the window (null if nothing is preferred).
*
* @param alertType The alert type like Information, Error, etc.
* @param windowTitle The title of the dialog window
* @param headerText The text of the header between title and body
* @param bodyText The actual text body
* @param showSymbol Whether the symbol besides the header text should be
* displayed
* @param windowPrefWidth Preferred width of the window
* @param windowPrefHeight Preferred height of the window
*/
public static void showCustomScrollableAlert(AlertType alertType, String windowTitle, String headerText,
String bodyText, boolean showSymbol, Double windowPrefWidth, Double windowPrefHeight) {
Alert alert = new Alert(alertType);
if (!showSymbol) {
alert.setGraphic(null);
}
alert.setTitle(windowTitle);
alert.setHeaderText(headerText);
alert.setResizable(true);
TextArea area = new TextArea(bodyText);
area.setWrapText(true);
area.setEditable(false);
DialogPane dialogPane = alert.getDialogPane();
Image taskbarIcon = getFXImage(ToolingReuseUIActivator.PLUGIN_ID, "icons/af3_icon64.png");
Stage stage = (Stage) dialogPane.getScene().getWindow();
stage.getIcons().add(taskbarIcon);
// use setExpandableContent(area) if the scrollable text should be first hidden
// under "Show details". Then, alert.setContentText() can be used to show a
// short message before
dialogPane.setContent(area);
if (windowPrefWidth != null && windowPrefWidth > 0.0) {
dialogPane.setPrefWidth(windowPrefWidth);
}
if (windowPrefHeight != null && windowPrefHeight > 0.0) {
dialogPane.setPrefHeight(windowPrefHeight);
}
alert.showAndWait();
}
}
ReuseLibraryModelElementFactory.java 4ee3eb7449e212643992a3dec6cfb8f4278efb70 GREEN
ReuseLibraryUtilsBasics.java 9aa543630acf9555721821519d96d4356a07f341 GREEN
ReuseLibraryUtilsBasics.java b651b31f6d94ff98a8f965440d662bfc4655c31b GREEN
ReuseLibraryUtilsManipulation.java 77a646db5a63ba7c61664dbcaf34a9036003fde5 GREEN
......@@ -45,10 +45,10 @@ import org.fortiss.tooling.kernel.model.INamedElement;
public class ReuseLibraryUtilsBasics {
/** Standard internal date format used for reuse (e.g. for hash dates) */
public static DateTimeFormatter internalReuseDateFormatter = ISO_DATE_TIME;
public final static DateTimeFormatter INTERNAL_REUSE_DATE_FORMATTER = ISO_DATE_TIME;
/** Standard date format used for reuse (easier readable) */
public static DateTimeFormatter displayReuseDateFormatter = RFC_1123_DATE_TIME;
public final static DateTimeFormatter DISPLAY_REUSE_DATE_FORMATTER = RFC_1123_DATE_TIME;
/**
* Returns whether the given element can be used as reuse element.
......@@ -343,9 +343,9 @@ public class ReuseLibraryUtilsBasics {
public static String getDateAsString(ZonedDateTime date, boolean forDisplay) {
if (date != null) {
if (forDisplay) {
return displayReuseDateFormatter.format(date);
return DISPLAY_REUSE_DATE_FORMATTER.format(date);
} else {
return internalReuseDateFormatter.format(date);
return INTERNAL_REUSE_DATE_FORMATTER.format(date);
}
}
return "";
......
IContextMenuContributor.java 0f09c76662c154cf52ddab61b417e82a42854162 GREEN
IContextMenuContributor.java de86b87701450d4579047de3075eda8f878d23a9 GREEN
IContextMenuMultiSelectionContributor.java 125b31dd38009bc2095b7e6bc860e946e39f58c4 GREEN
IModelEditor.java 777df0a6be0fecb42315c228e5c1e7f68d5ec63f GREEN
IModelEditorBinding.java 844865d93252b6c4a648c23ff28bb28fd42c17aa GREEN
IModelEditorBinding.java 0eab668c7a7ad05c6cfc25412e7d38110dd0dc8f GREEN
IModelElementHandler.java a1613b4ba01a497c8b04943e6dd7ca246a2d40f8 GREEN
ITutorialStepUI.java b8aee2b95857484ab6ad9ecd55b5de9f0ea158e5 GREEN
ITutorialUIProvider.java aa0ff5db4d7ba0953e34edeb99f3e8279567e18f GREEN
......
......@@ -48,4 +48,12 @@ public interface IContextMenuContributor {
/** Returns the section ID to be used for the contributed elements. */
String getMenuSectionID();
/**
* Returns true if this context menu provider should be hidden in the navigator's simplified
* non-expert view.
*/
default boolean hiddenInNonExpertView() {
return false;
}
}
......@@ -61,4 +61,10 @@ public interface IModelEditorBinding<T extends EObject> extends IEObjectAware<EO
/** Returns the priority of the editor. Higher values have lower priority. */
int getPriority();
/**
* Returns {@code true} if the editor referenced by this editor binding should be hidden in the
* navigator's simplified non-expert view.
*/
boolean hiddenInNonExpertView();
}
......@@ -7,7 +7,7 @@ EditorBase.java c8da67e34a7f052a71730e06b1963789f5c1b394 GREEN
FXEditorBase.java c582034c952955de6b58b804290d0cfdf9a76c27 GREEN
IListPropertySection.java 8bb00fe7959583e794ff9437b7a77404c9a9e70f GREEN
LWFXEFEditorBase.java cf8133b9f0c25a62f8756ab77959e5294992d59c GREEN
ModelEditorBindingBase.java b9b1a1c5a48a6e677d1f57ad55a6126d9703c4b5 GREEN
ModelEditorBindingBase.java a71465afca5a56dfb8f14a34a48acf8dedae813d GREEN
ModelElementHandlerBase.java 486ad59505e710062715f493c6ff6e49769f5550 GREEN
MultiEObjectActionBase.java 9e237d8ea640c4194e4877af4a9cfce88698e543 GREEN
NamedCommentedModelElementHandlerBase.java 681b98b50b362f01abb7a36f108f4f11b9e51829 GREEN
......
......@@ -92,4 +92,10 @@ public abstract class ModelEditorBindingBase<T extends EObject>
public int getPriority() {
return 0;
}
/** {@inheritDoc} */
@Override
public boolean hiddenInNonExpertView() {
return false;
}
}
ActionService.java e29126b5947c9fd2f1d82bb87001b9d0ead50c3b GREEN
ContextMenuService.java 802b6d0ade78f91478cd8959cfb423b9963d43bf GREEN
ContextMenuService.java 9021e4eeb5d7be5d73d87e5947564bdf17f07b9d GREEN
MarkerService.java 0bfe2c67638db4e506ea5dc7680765f2a8d632e1 GREEN
ModelEditorBindingService.java f304addb514cd2de443997e0b52cef7a3a9897bf GREEN
ModelElementHandlerService.java 34adeef844bf98c69f1b9a7252f34d0a2b741b54 GREEN
......
......@@ -42,6 +42,7 @@ import org.fortiss.tooling.kernel.ui.extension.data.ContextMenuContextProvider;
import org.fortiss.tooling.kernel.ui.introspection.items.ContextMenuKISSDetailsItem;
import org.fortiss.tooling.kernel.ui.service.IActionService;
import org.fortiss.tooling.kernel.ui.service.IContextMenuService;
import org.fortiss.tooling.kernel.ui.service.INavigatorService;
import org.fortiss.tooling.kernel.ui.service.ITutorialUIService;
import org.fortiss.tooling.kernel.utils.ExtensionPointUtils;
import org.fortiss.tooling.kernel.utils.LoggingUtils;
......@@ -188,6 +189,11 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
ContextMenuContextProvider contextProvider) {
EObject selectionElem = contextProvider.getSelectedModelElement();
for(IContextMenuContributor contributor : contextMenuContributorList) {
if(!INavigatorService.getInstance().isExpertViewActive() &&
contributor.hiddenInNonExpertView()) {
continue;
}
String menuSectionID = contributor.getMenuSectionID();
if(menuSectionID == null) {
menuSectionID = IWorkbenchActionConstants.MB_ADDITIONS;
......@@ -223,6 +229,11 @@ public class ContextMenuService implements IContextMenuService, IIntrospectiveKe
ContextMenuContextProvider contextProvider, List<EObject> selection) {
for(IContextMenuContributor contributor : contextMenuContributorList) {
if(contributor instanceof IContextMenuMultiSelectionContributor) {
if(!INavigatorService.getInstance().isExpertViewActive() &&
contributor.hiddenInNonExpertView()) {
continue;
}
IContextMenuMultiSelectionContributor multicontributor =
(IContextMenuMultiSelectionContributor)contributor;
String menuSectionID = contributor.getMenuSectionID();
......
ActionBarContributor.java 18d9db3744c5381cca8b6823b5f7bc18183a1cfa GREEN
ExtendableMultiPageEditor.java ea3f1d3b518eac66af458c0380b96d55d5c51b97 GREEN
ExtendableMultiPageEditor.java b350451d237a288e35671ffe1ad9bd1a3656b750 GREEN
IActionContributingEditor.java 4aa7496d67822de919a8cf0af0ddaafc61bf2919 GREEN
ModelElementEditorInput.java e269eff5d992d375a646e54d048f1f0efc6144dd GREEN
TutorialStepUIEditor.java 9eadc96c302b5131ff4cc3715777718fa06ec7e8 GREEN
......
......@@ -50,6 +50,7 @@ import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.extension.base.LWFXEFEditorBase;
import org.fortiss.tooling.kernel.ui.listener.ExtendableMultiPageEditorPageChangeListener;
import org.fortiss.tooling.kernel.ui.service.IModelEditorBindingService;
import org.fortiss.tooling.kernel.ui.service.INavigatorService;
import org.fortiss.tooling.kernel.ui.util.PropertiesConstantUtils;
/**
......@@ -189,7 +190,9 @@ public class ExtendableMultiPageEditor extends MultiPageEditorPart
try {
Class<? extends IEditorPart> editorClass =
editorBinding.getEditorClass(editedObject);
if(editorClass != null) {
boolean expertViewIsActive = INavigatorService.getInstance().isExpertViewActive();
if(editorClass != null &&
(expertViewIsActive || !editorBinding.hiddenInNonExpertView())) {
Class<? extends EObject> inputType = editedObject.getClass();
IEditorPart editorPart =
constructEditorPart(editorClass, inputType, editorBinding);
......
DoubleClick.java a94d27299814a93b0d8914050a5da7378a7eccd1 GREEN
GenericNewMenu.java 7e0dd435cb5ca6d4b486235ec17eef3e5c7aa5f6 GREEN
LinkWithEditorPartListener.java c5ab74424378e7b158a805c4dd14fc03c8abeded GREEN
ModelElementsView.java 412cd549f6b3c764a0a842dd3b852563a5496201 GREEN
ModelElementsView.java bc97ed1edbfa4473d23cbbb71d16f8eb0249bb73 GREEN
NavigatorNewMenu.java a35e391960d1dacbe7f77982e53e1891e9382d5a GREEN
NavigatorTreeContentComparator.java d9f1354cfdff78b104b28887d2397e5ca0e9755b GREEN
NavigatorTreeContentProvider.java 8162138aab09b2cf833cf5f90ff6ab1fc3edc4d8 GREEN
......
......@@ -35,10 +35,12 @@ import org.fortiss.tooling.kernel.extension.data.Prototype;
import org.fortiss.tooling.kernel.extension.data.PrototypeCategory;
import org.fortiss.tooling.kernel.internal.PrototypeService;
import org.fortiss.tooling.kernel.service.IPrototypeService;
import org.fortiss.tooling.kernel.ui.extension.IModelElementHandler;
import org.fortiss.tooling.kernel.ui.extension.base.EditorBase;
import org.fortiss.tooling.kernel.ui.internal.editor.ExtendableMultiPageEditor;
import org.fortiss.tooling.kernel.ui.listener.ExtendableMultiPageEditorPageChangeListener;
import org.fortiss.tooling.kernel.ui.service.IModelElementHandlerService;
import org.fortiss.tooling.kernel.ui.service.INavigatorService;
import javafx.scene.Node;
import javafx.scene.Scene;
......@@ -175,13 +177,24 @@ public final class ModelElementsView extends FXViewPart {
return false;
}
if(supportedBaseClasses.contains(element)) {
if(filterValue == null || "".equals(filterValue)) {
return true;
}
if(element instanceof Prototype) {
boolean isExpertViewActive =
INavigatorService.getInstance().isExpertViewActive();
Prototype proto = (Prototype)element;
IModelElementHandlerService mhs = IModelElementHandlerService.getInstance();
IModelElementHandler<EObject> handler =
mhs.getModelElementHandler(proto.getPrototype());
if(!isExpertViewActive && handler.hiddenInNonExpertView()) {
return false;
}
if(filterValue == null || "".equals(filterValue)) {
return true;
}
return proto.getName().toLowerCase().contains(filterValue.toLowerCase());
}
throw new RuntimeException("Model Elements view: encountered unexpected type: " +
element.getClass().getSimpleName());
}
return false;
}
......