* 2)
*/
public class OpenJcrFile extends AbstractHandler {
- // private final static Log log = LogFactory.getLog(OpenJcrFile.class);
-
- public final static String ID = SlcRapPlugin.PLUGIN_ID + ".openJcrFile";
+ // Use (new OpenJcrFileCmdId()).getCmdId() instead.
+ // public final String ID = SlcRapPlugin.PLUGIN_ID + ".openJcrFile";
+
public final static String PARAM_REPO_NODE_PATH = "param.repoNodePath";
public final static String PARAM_REPO_URI = "param.repoUri";
public final static String PARAM_WORKSPACE_NAME = "param.workspaceName";
--- /dev/null
+package org.argeo.slc.client.ui.specific;
+
+import org.argeo.slc.client.rap.SlcRapPlugin;
+
+/**
+ * Workaround a single sourcing problem:
+ *
+ * final static variable are imported at compilation time (we build against RCP)
+ * and we still must have a different ID (the prefix must be the PLUGIN ID) for
+ * RAP and RCP in order to be able to inject beans in the corresponding commands
+ */
+public class OpenJcrFileCmdId {
+
+ public String getCmdId() {
+ return SlcRapPlugin.PLUGIN_ID + ".openJcrFile";
+ }
+}
import org.apache.commons.io.IOUtils;
import org.argeo.jcr.JcrUtils;
import org.argeo.slc.SlcException;
-import org.argeo.slc.client.rcp.SlcRcpPlugin;
import org.argeo.slc.repo.RepoService;
import org.eclipse.core.commands.AbstractHandler;
import org.eclipse.core.commands.ExecutionEvent;
// private final static Log log = LogFactory.getLog(OpenJcrFile.class);
// Here is the trick that enable single sourcing: the ID is determined at
- // runtime. ALWAYS use this public variable to call the command.
- public final static String ID = SlcRcpPlugin.PLUGIN_ID + ".openJcrFile";
+ // runtime so use (new OpenJcrFileCmdId()).getCmdId() instead of the usual
+ // public final String ID = SlcRcpPlugin.PLUGIN_ID + ".openJcrFile";
public final static String PARAM_REPO_NODE_PATH = "param.repoNodePath";
public final static String PARAM_REPO_URI = "param.repoUri";
--- /dev/null
+package org.argeo.slc.client.ui.specific;
+
+import org.argeo.slc.client.rcp.SlcRcpPlugin;
+
+/**
+ * Workaround a single sourcing problem:
+ *
+ * final static variable are imported at compilation time (we build against RCP)
+ * and we still must have a different ID (the prefix must be the PLUGIN ID) for
+ * RAP and RCP in order to be able to inject beans in the corresponding commands
+ */
+public class OpenJcrFileCmdId {
+
+ public String getCmdId() {
+ return SlcRcpPlugin.PLUGIN_ID + ".openJcrFile";
+ }
+}
import javax.jcr.Node;
import javax.jcr.RepositoryException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.argeo.ArgeoException;
import org.argeo.eclipse.ui.utils.CommandUtils;
import org.argeo.slc.SlcException;
import org.argeo.slc.client.ui.dist.DistConstants;
import org.argeo.slc.client.ui.dist.utils.AbstractHyperlinkListener;
import org.argeo.slc.client.ui.specific.OpenJcrFile;
+import org.argeo.slc.client.ui.specific.OpenJcrFileCmdId;
import org.argeo.slc.jcr.SlcNames;
import org.argeo.slc.repo.RepoConstants;
import org.argeo.slc.repo.RepoUtils;
* Show the details for a given bundle.
*/
public class BundleDetailPage extends FormPage implements SlcNames {
+ private final static Log log = LogFactory.getLog(BundleDetailPage.class);
final static String PAGE_ID = "BundleDetailPage";
Label label = tk.createLabel(parent, "Pom", SWT.RIGHT);
label.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false));
- String name = bundle.getName().substring(0, bundle.getName().length() - "jar".length()) + "pom";
+ String name = bundle.getName().substring(0,
+ bundle.getName().length() - "jar".length())
+ + "pom";
if (bundle.getParent().hasNode(name)) {
Node pom = bundle.getParent().getNode(name);
params.put(OpenJcrFile.PARAM_WORKSPACE_NAME,
editorInput.getWorkspaceName());
params.put(OpenJcrFile.PARAM_FILE_PATH, path);
- CommandUtils.callCommand(OpenJcrFile.ID, params);
+
+ String cmdId = (new OpenJcrFileCmdId()).getCmdId();
+ if (log.isTraceEnabled())
+ log.debug("Retrieved openFile Cmd ID: " + cmdId);
+ CommandUtils.callCommand(cmdId, params);
} catch (Exception ex) {
throw new SlcException("error opening browser", ex); //$NON-NLS-1$
}