Skip to content
GitLab
Explore
Projects
Groups
Snippets
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
NeqModPlus
Building Physics
Building Physics Catalog Editor
Commits
740ea39f
Commit
740ea39f
authored
4 years ago
by
Kai-Holger Brassel
Browse files
Options
Download
Email Patches
Plain Diff
Create new catalogs with UTF-8 encoding.
parent
b01e4355
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
de.hftstuttgart.buildingphysics.application/src/de/hftstuttgart/buildingphysics/application/handlers/NewHandler.java
+12
-5
...gart/buildingphysics/application/handlers/NewHandler.java
with
12 additions
and
5 deletions
+12
-5
de.hftstuttgart.buildingphysics.application/src/de/hftstuttgart/buildingphysics/application/handlers/NewHandler.java
+
12
-
5
View file @
740ea39f
...
@@ -12,6 +12,7 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
...
@@ -12,6 +12,7 @@ import org.eclipse.e4.ui.workbench.modeling.EPartService;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.emf.ecore.EObject
;
import
org.eclipse.emf.ecore.resource.Resource
;
import
org.eclipse.emf.ecore.resource.Resource
;
import
org.eclipse.emf.ecore.util.EcoreUtil
;
import
org.eclipse.emf.ecore.util.EcoreUtil
;
import
org.eclipse.emf.ecore.xmi.XMLResource
;
import
org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain
;
import
org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain
;
import
org.eclipse.swt.widgets.Shell
;
import
org.eclipse.swt.widgets.Shell
;
...
@@ -27,19 +28,25 @@ public class NewHandler {
...
@@ -27,19 +28,25 @@ public class NewHandler {
if
(
pathToNewCatalog
!=
null
)
{
if
(
pathToNewCatalog
!=
null
)
{
// create new catalog with resource at above path
// create new catalog with resource at above path
final
AdapterFactoryEditingDomain
domain
=
HandlerUtils
.
createEditingDomain
();
final
AdapterFactoryEditingDomain
domain
=
HandlerUtils
.
createEditingDomain
();
final
Resource
energyCatalogResource
=
domain
.
createResource
(
"file://"
+
pathToNewCatalog
);
final
Resource
catalogResource
=
domain
.
createResource
(
"file://"
+
pathToNewCatalog
);
final
EObject
energyCatalog
=
EcoreUtil
.
create
(
BuildingPhysicsPackage
.
eINSTANCE
.
getBuildingPhysicsCatalog
());
energyCatalogResource
.
getContents
().
add
(
energyCatalog
);
// assume default XMI factory was used to create an XML resource
if
(
catalogResource
instanceof
XMLResource
)
{
((
XMLResource
)
catalogResource
).
setEncoding
(
"UTF-8"
);
}
final
EObject
catalog
=
EcoreUtil
.
create
(
BuildingPhysicsPackage
.
eINSTANCE
.
getBuildingPhysicsCatalog
());
catalogResource
.
getContents
().
add
(
catalog
);
// store new (empty) resource at selected path
// store new (empty) resource at selected path
try
{
try
{
energyC
atalogResource
.
save
(
null
);
c
atalogResource
.
save
(
null
);
}
catch
(
IOException
e
)
{
}
catch
(
IOException
e
)
{
// TODO Auto-generated catch block
// TODO Auto-generated catch block
e
.
printStackTrace
();
e
.
printStackTrace
();
}
}
HandlerUtils
.
createNewPartWithCatalog
(
application
.
getContext
(),
partService
,
energyC
atalogResource
);
HandlerUtils
.
createNewPartWithCatalog
(
application
.
getContext
(),
partService
,
c
atalogResource
);
}
}
}
}
}
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Snippets