diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/plugin.xml b/plugins/org.eclipse.fordiac.ide.typemanagement/plugin.xml
index bee26fa929..7d78493c5e 100644
--- a/plugins/org.eclipse.fordiac.ide.typemanagement/plugin.xml
+++ b/plugins/org.eclipse.fordiac.ide.typemanagement/plugin.xml
@@ -712,6 +712,15 @@
+
+
+
+
+
+
+
@@ -768,5 +777,18 @@
+
+
+
+
+
+
+
+
diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/IFordiacModifiablePreviewChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/IFordiacModifiablePreviewChange.java
new file mode 100644
index 0000000000..8c99e06817
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/IFordiacModifiablePreviewChange.java
@@ -0,0 +1,28 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Primetals Technologies Austria GmbH
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Mario Kastner
+ * - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.fordiac.ide.typemanagement.refactoring;
+
+import org.eclipse.fordiac.ide.model.typelibrary.TypeEntry;
+
+public interface IFordiacModifiablePreviewChange {
+
+ boolean isEditable();
+
+ void updateChange(String inputText);
+
+ String getText();
+
+ TypeEntry getType();
+}
diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/UpdateTypeEntryChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/UpdateTypeEntryChange.java
index 3cb26a60c2..b82b4c2b47 100644
--- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/UpdateTypeEntryChange.java
+++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/UpdateTypeEntryChange.java
@@ -37,10 +37,10 @@
public class UpdateTypeEntryChange extends Change {
- IFile file;
- TypeEntry typeEntry;
- String newName;
- String oldName;
+ protected final IFile file;
+ protected final TypeEntry typeEntry;
+ protected final String newName;
+ protected final String oldName;
public UpdateTypeEntryChange(final IFile file, final TypeEntry typeEntry, final String newName,
final String oldName) {
@@ -67,7 +67,7 @@ public RefactoringStatus isValid(final IProgressMonitor pm) throws CoreException
return status;
}
- public static void checkEditor(final RefactoringStatus result, final TypeEntry typeEntry, final String oldName) {
+ public void checkEditor(final RefactoringStatus result, final TypeEntry typeEntry, final String oldName) {
// depending if the in-place renaming is active we may not be in the display
// thread
Display.getDefault().syncExec(() -> {
@@ -84,7 +84,8 @@ public static void checkEditor(final RefactoringStatus result, final TypeEntry t
});
}
- private static boolean shouldSaveFile(final Shell shell, final String oldName) {
+ @SuppressWarnings("static-method")
+ protected boolean shouldSaveFile(final Shell shell, final String oldName) {
final int result = MessageDialog.open(MessageDialog.QUESTION, shell, "Rename of Type with unsaved changes!", //$NON-NLS-1$
MessageFormat.format(
"There are unsaved changes for type \"{0}\". Do you want to save them before renaming?", //$NON-NLS-1$
@@ -98,7 +99,6 @@ public Change perform(final IProgressMonitor pm) throws CoreException {
final IFile newFile = findNewResource(newName);
if (newFile != null) {
FordiacResourceChangeListener.updateTypeEntryByRename(newFile, typeEntry);
-
return new UpdateTypeEntryChange(newFile, typeEntry, oldName, newName);
}
return null;
diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/move/MoveTypeChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/move/MoveTypeChange.java
new file mode 100644
index 0000000000..49ff603875
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/move/MoveTypeChange.java
@@ -0,0 +1,94 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Primetals Technologies Austria GmbH
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Mario Kastner
+ * - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.fordiac.ide.typemanagement.refactoring.move;
+
+import java.util.Objects;
+import java.util.Optional;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.fordiac.ide.model.IdentifierVerifier;
+import org.eclipse.fordiac.ide.model.commands.change.ChangePackageNameCommand;
+import org.eclipse.fordiac.ide.model.helpers.PackageNameHelper;
+import org.eclipse.fordiac.ide.model.libraryElement.LibraryElement;
+import org.eclipse.fordiac.ide.model.typelibrary.TypeEntry;
+import org.eclipse.fordiac.ide.typemanagement.refactoring.AbstractCommandChange;
+import org.eclipse.fordiac.ide.typemanagement.refactoring.IFordiacModifiablePreviewChange;
+import org.eclipse.fordiac.ide.typemanagement.wizards.Messages;
+import org.eclipse.gef.commands.Command;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+
+public class MoveTypeChange extends AbstractCommandChange implements IFordiacModifiablePreviewChange {
+
+ private String newPackageName;
+ private String oldPackageName;
+ private final TypeEntry type;
+
+ protected MoveTypeChange(final String newPackageName, final TypeEntry type, final String name, final URI uri) {
+ super(name, uri, LibraryElement.class);
+ this.newPackageName = newPackageName;
+ this.type = type;
+ }
+
+ @Override
+ public void initializeValidationData(final LibraryElement element, final IProgressMonitor pm) {
+ oldPackageName = PackageNameHelper.getPackageName(element);
+ }
+
+ @Override
+ public RefactoringStatus isValid(final LibraryElement element, final IProgressMonitor pm)
+ throws CoreException, OperationCanceledException {
+ final RefactoringStatus status = new RefactoringStatus();
+ if (!Objects.equals(PackageNameHelper.getPackageName(element), oldPackageName)) {
+ status.addFatalError(Messages.MoveTypeToPackage_NameChanged);
+ }
+ if (oldPackageName.equals(newPackageName)) {
+ status.addWarning(Messages.MoveTypeToPackage_PackageNameIsTheSame);
+ }
+ final Optional errorMessage = IdentifierVerifier.verifyPackageName(newPackageName);
+ if (errorMessage.isPresent()) {
+ status.addFatalError(errorMessage.get());
+ }
+ return status;
+ }
+
+ @Override
+ protected Command createCommand(final LibraryElement element) {
+ return new ChangePackageNameCommand(element, newPackageName);
+ }
+
+ @Override
+ public void updateChange(final String textInput) {
+ this.newPackageName = textInput;
+ }
+
+ @Override
+ public String getText() {
+ return this.newPackageName;
+ }
+
+ @Override
+ public TypeEntry getType() {
+ return this.type;
+ }
+
+ @Override
+ public boolean isEditable() {
+ return false;
+ }
+
+}
diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/move/MoveTypeRefactoringParticipant.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/move/MoveTypeRefactoringParticipant.java
new file mode 100644
index 0000000000..bb13f597fc
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/move/MoveTypeRefactoringParticipant.java
@@ -0,0 +1,127 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Primetals Technologies Austria GmbH
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Mario Kastner
+ * - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.fordiac.ide.typemanagement.refactoring.move;
+
+import java.text.MessageFormat;
+import java.util.List;
+import java.util.Optional;
+
+import org.eclipse.core.resources.IContainer;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.OperationCanceledException;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.emf.common.util.URI;
+import org.eclipse.emf.ecore.EObject;
+import org.eclipse.fordiac.ide.model.IdentifierVerifier;
+import org.eclipse.fordiac.ide.model.helpers.PackageNameHelper;
+import org.eclipse.fordiac.ide.model.libraryElement.FBNetworkElement;
+import org.eclipse.fordiac.ide.model.search.types.BlockTypeInstanceSearch;
+import org.eclipse.fordiac.ide.model.search.types.DataTypeInstanceSearch;
+import org.eclipse.fordiac.ide.model.typelibrary.DataTypeEntry;
+import org.eclipse.fordiac.ide.model.typelibrary.TypeEntry;
+import org.eclipse.fordiac.ide.model.typelibrary.TypeLibraryManager;
+import org.eclipse.fordiac.ide.typemanagement.refactoring.UpdateFBInstanceChange;
+import org.eclipse.fordiac.ide.typemanagement.wizards.Messages;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.ltk.core.refactoring.CompositeChange;
+import org.eclipse.ltk.core.refactoring.RefactoringStatus;
+import org.eclipse.ltk.core.refactoring.participants.CheckConditionsContext;
+import org.eclipse.ltk.core.refactoring.participants.MoveParticipant;
+
+public class MoveTypeRefactoringParticipant extends MoveParticipant {
+
+ private String oldPackageName;
+ private String newPackageName;
+ private TypeEntry type;
+ private IFile destinationFile;
+ private IFile currentFile;
+
+ @Override
+ protected boolean initialize(final Object element) {
+ if (element instanceof final IFile file) {
+ this.currentFile = file;
+ this.type = TypeLibraryManager.INSTANCE.getTypeEntryForFile(file);
+ this.oldPackageName = type.getPackageName();
+ if (getArguments().getDestination() instanceof final IContainer destination) {
+ this.destinationFile = destination.getFile(IPath.fromOSString(file.getFullPath().lastSegment()));
+ this.newPackageName = PackageNameHelper.getPackageNameFromFile(destinationFile);
+ return true;
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public String getName() {
+ return MessageFormat.format(Messages.MoveTypeToPackage_RenamePackageTo, newPackageName);
+ }
+
+ @Override
+ public RefactoringStatus checkConditions(final IProgressMonitor pm, final CheckConditionsContext context)
+ throws OperationCanceledException {
+ final RefactoringStatus status = new RefactoringStatus();
+ if (oldPackageName.contentEquals(newPackageName)) {
+ status.addWarning(Messages.MoveTypeToPackage_PackageNameIsTheSame);
+ }
+ if (!(getArguments().getDestination() instanceof IResource)) {
+ status.addError(Messages.MoveTypeToPackage_InvalidDestination);
+ }
+ final Optional errorMessage = IdentifierVerifier.verifyPackageName(newPackageName);
+ if (errorMessage.isPresent()) {
+ status.addFatalError(errorMessage.get());
+ }
+ return status;
+ }
+
+ @Override
+ public Change createPreChange(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
+ return new MoveTypeChange(newPackageName, this.type, getName(), this.type.getURI());
+ }
+
+ @Override
+ public Change createChange(final IProgressMonitor pm) throws CoreException, OperationCanceledException {
+ final CompositeChange parentChange = new CompositeChange(Messages.MoveTypeToPackage);
+ parentChange.add(new UpdateTypeEntryFileChange(currentFile, type, destinationFile));
+ parentChange.add(getInstanceChanges(type));
+ return parentChange;
+ }
+
+ static IFile getFileFromURI(final URI uri) {
+ if (uri.isPlatformResource()) {
+ final Path filePath = new Path(uri.toPlatformString(true));
+ return ResourcesPlugin.getWorkspace().getRoot().getFile(filePath);
+ }
+ return null;
+ }
+
+ private static CompositeChange getInstanceChanges(final TypeEntry typeEntry) {
+ final CompositeChange change = new CompositeChange(Messages.MoveTypeToPackage_UpdateInstances);
+ final List extends EObject> result = (typeEntry instanceof final DataTypeEntry dtEntry)
+ ? new DataTypeInstanceSearch(dtEntry).performSearch()
+ : new BlockTypeInstanceSearch(typeEntry).performSearch();
+
+ for (final EObject eObject : result) {
+ if (eObject instanceof final FBNetworkElement elem) {
+ change.add(new UpdateFBInstanceChange(elem, typeEntry));
+ }
+ }
+ return change;
+ }
+}
diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/move/UpdateTypeEntryFileChange.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/move/UpdateTypeEntryFileChange.java
new file mode 100644
index 0000000000..46fca59d4c
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/refactoring/move/UpdateTypeEntryFileChange.java
@@ -0,0 +1,62 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Primetals Technologies Austria GmbH
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Mario Kastner - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+package org.eclipse.fordiac.ide.typemanagement.refactoring.move;
+
+import java.text.MessageFormat;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.fordiac.ide.model.typelibrary.TypeEntry;
+import org.eclipse.fordiac.ide.systemmanagement.changelistener.FordiacResourceChangeListener;
+import org.eclipse.fordiac.ide.typemanagement.refactoring.UpdateTypeEntryChange;
+import org.eclipse.fordiac.ide.typemanagement.wizards.Messages;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ltk.core.refactoring.Change;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Shell;
+
+public class UpdateTypeEntryFileChange extends UpdateTypeEntryChange {
+
+ private final IFile destinationFile;
+
+ public UpdateTypeEntryFileChange(final IFile currentFile, final TypeEntry typeEntry, final IFile destinationFile) {
+ super(currentFile, typeEntry, typeEntry.getTypeName(), typeEntry.getTypeName());
+ this.destinationFile = destinationFile;
+ }
+
+ @Override
+ public String getName() {
+ return Messages.MoveTypeToPackage_UpdateTypeEntryFile;
+ }
+
+ @Override
+ protected boolean shouldSaveFile(final Shell shell, final String oldName) {
+ final int result = MessageDialog.open(MessageDialog.QUESTION, shell, "Moving of Type with unsaved changes!", //$NON-NLS-1$
+ MessageFormat.format(
+ "There are unsaved changes for type \"{0}\". Do you want to save them before moving it?", //$NON-NLS-1$
+ oldName),
+ SWT.NONE, "Save", "Cancel"); //$NON-NLS-1$//$NON-NLS-2$
+ return result == 0;
+ }
+
+ @Override
+ public Change perform(final IProgressMonitor pm) throws CoreException {
+ if (destinationFile != null) {
+ FordiacResourceChangeListener.updateTypeEntry(destinationFile, typeEntry);
+ // returns undo change
+ return new UpdateTypeEntryFileChange(destinationFile, typeEntry, file);
+ }
+ return null;
+ }
+}
diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/Messages.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/Messages.java
index 8369db1511..036969423a 100644
--- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/Messages.java
+++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/Messages.java
@@ -34,6 +34,17 @@ public class Messages extends NLS {
public static String RepairBrokenConnectionWizardPage_Name;
public static String RepairBrokenConnectionWizardPage_Title;
public static String RepairBrokenConnectionWizardPage_Type;
+
+ public static String MoveToPackageChangePreview_EnterPackageName;
+ public static String MoveTypeToPackage;
+ public static String MoveTypeToPackage_RenamePackageTo;
+ public static String MoveTypeToPackage_PackageNameIsTheSame;
+ public static String MoveTypeToPackage_PackageNameIsEmpty;
+ public static String MoveTypeToPackage_InvalidDestination;
+ public static String MoveTypeToPackage_UpdateInstances;
+ public static String MoveTypeToPackage_NameChanged;
+ public static String MoveTypeToPackage_UpdateTypeEntryFile;
+
static {
// initialize resource bundle
NLS.initializeMessages(BUNDLE_NAME, Messages.class);
diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/MoveToPackageChangeViewer.java b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/MoveToPackageChangeViewer.java
new file mode 100644
index 0000000000..f2279c4762
--- /dev/null
+++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/MoveToPackageChangeViewer.java
@@ -0,0 +1,109 @@
+/*******************************************************************************
+ * Copyright (c) 2024 Primetals Technologies Austria GmbH
+ *
+ * This program and the accompanying materials are made available under the
+ * terms of the Eclipse Public License 2.0 which is available at
+ * http://www.eclipse.org/legal/epl-2.0.
+ *
+ * SPDX-License-Identifier: EPL-2.0
+ *
+ * Contributors:
+ * Mario Kastner
+ * - initial API and implementation and/or initial documentation
+ *******************************************************************************/
+
+package org.eclipse.fordiac.ide.typemanagement.wizards;
+
+import java.util.Optional;
+import java.util.function.Supplier;
+
+import org.eclipse.fordiac.ide.model.IdentifierVerifier;
+import org.eclipse.fordiac.ide.model.typelibrary.TypeLibrary;
+import org.eclipse.fordiac.ide.model.ui.widgets.PackageSelectionProposalProvider;
+import org.eclipse.fordiac.ide.typemanagement.refactoring.IFordiacModifiablePreviewChange;
+import org.eclipse.jface.fieldassist.ContentProposalAdapter;
+import org.eclipse.jface.fieldassist.ControlDecoration;
+import org.eclipse.jface.fieldassist.FieldDecorationRegistry;
+import org.eclipse.jface.fieldassist.TextContentAdapter;
+import org.eclipse.jface.layout.GridDataFactory;
+import org.eclipse.jface.layout.GridLayoutFactory;
+import org.eclipse.ltk.ui.refactoring.ChangePreviewViewerInput;
+import org.eclipse.ltk.ui.refactoring.IChangePreviewViewer;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.custom.CLabel;
+import org.eclipse.swt.graphics.Image;
+import org.eclipse.swt.graphics.Point;
+import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Text;
+import org.eclipse.ui.fieldassist.ContentAssistCommandAdapter;
+
+public class MoveToPackageChangeViewer implements IChangePreviewViewer {
+ private Composite control;
+ private IFordiacModifiablePreviewChange change;
+ private Text nameText;
+
+ @Override
+ public void createControl(final Composite parent) {
+ control = new Composite(parent, SWT.FILL);
+
+ GridLayoutFactory.fillDefaults().numColumns(2).margins(new Point(5, 5)).applyTo(control);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, true).applyTo(control);
+
+ final CLabel label = new CLabel(control, SWT.NONE);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(label);
+ label.setText(Messages.MoveToPackageChangePreview_EnterPackageName + ":"); //$NON-NLS-1$
+
+ this.nameText = new Text(control, SWT.BORDER | SWT.FILL);
+ GridDataFactory.fillDefaults().align(SWT.FILL, SWT.FILL).grab(true, false).applyTo(nameText);
+ nameText.setEnabled(false);
+
+ final ControlDecoration errorDecorator = createErrorDecorator(nameText);
+ nameText.addModifyListener(e -> {
+ if (change != null) {
+ final String text = nameText.getText();
+ final Optional errorMessage = IdentifierVerifier.verifyPackageName(text);
+ if (errorMessage.isPresent()) {
+ errorDecorator.setDescriptionText(errorMessage.get());
+ errorDecorator.show();
+ } else {
+ change.updateChange(nameText.getText());
+ errorDecorator.hide();
+ }
+ }
+ });
+
+ final Supplier typeLibrary = () -> change.getType().getTypeLibrary();
+ final ContentAssistCommandAdapter packageNameProposalAdapter = new ContentAssistCommandAdapter(nameText,
+ new TextContentAdapter(), new PackageSelectionProposalProvider(typeLibrary), null, null, true);
+ packageNameProposalAdapter.setProposalAcceptanceStyle(ContentProposalAdapter.PROPOSAL_REPLACE);
+ }
+
+ @Override
+ public Control getControl() {
+ return control;
+ }
+
+ @Override
+ public void setInput(final ChangePreviewViewerInput input) {
+ if (input.getChange() instanceof final IFordiacModifiablePreviewChange previewChange) {
+ this.change = previewChange;
+ if (nameText != null) {
+ nameText.setText(change.getText());
+ if (change.isEditable()) {
+ nameText.setEnabled(true);
+ }
+ }
+ }
+ }
+
+ private static ControlDecoration createErrorDecorator(final Control control) {
+ final ControlDecoration errorDecorator = new ControlDecoration(control, SWT.TOP | SWT.RIGHT);
+ final Image img = FieldDecorationRegistry.getDefault().getFieldDecoration(FieldDecorationRegistry.DEC_ERROR)
+ .getImage();
+ errorDecorator.setImage(img);
+ errorDecorator.hide();
+ return errorDecorator;
+ }
+
+}
diff --git a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/messages.properties b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/messages.properties
index c461df524a..e970a9501a 100644
--- a/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/messages.properties
+++ b/plugins/org.eclipse.fordiac.ide.typemanagement/src/org/eclipse/fordiac/ide/typemanagement/wizards/messages.properties
@@ -15,3 +15,12 @@ RepairBrokenConnectionWizardPage_Dots=...
RepairBrokenConnectionWizardPage_Name=Name
RepairBrokenConnectionWizardPage_Title=Repair broken Connection
RepairBrokenConnectionWizardPage_Type=Type
+MoveTypeToPackage=Move type to package
+MoveTypeToPackage_RenamePackageTo=Rename package to: {0}
+MoveTypeToPackage_PackageNameIsTheSame=The selected package name is the same as before
+MoveTypeToPackage_PackageNameIsEmpty=Package name is empty
+MoveTypeToPackage_NameChanged=The element package name has changed
+MoveTypeToPackage_InvalidDestination=Invalid destination
+MoveToPackageChangePreview_EnterPackageName=Enter package name
+MoveTypeToPackage_UpdateInstances=Update type instances
+MoveTypeToPackage_UpdateTypeEntryFile=Update type entry file