import org.eclipse.ui.PlatformUI;
/** Generic error dialog to be used in try/catch blocks */
-@SuppressWarnings("serial")
public class ErrorFeedback extends TitleAreaDialog {
+ private static final long serialVersionUID = -8918084784628179044L;
+
private final static Log log = LogFactory.getLog(ErrorFeedback.class);
private final String message;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.eclipse.core.runtime.ILogListener;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Platform;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.BundleContext;
/**
* The activator class controls the plug-in life cycle
*/
-public class WorkbenchUiPlugin extends AbstractUIPlugin {
+public class WorkbenchUiPlugin extends AbstractUIPlugin implements ILogListener {
private final static Log log = LogFactory.getLog(WorkbenchUiPlugin.class);
private ResourceBundle messages;
*/
public void start(BundleContext context) throws Exception {
super.start(context);
- plugin = this;
- messages = ResourceBundle.getBundle(ID + ".messages");
-
+ // weirdly, the start method is called twice...
+ // TODO check if it is still the case.
+ if (plugin == null) {
+ plugin = this;
+ messages = ResourceBundle.getBundle(ID + ".messages");
+ Platform.addLogListener(this);
+ log.debug("Eclipse logging now directed to standard logging");
+ } else
+ log.warn("Trying to start an already started plugin.");
}
/*
* )
*/
public void stop(BundleContext context) throws Exception {
- plugin = null;
- super.stop(context);
+ try {
+ // weirdly, the stop method is called twice...
+ // TODO check if it is still the case.
+ if (plugin != null) {
+ Platform.removeLogListener(this);
+ log.debug("Eclipse logging not directed anymore to standard logging");
+ plugin = null;
+ } else
+ log.warn("Trying to stop an already stopped plugin.");
+ } finally {
+ super.stop(context);
+ }
}
/**
return null;
}
+ public void logging(IStatus status, String plugin) {
+ Log pluginLog = LogFactory.getLog(plugin);
+ Integer severity = status.getSeverity();
+ if (severity == IStatus.ERROR)
+ pluginLog.error(status.getMessage(), status.getException());
+ else if (severity == IStatus.WARNING)
+ pluginLog.warn(status.getMessage(), status.getException());
+ else if (severity == IStatus.INFO)
+ pluginLog.info(status.getMessage(), status.getException());
+ else if (severity == IStatus.CANCEL)
+ if (pluginLog.isDebugEnabled())
+ pluginLog.debug(status.getMessage(), status.getException());
+
+ }
+
}
*/
protected ColumnLabelProvider getLabelProvider(final String columnName) {
return new ColumnLabelProvider() {
+ private static final long serialVersionUID = -3539689333250152606L;
+
public String getText(Object element) {
Row row = (Row) element;
try {
private class QueryResultContentProvider implements
IStructuredContentProvider {
+ private static final long serialVersionUID = -5421095459600554741L;
public void dispose() {
}
return null;
SelectionAdapter selectionAdapter = new SelectionAdapter() {
+ private static final long serialVersionUID = 239829307927778349L;
+
@Override
public void widgetSelected(SelectionEvent e) {
Require-Bundle: org.eclipse.core.runtime
Import-Package: org.eclipse.core.commands,\
+ org.eclipse.jface.window,
org.eclipse.swt,\
org.eclipse.swt.widgets;version="[0,1)",\
org.osgi.framework;version="[1.5,2)",\
org.springframework.core.io.support,\
*
-
# Was:
#Bundle-ActivationPolicy: lazy
#Bundle-SymbolicName: org.argeo.eclipse.ui;singleton:=true
<artifactId>org.argeo.eclipse.ui</artifactId>
<name>Commons Eclipse UI</name>
<packaging>jar</packaging>
- <build>
- <plugins>
- <plugin>
- <groupId>org.apache.felix</groupId>
- <artifactId>maven-bundle-plugin</artifactId>
- <configuration>
- <instructions>
- <Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
- </instructions>
- </configuration>
- </plugin>
- </plugins>
- </build>
+ <!-- <build> <plugins> <plugin> <groupId>org.apache.felix</groupId> <artifactId>maven-bundle-plugin</artifactId>
+ <configuration> <instructions> <Bundle-SymbolicName>${project.artifactId};singleton:=true</Bundle-SymbolicName>
+ </instructions> </configuration> </plugin> </plugins> </build> -->
<dependencies>
<!-- We build against RAP -->
<dependency>
<version>2.1.12-SNAPSHOT</version>
</dependency>
- <!-- Bridge Spring and OSGi -->
+ <!-- Bridge Spring and OSGi -->
<dependency>
<groupId>org.argeo.tp</groupId>
<artifactId>org.springframework.osgi.extender</artifactId>
/** Utilities to simplify UI development. */
public class EclipseUiUtils {
/**
- * Create a label and a text field for a grid layout, the text field grabing
+ * Create a label and a text field for a grid layout, the text field grabbing
* excess horizontal
*
* @param parent
* the parent composite
* @param label
- * the lable to display
+ * the label to display
* @param modifyListener
* a {@link ModifyListener} to listen on events on the text, can
* be null
}
/**
- * Creates one label and a text field not editable with background color of
+ * Creates one label and a text field not editable with background colour of
* the parent (like a label but with selectable text)
*/
public static Text createGridLL(Composite parent, String label, String text) {
*/
package org.argeo.eclipse.ui.dialogs;
-import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IMessageProvider;
import org.eclipse.jface.dialogs.TitleAreaDialog;
+import org.eclipse.jface.window.Window;
import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
public static String ask(String label, String message) {
SingleValue svd = new SingleValue(label, message);
- if (svd.open() == Dialog.OK)
+ if (svd.open() == Window.OK)
return svd.getString();
else
return null;
public static Long askLong(String label, String message) {
SingleValue svd = new SingleValue(label, message);
- if (svd.open() == Dialog.OK)
+ if (svd.open() == Window.OK)
return svd.getLong();
else
return null;
public static Double askDouble(String label, String message) {
SingleValue svd = new SingleValue(label, message);
- if (svd.open() == Dialog.OK)
+ if (svd.open() == Window.OK)
return svd.getDouble();
else
return null;
public static boolean setJcrProperty(Node node, String propName,
int propertyType, Object value) {
try {
- // int propertyType = getPic().getProperty(propName).getType();
switch (propertyType) {
case PropertyType.STRING:
if ("".equals((String) value)
/**
* Creates a new selection adapter in order to provide sorting abitily on a
- * swt table that display a row list
+ * SWT Table that display a row list
**/
public static SelectionAdapter getRowSelectionAdapter(final int index,
final int propertyType, final String selectorName,
+++ /dev/null
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package org.argeo.eclipse.ui.jcr.views;
-
-
-@ Deprecated
-public abstract class AbstractJcrBrowser {}
-
-// public abstract class AbstractJcrBrowser extends ViewPart {
-//
-// @Override
-// public abstract void createPartControl(Composite parent);
-//
-// /**
-// * To be overridden to adapt size of form and result frames.
-// */
-// abstract protected int[] getWeights();
-//
-// /**
-// * To be overridden to provide an adapted size nodeViewer
-// */
-// abstract protected TreeViewer createNodeViewer(Composite parent,
-// ITreeContentProvider nodeContentProvider);
-//
-// /**
-// * To be overridden to retrieve the current nodeViewer
-// */
-// abstract protected TreeViewer getNodeViewer();
-//
-// /*
-// * Enables the refresh of the tree.
-// */
-// @Override
-// public void setFocus() {
-// getNodeViewer().getTree().setFocus();
-// }
-//
-// public void refresh(Object obj) {
-// // getNodeViewer().update(obj, null);
-// getNodeViewer().refresh(obj);
-// // getNodeViewer().expandToLevel(obj, 1);
-// }
-//
-// public void nodeAdded(Node parentNode, Node newNode) {
-// getNodeViewer().refresh(parentNode);
-// getNodeViewer().expandToLevel(newNode, 0);
-// }
-//
-// public void nodeRemoved(Node parentNode) {
-// IStructuredSelection newSel = new StructuredSelection(parentNode);
-// getNodeViewer().setSelection(newSel, true);
-// // Force refresh
-// IStructuredSelection tmpSel = (IStructuredSelection) getNodeViewer()
-// .getSelection();
-// getNodeViewer().refresh(tmpSel.getFirstElement());
-// }
-// }
/**
* Creates a basic column for the given table. For the time being, we do not
- * support moveable columns.
+ * support movable columns.
*/
public static TableColumn createColumn(Table parent, String name,
int style, int width) {
/**
* Creates a TableViewerColumn for the given viewer. For the time being, we
- * do not support moveable columns.
+ * do not support movable columns.
*/
public static TableViewerColumn createTableViewerColumn(TableViewer parent,
String name, int style, int width) {
/**
* Creates a TreeViewerColumn for the given viewer. For the time being, we
- * do not support moveable columns.
+ * do not support movable columns.
*/
public static TreeViewerColumn createTreeViewerColumn(TreeViewer parent,
String name, int style, int width) {