From: Mathieu Baudier Date: Fri, 16 Mar 2018 16:44:39 +0000 (+0100) Subject: Improve Eclipse 4 support X-Git-Tag: argeo-commons-2.1.73~37 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=6ba130a04c057858b151d5d460b8c95976bd619b;p=lgpl%2Fargeo-commons.git Improve Eclipse 4 support --- diff --git a/demo/cms-e4-rap.properties b/demo/cms-e4-rap.properties index 68db6f94b..0e01b5dcf 100644 --- a/demo/cms-e4-rap.properties +++ b/demo/cms-e4-rap.properties @@ -9,7 +9,7 @@ argeo.osgi.start.3.node=\ org.argeo.cms argeo.osgi.start.5.node=\ -org.argeo.cms.e4 +org.argeo.cms.e4.rap # Local argeo.node.repo.type=h2 diff --git a/dep/org.argeo.dep.cms.rap.e4/pom.xml b/dep/org.argeo.dep.cms.rap.e4/pom.xml index e826e1b12..b5c44ed4d 100644 --- a/dep/org.argeo.dep.cms.rap.e4/pom.xml +++ b/dep/org.argeo.dep.cms.rap.e4/pom.xml @@ -16,23 +16,17 @@ org.argeo.commons org.argeo.dep.cms.node 2.1.73-SNAPSHOT - pom - - - - - - - - - - - - - - - + + org.argeo.commons + org.argeo.cms.e4 + 2.1.73-SNAPSHOT + + + org.argeo.commons + org.argeo.cms.e4.rap + 2.1.73-SNAPSHOT + diff --git a/org.argeo.cms.e4.rap/.classpath b/org.argeo.cms.e4.rap/.classpath new file mode 100644 index 000000000..eca7bdba8 --- /dev/null +++ b/org.argeo.cms.e4.rap/.classpath @@ -0,0 +1,7 @@ + + + + + + + diff --git a/org.argeo.cms.e4.rap/.gitignore b/org.argeo.cms.e4.rap/.gitignore new file mode 100644 index 000000000..09e3bc9b2 --- /dev/null +++ b/org.argeo.cms.e4.rap/.gitignore @@ -0,0 +1,2 @@ +/bin/ +/target/ diff --git a/org.argeo.cms.e4.rap/.project b/org.argeo.cms.e4.rap/.project new file mode 100644 index 000000000..94d2f42b9 --- /dev/null +++ b/org.argeo.cms.e4.rap/.project @@ -0,0 +1,28 @@ + + + org.argeo.cms.e4.rap + + + + + + org.eclipse.jdt.core.javabuilder + + + + + org.eclipse.pde.ManifestBuilder + + + + + org.eclipse.pde.SchemaBuilder + + + + + + org.eclipse.pde.PluginNature + org.eclipse.jdt.core.javanature + + diff --git a/org.argeo.cms.e4.rap/META-INF/.gitignore b/org.argeo.cms.e4.rap/META-INF/.gitignore new file mode 100644 index 000000000..4854a41b9 --- /dev/null +++ b/org.argeo.cms.e4.rap/META-INF/.gitignore @@ -0,0 +1 @@ +/MANIFEST.MF diff --git a/org.argeo.cms.e4.rap/OSGI-INF/cms-admin-rap.xml b/org.argeo.cms.e4.rap/OSGI-INF/cms-admin-rap.xml new file mode 100644 index 000000000..e54d613dc --- /dev/null +++ b/org.argeo.cms.e4.rap/OSGI-INF/cms-admin-rap.xml @@ -0,0 +1,8 @@ + + + + + + + + diff --git a/org.argeo.cms.e4.rap/bnd.bnd b/org.argeo.cms.e4.rap/bnd.bnd new file mode 100644 index 000000000..1dc383b48 --- /dev/null +++ b/org.argeo.cms.e4.rap/bnd.bnd @@ -0,0 +1,7 @@ +Bundle-ActivationPolicy: lazy +Service-Component: OSGI-INF/cms-admin-rap.xml + +Import-Package: org.argeo.node,\ +org.eclipse.swt,\ +org.eclipse.rap.rwt.client,\ +* diff --git a/org.argeo.cms.e4.rap/build.properties b/org.argeo.cms.e4.rap/build.properties new file mode 100644 index 000000000..c58ea2178 --- /dev/null +++ b/org.argeo.cms.e4.rap/build.properties @@ -0,0 +1,5 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + OSGI-INF/ diff --git a/org.argeo.cms.e4.rap/cms-admin.e4xmi b/org.argeo.cms.e4.rap/cms-admin.e4xmi new file mode 100644 index 000000000..58e6d6844 --- /dev/null +++ b/org.argeo.cms.e4.rap/cms-admin.e4xmi @@ -0,0 +1,32 @@ + + + + + shellMaximized + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.argeo.cms.e4.rap/pom.xml b/org.argeo.cms.e4.rap/pom.xml new file mode 100644 index 000000000..f08cc0039 --- /dev/null +++ b/org.argeo.cms.e4.rap/pom.xml @@ -0,0 +1,30 @@ + + + 4.0.0 + + org.argeo.commons + argeo-commons + 2.1.73-SNAPSHOT + .. + + org.argeo.cms.e4.rap + CMS E4 RAP + jar + + + org.argeo.commons + org.argeo.cms.e4 + 2.1.73-SNAPSHOT + + + + + org.argeo.tp + argeo-tp-rap-e4 + ${version.argeo-tp} + pom + provided + + + \ No newline at end of file diff --git a/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsE4AdminApp.java b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsE4AdminApp.java new file mode 100644 index 000000000..0a3e050cb --- /dev/null +++ b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsE4AdminApp.java @@ -0,0 +1,89 @@ +package org.argeo.cms.e4.rap; + +import java.security.PrivilegedAction; +import java.util.HashMap; +import java.util.Map; + +import javax.security.auth.Subject; + +import org.eclipse.rap.e4.E4ApplicationConfig; +import org.eclipse.rap.e4.E4EntryPointFactory; +import org.eclipse.rap.rwt.application.Application; +import org.eclipse.rap.rwt.application.Application.OperationMode; +import org.eclipse.rap.rwt.application.ApplicationConfiguration; +import org.eclipse.rap.rwt.application.EntryPoint; +import org.eclipse.rap.rwt.client.WebClient; +import org.osgi.framework.Bundle; +import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; + +public class CmsE4AdminApp implements ApplicationConfiguration { + private final BundleContext bc = FrameworkUtil.getBundle(CmsE4AdminApp.class).getBundleContext(); + + String pageTitle = "CMS Admin"; + String e4Xmi = "/cms-admin.e4xmi"; + String path = "/admin"; + + public void configure(Application application) { + + Map properties = new HashMap(); + properties.put(WebClient.PAGE_TITLE, pageTitle); + Bundle bundle = bc.getBundle(); + String e4XmiUri = bundle.getSymbolicName() + e4Xmi; + E4ApplicationConfig config = new E4ApplicationConfig(e4XmiUri, + "bundleclass://" + bundle.getSymbolicName() + "/" + CmsLoginLifecycle.class.getName(), null, false, + true, true); + config.isClearPersistedState(); + E4EntryPointFactory entryPointFactory = new E4EntryPointFactory(config) { + + @Override + public EntryPoint create() { + Subject subject = new Subject(); + // return Subject.doAs(subject, new PrivilegedAction() { + // + // @Override + // public EntryPoint run() { + EntryPoint ep = createEntryPoint(); + EntryPoint authEp = new EntryPoint() { + + @Override + public int createUI() { + return Subject.doAs(subject, new PrivilegedAction() { + + @Override + public Integer run() { + return ep.createUI(); + } + + }); + } + }; + // return authEp; + // } + // + // }); + return authEp; + } + + protected EntryPoint createEntryPoint() { + return super.create(); + } + + }; + application.addEntryPoint(path, entryPointFactory, properties); + application.setOperationMode(OperationMode.SWT_COMPATIBILITY); + } + + public void setPageTitle(String pageTitle) { + this.pageTitle = pageTitle; + } + + public void setE4Xmi(String e4Xmi) { + this.e4Xmi = e4Xmi; + } + + public void setPath(String path) { + this.path = path; + } + +} diff --git a/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java new file mode 100644 index 000000000..687290626 --- /dev/null +++ b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java @@ -0,0 +1,108 @@ +package org.argeo.cms.e4.rap; + +import java.security.AccessController; + +import javax.security.auth.Subject; +import javax.security.auth.login.LoginContext; +import javax.security.auth.login.LoginException; + +import org.argeo.cms.CmsException; +import org.argeo.cms.auth.CurrentUser; +import org.argeo.cms.ui.CmsImageManager; +import org.argeo.cms.ui.CmsView; +import org.argeo.cms.ui.UxContext; +import org.argeo.cms.util.SimpleUxContext; +import org.argeo.cms.widgets.auth.CmsLoginShell; +import org.argeo.node.NodeConstants; +import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate; +import org.eclipse.swt.widgets.Display; + +@SuppressWarnings("restriction") +public class CmsLoginLifecycle implements CmsView { + private UxContext uxContext; + private LoginContext loginContext; + + @PostContextCreate + boolean login(Display d) { + Subject subject = Subject.getSubject(AccessController.getContext()); + Display display = Display.getCurrent(); + CmsLoginShell loginShell = new CmsLoginShell(this); + loginShell.setSubject(subject); + try { + // try pre-auth + loginContext = new LoginContext(NodeConstants.LOGIN_CONTEXT_USER, subject, loginShell); + loginContext.login(); + } catch (LoginException e) { + loginShell.createUi(); + loginShell.open(); + + while (!loginShell.getShell().isDisposed()) { + if (!display.readAndDispatch()) + display.sleep(); + } + } + if (CurrentUser.getUsername(getSubject()) == null) + return false; + uxContext = new SimpleUxContext(); + return true; + } + + @Override + public UxContext getUxContext() { + return uxContext; + } + + @Override + public void navigateTo(String state) { + // TODO Auto-generated method stub + + } + + @Override + public void authChange(LoginContext loginContext) { + if (loginContext == null) + throw new CmsException("Login context cannot be null"); + // logout previous login context +// if (this.loginContext != null) +// try { +// this.loginContext.logout(); +// } catch (LoginException e1) { +// System.err.println("Could not log out: " + e1); +// } + this.loginContext = loginContext; + } + + @Override + public void logout() { + if (loginContext == null) + throw new CmsException("Login context should not bet null"); + try { + CurrentUser.logoutCmsSession(loginContext.getSubject()); + loginContext.logout(); + } catch (LoginException e) { + throw new CmsException("Cannot log out", e); + } + } + + @Override + public void exception(Throwable e) { + // TODO Auto-generated method stub + + } + + @Override + public CmsImageManager getImageManager() { + // TODO Auto-generated method stub + return null; + } + + protected Subject getSubject() { + return loginContext.getSubject(); + } + + @Override + public boolean isAnonymous() { + return CurrentUser.isAnonymous(getSubject()); + } + +} diff --git a/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/TestTool.java b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/TestTool.java new file mode 100644 index 000000000..774af3fc1 --- /dev/null +++ b/org.argeo.cms.e4.rap/src/org/argeo/cms/e4/rap/TestTool.java @@ -0,0 +1,16 @@ +package org.argeo.cms.e4.rap; + +import javax.annotation.PostConstruct; +import org.eclipse.swt.SWT; +import org.eclipse.swt.widgets.Combo; +import org.eclipse.swt.widgets.Composite; + +public class TestTool { + + @PostConstruct + public void createGui(Composite parent) { + Combo combo = new Combo(parent, SWT.READ_ONLY); + combo.add("First"); + combo.add("Second"); + } +} \ No newline at end of file diff --git a/org.argeo.cms.e4/OSGI-INF/cms-admin-rap.xml b/org.argeo.cms.e4/OSGI-INF/cms-admin-rap.xml deleted file mode 100644 index e54d613dc..000000000 --- a/org.argeo.cms.e4/OSGI-INF/cms-admin-rap.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - diff --git a/org.argeo.cms.e4/bnd.bnd b/org.argeo.cms.e4/bnd.bnd index 5d1261fe7..f3c13bec5 100644 --- a/org.argeo.cms.e4/bnd.bnd +++ b/org.argeo.cms.e4/bnd.bnd @@ -1,7 +1,2 @@ -Service-Component: OSGI-INF/cms-admin-rap.xml - Import-Package: org.eclipse.swt,\ -org.argeo.node,\ -org.eclipse.rap.*;resolution:=optional,\ -org.eclipse.rap.rwt.client;resolution:=optional,\ * diff --git a/org.argeo.cms.e4/cms-admin.e4xmi b/org.argeo.cms.e4/cms-admin.e4xmi deleted file mode 100644 index b9c37670f..000000000 --- a/org.argeo.cms.e4/cms-admin.e4xmi +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - - - - - - - diff --git a/org.argeo.cms.e4/pom.xml b/org.argeo.cms.e4/pom.xml index bf677e09e..dca59441c 100644 --- a/org.argeo.cms.e4/pom.xml +++ b/org.argeo.cms.e4/pom.xml @@ -17,11 +17,6 @@ org.argeo.cms.ui 2.1.73-SNAPSHOT - - org.argeo.commons - org.argeo.cms.ui.theme - 2.1.73-SNAPSHOT - diff --git a/org.argeo.cms.e4/src/org/argeo/cms/e4/jcr/JcrBrowserView.java b/org.argeo.cms.e4/src/org/argeo/cms/e4/jcr/JcrBrowserView.java index 0551e16b8..3eff80733 100644 --- a/org.argeo.cms.e4/src/org/argeo/cms/e4/jcr/JcrBrowserView.java +++ b/org.argeo.cms.e4/src/org/argeo/cms/e4/jcr/JcrBrowserView.java @@ -62,16 +62,12 @@ import org.eclipse.swt.layout.GridLayout; import org.eclipse.swt.widgets.Composite; import org.eclipse.swt.widgets.Display; import org.eclipse.swt.widgets.Menu; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; /** * Basic View to display a sash form to browse a JCR compliant multiple * repository environment */ public class JcrBrowserView { - private static BundleContext bc = FrameworkUtil.getBundle(JcrBrowserView.class).getBundleContext(); - private boolean sortChildNodes = true; /* DEPENDENCY INJECTION */ @@ -84,7 +80,7 @@ public class JcrBrowserView { // Current user session on the "Argeo node" default workspace private Session userSession; - private OsgiRepositoryRegister repositoryRegister = new OsgiRepositoryRegister(bc); + private OsgiRepositoryRegister repositoryRegister = new OsgiRepositoryRegister(); // This page widgets private TreeViewer nodesViewer; diff --git a/org.argeo.cms.e4/src/org/argeo/cms/e4/rap/CmsE4AdminApp.java b/org.argeo.cms.e4/src/org/argeo/cms/e4/rap/CmsE4AdminApp.java deleted file mode 100644 index 5b2adc0bb..000000000 --- a/org.argeo.cms.e4/src/org/argeo/cms/e4/rap/CmsE4AdminApp.java +++ /dev/null @@ -1,87 +0,0 @@ -package org.argeo.cms.e4.rap; - -import java.security.PrivilegedAction; -import java.util.HashMap; -import java.util.Map; - -import javax.security.auth.Subject; - -import org.eclipse.rap.e4.E4ApplicationConfig; -import org.eclipse.rap.e4.E4EntryPointFactory; -import org.eclipse.rap.rwt.application.Application; -import org.eclipse.rap.rwt.application.Application.OperationMode; -import org.eclipse.rap.rwt.application.ApplicationConfiguration; -import org.eclipse.rap.rwt.application.EntryPoint; -import org.eclipse.rap.rwt.client.WebClient; -import org.osgi.framework.Bundle; -import org.osgi.framework.BundleContext; -import org.osgi.framework.FrameworkUtil; - -public class CmsE4AdminApp implements ApplicationConfiguration { - private final BundleContext bc = FrameworkUtil.getBundle(CmsE4AdminApp.class).getBundleContext(); - - String pageTitle = "CMS Admin"; - String e4Xmi = "/cms-admin.e4xmi"; - String path = "/admin"; - - public void configure(Application application) { - - Map properties = new HashMap(); - properties.put(WebClient.PAGE_TITLE, pageTitle); - Bundle bundle = bc.getBundle(); - String e4XmiUri = bundle.getSymbolicName() + e4Xmi; - E4ApplicationConfig config = E4ApplicationConfig.create(e4XmiUri, - "bundleclass://" + bundle.getSymbolicName() + "/" + CmsLoginLifecycle.class.getName()); - E4EntryPointFactory entryPointFactory = new E4EntryPointFactory(config) { - - @Override - public EntryPoint create() { - Subject subject = new Subject(); - // return Subject.doAs(subject, new PrivilegedAction() { - // - // @Override - // public EntryPoint run() { - EntryPoint ep = createEntryPoint(); - EntryPoint authEp = new EntryPoint() { - - @Override - public int createUI() { - return Subject.doAs(subject, new PrivilegedAction() { - - @Override - public Integer run() { - return ep.createUI(); - } - - }); - } - }; - // return authEp; - // } - // - // }); - return authEp; - } - - protected EntryPoint createEntryPoint() { - return super.create(); - } - - }; - application.addEntryPoint(path, entryPointFactory, properties); - application.setOperationMode(OperationMode.SWT_COMPATIBILITY); - } - - public void setPageTitle(String pageTitle) { - this.pageTitle = pageTitle; - } - - public void setE4Xmi(String e4Xmi) { - this.e4Xmi = e4Xmi; - } - - public void setPath(String path) { - this.path = path; - } - -} diff --git a/org.argeo.cms.e4/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java b/org.argeo.cms.e4/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java deleted file mode 100644 index 687290626..000000000 --- a/org.argeo.cms.e4/src/org/argeo/cms/e4/rap/CmsLoginLifecycle.java +++ /dev/null @@ -1,108 +0,0 @@ -package org.argeo.cms.e4.rap; - -import java.security.AccessController; - -import javax.security.auth.Subject; -import javax.security.auth.login.LoginContext; -import javax.security.auth.login.LoginException; - -import org.argeo.cms.CmsException; -import org.argeo.cms.auth.CurrentUser; -import org.argeo.cms.ui.CmsImageManager; -import org.argeo.cms.ui.CmsView; -import org.argeo.cms.ui.UxContext; -import org.argeo.cms.util.SimpleUxContext; -import org.argeo.cms.widgets.auth.CmsLoginShell; -import org.argeo.node.NodeConstants; -import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate; -import org.eclipse.swt.widgets.Display; - -@SuppressWarnings("restriction") -public class CmsLoginLifecycle implements CmsView { - private UxContext uxContext; - private LoginContext loginContext; - - @PostContextCreate - boolean login(Display d) { - Subject subject = Subject.getSubject(AccessController.getContext()); - Display display = Display.getCurrent(); - CmsLoginShell loginShell = new CmsLoginShell(this); - loginShell.setSubject(subject); - try { - // try pre-auth - loginContext = new LoginContext(NodeConstants.LOGIN_CONTEXT_USER, subject, loginShell); - loginContext.login(); - } catch (LoginException e) { - loginShell.createUi(); - loginShell.open(); - - while (!loginShell.getShell().isDisposed()) { - if (!display.readAndDispatch()) - display.sleep(); - } - } - if (CurrentUser.getUsername(getSubject()) == null) - return false; - uxContext = new SimpleUxContext(); - return true; - } - - @Override - public UxContext getUxContext() { - return uxContext; - } - - @Override - public void navigateTo(String state) { - // TODO Auto-generated method stub - - } - - @Override - public void authChange(LoginContext loginContext) { - if (loginContext == null) - throw new CmsException("Login context cannot be null"); - // logout previous login context -// if (this.loginContext != null) -// try { -// this.loginContext.logout(); -// } catch (LoginException e1) { -// System.err.println("Could not log out: " + e1); -// } - this.loginContext = loginContext; - } - - @Override - public void logout() { - if (loginContext == null) - throw new CmsException("Login context should not bet null"); - try { - CurrentUser.logoutCmsSession(loginContext.getSubject()); - loginContext.logout(); - } catch (LoginException e) { - throw new CmsException("Cannot log out", e); - } - } - - @Override - public void exception(Throwable e) { - // TODO Auto-generated method stub - - } - - @Override - public CmsImageManager getImageManager() { - // TODO Auto-generated method stub - return null; - } - - protected Subject getSubject() { - return loginContext.getSubject(); - } - - @Override - public boolean isAnonymous() { - return CurrentUser.isAnonymous(getSubject()); - } - -} diff --git a/org.argeo.cms.e4/src/org/argeo/cms/e4/rap/LoginLifcecycle.java b/org.argeo.cms.e4/src/org/argeo/cms/e4/rap/LoginLifcecycle.java deleted file mode 100644 index 5c6caaf8b..000000000 --- a/org.argeo.cms.e4/src/org/argeo/cms/e4/rap/LoginLifcecycle.java +++ /dev/null @@ -1,90 +0,0 @@ -package org.argeo.cms.e4.rap; - -import java.util.concurrent.atomic.AtomicBoolean; - -import org.eclipse.e4.ui.workbench.lifecycle.PostContextCreate; -import org.eclipse.swt.SWT; -import org.eclipse.swt.events.SelectionAdapter; -import org.eclipse.swt.events.SelectionEvent; -import org.eclipse.swt.graphics.Point; -import org.eclipse.swt.graphics.Rectangle; -import org.eclipse.swt.layout.GridData; -import org.eclipse.swt.layout.GridLayout; -import org.eclipse.swt.widgets.Button; -import org.eclipse.swt.widgets.Composite; -import org.eclipse.swt.widgets.Display; -import org.eclipse.swt.widgets.Label; -import org.eclipse.swt.widgets.Shell; -import org.eclipse.swt.widgets.Text; - -@SuppressWarnings("restriction") -public class LoginLifcecycle { - @PostContextCreate - boolean login(Display d) { - final AtomicBoolean rv = new AtomicBoolean(false); - final Shell s = new Shell(d); - s.setText("Login"); - s.setLayout(new GridLayout(2, false)); - - { - Label l = new Label(s, SWT.NONE); - l.setText("Username"); - - Text t = new Text(s, SWT.BORDER); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - { - Label l = new Label(s, SWT.NONE); - l.setText("Password"); - - Text t = new Text(s, SWT.BORDER | SWT.PASSWORD); - t.setLayoutData(new GridData(GridData.FILL_HORIZONTAL)); - } - - { - Composite buttonContainer = new Composite(s, SWT.NONE); - buttonContainer.setLayout(new GridLayout(2, true)); - buttonContainer.setLayoutData(new GridData(SWT.TRAIL, SWT.CENTER, false, false, 2, 1)); - - { - Button b = new Button(buttonContainer, SWT.PUSH); - b.setText("Abort"); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - rv.set(false); - s.dispose(); - } - }); - } - - { - Button b = new Button(buttonContainer, SWT.PUSH); - b.setText("Login"); - b.addSelectionListener(new SelectionAdapter() { - @Override - public void widgetSelected(SelectionEvent e) { - rv.set(true); - s.dispose(); - } - }); - } - } - s.pack(); - s.setSize(300, s.getSize().y + 10); - Rectangle bounds = d.getPrimaryMonitor().getBounds(); - - Point size = s.getSize(); - s.setLocation(bounds.width / 2 - size.x / 2, bounds.height / 2 - size.y / 2); - - s.open(); - while (!s.isDisposed() && !d.isDisposed()) { - if (!d.readAndDispatch()) { - d.sleep(); - } - } - - return rv.get(); - } -} \ No newline at end of file diff --git a/org.argeo.cms.ui/src/org/argeo/cms/ui/jcr/OsgiRepositoryRegister.java b/org.argeo.cms.ui/src/org/argeo/cms/ui/jcr/OsgiRepositoryRegister.java index 566b33d01..444350aeb 100644 --- a/org.argeo.cms.ui/src/org/argeo/cms/ui/jcr/OsgiRepositoryRegister.java +++ b/org.argeo.cms.ui/src/org/argeo/cms/ui/jcr/OsgiRepositoryRegister.java @@ -6,13 +6,15 @@ import java.util.Map; import javax.jcr.Repository; import org.osgi.framework.BundleContext; +import org.osgi.framework.FrameworkUtil; import org.osgi.framework.ServiceReference; import org.osgi.util.tracker.ServiceTracker; public class OsgiRepositoryRegister extends DefaultRepositoryRegister { + private final static BundleContext bc = FrameworkUtil.getBundle(OsgiRepositoryRegister.class).getBundleContext(); private final ServiceTracker repositoryTracker; - public OsgiRepositoryRegister(BundleContext bc) { + public OsgiRepositoryRegister() { repositoryTracker = new ServiceTracker(bc, Repository.class, null) { @Override diff --git a/pom.xml b/pom.xml index 66f95773a..cfecfad43 100644 --- a/pom.xml +++ b/pom.xml @@ -36,6 +36,7 @@ org.argeo.cms.ui org.argeo.cms.e4 + org.argeo.cms.e4.rap org.argeo.cms.ui.workbench org.argeo.cms.ui.workbench.rap