Commit 2ef47f57 authored by Johannes Eder's avatar Johannes Eder
Browse files

adapted mira external references

refs 1007
parent 3191d59c
......@@ -86,7 +86,7 @@ public class ExportImagesAction extends EObjectActionBase<EObject> {
for(ImageItem imageItem : element.getImages()) {
try {
copyFile(getImageFile(imageItem), new File(imageFolder, imageItem.getPath()));
copyFile(getImageFile(imageItem), new File(imageFolder, imageItem.getUri()));
} catch(IOException e) {
e.printStackTrace();
}
......
......@@ -156,7 +156,7 @@ public class ImageBox {
// clicks on the picture
getDesktop().open(
new File(new File(getDefaultGeneralProjectPath(), "images"), imageItem
.getPath()));
.getUri()));
} catch(IOException e1) {
e1.printStackTrace();
}
......
......@@ -181,7 +181,7 @@ public class ImageSection {
return;
}
newItem.setPath(destFile.getName());
newItem.setUri(destFile.getName());
ICommandStackService.INSTANCE.runAsCommand(editedObject, new Runnable() {
@Override
......@@ -212,7 +212,7 @@ public class ImageSection {
composite.getShell(),
"Image could not be opened",
"The image " +
item.getPath() +
item.getUri() +
" could not be opened. Perhaps it was deleted or the AF3 image folder is not accessible.\n" +
"Do you want to delete the reference to this image?");
}
......
......@@ -133,7 +133,7 @@ public class FilePart {
this.document = document;
this.isLocal = isLocal;
this.dbc = dbc;
this.file = new File(fileItem.getUrl());
this.file = new File(fileItem.getUri());
this.form = form;
this.registeredSourceViewers = registeredSourceViewers;
}
......@@ -164,7 +164,7 @@ public class FilePart {
final Hyperlink link =
toolkit.createHyperlink(fileComposite, fileItem.isIsLocal()
? getDefaultGeneralProjectName() + "/Document/" + fileItem.getName()
: fileItem.getUrl(), SWT.NONE);
: fileItem.getUri(), SWT.NONE);
singleLineInputFactory.applyTo(link);
link.addMouseListener(new MouseAdapter() {
......@@ -180,7 +180,7 @@ public class FilePart {
getDesktop().open(file);
}
} else {
Desktop.getDesktop().browse(java.net.URI.create(fileItem.getUrl()));
Desktop.getDesktop().browse(java.net.URI.create(fileItem.getUri()));
}
} catch(IOException e1) {
if(askIfDelete(fileItem))
......@@ -215,12 +215,12 @@ public class FilePart {
if(isLocal) {
final File newFile = selectLocalFile(fileComposite);
if(newFile != null && !fileItem.getUrl().equals(newFile.getPath())) {
if(newFile != null && !fileItem.getUri().equals(newFile.getPath())) {
ICommandStackService.INSTANCE.runAsCommand(fileItem, new Runnable() {
@Override
public void run() {
fileItem.setName(newFile.getName());
fileItem.setUrl(newFile.getPath());
fileItem.setUri(newFile.getPath());
fileItem.setDescription("");
fileItem.setVersion("");
......@@ -241,7 +241,7 @@ public class FilePart {
@Override
public void run() {
fileItem.setName(newUrl.toString());
fileItem.setUrl(newUrl.toString());
fileItem.setUri(newUrl.toString());
fileItem.setDescription("");
fileItem.setVersion("");
}
......@@ -250,7 +250,7 @@ public class FilePart {
}
}
link.setText(fileItem.isIsLocal() ? getDefaultGeneralProjectName() + "/Document/" +
fileItem.getName() : fileItem.getUrl());
fileItem.getName() : fileItem.getUri());
fileComposite.layout(true);
fileComposite.redraw();
composite.layout();
......@@ -351,7 +351,7 @@ public class FilePart {
return openQuestion(composite.getShell(), "Illegal file",
"The file " +
(item.isIsLocal() ? getDefaultGeneralProjectName() + "/Document/" +
fileItem.getName() : item.getUrl()) + " could not be found.\n" +
fileItem.getName() : item.getUri()) + " could not be found.\n" +
"Do you want to delete the reference to this file?");
}
......
......@@ -146,6 +146,6 @@ public class ImageUtils {
*/
public static File getImageFile(ImageItem item) {
File f1 = new File(getDefaultGeneralProjectPath(), "images");
return new File(f1, item.getPath());
return new File(f1, item.getUri());
}
}
......@@ -114,9 +114,7 @@
</eAnnotations>
</eOperations>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ImageItem" eSuperTypes="platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="path" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ImageItem" eSuperTypes="platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//IExternalDocumentReference"/>
<eClassifiers xsi:type="ecore:EClass" name="IImageContainer">
<eStructuralFeatures xsi:type="ecore:EReference" name="images" upperBound="-1"
eType="#//ImageItem" containment="true"/>
......@@ -490,8 +488,7 @@
<eStructuralFeatures xsi:type="ecore:EAttribute" name="mobileNr" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
</eClassifiers>
<eClassifiers xsi:type="ecore:EClass" name="ExternalSystem" eSuperTypes="#//requirementSource/RequirementSourceElement"/>
<eClassifiers xsi:type="ecore:EClass" name="FileItem" eSuperTypes="platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="url" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eClassifiers xsi:type="ecore:EClass" name="FileItem" eSuperTypes="platform:/plugin/org.fortiss.tooling.base/model/base.ecore#//element/IHierarchicElement platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//INamedElement platform:/plugin/org.fortiss.tooling.kernel/model/kernel.ecore#//IExternalDocumentReference">
<eStructuralFeatures xsi:type="ecore:EAttribute" name="version" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="isLocal" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EBoolean"/>
<eStructuralFeatures xsi:type="ecore:EAttribute" name="description" eType="ecore:EDataType http://www.eclipse.org/emf/2002/Ecore#//EString"/>
......
......@@ -58,9 +58,7 @@
<genClasses ecoreClass="mira.ecore#//RequirementSpecification">
<genOperations ecoreOperation="mira.ecore#//RequirementSpecification/getRequirement"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//ImageItem">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//ImageItem/path"/>
</genClasses>
<genClasses ecoreClass="mira.ecore#//ImageItem"/>
<genClasses ecoreClass="mira.ecore#//IImageContainer">
<genFeatures property="None" children="true" createChild="true" ecoreFeature="ecore:EReference mira.ecore#//IImageContainer/images"/>
</genClasses>
......@@ -240,7 +238,6 @@
</genClasses>
<genClasses ecoreClass="mira.ecore#//requirementSource/ExternalSystem"/>
<genClasses ecoreClass="mira.ecore#//requirementSource/FileItem">
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//requirementSource/FileItem/url"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//requirementSource/FileItem/version"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//requirementSource/FileItem/isLocal"/>
<genFeatures createChild="false" ecoreFeature="ecore:EAttribute mira.ecore#//requirementSource/FileItem/description"/>
......
......@@ -593,7 +593,7 @@ public class ContextFactory {
public static EvaluationContext getContextFor(ImageItem imageItem) {
EvaluationContext ctx = new EvaluationContext();
ctx.set("description", imageItem.getName());
ctx.set("path", imageItem.getPath());
ctx.set("path", imageItem.getUri());
return ctx;
}
......@@ -692,7 +692,7 @@ public class ContextFactory {
EvaluationContext ctx = new EvaluationContext();
ctx.set("type", fileItem.isIsLocal() ? "Local file" : "File link");
ctx.set("is_Local", fileItem.isIsLocal());
ctx.set("fileUrl", fileItem.getUrl());
ctx.set("fileUrl", fileItem.getUri());
ctx.set("fileName", fileItem.getName());
ctx.set("fileDescription", fileItem.getDescription());
ctx.set("fileVersion", fileItem.getVersion());
......
......@@ -462,7 +462,7 @@ public final class MiraModelElementFactory {
/** Creates a {@link FileItem} */
public static FileItem createFileItem(String url, String name, boolean isLocal) {
FileItem file = RequirementSourceFactory.eINSTANCE.createFileItem();
file.setUrl(url);
file.setUri(url);
file.setName(name);
file.setIsLocal(isLocal);
file.setDescription("");
......
Supports Markdown
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