Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
  • Sign in
  • B Building Physics Catalog Editor
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
    • Locked Files
  • Issues 4
    • Issues 4
    • List
    • Boards
    • Service Desk
    • Milestones
    • Iterations
    • Requirements
  • Merge requests 0
    • Merge requests 0
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
    • Test Cases
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Code review
    • Insights
    • Issue
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • NeqModPlus
  • Building Physics
  • Building Physics Catalog Editor
  • Merge requests
  • !2

Resolve "Add application plugin"

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Kai-Holger Brassel requested to merge 4-add-application-plugin into master 4 years ago
  • Overview 0
  • Commits 4
  • Pipelines 0
  • Changes 25

Closes #4 (closed)

  • Kai-Holger Brassel @brassel added 1 deleted label 4 years ago

    added 1 deleted label

  • Kai-Holger Brassel @brassel added technical label 4 years ago

    added technical label

  • Kai-Holger Brassel @brassel mentioned in commit 325f3178 4 years ago

    mentioned in commit 325f3178

  • Kai-Holger Brassel @brassel merged 4 years ago

    merged

  • Loading
  • You're only seeing other activity in the feed. To add a comment, switch to one of the following options.
Please register or sign in to reply
Compare
  • master (base)

and
  • latest version
    a00f97a2
    4 commits, 4 years ago

25 files
+ 559
- 14

    Preferences

    File browser
    Compare changes
de.hftstuttgart.build‎ingphysics.application‎
META‎-INF‎
MANIF‎EST.MF‎ +21 -0
c‎ss‎
defau‎lt.css‎ +0 -0
ic‎ons‎
home‎.png‎ +0 -0
open_in‎_app.png‎ +0 -0
save_e‎dit.png‎ +0 -0
src/de/…/buildingp‎hysics/application‎
hand‎lers‎
AboutHan‎dler.java‎ +12 -0
HandlerU‎tils.java‎ +50 -0
NewHand‎ler.java‎ +45 -0
OpenHand‎ler.java‎ +28 -0
QuitHand‎ler.java‎ +17 -0
SaveHand‎ler.java‎ +21 -0
pa‎rts‎
CatalogP‎art.java‎ +50 -0
.clas‎spath‎ +7 -0
.pro‎ject‎ +28 -0
Applicat‎ion.e4xmi‎ +51 -0
build.pr‎operties‎ +8 -0
de.hftstuttgart.buildingp‎hysics.application.product‎ +50 -0
plugi‎n.xml‎ +18 -0
de.hftstuttgart.bui‎ldingphysics.feature‎
.pro‎ject‎ +17 -0
build.pr‎operties‎ +1 -0
featu‎re.xml‎ +103 -0
de.hftstuttgart.buil‎dingphysics.viewmodel‎
viewm‎odels‎
BuildingPhysi‎csCatalog.view‎ +1 -1
MaterialCa‎tegory.view‎ +12 -0
plugi‎n.xml‎ +4 -12
READ‎ME.md‎ +15 -1
de.hftstuttgart.buildingphysics.application/META-INF/MANIFEST.MF 0 → 100644
+ 21
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

 
Manifest-Version: 1.0
 
Bundle-ManifestVersion: 2
 
Bundle-Name: Application
 
Bundle-SymbolicName: de.hftstuttgart.buildingphysics.application;singleton:=true
 
Bundle-Version: 1.0.0.qualifier
 
Require-Bundle: javax.inject;bundle-version="0.0.0",
 
org.eclipse.core.runtime;bundle-version="0.0.0",
 
org.eclipse.swt;bundle-version="0.0.0",
 
org.eclipse.e4.ui.model.workbench;bundle-version="0.0.0",
 
org.eclipse.jface;bundle-version="0.0.0",
 
org.eclipse.e4.ui.services;bundle-version="0.0.0",
 
org.eclipse.e4.ui.workbench;bundle-version="0.0.0",
 
org.eclipse.e4.core.di;bundle-version="0.0.0",
 
org.eclipse.e4.ui.di;bundle-version="0.0.0",
 
org.eclipse.e4.core.contexts;bundle-version="0.0.0",
 
org.eclipse.emf.ecore,
 
org.eclipse.emf.edit,
 
org.eclipse.emf.ecp.ui.view.swt
 
Import-Package: de.hftstuttgart.buildingphysics,
 
javax.annotation;version="0.0.0"
 
Automatic-Module-Name: de.hftstuttgart.buildingphysics.application
de.hftstuttgart.buildingphysics.application/META-INF/MANIFEST.MF 0 → 100644
+ 21
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

 
Manifest-Version: 1.0
 
Bundle-ManifestVersion: 2
 
Bundle-Name: Application
 
Bundle-SymbolicName: de.hftstuttgart.buildingphysics.application;singleton:=true
 
Bundle-Version: 1.0.0.qualifier
 
Require-Bundle: javax.inject;bundle-version="0.0.0",
 
org.eclipse.core.runtime;bundle-version="0.0.0",
 
org.eclipse.swt;bundle-version="0.0.0",
 
org.eclipse.e4.ui.model.workbench;bundle-version="0.0.0",
 
org.eclipse.jface;bundle-version="0.0.0",
 
org.eclipse.e4.ui.services;bundle-version="0.0.0",
 
org.eclipse.e4.ui.workbench;bundle-version="0.0.0",
 
org.eclipse.e4.core.di;bundle-version="0.0.0",
 
org.eclipse.e4.ui.di;bundle-version="0.0.0",
 
org.eclipse.e4.core.contexts;bundle-version="0.0.0",
 
org.eclipse.emf.ecore,
 
org.eclipse.emf.edit,
 
org.eclipse.emf.ecp.ui.view.swt
 
Import-Package: de.hftstuttgart.buildingphysics,
 
javax.annotation;version="0.0.0"
 
Automatic-Module-Name: de.hftstuttgart.buildingphysics.application
de.hftstuttgart.buildingphysics.application/css/default.css 0 → 100644
+ 0
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

de.hftstuttgart.buildingphysics.application/icons/home.png 0 → 100644
+ 0
- 0
  • View file @ a00f97a2

287 bytes

de.hftstuttgart.buildingphysics.application/icons/open_in_app.png 0 → 100644
+ 0
- 0
  • View file @ a00f97a2

315 bytes

de.hftstuttgart.buildingphysics.application/icons/save_edit.png 0 → 100644
+ 0
- 0
  • View file @ a00f97a2

367 bytes

de.hftstuttgart.buildingphysics.application/src/de/hftstuttgart/buildingphysics/application/handlers/AboutHandler.java 0 → 100644
+ 12
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

 
package de.hftstuttgart.buildingphysics.application.handlers;
 
 
import org.eclipse.e4.core.di.annotations.Execute;
 
import org.eclipse.jface.dialogs.MessageDialog;
 
import org.eclipse.swt.widgets.Shell;
 
 
public class AboutHandler {
 
@Execute
 
public void execute(Shell shell) {
 
MessageDialog.openInformation(shell, "About", "HfT Stuttgart - Building Physics Catalog");
 
}
 
}
de.hftstuttgart.buildingphysics.application/src/de/hftstuttgart/buildingphysics/application/handlers/HandlerUtils.java 0 → 100644
+ 50
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

 
package de.hftstuttgart.buildingphysics.application.handlers;
 
 
import org.eclipse.e4.core.contexts.IEclipseContext;
 
import org.eclipse.e4.ui.model.application.ui.basic.MPart;
 
import org.eclipse.e4.ui.workbench.modeling.EPartService;
 
import org.eclipse.e4.ui.workbench.modeling.EPartService.PartState;
 
import org.eclipse.emf.common.command.BasicCommandStack;
 
import org.eclipse.emf.common.notify.AdapterFactory;
 
import org.eclipse.emf.ecore.resource.Resource;
 
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
 
import org.eclipse.emf.edit.provider.ComposedAdapterFactory;
 
import org.eclipse.swt.SWT;
 
import org.eclipse.swt.widgets.FileDialog;
 
import org.eclipse.swt.widgets.Shell;
 
 
class HandlerUtils {
 
static final String CATALOG_PARTDESCRIPTOR_ID = "de.hftstuttgart.buildingphysics.application.partdescriptor.catalog";
 
 
public static String openFileDialog(Shell shell) {
 
return invokeFileDialog(new FileDialog(shell, SWT.OPEN));
 
}
 
 
public static String newFileDialog(Shell shell) {
 
return invokeFileDialog(new FileDialog(shell, SWT.SAVE));
 
}
 
 
private static String invokeFileDialog(FileDialog dialog) {
 
dialog.setFilterPath(System.getProperty("user.home"));
 
dialog.setFilterNames(new String [] {"Building Physics Catalog", "All Files (*)"});
 
dialog.setFilterExtensions(new String [] {"*.buildphys", "*"});
 
return dialog.open();
 
}
 
 
static void createNewPartWithCatalog(IEclipseContext context, EPartService partService, Resource resource) {
 
context.set(Resource.class, resource);
 
MPart catalogPart = partService.createPart(CATALOG_PARTDESCRIPTOR_ID);
 
catalogPart.setDirty(true); // must listen to adapter!
 
catalogPart.setLabel(resource.getURI().lastSegment());
 
partService.showPart(catalogPart, PartState.ACTIVATE);
 
}
 
 
static AdapterFactoryEditingDomain createEditingDomain() {
 
final AdapterFactory composedAdapterFactory = new ComposedAdapterFactory(
 
ComposedAdapterFactory.Descriptor.Registry.INSTANCE); // no dispose required?
 
final AdapterFactoryEditingDomain domain = new AdapterFactoryEditingDomain(composedAdapterFactory,
 
new BasicCommandStack());
 
return domain;
 
}
 
 
}
de.hftstuttgart.buildingphysics.application/src/de/hftstuttgart/buildingphysics/application/handlers/NewHandler.java 0 → 100644
+ 45
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

 
package de.hftstuttgart.buildingphysics.application.handlers;
 
 
import de.hftstuttgart.buildingphysics.BuildingPhysicsPackage;
 
import java.io.IOException;
 
 
import javax.inject.Named;
 
 
import org.eclipse.e4.core.di.annotations.Execute;
 
import org.eclipse.e4.ui.model.application.MApplication;
 
import org.eclipse.e4.ui.services.IServiceConstants;
 
import org.eclipse.e4.ui.workbench.modeling.EPartService;
 
import org.eclipse.emf.ecore.EObject;
 
import org.eclipse.emf.ecore.resource.Resource;
 
import org.eclipse.emf.ecore.util.EcoreUtil;
 
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
 
import org.eclipse.swt.widgets.Shell;
 
 
 
public class NewHandler {
 
 
@Execute
 
public void execute(MApplication application, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
 
EPartService partService) {
 
 
final String pathToNewCatalog = HandlerUtils.newFileDialog(shell);
 
 
if (pathToNewCatalog != null) {
 
// create new catalog with resource at above path
 
final AdapterFactoryEditingDomain domain = HandlerUtils.createEditingDomain();
 
final Resource energyCatalogResource = domain.createResource("file://" + pathToNewCatalog);
 
final EObject energyCatalog = EcoreUtil.create(BuildingPhysicsPackage.eINSTANCE.getBuildingPhysicsCatalog());
 
energyCatalogResource.getContents().add(energyCatalog);
 
 
// store new (empty) resource at selected path
 
try {
 
energyCatalogResource.save(null);
 
} catch (IOException e) {
 
// TODO Auto-generated catch block
 
e.printStackTrace();
 
}
 
 
HandlerUtils.createNewPartWithCatalog(application.getContext(), partService, energyCatalogResource);
 
}
 
}
 
}
 
\ No newline at end of file
de.hftstuttgart.buildingphysics.application/src/de/hftstuttgart/buildingphysics/application/handlers/OpenHandler.java 0 → 100644
+ 28
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

 
package de.hftstuttgart.buildingphysics.application.handlers;
 
 
import javax.inject.Named;
 
 
import org.eclipse.e4.core.di.annotations.Execute;
 
import org.eclipse.e4.ui.model.application.MApplication;
 
import org.eclipse.e4.ui.services.IServiceConstants;
 
import org.eclipse.e4.ui.workbench.modeling.EPartService;
 
import org.eclipse.emf.ecore.resource.Resource;
 
import org.eclipse.emf.edit.domain.AdapterFactoryEditingDomain;
 
import org.eclipse.swt.widgets.Shell;
 
 
 
public class OpenHandler {
 
@Execute
 
public void execute(MApplication application, @Named(IServiceConstants.ACTIVE_SHELL) Shell shell,
 
EPartService partService) {
 
 
final String pathToCatalog = HandlerUtils.openFileDialog(shell);
 
 
if (pathToCatalog != null) {
 
final AdapterFactoryEditingDomain domain = HandlerUtils.createEditingDomain();
 
System.out.println("Open catalog: " + pathToCatalog);
 
final Resource catalogResource = domain.loadResource("file://" + pathToCatalog);
 
HandlerUtils.createNewPartWithCatalog(application.getContext(), partService, catalogResource);
 
}
 
}
 
}
 
\ No newline at end of file
de.hftstuttgart.buildingphysics.application/src/de/hftstuttgart/buildingphysics/application/handlers/QuitHandler.java 0 → 100644
+ 17
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

 
package de.hftstuttgart.buildingphysics.application.handlers;
 
 
import org.eclipse.e4.core.di.annotations.Execute;
 
import org.eclipse.e4.ui.workbench.IWorkbench;
 
import org.eclipse.jface.dialogs.MessageDialog;
 
import org.eclipse.swt.widgets.Shell;
 
 
 
public class QuitHandler {
 
@Execute
 
public void execute(IWorkbench workbench, Shell shell){
 
if (MessageDialog.openConfirm(shell, "Confirmation",
 
"Do you want to exit?")) {
 
workbench.close();
 
}
 
}
 
}
de.hftstuttgart.buildingphysics.application/src/de/hftstuttgart/buildingphysics/application/handlers/SaveHandler.java 0 → 100644
+ 21
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

 
package de.hftstuttgart.buildingphysics.application.handlers;
 
 
import org.eclipse.e4.core.di.annotations.CanExecute;
 
import org.eclipse.e4.core.di.annotations.Execute;
 
import org.eclipse.e4.ui.workbench.modeling.EPartService;
 
 
public class SaveHandler {
 
 
@CanExecute
 
public boolean canExecute(EPartService partService) {
 
if (partService != null) {
 
return !partService.getDirtyParts().isEmpty();
 
}
 
return false;
 
}
 
 
@Execute
 
public void execute(EPartService partService) {
 
partService.saveAll(false);
 
}
 
}
 
\ No newline at end of file
de.hftstuttgart.buildingphysics.application/src/de/hftstuttgart/buildingphysics/application/parts/CatalogPart.java 0 → 100644
+ 50
- 0
  • View file @ a00f97a2

  • Edit in single-file editor

  • Open in Web IDE

 
package de.hftstuttgart.buildingphysics.application.parts;
 
 
import java.io.IOException;
 
 
import javax.annotation.PostConstruct;
 
 
import org.eclipse.e4.ui.di.Persist;
 
import org.eclipse.e4.ui.model.application.MApplication;
 
import org.eclipse.emf.ecore.EObject;
 
import org.eclipse.emf.ecore.resource.Resource;
 
import org.eclipse.emf.ecp.ui.view.ECPRendererException;
 
import org.eclipse.emf.ecp.ui.view.swt.ECPSWTViewRenderer;
 
import org.eclipse.jface.layout.GridLayoutFactory;
 
import org.eclipse.swt.SWT;
 
import org.eclipse.swt.widgets.Composite;
 
 
/**
 
* Part for displaying a Forms Editor for a Building Physics Catalog.
 
*/
 
public class CatalogPart {
 
private Resource catalogResource;
 
 
@PostConstruct
 
public void createComposite(MApplication application, Composite parent) {
 
catalogResource = application.getContext().get(Resource.class);
 
EObject energyCatalog = catalogResource.getContents().get(0);
 
try {
 
final Composite content = new Composite(parent, SWT.NONE);
 
content.setBackground(parent.getDisplay().getSystemColor(SWT.COLOR_WHITE));
 
content.setLayout(GridLayoutFactory.fillDefaults().margins(10, 10).create());
 
ECPSWTViewRenderer.INSTANCE.render(content, energyCatalog);
 
content.layout();
 
} catch (final ECPRendererException e) {
 
e.printStackTrace();
 
}
 
parent.layout();
 
}
 
 
@Persist
 
public void save() {
 
System.out.println("Saved " + catalogResource);
 
try {
 
catalogResource.save(null);
 
} catch (IOException e) {
 
// TODO Auto-generated catch block
 
e.printStackTrace();
 
}
 
}
 
 
}
 
\ No newline at end of file
Assignee
Kai-Holger Brassel's avatar
Kai-Holger Brassel
Assign to
0 Reviewers
None
Request review from
Labels
1
technical
1
technical
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
1
1 participant
Kai-Holger Brassel
Reference: neqmodplus/building-physics/building-physics-catalog-editor!2
Source branch: 4-add-application-plugin

Menu

Explore Projects Groups Snippets

Dies ist die Gitlab-Instanz des Transferportals der Hochschule für Technik Stuttgart. Hier geht es zurück zum Portal