diff options
author | Alexandra Buzila | 2018-11-16 14:31:19 +0000 |
---|---|---|
committer | Eugen Neufeld | 2018-11-16 16:56:29 +0000 |
commit | 4b887e258b4ad8ecb0daed1a52b620b4109ea5a4 (patch) | |
tree | db0fd5ed1d785f2ac1514adebdadfa4aae838efe /bundles | |
parent | 60c6b244adb04227a139e281a7774573750ca811 (diff) | |
download | org.eclipse.emf.ecp.core-4b887e258b4ad8ecb0daed1a52b620b4109ea5a4.tar.gz org.eclipse.emf.ecp.core-4b887e258b4ad8ecb0daed1a52b620b4109ea5a4.tar.xz org.eclipse.emf.ecp.core-4b887e258b4ad8ecb0daed1a52b620b4109ea5a4.zip |
Bug 536049 - GenericEditor and subclasses should handle unknown features
- add resource load option to record unknown features and show a dialog
in the generic editor if the model could not be correctly loaded
- let clients customize load and save options
- externalize strings and remove warnings in changed code
Change-Id: Ic90e563fa84f95c93174c5fbda5f8c0c290a949b
Signed-off-by: Alexandra Buzila <abuzila@eclipsesource.com>
Diffstat (limited to 'bundles')
17 files changed, 217 insertions, 112 deletions
diff --git a/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/ViewEditorPart.java b/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/ViewEditorPart.java index cd59331ae1..36fd24d653 100644 --- a/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/ViewEditorPart.java +++ b/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/ViewEditorPart.java @@ -607,15 +607,15 @@ public class ViewEditorPart extends EditorPart implements MessageDialog .openWarning( parent.getShell(), - Messages.ViewEditorPart_LoadedPartyTitle, - Messages.ViewEditorPart_LoadedPartyDescription); + Messages.ViewEditorPart_LoadedPartlyTitle, + Messages.ViewEditorPart_LoadedPartlyDescription); } try { final ViewModelContext viewModelContext = ViewModelContextFactory.INSTANCE .createViewModelContext(ViewProviderHelper.getView(view, null), view, new DefaultReferenceService(), new EMFDeleteServiceImpl()); - viewModelContext.putContextValue("enableMultiEdit", Boolean.TRUE); + viewModelContext.putContextValue("enableMultiEdit", Boolean.TRUE); //$NON-NLS-1$ render = ECPSWTViewRenderer.INSTANCE.render(parent, viewModelContext); } catch (final ECPRendererException ex) { Activator.getDefault().getReportService().report( diff --git a/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/messages/Messages.java b/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/messages/Messages.java index dea6d352e6..7eaa82483e 100644 --- a/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/messages/Messages.java +++ b/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/messages/Messages.java @@ -27,8 +27,8 @@ public class Messages extends NLS { public static String ViewEditorPart_invalidVView_noRootEClass; public static String ViewEditorPart_invalidVView_rootEClassNotInPackage; public static String ViewEditorPart_invalidVView_rootEClassPackageNotResolved; - public static String ViewEditorPart_LoadedPartyDescription; - public static String ViewEditorPart_LoadedPartyTitle; + public static String ViewEditorPart_LoadedPartlyDescription; + public static String ViewEditorPart_LoadedPartlyTitle; public static String ViewEditorPart_MigrationErrorText1; public static String ViewEditorPart_MigrationErrorText2; public static String ViewEditorPart_MigrationErrorTitle; diff --git a/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/messages/messages.properties b/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/messages/messages.properties index c8dfd3650e..24caf6753e 100644 --- a/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/messages/messages.properties +++ b/bundles/org.eclipse.emf.ecp.ide.editor.view/src/org/eclipse/emf/ecp/ide/editor/view/messages/messages.properties @@ -5,8 +5,8 @@ ViewEditorPart_InvalidVView=The file you attempted to open does not seem to cont ViewEditorPart_invalidVView_noRootEClass=The file you attempted to open does not seem to contain a valid EMFForms view model.\nReason: The VView element refers to an invalid root Eclass. ViewEditorPart_invalidVView_rootEClassNotInPackage=The root EClass "{0}" of the VView element could not be resolved.\nReason: The registered EPackage "{1}" with namespace URI "{2}" does not contain the root EClass.\nPerhaps your Ecore does not fit to your view model? ViewEditorPart_invalidVView_rootEClassPackageNotResolved=The root EClass "{0}" of the VView could not be resolved using package "{1}".\nMake sure you registered the EPackage containing your EClass with its respective namespace URI. -ViewEditorPart_LoadedPartyDescription=The view model loading incomplete. A migration to the latest view model version might be required.\nPlease visit our migration guide for more information. -ViewEditorPart_LoadedPartyTitle=Problems while loading the view model +ViewEditorPart_LoadedPartlyDescription=The view model loading was incomplete. A migration to the latest view model version might be required.\nPlease visit our migration guide for more information. +ViewEditorPart_LoadedPartlyTitle=Problems while loading the view model ViewEditorPart_MigrationErrorText1=An error occurred during the migration of the view model. ViewEditorPart_MigrationErrorText2=More information on the error can be found in the error log. ViewEditorPart_MigrationErrorTitle=EMF Forms view model migration error diff --git a/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.jdt.core.prefs b/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.jdt.core.prefs index 82d0031d52..557976e20e 100644 --- a/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.jdt.core.prefs +++ b/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.jdt.core.prefs @@ -26,9 +26,9 @@ org.eclipse.jdt.core.compiler.annotation.nullable=org.eclipse.jdt.annotation.Nul org.eclipse.jdt.core.compiler.annotation.nullanalysis=disabled org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled org.eclipse.jdt.core.compiler.codegen.methodParameters=do not generate -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve -org.eclipse.jdt.core.compiler.compliance=1.6 +org.eclipse.jdt.core.compiler.compliance=1.8 org.eclipse.jdt.core.compiler.debug.lineNumber=generate org.eclipse.jdt.core.compiler.debug.localVariable=generate org.eclipse.jdt.core.compiler.debug.sourceFile=generate @@ -82,7 +82,7 @@ org.eclipse.jdt.core.compiler.problem.missingSerialVersion=warning org.eclipse.jdt.core.compiler.problem.missingSynchronizedOnInheritedMethod=warning org.eclipse.jdt.core.compiler.problem.noEffectAssignment=warning org.eclipse.jdt.core.compiler.problem.noImplicitStringConversion=warning -org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=ignore +org.eclipse.jdt.core.compiler.problem.nonExternalizedStringLiteral=warning org.eclipse.jdt.core.compiler.problem.nonnullParameterAnnotationDropped=warning org.eclipse.jdt.core.compiler.problem.nullAnnotationInferenceConflict=error org.eclipse.jdt.core.compiler.problem.nullReference=warning @@ -131,7 +131,7 @@ org.eclipse.jdt.core.compiler.problem.unusedPrivateMember=warning org.eclipse.jdt.core.compiler.problem.unusedTypeParameter=ignore org.eclipse.jdt.core.compiler.problem.unusedWarningToken=warning org.eclipse.jdt.core.compiler.problem.varargsArgumentNeedCast=warning -org.eclipse.jdt.core.compiler.source=1.6 +org.eclipse.jdt.core.compiler.source=1.8 org.eclipse.jdt.core.compiler.taskCaseSensitive=enabled org.eclipse.jdt.core.compiler.taskPriorities=NORMAL,HIGH,HIGH,LOW,LOW,LOW,LOW,LOW,NORMAL org.eclipse.jdt.core.compiler.taskTags=TODO,FIXME,XXX,PERF,MEM,POLISH,@generated NOT,@ADDED,APITODO diff --git a/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.jdt.ui.prefs b/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.jdt.ui.prefs index 7d2a1b19b7..8bc4bb4b36 100644 --- a/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.jdt.ui.prefs +++ b/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.jdt.ui.prefs @@ -11,10 +11,12 @@ cleanup.always_use_blocks=true cleanup.always_use_parentheses_in_expressions=false cleanup.always_use_this_for_non_static_field_access=false cleanup.always_use_this_for_non_static_method_access=false +cleanup.convert_functional_interfaces=false cleanup.convert_to_enhanced_for_loop=false -cleanup.correct_indentation=true +cleanup.correct_indentation=false cleanup.format_source_code=true cleanup.format_source_code_changes_only=false +cleanup.insert_inferred_type_arguments=false cleanup.make_local_variable_final=true cleanup.make_parameters_final=false cleanup.make_private_fields_final=true @@ -29,6 +31,7 @@ cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=tru cleanup.qualify_static_member_accesses_with_declaring_class=true cleanup.qualify_static_method_accesses_with_declaring_class=false cleanup.remove_private_constructors=true +cleanup.remove_redundant_type_arguments=true cleanup.remove_trailing_whitespaces=true cleanup.remove_trailing_whitespaces_all=true cleanup.remove_trailing_whitespaces_ignore_empty=false @@ -42,13 +45,16 @@ cleanup.remove_unused_private_methods=true cleanup.remove_unused_private_types=true cleanup.sort_members=false cleanup.sort_members_all=false +cleanup.use_anonymous_class_creation=false cleanup.use_blocks=true cleanup.use_blocks_only_for_return_and_throw=false +cleanup.use_lambda=true cleanup.use_parentheses_in_expressions=true cleanup.use_this_for_non_static_field_access=true cleanup.use_this_for_non_static_field_access_only_if_necessary=true cleanup.use_this_for_non_static_method_access=true cleanup.use_this_for_non_static_method_access_only_if_necessary=true +cleanup.use_type_arguments=false cleanup_profile=_esmCleanUp cleanup_settings_version=2 eclipse.preferences.version=1 @@ -76,7 +82,7 @@ sp_cleanup.always_use_this_for_non_static_field_access=false sp_cleanup.always_use_this_for_non_static_method_access=false sp_cleanup.convert_functional_interfaces=false sp_cleanup.convert_to_enhanced_for_loop=false -sp_cleanup.correct_indentation=true +sp_cleanup.correct_indentation=false sp_cleanup.format_source_code=true sp_cleanup.format_source_code_changes_only=false sp_cleanup.insert_inferred_type_arguments=false diff --git a/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.pde.ds.annotations.prefs b/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.pde.ds.annotations.prefs new file mode 100644 index 0000000000..960a807c0b --- /dev/null +++ b/bundles/org.eclipse.emfforms.editor/.settings/org.eclipse.pde.ds.annotations.prefs @@ -0,0 +1,6 @@ +eclipse.preferences.version=1 +enabled=true +generateBundleActivationPolicyLazy=true +path=OSGI-INF +validationErrorLevel=error +validationErrorLevel.missingImplicitUnbindMethod=error diff --git a/bundles/org.eclipse.emfforms.editor/META-INF/MANIFEST.MF b/bundles/org.eclipse.emfforms.editor/META-INF/MANIFEST.MF index da2495af37..6336eba552 100644 --- a/bundles/org.eclipse.emfforms.editor/META-INF/MANIFEST.MF +++ b/bundles/org.eclipse.emfforms.editor/META-INF/MANIFEST.MF @@ -6,12 +6,13 @@ Bundle-Version: 1.19.0.qualifier Bundle-Activator: org.eclipse.emfforms.internal.editor.Activator Bundle-Vendor: Eclipse Modeling Project Export-Package: org.eclipse.emfforms.internal.editor;version="1.19.0";x-internal:=true, - org.eclipse.emfforms.internal.editor.handlers;version="1.19.0";;x-internal:=true;x-friends:="org.eclipse.emfforms.editor.ecore", - org.eclipse.emfforms.internal.editor.toolbaractions;version="1.19.0";;x-internal:=true;x-internal:=true, - org.eclipse.emfforms.internal.editor.ui;version="1.19.0";x-friends:="org.eclipse.emfforms.editor.ecore", - org.eclipse.emfforms.spi.editor;version="1.19.0", - org.eclipse.emfforms.spi.editor.handler;version="1.19.0", - org.eclipse.emfforms.spi.editor.helpers;version="1.19.0";;x-friends:="org.eclipse.emfforms.editor.ecore,org.eclipse.emfforms.editor.genmodel" + org.eclipse.emfforms.internal.editor.handlers;version="1.19.0";;x-internal:=true;x-friends:="org.eclipse.emfforms.editor.ecore", + org.eclipse.emfforms.internal.editor.toolbaractions;version="1.19.0";;x-internal:=true;x-internal:=true, + org.eclipse.emfforms.internal.editor.ui;version="1.19.0";x-friends:="org.eclipse.emfforms.editor.ecore", + org.eclipse.emfforms.spi.editor;version="1.19.0", + org.eclipse.emfforms.spi.editor.handler;version="1.19.0", + org.eclipse.emfforms.spi.editor.helpers;version="1.19.0";;x-friends:="org.eclipse.emfforms.editor.ecore,org.eclipse.emfforms.editor.genmodel", + org.eclipse.emfforms.spi.editor.messages;version="1.19.0" Require-Bundle: org.eclipse.core.runtime;bundle-version="[3.1.0,4.0.0)", org.eclipse.emf.ecp.ui.view.swt;bundle-version="[1.19.0,1.20.0)", org.eclipse.emf.edit.ui;bundle-version="[2.10.0,3.0.0)", diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/handlers/ShortcutHandler.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/handlers/ShortcutHandler.java index 2bec51837b..7db5d182b2 100644 --- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/handlers/ShortcutHandler.java +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/handlers/ShortcutHandler.java @@ -23,6 +23,7 @@ import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emfforms.common.Optional; import org.eclipse.emfforms.internal.editor.ui.CreateNewChildDialog; import org.eclipse.emfforms.spi.editor.handler.DeleteShortCutHandler; +import org.eclipse.emfforms.spi.editor.messages.Messages; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.viewers.ISelectionProvider; import org.eclipse.jface.viewers.StructuredSelection; @@ -72,13 +73,13 @@ public class ShortcutHandler extends AbstractHandler { performDelete(sSelection, editingDomain); } else if (getNewChildCmdName().equals(commandName)) { createNewElementDialog(editingDomain, editor.getEditorSite().getSelectionProvider(), currentSelection, - "Create Child").open(); + Messages.ShortcutHandler_NewElementDialogTitle).open(); } else if (getNewSiblingCmdName().equals(commandName)) { // Get Parent of current Selection and show the dialog for it final EObject parent = currentSelection.eContainer(); final EditingDomain parentEditingDomain = AdapterFactoryEditingDomain.getEditingDomainFor(parent); createNewElementDialog(parentEditingDomain, editor.getEditorSite().getSelectionProvider(), parent, - "Create Sibling").open(); + Messages.ShortcutHandler_NewElementDialogDescription).open(); } return null; @@ -111,21 +112,21 @@ public class ShortcutHandler extends AbstractHandler { * @return the cmd name for new siblings */ protected String getNewSiblingCmdName() { - return "org.eclipse.emfforms.editor.new.sibling"; + return "org.eclipse.emfforms.editor.new.sibling"; //$NON-NLS-1$ } /** * @return the cmd name for new children */ protected String getNewChildCmdName() { - return "org.eclipse.emfforms.editor.new"; + return "org.eclipse.emfforms.editor.new"; //$NON-NLS-1$ } /** * @return the cmd name for deletions */ protected String getDeleteCmdName() { - return "org.eclipse.emfforms.editor.delete"; + return "org.eclipse.emfforms.editor.delete"; //$NON-NLS-1$ } /** diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/toolbaractions/LoadEcoreAction.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/toolbaractions/LoadEcoreAction.java index ef1544d9bc..7fa5817fc6 100644 --- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/toolbaractions/LoadEcoreAction.java +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/toolbaractions/LoadEcoreAction.java @@ -38,6 +38,7 @@ import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain; import org.eclipse.emf.edit.domain.EditingDomain; import org.eclipse.emf.edit.ui.action.LoadResourceAction.LoadResourceDialog; import org.eclipse.emf.edit.ui.provider.ExtendedImageRegistry; +import org.eclipse.emfforms.spi.editor.messages.Messages; import org.eclipse.jface.action.Action; import org.eclipse.jface.resource.ImageDescriptor; import org.eclipse.jface.viewers.LabelProvider; @@ -72,7 +73,7 @@ public class LoadEcoreAction extends Action { * @param currentObject the currently loaded object in the Editor (should be ResourceSet) */ public LoadEcoreAction(Object currentObject) { - this(currentObject, "Load Ecore"); + this(currentObject, Messages.LoadEcoreAction_ActionName); } /** @@ -84,7 +85,7 @@ public class LoadEcoreAction extends Action { public LoadEcoreAction(Object currentObject, String actionName) { super(actionName); setImageDescriptor(ImageDescriptor.createFromURL(FrameworkUtil.getBundle(this.getClass()) - .getResource("icons/chart_organisation_add.png"))); + .getResource("icons/chart_organisation_add.png"))); //$NON-NLS-1$ this.currentObject = currentObject; } @@ -143,19 +144,19 @@ public class LoadEcoreAction extends Action { for (final EPackage ePackage : getAllPackages(resource)) { if (nsURIs.contains(ePackage.getNsURI())) { uris.append(resource.getURI()); - uris.append(" "); + uris.append(" "); //$NON-NLS-1$ break; } } } - uriField.setText((uriField.getText() + " " + uris.toString()).trim()); + uriField.setText((uriField.getText() + " " + uris.toString()).trim()); //$NON-NLS-1$ } else { final StringBuffer uris = new StringBuffer(); for (int i = 0, length = result.length; i < length; i++) { uris.append(result[i]); - uris.append(" "); + uris.append(" "); //$NON-NLS-1$ } - uriField.setText((uriField.getText() + " " + uris.toString()).trim()); + uriField.setText((uriField.getText() + " " + uris.toString()).trim()); //$NON-NLS-1$ } } } @@ -199,12 +200,12 @@ public class LoadEcoreAction extends Action { for (final EPackage ePackage : getAllPackages(resource)) { if (nsURIs.contains(ePackage.getNsURI())) { uris.append(resource.getURI()); - uris.append(" "); + uris.append(" "); //$NON-NLS-1$ break; } } } - uriField.setText((uriField.getText() + " " + uris.toString()).trim()); + uriField.setText((uriField.getText() + " " + uris.toString()).trim()); //$NON-NLS-1$ } } } @@ -255,7 +256,7 @@ public class LoadEcoreAction extends Action { final Composite buttonComposite = (Composite) composite.getChildren()[0]; final Button browseRegisteredPackagesButton = new Button(buttonComposite, SWT.PUSH); - browseRegisteredPackagesButton.setText("Browser Registered Packages"); + browseRegisteredPackagesButton.setText(Messages.LoadEcoreAction_BrowseRegPackagesButton); prepareBrowseRegisteredPackagesButton(browseRegisteredPackagesButton); { final FormData data = new FormData(); @@ -265,7 +266,7 @@ public class LoadEcoreAction extends Action { } final Button browseTargetPlatformPackagesButton = new Button(buttonComposite, SWT.PUSH); - browseTargetPlatformPackagesButton.setText("Browse Target Platform Packages"); + browseTargetPlatformPackagesButton.setText(Messages.LoadEcoreAction_BrowseTargetPackagesButton); prepareBrowseTargetPlatformPackagesButton(browseTargetPlatformPackagesButton); { final FormData data = new FormData(); @@ -298,14 +299,14 @@ public class LoadEcoreAction extends Action { @Override public Image getImage(Object element) { return ExtendedImageRegistry.getInstance().getImage( - EcoreEditPlugin.INSTANCE.getImage("full/obj16/EPackage")); + EcoreEditPlugin.INSTANCE.getImage("full/obj16/EPackage")); //$NON-NLS-1$ } }); setMultipleSelection(true); - setMessage("Select Registered Package URI"); - setFilter("*"); - setTitle("PackageSelection"); + setMessage(Messages.LoadEcoreAction_TargetPlatformDialogDescription); + setFilter("*"); //$NON-NLS-1$ + setTitle(Messages.LoadEcoreAction_TargetPlatformDialogTitle); } protected void updateElements() { @@ -340,14 +341,14 @@ public class LoadEcoreAction extends Action { @Override public Image getImage(Object element) { return ExtendedImageRegistry.getInstance().getImage( - EcoreEditPlugin.INSTANCE.getImage("full/obj16/EPackage")); + EcoreEditPlugin.INSTANCE.getImage("full/obj16/EPackage")); //$NON-NLS-1$ } }); setMultipleSelection(true); - setMessage("Select Registered Package URI"); - setFilter("*"); - setTitle("Package Selection"); + setMessage(Messages.LoadEcoreAction_RegisteredPackageDialogDescription); + setFilter("*"); //$NON-NLS-1$ + setTitle(Messages.LoadEcoreAction_RegisteredPackageDialogTitle); } public boolean isDevelopmentTimeVersion() { @@ -385,9 +386,9 @@ public class LoadEcoreAction extends Action { updateElements(); } }); - developmentTimeVersionButton.setText("Development Time Version"); + developmentTimeVersionButton.setText(Messages.LoadEcoreAction_DevelopmentTimeVersionButton); final Button runtimeTimeVersionButton = new Button(buttonGroup, SWT.RADIO); - runtimeTimeVersionButton.setText("Runtime Version"); + runtimeTimeVersionButton.setText(Messages.LoadEcoreAction_RuntimeTimeVersionButton); developmentTimeVersionButton.setSelection(true); updateElements(); diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/CreateDialog.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/CreateDialog.java index c15b67fd98..8e0234c1b0 100644 --- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/CreateDialog.java +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/CreateDialog.java @@ -23,6 +23,7 @@ import org.eclipse.emf.ecp.view.spi.model.VViewFactory; import org.eclipse.emf.ecp.view.spi.model.VViewModelProperties; import org.eclipse.emf.ecp.view.spi.validation.ValidationService; import org.eclipse.emf.ecp.view.spi.validation.ViewValidationListener; +import org.eclipse.emfforms.spi.editor.messages.Messages; import org.eclipse.emfforms.swt.core.EMFFormsSWTConstants; import org.eclipse.jface.dialogs.Dialog; import org.eclipse.jface.dialogs.IDialogConstants; @@ -62,23 +63,15 @@ public class CreateDialog extends Dialog { setShellStyle(getShellStyle() | SWT.RESIZE); } - /* - * (non-Javadoc) - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) - */ @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); - newShell.setText("Create new " + newObject.eClass().getName()); + newShell.setText(Messages.CreateDialog_CreateDialogTitle + newObject.eClass().getName()); newShell.setMinimumSize(300, 150); newShell.setBackground(new Color(newShell.getDisplay(), 255, 255, 255)); newShell.setBackgroundMode(SWT.INHERIT_FORCE); } - /* - * (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ @Override protected Control createDialogArea(Composite parent) { @@ -120,10 +113,6 @@ public class CreateDialog extends Dialog { return parent; } - /* - * (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#okPressed() - */ @Override protected void okPressed() { getParentShell().forceFocus(); @@ -137,21 +126,22 @@ public class CreateDialog extends Dialog { final StringBuilder sb = new StringBuilder(); sb.append(errorCount); - sb.append(" "); - sb.append(errorCount == 1 ? "error" : "errors"); - sb.append(" occured while analyzing your inputs. The following errors were found:\r\n"); + sb.append(" "); //$NON-NLS-1$ + sb.append(errorCount == 1 ? Messages.CreateDialog_ErrorSingular : Messages.CreateDialog_ErrorPlural); + sb.append(Messages.CreateDialog_ErrorOccuredMessage); int messageCount = 1; for (final Diagnostic d : result.getChildren()) { - sb.append("\r\n"); + sb.append("\r\n"); //$NON-NLS-1$ sb.append(messageCount++); - sb.append(". "); + sb.append(". "); //$NON-NLS-1$ sb.append(d.getMessage()); } final String errorMessage = sb.toString(); - MessageDialog.open(MessageDialog.ERROR, getParentShell(), "Error", errorMessage, SWT.NONE); + MessageDialog.open(MessageDialog.ERROR, getParentShell(), Messages.CreateDialog_ErrorDialogTitle, + errorMessage, SWT.NONE); } } diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/CreateNewChildDialog.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/CreateNewChildDialog.java index 9bda1956e9..71a257507c 100644 --- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/CreateNewChildDialog.java +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/CreateNewChildDialog.java @@ -81,50 +81,29 @@ public class CreateNewChildDialog extends Dialog { return selectionProvider; } - /* - * (non-Javadoc) - * @see org.eclipse.jface.window.Window#setShellStyle(int) - */ @Override protected void setShellStyle(int newShellStyle) { super.setShellStyle(SWT.TITLE); } - /* - * (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createButton(org.eclipse.swt.widgets.Composite, int, java.lang.String, - * boolean) - */ @Override protected Button createButton(Composite parent, int id, String label, boolean defaultButton) { return null; } - /* - * (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createButtonsForButtonBar(org.eclipse.swt.widgets.Composite) - */ @Override protected void createButtonsForButtonBar(Composite parent) { final GridLayout layout = (GridLayout) parent.getLayout(); layout.marginHeight = 0; } - /* - * (non-Javadoc) - * @see org.eclipse.jface.window.Window#configureShell(org.eclipse.swt.widgets.Shell) - */ @Override protected void configureShell(Shell newShell) { super.configureShell(newShell); newShell.setText(title); } - /* - * (non-Javadoc) - * @see org.eclipse.jface.dialogs.Dialog#createDialogArea(org.eclipse.swt.widgets.Composite) - */ @Override protected Control createDialogArea(Composite parentComposite) { final ChildrenDescriptorCollector childrenDescriptorCollector = new ChildrenDescriptorCollector(); @@ -145,10 +124,10 @@ public class CreateNewChildDialog extends Dialog { final StringBuilder builder = new StringBuilder(action .getText()); if (action.getAccelerator() > 0) { - builder.append(" ["); + builder.append(" ["); //$NON-NLS-1$ builder.append(Character.toUpperCase((char) action .getAccelerator())); - builder.append("]"); + builder.append("]"); //$NON-NLS-1$ } return builder.toString(); } diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/EditorToolBar.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/EditorToolBar.java index b86f39f4eb..10e12f8c94 100644 --- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/EditorToolBar.java +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/internal/editor/ui/EditorToolBar.java @@ -61,7 +61,7 @@ public class EditorToolBar extends Composite { // Create the Icon on the Left final Label titleImage = new Label(this, SWT.NONE); final ImageDescriptor imageDescriptor = ImageDescriptor.createFromURL(Activator.getDefault().getBundle() - .getResource("icons/view.png")); + .getResource("icons/view.png")); //$NON-NLS-1$ titleImage.setImage(new Image(parent.getDisplay(), imageDescriptor.getImageData(100))); final FormData titleImageData = new FormData(); @@ -103,11 +103,6 @@ public class EditorToolBar extends Composite { this.layout(); } - /** - * {@inheritDoc} - * - * @see org.eclipse.swt.widgets.Widget#dispose() - */ @Override public void dispose() { background.dispose(); diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/EMFUndoRedoActionBarContributor.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/EMFUndoRedoActionBarContributor.java index 126cb84897..7ad8791500 100644 --- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/EMFUndoRedoActionBarContributor.java +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/EMFUndoRedoActionBarContributor.java @@ -301,9 +301,9 @@ public class EMFUndoRedoActionBarContributor // Add our standard marker. // if ((style & ADDITIONS_LAST_STYLE) == 0) { - menuManager.add(new Separator("additions")); + menuManager.add(new Separator("additions")); //$NON-NLS-1$ } - menuManager.add(new Separator("edit")); + menuManager.add(new Separator("edit")); //$NON-NLS-1$ // Add the edit menu actions. // @@ -312,12 +312,12 @@ public class EMFUndoRedoActionBarContributor menuManager.add(new Separator()); if ((style & ADDITIONS_LAST_STYLE) != 0) { - menuManager.add(new Separator("additions")); + menuManager.add(new Separator("additions")); //$NON-NLS-1$ menuManager.add(new Separator()); } // Add our other standard marker. // - menuManager.add(new Separator("additions-end")); + menuManager.add(new Separator("additions-end")); //$NON-NLS-1$ addGlobalActions(menuManager); } @@ -326,7 +326,7 @@ public class EMFUndoRedoActionBarContributor * This inserts global actions before the "additions-end" separator. */ protected void addGlobalActions(IMenuManager menuManager) { - final String key = (style & ADDITIONS_LAST_STYLE) == 0 ? "additions-end" : "additions"; + final String key = (style & ADDITIONS_LAST_STYLE) == 0 ? "additions-end" : "additions"; //$NON-NLS-1$ //$NON-NLS-2$ if (validateAction != null) { menuManager.insertBefore(key, new ActionContributionItem(validateAction)); } diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/GenericEditor.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/GenericEditor.java index a43954ba9f..0c1691913e 100644 --- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/GenericEditor.java +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/GenericEditor.java @@ -19,8 +19,10 @@ import java.util.ArrayList; import java.util.Collection; import java.util.Collections; import java.util.EventObject; +import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.Map; import java.util.concurrent.CopyOnWriteArrayList; import org.eclipse.core.resources.IFile; @@ -51,6 +53,7 @@ import org.eclipse.emf.common.util.URI; import org.eclipse.emf.ecore.EObject; import org.eclipse.emf.ecore.resource.Resource; import org.eclipse.emf.ecore.resource.ResourceSet; +import org.eclipse.emf.ecore.xmi.XMLResource; import org.eclipse.emf.ecp.common.spi.ChildrenDescriptorCollector; import org.eclipse.emf.ecp.view.spi.model.reporting.StatusReport; import org.eclipse.emf.edit.domain.EditingDomain; @@ -63,6 +66,7 @@ import org.eclipse.emfforms.internal.editor.toolbaractions.LoadEcoreAction; import org.eclipse.emfforms.internal.editor.ui.EditorToolBar; import org.eclipse.emfforms.internal.swt.treemasterdetail.defaultprovider.DefaultDeleteActionBuilder; import org.eclipse.emfforms.spi.editor.helpers.ResourceSetHelpers; +import org.eclipse.emfforms.spi.editor.messages.Messages; import org.eclipse.emfforms.spi.swt.treemasterdetail.MenuProvider; import org.eclipse.emfforms.spi.swt.treemasterdetail.TreeMasterDetailComposite; import org.eclipse.emfforms.spi.swt.treemasterdetail.TreeMasterDetailMenuListener; @@ -105,11 +109,11 @@ import org.eclipse.ui.part.EditorPart; */ public class GenericEditor extends EditorPart implements IEditingDomainProvider, IGotoMarker { - private static final String FRAGMENT_URI = "FRAGMENT_URI"; + private static final String FRAGMENT_URI = "FRAGMENT_URI"; //$NON-NLS-1$ - private static final String RESOURCE_URI = "RESOURCE_URI"; + private static final String RESOURCE_URI = "RESOURCE_URI"; //$NON-NLS-1$ - private static final String ITOOLBAR_ACTIONS_ID = "org.eclipse.emfforms.editor.toolbarActions"; + private static final String ITOOLBAR_ACTIONS_ID = "org.eclipse.emfforms.editor.toolbarActions"; //$NON-NLS-1$ /** The Resource loaded from the provided EditorInput. */ private ResourceSet resourceSet; @@ -153,7 +157,7 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, public void doSave(IProgressMonitor monitor) { // Remove the Listener, so that we won't get a changed notification for our own save operation preSave(); - if (ResourceSetHelpers.save(resourceSet, null)) { + if (ResourceSetHelpers.save(resourceSet, getResourceSaveOptions())) { // Tell the CommandStack, that we have saved the file successfully // and inform the Workspace, that the Dirty property has changed. getCommandStack().saveIsDone(); @@ -227,8 +231,9 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, } private boolean discardChanges() { - return MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), "File Changed", - "The currently opened files were changed. Do you want to discard the changes and reload the file?"); + return MessageDialog.openQuestion(Display.getCurrent().getActiveShell(), + Messages.GenericEditor_DiscardChangesTitle, + Messages.GenericEditor_DiscardChangesDescription); } @Override @@ -279,7 +284,7 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, * @return the context id */ protected String getContextId() { - return "org.eclipse.emfforms.editor.context"; + return "org.eclipse.emfforms.editor.context"; //$NON-NLS-1$ } @Override @@ -320,7 +325,7 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, /* we already enqueued an update job which is not running yet */ return; } - final Job job = Job.create("Add GenericEditor validation markers.", new IJobFunction() { + final Job job = Job.create(Messages.GenericEditor_ValidationMarkersJobName, new IJobFunction() { @Override public IStatus run(IProgressMonitor monitor) { @@ -328,7 +333,7 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, adjustMarkers(monitor); return Status.OK_STATUS; } catch (final CoreException ex) { - return new Status(IStatus.ERROR, "org.eclipse.emfforms.editor", ex.getMessage(), ex); + return new Status(IStatus.ERROR, "org.eclipse.emfforms.editor", ex.getMessage(), ex); //$NON-NLS-1$ } finally { markerJobs.remove(0); } @@ -372,7 +377,7 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, if (!file.isPresent()) { return; } - file.get().deleteMarkers("org.eclipse.core.resources.problemmarker", false, + file.get().deleteMarkers("org.eclipse.core.resources.problemmarker", false, //$NON-NLS-1$ IResource.DEPTH_ZERO); } @@ -494,9 +499,12 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, protected ResourceSet loadResource(IEditorInput editorInput) throws PartInitException { final URI resourceURI = EditUIUtil.getURI(editorInput, null); - final ResourceSet resourceSet = ResourceSetHelpers.createResourceSet(getCommandStack()); + ResourceSet resourceSet = ResourceSetHelpers.createResourceSet(getCommandStack()); try { - return ResourceSetHelpers.loadResourceWithProxies(resourceURI, resourceSet, Collections.emptyMap()); + resourceSet = ResourceSetHelpers.loadResourceWithProxies(resourceURI, resourceSet, + getResourceLoadOptions()); + verifyEditorResource(resourceURI, resourceSet); + return resourceSet; // CHECKSTYLE.OFF: IllegalCatch } catch (final Exception e) { throw new PartInitException(e.getLocalizedMessage(), e); @@ -504,6 +512,50 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, // CHECKSTYLE.ON: IllegalCatch } + /** + * Check that the resource was loaded correctly and show any warnings to the user. + * + * @param resourceSet the resource set + * @param resourceURI the URI of the resource + * @since 1.19 + * + */ + protected void verifyEditorResource(URI resourceURI, ResourceSet resourceSet) { + final Resource resource = resourceSet.getResource(resourceURI, true); + if (XMLResource.class.isInstance(resource) + && !XMLResource.class.cast(resource).getEObjectToExtensionMap().isEmpty()) { + // we are showing a view which wasn't fully loaded + MessageDialog + .openWarning( + getSite().getShell(), + Messages.GenericEditor_UnknownFeaturesDialogTitle, + Messages.GenericEditor_UnknownFeaturesDialogDescription); + } + } + + /** + * The options to be used when loading the editor's resource. + * + * @return the load options + * @since 1.19 + */ + protected Map<Object, Object> getResourceLoadOptions() { + final HashMap<Object, Object> options = new HashMap<Object, Object>(); + options.put(XMLResource.OPTION_RECORD_UNKNOWN_FEATURE, + Boolean.TRUE); + return options; + } + + /** + * The options to be used when saving the editor's resource. + * + * @return the save options + * @since 1.19 + */ + protected Map<Object, Object> getResourceSaveOptions() { + return Collections.emptyMap(); + } + @Override public void setFocus() { // NOOP @@ -525,7 +577,7 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, * @return the title */ protected String getEditorTitle() { - return "Model Editor"; + return Messages.GenericEditor_EditorTitle; } /** @@ -582,7 +634,7 @@ public class GenericEditor extends EditorPart implements IEditingDomainProvider, final IConfigurationElement[] config = registry.getConfigurationElementsFor(ITOOLBAR_ACTIONS_ID); for (final IConfigurationElement e : config) { try { - final Object o = e.createExecutableExtension("toolbarAction"); + final Object o = e.createExecutableExtension("toolbarAction"); //$NON-NLS-1$ if (o instanceof IToolbarAction) { final IToolbarAction action = (IToolbarAction) o; if (!action.canExecute(resourceSet)) { diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/InitializeChildCallback.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/InitializeChildCallback.java index b329331e29..2ee761609b 100644 --- a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/InitializeChildCallback.java +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/InitializeChildCallback.java @@ -43,7 +43,7 @@ public class InitializeChildCallback implements CreateElementCallback { } final VViewModelProperties properties = VViewFactory.eINSTANCE.createViewModelLoadingProperties(); - properties.addInheritableProperty("useOnModifyDatabinding", "true"); + properties.addInheritableProperty("useOnModifyDatabinding", "true"); //$NON-NLS-1$ //$NON-NLS-2$ final VView view = ViewProviderHelper.getView((EObject) newElement, properties); final boolean isViewEmpty = view == null ? true : view.getChildren().isEmpty(); diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/messages/Messages.java b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/messages/Messages.java new file mode 100644 index 0000000000..8869ccd938 --- /dev/null +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/messages/Messages.java @@ -0,0 +1,52 @@ +/******************************************************************************* + * Copyright (c) 2011-2018 EclipseSource Muenchen GmbH and others. + * + * All rights reserved. This program and the accompanying materials + * are made available under the terms of the Eclipse Public License v1.0 + * which accompanies this distribution, and is available at + * http://www.eclipse.org/legal/epl-v10.html + * + * Contributors: + * Alexandra Buzila - initial API and implementation + ******************************************************************************/ +package org.eclipse.emfforms.spi.editor.messages; + +import org.eclipse.osgi.util.NLS; + +/** + * @since 1.19 + * @generated + * + */ +public final class Messages extends NLS { + private static final String BUNDLE_NAME = "org.eclipse.emfforms.spi.editor.messages.messages"; //$NON-NLS-1$ + public static String CreateDialog_CreateDialogTitle; + public static String CreateDialog_ErrorDialogTitle; + public static String CreateDialog_ErrorOccuredMessage; + public static String CreateDialog_ErrorPlural; + public static String CreateDialog_ErrorSingular; + public static String GenericEditor_DiscardChangesDescription; + public static String GenericEditor_DiscardChangesTitle; + public static String GenericEditor_EditorTitle; + public static String GenericEditor_UnknownFeaturesDialogDescription; + public static String GenericEditor_UnknownFeaturesDialogTitle; + public static String GenericEditor_ValidationMarkersJobName; + public static String LoadEcoreAction_ActionName; + public static String LoadEcoreAction_BrowseRegPackagesButton; + public static String LoadEcoreAction_BrowseTargetPackagesButton; + public static String LoadEcoreAction_DevelopmentTimeVersionButton; + public static String LoadEcoreAction_RegisteredPackageDialogDescription; + public static String LoadEcoreAction_RegisteredPackageDialogTitle; + public static String LoadEcoreAction_RuntimeTimeVersionButton; + public static String LoadEcoreAction_TargetPlatformDialogDescription; + public static String LoadEcoreAction_TargetPlatformDialogTitle; + public static String ShortcutHandler_NewElementDialogDescription; + public static String ShortcutHandler_NewElementDialogTitle; + static { + // initialize resource bundle + NLS.initializeMessages(BUNDLE_NAME, Messages.class); + } + + private Messages() { + } +} diff --git a/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/messages/messages.properties b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/messages/messages.properties new file mode 100644 index 0000000000..8042d24bef --- /dev/null +++ b/bundles/org.eclipse.emfforms.editor/src/org/eclipse/emfforms/spi/editor/messages/messages.properties @@ -0,0 +1,22 @@ +CreateDialog_CreateDialogTitle=Create new +CreateDialog_ErrorDialogTitle=Error +CreateDialog_ErrorOccuredMessage=\ occured while analyzing your inputs. The following errors were found:\r\n +CreateDialog_ErrorPlural=errors +CreateDialog_ErrorSingular=error +GenericEditor_DiscardChangesDescription=The currently opened files were changed. Do you want to discard the changes and reload the file? +GenericEditor_DiscardChangesTitle=File Changed +GenericEditor_EditorTitle=Model Editor +GenericEditor_UnknownFeaturesDialogDescription=The model loading was incomplete. A migration to the latest model version might be required.\nPlease visit our migration guide for more information. +GenericEditor_UnknownFeaturesDialogTitle=Problems while loading the model +GenericEditor_ValidationMarkersJobName=Add GenericEditor validation markers. +LoadEcoreAction_ActionName=Load Ecore +LoadEcoreAction_BrowseRegPackagesButton=Browser Registered Packages +LoadEcoreAction_BrowseTargetPackagesButton=Browse Target Platform Packages +LoadEcoreAction_DevelopmentTimeVersionButton=Development Time Version +LoadEcoreAction_RegisteredPackageDialogDescription=Select Registered Package URI +LoadEcoreAction_RegisteredPackageDialogTitle=Package Selection +LoadEcoreAction_RuntimeTimeVersionButton=Runtime Version +LoadEcoreAction_TargetPlatformDialogDescription=Select Registered Package URI +LoadEcoreAction_TargetPlatformDialogTitle=PackageSelection +ShortcutHandler_NewElementDialogDescription=Create Sibling +ShortcutHandler_NewElementDialogTitle=Create Child |